📄 fs_int.h
字号:
#define FS_LOCK_DRIVER(pDevice) FS_OS_LockDriver(pDevice)
#define FS_UNLOCK_DRIVER(pDevice) FS_OS_UnlockDriver(pDevice)
void FS_OS_LockDriver (const FS_DEVICE * pDevice);
void FS_OS_UnlockDriver(const FS_DEVICE * pDevice);
#define FS_OS_GETNUM_DRIVERLOCKS() FS_OS_GetNumDriverLocks()
#define FS_OS_GETNUM_SYSLOCKS() 1
unsigned FS_OS_GetNumDriverLocks(void);
#define FS_OS_ADD_DRIVER(pDevice) FS_OS_AddDriver(pDevice)
void FS_OS_AddDriver(const FS_DEVICE_TYPE * pDriver);
#define FS_OS_INIT(MaxNumLocks) FS_X_OS_Init(MaxNumLocks)
#endif
/*********************************************************************
*
* FS_JOURNAL
*
*/
int FS_JOURNAL_Begin(FS_VOLUME * pVolume);
int FS_JOURNAL_End (FS_VOLUME * pVolume);
void FS_JOURNAL_Delete(FS_VOLUME * pVolume, U32 LastSectorInFS);
void FS_JOURNAL_Invalidate(FS_VOLUME * pVolume);
#if FS_SUPPORT_JOURNAL
#define FS_JOURNAL_BEGIN(pVolume) FS_JOURNAL_Begin(pVolume)
#define FS_JOURNAL_END(pVolume) FS_JOURNAL_End (pVolume)
#define FS_JOURNAL_MOUNT(pVolume) FS_JOURNAL_Mount(pVolume)
#define FS_JOURNAL_DELETE(pVolume, LastSector) FS_JOURNAL_Delete(pVolume, LastSector)
#define FS_JOURNAL_INVALIDATE(pVolume) FS_JOURNAL_Invalidate(pVolume)
#else
#define FS_JOURNAL_BEGIN(pVolume) FS_USE_PARA(pVolume)
#define FS_JOURNAL_END(pVolume) FS_USE_PARA(pVolume)
#define FS_JOURNAL_MOUNT(pVolume)
#define FS_JOURNAL_DELETE(pVolume, LastSector)
#define FS_JOURNAL_INVALIDATE(pVolume)
#endif
/*********************************************************************
*
* API mapping macros
*
* These macros map to the functions of the file system (Currently FAT or EFS)
* or - in case of multiple file systems - to a mapping layer, which calls the
* appropriate function depending on the filesystem of the volume
*
**********************************************************************
*/
#define FS_IOCTL( pDevice, Cmd, Aux, pBuffer) FS_LB_Ioctl(pDevice, Cmd, Aux, pBuffer)
#if (FS_SUPPORT_FAT) && (! FS_SUPPORT_EFS)
#define FS_CHECK_INFOSECTOR(pVolume) FS_FAT_CheckBPB(pVolume)
#define FS_CLOSEDIR(pDir) FS_FAT_CloseDir(pDir);
#define FS_CREATEDIR(pVolume, s) FS_FAT_CreateDir(pVolume, s)
#define FS_CLOSE_FILE( hFile) FS_FAT_Close(hFile)
#define FS_OPEN_FILE( s, pFile, DoDel, DoOpen, DoCreate) FS_FAT_Open(s, pFile, DoDel, DoOpen, DoCreate)
#define FS_FORMAT( pVolume, pFormatInfo) FS_FAT_Format(pVolume, pFormatInfo)
#define FS_FREAD( pFile, pData, NumBytes) FS_FAT_Read(pFile, pData, NumBytes)
#define FS_FWRITE( pFile, pData, NumBytes) FS_FAT_Write(pFile, pData, NumBytes)
#define FS_GETDIRENTRYINFO(pVolume, sName, p, Mask) FS_FAT_GetDirEntryInfo(pVolume, sName, p, Mask)
#define FS_GET_DISKINFO( pVolume, pInfo) FS_FAT_GetDiskInfo(pVolume, pInfo)
#define FS_MOVE( sSrc, sDest, pVolume) FS_FAT_Move(sSrc, sDest, pVolume)
#define FS_OPENDIR( s, pDirHandle) FS_FAT_OpenDir(s, pDirHandle)
#define FS_READDIR( pDir, pDirEntryInfo) FS_FAT_ReadDir(pDir, pDirEntryInfo)
#define FS_REMOVEDIR(pVolume, s) FS_FAT_RemoveDir(pVolume, s)
#define FS_RENAME( s, sNewName, pVolume) FS_FAT_Rename(s, sNewName, pVolume)
#define FS_SETDIRENTRYINFO(pVolume, sName, p, Mask) FS_FAT_SetDirEntryInfo(pVolume, sName, p, Mask)
#define FS_SET_END_OF_FILE(pFile) FS_FAT_SetEndOfFile(pFile)
#define FS_UNMOUNT( pVolume) FS_FAT_Unmount(pVolume)
#define FS_GET_VOLUME_LABEL(pVolume, pVolLabel, VolLabelSize) FS_FAT_GetVolumeLabel(pVolume, pVolLabel, VolLabelSize)
#define FS_SET_VOLUME_LABEL(pVolume, pVolLabel) FS_FAT_SetVolumeLabel(pVolume, pVolLabel)
#define FS_CREATE_JOURNAL_FILE(pVolume, NumBytes, pFirstS, pNumS) FS_FAT_CreateJournalFile(pVolume, NumBytes, pFirstS, pNumS)
#define FS_OPEN_JOURNAL_FILE(pVolume) FS_FAT_OpenJournalFile(pVolume)
#define FS_GET_INDEX_OF_LAST_SECTOR(pVolume) FS_FAT_GetIndexOfLastSector(pVolume)
#define FS_CHECKDISK(pVolume, pDiskInfo, pBuffer, BufferSize, MaxRecursionLevel, pfOnError) FS_FAT__CheckDisk(pVolume, pDiskInfo, pBuffer, BufferSize, MaxRecursionLevel, pfOnError)
#elif (! FS_SUPPORT_FAT) && (FS_SUPPORT_EFS)
#define FS_CHECK_INFOSECTOR(pVolume) FS_EFS_CheckInfoSector(pVolume)
#define FS_CLOSEDIR( pDir) FS_EFS_CloseDir(pDir)
#define FS_CREATEDIR(pVolume, s) FS_EFS_CreateDir(pVolume, s)
#define FS_CLOSE_FILE( hFile) FS_EFS_Close(hFile)
#define FS_OPEN_FILE( s, pFile, DoDel, DoOpen, DoCreate) FS_EFS_Open(s, pFile, DoDel, DoOpen, DoCreate)
#define FS_FORMAT( pVolume, pFormatInfo) FS_EFS_Format(pVolume, pFormatInfo)
#define FS_FREAD( pFile, pData, NumBytes) FS_EFS_Read(pFile, pData, NumBytes)
#define FS_FWRITE( pFile, pData, NumBytes) FS_EFS_Write(pFile, pData, NumBytes)
#define FS_GETDIRENTRYINFO(pVolume, sName, p, Mask) FS_EFS_GetDirEntryInfo(pVolume, sName, p, Mask)
#define FS_GET_DISKINFO( pVolume, pInfo) FS_EFS_GetDiskInfo(pVolume, pInfo)
#define FS_MOVE( sSrc, sDest, pVolume) FS_EFS_Move(sSrc, sDest, pVolume)
#define FS_OPENDIR( s, pDirHandle) FS_EFS_OpenDir(s, pDirHandle)
#define FS_READDIR( pDir, pDirEntryInfo) FS_EFS_ReadDir(pDir, pDirEntryInfo)
#define FS_REMOVEDIR(pVolume, s) FS_EFS_RemoveDir(pVolume, s)
#define FS_RENAME( s, sNewName, pVolume) FS_EFS_Rename(s, sNewName, pVolume)
#define FS_SETDIRENTRYINFO(pVolume, sName, p, Mask) FS_EFS_SetDirEntryInfo(pVolume, sName, p, Mask)
#define FS_SET_END_OF_FILE(pFile) FS_EFS_SetEndOfFile(pFile)
#define FS_UNMOUNT(pVolume) FS_EFS_Unmount(pVolume)
#define FS_GET_VOLUME_LABEL(pVolume, pVolLabel, VolLabelSize) FS_EFS_GetVolumeLabel(pVolume, pVolLabel, VolLabelSize)
#define FS_SET_VOLUME_LABEL(pVolume, pVolLabel) FS_EFS_SetVolumeLabel(pVolume, pVolLabel)
#define FS_CREATE_JOURNAL_FILE(pVolume, NumBytes, pFirstS, pNumS) FS_EFS_CreateJournalFile(pVolume, NumBytes, pFirstS, pNumS)
#define FS_OPEN_JOURNAL_FILE(pVolume) FS_EFS_OpenJournalFile(pVolume)
#define FS_GET_INDEX_OF_LAST_SECTOR(pVolume) FS_EFS_GetIndexOfLastSector(pVolume)
#define FS_CHECKDISK(pVolume, pDiskInfo, pBuffer, BufferSize, MaxRecursionLevel, pfOnError) FS_EFS__CheckDisk(pVolume, pDiskInfo, pBuffer, BufferSize, MaxRecursionLevel, pfOnError)
#else
#error FS_SUPPORT_MULTIPLE_FS: Multiple simulanteous file systems not yet supported
#define FS_CHECK_INFOSECTOR(pVolume) FS_MAP_CheckFS_API(pVolume)
#define FS_CLOSEDIR( pDir) FS_MAP_CloseDir(pDir)
#define FS_CREATEDIR(pVolume, s) FS_MAP_CreateDir(pVolume, s)
#define FS_CLOSE_FILE( hFile) FS_MAP_Close(hFile)
#define FS_OPEN_FILE( s, pFile, DoDel, DoOpen, DoCreate) FS_MAP_Open(s, pFile, DoDel, DoOpen, DoCreate)
#define FS_FORMAT( pVolume, pFormatInfo) FS_MAP_Format(pVolume, pFormatInfo)
#define FS_FREAD( pFile, pData, NumBytes) FS_MAP_Read(pFile, pData, NumBytes)
#define FS_FWRITE( pFile, pData, NumBytes) FS_MAP_Write(pFile, pData, NumBytes)
#define FS_GETDIRENTRYINFO(pVolume, sName, p, Mask) FS_MAP_GetDirEntryInfo(pVolume, sName, p, Mask)
#define FS_GET_DISKINFO(pVolume, pInfo) FS_MAP_GetDirInfo(pVolume, pInfo)
#define FS_MOVE( sSrc, sDest, pVolume) FS_MAP_Move(sSrc, sDest, pVolume)
#define FS_OPENDIR( s, pDirHandle) FS_MAP_OpenDir(s, pDirHandle)
#define FS_READDIR( pDir) FS_MAP_ReadDir(pDir)
#define FS_REMOVEDIR(pVolume, s) FS_MAP_RemoveDir(pVolume, s)
#define FS_RENAME( s, sNewName, pVolume) FS_MAP_Rename(s, sNewName, pVolume)
#define FS_SETDIRENTRYINFO(pVolume, sName, p, Mask) FS_MAP_SetDirEntryInfo(pVolume, sName, p, Mask)
#define FS_SET_END_OF_FILE(pFile) FS_MAP_SetEndOfFile(pFile)
#define FS_UNMOUNT(pVolume) FS_MAP_Unmount(pVolume)
#define FS_GET_VOLUME_LABEL(pVolume, pVolLabel, VolLabelSize) FS_MAP_GetVolumeLabel(pVolume, pVolLabel, VolLabelSize)
#define FS_SET_VOLUME_LABEL(pVolume, pVolLabel) FS_MAP_SetVolumeLabel(pVolume, pVolLabel)
#define FS_CREATE_JOURNAL_FILE(pVolume, NumBytes, pFirstS, pNumS) FS_MAP_CreateJournalFile(pVolume, NumBytes, pFirstS, pNumS)
#define FS_GET_INDEX_OF_LAST_SECTOR(pVolume) FS_MAP_GetIndexOfLastSector(pVolume)
#define FS_CHECKDISK(pVolume, pDiskInfo, pBuffer, BufferSize, MaxRecursionLevel, pfOnError) FS_MAP_CheckDisk(pVolume, pDiskInfo, pBuffer, BufferSize, MaxRecursionLevel, pfOnError)
#endif
void FS_MAP_Close (FS_FILE * pFile);
int FS_MAP_CheckFS_API (FS_VOLUME * pVolume, U8 * pBuffer);
U32 FS_MAP_Read (FS_FILE * pFile, void * pData, U32 NumBytes);
U32 FS_MAP_Write (FS_FILE * pFile, const void * pData, U32 NumBytes);
char FS_MAP_Open (const char * pFileName, FS_FILE * pFile, char DoDel, char DoOpen, char DoCreate);
int FS_MAP_Format (FS_VOLUME * pVolume, FS_FORMAT_INFO * pFormatInfo);
int FS_MAP_OpenDir (const char * pDirName, FS_DIR * pDir);
int FS_MAP_CloseDir (FS_DIR * pDir);
FS_DIRENT * FS_MAP_ReadDir (FS_DIR * pDir);
int FS_MAP_RemoveDir (FS_VOLUME * pVolume, const char * pDirName);
int FS_MAP_CreateDir (FS_VOLUME * pVolume, const char * pDirName);
int FS_MAP_Rename (const char * sOldName, const char * sNewName, FS_VOLUME * pVolume);
int FS_MAP_Move (const char * sOldName, const char * sNewName, FS_VOLUME * pVolume);
char FS_MAP_SetDirEntryInfo(FS_VOLUME * pVolume, const char * sName, const void * p, int Mask);
char FS_MAP_GetDirEntryInfo(FS_VOLUME * pVolume, const char * sName, void * p, int Mask);
int FS_MAP_SetEndOfFile (FS_FILE * pFile);
void FS_MAP_Unmount (FS_VOLUME * pVolume);
int FS_MAP_GetDiskInfo (FS_VOLUME * pVolume, FS_DISK_INFO * pDiskData);
int FS_MAP_GetVolumeLabel (FS_VOLUME * pVolume, char * pVolumeLabel, unsigned VolumeLabelSize);
int FS_MAP_SetVolumeLabel (FS_VOLUME * pVolume, const char * pVolumeLabel);
/*********************************************************************
*
* CLIB
*
* Optional replacements for standard "C" library routines.
*
**********************************************************************
*/
int FS__CLIB_atoi (const char *s);
int FS__CLIB_memcmp (const void *s1, const void *s2, unsigned n);
void * FS__CLIB_memset (void *s, int c, U32 n);
int FS__CLIB_strcmp (const char *s1, const char *s2);
char * FS__CLIB_strcpy (char *s1, const char *s2);
unsigned FS__CLIB_strlen (const char *s);
int FS__CLIB_strncmp (const char *s1, const char *s2, int n);
char * FS__CLIB_strncpy (char *s1, const char *s2, U32 n);
int FS__CLIB_toupper (int c);
char * FS__CLIB_strcat (char *s1, const char *s2);
char * FS__CLIB_strncat (char *s1, const char *s2, U32 n);
#if FS_NO_CLIB
#define FS_ATOI(s) FS__CLIB_atoi(s)
#define FS_MEMCMP(s1,s2,n) FS__CLIB_memcmp(s1,s2,n)
#ifndef FS_MEMCPY
#define FS_MEMCPY(s1,s2,n) FS_memcpy(s1,s2,n)
#endif
#define FS_MEMSET(s,c,n) FS__CLIB_memset(s,c,n)
#define FS_STRCAT(s1,s2) FS__CLIB_strcat(s1, s2)
#define FS_STRCMP(s1,s2) FS__CLIB_strcmp(s1,s2)
#define FS_STRCPY(s1,s2) FS__CLIB_strcpy(s1,s2)
#define FS_STRLEN(s) FS__CLIB_strlen(s)
#define FS_STRNCAT(s1,s2,n) FS__CLIB_strncat(s1, s2, n)
#define FS_STRNCMP(s1,s2,n) FS__CLIB_strncmp(s1,s2,n)
#define FS_STRNCPY(s1,s2,n) FS__CLIB_strncpy(s1,s2,n)
#define FS_TOUPPER(c) FS__CLIB_toupper(c)
#else
#define FS_ATOI(s) atoi(s)
#define FS_MEMCMP(s1,s2,n) memcmp(s1,s2,n)
#ifndef FS_MEMCPY
#ifdef __ICCARM__
#define FS_MEMCPY(s1,s2,n) FS_memcpy(s1,s2,n)
#else
#define FS_MEMCPY(s1,s2,n) memcpy(s1,s2,n)
#endif
#endif
#define FS_MEMSET(s,c,n) memset(s,c,n)
#define FS_STRCAT(s1,s2) strcat(s1,s2)
#define FS_STRCMP(s1,s2) strcmp(s1,s2)
#define FS_STRCPY(s1,s2) strcpy(s1,s2)
#define FS_STRLEN(s) strlen(s)
#define FS_STRNCAT(s1,s2,n) strncat(s1, s2, n)
#define FS_STRNCMP(s1,s2,n) strncmp(s1,s2,n)
#define FS_STRNCPY(s1,s2,n) strncpy(s1,s2,n)
#define FS_TOUPPER(c) toupper(c)
#endif
/*********************************************************************
*
* FS_LB
*
* Logical block layer
*
**********************************************************************
*/
int FS_LB_GetStatus (const FS_DEVICE * pDevice);
U16 FS_GetSectorSize (const FS_DEVICE * pDevice);
int FS_LB_GetDeviceInfo (const FS_DEVICE * pDevice, FS_DEV_INFO * pDevInfo);
int FS_LB_InitMedium ( FS_DEVICE * pDevice);
int FS_LB_InitMediumIfRequired( FS_DEVICE * pDevice);
int FS_LB_Ioctl ( FS_DEVICE * pDevice, I32 Cmd, I32 Aux, void * pBuffer);
void FS_LB_FreePartSectors( FS_PARTITION * pPart, U32 SectorIndex, U32 NumSectors);
int FS_LB_ReadBurst ( FS_PARTITION * pPart, U32 SectorNo, U32 NumSectors, void * pBuffer, U8 Type);
int FS_LB_ReadDevice ( FS_DEVICE * pDevice, U32 Sector, void * pBuffer, U8 Type);
int FS_LB_ReadPart ( FS_PARTITION * pPart, U32 Sector, void * pBuffer, U8 Type);
int FS_LB_WriteBurst ( FS_PARTITION * pPart, U32 SectorNo, U32 NumSectors, const void * pBuffer, U8 Type);
int FS_LB_WriteDevice ( FS_DEVICE * pDevice, U32 Sector, const void * pBuffer, U8 Type);
int FS_LB_WritePart ( FS_PARTITION * pPart, U32 Sector, const void * pBuffer, U8 Type);
int FS_LB_WriteMultiple ( FS_PARTITION * pPart, U32 Sector, U32 NumSectors, const void * pBuffer, U8 Type);
#if FS_DEBUG_LEVEL >= FS_DEBUG_LEVEL_CHECK_PARA
typedef struct {
U32 ReadSectorCnt;
U32 ReadBurstCnt;
U32 ReadBurstSectorCnt;
U32 WriteSectorCnt;
U32 WriteBurstCnt;
U32 WriteBurstSectorCnt;
U32 WriteMultipleCnt;
U32 WriteMultipleSectorCnt;
} FS_STAT; /* For debugging only (statistics) */
void FS_LB_GetCounters (FS_STAT * pStat);
void FS_LB_ResetCounters(void);
#endif
/*********************************************************************
*
* FS_JOURNAL
*
* Journal to make file system layer transaction and fail safe
*
**********************************************************************
*/
int FS_JOURNAL_Create (FS_VOLUME * pVolume, U32 FirstSector, U32 NumSectors);
int FS_JOURNAL_GetNumFreeSectors(FS_VOLUME * pVolume);
int FS_JOURNAL_IsPresent (FS_VOLUME * pVolume);
int FS_JOURNAL_Mount (FS_VOLUME * pVolume);
int FS_JOURNAL_Read (const FS_DEVICE * pDevice, U32 SectorNo, void * pBuffer, U32 NumSectors);
int FS_JOURNAL_Write (const FS_DEVICE * pDevice, U32 SectorNo, const void * pBuffer, U32 NumSectors, U8 RepeatSame);
/*********************************************************************
*
* Public const
*
**********************************************************************
*/
#if FS_SUPPORT_MULTIPLE_FS
extern const FS_FS_API FS_FAT_API;
extern const FS_FS_API FS_EFS_API;
#endif
#if defined(__cplusplus)
} /* Make sure we have C-declarations in C++ programs */
#endif
#endif // Avoid multiple/recursive inclusion
/*************************** End of file ****************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -