ChaN contributed two FAT file system implementations as open source
Both are great work and put under a license that allowed use in commercial software.
For weAutSys / weAut_01 the petit one was unsuitable restricted. And it proved quite hard to upgrade. So the grande variant was taken and cut to size quite radically for (mainly) two reasons
The successful adaption to weAutSys / weAut_01 respectively ATmega is still open source. It, necessarily, sacrifices a good deal of ChaN's original flexibility and adaptability to large systems with multiple drives of many types.
Modules | |
Driver adaption to SMC | |
File system operations | |
Files | |
file | diskio.h |
Small memory card (SMC / MMC) driver function definitions. | |
file | ff.h |
(Grande) fatFS configurations and declarations | |
file | ffconf.h |
(Grande) fatFS configuration options | |
Defines | |
#define | _CODE_PAGE 1 |
The code page used. | |
#define | _FS_MINIMIZE 0 |
Omit functions to save (program / flash) memory. | |
#define | _FS_READONLY 0 |
Only read functions. | |
#define | _FS_RPATH 0 |
The relative path feature. | |
#define | _LFN_UNICODE 0 |
0: ANSI/OEM or 1: Unicode | |
#define | _MAX_LFN 255 |
Maximum LFN length to handle (12 to 255) | |
#define | _MULTI_PARTITION 0 |
Allow multiple partitions. | |
#define | _USE_ERASE 0 |
Allow erase of blocks of sectors. | |
#define | _USE_FASTSEEK 0 |
0: disable or 1: enable the fast seek feature | |
#define | _USE_LFN 0 |
The long file name feature. | |
#define | _USE_STRFUNC 0 |
0: disable or 1-2: enable string functions | |
#define | _VOLUMES 1 |
Number of volumes (logical drives) to be used. | |
#define | _WORD_ACCESS 1 |
Word access. |
#define _FS_READONLY 0 |
#define _FS_MINIMIZE 0 |
Omit functions to save (program / flash) memory.
The _FS_MINIMIZE option defines minimisation level to remove some functions.
0: No reduction, except on weAutSys omission of f_getfree and f_lseek *a)
1: Omit f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename.
2: Additionally omit f_opendir and f_readdir.
3: Omit f_lseek also.
Note *a): f_getfree and f_lseek follow sectors until certain conditions are met. This leads to unpredictable run times — often long enough to fire a watchdog reset.
#define _CODE_PAGE 1 |
The code page used.
The _CODE_PAGE specifies the OEM code page to be used on the target system. Incorrect setting of the code page can cause a file open failure.
932 - Japanese Shift-JIS (DBCS, OEM, Windows)
936 - Simplified Chinese GBK (DBCS, OEM, Windows)
949 - Korean (DBCS, OEM, Windows)
950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
1250 - Central Europe (Windows)
1251 - Cyrillic (Windows)
1252 - Latin 1 (Windows)
1253 - Greek (Windows)
1254 - Turkish (Windows)
1255 - Hebrew (Windows)
1256 - Arabic (Windows)
1257 - Baltic (Windows)
1258 - Vietnam (OEM, Windows)
437 - U.S. (OEM)
720 - Arabic (OEM)
737 - Greek (OEM)
775 - Baltic (OEM)
850 - Multilingual Latin 1 (OEM)
858 - Multilingual Latin 1 + Euro (OEM)
852 - Latin 2 (OEM)
855 - Cyrillic (OEM)
866 - Russian (OEM)
857 - Turkish (OEM)
862 - Hebrew (OEM)
874 - Thai (OEM, Windows)
1 - ASCII only (Valid for non LFN configuration)
#define _USE_LFN 0 |
The long file name feature.
0: Disable LFN feature. _MAX_LFN and _LFN_UNICODE have no effect.
1: Enable LFN with static working buffer on the BSS. Always NOT reentrant.
2: Enable LFN with dynamic working buffer on the stack.
3: Enable LFN with dynamic working buffer on the heap.
The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. To enable LFN, the Unicode handling functions ff_convert() and ff_wtoupper() must be added to the project. To use heap, the memory control functions ff_memalloc() and ff_memfree() must be added to the project.
For small systems and SMCs this feature is switched off for space, performance and license reasons. (Microsoft holds patents for long file names on FAT file systems.) One extra drawback of using only short file names is their using only upper case letters.
#define _FS_RPATH 0 |
The relative path feature.
0: Disable relative path feature and remove related functions.
1: Enable relative path functions f_chdrive() and f_chdir().
2: f_getcwd() is available, also.
Note that output of f_readdir() is affected by this option.
For small systems and SMCs this feature is switched off.
#define _MULTI_PARTITION 0 |
Allow multiple partitions.
legal values:
0: single partition,
1/2: enable multiple partition
When set to 0, each volume is bound to the same physical drive number and can mount only the first primary partition. When it is set to 1 or 2, each volume is tied to the partitions listed in (then defined) VolToPart[]. When set to 2 a f_fisk() function is defined additionally.
Hint: For small memory card (SMC, MMC) implementation on small controllers _MULTI_PARTITION should be kept 0.
#define _USE_ERASE 0 |
Allow erase of blocks of sectors.
This is a device driver function "below" the file system. For use with weAutSys it should be kept disabled to avoid conflicts with the runtime's driver functions.
Note: Files and directories are erased by f_unlink().
0: disable / 1: enable sectors erase.
If set to 1 the CTRL_ERASE_SECTOR command should be added to the disk_ioctl function.
#define _WORD_ACCESS 1 |
Word access.
values: 0: Byte-by-byte access / 1: Word access.
ChaN says: When the byte order on the memory is big-endian or address miss-aligned word access results incorrect behavior, the _WORD_ACCESS must be set to 0.
Hint (A.W.): In all other cases (like ref intro_sec "weAutSys", ref intro_secH "weAut_01", ATmega, GCC) it should be left 1 as the C and machine code generated by _WORD_ACCESS
== 0 is not optimal (to put it mildly).
Hint2: The name of this configuration option is a bit misleading. It concerns not really the bus width (8, 16, 32, 64) of the computer architecture used but more (or only) its endianess.