📄 fat32_access.c
字号:
#include "fat_include.h"
//-----------------------------------------------------------------------------
// FAT32_LoadFAT: Load FAT32 Parameters
//-----------------------------------------------------------------------------
void FAT32_LoadFAT(void)
{
s3c44b0x_Printf("\r\nLoading Partition 1");
FAT32_FindFAT32Details();
s3c44b0x_Printf("\r\nFAT Parameters Loaded Successfully");
}
//-----------------------------------------------------------------------------
// FAT32_SectorReader: From the provided startcluster and sector offset, load using
// IDE_BufferSector the required sector into memory.
//-----------------------------------------------------------------------------
int FAT32_SectorReader(UI32 Startcluster, UI32 offset)
{
UI32 SectortoRead = 0;
UI32 ClustertoRead = 0;
UI32 ClusterChain = 0;
int i;
// Set start of cluster chain to initial value
ClusterChain = Startcluster;
// Find parameters
ClustertoRead = offset / FAT32.SectorsPerCluster;
SectortoRead = offset - (ClustertoRead*FAT32.SectorsPerCluster);
// Follow chain to find cluster to read
for (i=0; i<ClustertoRead; i++)
ClusterChain = FAT32_FindNextCluster(ClusterChain);
// If end of cluster chain then return 1
if (ClusterChain==0xFFFFFFFF) return 1;
// Else read sector and return 0
IDE_BufferSector(FAT32_LBAofCluster(ClusterChain)+SectortoRead);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -