SD Card Interface class. Log raw data bytes to memory addresses of your choice, or format the card and use the FAT file system to write files.

Dependencies:   mbed

Committer:
Blaze513
Date:
Sun Jan 16 09:20:30 2011 +0000
Revision:
6:ddf09d859ed7
Parent:
5:d85e20b6b904
gave access to Initialization function to FAT module.
added disk formatting functionality.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Blaze513 6:ddf09d859ed7 1 //Modified by Thomas Hamilton, Copyright 2010
Blaze513 6:ddf09d859ed7 2
Blaze513 6:ddf09d859ed7 3 /*---------------------------------------------------------------------------/
Blaze513 6:ddf09d859ed7 4 / FatFs - FAT file system module configuration file R0.08 (C)ChaN, 2010 /
Blaze513 6:ddf09d859ed7 5 /----------------------------------------------------------------------------/
Blaze513 6:ddf09d859ed7 6 /
Blaze513 6:ddf09d859ed7 7 / CAUTION! Do not forget to make clean the project after any changes to
Blaze513 6:ddf09d859ed7 8 / the configuration options.
Blaze513 6:ddf09d859ed7 9 /
Blaze513 6:ddf09d859ed7 10 /---------------------------------------------------------------------------*/
Blaze513 6:ddf09d859ed7 11
Blaze513 6:ddf09d859ed7 12 #ifndef _FFCONF
Blaze513 6:ddf09d859ed7 13 #define _FFCONF 8085 /* Revision ID */
Blaze513 6:ddf09d859ed7 14
Blaze513 6:ddf09d859ed7 15 /*---------------------------------------------------------------------------/
Blaze513 6:ddf09d859ed7 16 / Function and Buffer Configurations /
Blaze513 6:ddf09d859ed7 17 /---------------------------------------------------------------------------*/
Blaze513 6:ddf09d859ed7 18
Blaze513 6:ddf09d859ed7 19 #define _FS_TINY 0 /* 0:Normal or 1:Tiny */
Blaze513 6:ddf09d859ed7 20 /* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
Blaze513 6:ddf09d859ed7 21 / object instead of the sector buffer in the individual file object for file
Blaze513 6:ddf09d859ed7 22 / data transfer. This reduces memory consumption 512 bytes each file object. */
Blaze513 6:ddf09d859ed7 23
Blaze513 6:ddf09d859ed7 24 #define _FS_READONLY 0 /* 0:Read/Write or 1:Read only */
Blaze513 6:ddf09d859ed7 25 /* Setting _FS_READONLY to 1 defines read only configuration. This removes
Blaze513 6:ddf09d859ed7 26 / writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
Blaze513 6:ddf09d859ed7 27 / f_truncate and useless f_getfree. */
Blaze513 6:ddf09d859ed7 28
Blaze513 6:ddf09d859ed7 29 #define _FS_MINIMIZE 0 /* 0, 1, 2 or 3 */
Blaze513 6:ddf09d859ed7 30 /* The _FS_MINIMIZE option defines minimization level to remove some functions.
Blaze513 6:ddf09d859ed7 31 /
Blaze513 6:ddf09d859ed7 32 / 0: Full function.
Blaze513 6:ddf09d859ed7 33 / 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
Blaze513 6:ddf09d859ed7 34 / are removed.
Blaze513 6:ddf09d859ed7 35 / 2: f_opendir and f_readdir are removed in addition to level 1.
Blaze513 6:ddf09d859ed7 36 / 3: f_lseek is removed in addition to level 2. */
Blaze513 6:ddf09d859ed7 37
Blaze513 6:ddf09d859ed7 38 #define _USE_STRFUNC 2 /* 0:Disable or 1/2:Enable */
Blaze513 6:ddf09d859ed7 39 /* To enable string functions, set _USE_STRFUNC to 1 or 2. */
Blaze513 6:ddf09d859ed7 40
Blaze513 6:ddf09d859ed7 41 #define _USE_MKFS 1 /* 0:Disable or 1:Enable */
Blaze513 6:ddf09d859ed7 42 /* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
Blaze513 6:ddf09d859ed7 43
Blaze513 6:ddf09d859ed7 44 #define _USE_FORWARD 0 /* 0:Disable or 1:Enable */
Blaze513 6:ddf09d859ed7 45 /* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
Blaze513 6:ddf09d859ed7 46
Blaze513 6:ddf09d859ed7 47 #define _USE_FASTSEEK 0 /* 0:Disable or 1:Enable */
Blaze513 6:ddf09d859ed7 48 /* To enable fast seek feature, set _USE_FASTSEEK to 1. */
Blaze513 6:ddf09d859ed7 49
Blaze513 6:ddf09d859ed7 50 /*---------------------------------------------------------------------------/
Blaze513 6:ddf09d859ed7 51 / Locale and Namespace Configurations
Blaze513 6:ddf09d859ed7 52 /----------------------------------------------------------------------------*/
Blaze513 6:ddf09d859ed7 53
Blaze513 6:ddf09d859ed7 54 #define _CODE_PAGE 1
Blaze513 6:ddf09d859ed7 55 /* The _CODE_PAGE specifies the OEM code page to be used on the target system.
Blaze513 6:ddf09d859ed7 56 / Incorrect setting of the code page can cause a file open failure.
Blaze513 6:ddf09d859ed7 57 /
Blaze513 6:ddf09d859ed7 58 / 932 - Japanese Shift-JIS (DBCS, OEM, Windows)
Blaze513 6:ddf09d859ed7 59 / 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
Blaze513 6:ddf09d859ed7 60 / 949 - Korean (DBCS, OEM, Windows)
Blaze513 6:ddf09d859ed7 61 / 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
Blaze513 6:ddf09d859ed7 62 / 1250 - Central Europe (Windows)
Blaze513 6:ddf09d859ed7 63 / 1251 - Cyrillic (Windows)
Blaze513 6:ddf09d859ed7 64 / 1252 - Latin 1 (Windows)
Blaze513 6:ddf09d859ed7 65 / 1253 - Greek (Windows)
Blaze513 6:ddf09d859ed7 66 / 1254 - Turkish (Windows)
Blaze513 6:ddf09d859ed7 67 / 1255 - Hebrew (Windows)
Blaze513 6:ddf09d859ed7 68 / 1256 - Arabic (Windows)
Blaze513 6:ddf09d859ed7 69 / 1257 - Baltic (Windows)
Blaze513 6:ddf09d859ed7 70 / 1258 - Vietnam (OEM, Windows)
Blaze513 6:ddf09d859ed7 71 / 437 - U.S. (OEM)
Blaze513 6:ddf09d859ed7 72 / 720 - Arabic (OEM)
Blaze513 6:ddf09d859ed7 73 / 737 - Greek (OEM)
Blaze513 6:ddf09d859ed7 74 / 775 - Baltic (OEM)
Blaze513 6:ddf09d859ed7 75 / 850 - Multilingual Latin 1 (OEM)
Blaze513 6:ddf09d859ed7 76 / 858 - Multilingual Latin 1 + Euro (OEM)
Blaze513 6:ddf09d859ed7 77 / 852 - Latin 2 (OEM)
Blaze513 6:ddf09d859ed7 78 / 855 - Cyrillic (OEM)
Blaze513 6:ddf09d859ed7 79 / 866 - Russian (OEM)
Blaze513 6:ddf09d859ed7 80 / 857 - Turkish (OEM)
Blaze513 6:ddf09d859ed7 81 / 862 - Hebrew (OEM)
Blaze513 6:ddf09d859ed7 82 / 874 - Thai (OEM, Windows)
Blaze513 6:ddf09d859ed7 83 / 1 - ASCII only (Valid for non LFN cfg.) */
Blaze513 6:ddf09d859ed7 84
Blaze513 6:ddf09d859ed7 85 #define _USE_LFN 0 /* 0 to 3 */
Blaze513 6:ddf09d859ed7 86 #define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
Blaze513 6:ddf09d859ed7 87 /* The _USE_LFN option switches the LFN support.
Blaze513 6:ddf09d859ed7 88 /
Blaze513 6:ddf09d859ed7 89 / 0: Disable LFN. _MAX_LFN and _LFN_UNICODE have no effect.
Blaze513 6:ddf09d859ed7 90 / 1: Enable LFN with static working buffer on the bss. NOT REENTRANT.
Blaze513 6:ddf09d859ed7 91 / 2: Enable LFN with dynamic working buffer on the STACK.
Blaze513 6:ddf09d859ed7 92 / 3: Enable LFN with dynamic working buffer on the HEAP.
Blaze513 6:ddf09d859ed7 93 /
Blaze513 6:ddf09d859ed7 94 / The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes. When enable LFN,
Blaze513 6:ddf09d859ed7 95 / Unicode handling functions ff_convert() and ff_wtoupper() must be added
Blaze513 6:ddf09d859ed7 96 / to the project. When enable to use heap, memory control functions
Blaze513 6:ddf09d859ed7 97 / ff_memalloc() and ff_memfree() must be added to the project. */
Blaze513 6:ddf09d859ed7 98
Blaze513 6:ddf09d859ed7 99 #define _LFN_UNICODE 0 /* 0:ANSI/OEM or 1:Unicode */
Blaze513 6:ddf09d859ed7 100 /* To switch the character code set on FatFs API to Unicode,
Blaze513 6:ddf09d859ed7 101 / enable LFN feature and set _LFN_UNICODE to 1. */
Blaze513 6:ddf09d859ed7 102
Blaze513 6:ddf09d859ed7 103 #define _FS_RPATH 0 /* 0:Disable or 1:Enable */
Blaze513 6:ddf09d859ed7 104 /* When _FS_RPATH is set to 1, relative path feature is enabled and f_chdir,
Blaze513 6:ddf09d859ed7 105 / f_chdrive function are available.
Blaze513 6:ddf09d859ed7 106 / Note that output of the f_readdir fnction is affected by this option. */
Blaze513 6:ddf09d859ed7 107
Blaze513 6:ddf09d859ed7 108 /*---------------------------------------------------------------------------/
Blaze513 6:ddf09d859ed7 109 / Physical Drive Configurations
Blaze513 6:ddf09d859ed7 110 /----------------------------------------------------------------------------*/
Blaze513 6:ddf09d859ed7 111
Blaze513 6:ddf09d859ed7 112 #define _DRIVES 7
Blaze513 6:ddf09d859ed7 113 /* Number of volumes (logical drives) to be used. */
Blaze513 6:ddf09d859ed7 114
Blaze513 6:ddf09d859ed7 115 #define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
Blaze513 6:ddf09d859ed7 116 /* Maximum sector size to be handled.
Blaze513 6:ddf09d859ed7 117 / Always set 512 for memory card and hard disk but a larger value may be
Blaze513 6:ddf09d859ed7 118 / required for floppy disk (512/1024) and optical disk (512/2048).
Blaze513 6:ddf09d859ed7 119 / When _MAX_SS is larger than 512, GET_SECTOR_SIZE command must be implememted
Blaze513 6:ddf09d859ed7 120 / to the disk_ioctl function. */
Blaze513 6:ddf09d859ed7 121
Blaze513 6:ddf09d859ed7 122 #define _MULTI_PARTITION 0 /* 0:Single parition or 1:Multiple partition */
Blaze513 6:ddf09d859ed7 123 /* When _MULTI_PARTITION is set to 0, each volume is bound to the same physical
Blaze513 6:ddf09d859ed7 124 / drive number and can mount only first primaly partition. When it is set to 1,
Blaze513 6:ddf09d859ed7 125 / each volume is tied to the partitions listed in Drives[]. */
Blaze513 6:ddf09d859ed7 126
Blaze513 6:ddf09d859ed7 127 /*---------------------------------------------------------------------------/
Blaze513 6:ddf09d859ed7 128 / System Configurations
Blaze513 6:ddf09d859ed7 129 /----------------------------------------------------------------------------*/
Blaze513 6:ddf09d859ed7 130
Blaze513 6:ddf09d859ed7 131 #define _WORD_ACCESS 0 /* 0 or 1 */
Blaze513 6:ddf09d859ed7 132 /* Set 0 first and it is always compatible with all platforms. The _WORD_ACCESS
Blaze513 6:ddf09d859ed7 133 / option defines which access method is used to the word data on the FAT volume.
Blaze513 6:ddf09d859ed7 134 /
Blaze513 6:ddf09d859ed7 135 / 0: Byte-by-byte access.
Blaze513 6:ddf09d859ed7 136 / 1: Word access. Do not choose this unless following condition is met.
Blaze513 6:ddf09d859ed7 137 /
Blaze513 6:ddf09d859ed7 138 / When the byte order on the memory is big-endian or address miss-aligned word
Blaze513 6:ddf09d859ed7 139 / access results incorrect behavior, the _WORD_ACCESS must be set to 0.
Blaze513 6:ddf09d859ed7 140 / If it is not the case, the value can also be set to 1 to improve the
Blaze513 6:ddf09d859ed7 141 / performance and code size. */
Blaze513 6:ddf09d859ed7 142
Blaze513 6:ddf09d859ed7 143 #define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
Blaze513 6:ddf09d859ed7 144 #define _FS_TIMEOUT 1024 /* Timeout period in unit of time ticks */
Blaze513 6:ddf09d859ed7 145 #define _SYNC_t HANDLE /* O/S dependent type of sync object.
Blaze513 6:ddf09d859ed7 146 e.g. HANDLE, OS_EVENT*, ID and etc.. */
Blaze513 6:ddf09d859ed7 147 /* Include a header file here to define O/S system calls */
Blaze513 6:ddf09d859ed7 148 /* #include <windows.h>, <ucos_ii.h.h>, <semphr.h> or ohters. */
Blaze513 6:ddf09d859ed7 149
Blaze513 6:ddf09d859ed7 150 /* The _FS_REENTRANT option switches the reentrancy of the FatFs module.
Blaze513 6:ddf09d859ed7 151 /
Blaze513 6:ddf09d859ed7 152 / 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
Blaze513 6:ddf09d859ed7 153 / 1: Enable reentrancy. Also user provided synchronization handlers,
Blaze513 6:ddf09d859ed7 154 / ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
Blaze513 6:ddf09d859ed7 155 / function must be added to the project. */
Blaze513 6:ddf09d859ed7 156
Blaze513 6:ddf09d859ed7 157 #define _FS_SHARE 0 /* 0:Disable or >=1:Enable */
Blaze513 6:ddf09d859ed7 158 /* To enable file sharing feature, set _FS_SHARE to >= 1 and also user
Blaze513 6:ddf09d859ed7 159 provided memory handlers, ff_memalloc and ff_memfree function must be
Blaze513 6:ddf09d859ed7 160 added to the project. The value defines number of files can be opened
Blaze513 6:ddf09d859ed7 161 per volume. */
Blaze513 6:ddf09d859ed7 162
Blaze513 1:94c648931f84 163 #endif