1 /*****************************************************************************
2 * FullFAT - High Performance, Thread-Safe Embedded FAT File-System *
3 * Copyright (C) 2009 James Walmsley (james@worm.me.uk) *
5 * This program is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 3 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
20 * Alternative Licensing is available directly from the Copyright holder, *
21 * (James Walmsley). For more information consult LICENSING.TXT to obtain *
22 * a Commercial license. *
24 * See RESTRICTIONS.TXT for extra restrictions on the use of FullFAT. *
26 * Removing the above notice is illegal and will invalidate this license. *
27 *****************************************************************************
28 * See http://worm.me.uk/fullfat for more information. *
29 * Or http://fullfat.googlecode.com/ for latest releases and the wiki. *
30 *****************************************************************************/
34 Here you can change the configuration of FullFAT as appropriate to your
38 //---------- ENDIANESS
39 #define FF_LITTLE_ENDIAN // Choosing the Byte-order of your system is important.
40 //#define FF_BIG_ENDIAN // You may be able to provide better Byte-order swapping routines to FullFAT.
41 // See ff_memory.c for more information.
43 //---------- LFN (Long File-name) SUPPORT
44 #define FF_LFN_SUPPORT // Comment this out if you don't want to worry about Patent Issues.
45 // FullFAT works great with LFNs and without. You choose, its your project!
47 //---------- LEGAL LFNS
48 //#define FF_LEGAL_LFNS // Enabling this define causes FullFAT to not infringe on any of Microsoft's patents when making LFN names.
49 // To do this, it will only create LFNs and no shortnames. Microsofts patents are only relevent when mapping
50 // a shortname to a long name. This is the same way that Linux gets around the FAT legal issues:
51 // see http://lkml.org/lkml/2009/6/26/314
53 // Enabling this may break compatibility with devices that cannot read LFN filenames.
54 // Enabling this option causes no compatibility issues when reading any media.
56 //---------- TIME SUPPORT
57 #define FF_TIME_SUPPORT // Should FullFAT use time stamping. Only if you have provided the relevant time drivers in ff_time.c
58 // Note, by default ff_time.c is set-up for the Windows Demonstration. Please see ff_time.c to disable.
60 //---------- FILE SPACE ALLOCATION PERFORMANCE
61 // Uncomment the prefered method. (Can only choose a single method).
62 #define FF_ALLOC_DEFAULT // Only allocate as much as is needed. (Provides good performance, without wasting space).
63 //#define FF_ALLOC_DOUBLE // Doubles the size of a file each time allocation is required. (When high-performance writing is required).
65 //---------- Use Native STDIO.h
66 //#define FF_USE_NATIVE_STDIO // Makes FullFAT conform to values provided by your native STDIO.h file.
68 //---------- FREE SPACE CALCULATION
69 //#define FF_MOUNT_FIND_FREE // Uncomment this option to check for Freespace on a volume mount. (Performance Penalty while mounting).
70 // If not done in the mount, it will be done on the first call to FF_GetFreeSize() function.
72 //---------- PATH CACHE
73 #define FF_PATH_CACHE // Enables a simply Path Caching mechanism that increases performance of repeated operations
74 // within the same path. E.g. a copy \dir1\*.* \dir2\*.* command.
75 // This command requires FF_MAX_PATH number of bytes of memory. (Defined below, default 2600).
77 //---------- BLKDEV USES SEMAPHORE
78 #define FF_BLKDEV_USES_SEM // When defined, each call to fnReadBlocks and fnWriteBlocks will be done while semaphore is locked
79 // See also ff_safety.c
83 #define FF_PATH_CACHE_DEPTH 2 // The Number of PATH's to Cache.
85 //---------- DON'T USE MALLOC
86 //#define FF_NO_MALLOC
88 #define FF_MALLOC(aSize) malloc(aSize)
89 #define FF_FREE(apPtr) free(apPtr)
91 //#define FF_INLINE_MEMORY_ACCESS
93 //#define FF_INLINE static __forceinline // Keywords to inline functions (Windows)
94 #define FF_INLINE static inline // Standard for GCC
97 //---------- Hash Table Support
98 //#define FF_HASH_TABLE_SUPPORT // Enable HASH to speed up file creation.
99 #ifdef FF_HASH_TABLE_SUPPORT
100 #define FF_HASH_FUNCTION CRC16
101 //#define FF_HASH_FUNCTION CRC8
106 //---------- FAT12 SUPPORT
107 #define FF_FAT12_SUPPORT // Enable FAT12 Suppport. You can reduce the code-size by commenting this out.
108 // If you don't need FAT12 support, why have it. FAT12 is more complex to process,
109 // therefore savings can be made by not having it.
111 //---------- 64-Bit Number Support
112 #define FF_64_NUM_SUPPORT // This helps to give information about the FreeSpace and VolumeSize of a partition or volume.
113 // If you cannot support 64-bit integers, then FullFAT still works, its just that the functions:
114 // FF_GetFreeSize() and FF_GetVolumeSize() don't make sense when reporting sizes > 4GB.
116 //---------- Driver Sleep Time // How long FullFAT should sleep the thread for in ms, if FF_ERR_DRIVER_BUSY is recieved.
117 #define FF_DRIVER_BUSY_SLEEP 20
119 //---------- Debugging Features
120 #define FF_DEBUG // Enable the Error Code string functions. const FF_T_INT8 *FF_GetErrMessage( FF_T_SINT32 iErrorCode);
121 // Uncommenting this just stops FullFAT error strings being compiled.
123 //---------- Actively Determine if partition is FAT
124 #define FF_FAT_CHECK // This is experimental, so if FullFAT won't mount your volume, comment this out
125 // Also report the problem to james@worm.me.uk
128 //---------- AUTOMATIC SETTINGS DO NOT EDIT -- These configure your options from above, and check sanity!
130 #ifdef FF_LFN_SUPPORT
131 #define FF_MAX_FILENAME (129)
133 #define FF_MAX_FILENAME 13
136 #ifdef FF_USE_NATIVE_STDIO
138 #define FF_MAX_PATH MAX_PATH
140 #define FF_MAX_PATH 2600
143 #define FF_MAX_PATH 2600
146 #ifndef FF_ALLOC_DOUBLE
147 #ifndef FF_ALLOC_DEFAULT
148 #error FullFAT Invalid ff_config.h file: A file allocation method must be specified. See ff_config.h file.
152 #ifdef FF_ALLOC_DOUBLE
153 #ifdef FF_ALLOC_DEFAULT
154 #error FullFAT Invalid ff_config.h file: Must choose a single option for File Allocation Method. DOUBLE or DEFAULT. See ff_config.h file.
158 #ifndef FF_LITTLE_ENDIAN
159 #ifndef FF_BIG_ENDIAN
160 #error FullFAT Invalid ff_config.h file: An ENDIANESS must be defined for your platform. See ff_config.h file.
164 #ifdef FF_LITTLE_ENDIAN
166 #error FullFAT Invalid ff_config.h file: Cannot be BIG and LITTLE ENDIAN, choose either or BIG or LITTLE. See ff_config.h file.
170 #ifdef FF_HASH_TABLE_SUPPORT
172 #if FF_HASH_FUNCTION == CRC16
173 #define FF_HASH_TABLE_SIZE 8192
174 #elif FF_HASH_FUNCTION == CRC8
175 #define FF_HASH_TABLE_SIZE 32
177 #error Invalid Hashing function selected. CRC16 or CRC8!