📄 flchkdef.h
字号:
/* When using static allocation , SAFTL may requires the number of sectors
* in a logical unit. This value can normally be deduced from the unit size.
* However if you need to support several DiskOnChip devices with different
* unit sizes, you may need to define the smallest unit size, while defining
* the largest number of logical sectors in a logical unit
*/
#ifndef FL_ASSUMED_MAX_SECTORS_PER_UNIT
#define FL_ASSUMED_MAX_SECTORS_PER_UNIT (FL_ASSUMED_MIN_UNIT_SIZE>>FL_SECTOR_SIZE_BITS)
#endif /* FL_ASSUMED_MAX_SECTORS_PER_UNIT */
/* Validity check for FL_LOW_LEVEL compilation flag.
*
* Starting from TrueFFS 5.1 the LOW_LEVEL was changed to FL_LOW_LEVEL
* The reason was that it clashed with Windows NT LOW_LEVEL macro.
*/
#ifndef FL_LOW_LEVEL
#ifdef LOW_LEVEL
#define FL_LOW_LEVEL
#endif /* LOW_LEVEL */
#endif /* FL_LOW_LEVEL */
#if !defined(FL_ABS_READ_WRITE) && !defined(FS_ABS_READ_WRITE) && defined(ABS_READ_WRITE)
#define FL_ABS_READ_WRITE
#define FS_ABS_READ_WRITE
#endif
/* Validity check for FL_SYS_FUNC_RELEASE
*
* Starting from TrueFFS 6.0 the flExit routine calls this macro in
* order to inform the OS/FS that it is about to leave.
*/
#ifndef FL_SYS_FUNC_RELEASE
#define FL_SYS_FUNC_RELEASE
#endif /* FL_SYS_FUNC_RELEASE */
#if !defined(FL_EXIT) && !defined(FS_EXIT) && defined(EXIT)
#define FL_EXIT
#define FS_EXIT
#endif
/* Validity check for FL_LOWER_PRIORITY_THREAD and FL_RAISE_PRIORITY_THREAD
*
* Starting from TrueFFS 6.0-6.2.2 the MTD waitForReady routine calls the
* FL_LowerPriorityThread and FL_RaisePriorityThread macros allowing the OS
* to lower the driver's priority during the long wait.
*
* After 6.2.2 the name of the macros was changed to all upper case.
*/
#ifndef FL_LOWER_PRIORITY_THREAD
#ifdef FL_LowerPriorityThread
/*** Add support for older flsystem that use FL_Raise/LowerPriorityThread macros ***/
#define FL_LOWER_PRIORITY_THREAD FL_LowerPriorityThread
#else
#define FL_LOWER_PRIORITY_THREAD(myFlash)
#endif /* FL_LowerPriorityThread */
#endif /* FL_LOWER_PRIORITY_THREAD */
#ifndef FL_RAISE_PRIORITY_THREAD
#ifdef FL_RaisePriorityThread
/*** Add support for older flsystem that use FL_Raise/LowerPriorityThread macros ***/
#define FL_RAISE_PRIORITY_THREAD FL_RaisePriorityThread
#else
#define FL_RAISE_PRIORITY_THREAD(myFlash)
#endif /* FL_RaisePriorityThread */
#endif /* FL_RAISE_PRIORITY_THREAD */
#ifndef FL_LowerPriorityThread
#define FL_LowerPriorityThread(myFlash)
#endif /* FL_LowerPriorityThread */
#ifndef FL_RaisePriorityThread
#define FL_RaisePriorityThread(myFlash)
#endif /* FL_RaisePriorityThread */
/* Validity check for FL_TFFS_SLEEP
*
* Note that this routine used to be called flsleep, but it's name was
* greater resolution was required.
*/
#ifndef FL_TFFS_SLEEP
#define FL_TFFS_SLEEP(flash,microseconds)
#endif /* FL_TFFS_SLEEP */
/* Validity check for FL_READ_ONLY
*
* When Block device does not support write operations, also file system
* cannot write. Therefore, if BD read only is set - also FS read only must be set.
*/
#ifdef FL_READ_ONLY
#define FS_READ_ONLY
#endif /*FS_READ_ONLY*/
/* Validity check for FL_MALLOC and FL_FREE macros
*
* Starting from TrueFFS 5.0 the FREE and MALLOC macroes were
* changed to FL_MALLOC and FL_FREE in order to avoid name clashes.
* In order to keep backwards compatibility with previous flsystem.h
* files the following new defintions checks were added.
* if your system uses the FREE and MALLOC defintion simply comment
* them out and customized the FL_MALLOC and FL_FREE macroes in your
* flsystem.h file.
*/
#if (defined(MALLOC) && !defined(FL_MALLOC))
#define FL_MALLOC MALLOC
#endif /* MALLOC && ! FL_MALLOC */
#if (defined(FREE) && !defined(FL_FREE))
#define FL_FREE FREE
#endif /* FREE && ! FL_FREE */
/* Validity check for "subFromFarPointer" and "distanceBetweenFarPointers"
*
* Starting from TrueFFS 6.3.0 2 new memory manipulation macro's were
* introduced for none flat memory architecture. They should be used when
* memory pointers are being subtracted or a difference between 2 pointers
* is needed
*/
#ifndef subFromFarPointer
#define subFromFarPointer(base,increment) \
addToFarPointer(base,(-(FLSDword)(increment)))
#endif /* subFromFarPointer */
#ifndef distanceBetweenFarPointers
#define distanceBetweenFarPointers(ptr1, ptr2) \
(((FLDword)(ptr1)) - ((FLDword)(ptr2)))
#endif /* distanceBetweenFarPointers */
/* Validity check for FL_FAR_MALLOC and FL_FAR_FREE
*
* Due to the BIOS driver memory limitations a dedicated routine
* is used for allocating the large ram arrays.
*/
#if (defined(FL_MALLOC) && !defined(FL_FAR_MALLOC))
#define FL_FAR_MALLOC FL_MALLOC
#endif /* FL_MALLOC && ! FL_FAR_MALLOC */
#if (defined(FL_FREE) && !defined(FL_FAR_FREE))
#define FL_FAR_FREE FL_FREE
#endif /* FL_MALLOC && ! FL_FAR_MALLOC */
#ifndef FL_MALLOC_DMA_BUFFER
#define FL_MALLOC_DMA_BUFFER FL_FAR_MALLOC
#endif
#ifndef FL_FREE_DMA_BUFFER
#define FL_FREE_DMA_BUFFER FL_FAR_FREE
#endif
/* Validity check for debug printing
*
* Starting from TrueFFS 6.0 there are 6 types of debug print
* In case they were not customized in flsystem.h they are defined here
* as NULL.
*/
#ifndef DBG_PRINT_FLOW
#define DBG_PRINT_FLOW(zone,str) /* if (zone & (ACTIVE_DEBUG_ZONE)) printf (str) */
#endif
#ifndef DBG_PRINT_ERR
#define DBG_PRINT_ERR(zone,str) /* if (zone & (ACTIVE_DEBUG_ZONE)) printf (str) */
#endif
#ifndef DBG_PRINT_WRN
#define DBG_PRINT_WRN(zone,str) /* if (zone & (ACTIVE_DEBUG_ZONE)) printf (str) */
#endif
#ifndef DBG_PRINT_FLOW_PRM
#define DBG_PRINT_FLOW_PRM(zone,str) /* if (zone & (ACTIVE_DEBUG_ZONE)) printf str */
#endif
#ifndef DBG_PRINT_ERR_PRM
#define DBG_PRINT_ERR_PRM(zone,str) /* if (zone & (ACTIVE_DEBUG_ZONE)) printf str */
#endif
#ifndef DBG_PRINT_WRN_PRM
#define DBG_PRINT_WRN_PRM(zone,str) /* if (zone & (ACTIVE_DEBUG_ZONE)) printf str */
#endif
#ifndef DBG_PRINT_ATA
#define DBG_PRINT_ATA DBG_PRINT_ERR_PRM
#endif /*DBG_PRINT_ATA*/
#ifndef DFORMAT_PRINT
#define DFORMAT_PRINT(a) DBG_PRINT_WRN_PRM(FLZONE_FORMAT,a)
#endif
#ifndef DEBUG_PRINT
#define DEBUG_PRINT(a) DBG_PRINT_WRN(FLZONE_FULL,a)
#endif
/* For backwards compatibility we make sure tffsxxx is defined as flxxx
*
* Versions prior to 6.1 (when ENVIRONMENT_VARS was defined) the user was
* required to customize 2 sets of DiskOnChip memory access routines.
* (flxxx and flmemxxx). One set was for fast memory access and one
* implemented a simple for loop for maximum platform portability. Newer
* versions automatically implement the simple for loop allowing easier
* customization. The new customization model allows the user to customize
* only the tffsxxx routines regardless of the compilation flag
*/
#if !defined(FL_ENVIRONMENT_VARS) && defined(ENVIRONMENT_VARS)
#define FL_ENVIRONMENT_VARS
#endif
#ifdef FL_ENVIRONMENT_VARS
#ifndef tffscpy
#define tffscpy flcpy
#endif /* tffscpy */
#ifndef tffscmp
#define tffscmp flcmp
#endif /* tffscmp */
#ifndef tffsset
#define tffsset flset
#endif /* tffsset */
#endif /* FL_ENVIRONMENT_VARS */
/* Macro for converting text to string */
#ifndef FLTXT
#define FLTXT
#endif /* FLTXT */
/*****************************/
/* M-Systems forced defaults */
/*****************************/
/* define IO memory access macros - must be defined in flsystem.h */
#ifndef FLWRITE_IO_BYTE
#define FLWRITE_IO_BYTE(val,address) *((volatile FLByte FAR0*)(address))=(FLByte)(val)
#endif
#ifndef FLWRITE_IO_WORD
#define FLWRITE_IO_WORD(val,address) *((volatile FLWord FAR0*)(address))=(FLWord)(val)
#endif
#ifndef FLWRITE_IO_DWORD
#define FLWRITE_IO_DWORD(val,address) *((volatile FLDword FAR0*)(address))=(FLDword)(val)
#endif
#ifndef TFFSCPY_FROM_IO_8_BITS
#ifdef TFFSCPY_FROM_IO
#define TFFSCPY_FROM_IO_8_BITS TFFSCPY_FROM_IO
#else
#define TFFSCPY_FROM_IO_8_BITS(dest,src,count) tffscpy(dest,(void FAR0*)(src),count)
#endif
#endif /* TFFSCPY_FROM_IO_8_BITS */
#ifndef TFFSCPY_FROM_IO_16_BITS
#ifdef TFFSCPY_FROM_IO
#define TFFSCPY_FROM_IO_16_BITS TFFSCPY_FROM_IO
#else
#define TFFSCPY_FROM_IO_16_BITS(dest,src,count) tffscpy(dest,(void FAR0*)(src),count)
#endif
#endif /* TFFSCPY_FROM_IO_16_BITS */
#ifndef FLREAD_IO_BYTE
#define FLREAD_IO_BYTE(address) (*((volatile FLByte FAR0*)(address)))
#endif
#ifndef FLREAD_IO_WORD
#define FLREAD_IO_WORD(address) (*((volatile FLWord FAR0*)(address)))
#endif
#ifndef FLREAD_IO_DWORD
#define FLREAD_IO_DWORD(address) (*((volatile FLDword FAR0*)(address)))
#endif
#ifndef TFFSCPY_TO_IO_8_BITS
#ifdef TFFSCPY_TO_IO
#define TFFSCPY_TO_IO_8_BITS TFFSCPY_TO_IO
#else
#define TFFSCPY_TO_IO_8_BITS(dest,src,count) tffscpy((void FAR0*)(dest),src,count)
#endif
#endif /* TFFSCPY_TO_IO_8_BITS */
#ifndef TFFSCPY_TO_IO_16_BITS
#ifdef TFFSCPY_TO_IO
#define TFFSCPY_TO_IO_16_BITS TFFSCPY_TO_IO
#else
#define TFFSCPY_TO_IO_16_BITS(dest,src,count) tffscpy((void FAR0*)(dest),src,count)
#endif
#endif /* TFFSCPY_TO_IO_16_BITS */
#ifndef TFFSSET_IO_8_BITS
#ifdef TFFSSET_IO
#define TFFSSET_IO_8_BITS TFFSSET_IO
#else
#define TFFSSET_IO_8_BITS(dest,val,count) tffsset((void FAR0*)(dest),val,count)
#endif
#endif /* TFFSSET_IO_8_BITS */
#ifndef TFFSSET_IO_16_BITS
#ifdef TFFSSET_IO
#define TFFSSET_IO_16_BITS TFFSSET_IO
#else
#define TFFSSET_IO_16_BITS(dest,val,count) tffsset((void FAR0*)(dest),val,count)
#endif
#endif /* TFFSSET_IO_16_BITS */
/* The FAT-LITE/SURE-FS API definitions were added the FL_ prefix.
*
* Starting from TrueFFS 6.2
*/
#ifndef FS_FILES
#ifdef FILES
#define FS_FILES FILES
#endif /* FILES */
#ifdef FL_FILES
#define FS_FILES FL_FILES
#endif /* FL_FILES */
#endif /* FS_FILES */
#if defined(FS_FILES) && (FS_FILES <= 0)
#undef FS_FILES
#endif
#if defined(FS_MAX_FSOS) && ((FS_MAX_FSOS <= 0) || !defined(FS_FILES))
#undef FS_MAX_FSOS
#endif
#if defined(FS_SUPPORT_FILE_CACHE) && !defined(FS_MAX_FSOS)
#undef FS_SUPPORT_FILE_CACHE
/* you need FSOs to define the cache size per file type */
#endif
#if defined(FS_SUPPORT_FILE_CACHE) && !defined(FL_EXTENDED_SECTOR_CACHE)
#define FL_EXTENDED_SECTOR_CACHE
#endif
#if defined(FS_MAX_FSOS) && !defined(FS_MM_PERFORMANCE_TUNEUPS)
#define FS_MM_PERFORMANCE_TUNEUPS
#endif
#if defined(FS_MAX_FSOS) && !defined(STATIC_FS_DB)
#if FS_MAX_FSOS >= 2
#define STATIC_FS_DB = { DEFAULT_FILE(0, 0), DEFINE_FSO(NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) }
#else
#define STATIC_FS_DB = { DEFAULT_FILE(0, 0) }
#endif
#endif
#if defined(SUB_DIRECTORY) && !defined(FS_SUB_DIRECTORY)
#define FS_SUB_DIRECTORY
#endif
#if defined(RENAME_FILE) && !defined(FS_RENAME_FILE)
#define FS_RENAME_FILE
#endif
#ifndef FILE_IS_ROOT_DIR
#define FILE_IS_ROOT_DIR FL_FILE_IS_ROOT_DIR
#endif
#ifndef FILE_MODIFIED
#define FILE_MODIFIED FL_FILE_MODIFIED
#endif
#ifndef FILE_IS_OPEN
#define FILE_IS_OPEN FL_FILE_IS_OPEN
#endif
#ifndef FILE_IS_DIRECTORY
#define FILE_IS_DIRECTORY FL_FILE_IS_DIRECTORY
#endif
#ifndef FILE_READ_ONLY
#define FILE_READ_ONLY FL_FILE_READ_ONLY
#endif
#ifndef FILE_MUST_OPEN
#define FILE_MUST_OPEN FL_FILE_MUST_OPEN
#endif
#if defined(FL_TRANSLATE_FROM_UNICODE) && defined(FL_TRANSLATE_TO_UNICODE)
#define FILENAMES_INTERNAL_UNICODE_CONVERSION /* user-defined functions */
#elif defined(FL_LONG_FILENAMES_ASCII_SUPPORT)
#define FL_TRANSLATE_FROM_UNICODE unicodeToAscii
#define FL_TRANSLATE_TO_UNICODE asciiToUnicode
#define FILENAMES_INTERNAL_UNICODE_CONVERSION
#elif defined(FL_LONG_FILENAMES_UTF8_SUPPORT)
#define FL_TRANSLATE_FROM_UNICODE unicodeToUTF8
#define FL_TRANSLATE_TO_UNICODE UTF8ToUnicode
#define FILENAMES_INTERNAL_UNICODE_CONVERSION
#endif
#if defined(FL_EXTENDED_SECTOR_CACHE) && (!defined(FS_FILES) || (FS_FILES == 0))
#undef FL_EXTENDED_SECTOR_CACHE
#endif
#if defined(FL_EXTENDED_SECTOR_CACHE) && !defined(FS_DATA_CACHE_SIZE)
#define FS_DATA_CACHE_SIZE(socket, partition, logPartition) 200
#endif
#if defined(FAT_12BIT) && !defined(FS_FAT_12BIT)
#define FS_FAT_12BIT
#endif
/******************************** MTD Macros ********************************************/
#ifndef FL_CHANGE_READ_ACCESS_TIME
#define FL_CHANGE_READ_ACCESS_TIME(wTimeNanoSec,socket)
#endif /* FL_CHANGE_READ_ACCESS_TIME */
/****************************************************************************************/
/******************************* M I G R A T I O N M A C R O S ***********************/
/****************************************************************************************/
/* Maximum number of supported DOCHs */
/*===================================*/
#ifndef DOCH_MAX_SOCKETS
#ifdef FL_SOCKETS
#define DOCH_MAX_SOCKETS FL_SOCKETS
#else /*FL_SOCKETS*/
#define DOCH_MAX_SOCKETS 1
#endif /*FL_SOCKETS*/
#endif /*DOCH_MAX_SOCKETS*/
/*
* Length of DOCH register 'read' cycle in nanoseconds (default value should
* do for most systems).
*/
#ifndef DOCH_ACCESS_NANOSEC
#define DOCH_ACCESS_NANOSEC 15
#endif /*DOCH_ACCESS_NANOSEC*/
#ifndef DOCH_SPI_ACCESS_NANOSEC
#define DOCH_SPI_ACCESS_NANOSEC 150000
#endif /*DOCH_SPI_ACCESS_NANOSEC*/
/* Host CPU ENDIANESS */
/*====================*/
#ifndef DOCH_BIG_ENDIAN
#ifdef FL_BIG_ENDIAN
#define DOCH_BIG_ENDIAN
#endif /*FL_BIG_ENDIAN*/
#endif /*DOCH_BIG_ENDIAN*/
/* */
/*=*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -