Contiki-NG
Loading...
Searching...
No Matches
ffconf.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016, Benoît Thébaudeau <benoit@wsystem.com>
3 * All rights reserved.
4 *
5 * Based on the FatFs Module,
6 * Copyright (c) 2016, ChaN
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * 3. Neither the name of the copyright holder nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35/**
36 * \addtogroup zoul
37 * @{
38 *
39 * \defgroup remote-fat RE-Mote FatFs
40 *
41 * Default port of FatFs on RE-Mote.
42 * @{
43 *
44 * \file
45 * Header file configuring FatFs for RE-Mote.
46 */
47#ifndef FFCONF_H_
48#define FFCONF_H_
49
50#include "contiki.h"
51
52#define _FFCONF 68020 /**< Revision ID */
53
54/*----------------------------------------------------------------------------*/
55/** \name Function Configuration
56 * @{
57 */
58
59#ifndef _FS_READONLY
60/** This option switches the read-only configuration
61 * (\c 0: read/write or \c 1: read-only).
62 *
63 * The read-only configuration removes the writing functions from the API:
64 * \c f_write(), \c f_sync(), \c f_unlink(), \c f_mkdir(), \c f_chmod(),
65 * \c f_rename(), \c f_truncate(), \c f_getfree(), and optional writing
66 * functions as well.
67 */
68#define _FS_READONLY 0
69#endif
70
71#ifndef _FS_MINIMIZE
72/** This option defines the minimization level to remove some basic API
73 * functions.
74 *
75 * \c 0: All the basic functions are enabled.
76 * \c 1: \c f_stat(), \c f_getfree(), \c f_unlink(), \c f_mkdir(),
77 * \c f_truncate(), and \c f_rename() are removed.
78 * \c 2: \c f_opendir(), \c f_readdir(), and \c f_closedir() are removed in
79 * addition to \c 1.
80 * \c 3: \c f_lseek() is removed in addition to \c 2.
81 */
82#define _FS_MINIMIZE 0
83#endif
84
85#ifndef _USE_STRFUNC
86/** This option switches the string functions: \c f_gets(), \c f_putc(),
87 * \c f_puts(), and \c f_printf().
88 *
89 * \c 0: Disable string functions.
90 * \c 1: Enable without LF-CRLF conversion.
91 * \c 2: Enable with LF-CRLF conversion.
92 */
93#define _USE_STRFUNC 1
94#endif
95
96#ifndef _USE_FIND
97/** This option switches the filtered directory read functions: \c f_findfirst()
98 * and \c f_findnext() (\c 0: disable, \c 1: enable, \c 2: enable with matching
99 * \c altname[] too).
100 */
101#define _USE_FIND 1
102#endif
103
104#ifndef _USE_MKFS
105/** This option switches the \c f_mkfs() function
106 * (\c 0: disable or \c 1: enable).
107 */
108#define _USE_MKFS 1
109#endif
110
111#ifndef _USE_FASTSEEK
112/** This option switches the fast seek function
113 * (\c 0: disable or \c 1: enable).
114 */
115#define _USE_FASTSEEK 0
116#endif
117
118#ifndef _USE_EXPAND
119/** This option switches the \c f_expand() function
120 * (\c 0: disable or \c 1: enable).
121 */
122#define _USE_EXPAND 0
123#endif
124
125#ifndef _USE_CHMOD
126/** This option switches the attribute manipulation functions: \c f_chmod() and
127 * \c f_utime() (\c 0: disable or \c 1: enable). Also, \c _FS_READONLY needs to
128 * be \c 0 to enable this option.
129 */
130#define _USE_CHMOD 1
131#endif
132
133#ifndef _USE_LABEL
134/** This option switches the volume label functions: \c f_getlabel() and
135 * \c f_setlabel() (\c 0: disable or \c 1: enable).
136 */
137#define _USE_LABEL 1
138#endif
139
140#ifndef _USE_FORWARD
141/** This option switches the \c f_forward() function
142 * (\c 0: disable or \c 1: enable).
143 */
144#define _USE_FORWARD 0
145#endif
146
147/** @} */
148/*----------------------------------------------------------------------------*/
149/** \name Locale and Namespace Configuration
150 * @{
151 */
152
153#ifndef _CODE_PAGE
154/** This option specifies the OEM code page to be used on the target system.
155 * Incorrect setting of the code page can cause a file open failure.
156 *
157 * \c 1 - ASCII (no extended character, non-LFN cfg. only)
158 * \c 437 - U.S.
159 * \c 720 - Arabic
160 * \c 737 - Greek
161 * \c 771 - KBL
162 * \c 775 - Baltic
163 * \c 850 - Latin 1
164 * \c 852 - Latin 2
165 * \c 855 - Cyrillic
166 * \c 857 - Turkish
167 * \c 860 - Portuguese
168 * \c 861 - Icelandic
169 * \c 862 - Hebrew
170 * \c 863 - Canadian French
171 * \c 864 - Arabic
172 * \c 865 - Nordic
173 * \c 866 - Russian
174 * \c 869 - Greek 2
175 * \c 932 - Japanese (DBCS)
176 * \c 936 - Simplified Chinese (DBCS)
177 * \c 949 - Korean (DBCS)
178 * \c 950 - Traditional Chinese (DBCS)
179 */
180#define _CODE_PAGE 437
181#endif
182
183#ifndef _USE_LFN
184/** \c _USE_LFN switches the support of long file name (LFN).
185 *
186 * \c 0: Disable LFN support. \c _MAX_LFN has no effect.
187 * \c 1: Enable LFN with static working buffer on the BSS. Always thread-unsafe.
188 * \c 2: Enable LFN with dynamic working buffer on the STACK.
189 * \c 3: Enable LFN with dynamic working buffer on the HEAP.
190 *
191 * To enable LFN, the Unicode handling functions (<tt>option/unicode.c</tt>)
192 * must be added to the project. The working buffer occupies
193 * <tt>(_MAX_LFN + 1) * 2</tt> bytes, and 608 more bytes with exFAT enabled.
194 * \c _MAX_LFN can be in the range from 12 to 255. It should be set to 255 to
195 * support the full-featured LFN operations. When using the stack for the
196 * working buffer, take care of stack overflow. When using the heap memory for
197 * the working buffer, the memory management functions, \c ff_memalloc() and
198 * \c ff_memfree(), must be added to the project.
199 */
200#define _USE_LFN 3
201#endif
202#ifndef _MAX_LFN
203#define _MAX_LFN 255
204#endif
205
206#ifndef _LFN_UNICODE
207/** This option switches the character encoding in the API
208 * (\c 0: ANSI/OEM or \c 1: UTF-16).
209 *
210 * To use a Unicode string for the path name, enable LFN and set \c _LFN_UNICODE
211 * to \c 1.
212 * This option also affects the behavior of the string I/O functions.
213 */
214#define _LFN_UNICODE 0
215#endif
216
217#ifndef _STRF_ENCODE
218/** If \c _LFN_UNICODE is set to \c 1, this option selects the character
219 * encoding OF THE FILE to be read/written via the string I/O functions:
220 * \c f_gets(), \c f_putc(), \c f_puts(), and \c f_printf().
221 *
222 * \c 0: ANSI/OEM
223 * \c 1: UTF-16LE
224 * \c 2: UTF-16BE
225 * \c 3: UTF-8
226 *
227 * This option has no effect if \c _LFN_UNICODE is set to \c 0.
228 */
229#define _STRF_ENCODE 0
230#endif
231
232#ifndef _FS_RPATH
233/** This option configures the support of relative path.
234 *
235 * \c 0: Disable relative path and remove related functions.
236 * \c 1: Enable relative path. \c f_chdir() and \c f_chdrive() are available.
237 * \c 2: \c f_getcwd() is available in addition to \c 1.
238 */
239#define _FS_RPATH 2
240#endif
241
242/** @} */
243/*----------------------------------------------------------------------------*/
244/** \name Drive/Volume Configuration
245 * @{
246 */
247
248#ifndef _VOLUMES
249/** Number of volumes (logical drives) to be used. */
250#define _VOLUMES 1
251#endif
252
253#ifndef _STR_VOLUME_ID
254/** \c _STR_VOLUME_ID switches the string support of volume ID.
255 * If \c _STR_VOLUME_ID is set to \c 1, pre-defined strings can also be used as
256 * drive number in the path name. \c _VOLUME_STRS defines the drive ID strings
257 * for each logical drive. The number of items must be equal to \c _VOLUMES.
258 * The valid characters for the drive ID strings are: A-Z and 0-9.
259 */
260#define _STR_VOLUME_ID 0
261#endif
262#ifndef _VOLUME_STRS
263#define _VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
264#endif
265
266#ifndef _MULTI_PARTITION
267/** This option switches support of multi-partition on a physical drive.
268 * By default (0), each logical drive number is bound to the same physical drive
269 * number and only an FAT volume found on the physical drive will be mounted.
270 * When multi-partition is enabled (1), each logical drive number can be bound to
271 * arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
272 * funciton will be available.
273 */
274#define _MULTI_PARTITION 0
275#endif
276
277#ifndef _MIN_SS
278/** These options configure the range of sector size to be supported (512, 1024,
279 * 2048, or 4096). Always set both to 512 for most systems, all types of memory
280 * cards and harddisk. But a larger value may be required for on-board flash
281 * memory and some types of optical media. When \c _MAX_SS is larger than
282 * \c _MIN_SS, FatFs is configured to variable sector size and the
283 * \c GET_SECTOR_SIZE command must be implemented in \c disk_ioctl().
284 */
285#define _MIN_SS 512
286#endif
287#ifndef _MAX_SS
288#define _MAX_SS 512
289#endif
290
291#ifndef _USE_TRIM
292/** This option switches the support of ATA-TRIM
293 * (\c 0: disable or \c 1: enable).
294 *
295 * To enable the Trim function, the \c CTRL_TRIM command should also be
296 * implemented in \c disk_ioctl().
297 */
298#define _USE_TRIM 0
299#endif
300
301#ifndef _FS_NOFSINFO
302/** If you need to know the correct free space on the FAT32 volume, set the bit
303 * 0 of this option, and the \c f_getfree() function will force a full FAT scan
304 * on the first time after a volume mount. The bit 1 controls the use of the
305 * last allocated cluster number.
306 *
307 * bit 0=0: Use the free cluster count in FSINFO if available.
308 * bit 0=1: Do not trust the free cluster count in FSINFO.
309 * bit 1=0: Use the last allocated cluster number in FSINFO if available.
310 * bit 1=1: Do not trust the last allocated cluster number in FSINFO.
311 */
312#define _FS_NOFSINFO 3
313#endif
314
315/** @} */
316/*----------------------------------------------------------------------------*/
317/** \name System Configuration
318 * @{
319 */
320
321#ifndef _FS_TINY
322/** This option switches the tiny buffer configuration
323 * (\c 0: normal or \c 1: tiny).
324 *
325 * With the tiny configuration, the size of a file object (FIL) is reduced to
326 * \c _MAX_SS bytes. Instead of the private sector buffer eliminated from the
327 * file object, a common sector buffer in the file system object (FATFS) is used
328 * for the file data transfer.
329 */
330#define _FS_TINY 0
331#endif
332
333#ifndef _FS_EXFAT
334/** This option switches the support of the exFAT file system
335 * (\c 0: disable or \c 1: enable).
336 *
337 * With exFAT enabled, LFN also needs to be enabled (\c _USE_LFN >= 1).
338 * Note that enabling exFAT discards C89 compatibility.
339 */
340#define _FS_EXFAT 1
341#endif
342
343#ifndef _FS_NORTC
344/** The option \c _FS_NORTC switches the timestamp function. If the system does
345 * not have any RTC function or if a valid timestamp is not needed, set
346 * \c _FS_NORTC to \c 1 to disable the timestamp function. All the objects
347 * modified by FatFs will have a fixed timestamp defined by \c _NORTC_MON,
348 * \c _NORTC_MDAY, and \c _NORTC_YEAR in local time.
349 * To enable the timestamp function (\c _FS_NORTC set to \c 0), \c get_fattime()
350 * needs to be added to the project to get the current time from a real-time
351 * clock. \c _NORTC_MON, \c _NORTC_MDAY, and \c _NORTC_YEAR have no effect.
352 * These options have no effect with a read-only configuration (\c _FS_READONLY
353 * set to \c 1).
354 */
355#define _FS_NORTC (!RTC_CONF_INIT)
356#endif
357#ifndef _NORTC_MON
358#define _NORTC_MON 1
359#endif
360#ifndef _NORTC_MDAY
361#define _NORTC_MDAY 1
362#endif
363#ifndef _NORTC_YEAR
364#define _NORTC_YEAR 2016
365#endif
366
367#ifndef _FS_LOCK
368/** The option \c _FS_LOCK switches the file lock function controlling duplicate
369 * file open and illegal operations on the open objects. This option must be set
370 * to \c 0 if \c _FS_READONLY is \c 1.
371 *
372 * \c 0: Disable the file lock function. To avoid volume corruption, the
373 * application program should avoid illegal open, remove, and rename on
374 * the open objects.
375 * \c >0: Enable the file lock function. The value defines how many
376 * files/sub-directories can be opened simultaneously under file lock
377 * control. Note that the file lock control is independent of
378 * re-entrancy.
379 */
380#define _FS_LOCK 0
381#endif
382
383#ifndef _FS_REENTRANT
384/** The option \c _FS_REENTRANT switches the re-entrancy (thread-safe) of the
385 * FatFs module itself. Note that, regardless of this option, file access to
386 * different volumes is always re-entrant, and the volume control functions,
387 * \c f_mount(), \c f_mkfs(), and \c f_fdisk(), are always non-re-entrant. Only
388 * file/directory access to the same volume is under control of this function.
389 *
390 * \c 0: Disable re-entrancy. \c _FS_TIMEOUT and \c _SYNC_t have no effect.
391 * \c 1: Enable re-entrancy. The user-provided synchronization handlers,
392 * \c ff_req_grant(), \c ff_rel_grant(), \c ff_del_syncobj(), and
393 * \c ff_cre_syncobj(), must also be added to the project. Samples are
394 * available in <tt>option/syscall.c</tt>.
395 *
396 * \c _FS_TIMEOUT defines the timeout period in unit of time tick.
397 * \c _SYNC_t defines the OS-dependent sync object type, e.g. \c HANDLE, \c ID,
398 * \c OS_EVENT*, \c SemaphoreHandle_t, etc. A header file for the OS definitions
399 * needs to be included somewhere in the scope of <tt>ff.h</tt>.
400 */
401#define _FS_REENTRANT 0
402#endif
403#ifndef _FS_TIMEOUT
404#define _FS_TIMEOUT 1000
405#endif
406#ifndef _SYNC_t
407#define _SYNC_t HANDLE
408#endif
409
410/** @} */
411/*----------------------------------------------------------------------------*/
412
413#endif /* FFCONF_H_ */
414
415/**
416 * @}
417 * @}
418 */