keil_examples/USBHostLite/UsbHost/Fat/usbhost_fat.c
/*
**************************************************************************************************************
*                                              CREATING AN ENTRY
*
* Description: This function creates a file entry in the root directory if the file does not exist
*
* Arguments  : ent_name_given    The file name with which the entry is to be created
*              entry             Pointer to FILE ENTRY structure
*
* Returns    : OK                If the entry already exists or successfully created if it doesn't exists
*              ERROR             If failed to create the entry
*
**************************************************************************************************************
*/
CREATING AN ENTRY
Description: This function creates a file entry in the root directory if the file does not exist

Arguments  : ent_name_given    The file name with which the entry is to be created
entry             Pointer to FILE ENTRY structure

Returns    : OK                If the entry already exists or successfully created if it doesn't exists
ERROR             If failed to create the entry
CREATING AN ENTRY Description : This function creates a file entry in the root directory if the file does not exist Arguments : ent_name_given The file name with which the entry is to be created entry Pointer to FILE ENTRY structure Returns : OK If the entry already exists or successfully created if it doesn ' t exists ERROR If failed to create the entry
int32_t  FAT_CreateEntry (uint8_t  *ent_name_given,
                             FILE_ENTRY  *entry)
{
    int32_t  rc;
    rc = FAT_FindEntry(ent_name_given, entry);        
    if (rc == MATCH_FOUND) {                          
        return (rc);
    } else {
        rc = FAT_GetFreeEntry(entry);                 
        if (rc != OK) {
            return (rc);
        } else {
            FAT_PutSFN(ent_name_given, entry);        
            return (rc);
        }
    }
}
int32_t FAT_CreateEntry ( uint8_t * ent_name_given , FILE_ENTRY * entry ) { int32_t rc ; rc = FAT_FindEntry ( ent_name_given , entry ) ; if ( rc == MATCH_FOUND ) { return ( rc ) ; } else { rc = FAT_GetFreeEntry ( entry ) ; if ( rc != OK ) { return ( rc ) ; } else { FAT_PutSFN ( ent_name_given , entry ) ; return ( rc ) ; } } }
CREATING AN ENTRY
Description: This function creates a file entry in the root directory if the file does not exist
CREATING AN ENTRY Description : This function creates a file entry in the root directory if the file does not exist
/* Find for the given file name in the root directory */ /* If match found, return                             */ /* Else get a free entry from the root directory      */ /* Store the given short file name in that entry      */