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

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

?? fatfs_supp.c

?? 該工程是從ecos嵌入式系統(tǒng)下移植過來的一個(gè)小型的fat16文件系統(tǒng)
?? C
?? 第 1 頁 / 共 5 頁
字號:
//==========================================================================////      fatfs_supp.c////      FAT file system support functions////==========================================================================//####ECOSGPLCOPYRIGHTBEGIN####// -------------------------------------------// This file is part of eCos, the Embedded Configurable Operating System.// Copyright (C) 2003 Savin Zlobec //// eCos is free software; you can redistribute it and/or modify it under// the terms of the GNU General Public License as published by the Free// Software Foundation; either version 2 or (at your option) any later version.//// eCos is distributed in the hope that it will be useful, but WITHOUT ANY// WARRANTY; without even the implied warranty of MERCHANTABILITY or// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License// for more details.//// You should have received a copy of the GNU General Public License along// with eCos; if not, write to the Free Software Foundation, Inc.,// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.//// As a special exception, if other files instantiate templates or use macros// or inline functions from this file, or you compile this file and link it// with other works to produce a work based on this file, this file does not// by itself cause the resulting work to be covered by the GNU General Public// License. However the source code for this file must still be made available// in accordance with section (3) of the GNU General Public License.//// This exception does not invalidate any other reasons why a work based on// this file might be covered by the GNU General Public License.//// -------------------------------------------//####ECOSGPLCOPYRIGHTEND####//==========================================================================//#####DESCRIPTIONBEGIN####//// Author(s):           savin // Date:                2003-06-30////####DESCRIPTIONEND####////==========================================================================#include "cyg_type.h"#include "cyg_ass.h"#include "io.h"#include "types.h"#include "fatfs.h"#include "stdio.h"#include "Blockdevice.h"#include "windows.h"//==========================================================================// FAT defines & macros// -------------------------------------------------------------------------// FAT dir entry attributes#define DENTRY_ATTR_RDONLY  0x01 // Read only#define DENTRY_ATTR_HIDDEN  0x02 // Hidden#define DENTRY_ATTR_SYSTEM  0x04 // System#define DENTRY_ATTR_VOLUME  0x08 // Volume label#define DENTRY_ATTR_DIR     0x10 // Subdirectory#define DENTRY_ATTR_ARCHIVE 0x20 // Needs archiving// -------------------------------------------------------------------------// FAT dir entry attributes macros#define DENTRY_IS_RDONLY(_dentry_)  ((_dentry_)->attr & DENTRY_ATTR_RDONLY)#define DENTRY_IS_HIDDEN(_dentry_)  ((_dentry_)->attr & DENTRY_ATTR_HIDDEN)#define DENTRY_IS_SYSTEM(_dentry_)  ((_dentry_)->attr & DENTRY_ATTR_SYSTEM)#define DENTRY_IS_VOLUME(_dentry_)  ((_dentry_)->attr & DENTRY_ATTR_VOLUME)#define DENTRY_IS_DIR(_dentry_)     ((_dentry_)->attr & DENTRY_ATTR_DIR)#define DENTRY_IS_ARCHIVE(_dentry_) ((_dentry_)->attr & DENTRY_ATTR_ARCHIVE)#define DENTRY_IS_DELETED(_dentry_) \    (0xE5 == (unsigned char)((_dentry_)->name[0]))#define DENTRY_IS_ZERO(_dentry_) \    (0x00 == (unsigned char)((_dentry_)->name[0]))// -------------------------------------------------------------------------// FAT disk data access macros// FIXME: support big endian machines!   #define GET_BYTE(_data_, _var_, _off_) \    (_var_ = *( ((cyg_uint8 *)_data_) + (_off_) ) )#define GET_WORD(_data_, _var_, _off_)                      \    (_var_ = *( ((cyg_uint8 *)_data_) + (_off_) ) |         \             *( ((cyg_uint8 *)_data_) + (_off_) + 1 ) << 8)#define GET_DWORD(_data_, _var_, _off_)                         \    (_var_ = *( ((cyg_uint8 *)_data_) + (_off_))             |  \             *( ((cyg_uint8 *)_data_) + (_off_) + 1 ) << 8   |  \             *( ((cyg_uint8 *)_data_) + (_off_) + 2 ) << 16  |  \             *( ((cyg_uint8 *)_data_) + (_off_) + 3 ) << 24)#define GET_BYTES(_data_, _var_, _size_, _off_) \    memcpy((void *)(_var_), (void*)(((cyg_uint8 *)_data_)+(_off_)),_size_)#define SET_BYTE(_data_, _val_, _off_) \    (*( ((cyg_uint8 *)_data_) + (_off_) ) = _val_)#define SET_WORD(_data_, _val_, _off_)                                   \    do {                                                                 \        *( ((cyg_uint8 *)_data_) + (_off_) )     = _val_         & 0xFF; \        *( ((cyg_uint8 *)_data_) + (_off_) + 1 ) = (_val_ >> 8)  & 0xFF; \    } while (0)#define SET_DWORD(_data_, _val_, _off_)                                  \    do {                                                                 \        *( ((cyg_uint8 *)_data_) + (_off_) )     = _val_         & 0xFF; \        *( ((cyg_uint8 *)_data_) + (_off_) + 1 ) = (_val_ >> 8)  & 0xFF; \        *( ((cyg_uint8 *)_data_) + (_off_) + 2 ) = (_val_ >> 16) & 0xFF; \        *( ((cyg_uint8 *)_data_) + (_off_) + 3 ) = (_val_ >> 24) & 0xFF; \    } while (0)#define SET_BYTES(_data_, _var_, _size_, _off_) \    memcpy((void *)(((cyg_uint8 *)_data_)+(_off_)), (void *)(_var_), _size_)// -------------------------------------------------------------------------// FAT table entries types #define TENTRY_REGULAR  0 // Used when entry points to next file cluster #define TENTRY_FREE     1 // Free cluster#define TENTRY_LAST     2 // Last cluster of file #define TENTRY_RESERVED 3 // Reserved cluster#define TENTRY_BAD      4 // Bad cluster // -------------------------------------------------------------------------// FAT table structures size #define DENTRY_SIZE      0x20 // Dir entry size// -------------------------------------------------------------------------// Time & date defines #define JD_1_JAN_1970 2440588 // 1 Jan 1970 in Julian day number// -------------------------------------------------------------------------// Code tracing defines #ifdef FATFS_TRACE_FAT_TABLE# define TFT 1#else# define TFT 0#endif#ifdef FATFS_TRACE_DIR_ENTRY# define TDE 1#else# define TDE 0#endif#ifdef FATFS_TRACE_CLUSTER# define TCL 1#else# define TCL 0#endif#ifdef FATFS_TRACE_DATA# define TDO 1#else# define TDO 0#endif    // -------------------------------------------------------------------------// FAT table entry type strings #if TFTstatic const char *tentry_type_name[5] = {    "REGULAR", "FREE", "LAST", "RESERVED", "BAD"};   #endif//==========================================================================// FAT structures // -------------------------------------------------------------------------// FAT table boot record structure    typedef struct fat_boot_record_s{    cyg_uint16    jump;           // 00h : Jump code//  cyg_uint8     jump0;          //                 + NOP    char          oem_name[8+1];  // 03h : OEM name    cyg_uint16    bytes_per_sec;  // 0Bh : cyg_bytes per sector    cyg_uint8     sec_per_clust;  // 0Dh : Sectors per cluster    cyg_uint16    res_sec_num;    // 0Eh : Number of reserved sectors    cyg_uint8     fat_tbls_num;   // 10h : Number of copies of fat    cyg_uint16    max_root_dents; // 11h : Maximum number of root dir entries    cyg_uint16    sec_num_32;     // 13h : Number of sectors in partition < 32MB    cyg_uint8     media_desc;     // 15h : Media descriptor    cyg_uint16    sec_per_fat;    // 16h : Sectors per FAT    cyg_uint16    sec_per_track;  // 18h : Sectors per track    cyg_uint16    heads_num;      // 1Ah : Number of heads    cyg_uint32    hsec_num;       // 1Ch : Number of hidden sectors    cyg_uint32    sec_num;        // 20h : Number of sectors in partition    cyg_uint16    ldrv_num;       // 24h : Logical drive number of partition    cyg_uint8     ext_sig;        // 26h : Extended signature    cyg_uint32    ser_num;        // 27h : Serial number of partition    char          vol_name[11+1]; // 2Bh : Volume name of partition    char          fat_name[8+1];  // 36h : FAT name//  unsigned char exe_code[448];  // 3Eh : Executable code    unsigned char exe_marker[2];  // 1FEh: Executable marker (55h AAh)} fat_boot_record_t;// -------------------------------------------------------------------------// FAT dir entry structure  typedef struct fat_dir_entry_s{    char       name[8+1];       // 00h : Name    char       ext[3+1];        // 08h : Extension    cyg_uint8  attr;            // 0Bh : Attribute    cyg_uint8  nt_reserved;     // 0Ch : Win NT Reserved field    cyg_uint8  crt_sec_100;     // 0Dh : Creation time ms stamp 0 - 199    cyg_uint16 crt_time;        // 0Eh : Creation time    cyg_uint16 crt_date;        // 10h : Creation date    cyg_uint16 acc_date;        // 12h : Last access date    cyg_uint16 cluster_HI;      // 14h : Starting cluster HI WORD (FAT32)    cyg_uint16 wrt_time;        // 16h : Time        cyg_uint16 wrt_date;        // 18h : Date    cyg_uint16 cluster;         // 1Ah : Starting cluster     cyg_uint32 size;            // 1Ch : Size of the file        fatfs_data_pos_t pos;       // Positon on disk} fat_dir_entry_t;// -------------------------------------------------------------------------// FAT cluster opts  typedef enum cluster_opts_e{    CO_NONE       = 0x00, // NULL option    CO_EXTEND     = 0x01, // Extend cluster chain if one cluster too short    CO_ERASE_NEW  = 0x02, // Erase newly allocated cluster    CO_MARK_LAST  = 0x04  // Mark  newly allocated cluster as last} cluster_opts_t;//==========================================================================// Utility functions // -------------------------------------------------------------------------// get_val_log2()// Gets the log2 of given value or returns 0 if value is // not power of 2.  static cyg_uint32 get_val_log2(cyg_uint32 val){    cyg_uint32 i, log2;        i = val;    log2 = 0;    while (0 == (i & 1))    {        i >>= 1;        log2++;    }    if (i != 1)        return 0;    else        return log2;}// -------------------------------------------------------------------------// get_data_disk_apos()// Gets the absolute data position on disk from cluster number and// position inside given cluster.  static  cyg_uint32get_data_disk_apos(fatfs_disk_t *disk, cyg_uint32 cluster, cyg_uint32 pos){    return (disk->fat_data_pos + disk->cluster_size * (cluster - 2) + pos);}// -------------------------------------------------------------------------// jdays_to_gdate()// Converts juilan days into gregorian date. static voidjdays_to_gdate(cyg_uint32 jd, int *day, int *month, int *year){    cyg_uint32 l, n, i, j;    l = jd + 68569;    n = (4 * l) / 146097;    l = l - (146097 * n + 3) / 4;    i = (4000 * (l + 1)) / 1461001;    l = l - (1461 * i) / 4 + 31;    j = (80 * l) / 2447;    *day = l - (2447 * j) / 80;    l = j / 11;    *month = j + 2 - (12 * l);    *year = 100 * (n - 49) + i + l;}// -------------------------------------------------------------------------// gdate_to_jdays()// Converts gregorian date to juilan days. static voidgdate_to_jdays(int day, int month, int year, cyg_uint32 *jd){    *jd = day - 32075 + 1461*(year + 4800 + (month - 14)/12)/4 +          367*(month - 2 - (month - 14)/12*12)/12 -           3*((year + 4900 + (month - 14)/12)/100)/4;} // -------------------------------------------------------------------------// date_unix2dos()// Converts unix timestamp to dos time and date.                  static voiddate_unix2dos(cyg_uint32  unix_timestamp,               cyg_uint16 *dos_time,              cyg_uint16 *dos_date){    cyg_uint32 jd;    cyg_uint16 dtime, ddate;    int hour, min, sec;    int day, month, year;        hour = (unix_timestamp / 3600) % 24;    min  = (unix_timestamp / 60) % 60;    sec  =  unix_timestamp % 60;    jd = JD_1_JAN_1970 + unix_timestamp / (3600 * 24);    jdays_to_gdate(jd, &day, &month, &year);    printf( "ts=%d date=%d:%d:%d %d-%d-%d",                   unix_timestamp, hour, min, sec, year, month, day);    if (year < 1980)        year = 1980;    dtime = (hour << 11) | (min << 5) | (sec >> 1);    ddate = ((year - 1980) << 9) | (month << 5) | day;     printf( "dos time=%d date=%d", dtime, ddate);        if (NULL != dos_time) *dos_time = dtime;    if (NULL != dos_date) *dos_date = ddate;}// -------------------------------------------------------------------------// date_dos2unix()// Converts dos time and date to unix timestamp.  static voiddate_dos2unix(cyg_uint16  dos_time,               cyg_uint16  dos_date,               cyg_uint32 *unix_timestamp){    int hour, min, sec;    int day, month, year;    cyg_uint32 ts;         sec = (dos_time & ((1<<5)-1)) * 2;    dos_time >>= 5;    min = (dos_time & ((1<<6)-1));    dos_time >>= 6;    hour = dos_time;        day = (dos_date & ((1<<5)-1));    dos_date >>= 5;    month = (dos_date & ((1<<4)-1));    dos_date >>= 4;    year = dos_date + 1980;    gdate_to_jdays(day, month, year, &ts);    ts -= JD_1_JAN_1970;    ts = (ts * 24 * 3600) + (sec + min * 60 + hour * 3600);        *unix_timestamp = ts;    printf( "dos time=%d date=%d", dos_time, dos_date);    printf( "timestamp=%d date=%d:%d:%d %d-%d-%d",                    ts, hour, min, sec, year, month, day);}//==========================================================================// FAT boot record functions // -------------------------------------------------------------------------// print_boot_record()// Prints FAT boot record.#if TFT static voidprint_boot_record(fat_boot_record_t* fbr){    diag_printf("FAT: FBR jump code:       0x%02X\n", fbr->jump);    diag_printf("FAT: FBR oem name:       '%.8s'\n",  fbr->oem_name);    diag_printf("FAT: FBR bytes per sec:   %u\n",     fbr->bytes_per_sec);    diag_printf("FAT: FBR sec per cluster: %u\n",     fbr->sec_per_clust);    diag_printf("FAT: FBR reserved sec:    %u\n",     fbr->res_sec_num);    diag_printf("FAT: FBR fat tbls num:    %u\n",     fbr->fat_tbls_num);    diag_printf("FAT: FBR max root dents:  %u\n",     fbr->max_root_dents);    diag_printf("FAT: FBR sec num (32):    %u\n",     fbr->sec_num_32);    diag_printf("FAT: FBR media desc:      0x%02X\n", fbr->media_desc);    diag_printf("FAT: FBR sec per fat:     %u\n",     fbr->sec_per_fat);    diag_printf("FAT: FBR sec per track:   %u\n",     fbr->sec_per_track);    diag_printf("FAT: FBR heads num:       %u\n",     fbr->heads_num);    diag_printf("FAT: FBR hidden sec num:  %u\n",     fbr->hsec_num);    diag_printf("FAT: FBR sec num:         %u\n",     fbr->sec_num);    diag_printf("FAT: FBR log drv num:     %u\n",     fbr->ldrv_num);    diag_printf("FAT: FBR ext sig:         0x%02X\n", fbr->ext_sig);    diag_printf("FAT: FBR ser num:         0x%08X\n", fbr->ser_num);    diag_printf("FAT: FBR vol name:       '%.11s'\n", fbr->vol_name);    diag_printf("FAT: FBR fat name:       '%.8s'\n",  fbr->fat_name);    diag_printf("FAT: FBR exe mark:        0x%02X 0x%02X\n",                 fbr->exe_marker[0], fbr->exe_marker[1]);}#endif // TFT// -------------------------------------------------------------------------// read_boot_record()// Reads FAT boot record from disk. static int read_boot_record(fatfs_disk_t *disk, fat_boot_record_t *fbr){    int len, err;    unsigned char data[0x3E];        len = 0x3E;    err = ReadBlock((void*)data, &len, 0, 0);    if (err != ENOERR)        return err;       GET_WORD(data,  fbr->jump,           0x00);    GET_BYTES(data, fbr->oem_name, 8,    0x03);    GET_WORD(data,  fbr->bytes_per_sec,  0x0B);    GET_BYTE(data,  fbr->sec_per_clust,  0x0D);    GET_WORD(data,  fbr->res_sec_num,    0x0E);    GET_BYTE(data,  fbr->fat_tbls_num,   0x10);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91网页版在线| 一本大道av伊人久久综合| 国产精品乱码久久久久久| 欧美日韩亚洲国产综合| 东方aⅴ免费观看久久av| 午夜精品福利视频网站 | 亚洲欧美电影院| www久久久久| 欧美美女黄视频| 91玉足脚交白嫩脚丫在线播放| 久久99最新地址| 亚洲人成网站影音先锋播放| 久久蜜桃av一区二区天堂| 欧美视频在线一区| 91视频国产资源| 国产99久久久国产精品免费看| 久久精品国产亚洲aⅴ | 粉嫩高潮美女一区二区三区| 日韩av在线播放中文字幕| 依依成人综合视频| 亚洲人成网站色在线观看 | 石原莉奈在线亚洲二区| 亚洲欧美激情在线| 国产精品嫩草影院com| 久久婷婷久久一区二区三区| 91精品国产91久久久久久一区二区 | 亚洲国产精品一区二区www| 欧美极品少妇xxxxⅹ高跟鞋| 精品不卡在线视频| 日韩欧美一二三| 正在播放亚洲一区| 欧美日韩1234| 欧美丰满一区二区免费视频 | 91亚洲精品久久久蜜桃网站| 国产盗摄一区二区三区| 国内不卡的二区三区中文字幕 | 一区二区三区欧美| 一区二区三区久久久| 亚洲美女少妇撒尿| 亚洲美女区一区| 亚洲一区自拍偷拍| 亚洲成人一区在线| 日韩精品一二三| 精品中文字幕一区二区小辣椒| 青青草97国产精品免费观看无弹窗版 | 国产免费久久精品| 亚洲国产精品av| 国产精品国产精品国产专区不片| 中文成人综合网| 一区视频在线播放| 伊人开心综合网| 亚洲国产精品久久艾草纯爱| 亚洲成人av资源| 蜜臀av一级做a爰片久久| 精品中文av资源站在线观看| 国产一区二区美女诱惑| 成人在线视频一区二区| 99国产精品99久久久久久| 一本久久a久久免费精品不卡| 成人av动漫在线| 欧洲精品在线观看| 3d动漫精品啪啪1区2区免费| 欧美mv日韩mv国产网站app| 国产亚洲一本大道中文在线| 综合在线观看色| 午夜视频在线观看一区| 国产在线精品视频| av中文字幕在线不卡| 欧美日韩一区二区三区视频| 日韩欧美国产电影| 综合激情成人伊人| 日韩一区精品字幕| 国产91清纯白嫩初高中在线观看| 不卡电影免费在线播放一区| 色噜噜久久综合| 精品久久五月天| 亚洲精品亚洲人成人网| 激情六月婷婷久久| 日本精品视频一区二区| 精品粉嫩超白一线天av| 亚洲欧美一区二区三区国产精品| 天堂资源在线中文精品| 成人一区二区三区| 欧美区在线观看| 中文字幕五月欧美| 久久精品国产一区二区三| 97久久精品人人澡人人爽| 日韩精品一区二区三区视频播放| 国产精品国产馆在线真实露脸| 性感美女久久精品| 99国产精品久| 精品国产伦一区二区三区观看体验| 亚洲少妇30p| 久久99精品久久久久| 色先锋久久av资源部| 欧美成人性福生活免费看| 亚洲欧美另类小说视频| 国产一区二区三区在线看麻豆 | 久久天堂av综合合色蜜桃网| 一区二区在线观看不卡| 国产精一区二区三区| 欧美性大战久久久久久久| 国产欧美一区视频| 美日韩黄色大片| 欧美色偷偷大香| ...中文天堂在线一区| 国产一区二区三区不卡在线观看 | 91精品国产黑色紧身裤美女| 亚洲男人的天堂在线aⅴ视频| 国产一区日韩二区欧美三区| 欧美日韩免费观看一区三区| 亚洲欧洲日韩在线| 国产精品亚洲午夜一区二区三区 | 欧美色成人综合| 国产精品成人在线观看| 国产一区二区三区观看| 日韩欧美高清在线| 亚欧色一区w666天堂| 欧美亚洲一区三区| 亚洲精品国产第一综合99久久| 国产成人综合亚洲网站| 日韩美一区二区三区| 亚洲va在线va天堂| 欧美探花视频资源| 一区二区三区四区不卡在线 | 亚洲在线成人精品| 99久久精品免费| 国产精品卡一卡二| aa级大片欧美| 日韩美女视频一区| 99国产欧美另类久久久精品| 国产精品水嫩水嫩| 成人黄色一级视频| 中文字幕在线观看一区| 成人av影院在线| 亚洲人成亚洲人成在线观看图片| 99在线热播精品免费| 自拍偷拍国产精品| 色爱区综合激月婷婷| 亚洲在线视频一区| 欧美日韩国产首页| 日本视频免费一区| 精品久久国产字幕高潮| 国内精品免费**视频| 国产校园另类小说区| 粉嫩av一区二区三区在线播放| 国产日韩精品一区| 成人激情图片网| 一区二区三区中文字幕| 欧美唯美清纯偷拍| 久久精品国产亚洲a| 国产日韩欧美综合在线| 成人av免费观看| 亚洲午夜精品在线| 日韩欧美电影在线| 成人网男人的天堂| 亚洲综合视频在线观看| 91精品国产全国免费观看| 国产尤物一区二区| 亚洲天堂a在线| 欧美久久久久久蜜桃| 狠狠狠色丁香婷婷综合激情| 欧美国产1区2区| 欧美在线免费播放| 久久se精品一区二区| 国产精品区一区二区三区| 色综合天天综合网天天看片| 日日摸夜夜添夜夜添国产精品| 精品国产凹凸成av人导航| caoporn国产精品| 首页国产欧美日韩丝袜| 国产亚洲综合av| 欧美性xxxxx极品少妇| 国产一区二区三区精品欧美日韩一区二区三区| 国产欧美日韩亚州综合| 欧美三日本三级三级在线播放| 黄色成人免费在线| 伊人性伊人情综合网| 欧美精品一区二区久久婷婷| 99re热这里只有精品免费视频| 日韩高清不卡一区二区| 中文字幕电影一区| 欧美一区二区三区视频在线| ...av二区三区久久精品| 丝袜脚交一区二区| 亚洲国产精品精华液ab| 欧美日韩高清影院| 岛国av在线一区| 蜜桃久久av一区| 亚洲精品免费看| 久久久精品蜜桃| 欧美精品一二三| 99免费精品视频| 狠狠色丁香婷综合久久| 一区二区三区欧美激情| 欧美激情艳妇裸体舞| 日韩免费观看高清完整版| 91福利在线播放| 不卡在线视频中文字幕| 久久爱另类一区二区小说|