文件系统一边接收数据一边写向SD卡写数据,open文件的时候失败

[复制链接]
 楼主| 卡拉瓦乔 发表于 2018-7-11 14:42 | 显示全部楼层 |阅读模式
TFTP进行IAP升级时,一边接收数据一边向SD卡写bin文件时,在open SD卡文件时失败,一直在找不到文件,在这个do..while中循环:

do {
  res = move_window(fs, dp->sect);
  if (res != FR_OK) break;
  c = dp->dir[DIR_Name];
  if (c == 0) { res = FR_NO_FILE; break; } /* Reached to end of table */
#if _USE_LFN != 0 /* LFN configuration */
  dp->obj.attr = a = dp->dir[DIR_Attr] & AM_MASK;
  if (c == DDEM || ((a & AM_VOL) && a != AM_LFN)) { /* An entry without valid data */
   ord = 0xFF; dp->blk_ofs = 0xFFFFFFFF; /* Reset LFN sequence */
  } else {
   if (a == AM_LFN) {   /* An LFN entry is found */
    if (dp->lfn) {
     if (c & LLEF) {  /* Is it start of LFN sequence? */
      sum = dp->dir[LDIR_Chksum];
      c &= ~LLEF; ord = c; /* LFN start order */
      dp->blk_ofs = dp->dptr; /* Start offset of LFN */
     }
     /* Check validity of the LFN entry and compare it with given name */
     ord = (c == ord && sum == dp->dir[LDIR_Chksum] && cmp_lfn(dp->lfn, dp->dir)) ? ord - 1 : 0xFF;
    }
   } else {     /* An SFN entry is found */
    if (!ord && sum == sum_sfn(dp->dir)) break; /* LFN matched? */
    if (!(dp->fn[NSFLAG] & NS_LOSS) && !mem_cmp(dp->dir, dp->fn, 11)) break; /* SFN matched? */
    ord = 0xFF; dp->blk_ofs = 0xFFFFFFFF; /* Reset LFN sequence */
   }
  }
#else  /* Non LFN configuration */
  dp->obj.attr = dp->dir[DIR_Attr] & AM_MASK;
  if (!(dp->dir[DIR_Attr] & AM_VOL) && !mem_cmp(dp->dir, dp->fn, 11)) break; /* Is it a valid entry? */
#endif
  res = dir_next(dp, 0); /* Next entry */
} while (res == FR_OK);



但是在spi flash或者在nandflash中操作时就没有问题,求大神指教!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

438

主题

438

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部

438

主题

438

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部