打印
[FPGA]

关于FPGA的问题1

[复制链接]
563|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
wangxd5429|  楼主 | 2015-3-6 10:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
FPGA, se, win, ST, ck

各位高手,小弟正在向NIOS上移植FATFS文件系统。移植完成后,调用f_open创建并打开一个文件,这个时候遇到“打开失败”。调试了一下,发现check_fs函数中的LD_WORD

(&fs->win[BS_55AA])!=0xAA55判断失败,返回2。请教其中的原因。谢谢!部分代码如下:

static

BYTE check_fs (   /* 0:FATboor sector, 1:Valid boor sector but not FAT, 2:Not a boot sector, 3:Disk error*/

    FATFS* fs, /* File system object */

    DWORD sect /* Sector# (lba) to check if it is an FAT boot record ornot */

)

{

    WORD temp;

   

    fs->wflag = 0; fs->winsect = 0xFFFFFFFF;  /* Invaidatewindow */

    if (move_window(fs, sect) != FR_OK)           /* Load bootrecord */

       return 3;

    if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55) /* Check bootrecord signature (always placed at offset 510 even if the sector size is>512) */

        return 2;

    if ((LD_DWORD(&fs->win[BS_FilSysType])& 0xFFFFFF) == 0x544146)    /* Check "FAT" string */

       return 0;

    if ((LD_DWORD(&fs->win[BS_FilSysType32]) &0xFFFFFF) == 0x544146)  /* Check "FAT" string */

       return 0;


    return 1;
}

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

79

主题

99

帖子

2

粉丝