diff --git a/ff_stdio.c b/ff_stdio.c index 97c806a..b6881a4 100644 --- a/ff_stdio.c +++ b/ff_stdio.c @@ -1137,9 +1137,9 @@ int ff_stat( const char * pcName, #if ( ffconfigTIME_SUPPORT == 1 ) { - pxStatBuffer->st_atime = prvFileTime( &( xDirEntry.xAccessedTime ) ); - pxStatBuffer->st_mtime = prvFileTime( &( xDirEntry.xModifiedTime ) ); - pxStatBuffer->st_ctime = prvFileTime( &( xDirEntry.xCreateTime ) ); + pxStatBuffer->ff_atime = prvFileTime( &( xDirEntry.xAccessedTime ) ); + pxStatBuffer->ff_mtime = prvFileTime( &( xDirEntry.xModifiedTime ) ); + pxStatBuffer->ff_ctime = prvFileTime( &( xDirEntry.xCreateTime ) ); } #endif } diff --git a/include/ff_stdio.h b/include/ff_stdio.h index 48bd9f9..dda075b 100755 --- a/include/ff_stdio.h +++ b/include/ff_stdio.h @@ -89,9 +89,9 @@ /* Note time_t must be used here otherwise will have bugs when 2032 (uint32_t second clock rolls over) */ #if ( ffconfigTIME_SUPPORT == 1 ) - time_t st_atime; - time_t st_mtime; - time_t st_ctime; + time_t ff_atime; + time_t ff_mtime; + time_t ff_ctime; #endif /* ffconfigTIME_SUPPORT */ } FF_Stat_t; diff --git a/portable/ATSAM4E/ff_sddisk.c b/portable/ATSAM4E/ff_sddisk.c index 30fc276..d5b5cd8 100644 --- a/portable/ATSAM4E/ff_sddisk.c +++ b/portable/ATSAM4E/ff_sddisk.c @@ -310,6 +310,15 @@ void FF_SDDiskFlush( FF_Disk_t * pxDisk ) } /*-----------------------------------------------------------*/ +FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName, + const FFInitSettings_t * pxSettings ) +{ + ( void ) pxSettings; /* Unused */ + + return FF_SDDiskInit( pcName ); +} +/*-----------------------------------------------------------*/ + /* Initialise the SDIO driver and mount an SD card */ FF_Disk_t * FF_SDDiskInit( const char * pcName ) { diff --git a/portable/ATSAM4E/ff_sddisk_r.c b/portable/ATSAM4E/ff_sddisk_r.c index 14531f3..f75367d 100644 --- a/portable/ATSAM4E/ff_sddisk_r.c +++ b/portable/ATSAM4E/ff_sddisk_r.c @@ -168,6 +168,15 @@ void FF_SDDiskFlush( FF_Disk_t * pxDisk ) } /*-----------------------------------------------------------*/ +FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName, + const FFInitSettings_t * pxSettings ) +{ + ( void ) pxSettings; /* Unused */ + + return FF_SDDiskInit( pcName ); +} +/*-----------------------------------------------------------*/ + /* Initialise the SDIO driver and mount an SD card */ FF_Disk_t * FF_SDDiskInit( const char * pcName ) { diff --git a/portable/STM32F4xx/ff_sddisk.c b/portable/STM32F4xx/ff_sddisk.c index 7c7abe3..6b84ac3 100644 --- a/portable/STM32F4xx/ff_sddisk.c +++ b/portable/STM32F4xx/ff_sddisk.c @@ -423,6 +423,15 @@ static void vGPIO_SD_Init( SD_HandleTypeDef * xSDHandle ) } /*-----------------------------------------------------------*/ +FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName, + const FFInitSettings_t * pxSettings ) +{ + ( void ) pxSettings; /* Unused */ + + return FF_SDDiskInit( pcName ); +} +/*-----------------------------------------------------------*/ + FF_Disk_t * FF_SDDiskInit( const char * pcName ) { FF_Error_t xFFError; diff --git a/portable/STM32F7xx/ff_sddisk.c b/portable/STM32F7xx/ff_sddisk.c index 485f865..71f47d8 100644 --- a/portable/STM32F7xx/ff_sddisk.c +++ b/portable/STM32F7xx/ff_sddisk.c @@ -539,6 +539,15 @@ static void vGPIO_SD_Init( SD_HandleTypeDef * xSDHandle ) } /*-----------------------------------------------------------*/ +FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName, + const FFInitSettings_t * pxSettings ) +{ + ( void ) pxSettings; /* Unused */ + + return FF_SDDiskInit( pcName ); +} +/*-----------------------------------------------------------*/ + FF_Disk_t * FF_SDDiskInit( const char * pcName ) { FF_Error_t xFFError; diff --git a/portable/Zynq.2019.3/ff_sddisk.c b/portable/Zynq.2019.3/ff_sddisk.c index fc33b22..da96a95 100644 --- a/portable/Zynq.2019.3/ff_sddisk.c +++ b/portable/Zynq.2019.3/ff_sddisk.c @@ -432,20 +432,19 @@ static CacheMemoryInfo_t * pucGetSDIOCacheMemory( BaseType_t xPartition ) } /*-----------------------------------------------------------*/ -/* Initialise the SDIO driver and mount an SD card */ -BaseType_t xMountFailIgnore = 0; +FF_Disk_t * FF_SDDiskInit( const char * pcName ) +{ + const FFInitSettings_t defaultSettings = {}; -/* _HT_ : the function FF_SDDiskInit() used to mount partition-0. - * It would be nice if it has a parameter indicating the partition - * number. - * As for now, the partion can be set with a global variable 'xDiskPartition'. - */ -BaseType_t xDiskPartition = 0; + return FF_SDDiskInitWithSettings( pcName, &defaultSettings ); +} +/*-----------------------------------------------------------*/ -FF_Disk_t * FF_SDDiskInit( const char * pcName ) +/* Initialise the SDIO driver and mount an SD card */ +FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName, + const FFInitSettings_t * pxSettings ) { FF_Error_t xFFError; - BaseType_t xPartitionNumber = xDiskPartition; FF_CreationParameters_t xParameters; FF_Disk_t * pxDisk = NULL; CacheMemoryInfo_t * pxCacheMem = NULL; @@ -456,13 +455,13 @@ FF_Disk_t * FF_SDDiskInit( const char * pcName ) do { - if( pucGetSDIOCacheMemory( xPartitionNumber ) == NULL ) + if( pucGetSDIOCacheMemory( pxSettings->xDiskPartition ) == NULL ) { FF_PRINTF( "FF_SDDiskInit: Cached memory failed\n" ); break; } - pxCacheMem = pxCacheMemories[ xPartitionNumber ]; + pxCacheMem = pxCacheMemories[ pxSettings->xDiskPartition ]; if( pxSDCardInstance == NULL ) { @@ -551,14 +550,14 @@ FF_Disk_t * FF_SDDiskInit( const char * pcName ) } pxDisk->xStatus.bIsInitialised = pdTRUE; - pxDisk->xStatus.bPartitionNumber = xPartitionNumber; + pxDisk->xStatus.bPartitionNumber = pxSettings->xDiskPartition; if( FF_SDDiskMount( pxDisk ) == 0 ) { /* _HT_ Suppose that the partition is not yet * formatted, it might be desireable to have a valid * i/o manager. */ - if( xMountFailIgnore == 0 ) + if( pxSettings->xMountFailIgnore == 0 ) { FF_SDDiskDelete( pxDisk ); pxDisk = NULL; diff --git a/portable/Zynq/ff_sddisk.c b/portable/Zynq/ff_sddisk.c index 0160490..1f18016 100644 --- a/portable/Zynq/ff_sddisk.c +++ b/portable/Zynq/ff_sddisk.c @@ -371,6 +371,15 @@ static struct xCACHE_MEMORY_INFO * pucGetSDIOCacheMemory() } /*-----------------------------------------------------------*/ +FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName, + const FFInitSettings_t * pxSettings ) +{ + ( void ) pxSettings; /* Unused */ + + return FF_SDDiskInit( pcName ); +} +/*-----------------------------------------------------------*/ + /* Initialise the SDIO driver and mount an SD card */ FF_Disk_t * FF_SDDiskInit( const char * pcName ) { diff --git a/portable/common/ff_sddisk.h b/portable/common/ff_sddisk.h old mode 100755 new mode 100644 index c82d9ff..b7eead0 --- a/portable/common/ff_sddisk.h +++ b/portable/common/ff_sddisk.h @@ -28,11 +28,18 @@ #define __SDDISK_H__ + #include "ff_headers.h" + #ifdef __cplusplus extern "C" { #endif - #include "ff_headers.h" +/* @brief Initialization settings for more granular control on init. */ + typedef struct FFInitSettings_s + { + BaseType_t xMountFailIgnore; /**< Ignore failure when mounting */ + BaseType_t xDiskPartition; /**< Default disk partition number */ + } FFInitSettings_t; /* Return non-zero if the SD-card is present. @@ -40,6 +47,9 @@ BaseType_t FF_SDDiskDetect( FF_Disk_t * pxDisk ); /* Create a RAM disk, supplying enough memory to hold N sectors of 512 bytes each */ + FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName, + const FFInitSettings_t * pxSettings ); + FF_Disk_t * FF_SDDiskInit( const char * pcName ); BaseType_t FF_SDDiskReinit( FF_Disk_t * pxDisk ); diff --git a/portable/linux/ff_sddisk.c b/portable/linux/ff_sddisk.c index adb9331..28fe3e9 100644 --- a/portable/linux/ff_sddisk.c +++ b/portable/linux/ff_sddisk.c @@ -74,6 +74,15 @@ void FF_SDDiskFlush( FF_Disk_t * pxDisk ) } /*-----------------------------------------------------------*/ +FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName, + const FFInitSettings_t * pxSettings ) +{ + ( void ) pxSettings; /* Unused */ + + return FF_SDDiskInit( pcName ); +} +/*-----------------------------------------------------------*/ + FF_Disk_t * FF_SDDiskInit( const char * pcName ) { FF_Disk_t * pxDisk = NULL; diff --git a/portable/lpc18xx/ff_sddisk.c b/portable/lpc18xx/ff_sddisk.c index 0730eef..e09dbad 100644 --- a/portable/lpc18xx/ff_sddisk.c +++ b/portable/lpc18xx/ff_sddisk.c @@ -188,7 +188,15 @@ void FF_SDDiskFlush( FF_Disk_t * pxDisk ) } /*-----------------------------------------------------------*/ -/* Initialise the SDIO driver and mount an SD card */ +FF_Disk_t * FF_SDDiskInitWithSettings( const char * pcName, + const FFInitSettings_t * pxSettings ) +{ + ( void ) pxSettings; /* Unused */ + + return FF_SDDiskInit( pcName ); +} +/*-----------------------------------------------------------*/ + FF_Disk_t * FF_SDDiskInit( const char * pcName ) { FF_Error_t xFFError;