fat32_access.c
来自「hd driver for S3C44B0。44b0 + ide + fat32」· C语言 代码 · 共 49 行
C
49 行
#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 + =
减小字号Ctrl + -
显示快捷键?