From cba2dd901652ec6705da6922d0a0923f111a9768 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 25 Sep 2021 11:59:13 -0400 Subject: [PATCH 1/4] =?UTF-8?q?[fatfs]=20=E4=BF=AE=E6=94=B9=E4=BA=92?= =?UTF-8?q?=E6=96=A5=E4=BF=9D=E6=8A=A4=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4?= =?UTF-8?q?=20=E9=98=B2=E6=AD=A2=E5=9B=A0=E4=B8=80=E4=BA=9B=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E5=A4=8D=E6=9D=82=E8=80=97=E6=97=B6=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4fatfs=E8=AE=A4=E4=B8=BA=20timeout=20?= =?UTF-8?q?failure=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/filesystems/elmfat/ffconf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/dfs/filesystems/elmfat/ffconf.h b/components/dfs/filesystems/elmfat/ffconf.h index a17a07d8ea..d62ee4906a 100644 --- a/components/dfs/filesystems/elmfat/ffconf.h +++ b/components/dfs/filesystems/elmfat/ffconf.h @@ -295,12 +295,13 @@ / lock control is independent of re-entrancy. */ /* #include // O/S definitions */ +#include #ifdef RT_DFS_ELM_REENTRANT #define FF_FS_REENTRANT 1 /* 0 or 1 */ #else #define FF_FS_REENTRANT 0 /* 0:Disable or 1:Enable */ #endif -#define FF_FS_TIMEOUT 1000 +#define FF_FS_TIMEOUT 3000 #define FF_SYNC_t rt_mutex_t /* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs / module itself. Note that regardless of this option, file access to different From 50e215cfd4ef4bd9b57c70612a4704454e689130 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 25 Sep 2021 12:00:44 -0400 Subject: [PATCH 2/4] =?UTF-8?q?[dfs][filesystems]=20=E5=A2=9E=E5=8A=A0form?= =?UTF-8?q?at=5Fignore=E6=96=87=E4=BB=B6=EF=BC=8C=E6=8E=92=E9=99=A4fatfs?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/filesystems/.ignore_format.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 components/dfs/filesystems/.ignore_format.yml diff --git a/components/dfs/filesystems/.ignore_format.yml b/components/dfs/filesystems/.ignore_format.yml new file mode 100644 index 0000000000..e72719df1d --- /dev/null +++ b/components/dfs/filesystems/.ignore_format.yml @@ -0,0 +1,4 @@ +# files format check exclude path, please follow the instructions below to modify; + +dir_path: +- elmfat From 32e9aa21c4afc5b1f6f163d58644174d3783032f Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 25 Sep 2021 12:15:41 -0400 Subject: [PATCH 3/4] =?UTF-8?q?[fatfs]=20=E4=BF=AE=E5=A4=8Dtime=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=87=BD=E6=95=B0=E5=BC=80=E5=90=AF=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/filesystems/elmfat/dfs_elm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c index 41f99d7b62..01d303f71f 100644 --- a/components/dfs/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/filesystems/elmfat/dfs_elm.c @@ -945,7 +945,7 @@ DWORD get_fattime(void) { DWORD fat_time = 0; -#ifdef RT_LIBC_USING_TIME +#if defined(RT_LIBC_USING_TIME) || defined(RT_USING_LIBC) time_t now; struct tm *p_tm; struct tm tm_now; @@ -968,7 +968,7 @@ DWORD get_fattime(void) (DWORD)tm_now.tm_hour << 11 | (DWORD)tm_now.tm_min << 5 | (DWORD)tm_now.tm_sec / 2 ; -#endif /* RT_USING_LIBC */ +#endif /* defined(RT_LIBC_USING_TIME) || defined(RT_USING_LIBC) */ return fat_time; } From 1d00635ee92760b59e45e55b1d47199201c0a390 Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Sat, 25 Sep 2021 13:45:55 -0400 Subject: [PATCH 4/4] =?UTF-8?q?[fatfs]=20=E4=BA=92=E6=96=A5=E9=87=8F?= =?UTF-8?q?=E4=BF=9D=E6=8A=A4=E8=B6=85=E6=97=B6=E5=8F=AF=E9=80=9A=E8=BF=87?= =?UTF-8?q?Kconfig=E9=85=8D=E7=BD=AE=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/dfs/Kconfig | 6 ++++++ components/dfs/filesystems/elmfat/ffconf.h | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/components/dfs/Kconfig b/components/dfs/Kconfig index 442c3bb260..7a4fbb655d 100644 --- a/components/dfs/Kconfig +++ b/components/dfs/Kconfig @@ -122,6 +122,12 @@ if RT_USING_DFS config RT_DFS_ELM_REENTRANT bool "Enable the reentrancy (thread safe) of the FatFs module" default y + + config RT_DFS_ELM_MUTEX_TIMEOUT + int "Timeout of thread-safe protection mutex" + range 0 1000000 + default 3000 + depends on RT_DFS_ELM_REENTRANT endmenu endif diff --git a/components/dfs/filesystems/elmfat/ffconf.h b/components/dfs/filesystems/elmfat/ffconf.h index d62ee4906a..a6dcebe228 100644 --- a/components/dfs/filesystems/elmfat/ffconf.h +++ b/components/dfs/filesystems/elmfat/ffconf.h @@ -301,7 +301,10 @@ #else #define FF_FS_REENTRANT 0 /* 0:Disable or 1:Enable */ #endif -#define FF_FS_TIMEOUT 3000 +#ifndef RT_DFS_ELM_MUTEX_TIMEOUT +#define RT_DFS_ELM_MUTEX_TIMEOUT 3000 +#endif +#define FF_FS_TIMEOUT RT_DFS_ELM_MUTEX_TIMEOUT #define FF_SYNC_t rt_mutex_t /* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs / module itself. Note that regardless of this option, file access to different