keil_examples/USBHostLite/UsbHost/Fat/usbhost_fat.c
/*
**************************************************************************************************************
*                                         GET FILE SYSTEM TYPE
*
* Description: This function returns the file system type with which the disk is formatted
*
* Arguments  : None
*
* Returns    : FAT16           On Success
*              ERR_FAT_TYPE    On Failure
*
**************************************************************************************************************
*/
GET FILE SYSTEM TYPE
Description: This function returns the file system type with which the disk is formatted

Arguments  : None

Returns    : FAT16           On Success
ERR_FAT_TYPE    On Failure
GET FILE SYSTEM TYPE Description : This function returns the file system type with which the disk is formatted Arguments : None Returns : FAT16 On Success ERR_FAT_TYPE On Failure
uint8_t  FAT_GetFATType (void)
{
    uint8_t  fat_type;
    uint32_t  tot_sec;
    uint32_t  tot_data_clus;
    if (FAT_BootSec.TotSec16 != 0) {                             
        tot_sec = FAT_BootSec.TotSec16;
    } else {
        tot_sec = FAT_BootSec.TotSec32;
    }
    tot_data_clus = tot_sec / (FAT_BootSec.SecPerClus);          
    if (tot_data_clus >= 4085 && tot_data_clus < 65525) {
        fat_type = FAT_16;
    } else {
        fat_type = 0;
    }
    return (fat_type);
}
uint8_t FAT_GetFATType ( void ) { uint8_t fat_type ; uint32_t tot_sec ; uint32_t tot_data_clus ; if ( FAT_BootSec . TotSec16 != 0 ) { tot_sec = FAT_BootSec . TotSec16 ; } else { tot_sec = FAT_BootSec . TotSec32 ; } tot_data_clus = tot_sec / ( FAT_BootSec . SecPerClus ) ; if ( tot_data_clus >= 4085 && tot_data_clus < 65525 ) { fat_type = FAT_16 ; } else { fat_type = 0 ; } return ( fat_type ) ; }
GET FILE SYSTEM TYPE
Description: This function returns the file system type with which the disk is formatted
GET FILE SYSTEM TYPE Description : This function returns the file system type with which the disk is formatted
/* Get total sectors in the disk           */ /* Get total data clusters in the disk     */ /* If total data clusters >= 4085 and      */ /* < 65525, then it is FAT16 file system   */