📄 fs_int.h
字号:
*/
U16 FS_LoadU16LE (const U8 *pBuffer);
U32 FS_LoadU32LE (const U8 *pBuffer);
void FS_StoreU16LE( U8 *pBuffer, unsigned Data);
void FS_StoreU24LE( U8 *pBuffer, U32 Data);
void FS_StoreU32LE( U8 *pBuffer, U32 Data);
/*********************************************************************
*
* big endian translation functions, internal
*/
U32 FS_LoadU32BE (const U8 *pBuffer);
U16 FS_LoadU16BE (const U8 *pBuffer);
void FS_StoreU32BE( U8 *pBuffer, U32 Data);
void FS_StoreU16BE( U8 *pBuffer, unsigned Data);
/*********************************************************************
*
* CACHE API type, internal
*
*/
struct FS_CACHE_API {
char (*pfReadFromCache) (void * pCacheData, U32 SectorNo, void * pData, U8 Type);
char (*pfUpdateCache) (FS_DEVICE * pDevice, U32 SectorNo, const void * pData, U8 Type); /* Returns 0 if write cached, which means no further write is required */
void (*pfInvalidateCache) (void * pCacheData);
int (*pfCommand) (FS_DEVICE * pDevice , int Cmd, void *p);
char (*pfWriteIntoCache) (FS_DEVICE * pDevice , U32 SectorNo, const void * pData, U8 Type); /* Returns 0 if write cached, which means no further write is required */
};
/*********************************************************************
*
* Smart buffer (SB) API-functions, internal
*
*/
void FS__SB_Clean (FS_SB * pSB);
char FS__SB_Create (FS_SB * pSB, FS_PARTITION *pPart);
void FS__SB_Delete (FS_SB * pSB);
void FS__SB_Flush (FS_SB * pSB);
void FS__SB_MarkDirty (FS_SB * pSB);
void FS__SB_MarkValid (FS_SB * pSB, U32 SectorNo, U8 Type);
void FS__SB_MarkNotDirty (FS_SB * pSB);
char FS__SB_Read (FS_SB * pSB);
void FS__SB_SetSector (FS_SB * pSB, U32 SectorNo, U8 Type);
char FS__SB_Write (FS_SB * pSB);
#if FS_MAINTAIN_FAT_COPY
void FS__SB_SetWriteCopyOff(FS_SB * pSB, U32 Off);
#endif
/*********************************************************************
*
* SB-functions, locking and unlocking SB operations
*
*/
void FS_Lock_SB (FS_PARTITION * pPart, U32 SectorIndex);
void FS_Unlock_SB(FS_PARTITION * pPart, U32 SectorIndex);
/*********************************************************************
*
* Cache related fucntions, internal
*
*/
int FS__CACHE_CommandVolume (FS_VOLUME * pVolume, int Cmd, void * pData);
int FS__CACHE_CommandDevice (FS_DEVICE * pDevice, int Cmd, void * pData);
/*********************************************************************
*
* Sector allocation API-functions, internal
*
*/
U8 * FS__AllocSectorBuffer (void);
void FS__FreeSectorBuffer (void * p);
/*********************************************************************
*
* String operation API-functions, internal
*
*/
void FS_memcpy(void * pDest, const void * pSrc, int NumBytes);
const char * FS__strchr (const char *s, int c);
void FS__AddSpaceHex(U32 v, U8 Len, char** ps);
/*********************************************************************
*
* Volume API-functions, internal
*
*/
FS_VOLUME * FS__FindVolume (const char *pFullName, const char ** pFileName);
int FS__Mount (FS_VOLUME * pVolume, U8 MountType);
int FS__AutoMount (FS_VOLUME * pVolume);
void FS__Unmount (FS_VOLUME * pVolume);
void FS__UnmountLL (FS_VOLUME * pVolume);
void FS__UnmountForcedLL(FS_VOLUME * pVolume);
void FS__Sync (FS_VOLUME * pVolume);
/*********************************************************************
*
* API-functions, internal (without Global locking)
*
*/
int FS__FClose (FS_FILE * pFile);
U32 FS__GetFileSize (FS_FILE * pFile);
U32 FS__Read (FS_FILE * pFile, void * pData, U32 NumBytes);
U32 FS__Write (FS_FILE * pFile, const void * pData, U32 NumBytes);
int FS__Verify (FS_FILE * pFile, const void * pData, U32 NumBytes);
int FS__Remove (const char * pFileName);
FS_FILE * FS__FOpen (const char * pFileName, const char * pMode);
FS_FILE * FS__FOpenEx (const char * pFileName, U8 AccessFlags, char DoCreate, char DoDel, char DoOpen);
FS_FILE * FS__OpenEx (FS_VOLUME * pVolume, const char * sFilePath, U8 AccessFlags, char DoCreate, char DoDel, char DoOpen);
U32 FS__CalcSizeInBytes (U32 NumClusters, U32 SectorsPerCluster, U32 BytesPerSector);
FS_VOLUME * FS__AddDevice (const FS_DEVICE_TYPE * pDevType);
int FS__AddPhysDevice (const FS_DEVICE_TYPE * pDevType);
int FS__IoCtl (FS_VOLUME * pVolume, I32 Cmd, I32 Aux, void *pBuffer);
int FS__Format (FS_VOLUME * pVolume, FS_FORMAT_INFO * pFormatInfo);
int FS__SD_Format (FS_VOLUME * pVolume);
int FS__GetNumVolumes (void);
int FS__CopyFile (const char * sSource, const char * sDest);
int FS__GetVolumeInfo (const char * sVolume, FS_DISK_INFO * pInfo);
int FS__GetVolumeInfoEx (FS_VOLUME * pVolume, FS_DISK_INFO * pInfo);
int FS__CreateDir (const char * sDir);
int FS__MkDir (const char * pDirName);
int FS__RmDir (const char * pDirName);
int FS__FSeek (FS_FILE *pFile, I32 Offset, int Origin);
I32 FS__FTell (FS_FILE *pFile);
int FS__GetFileTimeEx (const char * pName, U32 * pTimeStamp, int Index);
int FS__SetFileTimeEx (const char * pName, U32 TimeStamp, int Index);
int FS__SetFileAttributes(const char * pName, U8 Attributes);
U8 FS__GetFileAttributes(const char * pName);
int FS__SetEndOfFile (FS_FILE * pFile);
void FS__RemoveDevice (FS_VOLUME * pVolume);
FS_DIR * FS__OpenDir (const char *pDirName);
FS_DIRENT * FS__ReadDir (FS_DIR *pDir);
int FS__CloseDir (FS_DIR *pDir);
void FS__RewindDir (FS_DIR *pDir);
void FS__DirEnt2Attr (FS_DIRENT *pDirEnt, U8* pAttr);
U32 FS__GetNumFiles (FS_DIR *pDir);
int FS__FindFirstFile(FS_FIND_DATA * pfd, const char * sPath, char * sFilename, int sizeofFilename);
int FS__FindFirstFileEx(FS_FIND_DATA * pfd, FS_VOLUME * pVolume, const char * sPath, char * sFilename, int sizeofFilename);
int FS__FindNextFile (FS_FIND_DATA * pfd);
void FS__FindClose (FS_FIND_DATA * pfd);
int FS__FormatLow (FS_VOLUME * pVolume);
void FS__UnmountForced (FS_VOLUME * pVolume);
int FS__GetVolumeStatus(FS_VOLUME * pVolume);
int FS__ReadSector (FS_VOLUME * pVolume, void * pData, U32 SectorIndex);
int FS__ReadSectors (FS_VOLUME * pVolume, void * pData, U32 SectorIndex, U32 NumSectors);
int FS__WriteSector (FS_VOLUME * pVolume, const void * pData, U32 SectorIndex);
int FS__WriteSectors (FS_VOLUME * pVolume, const void * pData, U32 SectorIndex, U32 NumSectors);
int FS__GetDeviceInfo(FS_VOLUME * pVolume, FS_DEV_INFO * pDevInfo);
int FS__IsLLFormatted(FS_VOLUME * pVolume);
/*********************************************************************
*
* API-functions, internal (without driver locking)
*
*/
int FS__FCloseNL (FS_FILE * pFile);
int FS__CACHE_CommandDeviceNL(FS_DEVICE * pDevice, int Cmd, void * pData);
int FS__IoCtlNL (FS_VOLUME * pVolume, I32 Cmd, I32 Aux, void * Buffer);
void FS__UnmountForcedNL (FS_VOLUME * pVolume);
int FS__MountNL (FS_VOLUME * pVolume, U8 MountType);
int FS__AutoMountNL (FS_VOLUME * pVolume);
/*********************************************************************
*
* API-functions, file handle operations
*
*/
FS_FILE * FS__AllocFileHandle(void);
void FS__FreeFileHandle(FS_FILE * pFile);
/*********************************************************************
*
* API-functions, file object operations
*
*/
FS_FILE_OBJ * FS__AllocFileObj(const char * sFullFileName);
FS_FILE_OBJ * FS__GetFileObj (const char * sFullFileName);
void FS__FreeFileObj (FS_FILE_OBJ * pFileObj);
/*********************************************************************
*
* ECC256
*
*/
int FS__ECC256_Apply(U32 * pData, U32 eccRead);
U32 FS__ECC256_Calc (const U32 * pData);
int FS__ECC256_IsValid(U32 ecc);
U32 FS__ECC256_Load (const U8 * p);
void FS__ECC256_Store(U8 * p, U32 ecc);
/*********************************************************************
*
* Helper functions
*
*/
U32 FS__DivideU32Up(U32 Nom, U32 Div);
/*********************************************************************
*
* Public data
*
*/
extern FS_FILE FS__aFilehandle [FS_NUM_FILE_HANDLES];
extern FS_FILE_OBJ FS__aFileObj [FS_NUM_FILE_OBJECTS];
extern FS_VOLUME FS__aVolume [FS_NUM_VOLUMES];
extern FS_DIR FS__aDirHandle [FS_NUM_DIR_HANDLES];
extern U32 FS__MaxSectorSize;
/*********************************************************************
*
* OS mapping macros (multi tasking locks)
*
*
* Notes
* These macros map to locking routines or are empty,
* depending on the configuration
* There are 3 different lock-levels:
* FS_OS == 0 -> No locking
* FS_OS == 1
* FS_OS_LOCK_PER_DRIVER == 0 -> Single, global lock in every API function
* FS_OS_LOCK_PER_DRIVER == 1 -> Multiple locks
*
**********************************************************************
*/
#if (FS_OS == 0) /* No locking */
#define FS_LOCK()
#define FS_UNLOCK()
#define FS_LOCK_SYS()
#define FS_UNLOCK_SYS()
#define FS_OS_INIT(MaxNumLocks)
#define FS_LOCK_DRIVER(pDriver)
#define FS_UNLOCK_DRIVER(pDriver)
#define FS_OS_ADD_DRIVER(pDevice)
#define FS_OS_GETNUM_DRIVERLOCKS() 0
#define FS_OS_GETNUM_SYSLOCKS() 0
#elif (FS_OS) && (FS_OS_LOCK_PER_DRIVER == 0)
//
// Coarse lock granularity:
// One global lock for all FS API functions
//
#define FS_LOCK_ID_SYSTEM 0
#define FS_LOCK() FS_X_OS_Lock(FS_LOCK_ID_SYSTEM)
#define FS_UNLOCK() FS_X_OS_Unlock(FS_LOCK_ID_SYSTEM)
#define FS_LOCK_SYS()
#define FS_UNLOCK_SYS()
#define FS_LOCK_DRIVER(pDriver)
#define FS_UNLOCK_DRIVER(pDriver)
#define FS_OS_ADD_DRIVER(pDevice)
#define FS_OS_GETNUM_DRIVERLOCKS() 0
#define FS_OS_GETNUM_SYSLOCKS() 1
#define FS_OS_INIT(MaxNumLocks) FS_X_OS_Init(MaxNumLocks)
#else
//
// Fine lock granularity:
// Lock for different FS functions
//
#define FS_LOCK_ID_SYSTEM 0
#define FS_LOCK_ID_DEVICE 1
#define FS_LOCK()
#define FS_UNLOCK()
#define FS_LOCK_SYS() FS_X_OS_Lock (FS_LOCK_ID_SYSTEM)
#define FS_UNLOCK_SYS() FS_X_OS_Unlock(FS_LOCK_ID_SYSTEM)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -