亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fat.c

?? 8051實現的MP3播放程序,大家可以一起學習.
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*_____ I N C L U D E S ____________________________________________________*/

#include "config.h"                         /* system configuration */
#include "..\mem\hard.h"                    /* low level function definition */
#include "file.h"                           /* file function definition */
#include "fat.h"                            /* fat file-system definition */

/*_____ M A C R O S ________________________________________________________*/


/*_____ D E F I N I T I O N ________________________________________________*/

extern  bit           reserved_disk_space;
extern  pdata Byte    gl_buffer[];
extern  xdata Byte    fat_buf_sector[];  /* 512 bytes buffer */
extern  xdata Uint32  total_capacity;
extern  pdata char    *lfn_name; /* long filename limited to MAX_FILENAME_LEN chars */
extern  Uint16        song_name[11];
extern  bit bdata     song_name_style;
/* disk management */
extern  data  Uint32  fat_ptr_fats;         /* address of the first byte of FAT */
extern  data  Uint32  fat_ptr_rdir;         /* address of the first byte of root dir */
extern  data  Uint32  fat_ptr_data;         /* address of the first byte of data */
extern  data  Byte    fat_cluster_size;     /* cluster size (sector count) */
extern  idata Byte    fat_cluster_mask;     /* mask for end of cluster test */

extern  bdata bit     dir_is_root;          /* TRUE: point the root directory  */
extern  bdata bit     fat_is_fat16;         /* TRUE: FAT16 - FALSE: FAT12 */
extern  bdata bit     fat_is_fat32;         /* TRUE: FAT32 - FALSE: FAT12/FAT16 */
extern  bdata bit     fat_open_mode;        /* READ or WRITE */
extern  bdata bit     fat_2_is_present;     /* TRUE: 2 FATs - FALSE: 1 FAT */
extern  bdata bit     flag_end_disk_file;


extern  xdata Uint32  fat_count_of_clusters;/* number of cluster - 2 */
extern  xdata Uint16  fat_root_entry;       /* position in root dir */
extern  xdata Union32 fat_file_size;
extern  xdata Uint16  fat_fat_size;         /* FAT size in sector count */


/* directory management */
extern  idata Uint32  fat_dir_current_sect; /* sector of selected entry in dir list */
extern  xdata Uint16  fat_dir_list_index;   /* index of current entry in dir list */
extern  xdata Uint16  fat_dir_list_last;    /* index of last entry in dir list */
extern  idata Uint16  fat_dclust_byte_count;/* byte counter in directory sector */
extern  idata Uint16  fat_dchain_index;     /* the number of the fragment of the dir, in fact
                                               the index of the table in the cluster chain */
extern  idata Byte    fat_dchain_nb_clust;  /* the offset of the cluster from the first cluster
                                               of the dir fragment */
extern  xdata Uint32  fat_dir_start_sect;   /* start sector of dir list */
extern  xdata Uint16  fat_dir_current_offs; /* entry offset from fat_dir_current_sect */
extern  xdata Byte    fat_last_dclust_index;/* index of the last cluster in directory chain */
extern  xdata fat_st_cache   fat_cache;     /* The cache structure, see the .h for more info */
extern  xdata fat_st_clust_chain dclusters[MAX_DIR_FRAGMENT_NUMBER];
                                            /* cluster chain for the current directory */
extern  xdata char  ext[3];                 /* file extension (limited to 3 characters) */
#define fat_dir_entry_list  fat_buf_sector  /* manual variable overlay */


/* file management */
extern  data  Uint16  fat_fclust_byte_count;/* byte counter in file cluster */
extern  idata Byte    fat_last_clust_index; /* index of the last cluster in file chain */
extern  idata Byte    fat_fchain_index;     /* the number of the fragment of the file, in fact
                                               the index of the table in the cluster chain */
extern  idata Uint16  fat_fchain_nb_clust;  /* the offset of the cluster from the first cluster
                                               of the file fragment */

extern  xdata fat_st_clust_chain fclusters[MAX_FILE_FRAGMENT_NUMBER];
                                            /* cluster chain for the current file */


/* Mode repeat A/B variables */
extern xdata  Byte    fat_fchain_index_save;         
extern xdata  Byte    fat_fchain_nb_clust_save;
extern xdata  Uint16  fat_fclust_byte_count_save;

extern xdata  Uint32  fat_bpb_add;

extern xdata  fat_st_free_space free_space;




/*_____ D E C L A R A T I O N ______________________________________________*/



code Byte PBR_record_part1[] =
{
  0xEB, 0x3C, 0x90, /* JMP instruction to boot code */
  'O', 'E', 'M', ' ', 'N', 'A', 'M', 'E', /* OEM name */
  SECTOR_SIZE, SECTOR_SIZE >> 8, /* number of bytes per sector */
  0x00, /* number of sector per cluster */
  NB_RESERVED, NB_RESERVED >> 8, /* number of reserved sector */
  NB_FATS, /* number of FAT */
  NB_ROOT_ENTRY, NB_ROOT_ENTRY >> 8, /* number of root directory entries */
  0x00, 0x00, /* total sectors if less than 65535 */
  HARD_DISK, /* media byte */
};

code Byte PBR_record_part2[] =
{
  FAT_DRIVE_NUMBER, /* Drive number */
  0x00, /* not used */
  FAT_EXT_SIGN, /* extended boot signature */
  0x00, 0x00, 0x00, 0x00, /* volume ID */
  'N', 'O', ' ', 'N', 'A', 'M', 'E', ' ', ' ', ' ', ' ', /* volume label */
  'F', 'A', 'T', '1', 0x00, ' ', ' ', ' ', /* File system type in ASCII */

};


/*F**************************************************************************
* NAME: fat_load_sector
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   This function load a sector in fat_buf_sector
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*   
*****************************************************************************/
bit fat_load_sector(Uint32 sector)
{
Uint16 i;
  if (Hard_read_open(sector) == OK)
  {
    for (i = 0; i < (SECTOR_SIZE); i++)
    {
      fat_buf_sector[i++] = Hard_read_byte();
      fat_buf_sector[i++] = Hard_read_byte();
      fat_buf_sector[i++] = Hard_read_byte();
      fat_buf_sector[i]   = Hard_read_byte();
    }
    Hard_read_close();

    return OK;
  }
  else
  {
    return KO;
  }
}

/*F**************************************************************************
* NAME: fat_install
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*   - OK: intallation succeeded
*   - KO: - partition 1 signature not recognized
*         - FAT type is not FAT12/FAT16
*         - sector size is not 512 bytes
*         - MBR or PBR signatures are not correct
*         - low level read open failure
*----------------------------------------------------------------------------
* PURPOSE:
*   Install the fat system, read mbr, bootrecords...
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   if MBR not found, try to mount unpartitionned FAT
*   sector size is fixed to 512 bytes to simplify low level drivers
*   fat_ptr_fats = partition offset + nb_reserved_sector
*   fat_ptr_rdir = fat_ptr_fat + fat_size * nb_fat
*   fat_ptr_data = fat_ptr_rdir + nb_root_entries * 32 / 512
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
bit fat_install (void)
{          
Uint32 fat_nb_sector;

  /* MBR/PBR determination */
  fat_ptr_fats = 1;
  if (fat_load_sector(MBR_ADDRESS) == OK)
  {
    if ((fat_buf_sector[0] == 0xEB) &&      /* PBR Byte 0 */
        (fat_buf_sector[2] == 0x90) &&      /* PBR Byte 2 */
        ((fat_buf_sector[21] & 0xF0) == 0xF0)) /* PBR Byte 21 : Media byte */
    {
      if ((fat_buf_sector[510] != LOW(BR_SIGNATURE)) &&         /* check PBR signature */
          (fat_buf_sector[511] != HIGH(BR_SIGNATURE)))
      {
        return KO;
      }
      else
      {
        fat_ptr_fats = 0x00000000; /* first sector is PBR */
      }
    }
    else
    {   /* first sector is MBR */
      if ((fat_buf_sector[446] != PARTITION_ACTIVE) && 
          (fat_buf_sector[446] != 0x00))
      {
        return KO;                            /* not a MBR */
      }
      else
      {
        /* read partition offset (in sectors) at offset 8 */
        ((Byte*)&fat_ptr_fats)[3] = fat_buf_sector[454];
        ((Byte*)&fat_ptr_fats)[2] = fat_buf_sector[455];
        ((Byte*)&fat_ptr_fats)[1] = fat_buf_sector[456];
        ((Byte*)&fat_ptr_fats)[0] = fat_buf_sector[457];
        
         fat_bpb_add = fat_ptr_fats;

        if ((fat_buf_sector[510] != LOW(BR_SIGNATURE)) &&         /* check PBR signature */
            (fat_buf_sector[511] != HIGH(BR_SIGNATURE)))
        {
          return KO;
        }

      }

    }
  }
  else
  {
    return KO;
  }

  /* read and check usefull PBR info */
  if (fat_load_sector(fat_ptr_fats) == OK) 
  {
    if ((fat_buf_sector[11] != LOW(SECTOR_SIZE)) ||  /* read sector size (in bytes) */
        (fat_buf_sector[12] != HIGH(SECTOR_SIZE)))
    {
      return KO;
    }

    /* read cluster size (in sector) */
    fat_cluster_size = fat_buf_sector[13];
    fat_cluster_mask = HIGH((Uint16)fat_cluster_size * SECTOR_SIZE) - 1;
    /* compute FATs sector address: add reserved sector number */
    fat_ptr_fats += fat_buf_sector[14];
    fat_ptr_fats += (Uint16)fat_buf_sector[15] << 8;
    /* read number of FATs */
    if (fat_buf_sector[16] == 2)
      fat_2_is_present = TRUE;
    else
      fat_2_is_present = FALSE;
    /* read number of dir entries  and compute rdir offset */
    ((Byte*)&fat_ptr_data)[3] = fat_buf_sector[17];
    ((Byte*)&fat_ptr_data)[2] = fat_buf_sector[18];
    ((Byte*)&fat_ptr_data)[1] = 0;
    ((Byte*)&fat_ptr_data)[0] = 0;
    fat_ptr_data = (fat_ptr_data * DIR_SIZE) / SECTOR_SIZE;
    /* read number of sector in partition (<32Mb) */
    ((Byte*)&fat_nb_sector)[3] = fat_buf_sector[19];
    ((Byte*)&fat_nb_sector)[2] = fat_buf_sector[20];
    ((Byte*)&fat_nb_sector)[1] = 0x00;
    ((Byte*)&fat_nb_sector)[0] = 0x00;
    /* compute root directory sector address */
    ((Byte*)&fat_fat_size)[1] = fat_buf_sector[22];
    ((Byte*)&fat_fat_size)[0] = fat_buf_sector[23];
    
    fat_ptr_rdir = fat_buf_sector[16] * fat_fat_size;
    fat_ptr_rdir += fat_ptr_fats;

    /* read number of sector in partition (>32Mb) */
    if (!fat_nb_sector)
    {
      ((Byte*)&fat_nb_sector)[3] = fat_buf_sector[32];
      ((Byte*)&fat_nb_sector)[2] = fat_buf_sector[33];
      ((Byte*)&fat_nb_sector)[1] = fat_buf_sector[34];
      ((Byte*)&fat_nb_sector)[0] = fat_buf_sector[35];
    }
    total_capacity = fat_nb_sector;

    fat_count_of_clusters = (fat_nb_sector - (1 + (fat_buf_sector[16] * fat_fat_size) + fat_ptr_data)) 
                            / fat_cluster_size;
    if (fat_count_of_clusters <= MAX_CLUSTERS12)
     {
      fat_is_fat16 = FALSE;
      fat_is_fat32 = FALSE;
     }
    else
      if (fat_count_of_clusters <= MAX_CLUSTERS16)
       {
        fat_is_fat16 = TRUE;
        fat_is_fat32 = FALSE;
       }
	else 
	   {      
	   fat_is_fat16 = FALSE;
       fat_is_fat32 = TRUE;
	   }
      /* else is FAT32 not supported */

    /* compute data sector address */
    fat_ptr_data += fat_ptr_rdir;
    /* check partition signature */
    if ((fat_buf_sector[510] != LOW(BR_SIGNATURE)) &&
        (fat_buf_sector[511] != HIGH(BR_SIGNATURE)))
    {
      return KO;
    }

    return OK;
  }
  else
  { /* low level error */
    return KO;
  }
}


/*F**************************************************************************
* NAME: fat_get_dir_entry
*----------------------------------------------------------------------------
* PARAMS:
*   entry: directory entry structure
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Get from directory all information about a directory or file entry
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   This function reads directly datas from sectors
*   It automaticaly computes difference between LFN and normal entries
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void fat_get_dir_entry (fat_st_dir_entry xdata *entry)
{
bit     exit_flag = FALSE;
bit     lfn_entry_found = FALSE;
Byte    i;

  /* clear the name buffer */
  for (i = MAX_FILENAME_LEN; i != 0; lfn_name[--i] = '\0');
  for (i = 0; i < 11; i++)  
           song_name[i] = 0 ;

  while (!exit_flag)
  /* loop while the entry is not a normal one. */
  {
    /* read the directory entry */
    if (dir_is_root == TRUE)
    { /* root dir is linear -> Hard_read_byte() */
      for (i = 0; i < DIR_SIZE; i++)
        gl_buffer[i] = Hard_read_byte();
    }
    else
    { /* subdir can be fragmented -> dgetc() */
      for (i = 0; i < DIR_SIZE; i++)
        gl_buffer[i] = fat_dgetc();
    }

    /*computes gathered data
    /* check if we have a LFN entry */
    if (gl_buffer[11] != ATTR_LFN_ENTRY)
    {
      if (!lfn_entry_found)
      {
        /* true DOS 8.3 entry format */
        for (i = 0; i < 8; i++)
        {
          lfn_name[i] = gl_buffer[i];
          
          if (lfn_name[i] == ' ')
          { /* space is end of name */
            break;
          }
        }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
a级精品国产片在线观看| 久久亚洲综合色一区二区三区| 日韩一二三四区| 亚洲欧洲精品天堂一级| 久久精品国产一区二区三区免费看| 粉嫩嫩av羞羞动漫久久久| 欧美精品久久久久久久多人混战| 久久久国产午夜精品| 天堂va蜜桃一区二区三区| 97aⅴ精品视频一二三区| 久久亚洲春色中文字幕久久久| 亚洲国产精品精华液网站| 成人精品电影在线观看| 欧美大胆一级视频| 天天射综合影视| 欧美性大战久久久| 日韩理论片在线| 国产99久久久国产精品潘金网站| 欧美一级专区免费大片| 亚洲伊人色欲综合网| 91老司机福利 在线| 欧美国产激情二区三区| 国产精品99久久久久| 日韩一二三区视频| 久久综合综合久久综合| 欧美日韩国产精品自在自线| 亚洲精品日日夜夜| 91麻豆免费看| 日韩久久一区二区| 国产成人综合在线观看| 精品人在线二区三区| 免费看黄色91| 欧美一二三四在线| 毛片av中文字幕一区二区| 欧美精品高清视频| 日本女优在线视频一区二区| 欧美蜜桃一区二区三区| 五月婷婷激情综合| 久久久久国色av免费看影院| 狠狠色丁香久久婷婷综合_中| 91精品国产色综合久久不卡蜜臀| 日日骚欧美日韩| 日韩一区二区三区四区| 激情成人午夜视频| 国产欧美1区2区3区| 成人不卡免费av| 亚洲精品老司机| 欧美丝袜丝nylons| 日韩成人免费电影| 日韩欧美国产电影| 成人av动漫网站| 亚洲欧美激情插 | 精品国产污网站| 国产永久精品大片wwwapp| 国产欧美日本一区视频| 91浏览器打开| 蜜桃久久精品一区二区| 国产精品网站在线播放| 在线观看网站黄不卡| 亚洲一区二区在线观看视频| 9191成人精品久久| 国产成人在线色| 亚洲一区二区偷拍精品| 日韩美女视频在线| 99久久婷婷国产精品综合| 天堂在线亚洲视频| 日本一区二区三区dvd视频在线| 99久久精品情趣| 免费看欧美美女黄的网站| 欧美激情综合五月色丁香| 欧美日韩视频在线一区二区| 国产一区二区三区美女| 亚洲第一福利一区| 国产精品三级在线观看| 正在播放一区二区| 成+人+亚洲+综合天堂| 男女激情视频一区| 一区二区三区四区视频精品免费| 日韩一区二区三区高清免费看看 | 91一区二区三区在线播放| 美女视频一区二区三区| 国产精品国产三级国产普通话三级| 欧美日韩精品一区视频| 成人免费高清视频在线观看| 日本不卡一二三| 亚洲欧美另类久久久精品2019| 精品国产精品网麻豆系列| 91浏览器在线视频| 成人激情午夜影院| 久久精品72免费观看| 一区二区三区中文字幕精品精品 | 国内精品国产三级国产a久久| 亚洲一区二区三区四区的| 中文天堂在线一区| 久久色视频免费观看| 欧美另类高清zo欧美| 99国产精品久久久| 国产成人免费在线观看| 激情综合网av| 麻豆视频观看网址久久| 亚洲国产综合在线| 亚洲伦在线观看| 国产精品家庭影院| 国产精品美日韩| 久久久精品影视| 精品国产伦一区二区三区免费 | 欧美亚洲国产一区二区三区| 成人av影院在线| 丁香六月综合激情| 国产精品亚洲专一区二区三区 | 欧美精品一区在线观看| 欧美丰满一区二区免费视频| 91久久精品国产91性色tv| 91在线云播放| 一本久久a久久免费精品不卡| www.综合网.com| 91免费看片在线观看| 波多野结衣在线一区| av电影在线观看一区| 91丨九色丨国产丨porny| 色综合天天综合网国产成人综合天| eeuss鲁片一区二区三区在线看 | 韩国精品主播一区二区在线观看 | av欧美精品.com| 不卡视频免费播放| 99久久777色| 欧美性大战久久| 91精品国产色综合久久ai换脸| 91麻豆精品国产91久久久使用方法| 欧美日本免费一区二区三区| 日韩一区二区免费高清| 26uuu另类欧美亚洲曰本| 国产亚洲欧美在线| 国产精品成人免费精品自在线观看| 日韩一区日韩二区| 亚洲一区免费观看| 麻豆成人在线观看| 成人免费va视频| 欧美日韩精品综合在线| 精品美女被调教视频大全网站| 久久久久久久久99精品| 亚洲精品视频在线观看免费 | 欧美一级xxx| 中文字幕电影一区| 亚洲一区二区五区| 韩国一区二区在线观看| 91麻豆国产精品久久| 欧美一区二区精品在线| 国产日韩三级在线| 一区二区三区美女| 韩国欧美国产一区| 91精品国产综合久久香蕉的特点| 亚洲精品一区二区精华| 亚洲精品视频一区| 国产一区二区美女| 欧美三级日韩三级| 国产欧美精品在线观看| 日韩专区中文字幕一区二区| 成人免费视频一区二区| 在线电影院国产精品| 国产精品丝袜久久久久久app| 亚洲1区2区3区4区| 高清国产一区二区| 欧美乱熟臀69xxxxxx| 亚洲色大成网站www久久九九| 免费观看成人av| 在线观看一区二区视频| 久久久久国产精品麻豆| 天天综合网天天综合色| av一二三不卡影片| 久久网站热最新地址| 日本网站在线观看一区二区三区 | 久久99精品国产麻豆不卡| 91最新地址在线播放| 国产视频一区在线观看 | 亚洲一区二区三区四区的| 福利一区福利二区| 欧美tickling网站挠脚心| 亚洲五月六月丁香激情| 91偷拍与自偷拍精品| 国产女人aaa级久久久级| 久久精品二区亚洲w码| 7777精品伊人久久久大香线蕉| 亚洲天堂久久久久久久| 粉嫩嫩av羞羞动漫久久久| 久久综合精品国产一区二区三区| 午夜电影网一区| 欧美剧在线免费观看网站| 一区二区三区不卡在线观看| 一本到三区不卡视频| 亚洲图片激情小说| 91女人视频在线观看| 国产精品久久久久永久免费观看 | 一区二区视频免费在线观看| av网站免费线看精品| 国产精品全国免费观看高清 | 91精品国产品国语在线不卡| 亚洲网友自拍偷拍| 欧美久久久久久久久中文字幕| 亚洲国产你懂的|