未验证 提交 f44f4dfd 编写于 作者: B Bernard Xiong 提交者: GitHub

Merge pull request #5099 from mysterywolf/fatfs

[fatfs] 修改互斥保护超时时间, 并将超时时间改为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
......
# files format check exclude path, please follow the instructions below to modify;
dir_path:
- elmfat
......@@ -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;
}
......
......@@ -295,12 +295,16 @@
/ lock control is independent of re-entrancy. */
/* #include <somertos.h> // O/S definitions */
#include <rtdef.h>
#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
#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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册