SD card data log

Dependents:   riset_Datalogger

Committer:
kotachi
Date:
Sun Nov 03 07:28:09 2019 +0000
Revision:
0:18d80d7403d3
SD card logging system

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kotachi 0:18d80d7403d3 1 /*---------------------------------------------------------------------------/
kotachi 0:18d80d7403d3 2 / FatFs - FAT file system module configuration file R0.11a (C)ChaN, 2015
kotachi 0:18d80d7403d3 3 /---------------------------------------------------------------------------*/
kotachi 0:18d80d7403d3 4
kotachi 0:18d80d7403d3 5 #define _FFCONF 64180 /* Revision ID */
kotachi 0:18d80d7403d3 6
kotachi 0:18d80d7403d3 7 #define FFS_DBG 0
kotachi 0:18d80d7403d3 8
kotachi 0:18d80d7403d3 9 /*---------------------------------------------------------------------------/
kotachi 0:18d80d7403d3 10 / Function Configurations
kotachi 0:18d80d7403d3 11 /---------------------------------------------------------------------------*/
kotachi 0:18d80d7403d3 12
kotachi 0:18d80d7403d3 13 #define _FS_READONLY 0
kotachi 0:18d80d7403d3 14 /* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
kotachi 0:18d80d7403d3 15 / Read-only configuration removes writing API functions, f_write(), f_sync(),
kotachi 0:18d80d7403d3 16 / f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
kotachi 0:18d80d7403d3 17 / and optional writing functions as well. */
kotachi 0:18d80d7403d3 18
kotachi 0:18d80d7403d3 19
kotachi 0:18d80d7403d3 20 #define _FS_MINIMIZE 0
kotachi 0:18d80d7403d3 21 /* This option defines minimization level to remove some basic API functions.
kotachi 0:18d80d7403d3 22 /
kotachi 0:18d80d7403d3 23 / 0: All basic functions are enabled.
kotachi 0:18d80d7403d3 24 / 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_chmod(), f_utime(),
kotachi 0:18d80d7403d3 25 / f_truncate() and f_rename() function are removed.
kotachi 0:18d80d7403d3 26 / 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
kotachi 0:18d80d7403d3 27 / 3: f_lseek() function is removed in addition to 2. */
kotachi 0:18d80d7403d3 28
kotachi 0:18d80d7403d3 29
kotachi 0:18d80d7403d3 30 #define _USE_STRFUNC 0
kotachi 0:18d80d7403d3 31 /* This option switches string functions, f_gets(), f_putc(), f_puts() and
kotachi 0:18d80d7403d3 32 / f_printf().
kotachi 0:18d80d7403d3 33 /
kotachi 0:18d80d7403d3 34 / 0: Disable string functions.
kotachi 0:18d80d7403d3 35 / 1: Enable without LF-CRLF conversion.
kotachi 0:18d80d7403d3 36 / 2: Enable with LF-CRLF conversion. */
kotachi 0:18d80d7403d3 37
kotachi 0:18d80d7403d3 38
kotachi 0:18d80d7403d3 39 #define _USE_FIND 0
kotachi 0:18d80d7403d3 40 /* This option switches filtered directory read feature and related functions,
kotachi 0:18d80d7403d3 41 / f_findfirst() and f_findnext(). (0:Disable or 1:Enable) */
kotachi 0:18d80d7403d3 42
kotachi 0:18d80d7403d3 43
kotachi 0:18d80d7403d3 44 #define _USE_MKFS 1
kotachi 0:18d80d7403d3 45 /* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
kotachi 0:18d80d7403d3 46
kotachi 0:18d80d7403d3 47
kotachi 0:18d80d7403d3 48 #define _USE_FASTSEEK 0
kotachi 0:18d80d7403d3 49 /* This option switches fast seek feature. (0:Disable or 1:Enable) */
kotachi 0:18d80d7403d3 50
kotachi 0:18d80d7403d3 51
kotachi 0:18d80d7403d3 52 #define _USE_LABEL 0
kotachi 0:18d80d7403d3 53 /* This option switches volume label functions, f_getlabel() and f_setlabel().
kotachi 0:18d80d7403d3 54 / (0:Disable or 1:Enable) */
kotachi 0:18d80d7403d3 55
kotachi 0:18d80d7403d3 56
kotachi 0:18d80d7403d3 57 #define _USE_FORWARD 0
kotachi 0:18d80d7403d3 58 /* This option switches f_forward() function. (0:Disable or 1:Enable)
kotachi 0:18d80d7403d3 59 / To enable it, also _FS_TINY need to be set to 1. */
kotachi 0:18d80d7403d3 60
kotachi 0:18d80d7403d3 61
kotachi 0:18d80d7403d3 62 /*---------------------------------------------------------------------------/
kotachi 0:18d80d7403d3 63 / Locale and Namespace Configurations
kotachi 0:18d80d7403d3 64 /---------------------------------------------------------------------------*/
kotachi 0:18d80d7403d3 65
kotachi 0:18d80d7403d3 66 #define _CODE_PAGE 850
kotachi 0:18d80d7403d3 67 /* This option specifies the OEM code page to be used on the target system.
kotachi 0:18d80d7403d3 68 / Incorrect setting of the code page can cause a file open failure.
kotachi 0:18d80d7403d3 69 /
kotachi 0:18d80d7403d3 70 / 1 - ASCII (No extended character. Non-LFN cfg. only)
kotachi 0:18d80d7403d3 71 / 437 - U.S.
kotachi 0:18d80d7403d3 72 / 720 - Arabic
kotachi 0:18d80d7403d3 73 / 737 - Greek
kotachi 0:18d80d7403d3 74 / 771 - KBL
kotachi 0:18d80d7403d3 75 / 775 - Baltic
kotachi 0:18d80d7403d3 76 / 850 - Latin 1
kotachi 0:18d80d7403d3 77 / 852 - Latin 2
kotachi 0:18d80d7403d3 78 / 855 - Cyrillic
kotachi 0:18d80d7403d3 79 / 857 - Turkish
kotachi 0:18d80d7403d3 80 / 860 - Portuguese
kotachi 0:18d80d7403d3 81 / 861 - Icelandic
kotachi 0:18d80d7403d3 82 / 862 - Hebrew
kotachi 0:18d80d7403d3 83 / 863 - Canadian French
kotachi 0:18d80d7403d3 84 / 864 - Arabic
kotachi 0:18d80d7403d3 85 / 865 - Nordic
kotachi 0:18d80d7403d3 86 / 866 - Russian
kotachi 0:18d80d7403d3 87 / 869 - Greek 2
kotachi 0:18d80d7403d3 88 / 932 - Japanese (DBCS)
kotachi 0:18d80d7403d3 89 / 936 - Simplified Chinese (DBCS)
kotachi 0:18d80d7403d3 90 / 949 - Korean (DBCS)
kotachi 0:18d80d7403d3 91 / 950 - Traditional Chinese (DBCS)
kotachi 0:18d80d7403d3 92 */
kotachi 0:18d80d7403d3 93
kotachi 0:18d80d7403d3 94
kotachi 0:18d80d7403d3 95 #define _USE_LFN 1
kotachi 0:18d80d7403d3 96 #define _MAX_LFN 255
kotachi 0:18d80d7403d3 97 /* The _USE_LFN option switches the LFN feature.
kotachi 0:18d80d7403d3 98 /
kotachi 0:18d80d7403d3 99 / 0: Disable LFN feature. _MAX_LFN has no effect.
kotachi 0:18d80d7403d3 100 / 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
kotachi 0:18d80d7403d3 101 / 2: Enable LFN with dynamic working buffer on the STACK.
kotachi 0:18d80d7403d3 102 / 3: Enable LFN with dynamic working buffer on the HEAP.
kotachi 0:18d80d7403d3 103 /
kotachi 0:18d80d7403d3 104 / When enable the LFN feature, Unicode handling functions (option/unicode.c) must
kotachi 0:18d80d7403d3 105 / be added to the project. The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes.
kotachi 0:18d80d7403d3 106 / When use stack for the working buffer, take care on stack overflow. When use heap
kotachi 0:18d80d7403d3 107 / memory for the working buffer, memory management functions, ff_memalloc() and
kotachi 0:18d80d7403d3 108 / ff_memfree(), must be added to the project. */
kotachi 0:18d80d7403d3 109
kotachi 0:18d80d7403d3 110
kotachi 0:18d80d7403d3 111 #define _LFN_UNICODE 0
kotachi 0:18d80d7403d3 112 /* This option switches character encoding on the API. (0:ANSI/OEM or 1:Unicode)
kotachi 0:18d80d7403d3 113 / To use Unicode string for the path name, enable LFN feature and set _LFN_UNICODE
kotachi 0:18d80d7403d3 114 / to 1. This option also affects behavior of string I/O functions. */
kotachi 0:18d80d7403d3 115
kotachi 0:18d80d7403d3 116
kotachi 0:18d80d7403d3 117 #define _STRF_ENCODE 3
kotachi 0:18d80d7403d3 118 /* When _LFN_UNICODE is 1, this option selects the character encoding on the file to
kotachi 0:18d80d7403d3 119 / be read/written via string I/O functions, f_gets(), f_putc(), f_puts and f_printf().
kotachi 0:18d80d7403d3 120 /
kotachi 0:18d80d7403d3 121 / 0: ANSI/OEM
kotachi 0:18d80d7403d3 122 / 1: UTF-16LE
kotachi 0:18d80d7403d3 123 / 2: UTF-16BE
kotachi 0:18d80d7403d3 124 / 3: UTF-8
kotachi 0:18d80d7403d3 125 /
kotachi 0:18d80d7403d3 126 / When _LFN_UNICODE is 0, this option has no effect. */
kotachi 0:18d80d7403d3 127
kotachi 0:18d80d7403d3 128
kotachi 0:18d80d7403d3 129 #define _FS_RPATH 0
kotachi 0:18d80d7403d3 130 /* This option configures relative path feature.
kotachi 0:18d80d7403d3 131 /
kotachi 0:18d80d7403d3 132 / 0: Disable relative path feature and remove related functions.
kotachi 0:18d80d7403d3 133 / 1: Enable relative path feature. f_chdir() and f_chdrive() are available.
kotachi 0:18d80d7403d3 134 / 2: f_getcwd() function is available in addition to 1.
kotachi 0:18d80d7403d3 135 /
kotachi 0:18d80d7403d3 136 / Note that directory items read via f_readdir() are affected by this option. */
kotachi 0:18d80d7403d3 137
kotachi 0:18d80d7403d3 138
kotachi 0:18d80d7403d3 139 /*---------------------------------------------------------------------------/
kotachi 0:18d80d7403d3 140 / Drive/Volume Configurations
kotachi 0:18d80d7403d3 141 /---------------------------------------------------------------------------*/
kotachi 0:18d80d7403d3 142
kotachi 0:18d80d7403d3 143 #define _VOLUMES 1
kotachi 0:18d80d7403d3 144 /* Number of volumes (logical drives) to be used. */
kotachi 0:18d80d7403d3 145
kotachi 0:18d80d7403d3 146
kotachi 0:18d80d7403d3 147 #define _STR_VOLUME_ID 0
kotachi 0:18d80d7403d3 148 #define _VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3"
kotachi 0:18d80d7403d3 149 /* _STR_VOLUME_ID option switches string volume ID feature.
kotachi 0:18d80d7403d3 150 / When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
kotachi 0:18d80d7403d3 151 / number in the path name. _VOLUME_STRS defines the drive ID strings for each
kotachi 0:18d80d7403d3 152 / logical drives. Number of items must be equal to _VOLUMES. Valid characters for
kotachi 0:18d80d7403d3 153 / the drive ID strings are: A-Z and 0-9. */
kotachi 0:18d80d7403d3 154
kotachi 0:18d80d7403d3 155
kotachi 0:18d80d7403d3 156 #define _MULTI_PARTITION 0
kotachi 0:18d80d7403d3 157 /* This option switches multi-partition feature. By default (0), each logical drive
kotachi 0:18d80d7403d3 158 / number is bound to the same physical drive number and only an FAT volume found on
kotachi 0:18d80d7403d3 159 / the physical drive will be mounted. When multi-partition feature is enabled (1),
kotachi 0:18d80d7403d3 160 / each logical drive number is bound to arbitrary physical drive and partition
kotachi 0:18d80d7403d3 161 / listed in the VolToPart[]. Also f_fdisk() funciton will be available. */
kotachi 0:18d80d7403d3 162
kotachi 0:18d80d7403d3 163
kotachi 0:18d80d7403d3 164 #define _MIN_SS 512
kotachi 0:18d80d7403d3 165 #define _MAX_SS 512
kotachi 0:18d80d7403d3 166 /* These options configure the range of sector size to be supported. (512, 1024,
kotachi 0:18d80d7403d3 167 / 2048 or 4096) Always set both 512 for most systems, all type of memory cards and
kotachi 0:18d80d7403d3 168 / harddisk. But a larger value may be required for on-board flash memory and some
kotachi 0:18d80d7403d3 169 / type of optical media. When _MAX_SS is larger than _MIN_SS, FatFs is configured
kotachi 0:18d80d7403d3 170 / to variable sector size and GET_SECTOR_SIZE command must be implemented to the
kotachi 0:18d80d7403d3 171 / disk_ioctl() function. */
kotachi 0:18d80d7403d3 172
kotachi 0:18d80d7403d3 173
kotachi 0:18d80d7403d3 174 #define _USE_TRIM 0
kotachi 0:18d80d7403d3 175 /* This option switches ATA-TRIM feature. (0:Disable or 1:Enable)
kotachi 0:18d80d7403d3 176 / To enable Trim feature, also CTRL_TRIM command should be implemented to the
kotachi 0:18d80d7403d3 177 / disk_ioctl() function. */
kotachi 0:18d80d7403d3 178
kotachi 0:18d80d7403d3 179
kotachi 0:18d80d7403d3 180 #define _FS_NOFSINFO 0
kotachi 0:18d80d7403d3 181 /* If you need to know correct free space on the FAT32 volume, set bit 0 of this
kotachi 0:18d80d7403d3 182 / option, and f_getfree() function at first time after volume mount will force
kotachi 0:18d80d7403d3 183 / a full FAT scan. Bit 1 controls the use of last allocated cluster number.
kotachi 0:18d80d7403d3 184 /
kotachi 0:18d80d7403d3 185 / bit0=0: Use free cluster count in the FSINFO if available.
kotachi 0:18d80d7403d3 186 / bit0=1: Do not trust free cluster count in the FSINFO.
kotachi 0:18d80d7403d3 187 / bit1=0: Use last allocated cluster number in the FSINFO if available.
kotachi 0:18d80d7403d3 188 / bit1=1: Do not trust last allocated cluster number in the FSINFO.
kotachi 0:18d80d7403d3 189 */
kotachi 0:18d80d7403d3 190
kotachi 0:18d80d7403d3 191
kotachi 0:18d80d7403d3 192
kotachi 0:18d80d7403d3 193 /*---------------------------------------------------------------------------/
kotachi 0:18d80d7403d3 194 / System Configurations
kotachi 0:18d80d7403d3 195 /---------------------------------------------------------------------------*/
kotachi 0:18d80d7403d3 196
kotachi 0:18d80d7403d3 197 #define _FS_TINY 0
kotachi 0:18d80d7403d3 198 /* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
kotachi 0:18d80d7403d3 199 / At the tiny configuration, size of the file object (FIL) is reduced _MAX_SS
kotachi 0:18d80d7403d3 200 / bytes. Instead of private sector buffer eliminated from the file object,
kotachi 0:18d80d7403d3 201 / common sector buffer in the file system object (FATFS) is used for the file
kotachi 0:18d80d7403d3 202 / data transfer. */
kotachi 0:18d80d7403d3 203
kotachi 0:18d80d7403d3 204
kotachi 0:18d80d7403d3 205 #define _FS_NORTC 0
kotachi 0:18d80d7403d3 206 #define _NORTC_MON 1
kotachi 0:18d80d7403d3 207 #define _NORTC_MDAY 1
kotachi 0:18d80d7403d3 208 #define _NORTC_YEAR 2015
kotachi 0:18d80d7403d3 209 /* The _FS_NORTC option switches timestamp feature. If the system does not have
kotachi 0:18d80d7403d3 210 / an RTC function or valid timestamp is not needed, set _FS_NORTC to 1 to disable
kotachi 0:18d80d7403d3 211 / the timestamp feature. All objects modified by FatFs will have a fixed timestamp
kotachi 0:18d80d7403d3 212 / defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR.
kotachi 0:18d80d7403d3 213 / When timestamp feature is enabled (_FS_NORTC == 0), get_fattime() function need
kotachi 0:18d80d7403d3 214 / to be added to the project to read current time form RTC. _NORTC_MON,
kotachi 0:18d80d7403d3 215 / _NORTC_MDAY and _NORTC_YEAR have no effect.
kotachi 0:18d80d7403d3 216 / These options have no effect at read-only configuration (_FS_READONLY == 1). */
kotachi 0:18d80d7403d3 217
kotachi 0:18d80d7403d3 218
kotachi 0:18d80d7403d3 219 #define _FS_LOCK 0
kotachi 0:18d80d7403d3 220 /* The _FS_LOCK option switches file lock feature to control duplicated file open
kotachi 0:18d80d7403d3 221 / and illegal operation to open objects. This option must be 0 when _FS_READONLY
kotachi 0:18d80d7403d3 222 / is 1.
kotachi 0:18d80d7403d3 223 /
kotachi 0:18d80d7403d3 224 / 0: Disable file lock feature. To avoid volume corruption, application program
kotachi 0:18d80d7403d3 225 / should avoid illegal open, remove and rename to the open objects.
kotachi 0:18d80d7403d3 226 / >0: Enable file lock feature. The value defines how many files/sub-directories
kotachi 0:18d80d7403d3 227 / can be opened simultaneously under file lock control. Note that the file
kotachi 0:18d80d7403d3 228 / lock feature is independent of re-entrancy. */
kotachi 0:18d80d7403d3 229
kotachi 0:18d80d7403d3 230
kotachi 0:18d80d7403d3 231 #define _FS_REENTRANT 0
kotachi 0:18d80d7403d3 232 #define _FS_TIMEOUT 1000
kotachi 0:18d80d7403d3 233 #define _SYNC_t HANDLE
kotachi 0:18d80d7403d3 234 /* The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs
kotachi 0:18d80d7403d3 235 / module itself. Note that regardless of this option, file access to different
kotachi 0:18d80d7403d3 236 / volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
kotachi 0:18d80d7403d3 237 / and f_fdisk() function, are always not re-entrant. Only file/directory access
kotachi 0:18d80d7403d3 238 / to the same volume is under control of this feature.
kotachi 0:18d80d7403d3 239 /
kotachi 0:18d80d7403d3 240 / 0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect.
kotachi 0:18d80d7403d3 241 / 1: Enable re-entrancy. Also user provided synchronization handlers,
kotachi 0:18d80d7403d3 242 / ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
kotachi 0:18d80d7403d3 243 / function, must be added to the project. Samples are available in
kotachi 0:18d80d7403d3 244 / option/syscall.c.
kotachi 0:18d80d7403d3 245 /
kotachi 0:18d80d7403d3 246 / The _FS_TIMEOUT defines timeout period in unit of time tick.
kotachi 0:18d80d7403d3 247 / The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
kotachi 0:18d80d7403d3 248 / SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be
kotachi 0:18d80d7403d3 249 / included somewhere in the scope of ff.c. */
kotachi 0:18d80d7403d3 250
kotachi 0:18d80d7403d3 251
kotachi 0:18d80d7403d3 252 #define _WORD_ACCESS 0
kotachi 0:18d80d7403d3 253 /* The _WORD_ACCESS option is an only platform dependent option. It defines
kotachi 0:18d80d7403d3 254 / which access method is used to the word data on the FAT volume.
kotachi 0:18d80d7403d3 255 /
kotachi 0:18d80d7403d3 256 / 0: Byte-by-byte access. Always compatible with all platforms.
kotachi 0:18d80d7403d3 257 / 1: Word access. Do not choose this unless under both the following conditions.
kotachi 0:18d80d7403d3 258 /
kotachi 0:18d80d7403d3 259 / * Address misaligned memory access is always allowed to ALL instructions.
kotachi 0:18d80d7403d3 260 / * Byte order on the memory is little-endian.
kotachi 0:18d80d7403d3 261 /
kotachi 0:18d80d7403d3 262 / If it is the case, _WORD_ACCESS can also be set to 1 to reduce code size.
kotachi 0:18d80d7403d3 263 / Following table shows allowable settings of some type of processors.
kotachi 0:18d80d7403d3 264 /
kotachi 0:18d80d7403d3 265 / ARM7TDMI 0 *2 ColdFire 0 *1 V850E 0 *2
kotachi 0:18d80d7403d3 266 / Cortex-M3 0 *3 Z80 0/1 V850ES 0/1
kotachi 0:18d80d7403d3 267 / Cortex-M0 0 *2 x86 0/1 TLCS-870 0/1
kotachi 0:18d80d7403d3 268 / AVR 0/1 RX600(LE) 0/1 TLCS-900 0/1
kotachi 0:18d80d7403d3 269 / AVR32 0 *1 RL78 0 *2 R32C 0 *2
kotachi 0:18d80d7403d3 270 / PIC18 0/1 SH-2 0 *1 M16C 0/1
kotachi 0:18d80d7403d3 271 / PIC24 0 *2 H8S 0 *1 MSP430 0 *2
kotachi 0:18d80d7403d3 272 / PIC32 0 *1 H8/300H 0 *1 8051 0/1
kotachi 0:18d80d7403d3 273 /
kotachi 0:18d80d7403d3 274 / *1:Big-endian.
kotachi 0:18d80d7403d3 275 / *2:Unaligned memory access is not supported.
kotachi 0:18d80d7403d3 276 / *3:Some compilers generate LDM/STM for mem_cpy function.
kotachi 0:18d80d7403d3 277 */
kotachi 0:18d80d7403d3 278
kotachi 0:18d80d7403d3 279 #define FLUSH_ON_NEW_CLUSTER 0 /* Sync the file on every new cluster */
kotachi 0:18d80d7403d3 280 #define FLUSH_ON_NEW_SECTOR 1 /* Sync the file on every new sector */
kotachi 0:18d80d7403d3 281 /* Only one of these two defines needs to be set to 1. If both are set to 0
kotachi 0:18d80d7403d3 282 the file is only sync when closed.
kotachi 0:18d80d7403d3 283 Clusters are group of sectors (eg: 8 sectors). Flushing on new cluster means
kotachi 0:18d80d7403d3 284 it would be less often than flushing on new sector. Sectors are generally
kotachi 0:18d80d7403d3 285 512 Bytes long. */