Skip to content

chore(radio): update FatFs to R0.15 #4843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions radio/src/hal/fatfs_diskio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,19 @@ uint8_t fatfsGetLun(uint8_t pdrv)

#if FF_FS_REENTRANT != 0

int ff_cre_syncobj(BYTE vol, FF_SYNC_t* mutex)
int ff_mutex_create(int vol)
{
*mutex = _fatfs_drives[vol].mutex;
return 1;
}

int ff_req_grant(FF_SYNC_t mutex)
int ff_mutex_take(int vol)
{
RTOS_LOCK_MUTEX(mutex);
return 1;
return RTOS_LOCK_MUTEX(_fatfs_drives[vol].mutex);
}

void ff_rel_grant(FF_SYNC_t mutex) { RTOS_UNLOCK_MUTEX(mutex); }
void ff_mutex_give(int vol) { RTOS_UNLOCK_MUTEX(_fatfs_drives[vol].mutex); }

int ff_del_syncobj(FF_SYNC_t mutex) { return 1; }
void ff_mutex_delete(int vol) { }

#endif

Expand Down
4 changes: 2 additions & 2 deletions radio/src/rtos.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ extern "C++" {
mutex = PTHREAD_MUTEX_INITIALIZER;
}

static inline void RTOS_LOCK_MUTEX(pthread_mutex_t &mutex)
static inline bool RTOS_LOCK_MUTEX(pthread_mutex_t &mutex)
{
pthread_mutex_lock(&mutex);
return pthread_mutex_lock(&mutex) == 0;
}

static inline bool RTOS_TRYLOCK_MUTEX(pthread_mutex_t &mutex)
Expand Down
2 changes: 1 addition & 1 deletion radio/src/targets/simu/simufatfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define MSVC_BUILD 0
#endif

// NOTE: the #include order is important here, sensitive on different platoforms.
// NOTE: the #include order is important here, sensitive on different platforms.
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
Expand Down
41 changes: 40 additions & 1 deletion radio/src/thirdparty/FatFs/00history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ R0.12b (September 04, 2016)
R0.12c (March 04, 2017)

Improved write throughput at the fragmented file on the exFAT volume.
Made memory usage for exFAT be able to be reduced as decreasing FF_MAX_LFN.
Made memory usage for exFAT be able to be reduced as decreasing _MAX_LFN.
Fixed successive f_getfree() can return wrong count on the FAT12/16 volume. (appeared at R0.12)
Fixed configuration option _VOLUMES cannot be set 10. (appeared at R0.10c)

Expand Down Expand Up @@ -328,3 +328,42 @@ R0.13c (October 14, 2018)
Fixed creating a sub-directory in the fragmented sub-directory on the exFAT volume collapses FAT chain of the parent directory. (appeared at R0.12)
Fixed f_getcwd() cause output buffer overrun when the buffer has a valid drive number. (appeared at R0.13b)



R0.14 (October 14, 2019)
Added support for 64-bit LBA and GUID partition table (FF_LBA64 = 1)
Changed some API functions, f_mkfs() and f_fdisk().
Fixed f_open() function cannot find the file with file name in length of FF_MAX_LFN characters.
Fixed f_readdir() function cannot retrieve long file names in length of FF_MAX_LFN - 1 characters.
Fixed f_readdir() function returns file names with wrong case conversion. (appeared at R0.12)
Fixed f_mkfs() function can fail to create exFAT volume in the second partition. (appeared at R0.12)


R0.14a (December 5, 2020)
Limited number of recursive calls in f_findnext().
Fixed old floppy disks formatted with MS-DOS 2.x and 3.x cannot be mounted.
Fixed some compiler warnings.



R0.14b (April 17, 2021)
Made FatFs uses standard library <string.h> for copy, compare and search instead of built-in string functions.
Added support for long long integer and floating point to f_printf(). (FF_STRF_LLI and FF_STRF_FP)
Made path name parser ignore the terminating separator to allow "dir/".
Improved the compatibility in Unix style path name feature.
Fixed the file gets dead-locked when f_open() failed with some conditions. (appeared at R0.12a)
Fixed f_mkfs() can create wrong exFAT volume due to a timing dependent error. (appeared at R0.12)
Fixed code page 855 cannot be set by f_setcp().
Fixed some compiler warnings.



R0.15 (November 6, 2022)
Changed user provided synchronization functions in order to completely eliminate the platform dependency from FatFs code.
FF_SYNC_t is removed from the configuration options.
Fixed a potential error in f_mount when FF_FS_REENTRANT.
Fixed file lock control FF_FS_LOCK is not mutal excluded when FF_FS_REENTRANT && FF_VOLUMES > 1 is true.
Fixed f_mkfs() creates broken exFAT volume when the size of volume is >= 2^32 sectors.
Fixed string functions cannot write the unicode characters not in BMP when FF_LFN_UNICODE == 2 (UTF-8).
Fixed a compatibility issue in identification of GPT header.

2 changes: 1 addition & 1 deletion radio/src/thirdparty/FatFs/00readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FatFs Module Source Files R0.13c
FatFs Module Source Files R0.15


FILES
Expand Down
2 changes: 1 addition & 1 deletion radio/src/thirdparty/FatFs/LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ FatFs has being developped as a personal project of the author, ChaN. It is free
/ by use of this software.
/----------------------------------------------------------------------------*/

Therefore FatFs license is one of the BSD-style licenses but there is a significant feature. FatFs is mainly intended for embedded systems. In order to extend the usability for commercial products, the redistributions of FatFs in binary form, such as embedded code, binary library and any forms without source code, does not need to include about FatFs in the documentations. This is equivalent to the 1-clause BSD license. Of course FatFs is compatible with the most of open source software licenses including GNU GPL. When you redistribute the FatFs source code with any changes or create a fork, the license can also be changed to GNU GPL, BSD-style license or any open source software license that not conflict with FatFs license.
Therefore FatFs license is one of the BSD-style licenses, but there is a significant feature. FatFs is mainly intended for embedded systems. In order to extend the usability for commercial products, the redistributions of FatFs in binary form, such as embedded code, binary library and any forms without source code, do not need to include about FatFs in the documentations. This is equivalent to the 1-clause BSD license. Of course FatFs is compatible with the most of open source software licenses include GNU GPL. When you redistribute the FatFs source code with changes or create a fork, the license can also be changed to GNU GPL, BSD-style license or any open source software license that not conflict with FatFs license.
7 changes: 4 additions & 3 deletions radio/src/thirdparty/FatFs/diskio.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*-----------------------------------------------------------------------/
/ Low level disk interface modlue include file (C)ChaN, 2014 /
/ Low level disk interface modlue include file (C)ChaN, 2019 /
/-----------------------------------------------------------------------*/

#ifndef _DISKIO_DEFINED
Expand Down Expand Up @@ -30,10 +30,11 @@ typedef enum {

DSTATUS disk_initialize (BYTE pdrv);
DSTATUS disk_status (BYTE pdrv);
DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
DRESULT disk_read (BYTE pdrv, BYTE* buff, LBA_t sector, UINT count);
DRESULT disk_write (BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count);
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);


/* Disk Status Bits (DSTATUS) */

#define STA_NOINIT 0x01 /* Drive not initialized */
Expand Down
Loading