keil_examples/USBHostLite/UsbHost/Fat/usbhost_fat.c
/*
**************************************************************************************************************
*                                       UPDATE FILE ALLOCATION TABLE
*
* Description: This function updates the file allocation table
*
* Arguments  : curr_clus    Offset of the current cluster number in the file allocation table
*              value        Value with which this offset to be updated
*
* Returns    : None
*
**************************************************************************************************************
*/
UPDATE FILE ALLOCATION TABLE
Description: This function updates the file allocation table

Arguments  : curr_clus    Offset of the current cluster number in the file allocation table
value        Value with which this offset to be updated

Returns    : None
UPDATE FILE ALLOCATION TABLE Description : This function updates the file allocation table Arguments : curr_clus Offset of the current cluster number in the file allocation table value Value with which this offset to be updated Returns : None
void  FAT_UpdateFAT (uint16_t  curr_clus,
                     uint16_t  value)
{
    uint32_t  sec_num;
    uint32_t  sec_offset;
    sec_num = FAT_BootSec.RsvdSecCnt + (curr_clus * 2) / FAT_BootSec.BytsPerSec;
    sec_offset = (curr_clus * 2) % FAT_BootSec.BytsPerSec;
    MS_BulkRecv(sec_num, 1, FATBuffer);
    WriteLE16U(&FATBuffer[sec_offset], value);
    MS_BulkSend(sec_num, 1, FATBuffer);
}
void FAT_UpdateFAT ( uint16_t curr_clus , uint16_t value ) { uint32_t sec_num ; uint32_t sec_offset ; sec_num = FAT_BootSec . RsvdSecCnt + ( curr_clus * 2 ) / FAT_BootSec . BytsPerSec ; sec_offset = ( curr_clus * 2 ) % FAT_BootSec . BytsPerSec ; MS_BulkRecv ( sec_num , 1 , FATBuffer ) ; WriteLE16U ( & FATBuffer [ sec_offset ] , value ) ; MS_BulkSend ( sec_num , 1 , FATBuffer ) ; }
UPDATE FILE ALLOCATION TABLE
Description: This function updates the file allocation table
UPDATE FILE ALLOCATION TABLE Description : This function updates the file allocation table