keil_examples/USBHostLite/UsbHost/Fat/usbhost_fat.c
/*
**************************************************************************************************************
*                                                  FILE CLOSE
*
* Description: This function closes the opened file by making all the elements of FILE_ENTRY structure to 0
*
* Arguments  : fd    File descriptor which points to the file to be closed
*
* Returns    : None
*
**************************************************************************************************************
*/
FILE CLOSE
Description: This function closes the opened file by making all the elements of FILE_ENTRY structure to 0

Arguments  : fd    File descriptor which points to the file to be closed

Returns    : None
FILE CLOSE Description : This function closes the opened file by making all the elements of FILE_ENTRY structure to 0 Arguments : fd File descriptor which points to the file to be closed Returns : None
void  FILE_Close (int32_t  fd)
{
    FILE_ENTRY  *entry;
    entry = &FAT_FileEntry[fd-1];
    MS_BulkRecv(entry->EntrySec, 1, FATBuffer);
    WriteLE32U(&FATBuffer[entry->EntrySecOffset + 28], entry->FileSize);    
    MS_BulkSend(entry->EntrySec, 1, FATBuffer);
    entry->CurrClus       = 0;
    entry->CurrClusOffset = 0;
    entry->FileSize       = 0;
    entry->EntrySec       = 0;
    entry->EntrySecOffset = 0;
    entry->FileStatus     = 0;
}
void FILE_Close ( int32_t fd ) { FILE_ENTRY * entry ; entry = & FAT_FileEntry [ fd - 1 ] ; MS_BulkRecv ( entry -> EntrySec , 1 , FATBuffer ) ; WriteLE32U ( & FATBuffer [ entry -> EntrySecOffset + 28 ] , entry -> FileSize ) ; MS_BulkSend ( entry -> EntrySec , 1 , FATBuffer ) ; entry -> CurrClus = 0 ; entry -> CurrClusOffset = 0 ; entry -> FileSize = 0 ; entry -> EntrySec = 0 ; entry -> EntrySecOffset = 0 ; entry -> FileStatus = 0 ; }
FILE CLOSE
Description: This function closes the opened file by making all the elements of FILE_ENTRY structure to 0
FILE CLOSE Description : This function closes the opened file by making all the elements of FILE_ENTRY structure to 0
/* Update the file size         */