Content originally posted in LPCWare by honphylin on Sun Oct 21 19:59:48 MST 2012
Thanks for you replay.
Have anybody, throught USB, mount SD-card to PC, and use FAT32 interface. In the NXP example, only achieved FAT12, below:
void InitializeFAT12(DISKIMAGE *DiskImagePtr)
{
int i;
SetFAT12Entry(DiskImagePtr, 1, 0xfff);
for(i = 0; i < ((DiskImagePtr->BootSector.BPB_TotSec16 - StartDataRegion / BytesPerSector) / DiskImagePtr->BootSector.BPB_SecPerClus); i++)
{
if (!i)
DiskImagePtr->DirectoryEntries[1].startCluster = 2;// Startcluster is always 2 as defined by FAT12
else
{
SetFAT12Entry(DiskImagePtr, i + 1, i + 2);// 2 represents the startcluster (which is fixed by definition)
SetFAT12Entry(DiskImagePtr, i + 2, 0xfff);
}
DiskImagePtr->DirectoryEntries[1].fileSize += BYTESPERCLUSTER;
}
InitializeDiskDiskImage(DiskImagePtr);
}
void InitializeFAT16(DISKIMAGE *DiskImagePtr)
{
}
void InitializeFAT32(DISKIMAGE *DiskImagePtr)
{
}
Another, fact, i also need a NAND FTL layer, use for manage NANDFlash.