Browse Source

fix:fatfs关闭中文支持就无法读写文件了

alienwalker 3 years ago
parent
commit
8b210c5b8c
2 changed files with 10 additions and 8 deletions
  1. 7 7
      components/fatfs/diskio_spitf.c
  2. 3 1
      components/fatfs/ffconf.h

+ 7 - 7
components/fatfs/diskio_spitf.c

@@ -843,10 +843,10 @@ static void luat_spitf_write_blocks(luat_spitf_ctrl_t *spitf, const uint8_t *Buf
 	{
 		if (luat_spitf_cmd(spitf, CMD16, 512, 1))
 		{
-			goto SDHC_SPIREADBLOCKS_ERROR;
+			goto SDHC_SPIWRITEBLOCKS_ERROR;
 		}
 	}
-SDHC_SPIREADBLOCKS_START:
+SDHC_SPIWRITEBLOCKS_START:
 	if (spitf->SDSC)
 	{
 		address = (StartLBA + spitf->DataBuf.Pos) * 512;
@@ -857,11 +857,11 @@ SDHC_SPIREADBLOCKS_START:
 	}
 	if (luat_spitf_cmd(spitf, CMD25, address, 0))
 	{
-		goto SDHC_SPIREADBLOCKS_ERROR;
+		goto SDHC_SPIWRITEBLOCKS_ERROR;
 	}
 	if (luat_spitf_write_data(spitf))
 	{
-		goto SDHC_SPIREADBLOCKS_ERROR;
+		goto SDHC_SPIWRITEBLOCKS_ERROR;
 	}
 	if (spitf->DataBuf.Pos != spitf->DataBuf.MaxLen)
 	{
@@ -870,12 +870,12 @@ SDHC_SPIREADBLOCKS_START:
 		if (Retry > 3)
 		{
 			spitf->SDHCError = 1;
-			goto SDHC_SPIREADBLOCKS_ERROR;
+			goto SDHC_SPIWRITEBLOCKS_ERROR;
 		}
-		goto SDHC_SPIREADBLOCKS_START;
+		goto SDHC_SPIWRITEBLOCKS_START;
 	}
 	return;
-SDHC_SPIREADBLOCKS_ERROR:
+SDHC_SPIWRITEBLOCKS_ERROR:
 	luat_spitf_cs(spitf, 0);
 	LLOGD("write error!");
 	spitf->IsInitDone = 0;

+ 3 - 1
components/fatfs/ffconf.h

@@ -116,7 +116,9 @@
 #ifdef  LUAT_USE_FATFS_CHINESE
 #define FF_USE_LFN		2
 #else
-#define FF_USE_LFN		0
+#define FF_USE_LFN		2
+#undef FF_CODE_PAGE
+#define FF_CODE_PAGE	437
 #endif
 #define FF_MAX_LFN		255
 /* The FF_USE_LFN switches the support for LFN (long file name).