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

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

?? fat.c

?? ATMEL 89c51sndc mp3外接硬盤源碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
        return KO;
  
    }
    else
    {
      return KO;
    }
  }
  else
  {
    return OK; /* Nothing to do because we are in the root directory */
  }
}



/*F**************************************************************************
* NAME: fat_update_fat_sector
*----------------------------------------------------------------------------
* PARAMS: 
*   sector_number : fat sector position
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   update a sector of fat
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   This function check if there is 2 fats to be updated
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/  
void fat_update_fat_sector (Uint16 sector_number)
{
  fat_up_down_load_sector(fat_ptr_fats + sector_number, DOWNLOAD);                   /* FAT 1 update */
  if (fat_2_is_present == TRUE)
  {
    fat_up_down_load_sector(fat_ptr_fats + sector_number + fat_fat_size, DOWNLOAD);  /* FAT 2 update */
  }      
}


/*F**************************************************************************
* NAME: fat_update_entry_fat
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Update root entry and FAT after a writing file session (create or re-write)
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*   
*****************************************************************************/
void fat_update_entry_fat (void)
{
Byte index;
Uint16 chain_index;
Uint16 sector_number;
Byte id;
Uint16 i;
Uint16 j;
Uint32 cluster;
Uint16 temp;
Uint32 nb_cluster;

/*********************/
/* Update directory entry */
/*********************/
  fat_clear_dir_info();
  fat_dir_current_offs = (fat_current_end_entry_position - 1) * 32;
  fat_calc_cluster();
  fat_up_down_load_sector(fat_dir_current_sect, UPLOAD);
  j = ((fat_current_end_entry_position - 1) % 16) * 32 ;                /* Position of entry in the sector */

  /* Update file size */
  if (fat_cache.current.size.l <= fat_file_size.l)
    fat_cache.current.size.l = fat_file_size.l;
  fat_buf_sector[j + 28] = fat_cache.current.size.b[3];
  fat_buf_sector[j + 29] = fat_cache.current.size.b[2];
  fat_buf_sector[j + 30] = fat_cache.current.size.b[1];
  fat_buf_sector[j + 31] = fat_cache.current.size.b[0];

  ext[0] = fat_buf_sector[j + 8];
  ext[1] = fat_buf_sector[j + 9];
  ext[2] = fat_buf_sector[j + 10];
  id = fat_check_ext();

  fat_up_down_load_sector(fat_dir_current_sect, DOWNLOAD);

/********************/
/* Update fat 1 & 2 */
/********************/
  /* Calculate file size cluster */
  nb_cluster = (fat_cache.current.size.l / SECTOR_SIZE) / fat_cluster_size;
  if ((fat_cache.current.size.l % (fat_cluster_size * SECTOR_SIZE)))
  {
    nb_cluster++;
  }
  j = 1;
  index = 0;

/********************/
/* FAT32 management */
/********************/

  /* init the starting cluster value */
  cluster = fclusters[0].cluster + 2;
  /* Start at first chain cluster */
  sector_number = cluster / 128;
  /* Bufferize fat sector */
  fat_up_down_load_sector(fat_ptr_fats + sector_number, UPLOAD);
  /* i -> word fat sector position */
  i = (cluster * 4) & 0x1FF;
  chain_index = 1;

  while (j < nb_cluster)
  {
    /* Determinate the value of the next cluster */
    if (fclusters[index].number == chain_index)
    {
      /* increase index */
      index++;
      cluster = fclusters[index].cluster + 2;
      fat_buf_sector[i++] = ((Byte*)&cluster)[3];
      fat_buf_sector[i++] = ((Byte*)&cluster)[2];
      fat_buf_sector[i++] = ((Byte*)&cluster)[1];
      fat_buf_sector[i]   = ((Byte*)&cluster)[0];
      chain_index = 1;
      if ( (cluster / 128) != sector_number)
      { /* Fat change sector */
        fat_update_fat_sector(sector_number);
        sector_number = (Uint16)(cluster / 128);
        fat_up_down_load_sector(fat_ptr_fats + sector_number, UPLOAD);
      }
      i = (cluster * 4) & 0x1FF;

    }
    else
    {
      cluster++;
      fat_buf_sector[i++] = ((Byte*)&cluster)[3];
      fat_buf_sector[i++] = ((Byte*)&cluster)[2];
      fat_buf_sector[i++] = ((Byte*)&cluster)[1];
      fat_buf_sector[i++] = ((Byte*)&cluster)[0];
      chain_index++;
      if (i == SECTOR_SIZE)     /* Sector is full ? */   
      {                                                  
        fat_update_fat_sector(sector_number);            
        sector_number++;                                 
        fat_up_down_load_sector(fat_ptr_fats + sector_number, UPLOAD);   
        i = 0;                                           
      }            
    }
    j++;
  }
  /* End of file indicate by 0x0FFFFF */
  fat_buf_sector[i++] = 0xFF;
  fat_buf_sector[i++] = 0xFF;
  fat_buf_sector[i++] = 0xFF;
  fat_buf_sector[i]   = 0x0F;
  fat_update_fat_sector(sector_number);

  temp = fat_dir_list_index - 1;
  fat_seek_first();
  for (; temp != 0; temp--)
    fat_goto_next();
}


/*F**************************************************************************
* NAME: fat_fopen
*----------------------------------------------------------------------------
* PARAMS:
*   mode: READ:   open file for read
*         WRITE:  open file for write
*
* return:
*   - OK: file opened
*   - KO: file not opened: - file is empty
*                          - low level read error
*----------------------------------------------------------------------------
* PURPOSE:
*   Open the file in read or write mode
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
bit fat_fopen (bit mode)
{
  if (mode == READ)
  {
    if (fat_cache.current.size.l == 0)
    {
      return KO;                                              /* empty file */
    }
    else
    {
      fat_fclust_byte_count = 0;                              /* byte 0 of cluster */
      fat_fchain_index = 0;                                   /* reset the allocation list variable */
      fat_fchain_nb_clust = 0;                                /* start on first contiguous cluster */
      fat_get_clusters(&fclusters, MAX_FILE_FRAGMENT_NUMBER); /* get file allocation list */
  
      fat_open_mode = READ;                                   /* seek to the beginning of the file */
      return Hard_read_open(fat_ptr_data + ((Uint32)(fclusters[0].cluster) 
                                               * fat_cluster_size));
    }
  }
  else
  {
    fat_fclust_byte_count = 0;                                /* byte 0 of cluster */
    fat_file_size.l = 0;  
    flag_end_disk_file = FALSE;                               /* reset end disk flag  */
    fat_fchain_index = 0;                                     /* reset the allocation list variable */
    fat_fchain_nb_clust = 0;                                  /* start on first contiguous cl */
    /* get file allocation list */
    fat_get_clusters(&fclusters, MAX_FILE_FRAGMENT_NUMBER);
    fat_open_mode = WRITE;
    return Hard_write_open(fat_ptr_data + ((Uint32)(fclusters[0].cluster) 
                                           * fat_cluster_size));
  }
}


/*F**************************************************************************
* NAME: fat_fclose
*----------------------------------------------------------------------------
* PARAMS:
*
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Close opened file
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
void fat_fclose (void)
{
  if (fat_open_mode == READ)
  {
    Hard_read_close();                      /* close reading */
  }
  else
  {
    Hard_write_close();                     /* close writing */
    fat_update_entry_fat();                 /* Update entry and fat */
  }
}


/*F**************************************************************************
* NAME: fat_fcreate
*----------------------------------------------------------------------------
* PARAMS:
*    
* return:
*----------------------------------------------------------------------------
* PURPOSE:
*   Prepare creation of a wav file in the root directory
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*   This function creates first the free cluster chain from fat1 and then
*   creates an entry in root directory
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
bit fat_fcreate (char *file_name, Byte attribute)
{
Byte temp_byte;
Byte i;
Uint16 j;
Uint16 index;
xdata Uint32 temp;
xdata Uint32 cluster;
xdata Uint32 temp_cluster;

  if (fat_no_entries_free == TRUE)                /* If last directory cluster is full */
  {
    cluster = 0;
    Hard_read_open(fat_ptr_fats);
    do
    {
      ((Byte*)&temp)[3] = Hard_read_byte();
      ((Byte*)&temp)[2] = Hard_read_byte();
      ((Byte*)&temp)[1] = Hard_read_byte();
      ((Byte*)&temp)[0] = Hard_read_byte();
      cluster++;
    }
    while (temp != 0x00000000);
    Hard_read_close();
    cluster--;                                                  /* Free cluster value */
    temp_cluster = dclusters[fat_last_dclust_index].cluster + dclusters[fat_last_dclust_index].number - 1;

    temp =  (temp_cluster + 2) / 128;                           /* End of cluster chain */
    fat_up_down_load_sector(fat_ptr_fats + temp, UPLOAD);
    j = (temp_cluster * 4) & 0x1FF;
    fat_buf_sector[j++] = ((Byte*)&cluster)[3];                 /* Update with the new cluster value */
    fat_buf_sector[j++] = ((Byte*)&cluster)[2];
    fat_buf_sector[j++] = ((Byte*)&cluster)[1];
    fat_buf_sector[j]   = ((Byte*)&cluster)[0];

    if ((cluster / 128) != temp)
    {
      fat_update_fat_sector(temp);
      temp = cluster / 128;
      fat_up_down_load_sector(fat_ptr_fats + temp, UPLOAD);
    }
    j = (cluster * 4) & 0x1FF;                                  /* Update end chain marker */
    fat_buf_sector[j++] = 0xFF;
    fat_buf_sector[j++] = 0xFF;
    fat_buf_sector[j++] = 0xFF;
    fat_buf_sector[j]   = 0x0F;
    fat_update_fat_sector(temp);                                /* Update fat sector */
    fat_last_dclust_index++;
    dclusters[fat_last_dclust_index].cluster = cluster - 2;     /* Update chain cluster value */
    dclusters[fat_last_dclust_index].number = 1;
    fat_last_dir_cluster_full = FALSE;
    fat_no_entries_free = FALSE;
    fat_total_clusters++;
  }

  fat_clear_dir_info();
  fat_dseek(0);

  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 */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产精品网麻豆系列| 精品国精品国产| 精品综合久久久久久8888| 国产精品久久久久毛片软件| 欧美巨大另类极品videosbest| 高清不卡一二三区| 久久精品国产亚洲aⅴ| 一区二区三区四区在线免费观看 | 成人午夜在线播放| 日本不卡中文字幕| 亚洲影院理伦片| 中文字幕日韩一区| 国产欧美一区二区精品性色| 日韩精品一区二区三区在线观看| 欧美午夜精品一区二区蜜桃| 91小视频免费看| 国产91对白在线观看九色| 麻豆成人91精品二区三区| 亚洲第一成人在线| 夜夜爽夜夜爽精品视频| 中文字幕亚洲区| 国产精品久久国产精麻豆99网站| 精品国产成人系列| 欧美电视剧免费全集观看| 91精品国产高清一区二区三区蜜臀| 色噜噜夜夜夜综合网| 99re这里都是精品| zzijzzij亚洲日本少妇熟睡| 国产91高潮流白浆在线麻豆 | 国产欧美精品一区二区三区四区 | 欧洲精品在线观看| 99久精品国产| 91麻豆swag| 色婷婷精品久久二区二区蜜臂av| 99国产一区二区三精品乱码| 成人免费视频播放| 成人av网站免费| 99久久精品国产麻豆演员表| 99久久综合99久久综合网站| av在线一区二区| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 成人国产精品免费观看动漫| 日本伊人精品一区二区三区观看方式| 亚洲国产成人精品视频| 亚洲mv在线观看| 美女精品自拍一二三四| 久久精品二区亚洲w码| 国产精品夜夜爽| 成人在线综合网站| 99在线精品视频| 色丁香久综合在线久综合在线观看| 日韩三级高清在线| 91九色最新地址| 欧美日韩一区在线观看| 欧美肥大bbwbbw高潮| 日韩午夜小视频| 久久综合久久久久88| 国产精品高潮呻吟| 亚洲大型综合色站| 久久99国产精品免费| 懂色一区二区三区免费观看| 色婷婷综合激情| 91精品国产美女浴室洗澡无遮挡| 久久综合色婷婷| 亚洲婷婷综合色高清在线| 午夜欧美在线一二页| 免费成人在线视频观看| 国产精品性做久久久久久| 91网址在线看| 日韩视频在线你懂得| 中国色在线观看另类| 亚洲一区二区av在线| 久久99国产精品久久99果冻传媒| 成人黄色国产精品网站大全在线免费观看 | 亚洲欧美怡红院| 亚洲午夜精品网| 国精产品一区一区三区mba桃花| 亚洲一区在线电影| 国产精品久久毛片a| 欧美精品亚洲一区二区在线播放| 91精品国产综合久久久久久漫画| 久久精子c满五个校花| 亚洲黄色av一区| 国产精品一区久久久久| 日本电影欧美片| 久久久噜噜噜久噜久久综合| 亚洲激情在线激情| 国产黄色精品网站| 欧美视频你懂的| 久久免费偷拍视频| 天天色综合天天| 成人高清视频免费观看| 日韩欧美一区二区三区在线| 亚洲h动漫在线| 亚洲福利视频一区二区| 国产sm精品调教视频网站| 欧美丰满一区二区免费视频| 国产精品国产三级国产aⅴ原创| 蜜臀av亚洲一区中文字幕| 一本久道中文字幕精品亚洲嫩| 久久婷婷一区二区三区| 午夜精品久久久久久久| 91亚洲精品乱码久久久久久蜜桃| 精品美女一区二区三区| 午夜影院在线观看欧美| 91网站黄www| 日本一区二区免费在线| 免费精品视频在线| 精品污污网站免费看| 亚洲特黄一级片| 不卡的电影网站| 日本一区二区三区久久久久久久久不 | 99精品欧美一区二区三区小说| 日韩一区二区三区精品视频| 亚洲午夜视频在线| 91成人免费在线| 国产精品视频一二三区| 国产精品资源在线| 久久影院午夜论| 久久91精品久久久久久秒播| 欧美一区在线视频| 丝袜美腿亚洲色图| 欧美日韩一卡二卡三卡| 亚洲一区免费观看| 色欧美片视频在线观看在线视频| 国产精品无码永久免费888| 国产精品一区二区不卡| 国产亚洲自拍一区| 大桥未久av一区二区三区中文| 精品成人在线观看| 国产一区二区不卡| 久久久噜噜噜久久人人看 | 污片在线观看一区二区| 欧美日韩日本视频| 午夜久久久影院| 欧美一级免费大片| 日韩电影一二三区| 欧美大胆一级视频| 国产资源精品在线观看| 久久久美女毛片| 成人av免费在线观看| 综合久久给合久久狠狠狠97色| 色国产综合视频| 亚洲成a人在线观看| 91麻豆精品久久久久蜜臀| 日本麻豆一区二区三区视频| 日韩欧美色综合网站| 久久91精品国产91久久小草| 国产午夜亚洲精品理论片色戒| 国产成人午夜电影网| 亚洲天天做日日做天天谢日日欢 | 欧美三区免费完整视频在线观看| 一区二区三区四区在线播放 | 中文字幕中文字幕一区| 91在线视频播放| 日韩影院在线观看| 久久久午夜电影| 91片在线免费观看| 天堂蜜桃一区二区三区| 精品久久久久久久久久久久久久久 | 亚洲国产精品ⅴa在线观看| 99精品视频在线观看| 亚洲午夜在线视频| 亚洲精品在线免费观看视频| 国产福利一区二区三区视频 | 91精品国产综合久久香蕉麻豆| 麻豆91在线看| 国产精品麻豆一区二区| 欧美综合欧美视频| 国产美女视频91| 亚洲综合激情小说| 久久久精品2019中文字幕之3| 91在线porny国产在线看| 丝袜亚洲另类欧美综合| 欧美激情综合五月色丁香| 欧美日韩国产一二三| 国产一区二区影院| 性做久久久久久久免费看| 国产亚洲精品精华液| 欧美日韩一区二区三区不卡| 黄色成人免费在线| 一区二区三区精品视频| 久久久久久久久久久久电影| 欧美亚洲国产一区二区三区va | 欧美国产精品劲爆| 欧美日韩一卡二卡三卡| 成人永久免费视频| 蜜臀久久99精品久久久久宅男| 国产精品麻豆久久久| 91精品国产一区二区三区香蕉| 成人小视频在线观看| 青青国产91久久久久久| 亚洲同性gay激情无套| 2023国产精品视频| 欧美日韩亚洲综合| 成人精品在线视频观看| 蜜桃一区二区三区在线观看| 亚洲精品免费在线观看| 亚洲国产精品99久久久久久久久 | 国产精品久久久久一区|