exfat支持修复。添加uart框架中控485端口功能完成

This commit is contained in:
sc committed 2025-10-25 17:56:52 +08:00
1 parent 43f2057b44
commit fd04893625
17 files changed
+1269 -648

No files matched your search

@@ -863,7 +863,7 @@ DSTATUS disk_status(BYTE drv)
}
/* Read Sector(s) */
DRESULT disk_read(BYTE drv, BYTE *buff, DWORD sector, UINT count)
/*DRESULT disk_read(BYTE drv, BYTE *buff, DWORD sector, UINT count)
{
rt_size_t result;
rt_device_t device = disk[drv];
@@ -875,10 +875,22 @@ DRESULT disk_read(BYTE drv, BYTE *buff, DWORD sector, UINT count)
}
return RES_ERROR;
}
}*/
DRESULT disk_read(BYTE drv, BYTE *buff, LBA_t sector, UINT count)
{
rt_size_t result;
rt_device_t device = disk[drv];
result = rt_device_read(device, sector, buff, count);
if (result == count)
{
return RES_OK;
}
return RES_ERROR;
}
/* Write Sector(s) */
DRESULT disk_write(BYTE drv, const BYTE *buff, DWORD sector, UINT count)
/*DRESULT disk_write(BYTE drv, const BYTE *buff, DWORD sector, UINT count)
{
rt_size_t result;
rt_device_t device = disk[drv];
@@ -890,6 +902,19 @@ DRESULT disk_write(BYTE drv, const BYTE *buff, DWORD sector, UINT count)
}
return RES_ERROR;
}*/
DRESULT disk_write(BYTE drv, const BYTE *buff, LBA_t sector, UINT count)
{
rt_size_t result;
rt_device_t device = disk[drv];
result = rt_device_write(device, sector, buff, count);
if (result == count)
{
return RES_OK;
}
return RES_ERROR;
}
/* Miscellaneous Functions */
@@ -1025,4 +1050,3 @@ void ff_memfree(void *mem)
rt_free(mem);
}
#endif /* FF_USE_LFN == 3 */
@@ -2,20 +2,20 @@
/ FatFs Functional Configurations
/---------------------------------------------------------------------------*/
#define FFCONF_DEF 86631 /* Revision ID */
#define FFCONF_DEF 86631 /* Revision ID */
/*---------------------------------------------------------------------------/
/ Function Configurations
/---------------------------------------------------------------------------*/
#define FF_FS_READONLY 0
#define FF_FS_READONLY 0
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
/ and optional writing functions as well. */
#define FF_FS_MINIMIZE 0
#define FF_FS_MINIMIZE 0
/* This option defines minimization level to remove some basic API functions.
/
/ 0: Basic functions are fully enabled.
@@ -25,41 +25,41 @@
/ 3: f_lseek() function is removed in addition to 2. */
#define FF_USE_FIND 0
#define FF_USE_FIND 0
/* This option switches filtered directory read functions, f_findfirst() and
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
#define FF_USE_MKFS 1
#define FF_USE_MKFS 1
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
#define FF_USE_FASTSEEK 1
#define FF_USE_FASTSEEK 1
/* This option switches fast seek function. (0:Disable or 1:Enable) */
#define FF_USE_EXPAND 0
#define FF_USE_EXPAND 0
/* This option switches f_expand function. (0:Disable or 1:Enable) */
#define FF_USE_CHMOD 0
#define FF_USE_CHMOD 0
/* This option switches attribute manipulation functions, f_chmod() and f_utime().
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
#define FF_USE_LABEL 0
#define FF_USE_LABEL 0
/* This option switches volume label functions, f_getlabel() and f_setlabel().
/ (0:Disable or 1:Enable) */
#define FF_USE_FORWARD 0
#define FF_USE_FORWARD 0
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
#define FF_USE_STRFUNC 0
#define FF_PRINT_LLI 0
#define FF_PRINT_FLOAT 0
#define FF_STRF_ENCODE 3
#define FF_USE_STRFUNC 0
#define FF_PRINT_LLI 0
#define FF_PRINT_FLOAT 0
#define FF_STRF_ENCODE 3
/* FF_USE_STRFUNC switches string functions, f_gets(), f_putc(), f_puts() and
/ f_printf().
/
@@ -85,9 +85,9 @@
/---------------------------------------------------------------------------*/
#ifdef RT_DFS_ELM_CODE_PAGE
# define FF_CODE_PAGE RT_DFS_ELM_CODE_PAGE
# define FF_CODE_PAGE RT_DFS_ELM_CODE_PAGE
#else
# define FF_CODE_PAGE 936
# define FF_CODE_PAGE 936
#endif
/* This option specifies the OEM code page to be used on the target system.
/ Incorrect code page setting can cause a file open failure.
@@ -118,11 +118,11 @@
#if RT_DFS_ELM_USE_LFN
#define FF_USE_LFN RT_DFS_ELM_USE_LFN
#define FF_MAX_LFN RT_DFS_ELM_MAX_LFN
#define FF_USE_LFN RT_DFS_ELM_USE_LFN
#define FF_MAX_LFN RT_DFS_ELM_MAX_LFN
#else
#define FF_USE_LFN 0 /* 0 to 3 */
#define FF_MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
#define FF_USE_LFN 0 /* 0 to 3 */
#define FF_MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
#endif
/* The FF_USE_LFN switches the support for LFN (long file name).
/
@@ -152,9 +152,9 @@
/
/ Also behavior of string I/O functions will be affected by this option.
/ When LFN is not enabled, this option has no effect. */
#define FF_LFN_UNICODE RT_DFS_ELM_LFN_UNICODE /* 0:ANSI/OEM or 1:Unicode */
#define FF_LFN_UNICODE RT_DFS_ELM_LFN_UNICODE /* 0:ANSI/OEM or 1:Unicode */
#else
#define FF_LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */
#define FF_LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */
#endif
/* This option switches the character encoding on the API when LFN is enabled.
/
@@ -167,15 +167,15 @@
/ When LFN is not enabled, this option has no effect. */
#define FF_LFN_BUF 255
#define FF_SFN_BUF 12
#define FF_LFN_BUF 255
#define FF_SFN_BUF 12
/* This set of options defines size of file name members in the FILINFO structure
/ which is used to read out directory items. These values should be suffcient for
/ the file names to read. The maximum possible length of the read file name depends
/ on character encoding. When LFN is not enabled, these options have no effect. */
#define FF_FS_RPATH 0
#define FF_FS_RPATH 0
/* This option configures support for relative path.
/
/ 0: Disable relative path and remove related functions.
@@ -191,13 +191,13 @@
#ifdef RT_DFS_ELM_DRIVES
#define FF_VOLUMES RT_DFS_ELM_DRIVES
#else
#define FF_VOLUMES 1
#define FF_VOLUMES 1
#endif
/* Number of volumes (logical drives) to be used. (1-10) */
#define FF_STR_VOLUME_ID 0
#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
#define FF_STR_VOLUME_ID 0
#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
@@ -210,7 +210,7 @@
*/
#define FF_MULTI_PARTITION 0
#define FF_MULTI_PARTITION 0
/* This option switches support for multiple volumes on the physical drive.
/ By default (0), each logical drive number is bound to the same physical drive
/ number and only an FAT volume found on the physical drive will be mounted.
@@ -219,11 +219,11 @@
/ funciton will be available. */
#define FF_MIN_SS 512
#define FF_MIN_SS 512
#ifdef RT_DFS_ELM_MAX_SECTOR_SIZE
#define FF_MAX_SS RT_DFS_ELM_MAX_SECTOR_SIZE
#else
#define FF_MAX_SS 512 /* 512, 1024, 2048 or 4096 */
#define FF_MAX_SS 512 /* 512, 1024, 2048 or 4096 */
#endif
/* This set of options configures the range of sector size to be supported. (512,
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
@@ -233,17 +233,17 @@
/ GET_SECTOR_SIZE command. */
#define FF_LBA64 0
#define FF_LBA64 1
/* This option switches support for 64-bit LBA. (0:Disable or 1:Enable)
/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */
#define FF_MIN_GPT 0x10000000
#define FF_MIN_GPT 0x10000000
/* Minimum number of sectors to switch GPT as partitioning format in f_mkfs and
/ f_fdisk function. 0x100000000 max. This option has no effect when FF_LBA64 == 0. */
#define FF_USE_TRIM 0
#define FF_USE_TRIM 0
/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
/ To enable Trim function, also CTRL_TRIM command should be implemented to the
/ disk_ioctl() function. */
@@ -254,26 +254,26 @@
/ System Configurations
/---------------------------------------------------------------------------*/
#define FF_FS_TINY 0
#define FF_FS_TINY 0
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
/ Instead of private sector buffer eliminated from the file object, common sector
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
#define RT_DFS_ELM_USE_EXFAT//exfat支持
#ifdef RT_DFS_ELM_USE_EXFAT
#define FF_FS_EXFAT 1
#define FF_FS_EXFAT 1
#else
#define FF_FS_EXFAT 0
#define FF_FS_EXFAT 0
#endif
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
#define FF_FS_NORTC 0
#define FF_NORTC_MON 1
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2020
#define FF_FS_NORTC 0
#define FF_NORTC_MON 1
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2020
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
@@ -284,7 +284,7 @@
/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */
#define FF_FS_NOFSINFO 0
#define FF_FS_NOFSINFO 0
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option, and f_getfree() function at first time after volume mount will force
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
@@ -296,7 +296,7 @@
*/
#define FF_FS_LOCK 0
#define FF_FS_LOCK 0
/* The option FF_FS_LOCK switches file lock function to control duplicated file open
/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
/ is 1.
@@ -308,18 +308,18 @@
/ lock control is independent of re-entrancy. */
/* #include <somertos.h> // O/S definitions */
/* #include <somertos.h> // O/S definitions */
#include <rtdef.h>
#ifdef RT_DFS_ELM_REENTRANT
#define FF_FS_REENTRANT 1 /* 0 or 1 */
#define FF_FS_REENTRANT 1 /* 0 or 1 */
#else
#define FF_FS_REENTRANT 0 /* 0:Disable or 1:Enable */
#define FF_FS_REENTRANT 0 /* 0:Disable or 1:Enable */
#endif
#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
#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
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()