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

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

?? fat32.c

?? C51程序
?? C
?? 第 1 頁 / 共 5 頁
字號:

  temp_byte = fat_dgetc();          
  index = 0;
  while ((temp_byte != FILE_NOT_EXIST) && (temp_byte != FILE_DELETED))
  {
    for (i = DIR_SIZE - 1; i != 0; i--)
      fat_dgetc();
    temp_byte = fat_dgetc();
    index++;
  }
  if (temp_byte == FILE_DELETED)
  {
    fat_nb_deleted_entries--;
    if ((!fat_nb_deleted_entries) && (fat_last_dir_cluster_full == TRUE))
    {
      fat_no_entries_free = TRUE;
    }
  }
  else                              /* no deleted file entry */
  {
    fat_nb_total_entries++;         /* It's a new entry */
    if ((fat_nb_total_entries / 16) == fat_total_clusters * fat_cluster_size)
    {
      fat_last_dir_cluster_full = TRUE;
      fat_no_entries_free = TRUE;     /* Next time, add a cluster to the directory cluster chain */
    }
  }

  Hard_read_close();

  fat_get_free_clusters(1);
  cluster = fclusters[0].cluster + 2;
  /* Construct the entry */
  gl_buffer[0] = file_name[0];
  gl_buffer[1] = file_name[1];
  gl_buffer[2] = file_name[2];
  gl_buffer[3] = file_name[3];
  gl_buffer[4] = file_name[4];
  gl_buffer[5] = file_name[5];
  gl_buffer[6] = file_name[6];
  gl_buffer[7] = file_name[7];
  gl_buffer[8] = file_name[8];
  gl_buffer[9] = file_name[9];
  gl_buffer[10] = file_name[10];;
  gl_buffer[11] = attribute;                         /* Attribute : archive */
  gl_buffer[12] = 0x00;                         /* Millisecond stamp at time creation */
  gl_buffer[13] = 0x00;                         /* Time */
  gl_buffer[14] = 0x00;
  gl_buffer[15] = 0x00;                         /* Date */
  gl_buffer[16] = 0x00;
  gl_buffer[18] = 0x00;                         /* Last access date */
  gl_buffer[19] = 0x00;
  gl_buffer[20] = ((Byte*)&cluster)[1];         /* High word First cluster number*/
  gl_buffer[21] = ((Byte*)&cluster)[0];
  gl_buffer[22] = 0x00;                         /* Time of last write */
  gl_buffer[23] = 0x00;
  gl_buffer[24] = 0x00;                         /* Date of last write */
  gl_buffer[25] = 0x00;
  gl_buffer[26] = ((Byte*)&cluster)[3];         /* Low word first cluster number */
  gl_buffer[27] = ((Byte*)&cluster)[2];
  gl_buffer[28] = 0x00;                         /* Size */
  gl_buffer[29] = 0x00;
  gl_buffer[30] = 0x00;
  gl_buffer[31] = 0x00;

  fat_dir_current_sect += ((fat_dclust_byte_count % (fat_cluster_size * SECTOR_SIZE))/512);

  fat_up_down_load_sector(fat_dir_current_sect, 0);
  j = (index % 16) * DIR_SIZE ;                 /* Position of entry in the sector */
  for (i = 0; i < DIR_SIZE; i++)
    fat_buf_sector[j++] = gl_buffer[i];

  fat_up_down_load_sector(fat_dir_current_sect, DOWNLOAD);

  fat_dir_list_last++;                          /* Increase max file number */
  fat_dir_list_index = 0;
  
  fat_current_start_entry_position = index;
  fat_current_end_entry_position = index;
  fat_clear_dir_info();
  fat_dir_current_offs = index * 32;
  fat_calc_cluster();
  fat_fetch_file_info(&fat_cache.current, FETCH_NEXT);
  /* open file in write mode */
  fat_fclust_byte_count = 0;                                        /* byte 0 of cluster */
  fat_file_size.l = 0;
  fat_cache.current.size.l = 0;
  fat_fchain_index = 0;                                             /* reset the allocation list variable */
  fat_fchain_nb_clust = 0;                                          /* start on first contiguous cl */
  fat_open_mode = WRITE;
  return Hard_write_open(fat_ptr_data + ((Uint32)(fclusters[0].cluster) 
                                         * fat_cluster_size));
}


/*F**************************************************************************
* NAME: fat_refresh_dir_file_info
*----------------------------------------------------------------------------
* PARAMS:
*    
* return:
*   
*----------------------------------------------------------------------------
* PURPOSE:
*   Reconstruct the file directory list and seek to the file pointed by
*   fat_dir_list_index
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   
*----------------------------------------------------------------------------
* REQUIREMENTS:
*   
*****************************************************************************/
void fat_refresh_dir_file_info (Byte id)
{
  fat_dir_current_sect = (((Uint32)(dclusters[0].cluster)) * fat_cluster_size)
                           + fat_ptr_data;

  fat_get_dir_file_list(id); /* Refresh file list                          */
  fat_seek_entry_record();
}

/*F**************************************************************************
* NAME: fat_clear_fat
*----------------------------------------------------------------------------
* PARAMS:
*    
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Reset FAT clusters value
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void fat_clear_fat (Uint32 start_cluster)
{
Uint16 i;
Uint16 sector_number;
Uint32 cluster;

  /* init the starting cluster value */
  cluster = start_cluster;
  /* Start at first chain cluster */
  sector_number = cluster / 128;
  /* Bufferize fat sector */
  fat_up_down_load_sector(fat_ptr_fats + sector_number, UPLOAD);
  do 
  {
    if ((cluster / 128) != sector_number)
    {
      fat_update_fat_sector(sector_number);
      sector_number =  (Uint32)(cluster / 128);
      fat_up_down_load_sector(fat_ptr_fats + sector_number, UPLOAD);
    }
    i = (cluster * 4) & 0x1FF;
    ((Byte*)&cluster)[3] = fat_buf_sector[i];
    fat_buf_sector[i++] = 0;
    ((Byte*)&cluster)[2] = fat_buf_sector[i];
    fat_buf_sector[i++] = 0;
    ((Byte*)&cluster)[1] = fat_buf_sector[i];
    fat_buf_sector[i++] = 0;
    ((Byte*)&cluster)[0] = fat_buf_sector[i];
    fat_buf_sector[i] = 0;
  }
  while (cluster != 0x0FFFFFFF);
  fat_update_fat_sector(sector_number);
}


/*F**************************************************************************
* NAME: fat_fdelete
*----------------------------------------------------------------------------
* PARAMS:
*    
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Delete a selected file
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   This function works only on a root directory entry
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
Byte fat_fdelete (void)
{
Uint16 i;

  if (fat_check_ext() != FILE_DIR)
  {
    fat_clear_dir_info();
    fat_dir_current_offs = fat_current_start_entry_position * 32;
    fat_calc_cluster();
    fat_up_down_load_sector(fat_dir_current_sect, UPLOAD);
    i = (fat_current_start_entry_position % 16) * 32 ;                /* Position of entry in the sector */

    while (fat_buf_sector[i+11] == ATTR_LFN_ENTRY)
    {
      fat_buf_sector[i] = FILE_DELETED;               /* mark file as deleted */
      i += 32;
      fat_dclust_byte_count += 32;
  
      if (i == SECTOR_SIZE)
      {
        fat_up_down_load_sector(fat_dir_current_sect, DOWNLOAD);
        if  ((((Byte*)&fat_dclust_byte_count)[1] == 0x00) &&                  /* check if we are at the end of a cluster */
            ((((Byte*)&fat_dclust_byte_count)[0] & fat_cluster_mask) == 0x00))
        {
          /* extract if necessary the next cluster from the allocation list */
          if (dclusters[fat_dchain_index].number == fat_dchain_nb_clust)
          { /* new fragment */
            fat_dchain_index++;
            fat_dchain_nb_clust = 1;
            fat_dir_current_sect = (fat_ptr_data + ((Uint32)(dclusters[fat_dchain_index].cluster) * fat_cluster_size));
          }
          else
          {
            fat_dchain_nb_clust++;                          /* one more cluster read */
            fat_dir_current_sect++;                         /* Contiguous cluster    */
          }
        }
        else
        {
          fat_dir_current_sect++;
        }
        fat_up_down_load_sector(fat_dir_current_sect, UPLOAD);
        i = 0;
      }
  
    }
    fat_buf_sector[i] = FILE_DELETED;
    fat_up_down_load_sector(fat_dir_current_sect, DOWNLOAD);
    fat_clear_fat(fat_cache.current.start_cluster);         /* Clear fat cluster */

    fat_dir_list_last--;
    fat_nb_deleted_entries++;
    fat_last_dir_cluster_full = FALSE;
    fat_no_entries_free = FALSE;

    if ( ((dir_is_root == TRUE) && (fat_dir_list_last == 0)) ||     
         ((dir_is_root == FALSE) && (fat_dir_list_last == 2))      /* . and .. directory */
       )
      return DEL_RET_NO_MORE_FILE;

    if (fat_dir_list_index > fat_dir_list_last )
    {
      fat_dir_list_index = fat_dir_list_last;
    }
    return DEL_RET_OK;
  }
  else
  {
    return DEL_RET_ERROR_DIR;
  }
}


/*F**************************************************************************
* NAME: fat_get_free_clusters
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*   - OK: allocation done
*   - KO: allocation cannot be done : no free cluster
*----------------------------------------------------------------------------
* PURPOSE:
*   Prepare a list of the free clusters:
*     chain[n].cluster contains the starting cluster number of a fragment
*     chain[n].number contains the number of contiguous clusters in fragment
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   Free cluster list is limited by the nb_frag parameter.
*   If memory is too much fragmented, created file may be limited in size.
*   Last list item always has single cluster
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
bit fat_get_free_clusters (bit init)
{
#define NB_MAX_SECTOR             5
#define NB_MAX_CLUSTER_AT_INIT    3000
#define NB_MAX_CLUSTER            256
static idata Uint16 fat_sector;
static bit end_disk;
bit       cluster_free;
Byte      i;
Uint16    max_cluster;
Uint16    max_sector = 0;
Uint32    cluster;
Uint32    tot_cluster;

  if (init)
  {
    cluster = 0;
    fat_sector = 0;
    max_cluster = NB_MAX_CLUSTER_AT_INIT;
    last_free_cluster = 0;
    fat_last_clust_index = 0;
    end_disk = FALSE;
  }
  else
  {
    if (!end_disk)
    {
      cluster = last_free_cluster + 1;
      fat_sector = cluster / 128;
      max_cluster = NB_MAX_CLUSTER;
    }
    else
    {
      return KO;
    }
  }
  cluster_free = FALSE;
  tot_cluster = fat_count_of_clusters + 2;
  Hard_read_open(fat_ptr_fats + fat_sector);

  for (i = (cluster % 128); i != 0; i--)            /* dummy reads */
  {
    Hard_read_long_big_endian();
  }

  do                                      /* search for first free cluster */
  {
    if (Hard_read_long_big_endian() == 0x00000000)
    {
      cluster_free = TRUE;
    }
    else
    {
      cluster++;
      if (!(cluster & 0x7F) && (!init))
      {
        max_sector++;
      }
    }
  }
  while ((cluster != tot_cluster) && (!cluster_free) && (max_sector < NB_MAX_SECTOR));
   
  if (cluster == fat_count_of_clusters)
  {
    end_disk = TRUE;
  }

  if (!cluster_free)
  {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产人成亚洲区| 丝袜美腿亚洲色图| 狠狠v欧美v日韩v亚洲ⅴ| 欧美高清dvd| 一区二区三区日韩欧美| 91伊人久久大香线蕉| 最新国产の精品合集bt伙计| 国产精品亚洲第一区在线暖暖韩国 | 欧美一区二区久久久| 亚洲夂夂婷婷色拍ww47| 99久久精品免费看国产| 一区二区成人在线视频| 欧美日韩一区不卡| 免费在线观看一区| 久久综合资源网| 91香蕉视频在线| 午夜激情一区二区三区| 日韩午夜激情电影| 成人国产精品免费观看动漫| 亚洲欧美国产77777| 91精品国产综合久久福利| 精品一区二区国语对白| 最新久久zyz资源站| 欧美午夜片在线观看| 九九国产精品视频| 亚洲欧洲另类国产综合| 欧美视频一区二区在线观看| 日本中文在线一区| 亚洲国产精品二十页| 欧美性一二三区| 国产米奇在线777精品观看| 欧美国产乱子伦| 欧美另类高清zo欧美| 国产成人av影院| 秋霞午夜av一区二区三区| 国产精品久久福利| 久久久综合激的五月天| 在线播放中文一区| 日本韩国一区二区| 成人激情综合网站| 韩国精品主播一区二区在线观看| 一区二区三区日韩| 国产精品国产三级国产aⅴ中文| 日韩一区二区三区视频在线 | 亚洲人成精品久久久久| 久久久五月婷婷| 欧美日韩国产一级片| 色狠狠色噜噜噜综合网| 成人国产在线观看| av高清久久久| 91亚洲男人天堂| 91色.com| 欧美日韩精品福利| 91麻豆精品国产91久久久久久| 日本久久一区二区三区| 日本乱人伦aⅴ精品| 在线观看精品一区| 欧美精品在线视频| 日韩欧美电影在线| 26uuu欧美| 国产精品不卡一区| 一区二区三区在线观看欧美| 亚洲男人都懂的| 亚洲sss视频在线视频| 天堂一区二区在线免费观看| 亚洲精品免费在线播放| 亚洲成人av免费| 精品系列免费在线观看| 国产成人啪免费观看软件| 99re在线精品| 91麻豆精品国产| 国产精品嫩草影院com| 亚洲精品视频免费观看| 日本视频一区二区| 97久久超碰国产精品电影| 欧美丰满嫩嫩电影| 久久一夜天堂av一区二区三区| 中文字幕第一区综合| 天天综合网天天综合色| 国产91精品免费| 欧美一区二区视频在线观看| 久久精品亚洲乱码伦伦中文| 一区二区免费看| 成人福利视频在线| 欧美电视剧免费全集观看| 亚洲高清免费在线| 国产露脸91国语对白| 8x福利精品第一导航| 国产精品三级视频| 国产毛片精品视频| 精品久久久久久久久久久久包黑料 | 在线中文字幕一区二区| 久久久综合精品| 久色婷婷小香蕉久久| 欧美一区二区在线看| 五月天激情综合| 欧美日韩国产另类一区| 一区二区三区免费| 91亚洲精品久久久蜜桃| 国产女人水真多18毛片18精品视频| 免费观看日韩电影| 日韩一区二区不卡| 另类调教123区 | 欧美日韩大陆一区二区| 一区二区三区中文在线| 欧美亚洲综合久久| 亚洲aaa精品| 日韩欧美中文一区| 看片网站欧美日韩| 国产丝袜美腿一区二区三区| 久久99久久久久| 国产视频一区在线观看| 国产一区 二区 三区一级| 中文字幕不卡在线| 日本道在线观看一区二区| 午夜久久久久久久久| 91精品国产综合久久久蜜臀图片| 日本亚洲天堂网| 国产精品麻豆一区二区| 欧美中文一区二区三区| 六月婷婷色综合| 成人欧美一区二区三区1314| 91网址在线看| 麻豆成人免费电影| 精品久久久久久久久久久久久久久久久 | 91丨九色porny丨蝌蚪| 婷婷国产v国产偷v亚洲高清| 国产欧美日韩在线| 在线播放国产精品二区一二区四区| 韩国女主播成人在线| 亚洲精选免费视频| 久久久另类综合| 欧美老肥妇做.爰bbww视频| 国产麻豆午夜三级精品| 亚洲电影激情视频网站| 国产精品国产三级国产a| 4438成人网| 色哟哟国产精品| 国产成人精品www牛牛影视| 蜜臀av一区二区| 丝袜美腿高跟呻吟高潮一区| 中文欧美字幕免费| 在线一区二区三区四区| 成人听书哪个软件好| 六月丁香婷婷久久| 日韩电影在线一区二区三区| 日韩理论片在线| 国产精品乱码人人做人人爱| 欧美成人女星排行榜| 欧美三级电影网站| 911精品国产一区二区在线| 欧美日韩在线播放三区| 精品国产百合女同互慰| 精品久久人人做人人爰| 欧美日韩精品欧美日韩精品 | 日韩国产欧美在线视频| 亚洲国产精品综合小说图片区| 中文字幕不卡在线观看| 综合中文字幕亚洲| 日本一区二区三区国色天香| 亚洲国产精品成人久久综合一区 | 中日韩免费视频中文字幕| 欧美大片日本大片免费观看| 日韩三级伦理片妻子的秘密按摩| 欧美性极品少妇| 色婷婷综合久久久久中文| 色婷婷久久99综合精品jk白丝| 91国产成人在线| 日韩片之四级片| 亚洲色图.com| 理论片日本一区| 成人精品国产一区二区4080| 91国在线观看| 国产日韩欧美不卡在线| 亚洲精品免费在线| 久久精品国产网站| 欧美视频在线一区| 2021中文字幕一区亚洲| 亚洲自拍都市欧美小说| 精品在线观看免费| 欧洲激情一区二区| 1024国产精品| 国产suv精品一区二区三区| 欧美精品久久99| 亚洲精品ww久久久久久p站| 国产揄拍国内精品对白| 日韩欧美精品在线| 婷婷亚洲久悠悠色悠在线播放| 激情小说欧美图片| 91.com在线观看| 亚洲一区二区av在线| 色婷婷精品久久二区二区蜜臀av| 国产日产精品1区| 蜜桃av一区二区在线观看| 日本韩国欧美一区| 一区二区三区四区在线播放| 成人av资源站| 亚洲女人****多毛耸耸8| 色综合久久天天| 一区二区三区在线观看国产|