硬汉嵌入式论坛

 找回密码
 立即注册
查看: 3669|回复: 2
收起左侧

[有问必答] 使用fatfs v0.11版本 请教 ?

[复制链接]

614

主题

3070

回帖

4932

积分

至尊会员

积分
4932
发表于 2017-5-4 17:08:46 | 显示全部楼层 |阅读模式
请教下,
我现在想把fatfs v0.12版本改成 使用 fatfs v0.11,出现下面的情况,该如何修改啊 ??
fatfs v0.12 的版本里面有个
if(totsize == 0)   //仅仅是单个文件复制
{
totsize = fsrc->obj.objsize;        // 这个是 fatfs v0.12 版本里面的,但是在 fatfs v0.11里面没有,那么此处应该对应 v0.11版本里面的哪个变量啊 ???
lcpdsize = 0;
curpct   = 0;
}


在fatfs v0.11 里面找到    DWORD        clust;                        /* Current cluster of fpter (not valid when fprt is 0) */
对应 fatfs v0.11                          fsrc->fsize;                     // 如果改成这样,不知道对不对  ??????????????????????????????


/* 下面这个是 fatfs v0.11 版本 */
/* File object structure (FIL) */

typedef struct {
#if !_FS_TINY
  union{  
        UINT        d32[_MAX_SS/4]; /* Force 32bits alignement */     
        BYTE        d8[_MAX_SS];        /* File data read/write buffer */
  }buf;
#endif
        FATFS*        fs;                                /* Pointer to the related file system object (**do not change order**) */
        WORD        id;                                /* Owner file system mount ID (**do not change order**) */
        BYTE        flag;                        /* Status flags */
        BYTE        err;                        /* Abort flag (error code) */
        DWORD        fptr;                        /* File read/write pointer (Zeroed on file open) */
        DWORD        fsize;                        /* File size */
        DWORD        sclust;                        /* File start cluster (0:no cluster chain, always 0 when fsize is 0) */
        DWORD        clust;                        /* Current cluster of fpter (not valid when fprt is 0) */
        DWORD        dsect;                        /* Sector number appearing in buf[] (0:invalid) */
#if !_FS_READONLY
        DWORD        dir_sect;                /* Sector number containing the directory entry */
        BYTE*        dir_ptr;                /* Pointer to the directory entry in the win[] */
#endif
#if _USE_FASTSEEK
        DWORD*        cltbl;                        /* Pointer to the cluster link map table (Nulled on file open) */
#endif
#if _FS_LOCK
        UINT        lockid;                        /* File lock ID origin from 1 (index of file semaphore table Files[]) */
#endif

} FIL;


// ==================================================================
// ==================================================================
// ==================================================================
// ==================================================================

// 下面这个是 fatfs v0.12 版本里面的
typedef struct {
        FATFS*        fs;                        /* Pointer to the owner file system object */
        WORD        id;                        /* Owner file system mount ID */
        BYTE        attr;                /* Object attribute */
        BYTE        stat;                /* Object chain status (b1-0: =0:not contiguous, =2:contiguous (no data on FAT), =3:got flagmented, b2:sub-directory stretched) */
        DWORD        sclust;                /* Object start cluster (0:no cluster or root directory) */
        FSIZE_t        objsize;        /* Object size (valid when sclust != 0) */
#if _FS_EXFAT
        DWORD        n_cont;                /* Size of coutiguous part, clusters - 1 (valid when stat == 3) */
        DWORD        c_scl;                /* Containing directory start cluster (valid when sclust != 0) */
        DWORD        c_size;                /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
        DWORD        c_ofs;                /* Offset in the containing directory (valid when sclust != 0) */
#endif
#if _FS_LOCK != 0
        UINT        lockid;                /* File lock ID origin from 1 (index of file semaphore table Files[]) */
#endif
} _FDID;



/* File object structure (FIL) */

typedef struct {
        _FDID        obj;                        /* Object identifier (must be the 1st member to detect invalid object pointer) */
        BYTE        flag;                        /* File status flags */
        BYTE        err;                        /* Abort flag (error code) */
        FSIZE_t        fptr;                        /* File read/write pointer (Zeroed on file open) */
        DWORD        clust;                        /* Current cluster of fpter (invalid when fprt is 0) */
        DWORD        sect;                        /* Sector number appearing in buf[] (0:invalid) */
#if !_FS_READONLY
        DWORD        dir_sect;                /* Sector number containing the directory entry */
        BYTE*        dir_ptr;                /* Pointer to the directory entry in the win[] */
#endif
#if _USE_FASTSEEK
        DWORD*        cltbl;                        /* Pointer to the cluster link map table (nulled on open, set by application) */
#endif
#if !_FS_TINY
        BYTE        buf[_MAX_SS];        /* File private data read/write window */
#endif
} FIL;
回复

使用道具 举报

20

主题

249

回帖

309

积分

高级会员

积分
309
发表于 2017-5-4 22:36:14 | 显示全部楼层
为啥要改成0.11呢,0.12c不是很好用吗
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107527
QQ
发表于 2017-5-5 10:19:16 | 显示全部楼层
这个是哪里弄的,0.11用不到。
if(totsize == 0)   //仅仅是单个文件复制
{
totsize = fsrc->obj.objsize;        // 这个是 fatfs v0.12 版本里面的,但是在 fatfs v0.11里面没有,那么此处应该对应 v0.11版本里面的哪个变量啊 ???
lcpdsize = 0;
curpct   = 0;
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-6-4 21:33 , Processed in 0.154188 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表