00001 /* ---------------------------------------------------------------------------- 00002 * ATMEL Microcontroller Software Support 00003 * ---------------------------------------------------------------------------- 00004 * Copyright (c) 2008, Atmel Corporation 00005 * 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions are met: 00010 * 00011 * - Redistributions of source code must retain the above copyright notice, 00012 * this list of conditions and the disclaimer below. 00013 * 00014 * Atmel's name may not be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR 00018 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00020 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, 00021 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00022 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 00023 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00024 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00025 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00026 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00027 * ---------------------------------------------------------------------------- 00028 */ 00029 00030 #ifndef FATFS_CONFIG_H 00031 #define FATFS_CONFIG_H 00032 #include "integer.h" 00033 00034 /*-----------------------------------------------------------------------*/ 00035 /* Correspondence between physical drive number and physical drive. */ 00036 /*-----------------------------------------------------------------------*/ 00037 00038 00039 #define DRV_MMC 0 00040 #define DRV_ATA 1 00041 #define DRV_USB 2 00042 #define DRV_SDRAM 3 00043 #define DRV_NAND 5 00044 00045 00046 #define SECTOR_SIZE_DEFAULT 512 00047 #define SECTOR_SIZE_SDRAM 512 00048 #define SECTOR_SIZE_SDCARD 512 00049 00050 /*---------------------------------------------------------------------------/ 00051 / FatFs - FAT file system module configuration file R0.08 (C)ChaN, 2010 00052 /----------------------------------------------------------------------------*/ 00053 00054 /*---------------------------------------------------------------------------/ 00055 / FatFs Configuration Options 00056 / 00057 / CAUTION! Do not forget to make clean the project after any changes to 00058 / the configuration options. 00059 / 00060 /----------------------------------------------------------------------------*/ 00061 #define _FFCONF 8051 /* Revision ID */ 00062 00063 /*---------------------------------------------------------------------------/ 00064 / Function and Buffer Configurations 00065 /----------------------------------------------------------------------------*/ 00066 00067 #define _FS_TINY 0 /* 0:Normal or 1:Tiny */ 00068 /* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system 00069 / object instead of the sector buffer in the individual file object for file 00070 / data transfer. This reduces memory consumption 512 bytes each file object. */ 00071 00072 #if _FS_TINY != 1 00073 #define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */ 00074 /* Setting _FS_READONLY to 1 defines read only configuration. This removes 00075 / writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename, 00076 / f_truncate and useless f_getfree. */ 00077 #else 00078 #define _FS_READONLY 1 00079 /* Setting _FS_READONLY to 1 defines read only configuration. This removes 00080 / writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename, 00081 / f_truncate and useless f_getfree. */ 00082 #endif 00083 00084 #define _FS_MINIMIZE 0 /* 0, 1, 2 or 3 */ 00085 /* The _FS_MINIMIZE option defines minimization level to remove some functions. 00086 / 00087 / 0: Full function. 00088 / 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename 00089 / are removed. 00090 / 2: f_opendir and f_readdir are removed in addition to level 1. 00091 / 3: f_lseek is removed in addition to level 2. */ 00092 00093 00094 #define _USE_STRFUNC 0 /* 0:Disable or 1/2:Enable */ 00095 /* To enable string functions, set _USE_STRFUNC to 1 or 2. */ 00096 00097 00098 #define _USE_MKFS 1 /* 0:Disable or 1:Enable */ 00099 /* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */ 00100 00101 00102 #define _USE_FORWARD 0 /* 0:Disable or 1:Enable */ 00103 /* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */ 00104 00105 00106 #define _USE_FASTSEEK 0 /* 0:Disable or 1:Enable */ 00107 /* To enable fast seek feature, set _USE_FASTSEEK to 1. */ 00108 00109 00110 00111 /*---------------------------------------------------------------------------/ 00112 / Locale and Namespace Configurations 00113 /----------------------------------------------------------------------------*/ 00114 00115 #define _CODE_PAGE 850 00116 /* The _CODE_PAGE specifies the OEM code page to be used on the target system. 00117 / Incorrect setting of the code page can cause a file open failure. 00118 / 00119 / 932 - Japanese Shift-JIS (DBCS, OEM, Windows) 00120 / 936 - Simplified Chinese GBK (DBCS, OEM, Windows) 00121 / 949 - Korean (DBCS, OEM, Windows) 00122 / 950 - Traditional Chinese Big5 (DBCS, OEM, Windows) 00123 / 1250 - Central Europe (Windows) 00124 / 1251 - Cyrillic (Windows) 00125 / 1252 - Latin 1 (Windows) 00126 / 1253 - Greek (Windows) 00127 / 1254 - Turkish (Windows) 00128 / 1255 - Hebrew (Windows) 00129 / 1256 - Arabic (Windows) 00130 / 1257 - Baltic (Windows) 00131 / 1258 - Vietnam (OEM, Windows) 00132 / 437 - U.S. (OEM) 00133 / 720 - Arabic (OEM) 00134 / 737 - Greek (OEM) 00135 / 775 - Baltic (OEM) 00136 / 850 - Multilingual Latin 1 (OEM) 00137 / 858 - Multilingual Latin 1 + Euro (OEM) 00138 / 852 - Latin 2 (OEM) 00139 / 855 - Cyrillic (OEM) 00140 / 866 - Russian (OEM) 00141 / 857 - Turkish (OEM) 00142 / 862 - Hebrew (OEM) 00143 / 874 - Thai (OEM, Windows) 00144 / 1 - ASCII only (Valid for non LFN cfg.) 00145 */ 00146 00147 00148 #define _USE_LFN 2 /* 0 to 3 */ 00149 #define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */ 00150 /* The _USE_LFN option switches the LFN support. 00151 / 00152 / 0: Disable LFN. _MAX_LFN and _LFN_UNICODE have no effect. 00153 / 1: Enable LFN with static working buffer on the bss. NOT REENTRANT. 00154 / 2: Enable LFN with dynamic working buffer on the STACK. 00155 / 3: Enable LFN with dynamic working buffer on the HEAP. 00156 / 00157 / The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. When enable LFN, 00158 / Unicode handling functions ff_convert() and ff_wtoupper() must be added 00159 / to the project. When enable to use heap, memory control functions 00160 / ff_memalloc() and ff_memfree() must be added to the project. */ 00161 00162 00163 #define _LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */ 00164 /* To switch the character code set on FatFs API to Unicode, 00165 / enable LFN feature and set _LFN_UNICODE to 1. */ 00166 00167 00168 #define _FS_RPATH 0 /* 0:Disable or 1:Enable */ 00169 /* When _FS_RPATH is set to 1, relative path feature is enabled and f_chdir, 00170 / f_chdrive function are available. 00171 / Note that output of the f_readdir function is affected by this option. */ 00172 00173 00174 00175 /*---------------------------------------------------------------------------/ 00176 / Physical Drive Configurations 00177 /----------------------------------------------------------------------------*/ 00178 00179 #define _VOLUMES 1 00180 /* Number of volumes (logical drives) to be used. */ 00181 00182 #define _MIN_SS 512 00183 #define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */ 00184 /* Maximum sector size to be handled. 00185 / Always set 512 for memory card and hard disk but a larger value may be 00186 / required for floppy disk (512/1024) and optical disk (512/2048). 00187 / When _MAX_SS is larger than 512, GET_SECTOR_SIZE command must be implemented 00188 / to the disk_ioctl function. */ 00189 00190 #define _USE_ERASE 0 /* 0:Disable or 1:Enable */ 00191 /* To enable sector erase feature, set _USE_ERASE to 1. Also CTRL_ERASE_SECTOR command 00192 / should be added to the disk_ioctl() function. */ 00193 00194 00195 #define _FS_NOFSINFO 0 /* 0 to 3 */ 00196 /* If you need to know correct free space on the FAT32 volume, set bit 0 of this option 00197 / and f_getfree() function at first time after volume mount will force a full FAT scan. 00198 / Bit 1 controls the last allocated cluster number as bit 0. 00199 / 00200 / bit0=0: Use free cluster count in the FSINFO if available. 00201 / bit0=1: Do not trust free cluster count in the FSINFO. 00202 / bit1=0: Use last allocated cluster number in the FSINFO if available. 00203 / bit1=1: Do not trust last allocated cluster number in the FSINFO. 00204 */ 00205 00206 #define _STR_VOLUME_ID 0 /* 0:Use only 0-9 for drive ID, 1:Use strings for drive ID */ 00207 #define _VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3" 00208 /* When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive 00209 / number in the path name. _VOLUME_STRS defines the drive ID strings for each logical 00210 / drives. Number of items must be equal to _VOLUMES. Valid characters for the drive ID 00211 / strings are: 0-9 and A-Z. */ 00212 00213 #define _MULTI_PARTITION 0 /* 0:Single parition or 1:Multiple partition */ 00214 /* When _MULTI_PARTITION is set to 0, each volume is bound to the same physical 00215 / drive number and can mount only first primary partition. When it is set to 1, 00216 / each volume is tied to the partitions listed in Drives[]. */ 00217 00218 #define _USE_ERASE 0 /* 0:Disable or 1:Enable */ 00219 /* To enable sector erase feature, set _USE_ERASE to 1. CTRL_ERASE_SECTOR command 00220 / should be added to the disk_ioctl function. */ 00221 00222 00223 /*---------------------------------------------------------------------------/ 00224 / System Configurations 00225 /----------------------------------------------------------------------------*/ 00226 00227 00228 #define _FS_LOCK 0 /* 0:Disable or >=1:Enable */ 00229 /* To enable file lock control feature, set _FS_LOCK to non-zero value. 00230 / The value defines how many files/sub-directories can be opened simultaneously 00231 / with file lock control. This feature uses bss _FS_LOCK * 12 bytes. */ 00232 00233 #define _WORD_ACCESS 0 /* 0 or 1 */ 00234 /* Set 0 first and it is always compatible with all platforms. The _WORD_ACCESS 00235 / option defines which access method is used to the word data on the FAT volume. 00236 / 00237 / 0: Byte-by-byte access. 00238 / 1: Word access. Do not choose this unless following condition is met. 00239 / 00240 / When the byte order on the memory is big-endian or address miss-aligned word 00241 / access results incorrect behavior, the _WORD_ACCESS must be set to 0. 00242 / If it is not the case, the value can also be set to 1 to improve the 00243 / performance and code size. */ 00244 00245 00246 #define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */ 00247 #define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */ 00248 #define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */ 00249 /* Include a header file here to define O/S system calls */ 00250 /* #include <windows.h>, <ucos_ii.h.h>, <semphr.h> or ohters. */ 00251 00252 /* The _FS_REENTRANT option switches the reentrancy of the FatFs module. 00253 / 00254 / 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect. 00255 / 1: Enable reentrancy. Also user provided synchronization handlers, 00256 / ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj 00257 / function must be added to the project. */ 00258 00259 00260 #define _FS_SHARE 0 /* 0:Disable or >=1:Enable */ 00261 /* To enable file sharing feature, set _FS_SHARE to >= 1 and also user 00262 provided memory handlers, ff_memalloc and ff_memfree function must be 00263 added to the project. The value defines number of files can be opened 00264 per volume. */ 00265 00266 00267 #include "diskio.h" 00268 #include "ff.h" 00269 00270 #endif /* FATFS_CONFIG_H */