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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? fat32.c

?? fat16文件系統(tǒng)源碼。需要的請下
?? C
?? 第 1 頁 / 共 5 頁
字號:
/*C**************************************************************************
* NAME:         fat32.c
*----------------------------------------------------------------------------
* Copyright (c) 2003 Atmel.
*----------------------------------------------------------------------------
* RELEASE:      snd1c-refd-nf-4_0_3      
* REVISION:     1.4     
*----------------------------------------------------------------------------
* PURPOSE:
* FAT32 file-system basics functions
* 
* NOTES:
* Supports only the first partition
* Supports only 512 bytes sector size
* Supports only file fragmentation < MAX_FILE_FRAGMENT_NUMBER
* Supports only one file openned at a time
*
* Global Variables:
*   - gl_buffer: array of bytes in pdata space
*****************************************************************************/

/*_____ I N C L U D E S ____________________________________________________*/

#include "datatype.h"
#include "file.h"          /* file function definition */
#include "fat.h" 
#include "hard.h"

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


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

extern   Byte    gl_buffer[];

extern  char     *lfn_name;             /* long filename limited to MAX_FILENAME_LEN chars */
extern  Uint16  song_name[11];

extern  Byte fat_buf_sector[];         /* 512 bytes buffer */

extern  Uint32 total_capacity;

/* disk management */
extern    Uint32  fat_ptr_fats;         /* address of the first byte of FAT */
extern    Uint32  fat_ptr_data;         /* address of the first byte of data */
extern    Byte    fat_cluster_size;     /* cluster size (sector count) */
extern   Byte    fat_cluster_mask;     /* mask for end of cluster test */

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

extern   Uint32  fat_count_of_clusters;/* number of cluster - 2 */
extern   Union32 fat_file_size;
extern   Uint32  fat_fat_size;         /* FAT size in sector count */


/* directory management */
extern   fat_st_clust_chain dclusters[MAX_DIR_FRAGMENT_NUMBER];
                                            /* cluster chain for the current directory */
extern   Uint16  fat_dclust_byte_count;/* byte counter in directory sector */

extern   Uint16  fat_dchain_index;     /* the number of the fragment of the dir, in fact
                                               the index of the table in the cluster chain */
extern   Byte    fat_dchain_nb_clust;  /* the offset of the cluster from the first cluster
                                               of the dir fragment */
extern   Byte    fat_last_dclust_index;/* index of the last cluster in directory chain */

extern   Uint16  fat_dir_list_index;   /* index of current entry in dir list */
extern   Uint16  fat_dir_list_last;    /* index of last entry in dir list */
extern   Uint32  fat_dir_start_sect;   /* start sector of dir list */
extern   Uint32  fat_dir_current_sect; /* sector of selected entry in dir list */
extern   Uint32  fat_dir_current_offs; /* entry offset from fat_dir_current_sect */

extern   fat_st_cache   fat_cache;     /* The cache structure, see the .h for more info */
extern   char  ext[3];                 /* file extension (limited to 3 characters) */


/* file management */
extern   fat_st_clust_chain fclusters[MAX_FILE_FRAGMENT_NUMBER];
                                            /* cluster chain for the current file */
extern    Byte    fat_last_clust_index; /* index of the last cluster in file chain */

extern    Uint16   fat_fclust_byte_count;/* byte counter in file cluster */

extern    Byte    fat_fchain_index;     /* the number of the fragment of the file, in fact
                                               the index of the table in the cluster chain */
              
extern    Uint16  fat_fchain_nb_clust;  /* the offset of the cluster from the first cluster
                                               of the file fragment */

extern  Uint32  fat_current_file_size;
extern  Uint32  fat_rootclus_fat32;                  /* root cluster address */
extern  Byte fat_last_dir_cluster_full;
extern  Byte fat_no_entries_free;
extern  Uint16 fat_total_clusters;
extern  Uint32 last_free_cluster;

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

extern  Byte current_ext;

extern  Uint16 fat_current_end_entry_position;
extern  Uint16 fat_current_start_entry_position;
extern  Uint16 fat_nb_deleted_entries;
extern  Uint16 fat_nb_total_entries;


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


void  Hard_load_sector()
{
 Uint16 i;

 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();
    }
}
/*F**************************************************************************
* NAME: fat32_install
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*   - OK: intallation succeeded
*   - KO: - partition 1 not active
*         - FAT type is not 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
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
INT8U fat32_install (void)
{          
Byte i;
Uint32 tot_sect;
Uint32 fat_nb_sector;
Uint16 bpb_rsvd_sec_cnt;
Byte bpb_num_fat;
Uint16 bpb_root_ent_count;

  /* read and check usefull MBR info */
  /* go to the first partition field */
  Hard_read_open(MBR_ADDRESS);
  Hard_load_sector();
  Hard_read_close();

  fat_ptr_fats = 0x01;
  if ((fat_buf_sector[0] == 0xEB) && (fat_buf_sector[2] == 0x90)) /* Jump instruction to boot code */
  {
    if ((fat_buf_sector[21] & 0xF0) == 0xF0)  /* Media byte */
    {
      if ((fat_buf_sector[510] == 0x55) && (fat_buf_sector[511] == 0xAA)) /* signature */
      {
        fat_ptr_fats = 0x00000000;            /* disk may not be partitionned : first sector */
      }                                       /* is PBR */
      else
      {
        return KO;  /* no signature -> low level error */
      }
    }
  }

  if (fat_ptr_fats)                     /* if first sector is not a PBR */
  {
    if (Hard_read_open(MBR_ADDRESS) == OK) 
    {
      for (i = 446/2; i != 0; i--)
      {
        Hard_read_byte();                     /* go to first partition entry */
        Hard_read_byte();
      }
      Hard_read_byte();
      Hard_read_byte();                       /* dummy reads */
      Hard_read_byte();
      Hard_read_byte();
      Hard_read_byte();
      Hard_read_byte();
      Hard_read_byte();
      Hard_read_byte();
      /* read partition offset (in sectors) at offset 8 */
      ((Byte*)&fat_ptr_fats)[3] = Hard_read_byte();
      ((Byte*)&fat_ptr_fats)[2] = Hard_read_byte();
      ((Byte*)&fat_ptr_fats)[1] = Hard_read_byte();
      ((Byte*)&fat_ptr_fats)[0] = Hard_read_byte();
      /* go to the MBR signature field */
      for (i = 52; i != 0; i--)
      {
        Hard_read_byte();                   /* dummy reads */
      }
      /* check MBR signature */
      if ((Hard_read_byte() != LOW(BR_SIGNATURE)) &&
          (Hard_read_byte() != HIGH(BR_SIGNATURE)))
      {
        fat_ptr_fats = 0x00000000;          /* disk may not be partitionned */
      }
      Hard_read_close();                    /* close physical read */
    }
    else
    { /* low level error */
      return KO;
    }
  }

  /* read and check usefull PBR info */
  if (Hard_read_open(fat_ptr_fats) == OK) 
  {
    /* go to sector size field */
    for (i = 11; i != 0; i--)
    {
      Hard_read_byte();                     /* dummy reads */
    }
    /* read sector size (in bytes) */
    if ((Hard_read_byte() != LOW(SECTOR_SIZE)) ||
        (Hard_read_byte() != HIGH(SECTOR_SIZE)))
    {
      Hard_read_close();                    /* close physical read */
      return KO;
    }
    /* read cluster size (in sector) */
    fat_cluster_size = Hard_read_byte();
    fat_cluster_mask = HIGH((Uint16)fat_cluster_size * SECTOR_SIZE) - 1;
    /* reserved sector number */
    ((Byte*)&bpb_rsvd_sec_cnt)[1] = Hard_read_byte();
    ((Byte*)&bpb_rsvd_sec_cnt)[0] = Hard_read_byte();
    /* number of FATs */
    bpb_num_fat = Hard_read_byte();
    if (bpb_num_fat == 2)
      fat_2_is_present = TRUE;
    else
      fat_2_is_present = FALSE;    
    
    /* read number of dir entries*/
    ((Byte*)&bpb_root_ent_count)[3] = Hard_read_byte();
    ((Byte*)&bpb_root_ent_count)[2] = Hard_read_byte();

    /* read number of sector in partition (<32Mb) */
    ((Byte*)&fat_nb_sector)[3] = Hard_read_byte();
    ((Byte*)&fat_nb_sector)[2] = Hard_read_byte();
    ((Byte*)&fat_nb_sector)[1] = 0x00;
    ((Byte*)&fat_nb_sector)[0] = 0x00;
    Hard_read_byte();
    Hard_read_byte();                               /* FAT size for FAT12/16 */
    Hard_read_byte();
    
    Hard_read_byte();
    Hard_read_byte();
    Hard_read_byte();
    Hard_read_byte();
    Hard_read_byte();
    Hard_read_byte();
    Hard_read_byte();
    Hard_read_byte();

    /* read number of sector in partition (>32Mb) */
    ((Byte*)&fat_nb_sector)[3] += Hard_read_byte();
    ((Byte*)&fat_nb_sector)[2] += Hard_read_byte();
    ((Byte*)&fat_nb_sector)[1] += Hard_read_byte();
    ((Byte*)&fat_nb_sector)[0] += Hard_read_byte();

    fat_is_fat16 = FALSE;
    fat_is_fat32 = TRUE;

    fat_ptr_data = (bpb_root_ent_count * DIR_SIZE) / SECTOR_SIZE;

    /* Here start the structure for FAT32 */
    /* Offset 36 : 32 bits size of fat */
    ((Byte*)&fat_fat_size)[3] = Hard_read_byte();
    ((Byte*)&fat_fat_size)[2] = Hard_read_byte();
    ((Byte*)&fat_fat_size)[1] = Hard_read_byte();
    ((Byte*)&fat_fat_size)[0] = Hard_read_byte();

    tot_sect = fat_nb_sector - (Uint32)(((Uint32)(bpb_rsvd_sec_cnt) + (Uint32)((bpb_num_fat * (Uint32)(fat_fat_size))) + fat_ptr_data));
    fat_count_of_clusters = tot_sect / fat_cluster_size;

    total_capacity = tot_sect;
   
    /* Offset 40 : ExtFlags */
    Hard_read_byte();
    Hard_read_byte();
    /* Offset 42 : FS Version */
    Hard_read_byte();
    Hard_read_byte();
    /* Offset 44 : Root Cluster */
    ((Byte*)&fat_rootclus_fat32)[3] = Hard_read_byte();
    ((Byte*)&fat_rootclus_fat32)[2] = Hard_read_byte();
    ((Byte*)&fat_rootclus_fat32)[1] = Hard_read_byte();
    ((Byte*)&fat_rootclus_fat32)[0] = Hard_read_byte();

    fat_ptr_fats += bpb_rsvd_sec_cnt;
    fat_ptr_data = fat_ptr_fats + (bpb_num_fat * fat_fat_size);

    /* Offset 48 : FS Info */
    /* Offset 50 : Backup Boot Sector */
    /* Offset 52 : Reserved */
    /* Offset 64 - 89 : Data */
    /* Offset 90 : 510 : Free */
    for (i = 231; i != 0; i--)
    {
      Hard_read_byte();
      Hard_read_byte();
    }
    /* check partition signature */
    if ((Hard_read_byte() != LOW(BR_SIGNATURE)) &&
        (Hard_read_byte() != HIGH(BR_SIGNATURE)))
    {
      Hard_read_close();                    /* close physical read */
      return KO;
    }
    Hard_read_close();                      /* close physical read */
    return OK;
  }
  else
  { /* low level error */
    return KO;
  }
}

#define UPLOAD      0
#define DOWNLOAD    1
#define FETCH_NEXT  0
#define FETCH_PREV  1

/*F**************************************************************************
* NAME: fat32_calc_cluster
*----------------------------------------------------------------------------
* PARAMS:
*   
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Calculate fat_dir_current_sect and update directory variable from the
*   value of fat_dir_current_offs.
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   
*----------------------------------------------------------------------------
* REQUIREMENTS:

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产日韩a在线播放性色| 成人国产免费视频| 亚洲.国产.中文慕字在线| 亚洲天堂中文字幕| 国产精品福利影院| 最新成人av在线| 国产精品成人午夜| 亚洲精品日日夜夜| 夜夜夜精品看看| 午夜视频一区在线观看| 视频一区二区三区在线| 全国精品久久少妇| 卡一卡二国产精品| 国产成人精品一区二区三区四区 | 亚洲欧美一区二区三区国产精品| 欧美高清在线一区| 中文字幕中文字幕在线一区| 1区2区3区国产精品| 一区二区三区在线免费视频| 一区二区三区在线高清| 亚洲午夜久久久| 日韩av二区在线播放| 久久国产尿小便嘘嘘尿| 国产盗摄一区二区三区| av亚洲精华国产精华精华| 色噜噜狠狠成人网p站| 欧美午夜电影在线播放| 日韩一卡二卡三卡| 国产三级精品在线| 亚洲三级免费观看| 午夜亚洲国产au精品一区二区 | 欧美影院一区二区三区| 在线电影欧美成精品| 日韩精品一区二区三区蜜臀| 国产欧美日韩三区| 亚洲日本免费电影| 天天影视网天天综合色在线播放| 美美哒免费高清在线观看视频一区二区| 欧美亚洲动漫制服丝袜| 日本久久电影网| 欧美丰满少妇xxxbbb| 粉嫩高潮美女一区二区三区| av电影在线不卡| 欧美日韩你懂得| 久久久美女毛片| 一区二区三区波多野结衣在线观看| 日韩精品电影一区亚洲| 国产91综合一区在线观看| 日本道免费精品一区二区三区| 一区二区三区日韩欧美精品| 国产精品成人一区二区三区夜夜夜 | 亚洲国产岛国毛片在线| 亚洲国产综合色| 韩国av一区二区三区四区 | 精品99久久久久久| 亚洲精品免费一二三区| 国产麻豆一精品一av一免费 | 婷婷成人综合网| 国产成a人亚洲精品| 欧美年轻男男videosbes| 中文欧美字幕免费| 奇米一区二区三区av| 91国产成人在线| 国产亚洲一二三区| 日韩电影免费在线| 色88888久久久久久影院野外| 久久久不卡网国产精品一区| 香蕉影视欧美成人| 波多野结衣的一区二区三区| 欧美va在线播放| 一区2区3区在线看| 成人手机电影网| 欧美成人官网二区| 亚洲成av人片在www色猫咪| 成人免费视频一区| 亚洲精品一区二区三区蜜桃下载| 亚洲大片在线观看| 91网站视频在线观看| 国产日韩欧美激情| 美女高潮久久久| 欧美一区二区在线免费观看| 曰韩精品一区二区| 91影视在线播放| 中文字幕av资源一区| 国产露脸91国语对白| 91精品国产福利在线观看| 亚洲主播在线播放| 99国产欧美另类久久久精品| 国产欧美一区二区精品仙草咪| 精品一区二区三区免费视频| 欧美一区二区三区日韩| 亚洲大型综合色站| 欧美日韩国产美女| 日韩精品一二三| 在线播放中文一区| 日韩成人av影视| 欧美一区二区视频在线观看| 日韩和欧美一区二区三区| 欧美日韩免费高清一区色橹橹| 一区二区高清视频在线观看| 色婷婷亚洲精品| 亚洲与欧洲av电影| 欧美日韩成人综合在线一区二区| 亚洲一二三四在线| 欧美三级电影网站| 日韩综合小视频| 欧美精品视频www在线观看| 香蕉久久一区二区不卡无毒影院| 欧美三级在线看| 日韩在线一区二区| 日韩精品中文字幕在线一区| 久久99日本精品| 久久综合国产精品| 国产91精品精华液一区二区三区 | 国内精品国产成人国产三级粉色| 日韩欧美三级在线| 国精产品一区一区三区mba桃花| 日韩视频在线一区二区| 裸体在线国模精品偷拍| 日韩欧美国产1| 丁香桃色午夜亚洲一区二区三区 | 国产.精品.日韩.另类.中文.在线.播放| 久久综合九色综合欧美亚洲| 成人午夜电影网站| 亚洲欧美国产高清| 欧美精品久久久久久久多人混战| 免费在线观看视频一区| 久久久99精品久久| 93久久精品日日躁夜夜躁欧美| 亚洲美女视频在线观看| 欧美丰满少妇xxxbbb| 国产剧情在线观看一区二区| 国产精品久久夜| 欧美精品丝袜中出| 国产精品一卡二| 亚洲黄色片在线观看| 欧美丰满少妇xxxbbb| 国产**成人网毛片九色| 一区二区三区视频在线观看| 精品欧美一区二区三区精品久久| 国产成人精品亚洲午夜麻豆| 亚洲男人电影天堂| 日韩视频一区二区三区在线播放| 国产高清在线观看免费不卡| 一区二区在线观看免费视频播放 | 日韩一区欧美小说| 在线播放中文一区| 成人丝袜视频网| 日韩极品在线观看| 国产精品三级电影| 91精品国产91热久久久做人人| 国产成人av在线影院| 婷婷中文字幕一区三区| 久久久精品2019中文字幕之3| 色婷婷狠狠综合| 精品在线亚洲视频| 一区二区免费视频| 久久精品视频在线看| 欧美人狂配大交3d怪物一区| 国产成人自拍网| 五月婷婷综合在线| 国产精品传媒在线| 精品国产免费久久| 欧美午夜精品久久久久久超碰| 国产成人精品免费视频网站| 性感美女久久精品| 亚洲视频一区在线观看| 久久亚洲免费视频| 一区二区在线免费观看| 美女网站色91| 成人激情av网| 国产精品毛片大码女人| 一区二区三区日韩在线观看| 麻豆久久久久久久| av一二三不卡影片| 2014亚洲片线观看视频免费| 免费看日韩a级影片| 亚洲午夜视频在线| 国内成人自拍视频| 欧美一区二区三区在线| 国产一区视频在线看| 久久久久国产精品麻豆ai换脸 | 日产国产欧美视频一区精品| 自拍视频在线观看一区二区| 精品少妇一区二区三区在线视频 | 国产女人18毛片水真多成人如厕| 欧美丝袜自拍制服另类| 91天堂素人约啪| 国产精品综合二区| 精品一区二区免费看| 日本不卡不码高清免费观看| 一区二区三区日韩在线观看| 国产精品久久久久久久午夜片| 久久久一区二区三区捆绑**| 日韩欧美国产系列| 91精品国产综合久久福利| 欧美天天综合网| 色国产综合视频| 99re免费视频精品全部| 成人免费黄色在线|