/* * $Log: V:/Flite/archives/TrueFFS5/Src/FLBASE.H_V $ * * Rev 1.19 Apr 15 2002 07:36:18 oris * Moved all include directive to head of file. * Moved OS names definitions to mtdsa.h * Changed flBusConfig environment array to dword variables instead of single byte. * Added support for VERIFY_ERASED_SECTOR compilation flag. * * Rev 1.18 Feb 19 2002 20:59:28 oris * Changed order of include directives. * * Rev 1.17 Jan 29 2002 20:08:08 oris * Added NAMING_CONVENTION prefix and extern "C" for cpp files to all public routines: * tffsset, tffscmp and tffsset. * * Rev 1.16 Jan 20 2002 20:26:42 oris * Added casting to byte to FL_GET_PARTITION_FROM_HANDLE and to FL_GET_SOCKET_FROM_HANDLE * * Rev 1.15 Jan 17 2002 23:00:42 oris * Removed MAX and MIN definitions and replaced them with TFFSMIN and TFFSMAX. * Added extern for the following environment variables: * extern dword flSectorsVerifiedPerFolding; * extern byte flSuspendMode; * extern byte flBusConfig[SOCKETS]; * Changed the following environment variables * extern byte flVerifyWrite[SOCKETS][MAX_TL_PARTITIONS<<1] - 4 for disk partition 3 for binary and one for the rest. * extern byte flPolicy[SOCKETS][MAX_TL_PARTITIONS] - 1 for each disk partition. * Changed all environment variables to byte (except for flSectorsVerifiedPerFolding) * Added FL_UPS for flVerifyWrite * Added FL_SUSPEND_WRITE and FL_SUSPEND_IO for flSuspendMode. * Added define CUR_OS_WINCE for boot SDK customization. * Exchanged CUR_OS_VX_WORKS and CUR_NO_OS * Added FL_GET_SOCKET_FROM_HANDLE and FL_GET_PARTITION_FROM_HANDLE instead of HANDLE_VOLUME_MASK and HANDLE_PARTITION_MASK. * * Rev 1.14 Nov 21 2001 11:38:52 oris * Removed FL_MULTI_DOC_NOT_ACTIVE , FL_MULTI_DOC_ACTIVE , FL_DO_NOT_MARK_DELETE , FL_MARK_DELETE , FL_WITHOUT_VERIFY_WRITE , FL_WITH_VERIFY_WRITE definition (unsing FL_ON and FL_OFF instead). * * Rev 1.13 Nov 08 2001 10:49:14 oris * Moved environment variable states definitions from blockdev.h * Added flVerifyWrite environment variable that controls the verify write mode at run-time. * * Rev 1.12 Sep 15 2001 23:45:40 oris * Changed BIG_ENDIAN to FL_BIG_ENDIAN * Changed checkStatus definition in order not to get compilation warnings. * * Rev 1.11 Jul 29 2001 16:44:16 oris * Added CUR_OS_NO definition * * Rev 1.10 May 21 2001 16:09:52 oris * Removed flsleep prototype and moved tffscpy tffscmp and tffsset prototypes under USE_STD_FUNC copmpilation flag. * * Rev 1.9 May 21 2001 13:51:06 oris * Reorganized and added the CUS_OS_DOS, CUS_OS_PSOS and CUS_OS_VX_WORKS defintions. * * Rev 1.8 May 16 2001 21:17:38 oris * Added the FL_ prefix to the following defines: ON, OFF * Changed c variable name to cval (avoid name clashes). * Added flMtlDefragMode environment variable forward definition. * * Rev 1.7 Apr 30 2001 18:00:32 oris * Added new environment variable flMarkDeleteOnFlash declaration. * * Rev 1.6 Apr 10 2001 23:53:54 oris * Added flAddLongToFarPointer declaration for the standalone version. * * Rev 1.5 Apr 09 2001 15:01:56 oris * UNAL4(arg) definition was changed. * * Rev 1.4 Apr 01 2001 07:51:46 oris * copywrite notice. * Moved MIN,MAX,BYTE_ADD_FAR,WORD_ADD_FAR macroes from base2400.c. * Moved protection attributes definition to flflash.h. * Aliggned left all # directives. * Added FAR0 to cpyBuffer,setBuffer,cmpBuffer,flmemcpy,flmemset and flmemcmp * * Rev 1.3 Feb 18 2001 14:18:02 oris * remove osak version redundent definition. * * Rev 1.2 Feb 14 2001 02:12:08 oris * Added flMaxUnitChain environment variable. * Changed flUseMultiDoc and flPolicy variables type and names. * * Rev 1.1 Feb 05 2001 18:45:20 oris * Removed flcustm.h include directive since it is already included in mtdsa.h * Added flchkdef.h include directive for sanity check on compilation flags. * * Rev 1.0 Feb 04 2001 11:14:30 oris * Initial revision. * */ /***********************************************************************************/ /* M-Systems Confidential */ /* Copyright (C) M-Systems Flash Disk Pioneers Ltd. 1995-2001 */ /* All Rights Reserved */ /***********************************************************************************/ /* NOTICE OF M-SYSTEMS OEM */ /* SOFTWARE LICENSE AGREEMENT */ /* */ /* THE USE OF THIS SOFTWARE IS GOVERNED BY A SEPARATE LICENSE */ /* AGREEMENT BETWEEN THE OEM AND M-SYSTEMS. REFER TO THAT AGREEMENT */ /* FOR THE SPECIFIC TERMS AND CONDITIONS OF USE, */ /* OR CONTACT M-SYSTEMS FOR LICENSE ASSISTANCE: */ /* E-MAIL = info@m-sys.com */ /***********************************************************************************/ #ifndef FLBASE_H #define FLBASE_H /***************************************************************************/ /* */ /* Include customization files */ /* Note the following files are used for : */ /* mtdsa.h - Complete customization - standaloe applications */ /* like Binary SDK */ /* flsystem.h - System customization - TrueFFS applications like drivers */ /* flchkdef.h - Customized defintion check of TrueFFS applications. */ /* */ /***************************************************************************/ #include "mtdsa.h" #ifndef MTD_STANDALONE #include "flcustom.h" #include "flsystem.h" #include "flchkdef.h" #endif /* MTD_STANDALONE */ #include "flstatus.h" /* Number of translation layer partitions * * Defines Maximum Number of Traslation layer partitons on a physical device * * The actual number of partitions depends on the format placed on each device. */ #define MAX_TL_PARTITIONS 4 /* Sector size * * Define the log2 of sector size for the FAT & translation layers. Note * that the default 512 bytes is the de-facto standard and practically * the only one that provides real PC interoperability. */ #define SECTOR_SIZE_BITS 9 /* standard type definitions */ typedef int FLBoolean; /* Boolean constants */ #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif #ifndef FL_ON #define FL_ON 1 #endif #ifndef FL_OFF #define FL_OFF 0 #endif /* Geral purpose macroes */ #define BYTE_ADD_FAR(x,y) ((byte FAR1 *)addToFarPointer(x,y)) #define WORD_ADD_FAR(x,y) ((word FAR1 *)addToFarPointer(x,y)) /* Drive handle masks */ #define FL_GET_SOCKET_FROM_HANDLE(ioreq) (byte)(ioreq->irHandle & 0x0f) #define FL_GET_PARTITION_FROM_HANDLE(ioreq) (byte)((ioreq->irHandle & 0xf0) >> 4) #define INVALID_VOLUME_NUMBER 0xff #define TL_SIGNATURE 6 /* General types definitions */ typedef unsigned char byte; /* 8 bit unsigned variable */ typedef unsigned short word; /* 16 bit unsigned variable */ typedef unsigned long dword; /* 32 bit unsigned variable */ typedef signed char Sbyte; /* 8 bit signed variable */ typedef signed short Sword; /* 16 bit signed variable */ typedef signed long Sdword; /* 32 bit signed variable */ #define SECTOR_SIZE (1 << SECTOR_SIZE_BITS) #define BITS_PER_BITE 8 /* General purpose Macroes adjusted according to the above customization files. */ /* define SectorNo range according to media maximum size */ #if (MAX_VOLUME_MBYTES * 0x100000l) / SECTOR_SIZE > 0x10000l typedef unsigned long SectorNo; #define UNASSIGNED_SECTOR 0xffffffffl #else typedef unsigned short SectorNo; #define UNASSIGNED_SECTOR 0xffff #endif /* x86 pointer far level dictated several of the TrueFFS pointers types. */ #if FAR_LEVEL > 0 #define FAR0 far #else #define FAR0 #endif #if FAR_LEVEL > 1 #define FAR1 far #else #define FAR1 #endif #if FAR_LEVEL > 2 #define FAR2 far #else #define FAR2 #endif /* Call a procedure returning status and fail if it fails. This works only in */ /* routines that return Status: */ #define checkStatus(exp) { FLStatus fl__status = (exp);if (fl__status != flOK) return fl__status; } #define vol (*pVol) #define TFFSMIN(a,b) ((a>b) ? b:a) #define TFFSMAX(a,b) ((a