From ebb6034a688618794ec9004dc9b9f428a88babc2 Mon Sep 17 00:00:00 2001 From: rtel Date: Wed, 23 Apr 2014 13:28:21 +0000 Subject: [PATCH] Update FreeRTOS+FAT SL to version 1.0.1. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2235 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../ConfigurationFiles/config_fat_sl.h | 4 +- .../ConfigurationFiles/config_fat_sl_test.h | 62 + .../ConfigurationFiles/config_mdriver_ram.h | 2 +- .../WIN32.vcxproj | 1 + .../WIN32.vcxproj.filters | 3 + .../FreeRTOS-Plus-FAT-SL/api/api_mdriver.h | 2 +- .../api/api_mdriver_ram.h | 2 +- .../Source/FreeRTOS-Plus-FAT-SL/api/fat_sl.h | 48 +- .../config/config_fat_sl_template.h | 34 +- .../config/config_mdriver_ram_template.h | 2 +- .../FreeRTOS-Plus-FAT-SL/fat_sl/common/dir.c | 16 +- .../FreeRTOS-Plus-FAT-SL/fat_sl/common/dir.h | 20 +- .../FreeRTOS-Plus-FAT-SL/fat_sl/common/drv.c | 4 +- .../FreeRTOS-Plus-FAT-SL/fat_sl/common/drv.h | 4 +- .../fat_sl/common/f_lock.c | 4 +- .../fat_sl/common/f_lock.h | 7 +- .../FreeRTOS-Plus-FAT-SL/fat_sl/common/fat.c | 7 +- .../FreeRTOS-Plus-FAT-SL/fat_sl/common/fat.h | 4 +- .../FreeRTOS-Plus-FAT-SL/fat_sl/common/file.c | 209 +-- .../FreeRTOS-Plus-FAT-SL/fat_sl/common/file.h | 4 +- .../FreeRTOS-Plus-FAT-SL/fat_sl/common/util.c | 4 +- .../FreeRTOS-Plus-FAT-SL/fat_sl/common/util.h | 4 +- .../fat_sl/common/util_sfn.c | 4 +- .../fat_sl/common/util_sfn.h | 4 +- .../fat_sl/common/volume.c | 77 +- .../fat_sl/common/volume.h | 4 +- .../FreeRTOS-Plus-FAT-SL/fat_sl/test/test.c | 1145 +++++++++++------ .../FreeRTOS-Plus-FAT-SL/fat_sl/test/test.h | 90 +- .../media-drv/ram/ramdrv_f.c | 2 +- .../psp/include/psp_rtc.h | 2 +- .../psp/include/psp_string.h | 2 +- .../psp/target/fat_sl/psp_test.c | 55 +- .../psp/target/fat_sl/psp_test.h | 40 +- .../psp/target/rtc/psp_rtc.c | 2 +- .../FreeRTOS-Plus-FAT-SL/version/History.txt | 9 + .../FreeRTOS-Plus-FAT-SL/version/ver_fat_sl.h | 4 +- .../version/ver_mdriver.h | 2 +- .../version/ver_mdriver_ram.h | 2 +- .../version/ver_psp_fat_sl.h | 34 +- .../version/ver_psp_rtc.h | 2 +- .../version/ver_psp_string.h | 2 +- 41 files changed, 1166 insertions(+), 763 deletions(-) create mode 100644 FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_fat_sl_test.h create mode 100644 FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/History.txt diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_fat_sl.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_fat_sl.h index 373d78092..8647077ee 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_fat_sl.h +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_fat_sl.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * FreeRTOS+FAT SL is an complementary component provided to Real Time Engineers * Ltd. by HCC Embedded for use with FreeRTOS. It is not, in itself, part of @@ -38,7 +38,7 @@ #define _CONFIG_FAT_SL_H #include "../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_fat_sl_test.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_fat_sl_test.h new file mode 100644 index 000000000..2f56f933d --- /dev/null +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_fat_sl_test.h @@ -0,0 +1,62 @@ +/* + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded + * + * FreeRTOS+FAT SL is an complementary component provided to Real Time Engineers + * Ltd. by HCC Embedded for use with FreeRTOS. It is not, in itself, part of + * the FreeRTOS kernel. FreeRTOS+FAT SL is licensed separately from FreeRTOS, + * and uses a different license to FreeRTOS. FreeRTOS+FAT SL uses a dual + * license model, information on which is provided below: + * + * - Open source licensing - + * FreeRTOS+FAT SL is a free download and may be used, modified and distributed + * without charge provided the user adheres to version two of the GNU General + * Public license (GPL) and does not remove the copyright notice or this text. + * The GPL V2 text is available on the gnu.org web site, and on the following + * URL: http://www.FreeRTOS.org/gpl-2.0.txt + * + * - Commercial licensing - + * Businesses and individuals who wish to incorporate FreeRTOS+FAT SL into + * proprietary software for redistribution in any form must first obtain a + * commercial license - and in-so-doing support the maintenance, support and + * further development of the FreeRTOS+FAT SL product. Commercial licenses can + * be obtained from http://shop.freertos.org and do not require any source files + * to be changed. + * + * FreeRTOS+FAT SL is distributed in the hope that it will be useful. You + * cannot use FreeRTOS+FAT SL unless you agree that you use the software 'as + * is'. FreeRTOS+FAT SL is provided WITHOUT ANY WARRANTY; without even the + * implied warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. Real Time Engineers Ltd. and HCC Embedded disclaims all + * conditions and terms, be they implied, expressed, or statutory. + * + * http://www.FreeRTOS.org + * http://www.FreeRTOS.org/FreeRTOS-Plus + * + */ + +#ifndef _CONFIG_FAT_SL_TEST_H +#define _CONFIG_FAT_SL_TEST_H + +#include "../version/ver_fat_sl.h" +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 + #error Incompatible FAT_SL version number! +#endif + + +/* +** Maximum size for seek test. +** Options: 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 +*/ +#define F_MAX_SEEK_TEST 16384 + + +/* +** Defines media type for testing. +** Options: F_FAT12_MEDIA, F_FAT16_MEDIA, F_FAT32_MEDIA +*/ +#define F_FAT_TYPE F_FAT16_MEDIA + + +#endif /* ifndef _CONFIG_STHIN_TEST_H */ + + diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_mdriver_ram.h b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_mdriver_ram.h index 1c3ce96e5..51f201883 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_mdriver_ram.h +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/ConfigurationFiles/config_mdriver_ram.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * FreeRTOS+FAT SL is an complementary component provided to Real Time Engineers * Ltd. by HCC Embedded for use with FreeRTOS. It is not, in itself, part of diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/WIN32.vcxproj b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/WIN32.vcxproj index 294c69b3c..6257eb79f 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/WIN32.vcxproj +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/WIN32.vcxproj @@ -168,6 +168,7 @@ + diff --git a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/WIN32.vcxproj.filters b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/WIN32.vcxproj.filters index e230fae6d..72966a428 100644 --- a/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/WIN32.vcxproj.filters +++ b/FreeRTOS-Plus/Demo/FreeRTOS_Plus_FAT_SL_and_CLI_Windows_Simulator/WIN32.vcxproj.filters @@ -173,5 +173,8 @@ FreeRTOS+\FreeRTOS+FAT SL + + Configuration Files + \ No newline at end of file diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/api_mdriver.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/api_mdriver.h index 8e9b07081..59940a33b 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/api_mdriver.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/api_mdriver.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/api_mdriver_ram.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/api_mdriver_ram.h index c7b342121..750162dad 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/api_mdriver_ram.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/api_mdriver_ram.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/fat_sl.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/fat_sl.h index d18848c90..974a8bb15 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/fat_sl.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/fat_sl.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -44,7 +44,7 @@ #include "config_fat_sl.h" #include "../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif @@ -87,23 +87,6 @@ typedef struct F_POS pos; } F_FIND; -/* definitions for ctime */ -#define F_CTIME_SEC_SHIFT 0 -#define F_CTIME_SEC_MASK 0x001f /*0-30 in 2seconds*/ -#define F_CTIME_MIN_SHIFT 5 -#define F_CTIME_MIN_MASK 0x07e0 /*0-59 */ -#define F_CTIME_HOUR_SHIFT 11 -#define F_CTIME_HOUR_MASK 0xf800 /*0-23*/ - - -/* definitions for cdate */ -#define F_CDATE_DAY_SHIFT 0 -#define F_CDATE_DAY_MASK 0x001f /*0-31*/ -#define F_CDATE_MONTH_SHIFT 5 -#define F_CDATE_MONTH_MASK 0x01e0 /*1-12*/ -#define F_CDATE_YEAR_SHIFT 9 -#define F_CDATE_YEAR_MASK 0xfe00 /*0-119 (1980+value)*/ - #define F_ATTR_ARC 0x20 #define F_ATTR_DIR 0x10 #define F_ATTR_VOLUME 0x08 @@ -126,7 +109,6 @@ typedef struct unsigned long abspos; unsigned long filesize; unsigned long startcluster; - unsigned long prevcluster; unsigned long relpos; unsigned char modified; unsigned char mode; @@ -238,9 +220,6 @@ enum * for file changed events * ***************************************************************************/ -#ifndef F_FILE_CHANGED_EVENT - #define F_FILE_CHANGED_EVENT 0 -#endif #if F_FILE_CHANGED_EVENT @@ -277,9 +256,17 @@ extern F_FILE_CHANGED_EVENTFUNC f_filechangedevent; #define FACTION_ADDED 0x00000001 #define FACTION_REMOVED 0x00000002 #define FACTION_MODIFIED 0x00000003 + #define FACTION_RENAMED_OLD_NAME 0x00000004 + #define FACTION_RENAMED_NEW_NAME 0x00000005 #endif /* if F_FILE_CHANGED_EVENT */ +unsigned char fs_init ( void ); +unsigned char fs_delete ( void ); + +#define f_initvolume fn_initvolume +#define f_delvolume fn_delvolume + unsigned char fn_initvolume ( F_DRIVERINIT initfunc ); unsigned char fn_delvolume ( void ); @@ -318,7 +305,6 @@ F_FILE * fn_truncate ( const char *, long ); unsigned char fn_getcwd ( char * buffer, unsigned char maxlen, char root ); unsigned char fn_hardformat ( unsigned char fattype ); -unsigned char fn_format ( unsigned char fattype ); unsigned char fn_getserial ( unsigned long * ); @@ -327,14 +313,6 @@ unsigned char fn_getserial ( unsigned long * ); #include "FreeRTOS.h" #include "semphr.h" -#ifndef FS_MUTEX_DEFINED - extern xSemaphoreHandle fs_lock_semaphore; -#endif /* FS_MUTEX_DEFINED */ - -unsigned char fn_init ( void ); -#define f_init fn_init -#define f_initvolume fn_initvolume -#define f_delvolume fn_delvolume unsigned char fr_hardformat ( unsigned char fattype ); #define f_hardformat( fattype ) fr_hardformat( fattype ) @@ -405,11 +383,6 @@ F_FILE * fr_truncate ( const char *, long ); #else /* F_FS_THREAD_AWARE */ -unsigned char fn_init ( void ); -#define f_init fn_init -#define f_initvolume fn_initvolume -#define f_delvolume fn_delvolume - #define f_hardformat( fattype ) fn_hardformat( fattype ) #define f_format( fattype ) fn_hardformat( fattype ) @@ -468,6 +441,7 @@ F_FILE * fn_truncate ( const char *, long ); #endif /* F_FS_THREAD_AWARE */ + /**************************************************************************** * * end of fat_sl.h diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/config/config_fat_sl_template.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/config/config_fat_sl_template.h index 5b7314158..37b34395e 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/config/config_fat_sl_template.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/config/config_fat_sl_template.h @@ -1,29 +1,29 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * - * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license + * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. - * - * FreeRTOS+FAT SL uses a dual license model that allows the software to be used - * under a standard GPL open source license, or a commercial license. The - * standard GPL license (unlike the modified GPL license under which FreeRTOS - * itself is distributed) requires that all software statically linked with - * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. + * + * FreeRTOS+FAT SL uses a dual license model that allows the software to be used + * under a standard GPL open source license, or a commercial license. The + * standard GPL license (unlike the modified GPL license under which FreeRTOS + * itself is distributed) requires that all software statically linked with + * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. * Details of both license options follow: - * + * * - Open source licensing - * FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and - * distributed without charge provided the user adheres to version two of the - * GNU General Public License (GPL) and does not remove the copyright notice or + * distributed without charge provided the user adheres to version two of the + * GNU General Public License (GPL) and does not remove the copyright notice or * this text. The GPL V2 text is available on the gnu.org web site, and on the * following URL: http://www.FreeRTOS.org/gpl-2.0.txt. - * + * * - Commercial licensing - * Businesses and individuals who for commercial or other reasons cannot comply - * with the terms of the GPL V2 license must obtain a commercial license before - * incorporating FreeRTOS+FAT SL into proprietary software for distribution in - * any form. Commercial licenses can be purchased from - * http://shop.freertos.org/fat_sl and do not require any source files to be + * with the terms of the GPL V2 license must obtain a commercial license before + * incorporating FreeRTOS+FAT SL into proprietary software for distribution in + * any form. Commercial licenses can be purchased from + * http://shop.freertos.org/fat_sl and do not require any source files to be * changed. * * FreeRTOS+FAT SL is distributed in the hope that it will be useful. You @@ -42,7 +42,7 @@ #define _CONFIG_FAT_SL_H #include "../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/config/config_mdriver_ram_template.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/config/config_mdriver_ram_template.h index c0f59814d..7a3a4d362 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/config/config_mdriver_ram_template.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/config/config_mdriver_ram_template.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/dir.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/dir.c index e46c7f1a6..92fd0d961 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/dir.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/dir.c @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -49,7 +49,7 @@ #include "file.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif @@ -206,7 +206,9 @@ unsigned char _f_findfilewc ( char * name, char * ext, F_POS * pos, F_DIRENTRY * pos->cluster = gl_volume.bootrecord.rootcluster; } else + { return 0; + } } { @@ -303,6 +305,7 @@ static void _f_getfilename ( char * dest, char * name, char * ext ) unsigned long _f_getdecluster ( F_DIRENTRY * de ) { unsigned long cluster; + if ( gl_volume.mediatype == F_FAT32_MEDIA ) { cluster = _f_getword( &de->clusterhi ); @@ -384,6 +387,7 @@ unsigned char _f_findpath ( F_NAME * fsname, F_POS * pos ) { return 0; } + if ( !( de->attr & F_ATTR_DIR ) ) { return 0; @@ -506,8 +510,6 @@ unsigned char _f_findpath ( F_NAME * fsname, F_POS * pos ) * error code or zero if successful * ***************************************************************************/ - - unsigned char fn_getcwd ( char * buffer, unsigned char maxlen, char root ) { unsigned char a; @@ -557,8 +559,6 @@ unsigned char fn_getcwd ( char * buffer, unsigned char maxlen, char root ) * error code or zero if successful * ***************************************************************************/ - - unsigned char fn_findfirst ( const char * filename, F_FIND * find ) { unsigned char ret; @@ -605,8 +605,6 @@ unsigned char fn_findfirst ( const char * filename, F_FIND * find ) * error code or zero if successful * ***************************************************************************/ - - unsigned char fn_findnext ( F_FIND * find ) { F_DIRENTRY * de; @@ -827,7 +825,9 @@ unsigned char _f_addentry ( F_NAME * fsname, F_POS * pos, F_DIRENTRY * * pde ) pos->cluster = gl_volume.bootrecord.rootcluster; } else + { return F_ERR_NOMOREENTRY; + } } { diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/dir.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/dir.h index 84c7de1c2..6bd8a2b97 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/dir.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/dir.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -42,7 +42,7 @@ #define __DIR_H #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif @@ -51,6 +51,22 @@ extern "C" { #endif +/* definitions for ctime */ +#define F_CTIME_SEC_SHIFT 0 +#define F_CTIME_SEC_MASK 0x001f /*0-30 in 2seconds*/ +#define F_CTIME_MIN_SHIFT 5 +#define F_CTIME_MIN_MASK 0x07e0 /*0-59 */ +#define F_CTIME_HOUR_SHIFT 11 +#define F_CTIME_HOUR_MASK 0xf800 /*0-23*/ + + +/* definitions for cdate */ +#define F_CDATE_DAY_SHIFT 0 +#define F_CDATE_DAY_MASK 0x001f /*0-31*/ +#define F_CDATE_MONTH_SHIFT 5 +#define F_CDATE_MONTH_MASK 0x01e0 /*1-12*/ +#define F_CDATE_YEAR_SHIFT 9 +#define F_CDATE_YEAR_MASK 0xfe00 /*0-119 (1980+value)*/ #define NTRES_LOW 0x08 /*lower case name*/ diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/drv.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/drv.c index 41c5c2229..ccc232475 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/drv.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/drv.c @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -46,7 +46,7 @@ #include "volume.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/drv.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/drv.h index d4dd245e2..5d0ff726c 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/drv.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/drv.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -42,7 +42,7 @@ #define __DRV_H #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/f_lock.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/f_lock.c index 35d13a2ff..3a6ca633a 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/f_lock.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/f_lock.c @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -42,7 +42,7 @@ #include "../../api/fat_sl.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/f_lock.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/f_lock.h index abdb850b6..e62796014 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/f_lock.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/f_lock.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -42,7 +42,7 @@ #define _F_RTOS_H #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif @@ -51,7 +51,8 @@ extern "C" { #endif -unsigned char fr_init ( void ); +unsigned char fsr_init ( void ); +unsigned char fsr_delete ( void ); #ifdef __cplusplus } diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/fat.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/fat.c index 2063dd644..057558e2e 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/fat.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/fat.c @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -45,7 +45,7 @@ #include "drv.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif @@ -487,7 +487,6 @@ unsigned char _f_getcurrsector ( void ) return F_ERR_EOF; } - gl_file.prevcluster = gl_file.pos.cluster; _f_clustertopos( cluster, &gl_file.pos ); } @@ -510,7 +509,6 @@ unsigned char _f_getcurrsector ( void ) * error code or zero if successful * ***************************************************************************/ - unsigned char _f_alloccluster ( unsigned long * pcluster ) { unsigned long maxcluster = gl_volume.maxcluster; @@ -563,7 +561,6 @@ unsigned char _f_alloccluster ( unsigned long * pcluster ) * error code or zero if successful * ***************************************************************************/ - unsigned char _f_removechain ( unsigned long cluster ) { gl_volume.fatsector = (unsigned long)-1; diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/fat.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/fat.h index 9923b39b7..8fb6e95f7 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/fat.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/fat.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -42,7 +42,7 @@ #define __FAT_H #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/file.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/file.c index 38b93a51b..964b86c28 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/file.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/file.c @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -49,11 +49,11 @@ #include "file.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif -static unsigned char _f_emptywritebuffer ( void ); +static unsigned char _f_stepnextsector ( void ); /**************************************************************************** @@ -125,73 +125,77 @@ long fn_filelength ( const char * filename ) * error code or zero if successful * ***************************************************************************/ - - -static unsigned char _f_emptywritebuffer ( void ) +static unsigned char _f_stepnextsector ( void ) { unsigned char ret; + unsigned char b_alloc; - ret = _f_writeglsector( gl_file.pos.sector ); - if ( ret ) + b_alloc = 0; + gl_volume.fatsector = (unsigned long)-1; + if ( gl_file.startcluster == 0 ) { - return ret; + b_alloc = 1; } + else + { + ++gl_file.pos.sector; + if ( gl_file.pos.sector >= gl_file.pos.sectorend ) + { + unsigned long value; - gl_file.modified = 0; + ret = _f_getclustervalue( gl_file.pos.cluster, &value ); + if ( ret ) + { + return ret; + } - gl_file.pos.sector++; + if ( ( value >= 2 ) && ( value < F_CLUSTER_RESERVED ) ) /*we are in chain*/ + { + _f_clustertopos( value, &gl_file.pos ); /*go to next cluster*/ + } + else + { + b_alloc = 1; + } + } + } - if ( gl_file.pos.sector >= gl_file.pos.sectorend ) + if ( b_alloc != 0 ) { - unsigned long value; + unsigned long nextcluster; + + ret = _f_alloccluster( &nextcluster ); + if ( ret ) + { + return ret; + } - gl_volume.fatsector = (unsigned long)-1; - ret = _f_getclustervalue( gl_file.pos.cluster, &value ); + ret = _f_setclustervalue( nextcluster, F_CLUSTER_LAST ); if ( ret ) { return ret; } - if ( ( value >= 2 ) && ( value < F_CLUSTER_RESERVED ) ) /*we are in chain*/ + if ( gl_file.startcluster == 0 ) { - gl_file.prevcluster = gl_file.pos.cluster; - _f_clustertopos( value, &gl_file.pos ); /*go to next cluster*/ + gl_file.startcluster = nextcluster; } else { - unsigned long nextcluster; - - ret = _f_alloccluster( &nextcluster ); - if ( ret ) - { - return ret; - } - - ret = _f_setclustervalue( nextcluster, F_CLUSTER_LAST ); - if ( ret ) - { - return ret; - } - ret = _f_setclustervalue( gl_file.pos.cluster, nextcluster ); if ( ret ) { return ret; } + } - gl_file.prevcluster = gl_file.pos.cluster; - - _f_clustertopos( nextcluster, &gl_file.pos ); + _f_clustertopos( nextcluster, &gl_file.pos ); - return _f_writefatsector(); - } + return _f_writefatsector(); } - return F_NO_ERROR; -} /* _f_emptywritebuffer */ - - +} /* _f_stepnextsector */ /**************************************************************************** @@ -209,30 +213,65 @@ static unsigned char _f_extend ( long size ) size -= gl_file.filesize; _size = (unsigned long)size; - rc = _f_getcurrsector(); - if ( rc ) + if ( gl_file.startcluster == 0 ) + { + if ( _f_stepnextsector() ) + { + return F_ERR_WRITE; + } + } + else { - return rc; + if ( ( gl_file.relpos > 0 ) && ( gl_file.relpos < F_SECTOR_SIZE ) ) + { + rc = _f_getcurrsector(); + if ( rc ) + { + return rc; + } + } } - psp_memset( gl_sector + gl_file.relpos, 0, ( F_SECTOR_SIZE - gl_file.relpos ) ); - - if ( gl_file.relpos + _size > F_SECTOR_SIZE ) + if ( gl_file.relpos + _size >= F_SECTOR_SIZE ) { - _size -= ( F_SECTOR_SIZE - gl_file.relpos ); - while ( _size ) + if ( gl_file.relpos < F_SECTOR_SIZE ) { - if ( _f_emptywritebuffer() ) + psp_memset( gl_sector + gl_file.relpos, 0, ( F_SECTOR_SIZE - gl_file.relpos ) ); + _size -= ( F_SECTOR_SIZE - gl_file.relpos ); + + if ( _f_writeglsector( gl_file.pos.sector ) ) + { + return F_ERR_WRITE; + } + } + + if ( _f_stepnextsector() ) + { + return F_ERR_WRITE; + } + + psp_memset( gl_sector, 0, F_SECTOR_SIZE ); + + while ( _size >= F_SECTOR_SIZE ) + { + if ( _f_writeglsector( gl_file.pos.sector ) ) + { + return F_ERR_WRITE; + } + + if ( _f_stepnextsector() ) { return F_ERR_WRITE; } psp_memset( gl_sector, 0, F_SECTOR_SIZE ); - _size -= ( _size > F_SECTOR_SIZE ? F_SECTOR_SIZE : _size ); + + _size -= F_SECTOR_SIZE; } } else { + psp_memset( gl_sector + gl_file.relpos, 0, ( F_SECTOR_SIZE - gl_file.relpos ) ); _size += gl_file.relpos; } @@ -295,7 +334,6 @@ static unsigned char _f_fseek ( long offset ) { gl_file.abspos = 0; gl_file.relpos = 0; - gl_file.prevcluster = 0; gl_file.pos.cluster = gl_file.startcluster; remain = gl_file.filesize; @@ -326,7 +364,6 @@ static unsigned char _f_fseek ( long offset ) break; } - gl_file.prevcluster = gl_file.pos.cluster; gl_file.pos.cluster = cluster; } @@ -353,6 +390,10 @@ static unsigned char _f_fseek ( long offset ) gl_file.relpos = (unsigned short)offset; } } + else + { + ret = _f_extend( offset ); + } } return ret; @@ -452,7 +493,7 @@ F_FILE * fn_open ( const char * filename, const char * mode ) return 0; } - psp_memset( &gl_file, 0, 21 ); + psp_memset( &gl_file, 0, sizeof( F_FILE ) ); if ( !_f_findpath( &fsname, &gl_file.dirpos ) ) { @@ -605,27 +646,6 @@ F_FILE * fn_open ( const char * filename, const char * mode ) return 0; /*invalid mode*/ } /* switch */ - if ( ( m_mode != F_FILE_RD ) && ( gl_file.startcluster == 0 ) ) - { - gl_volume.fatsector = (unsigned long)-1; - if ( _f_alloccluster( &( gl_file.startcluster ) ) ) - { - return 0; - } - - _f_clustertopos( gl_file.startcluster, &gl_file.pos ); - if ( _f_setclustervalue( gl_file.startcluster, F_CLUSTER_LAST ) ) - { - return 0; - } - - if ( _f_writefatsector() ) - { - return 0; - } - } - - gl_file.mode = m_mode; /* lock it */ return (F_FILE *)1; } /* fn_open */ @@ -967,6 +987,11 @@ long fn_write ( const void * buf, long size, long _size_st, F_FILE * f ) _size_st = retsize; retsize = 0; + if ( size == 0 ) + { + return 0; + } + if ( _f_getvolume() ) { return 0; /*can't write*/ @@ -981,10 +1006,21 @@ long fn_write ( const void * buf, long size, long _size_st, F_FILE * f ) } } - if ( _f_getcurrsector() ) + if ( gl_file.startcluster == 0 ) { - gl_file.mode = F_FILE_CLOSE; - return 0; + if ( _f_stepnextsector() ) + { + gl_file.mode = F_FILE_CLOSE; + return 0; + } + } + else + { + if ( _f_getcurrsector() ) + { + gl_file.mode = F_FILE_CLOSE; + return 0; + } } for( ; ; ) @@ -995,7 +1031,7 @@ long fn_write ( const void * buf, long size, long _size_st, F_FILE * f ) { /*now full*/ if ( gl_file.modified ) { - if ( _f_emptywritebuffer() ) + if ( _f_writeglsector( gl_file.pos.sector ) ) { gl_file.mode = F_FILE_CLOSE; if ( _f_updatefileentry( 0 ) == 0 ) @@ -1007,10 +1043,21 @@ long fn_write ( const void * buf, long size, long _size_st, F_FILE * f ) return 0; } } + + gl_file.modified = 0; } - else + + if ( _f_stepnextsector() ) { - gl_file.pos.sector++; /*goto next*/ + gl_file.mode = F_FILE_CLOSE; + if ( _f_updatefileentry( 0 ) == 0 ) + { + return retsize; + } + else + { + return 0; + } } gl_file.abspos += gl_file.relpos; diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/file.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/file.h index 63045303a..b56093f7c 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/file.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/file.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -42,7 +42,7 @@ #define __FILE_H #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util.c index 9d5ed9b65..59842a85c 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util.c @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -45,7 +45,7 @@ #include "util.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util.h index 51be82120..2dfd8ac98 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -44,7 +44,7 @@ #include "util_sfn.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util_sfn.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util_sfn.c index ec2c39aa5..0ec64bbe4 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util_sfn.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util_sfn.c @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -43,7 +43,7 @@ #include "util.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util_sfn.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util_sfn.h index 9b4b2b68a..1c5768a8d 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util_sfn.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/util_sfn.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -42,7 +42,7 @@ #define __UTIL_SFN_H #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/volume.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/volume.c index 3325f4cde..b63068118 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/volume.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/volume.c @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -49,7 +49,7 @@ #include "file.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif @@ -112,8 +112,8 @@ static unsigned char _f_writebootrecord ( F_PHY * phy ) unsigned char rs; unsigned short mre; - unsigned char ret; - unsigned char _n = 0; + unsigned char ret; + unsigned char _n = 0; if ( gl_volume.mediatype == F_FAT32_MEDIA ) { /*write FS_INFO*/ @@ -379,6 +379,7 @@ static unsigned char _f_prepareformat ( F_PHY * phy, unsigned char fattype ) gl_volume.bootrecord.sector_per_cluster = FAT32_CS[i].sector_per_cluster; } + if ( !gl_volume.bootrecord.sector_per_cluster ) { return F_ERR_INVALIDMEDIA; /*fat16 cannot be there*/ @@ -869,17 +870,52 @@ unsigned char fn_getserial ( unsigned long * serial ) return 0; } + /* -** fn_init +** fs_init ** -** Initialize FAT_SL file system +** Initialize STHIN file system ** ** RETURN: F_NO_ERROR on success, other if error. */ -unsigned char fn_init ( void ) +unsigned char fs_init ( void ) { - return F_NO_ERROR; -} /* fn_init */ + unsigned char rc = F_NO_ERROR; + +#if RTOS_SUPPORT + rc = fsr_init(); + if ( rc ) + { + return rc; + } + +#endif + return rc; +} /* fs_init */ + + +/* +** fs_delete +** +** Delete STHIN file system +** +** RETURN: F_NO_ERROR on success, other if error. +*/ +unsigned char fs_delete ( void ) +{ + unsigned char rc = F_NO_ERROR; + +#if RTOS_SUPPORT + rc = fsr_delete(); + if ( rc ) + { + return rc; + } + +#endif + return rc; +} /* fs_delete */ + /**************************************************************************** * @@ -896,16 +932,18 @@ unsigned char fn_init ( void ) unsigned char fn_initvolume ( F_DRIVERINIT initfunc ) { #if F_FS_THREAD_AWARE == 1 - { - if( fs_lock_semaphore == NULL ) - { - fs_lock_semaphore = xSemaphoreCreateMutex(); - if( fs_lock_semaphore == NULL ) - { - return F_ERR_OS; - } - } - } + { + extern xSemaphoreHandle fs_lock_semaphore; + + if( fs_lock_semaphore == NULL ) + { + fs_lock_semaphore = xSemaphoreCreateMutex(); + if( fs_lock_semaphore == NULL ) + { + return F_ERR_OS; + } + } + } #endif /* F_FS_THREAD_AWARE */ gl_volume.state = F_STATE_NONE; @@ -925,6 +963,7 @@ unsigned char fn_initvolume ( F_DRIVERINIT initfunc ) return _f_getvolume(); } /* fn_initvolume */ + /**************************************************************************** * * fn_delvolume diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/volume.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/volume.h index 16a1d016c..a70de03b5 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/volume.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/volume.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -44,7 +44,7 @@ #include "config_fat_sl.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/test/test.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/test/test.c index b25e05c19..c74047a3a 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/test/test.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/test/test.c @@ -1,33 +1,29 @@ -#ifndef _TEST_C_ -#define _TEST_C_ - - /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * - * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license + * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. - * - * FreeRTOS+FAT SL uses a dual license model that allows the software to be used - * under a standard GPL open source license, or a commercial license. The - * standard GPL license (unlike the modified GPL license under which FreeRTOS - * itself is distributed) requires that all software statically linked with - * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. + * + * FreeRTOS+FAT SL uses a dual license model that allows the software to be used + * under a standard GPL open source license, or a commercial license. The + * standard GPL license (unlike the modified GPL license under which FreeRTOS + * itself is distributed) requires that all software statically linked with + * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. * Details of both license options follow: - * + * * - Open source licensing - * FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and - * distributed without charge provided the user adheres to version two of the - * GNU General Public License (GPL) and does not remove the copyright notice or + * distributed without charge provided the user adheres to version two of the + * GNU General Public License (GPL) and does not remove the copyright notice or * this text. The GPL V2 text is available on the gnu.org web site, and on the * following URL: http://www.FreeRTOS.org/gpl-2.0.txt. - * + * * - Commercial licensing - * Businesses and individuals who for commercial or other reasons cannot comply - * with the terms of the GPL V2 license must obtain a commercial license before - * incorporating FreeRTOS+FAT SL into proprietary software for distribution in - * any form. Commercial licenses can be purchased from - * http://shop.freertos.org/fat_sl and do not require any source files to be + * with the terms of the GPL V2 license must obtain a commercial license before + * incorporating FreeRTOS+FAT SL into proprietary software for distribution in + * any form. Commercial licenses can be purchased from + * http://shop.freertos.org/fat_sl and do not require any source files to be * changed. * * FreeRTOS+FAT SL is distributed in the hope that it will be useful. You @@ -44,10 +40,11 @@ #include "test.h" #include "../../api/fat_sl.h" +#include "config_fat_sl_test.h" #include "../../psp/target/fat_sl/psp_test.h" #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif @@ -139,19 +136,19 @@ static unsigned char f_formatting ( void ) ret = f_format( F_FAT_TYPE ); if ( ret ) { - return _f_result( 0, ret ); + return _f_result( __LINE__, ret ); } ret = _f_poweron(); if ( ret ) { - return _f_result( 1, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.*", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 2, ret ); + return _f_result( __LINE__, ret ); } _f_dump( "passed..." ); @@ -188,327 +185,327 @@ static unsigned char f_dirtest ( void ) ret = f_mkdir( "a" ); if ( ret ) { - return _f_result( 1, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( "ab" ); if ( ret ) { - return _f_result( 2, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( "abc" ); if ( ret ) { - return _f_result( 3, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( "abca" ); if ( ret ) { - return _f_result( 4, ret ); + return _f_result( __LINE__, ret ); } /*creates directories in /a - a ab abc abcd*/ ret = f_mkdir( "a/a" ); if ( ret ) { - return _f_result( 5, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( "a/ab" ); if ( ret ) { - return _f_result( 6, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( "a/abc" ); if ( ret ) { - return _f_result( 7, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( "a/abcd" ); if ( ret ) { - return _f_result( 8, ret ); + return _f_result( __LINE__, ret ); } /*change into a/abcd and check cwd*/ ret = f_chdir( "a/abcd" ); if ( ret ) { - return _f_result( 9, ret ); + return _f_result( __LINE__, ret ); } ret = _f_checkcwd( f_nameconv( "/a/abcd" ) ); if ( ret ) { - return _f_result( 10, ret ); + return _f_result( __LINE__, ret ); } /*make directory t change into t and check cwd="a/abcd/t"*/ ret = f_mkdir( "t" ); if ( ret ) { - return _f_result( 11, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "t" ); if ( ret ) { - return _f_result( 12, ret ); + return _f_result( __LINE__, ret ); } ret = _f_checkcwd( f_nameconv( "/a/abcd/t" ) ); if ( ret ) { - return _f_result( 13, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "." ); if ( ret ) { - return _f_result( 14, ret ); + return _f_result( __LINE__, ret ); } ret = _f_checkcwd( f_nameconv( "/a/abcd/t" ) ); if ( ret ) { - return _f_result( 15, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "../." ); if ( ret ) { - return _f_result( 16, ret ); + return _f_result( __LINE__, ret ); } ret = _f_checkcwd( f_nameconv( "/a/abcd" ) ); if ( ret ) { - return _f_result( 17, ret ); + return _f_result( __LINE__, ret ); } /*removing t dir*/ ret = f_rmdir( "t" ); if ( ret ) { - return _f_result( 18, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "t" ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 19, ret ); + return _f_result( __LINE__, ret ); } /*removing /a dir*/ ret = f_rmdir( "/ab" ); if ( ret ) { - return _f_result( 20, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "/ab" ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 21, ret ); + return _f_result( __LINE__, ret ); } /*removing /a dir*/ ret = f_rmdir( "../../a" ); if ( ret != F_ERR_NOTEMPTY ) { - return _f_result( 22, ret ); + return _f_result( __LINE__, ret ); } /*removing /abca dir*/ ret = f_rmdir( "a:/abca" ); if ( ret ) { - return _f_result( 24, ret ); + return _f_result( __LINE__, ret ); } /*changing invalid dirs*/ ret = f_chdir( "" ); if ( ret != F_ERR_INVALIDNAME ) { - return _f_result( 25, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( " " ); if ( ret ) { - return _f_result( 26, ret ); + return _f_result( __LINE__, ret ); } ret = _f_checkcwd( f_nameconv( "/a/abcd" ) ); if ( ret ) { - return _f_result( 27, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "?" ); if ( ret != F_ERR_INVALIDNAME ) { - return _f_result( 28, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "*.*" ); if ( ret != F_ERR_INVALIDNAME ) { - return _f_result( 29, ret ); + return _f_result( __LINE__, ret ); } ret = _f_checkcwd( f_nameconv( "/a/abcd" ) ); if ( ret ) { - return _f_result( 30, ret ); + return _f_result( __LINE__, ret ); } /*changing into /abc and removes subfolder from /a/ */ ret = f_chdir( "/abc" ); if ( ret ) { - return _f_result( 31, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( "/a/a" ); if ( ret ) { - return _f_result( 32, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( "A:../a/ab" ); if ( ret ) { - return _f_result( 33, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( "A:/a/abc" ); if ( ret ) { - return _f_result( 34, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( ".././abc/.././a/../a/abcd" ); if ( ret ) { - return _f_result( 35, ret ); + return _f_result( __LINE__, ret ); } /*some invalid rmdir*/ ret = f_rmdir( "." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 36, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( ".." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 37, ret ); + return _f_result( __LINE__, ret ); } /*create again abc remove abc*/ ret = f_mkdir( ".././abc" ); if ( ret != F_ERR_DUPLICATED ) { - return _f_result( 38, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( "../abc" ); if ( ret ) { - return _f_result( 39, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( ".././abc" ); if ( ret != F_ERR_INVALIDDIR ) { - return _f_result( 40, ret ); /*cwd is not exist*/ + return _f_result( __LINE__, ret ); /*cwd is not exist*/ } ret = f_chdir( "/" ); if ( ret ) { - return _f_result( 41, ret ); + return _f_result( __LINE__, ret ); } /*try . and .. in the root*/ ret = f_chdir( "." ); if ( ret ) { - return _f_result( 42, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "./././." ); if ( ret ) { - return _f_result( 43, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( ".." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 44, ret ); + return _f_result( __LINE__, ret ); } ret = _f_checkcwd( "/" ); /*root!*/ if ( ret ) { - return _f_result( 45, ret ); + return _f_result( __LINE__, ret ); } /*test . and .. in a and remove a*/ ret = f_chdir( "a" ); if ( ret ) { - return _f_result( 46, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( ".." ); if ( ret ) { - return _f_result( 47, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "a" ); if ( ret ) { - return _f_result( 48, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "." ); if ( ret ) { - return _f_result( 49, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "a" ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 50, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "./.." ); if ( ret ) { - return _f_result( 51, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( "a" ); if ( ret ) { - return _f_result( 52, ret ); + return _f_result( __LINE__, ret ); } /*check if all are removed*/ ret = f_findfirst( "*.*", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 53, ret ); + return _f_result( __LINE__, ret ); } _f_dump( "passed..." ); @@ -528,92 +525,92 @@ static unsigned char f_findingtest ( void ) ret = f_findfirst( "*.*", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 0, ret ); + return _f_result( __LINE__, ret ); } /*create Hello.dir*/ ret = f_mkdir( "Hello.dir" ); if ( ret ) { - return _f_result( 1, ret ); + return _f_result( __LINE__, ret ); } /*check if it is exist, and only exist*/ ret = f_findfirst( "*.*", &find ); if ( ret ) { - return _f_result( 2, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, f_nameconv( "Hello.dir" ) ) ) { - return _f_result( 3, 0 ); + return _f_result( __LINE__, 0 ); } if ( find.attr != F_ATTR_DIR ) { - return _f_result( 4, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 5, ret ); + return _f_result( __LINE__, ret ); } /*check some not founds*/ ret = f_findfirst( "q*.*", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 6, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "Hello.", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 7, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "a/*.*", &find ); if ( ret != F_ERR_INVALIDDIR ) { - return _f_result( 8, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( ".", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 9, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "..", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 10, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "?e.*", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 11, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 12, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.?", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 13, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.??", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 14, ret ); + return _f_result( __LINE__, ret ); } @@ -621,219 +618,219 @@ static unsigned char f_findingtest ( void ) ret = f_findfirst( "*.dir", &find ); if ( ret ) { - return _f_result( 15, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.d?r", &find ); if ( ret ) { - return _f_result( 16, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.d??", &find ); if ( ret ) { - return _f_result( 17, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.???", &find ); if ( ret ) { - return _f_result( 18, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "?ello.???", &find ); if ( ret ) { - return _f_result( 19, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "he??o.dir", &find ); if ( ret ) { - return _f_result( 20, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "he?*.dir", &find ); if ( ret ) { - return _f_result( 21, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "HELLO.DIR", &find ); /*no capitals sensitivity in find!!*/ if ( ret ) { - return _f_result( 22, ret ); + return _f_result( __LINE__, ret ); } /*change into hello.dir*/ ret = f_chdir( "hello.dir" ); if ( ret ) { - return _f_result( 23, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.*", &find ); if ( ret ) { - return _f_result( 24, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "..", &find ); if ( ret ) { - return _f_result( 25, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "??", &find ); if ( ret ) { - return _f_result( 26, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( ".", &find ); if ( ret ) { - return _f_result( 27, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "k*.*", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 28, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.", &find ); if ( ret ) { - return _f_result( 29, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, "." ) ) { - return _f_result( 29, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret ) { - return _f_result( 29, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, ".." ) ) { - return _f_result( 29, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 29, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.a", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 30, ret ); + return _f_result( __LINE__, ret ); } /*creating testdir and find it*/ ret = f_mkdir( "testdir" ); if ( ret ) { - return _f_result( 31, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.", &find ); if ( ret ) { - return _f_result( 32, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, "." ) ) { - return _f_result( 32, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret ) { - return _f_result( 32, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, ".." ) ) { - return _f_result( 32, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret ) { - return _f_result( 32, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, f_nameconv( "testdir" ) ) ) { - return _f_result( 33, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findfirst( "*.*", &find ); if ( ret ) { - return _f_result( 34, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, "." ) ) { - return _f_result( 35, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret ) { - return _f_result( 35, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, ".." ) ) { - return _f_result( 35, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret ) { - return _f_result( 36, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, f_nameconv( "testdir" ) ) ) { - return _f_result( 37, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 38, ret ); + return _f_result( __LINE__, ret ); } /*search exact file*/ ret = f_findfirst( "testDir", &find ); /*no capitals!*/ if ( ret ) { - return _f_result( 39, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, f_nameconv( "testdir" ) ) ) { - return _f_result( 40, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 41, ret ); + return _f_result( __LINE__, ret ); } @@ -841,26 +838,26 @@ static unsigned char f_findingtest ( void ) ret = f_chdir( "\\" ); if ( ret ) { - return _f_result( 42, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( "Hello.dir/testdir" ); if ( ret ) { - return _f_result( 43, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( "Hello.dir" ); if ( ret ) { - return _f_result( 44, ret ); + return _f_result( __LINE__, ret ); } /*check if all are removed*/ ret = f_findfirst( "*.*", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 45, ret ); + return _f_result( __LINE__, ret ); } _f_dump( "passed..." ); @@ -877,154 +874,154 @@ static unsigned char f_powerfail ( void ) ret = f_mkdir( "testdir" ); if ( ret ) { - return _f_result( 0, ret ); + return _f_result( __LINE__, ret ); } ret = _f_poweron(); if ( ret ) { - return _f_result( 1, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "testdir", &find ); if ( ret ) { - return _f_result( 2, ret ); + return _f_result( __LINE__, ret ); } /*checking formatting*/ ret = f_format( F_FAT_TYPE ); if ( ret ) { - return _f_result( 3, ret ); + return _f_result( __LINE__, ret ); } ret = _f_poweron(); if ( ret ) { - return _f_result( 4, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.*", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 5, ret ); + return _f_result( __LINE__, ret ); } /*checking formatting, 1st creating*/ ret = f_format( F_FAT_TYPE ); if ( ret ) { - return _f_result( 6, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( "testdir" ); if ( ret ) { - return _f_result( 7, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "testdir", &find ); if ( ret ) { - return _f_result( 8, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, f_nameconv( "testdir" ) ) ) { - return _f_result( 9, 0 ); + return _f_result( __LINE__, 0 ); } ret = _f_poweron(); if ( ret ) { - return _f_result( 10, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.*", &find ); if ( ret ) { - return _f_result( 11, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, f_nameconv( "testdir" ) ) ) { - return _f_result( 12, 0 ); + return _f_result( __LINE__, 0 ); } /*checking formatting, 2nd creating*/ ret = f_format( F_FAT_TYPE ); if ( ret ) { - return _f_result( 13, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( "testdir" ); if ( ret ) { - return _f_result( 14, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "testdir", &find ); if ( ret ) { - return _f_result( 15, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, f_nameconv( "testdir" ) ) ) { - return _f_result( 16, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_mkdir( "testdir2" ); if ( ret ) { - return _f_result( 17, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "testdir2", &find ); if ( ret ) { - return _f_result( 18, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, f_nameconv( "testdir2" ) ) ) { - return _f_result( 19, 0 ); + return _f_result( __LINE__, 0 ); } ret = _f_poweron(); if ( ret ) { - return _f_result( 20, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.*", &find ); if ( ret ) { - return _f_result( 21, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, f_nameconv( "testdir" ) ) ) { - return _f_result( 22, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret ) { - return _f_result( 23, ret ); + return _f_result( __LINE__, ret ); } if ( strcmp( find.filename, f_nameconv( "testdir2" ) ) ) { - return _f_result( 24, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_findnext( &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 25, ret ); + return _f_result( __LINE__, ret ); } @@ -1032,25 +1029,25 @@ static unsigned char f_powerfail ( void ) ret = _f_poweron(); if ( ret ) { - return _f_result( 26, ret ); + return _f_result( __LINE__, ret ); } ret = f_format( F_FAT_TYPE ); if ( ret ) { - return _f_result( 27, ret ); + return _f_result( __LINE__, ret ); } ret = _f_poweron(); if ( ret ) { - return _f_result( 28, ret ); + return _f_result( __LINE__, ret ); } ret = f_findfirst( "*.*", &find ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 29, ret ); + return _f_result( __LINE__, ret ); } @@ -1092,60 +1089,65 @@ static unsigned char f_seeking ( int sectorsize ) unsigned char ret; unsigned long size; unsigned long pos; + unsigned long fname_pos; + char * test_fname[4] = + { + "test1.txt", "test2.txt", "test3.txt", "test4.txt" + }; if ( sectorsize == 128 ) { _f_dump( "f_seeking with 128" ); } - #if ( F_MAX_SEEK_TEST > 128 ) +#if ( F_MAX_SEEK_TEST > 128 ) else if ( sectorsize == 256 ) { _f_dump( "f_seeking with 256" ); } - #endif - #if ( F_MAX_SEEK_TEST > 256 ) +#endif +#if ( F_MAX_SEEK_TEST > 256 ) else if ( sectorsize == 512 ) { _f_dump( "f_seeking with 512" ); } - #endif - #if ( F_MAX_SEEK_TEST > 512 ) +#endif +#if ( F_MAX_SEEK_TEST > 512 ) else if ( sectorsize == 1024 ) { _f_dump( "f_seeking with 1024" ); } - #endif - #if ( F_MAX_SEEK_TEST > 1024 ) +#endif +#if ( F_MAX_SEEK_TEST > 1024 ) else if ( sectorsize == 2048 ) { _f_dump( "f_seeking with 2048" ); } - #endif - #if ( F_MAX_SEEK_TEST > 2048 ) +#endif +#if ( F_MAX_SEEK_TEST > 2048 ) else if ( sectorsize == 4096 ) { _f_dump( "f_seeking with 4096" ); } - #endif - #if ( F_MAX_SEEK_TEST > 4096 ) +#endif +#if ( F_MAX_SEEK_TEST > 4096 ) else if ( sectorsize == 8192 ) { _f_dump( "f_seeking with 8192" ); } - #endif - #if ( F_MAX_SEEK_TEST > 8192 ) +#endif +#if ( F_MAX_SEEK_TEST > 8192 ) else if ( sectorsize == 16384 ) { _f_dump( "f_seeking with 16384" ); } - #endif - #if ( F_MAX_SEEK_TEST > 16384 ) +#endif +#if ( F_MAX_SEEK_TEST > 16384 ) else if ( sectorsize == 32768 ) { _f_dump( "f_seeking with 32768" ); } - #endif +#endif else { _f_dump( "f_seeking with random" ); @@ -1155,98 +1157,98 @@ static unsigned char f_seeking ( int sectorsize ) file = f_open( "test.bin", "w+" ); if ( !file ) { - return _f_result( 0, 0 ); + return _f_result( __LINE__, 0 ); } /*write sectorsize times 0*/ psp_memset( testbuffer, 0, sectorsize ); size = (unsigned long)f_write( testbuffer, 1, (long)sectorsize, file ); - if ( size != (unsigned long) sectorsize ) + if ( size != (unsigned long)sectorsize ) { - return _f_result( 1, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) sectorsize ) + if ( pos != (unsigned long)sectorsize ) { - return _f_result( 2, pos ); + return _f_result( __LINE__, pos ); } /*seek back and read some*/ ret = f_seek( file, 0, F_SEEK_SET ); /*seek back*/ if ( ret ) { - return _f_result( 3, ret ); + return _f_result( __LINE__, ret ); } pos = (unsigned long)f_tell( file ); if ( pos ) { - return _f_result( 4, pos ); + return _f_result( __LINE__, pos ); } size = (unsigned long)f_read( testbuffer, 1, sectorsize, file ); - if ( size != (unsigned long) sectorsize ) + if ( size != (unsigned long)sectorsize ) { - return _f_result( 5, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) sectorsize ) + if ( pos != (unsigned long)sectorsize ) { - return _f_result( 6, pos ); + return _f_result( __LINE__, pos ); } /*fake read at eof*/ size = (unsigned long)f_read( testbuffer, 1, 2, file ); /*eof!*/ if ( size != 0 ) { - return _f_result( 7, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) sectorsize ) + if ( pos != (unsigned long)sectorsize ) { - return _f_result( 8, pos ); + return _f_result( __LINE__, pos ); } /*writing sectorsize times 1 at the end*/ psp_memset( testbuffer, 1, sectorsize ); size = (unsigned long)f_write( testbuffer, 1, sectorsize, file ); - if ( size != (unsigned long) sectorsize ) + if ( size != (unsigned long)sectorsize ) { - return _f_result( 11, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( sectorsize * 2 ) ) + if ( pos != (unsigned long)( sectorsize * 2 ) ) { - return _f_result( 12, pos ); + return _f_result( __LINE__, pos ); } /*seeking back and read 1byte less*/ ret = f_seek( file, 0, F_SEEK_SET ); if ( ret ) { - return _f_result( 13, ret ); + return _f_result( __LINE__, ret ); } pos = (unsigned long)f_tell( file ); if ( pos ) { - return _f_result( 14, pos ); + return _f_result( __LINE__, pos ); } size = (unsigned long)f_read( testbuffer, 1, sectorsize - 1, file ); - if ( size != (unsigned long) ( sectorsize - 1 ) ) + if ( size != (unsigned long)( sectorsize - 1 ) ) { - return _f_result( 15, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( sectorsize - 1 ) ) + if ( pos != (unsigned long)( sectorsize - 1 ) ) { - return _f_result( 16, pos ); + return _f_result( __LINE__, pos ); } @@ -1255,26 +1257,26 @@ static unsigned char f_seeking ( int sectorsize ) size = (unsigned long)f_write( testbuffer, 1, 2, file ); if ( size != 2 ) { - return _f_result( 17, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( sectorsize + 1 ) ) + if ( pos != (unsigned long)( sectorsize + 1 ) ) { - return _f_result( 18, pos ); + return _f_result( __LINE__, pos ); } /*read 2 bytes*/ size = (unsigned long)f_read( testbuffer, 2, 1, file ); if ( size != 1 ) { - return _f_result( 19, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( sectorsize + 3 ) ) + if ( pos != (unsigned long)( sectorsize + 3 ) ) { - return _f_result( 20, pos ); + return _f_result( __LINE__, pos ); } @@ -1283,26 +1285,26 @@ static unsigned char f_seeking ( int sectorsize ) size = (unsigned long)f_write( testbuffer, 1, 4, file ); if ( size != 4 ) { - return _f_result( 21, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( sectorsize + 3 + 4 ) ) + if ( pos != (unsigned long)( sectorsize + 3 + 4 ) ) { - return _f_result( 22, pos ); + return _f_result( __LINE__, pos ); } /*seek at 2*/ ret = f_seek( file, 2, F_SEEK_SET ); if ( ret ) { - return _f_result( 23, ret ); + return _f_result( __LINE__, ret ); } pos = (unsigned long)f_tell( file ); if ( pos != 2 ) { - return _f_result( 24, pos ); + return _f_result( __LINE__, pos ); } /*write 6 times 4*/ @@ -1310,39 +1312,39 @@ static unsigned char f_seeking ( int sectorsize ) size = (unsigned long)f_write( testbuffer, 1, 6, file ); if ( size != 6 ) { - return _f_result( 25, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); if ( pos != 8 ) { - return _f_result( 26, pos ); + return _f_result( __LINE__, pos ); } /*seek end -4*/ ret = f_seek( file, -4, F_SEEK_END ); if ( ret ) { - return _f_result( 27, ret ); + return _f_result( __LINE__, ret ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( 2 * sectorsize - 4 ) ) + if ( pos != (unsigned long)( 2 * sectorsize - 4 ) ) { - return _f_result( 28, pos ); + return _f_result( __LINE__, pos ); } /*read 2 bytes*/ size = (unsigned long)f_read( testbuffer, 1, 2, file ); if ( size != 2 ) { - return _f_result( 29, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( 2 * sectorsize - 2 ) ) + if ( pos != (unsigned long)( 2 * sectorsize - 2 ) ) { - return _f_result( 30, pos ); + return _f_result( __LINE__, pos ); } /*write 8 times 5*/ @@ -1350,39 +1352,39 @@ static unsigned char f_seeking ( int sectorsize ) size = (unsigned long)f_write( testbuffer, 1, 8, file ); if ( size != 8 ) { - return _f_result( 31, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( 2 * sectorsize + 6 ) ) + if ( pos != (unsigned long)( 2 * sectorsize + 6 ) ) { - return _f_result( 32, pos ); + return _f_result( __LINE__, pos ); } /*seek to the begining*/ ret = f_seek( file, 0, F_SEEK_SET ); if ( ret ) { - return _f_result( 33, ret ); + return _f_result( __LINE__, ret ); } pos = (unsigned long)f_tell( file ); if ( pos ) { - return _f_result( 34, pos ); + return _f_result( __LINE__, pos ); } /*seek to the end*/ ret = f_seek( file, 2 * sectorsize + 6, F_SEEK_SET ); if ( ret ) { - return _f_result( 35, ret ); + return _f_result( __LINE__, ret ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( 2 * sectorsize + 6 ) ) + if ( pos != (unsigned long)( 2 * sectorsize + 6 ) ) { - return _f_result( 36, pos ); + return _f_result( __LINE__, pos ); } /*write 2 times 6*/ @@ -1390,51 +1392,51 @@ static unsigned char f_seeking ( int sectorsize ) size = (unsigned long)f_write( testbuffer, 1, 2, file ); if ( size != 2 ) { - return _f_result( 37, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( 2 * sectorsize + 8 ) ) + if ( pos != (unsigned long)( 2 * sectorsize + 8 ) ) { - return _f_result( 38, pos ); + return _f_result( __LINE__, pos ); } /*seek to the begining*/ (void)f_seek( file, -( 2 * sectorsize + 8 ), F_SEEK_CUR ); if ( ret ) { - return _f_result( 39, ret ); + return _f_result( __LINE__, ret ); } pos = (unsigned long)f_tell( file ); if ( pos ) { - return _f_result( 40, pos ); + return _f_result( __LINE__, pos ); } /*read 2 times sector*/ size = (unsigned long)f_read( testbuffer, 1, sectorsize, file ); - if ( size != (unsigned long) sectorsize ) + if ( size != (unsigned long)sectorsize ) { - return _f_result( 41, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) sectorsize ) + if ( pos != (unsigned long)sectorsize ) { - return _f_result( 42, pos ); + return _f_result( __LINE__, pos ); } size = (unsigned long)f_read( testbuffer, 1, sectorsize, file ); - if ( size != (unsigned long) sectorsize ) + if ( size != (unsigned long)sectorsize ) { - return _f_result( 43, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( 2 * sectorsize ) ) + if ( pos != (unsigned long)( 2 * sectorsize ) ) { - return _f_result( 44, pos ); + return _f_result( __LINE__, pos ); } /*write 1 once 7*/ @@ -1442,118 +1444,433 @@ static unsigned char f_seeking ( int sectorsize ) size = (unsigned long)f_write( testbuffer, 1, 1, file ); if ( size != 1 ) { - return _f_result( 45, size ); + return _f_result( __LINE__, size ); } pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( 2 * sectorsize + 1 ) ) + if ( pos != (unsigned long)( 2 * sectorsize + 1 ) ) { - return _f_result( 46, pos ); + return _f_result( __LINE__, pos ); } /*close it*/ ret = f_close( file ); if ( ret ) { - return _f_result( 47, ret ); + return _f_result( __LINE__, ret ); } /*check the result*/ size = (unsigned long)f_filelength( "test.bin" ); - if ( size != (unsigned long) ( 2 * sectorsize + 8 ) ) + if ( size != (unsigned long)( 2 * sectorsize + 8 ) ) { - return _f_result( 48, size ); + return _f_result( __LINE__, size ); } /*opens it*/ file = f_open( "test.bin", "r" ); if ( !file ) { - return _f_result( 49, size ); + return _f_result( __LINE__, size ); } if ( checkfilecontent( 2, 0, file ) ) { - return _f_result( 50, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( 6, 4, file ) ) { - return _f_result( 51, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( sectorsize - 8 - 1, 0, file ) ) { - return _f_result( 52, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( 2, 2, file ) ) { - return _f_result( 53, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( 2, 1, file ) ) { - return _f_result( 54, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( 4, 3, file ) ) { - return _f_result( 55, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( sectorsize - 7 - 2, 1, file ) ) { - return _f_result( 56, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( 2, 5, file ) ) { - return _f_result( 57, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( 1, 7, file ) ) { - return _f_result( 58, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( 5, 5, file ) ) { - return _f_result( 59, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( 2, 6, file ) ) { - return _f_result( 60, 0 ); + return _f_result( __LINE__, 0 ); } /*check pos result*/ pos = (unsigned long)f_tell( file ); - if ( pos != (unsigned long) ( 2 * sectorsize + 8 ) ) + if ( pos != (unsigned long)( 2 * sectorsize + 8 ) ) { - return _f_result( 61, pos ); + return _f_result( __LINE__, pos ); } /*this has to be eof*/ pos = f_eof( file ); if ( !pos ) { - return _f_result( 62, pos ); + return _f_result( __LINE__, pos ); } /*close it*/ ret = f_close( file ); if ( ret ) { - return _f_result( 63, ret ); + return _f_result( __LINE__, ret ); } /*deletes it*/ ret = f_delete( "test.bin" ); if ( ret ) { - return _f_result( 64, ret ); + return _f_result( __LINE__, ret ); + } + + /**************************************************************/ + for ( pos = 0 ; pos < 4 ; pos++ ) + { + file = f_open( test_fname[pos], "w" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + memset( testbuffer, '0' + pos, sectorsize ); + if ( f_write( testbuffer, 1, sectorsize - 1, file ) != ( sectorsize - 1 ) ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, 0 ); + } + } + + ret = f_delete( test_fname[0] ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + ret = f_delete( test_fname[2] ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + file = f_open( "test.txt", "w" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + memset( testbuffer, 'a', sectorsize ); + if ( f_write( testbuffer, 1, sectorsize, file ) != sectorsize ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, 0 ); + } + + file = f_open( "test.txt", "r+" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_seek( file, 2 * sectorsize, F_SEEK_SET ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, 0 ); + } + + for ( pos = 0 ; pos < 2 ; pos++ ) + { + file = f_open( "test.txt", "r+" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_seek( file, ( pos + 2 ) * sectorsize, F_SEEK_SET ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + memset( testbuffer, 'b' + pos, sectorsize ); + if ( f_write( testbuffer, 1, sectorsize, file ) != sectorsize ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + } + + fname_pos = 1; + for ( pos = 0 ; pos < 2 ; pos++ ) + { + file = f_open( test_fname[fname_pos], "r" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( sectorsize - 1, '0' + ( unsigned char ) fname_pos, file ) ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + fname_pos = 3; + } + + file = f_open( "test.txt", "r" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( sectorsize, 'a', file ) ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( sectorsize, 0, file ) ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( sectorsize, 'b', file ) ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( sectorsize, 'c', file ) ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + ret = f_delete( "test.txt" ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + /************************************/ + file = f_open( "test.txt", "w" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_seek( file, sectorsize - 2, F_SEEK_SET ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, 0 ); + } + + file = f_open( "test.txt", "r+" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + memset( testbuffer, 'f', 2 ); + if ( f_write( testbuffer, 1, 2, file ) != 2 ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_seek( file, sectorsize - 2, F_SEEK_SET ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, 0 ); + } + + memset( testbuffer, 'g', 3 ); + if ( f_write( testbuffer, 1, 3, file ) != 3 ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, 0 ); + } + + file = f_open( "test.txt", "r+" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_seek( file, sectorsize * 2, F_SEEK_SET ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, 0 ); + } + + memset( testbuffer, 'h', sectorsize ); + if ( f_write( testbuffer, 1, sectorsize, file ) != sectorsize ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, 0 ); + } + + size = f_filelength( "test.txt" ); + if ( size != ( unsigned long ) ( 3 * sectorsize ) ) + { + return _f_result( __LINE__, size ); + } + + fname_pos = 1; + for ( pos = 0 ; pos < 2 ; pos++ ) + { + file = f_open( test_fname[fname_pos], "r" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( sectorsize - 1, '0' + ( unsigned char ) fname_pos, file ) ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + fname_pos = 3; + } + + file = f_open( "test.txt", "r" ); + if ( file == NULL ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( 2, 'f', file ) ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( sectorsize - 4, 0, file ) ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( 3, 'g', file ) ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( sectorsize - 1, 0, file ) ) + { + return _f_result( __LINE__, 0 ); + } + + if ( checkfilecontent( sectorsize, 'h', file ) ) + { + return _f_result( __LINE__, 0 ); + } + + ret = f_close( file ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + ret = f_delete( "test.txt" ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + ret = f_delete( test_fname[1] ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); + } + + ret = f_delete( test_fname[3] ); + if ( ret != F_NO_ERROR ) + { + return _f_result( __LINE__, ret ); } _f_dump( "passed..." ); @@ -1573,38 +1890,38 @@ static unsigned char f_opening ( void ) file = f_open( "file.bin", "r" ); if ( file ) { - return _f_result( 0, 0 ); + return _f_result( __LINE__, 0 ); } file = f_open( "file.bin", "r+" ); if ( file ) { - return _f_result( 1, 0 ); + return _f_result( __LINE__, 0 ); } /*test non existing appends "a" a+*/ file = f_open( "file.bin", "a" ); if ( !file ) { - return _f_result( 2, 0 ); + return _f_result( __LINE__, 0 ); } file2 = f_open( "file.bin", "a+" ); /*open again*/ if ( file2 ) { - return _f_result( 3, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_close( file ); if ( ret ) { - return _f_result( 3, 1 ); + return _f_result( __LINE__, 1 ); } ret = f_close( file2 ); if ( ret != F_ERR_NOTOPEN ) { - return _f_result( 3, 2 ); + return _f_result( __LINE__, 2 ); } @@ -1612,7 +1929,7 @@ static unsigned char f_opening ( void ) file = f_open( "file.bin", "w" ); if ( !file ) { - return _f_result( 4, 0 ); + return _f_result( __LINE__, 0 ); } /*write 512 times 1*/ @@ -1620,65 +1937,65 @@ static unsigned char f_opening ( void ) size = (unsigned short)f_write( testbuffer, 1, 512, file ); /*test write*/ if ( size != 512 ) { - return _f_result( 5, size ); + return _f_result( __LINE__, size ); } /*go back, and read it*/ ret = f_rewind( file ); /*back to the begining*/ if ( ret ) { - return _f_result( 6, ret ); /*it should fail*/ + return _f_result( __LINE__, ret ); /*it should fail*/ } size = (unsigned short)f_read( testbuffer, 1, 512, file ); /*test read*/ if ( size ) { - return _f_result( 7, size ); /*it should fail*/ + return _f_result( __LINE__, size ); /*it should fail*/ } /*close and check size*/ size = (unsigned short)f_filelength( "file.bin" ); if ( size ) { - return _f_result( 8, size ); /*has to be zero*/ + return _f_result( __LINE__, size ); /*has to be zero*/ } ret = f_close( file ); if ( ret ) { - return _f_result( 9, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned short)f_filelength( "file.bin" ); if ( size != 512 ) { - return _f_result( 10, size ); + return _f_result( __LINE__, size ); } /*try to owerwrites it it*/ file = f_open( "file.bin", "w+" ); if ( !file ) { - return _f_result( 11, 0 ); + return _f_result( __LINE__, 0 ); } /*close and check size*/ size = (unsigned short)f_filelength( "file.bin" ); if ( size ) { - return _f_result( 12, size ); /*has to be zero*/ + return _f_result( __LINE__, size ); /*has to be zero*/ } ret = f_close( file ); if ( ret ) { - return _f_result( 13, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned short)f_filelength( "file.bin" ); if ( size ) { - return _f_result( 14, size ); + return _f_result( __LINE__, size ); } @@ -1687,7 +2004,7 @@ static unsigned char f_opening ( void ) file = f_open( "file.bin", "r+" ); if ( !file ) { - return _f_result( 15, 0 ); + return _f_result( __LINE__, 0 ); } /*write 512 times 1*/ @@ -1695,7 +2012,7 @@ static unsigned char f_opening ( void ) size = (unsigned short)f_write( testbuffer, 1, 512, file ); /*test write*/ if ( size != 512 ) { - return _f_result( 16, size ); + return _f_result( __LINE__, size ); } /*go back, and read it*/ @@ -1703,7 +2020,7 @@ static unsigned char f_opening ( void ) size = (unsigned short)f_read( testbuffer, 1, 512, file ); /*test read*/ if ( size != 512 ) { - return _f_result( 17, size ); /*it should fail*/ + return _f_result( __LINE__, size ); /*it should fail*/ } ret = f_rewind( file ); /*back to the begining*/ @@ -1713,32 +2030,32 @@ static unsigned char f_opening ( void ) size = (unsigned short)f_write( testbuffer, 1, 256, file ); /*test write*/ if ( size != 256 ) { - return _f_result( 18, size ); + return _f_result( __LINE__, size ); } pos = (unsigned short)f_tell( file ); if ( pos != 256 ) { - return _f_result( 19, pos ); /*position has to be 512*/ + return _f_result( __LINE__, pos ); /*position has to be 512*/ } size = (unsigned short)f_filelength( "file.bin" ); if ( size ) { - return _f_result( 20, size ); /*has to be zero*/ + return _f_result( __LINE__, size ); /*has to be zero*/ } /*close and check size*/ ret = f_close( file ); if ( ret ) { - return _f_result( 21, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned short)f_filelength( "file.bin" ); if ( size != 512 ) { - return _f_result( 22, size ); + return _f_result( __LINE__, size ); } @@ -1746,13 +2063,13 @@ static unsigned char f_opening ( void ) file = f_open( "file.bin", "a+" ); if ( !file ) { - return _f_result( 23, 0 ); + return _f_result( __LINE__, 0 ); } pos = (unsigned short)f_tell( file ); if ( pos != 512 ) { - return _f_result( 24, pos ); /*position has to be 512*/ + return _f_result( __LINE__, pos ); /*position has to be 512*/ } /*write 512 times 3*/ @@ -1760,58 +2077,58 @@ static unsigned char f_opening ( void ) size = (unsigned short)f_write( testbuffer, 1, 512, file ); /*test write*/ if ( size != 512 ) { - return _f_result( 25, size ); + return _f_result( __LINE__, size ); } /*go back, and read it*/ ret = f_rewind( file ); /*back to the begining*/ if ( ret ) { - return _f_result( 26, ret ); /*it should fail*/ + return _f_result( __LINE__, ret ); /*it should fail*/ } size = (unsigned short)f_read( testbuffer, 1, 512, file ); /*test read*/ if ( size != 512 ) { - return _f_result( 27, size ); /*it should fail*/ + return _f_result( __LINE__, size ); /*it should fail*/ } pos = (unsigned short)f_tell( file ); if ( pos != 512 ) { - return _f_result( 28, pos ); /*position has to be 512*/ + return _f_result( __LINE__, pos ); /*position has to be 512*/ } /*close and check size*/ size = (unsigned short)f_filelength( "file.bin" ); if ( size != 512 ) { - return _f_result( 29, size ); /*has to be zero*/ + return _f_result( __LINE__, size ); /*has to be zero*/ } ret = f_close( file ); if ( ret ) { - return _f_result( 30, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned short)f_filelength( "file.bin" ); if ( size != 1024 ) { - return _f_result( 31, size ); + return _f_result( __LINE__, size ); } /*close again!*/ ret = f_close( file ); if ( ret != F_ERR_NOTOPEN ) { - return _f_result( 32, pos ); + return _f_result( __LINE__, pos ); } ret = f_delete( "file.bin" ); if ( ret ) { - return _f_result( 33, ret ); + return _f_result( __LINE__, ret ); } _f_dump( "passed..." ); @@ -1833,20 +2150,20 @@ static unsigned char f_appending ( void ) file = f_open( "ap.bin", "a" ); if ( !file ) { - return _f_result( 1, 0 ); + return _f_result( __LINE__, 0 ); } psp_memset( testbuffer, a, sizeof( testbuffer ) ); size = (unsigned short)f_write( testbuffer, 1, a + 128, file ); if ( size != a + 128 ) { - return _f_result( 2, size ); + return _f_result( __LINE__, size ); } size = (unsigned short)f_filelength( "ap.bin" ); if ( size != tsize ) { - return _f_result( 3, size ); + return _f_result( __LINE__, size ); } tsize += a + 128; @@ -1854,34 +2171,34 @@ static unsigned char f_appending ( void ) ret = f_close( file ); if ( ret ) { - return _f_result( 4, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned short)f_filelength( "ap.bin" ); if ( size != tsize ) { - return _f_result( 5, size ); + return _f_result( __LINE__, size ); } } file = f_open( "ap.bin", "r" ); if ( !file ) { - return _f_result( 6, 0 ); + return _f_result( __LINE__, 0 ); } for ( tsize = 0, a = 0 ; a < 16 ; a++ ) { if ( checkfilecontent( a + 128, (char)a, file ) ) { - return _f_result( 7, a ); + return _f_result( __LINE__, a ); } } ret = f_close( file ); if ( ret ) { - return _f_result( 8, ret ); + return _f_result( __LINE__, ret ); } for ( tsize = 0, a = 0 ; a < 16 ; a++ ) @@ -1889,32 +2206,32 @@ static unsigned char f_appending ( void ) file = f_open( "ap.bin", "r" ); if ( !file ) { - return _f_result( 9, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_seek( file, tsize, F_SEEK_SET ); if ( ret ) { - return _f_result( 10, ret ); + return _f_result( __LINE__, ret ); } pos = (unsigned short)f_tell( file ); if ( pos != tsize ) { - return _f_result( 11, pos ); + return _f_result( __LINE__, pos ); } size = (unsigned short)f_read( testbuffer, 1, a + 128, file ); if ( size != a + 128 ) { - return _f_result( 12, size ); + return _f_result( __LINE__, size ); } for ( b = 0 ; b < a + 128 ; b++ ) { if ( testbuffer[b] != (char)a ) { - return _f_result( 13, a ); + return _f_result( __LINE__, a ); } } @@ -1923,26 +2240,26 @@ static unsigned char f_appending ( void ) pos = (unsigned short)f_tell( file ); if ( pos != tsize ) { - return _f_result( 13, pos ); + return _f_result( __LINE__, pos ); } ret = f_close( file ); if ( ret ) { - return _f_result( 14, ret ); + return _f_result( __LINE__, ret ); } } ret = f_close( file ); if ( ret != F_ERR_NOTOPEN ) { - return _f_result( 9, ret ); + return _f_result( __LINE__, ret ); } ret = f_delete( "ap.bin" ); if ( ret ) { - return _f_result( 14, ret ); + return _f_result( __LINE__, ret ); } _f_dump( "passed..." ); @@ -1961,7 +2278,7 @@ static unsigned char f_writing ( void ) ret = f_getfreespace( &before ); if ( ret ) { - return _f_result( 0, ret ); + return _f_result( __LINE__, ret ); } for ( a = 0 ; a < 4 ; a++ ) @@ -1969,43 +2286,43 @@ static unsigned char f_writing ( void ) file = f_open( "wr.bin", "w" ); if ( !file ) { - return _f_result( 1, 0 ); + return _f_result( __LINE__, 0 ); } psp_memset( testbuffer, a, sizeof( testbuffer ) ); size = (unsigned short)f_write( testbuffer, 1, a * 128, file ); if ( size != a * 128 ) { - return _f_result( 2, size ); + return _f_result( __LINE__, size ); } ret = f_close( file ); if ( ret ) { - return _f_result( 3, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned short)f_filelength( "wr.bin" ); if ( size != a * 128 ) { - return _f_result( 4, size ); + return _f_result( __LINE__, size ); } file = f_open( "wr.bin", "r" ); if ( !file ) { - return _f_result( 5, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( a * 128, (char)a, file ) ) { - return _f_result( 6, a ); + return _f_result( __LINE__, a ); } ret = f_close( file ); if ( ret ) { - return _f_result( 7, ret ); + return _f_result( __LINE__, ret ); } } @@ -2015,107 +2332,107 @@ static unsigned char f_writing ( void ) file = f_open( "wr.bin", "w+" ); if ( !file ) { - return _f_result( 8, 0 ); + return _f_result( __LINE__, 0 ); } psp_memset( testbuffer, a, sizeof( testbuffer ) ); size = (unsigned short)f_write( testbuffer, 1, a * 128, file ); if ( size != a * 128 ) { - return _f_result( 9, size ); + return _f_result( __LINE__, size ); } ret = f_close( file ); if ( ret ) { - return _f_result( 10, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned short)f_filelength( "wr.bin" ); if ( size != a * 128 ) { - return _f_result( 11, size ); + return _f_result( __LINE__, size ); } file = f_open( "wr.bin", "r+" ); if ( !file ) { - return _f_result( 12, 0 ); + return _f_result( __LINE__, 0 ); } if ( checkfilecontent( a * 128, (char)a, file ) ) { - return _f_result( 13, a ); + return _f_result( __LINE__, a ); } ret = f_close( file ); if ( ret ) { - return _f_result( 14, ret ); + return _f_result( __LINE__, ret ); } } ret = f_getfreespace( &after ); if ( ret ) { - return _f_result( 15, ret ); + return _f_result( __LINE__, ret ); } if ( before.bad != after.bad ) { - return _f_result( 16, 0 ); + return _f_result( __LINE__, 0 ); } if ( before.free == after.free ) { - return _f_result( 17, 0 ); + return _f_result( __LINE__, 0 ); } if ( before.used == after.used ) { - return _f_result( 18, 0 ); + return _f_result( __LINE__, 0 ); } if ( before.total != after.total ) { - return _f_result( 19, 0 ); + return _f_result( __LINE__, 0 ); } if ( before.used + before.free != after.used + after.free ) { - return _f_result( 20, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_delete( "wr.bin" ); if ( ret ) { - return _f_result( 21, ret ); + return _f_result( __LINE__, ret ); } ret = f_getfreespace( &after ); if ( ret ) { - return _f_result( 22, ret ); + return _f_result( __LINE__, ret ); } if ( before.bad != after.bad ) { - return _f_result( 23, 0 ); + return _f_result( __LINE__, 0 ); } if ( before.free != after.free ) { - return _f_result( 24, 0 ); + return _f_result( __LINE__, 0 ); } if ( before.used != after.used ) { - return _f_result( 25, 0 ); + return _f_result( __LINE__, 0 ); } if ( before.total != after.total ) { - return _f_result( 26, 0 ); + return _f_result( __LINE__, 0 ); } _f_dump( "passed..." ); @@ -2133,67 +2450,67 @@ static unsigned char f_dots ( void ) ret = f_mkdir( "/tt" ); if ( ret ) { - return _f_result( 0, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "/tt" ); if ( ret ) { - return _f_result( 1, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( "." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 4, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( ".." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 5, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( "." ); if ( ret ) { - return _f_result( 6, ret ); + return _f_result( __LINE__, ret ); } ret = _f_checkcwd( f_nameconv( "/tt" ) ); if ( ret ) { - return _f_result( 7, ret ); + return _f_result( __LINE__, ret ); } ret = f_delete( "." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 8, ret ); + return _f_result( __LINE__, ret ); } ret = f_delete( ".." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 9, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( "." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 10, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( ".." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 11, ret ); + return _f_result( __LINE__, ret ); } ret = f_mkdir( "..." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 12, ret ); + return _f_result( __LINE__, ret ); } for ( a = 0 ; a < 6 ; a++ ) @@ -2226,63 +2543,63 @@ static unsigned char f_dots ( void ) break; default: - return _f_result( 13, a ); + return _f_result( __LINE__, a ); } /* switch */ file = f_open( ".", mode ); if ( file ) { - return _f_result( 14, a ); + return _f_result( __LINE__, a ); } file = f_open( "..", mode ); if ( file ) { - return _f_result( 15, a ); + return _f_result( __LINE__, a ); } file = f_open( "...", mode ); if ( file ) { - return _f_result( 16, a ); + return _f_result( __LINE__, a ); } } size = (unsigned char)f_filelength( "." ); if ( size ) { - return _f_result( 17, size ); + return _f_result( __LINE__, size ); } size = (unsigned char)f_filelength( ".." ); if ( size ) { - return _f_result( 18, size ); + return _f_result( __LINE__, size ); } size = (unsigned char)f_filelength( "..." ); if ( size ) { - return _f_result( 19, size ); + return _f_result( __LINE__, size ); } ret = f_chdir( "..." ); if ( ret != F_ERR_NOTFOUND ) { - return _f_result( 20, ret ); + return _f_result( __LINE__, ret ); } ret = f_chdir( ".." ); if ( ret ) { - return _f_result( 21, ret ); + return _f_result( __LINE__, ret ); } ret = f_rmdir( "tt" ); if ( ret ) { - return _f_result( 27, ret ); + return _f_result( __LINE__, ret ); } @@ -2297,7 +2614,7 @@ typedef struct unsigned char Line; unsigned char Buf[87]; } struct_TestFileSysEntry; - #define NUM_OF_RECORDS 10 +#define NUM_OF_RECORDS 10 static unsigned char f_rit ( void ) { unsigned char i; @@ -2314,7 +2631,7 @@ static unsigned char f_rit ( void ) File = f_open( "MyTest", "a+" ); if ( !File ) { - return _f_result( 1, 0 ); + return _f_result( __LINE__, 0 ); } /* add records */ @@ -2328,40 +2645,40 @@ static unsigned char f_rit ( void ) if ( F_NO_ERROR != f_seek( File, 0, F_SEEK_END ) ) { - return _f_result( 2, 0 ); /* Fail, could not go to the end of the file */ + return _f_result( __LINE__, 0 ); /* Fail, could not go to the end of the file */ } if ( sizeof( struct_TestFileSysEntry ) != f_write( (void *)Entry, 1, sizeof( struct_TestFileSysEntry ), File ) ) { - return _f_result( 3, 0 ); /* Fail, could not write new entry */ + return _f_result( __LINE__, 0 ); /* Fail, could not write new entry */ } Pos = (unsigned short)f_tell( File ); if ( ( ( Pos / sizeof( struct_TestFileSysEntry ) ) - 1 ) != i ) { - return _f_result( 4, 0 ); /* Fail, wrong file position */ + return _f_result( __LINE__, 0 ); /* Fail, wrong file position */ } if ( F_NO_ERROR != f_seek( File, (long)( Pos - sizeof( struct_TestFileSysEntry ) ), F_SEEK_SET ) ) { - return _f_result( 5, 0 ); /* Fail, could not go to new entry position */ + return _f_result( __LINE__, 0 ); /* Fail, could not go to new entry position */ } if ( sizeof( struct_TestFileSysEntry ) != f_read( (void *)Entry, 1, sizeof( struct_TestFileSysEntry ), File ) ) { - return _f_result( 6, 0 ); /* Fail, could not read the new entry */ + return _f_result( __LINE__, 0 ); /* Fail, could not read the new entry */ } if ( ( Entry->MagicNum != 0xbc ) || ( Entry->Line != (int)i ) || ( Entry->Buf[0] != Ch ) || ( Entry->Buf[10] != Ch + 1 ) ) { - return _f_result( 7, 0 ); /*Fail, the new entry is corrupted"*/ + return _f_result( __LINE__, 0 ); /*Fail, the new entry is corrupted"*/ } } ret = f_close( File ); if ( ret ) { - return _f_result( 8, ret ); + return _f_result( __LINE__, ret ); } @@ -2369,7 +2686,7 @@ static unsigned char f_rit ( void ) File = f_open( "MyTest", "a+" ); if ( !File ) { - return _f_result( 9, 0 ); + return _f_result( __LINE__, 0 ); } /* read records */ @@ -2379,7 +2696,7 @@ static unsigned char f_rit ( void ) if ( F_NO_ERROR != f_seek( File, 0, F_SEEK_SET ) ) { - return _f_result( 10, 0 ); /* Fail, could not go to the start of the file */ + return _f_result( __LINE__, 0 ); /* Fail, could not go to the start of the file */ } Founded = 0; @@ -2397,21 +2714,21 @@ static unsigned char f_rit ( void ) if ( !Founded ) { - return _f_result( 11, i ); /* Entry not founded */ + return _f_result( __LINE__, i ); /* Entry not founded */ } } ret = f_close( File ); if ( ret ) { - return _f_result( 12, ret ); + return _f_result( __LINE__, ret ); } ret = f_delete( "MyTest" ); if ( ret ) { - return _f_result( 13, ret ); + return _f_result( __LINE__, ret ); } _f_dump( "passed..." ); @@ -2433,109 +2750,109 @@ static unsigned char f_truncating ( void ) file = f_open( "test.bin", "w+" ); if ( !file ) { - return _f_result( 0, 0 ); + return _f_result( __LINE__, 0 ); } (void)psp_memset( testbuffer, 1, F_MAX_SEEK_TEST ); size = (unsigned long)f_write( testbuffer, 1, F_MAX_SEEK_TEST, file ); if ( size != F_MAX_SEEK_TEST ) { - return _f_result( 1, size ); + return _f_result( __LINE__, size ); } ret = f_close( file ); if ( ret ) { - return _f_result( 2, ret ); + return _f_result( __LINE__, ret ); } file = f_truncate( "test.bin", F_MAX_SEEK_TEST - 4 ); if ( !file ) { - return _f_result( 3, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_close( file ); if ( ret ) { - return _f_result( 4, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned long)f_filelength( "test.bin" ); if ( size != F_MAX_SEEK_TEST - 4 ) { - return _f_result( 5, size ); + return _f_result( __LINE__, size ); } file = f_truncate( "test.bin", F_MAX_SEEK_TEST ); if ( !file ) { - return _f_result( 3, 0 ); + return _f_result( __LINE__, 0 ); } ret = f_close( file ); if ( ret ) { - return _f_result( 4, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned long)f_filelength( "test.bin" ); if ( size != F_MAX_SEEK_TEST ) { - return _f_result( 5, size ); + return _f_result( __LINE__, size ); } file = f_truncate( "test.bin", ( F_MAX_SEEK_TEST / 2 ) - 92 ); if ( !file ) { - return _f_result( 6, 0 ); + return _f_result( __LINE__, 0 ); } (void)psp_memset( testbuffer, 2, 92 ); size = (unsigned long)f_write( testbuffer, 1, 92, file ); if ( size != 92 ) { - return _f_result( 7, size ); + return _f_result( __LINE__, size ); } ret = f_close( file ); if ( ret ) { - return _f_result( 8, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned long)f_filelength( "test.bin" ); if ( size != ( F_MAX_SEEK_TEST / 2 ) ) { - return _f_result( 9, size ); + return _f_result( __LINE__, size ); } file = f_truncate( "test.bin", 1 ); if ( !file ) { - return _f_result( 10, 0 ); + return _f_result( __LINE__, 0 ); } (void)psp_memset( testbuffer, 3, 2 ); size = (unsigned long)f_write( testbuffer, 1, 2, file ); if ( size != 2 ) { - return _f_result( 11, size ); + return _f_result( __LINE__, size ); } ret = f_close( file ); if ( ret ) { - return _f_result( 12, ret ); + return _f_result( __LINE__, ret ); } size = (unsigned long)f_filelength( "test.bin" ); if ( size != 3 ) { - return _f_result( 13, size ); + return _f_result( __LINE__, size ); } @@ -2598,7 +2915,7 @@ void f_dotest ( unsigned char t ) break; } - #if ( F_MAX_SEEK_TEST > 128 ) +#if ( F_MAX_SEEK_TEST > 128 ) /* fall through */ case 6: @@ -2608,8 +2925,8 @@ void f_dotest ( unsigned char t ) break; } - #endif - #if ( F_MAX_SEEK_TEST > 256 ) +#endif +#if ( F_MAX_SEEK_TEST > 256 ) /* fall through */ case 7: @@ -2619,8 +2936,8 @@ void f_dotest ( unsigned char t ) break; } - #endif - #if ( F_MAX_SEEK_TEST > 512 ) +#endif +#if ( F_MAX_SEEK_TEST > 512 ) /* fall through */ case 8: @@ -2630,8 +2947,8 @@ void f_dotest ( unsigned char t ) break; } - #endif - #if ( F_MAX_SEEK_TEST > 1024 ) +#endif +#if ( F_MAX_SEEK_TEST > 1024 ) /* fall through */ case 9: @@ -2641,8 +2958,8 @@ void f_dotest ( unsigned char t ) break; } - #endif - #if ( F_MAX_SEEK_TEST > 2048 ) +#endif +#if ( F_MAX_SEEK_TEST > 2048 ) /* fall through */ case 10: @@ -2652,8 +2969,8 @@ void f_dotest ( unsigned char t ) break; } - #endif - #if ( F_MAX_SEEK_TEST > 4096 ) +#endif +#if ( F_MAX_SEEK_TEST > 4096 ) /* fall through */ case 11: @@ -2663,8 +2980,8 @@ void f_dotest ( unsigned char t ) break; } - #endif - #if ( F_MAX_SEEK_TEST > 8192 ) +#endif +#if ( F_MAX_SEEK_TEST > 8192 ) /* fall through */ case 12: @@ -2674,8 +2991,8 @@ void f_dotest ( unsigned char t ) break; } - #endif - #if ( F_MAX_SEEK_TEST > 16384 ) +#endif +#if ( F_MAX_SEEK_TEST > 16384 ) /* fall through */ case 13: @@ -2685,7 +3002,7 @@ void f_dotest ( unsigned char t ) break; } - #endif +#endif /* fall through */ case 14: @@ -2745,10 +3062,8 @@ void f_dotest ( unsigned char t ) } /* f_dotest */ - /**************************************************************************** * * end of test.c * ***************************************************************************/ -#endif /*_TEST_C_*/ diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/test/test.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/test/test.h index 033f5db00..6d2de8929 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/test/test.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/test/test.h @@ -1,29 +1,29 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * - * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license + * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. - * - * FreeRTOS+FAT SL uses a dual license model that allows the software to be used - * under a standard GPL open source license, or a commercial license. The - * standard GPL license (unlike the modified GPL license under which FreeRTOS - * itself is distributed) requires that all software statically linked with - * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. + * + * FreeRTOS+FAT SL uses a dual license model that allows the software to be used + * under a standard GPL open source license, or a commercial license. The + * standard GPL license (unlike the modified GPL license under which FreeRTOS + * itself is distributed) requires that all software statically linked with + * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. * Details of both license options follow: - * + * * - Open source licensing - * FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and - * distributed without charge provided the user adheres to version two of the - * GNU General Public License (GPL) and does not remove the copyright notice or + * distributed without charge provided the user adheres to version two of the + * GNU General Public License (GPL) and does not remove the copyright notice or * this text. The GPL V2 text is available on the gnu.org web site, and on the * following URL: http://www.FreeRTOS.org/gpl-2.0.txt. - * + * * - Commercial licensing - * Businesses and individuals who for commercial or other reasons cannot comply - * with the terms of the GPL V2 license must obtain a commercial license before - * incorporating FreeRTOS+FAT SL into proprietary software for distribution in - * any form. Commercial licenses can be purchased from - * http://shop.freertos.org/fat_sl and do not require any source files to be + * with the terms of the GPL V2 license must obtain a commercial license before + * incorporating FreeRTOS+FAT SL into proprietary software for distribution in + * any form. Commercial licenses can be purchased from + * http://shop.freertos.org/fat_sl and do not require any source files to be * changed. * * FreeRTOS+FAT SL is distributed in the hope that it will be useful. You @@ -42,14 +42,10 @@ #define __TEST_H #include "../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2 +#if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2 #error Incompatible FAT_SL version number! #endif -#ifdef __cplusplus -extern "C" { -#endif - /* ** Maximum size for seek test. @@ -60,59 +56,13 @@ extern "C" { /* ** Defines media type for testing. -** Options: F_FAT12_MEDIA, F_FAT16_MEDIA +** Options: F_FAT12_MEDIA, F_FAT16_MEDIA, F_FAT32_MEDIA */ -#define F_FAT_TYPE F_FAT12_MEDIA +#define F_FAT_TYPE F_FAT16_MEDIA -/* -** Start filesystem test. -** Parameter: -** 0 - run all the tests -** -** 2 - directory -** 3 - find -** -** 5* - seek 128 -** 6* - seek 256 -** 7* - seek 512 -** 8* - seek 1024 -** 9* - seek 2048 -** 10*- seek 4096 -** 11*- seek 8192 -** 12*- seek 16384 -** 13*- seek 32768 -** 14 - open -** 15 - append -** 16 - write -** 17 - dots -** 18 - rit -** *Note that only seek tests allowed by F_MAX_SEEK_TEST are executed. -** -** The following defines are required for the specific test: -** 1 1 1 1 1 1 1 1 1 -** 2 3 5 6 7 8 9 0 1 2 3 4 5 6 7 8 -** F_CHDIR x x - - - - - - - - - - x - x - -** F_MKDIR x x - - - - - - - - - - - - x - -** F_RMDIR x x - - - - - - - - - - x - x - -** F_DELETE x x x x x x x x x x x x x x x x -** F_FILELENGTH - - x x x x x x x x x x x x - - -** F_FINDING x x - - - - - - - - - - x - - - -** F_TELL - - x x x x x x x x x x x x - x -** F_REWIND - - - - - - - - - - - x - - - - -** F_EOF - - x x x x x x x x x - - x - - -** F_SEEK - - x x x x x x x x x - x x - x -** F_WRITE - - x x x x x x x x x x x x - x -** F_WRITING x x x x x x x x x x x x x x x x -** F_DIRECTORIES x x - - - - - - - - - - x - x - -** F_CHECKNAME x - - - - - - - - - - - - - x - -*/ void f_dotest ( unsigned char ); -#ifdef __cplusplus -} -#endif - -#endif /* ifndef __TEST_H */ +#endif /* ifndef _CONFIG_STHIN_TEST_H */ diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/media-drv/ram/ramdrv_f.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/media-drv/ram/ramdrv_f.c index c665df38e..30e443ee8 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/media-drv/ram/ramdrv_f.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/media-drv/ram/ramdrv_f.c @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/include/psp_rtc.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/include/psp_rtc.h index 4dab7fdad..a66c50015 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/include/psp_rtc.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/include/psp_rtc.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/include/psp_string.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/include/psp_string.h index 237c90c0c..8a4410d0c 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/include/psp_string.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/include/psp_string.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test.c index 085425cc7..5295424bb 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test.c @@ -1,29 +1,29 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * - * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license + * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. - * - * FreeRTOS+FAT SL uses a dual license model that allows the software to be used - * under a standard GPL open source license, or a commercial license. The - * standard GPL license (unlike the modified GPL license under which FreeRTOS - * itself is distributed) requires that all software statically linked with - * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. + * + * FreeRTOS+FAT SL uses a dual license model that allows the software to be used + * under a standard GPL open source license, or a commercial license. The + * standard GPL license (unlike the modified GPL license under which FreeRTOS + * itself is distributed) requires that all software statically linked with + * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. * Details of both license options follow: - * + * * - Open source licensing - * FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and - * distributed without charge provided the user adheres to version two of the - * GNU General Public License (GPL) and does not remove the copyright notice or + * distributed without charge provided the user adheres to version two of the + * GNU General Public License (GPL) and does not remove the copyright notice or * this text. The GPL V2 text is available on the gnu.org web site, and on the * following URL: http://www.FreeRTOS.org/gpl-2.0.txt. - * + * * - Commercial licensing - * Businesses and individuals who for commercial or other reasons cannot comply - * with the terms of the GPL V2 license must obtain a commercial license before - * incorporating FreeRTOS+FAT SL into proprietary software for distribution in - * any form. Commercial licenses can be purchased from - * http://shop.freertos.org/fat_sl and do not require any source files to be + * with the terms of the GPL V2 license must obtain a commercial license before + * incorporating FreeRTOS+FAT SL into proprietary software for distribution in + * any form. Commercial licenses can be purchased from + * http://shop.freertos.org/fat_sl and do not require any source files to be * changed. * * FreeRTOS+FAT SL is distributed in the hope that it will be useful. You @@ -46,15 +46,17 @@ #include "../../../api/api_mdriver_ram.h" #include "../../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 +#if VER_FAT_SL_MAJOR != 5 #error Incompatible FAT_SL version number! #endif #include "../../../version/ver_psp_fat_sl.h" -#if VER_PSP_FAT_FAT_SL_MAJOR != 1 || VER_PSP_FAT_FAT_SL_MINOR != 1 +#if VER_PSP_FAT_FAT_SL_MAJOR != 1 || VER_PSP_FAT_FAT_SL_MINOR != 2 #error Incompatible PSP_FAT_FAT_SL version number! #endif -uint8_t all_tests_passed = 1u; +#define PRINT_BUFFER_SIZE 64 + +extern void __printbuf ( char * buf, int len ); /* Use to display text (printf). */ void _f_dump ( char * s ) @@ -63,19 +65,9 @@ void _f_dump ( char * s ) } /* Use to display test result (printf). */ -uint8_t _f_result ( uint8_t testnum, uint32_t result ) +uint8_t _f_result ( int linenum, uint32_t result ) { - (void)testnum; - if ( result == 0 ) - { - printf( "Passed\r\n" ); - } - else - { - printf( "FAILED! Error code: %u\r\n", ( unsigned int ) result ); - all_tests_passed = 0u; - } - + printf( "Error:%d/%ld\r\n", linenum, result ); return 0; } @@ -85,4 +77,3 @@ uint8_t _f_poweron ( void ) f_delvolume(); return f_initvolume( ram_initfunc ); } - diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test.h index 53b1540d0..15e632f2a 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/fat_sl/psp_test.h @@ -1,29 +1,29 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * - * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license + * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. - * - * FreeRTOS+FAT SL uses a dual license model that allows the software to be used - * under a standard GPL open source license, or a commercial license. The - * standard GPL license (unlike the modified GPL license under which FreeRTOS - * itself is distributed) requires that all software statically linked with - * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. + * + * FreeRTOS+FAT SL uses a dual license model that allows the software to be used + * under a standard GPL open source license, or a commercial license. The + * standard GPL license (unlike the modified GPL license under which FreeRTOS + * itself is distributed) requires that all software statically linked with + * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. * Details of both license options follow: - * + * * - Open source licensing - * FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and - * distributed without charge provided the user adheres to version two of the - * GNU General Public License (GPL) and does not remove the copyright notice or + * distributed without charge provided the user adheres to version two of the + * GNU General Public License (GPL) and does not remove the copyright notice or * this text. The GPL V2 text is available on the gnu.org web site, and on the * following URL: http://www.FreeRTOS.org/gpl-2.0.txt. - * + * * - Commercial licensing - * Businesses and individuals who for commercial or other reasons cannot comply - * with the terms of the GPL V2 license must obtain a commercial license before - * incorporating FreeRTOS+FAT SL into proprietary software for distribution in - * any form. Commercial licenses can be purchased from - * http://shop.freertos.org/fat_sl and do not require any source files to be + * with the terms of the GPL V2 license must obtain a commercial license before + * incorporating FreeRTOS+FAT SL into proprietary software for distribution in + * any form. Commercial licenses can be purchased from + * http://shop.freertos.org/fat_sl and do not require any source files to be * changed. * * FreeRTOS+FAT SL is distributed in the hope that it will be useful. You @@ -45,11 +45,11 @@ #include "../../../psp/include/psp_string.h" #include "../../../version/ver_fat_sl.h" -#if VER_FAT_SL_MAJOR != 3 +#if VER_FAT_SL_MAJOR != 5 #error Incompatible FAT_SL version number! #endif #include "../../../version/ver_psp_fat_sl.h" -#if VER_PSP_FAT_FAT_SL_MAJOR != 1 || VER_PSP_FAT_FAT_SL_MINOR != 1 +#if VER_PSP_FAT_FAT_SL_MAJOR != 1 || VER_PSP_FAT_FAT_SL_MINOR != 2 #error Incompatible PSP_FAT_FAT_SL version number! #endif @@ -57,13 +57,11 @@ extern "C" { #endif -extern uint8_t all_tests_passed; - /* Use to display text (printf). */ void _f_dump ( char * s ); /* Use to display test result (printf). */ -uint8_t _f_result ( uint8_t testnum, uint32_t result ); +uint8_t _f_result ( int linenum, uint32_t result ); /* Use to build file system (mount). */ uint8_t _f_poweron ( void ); diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/rtc/psp_rtc.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/rtc/psp_rtc.c index 3f10512cf..afa6ca4d8 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/rtc/psp_rtc.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/psp/target/rtc/psp_rtc.c @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/History.txt b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/History.txt new file mode 100644 index 000000000..653b9213e --- /dev/null +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/History.txt @@ -0,0 +1,9 @@ +Changes between V1.0.0 and V1.0.1 + + + Fix seeking beyond the end of file when the offset was not multiple of + the sector size, or when the file was empty. + + + Seeking test extended to validate seeking/writing on sector boundaries. + + + diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_fat_sl.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_fat_sl.h index a789f73c7..922d32ddd 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_fat_sl.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_fat_sl.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. @@ -41,7 +41,7 @@ #ifndef _VER_FAT_SL_H #define _VER_FAT_SL_H -#define VER_FAT_SL_MAJOR 3 +#define VER_FAT_SL_MAJOR 5 #define VER_FAT_SL_MINOR 2 #endif diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_mdriver.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_mdriver.h index 18f298313..ee581f436 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_mdriver.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_mdriver.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_mdriver_ram.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_mdriver_ram.h index 730c11aee..bd2cffaa3 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_mdriver_ram.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_mdriver_ram.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_fat_sl.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_fat_sl.h index 38511cbb6..9cc86933e 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_fat_sl.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_fat_sl.h @@ -1,29 +1,29 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * - * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license + * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. - * - * FreeRTOS+FAT SL uses a dual license model that allows the software to be used - * under a standard GPL open source license, or a commercial license. The - * standard GPL license (unlike the modified GPL license under which FreeRTOS - * itself is distributed) requires that all software statically linked with - * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. + * + * FreeRTOS+FAT SL uses a dual license model that allows the software to be used + * under a standard GPL open source license, or a commercial license. The + * standard GPL license (unlike the modified GPL license under which FreeRTOS + * itself is distributed) requires that all software statically linked with + * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms. * Details of both license options follow: - * + * * - Open source licensing - * FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and - * distributed without charge provided the user adheres to version two of the - * GNU General Public License (GPL) and does not remove the copyright notice or + * distributed without charge provided the user adheres to version two of the + * GNU General Public License (GPL) and does not remove the copyright notice or * this text. The GPL V2 text is available on the gnu.org web site, and on the * following URL: http://www.FreeRTOS.org/gpl-2.0.txt. - * + * * - Commercial licensing - * Businesses and individuals who for commercial or other reasons cannot comply - * with the terms of the GPL V2 license must obtain a commercial license before - * incorporating FreeRTOS+FAT SL into proprietary software for distribution in - * any form. Commercial licenses can be purchased from - * http://shop.freertos.org/fat_sl and do not require any source files to be + * with the terms of the GPL V2 license must obtain a commercial license before + * incorporating FreeRTOS+FAT SL into proprietary software for distribution in + * any form. Commercial licenses can be purchased from + * http://shop.freertos.org/fat_sl and do not require any source files to be * changed. * * FreeRTOS+FAT SL is distributed in the hope that it will be useful. You @@ -42,7 +42,7 @@ #define _VER_PSP_FAT_FAT_SL_H #define VER_PSP_FAT_FAT_SL_MAJOR 1 -#define VER_PSP_FAT_FAT_SL_MINOR 1 +#define VER_PSP_FAT_FAT_SL_MINOR 2 #endif /* _VER_PSP_FAT_FAT_SL_H */ diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_rtc.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_rtc.h index a1f4c6e61..032888eb6 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_rtc.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_rtc.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_string.h b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_string.h index d2c0a21a8..5d8cd4300 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_string.h +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/version/ver_psp_string.h @@ -1,5 +1,5 @@ /* - * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded + * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded * * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license * terms. -- 2.39.5