This program is an example of of using the MSCUSBHost code with a raw build of ELM Chan Fat Fs. This was done to add both Long File Name Support along with proper time/date stamps (assuming you have a battery hooked up to keep time). This code exposes the Chan API (see main.cpp) and is NOT a c++ class: http://elm-chan.org/fsw/ff/00index_e.html The diskio.c file has the mapping needed to link the filesystem to the MSC stuff

Dependencies:   mbed

Committer:
emh203
Date:
Sun Jan 23 18:35:43 2011 +0000
Revision:
0:2dbbafe1b1fb
1st test version.   Test with raw mbed and Samtec USB-RA type A connector wired directly to pins.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emh203 0:2dbbafe1b1fb 1 /*---------------------------------------------------------------------------/
emh203 0:2dbbafe1b1fb 2 / FatFs - FAT file system module include file R0.07e (C)ChaN, 2009
emh203 0:2dbbafe1b1fb 3 /----------------------------------------------------------------------------/
emh203 0:2dbbafe1b1fb 4 / FatFs module is a generic FAT file system module for small embedded systems.
emh203 0:2dbbafe1b1fb 5 / This is a free software that opened for education, research and commercial
emh203 0:2dbbafe1b1fb 6 / developments under license policy of following trems.
emh203 0:2dbbafe1b1fb 7 /
emh203 0:2dbbafe1b1fb 8 / Copyright (C) 2009, ChaN, all right reserved.
emh203 0:2dbbafe1b1fb 9 /
emh203 0:2dbbafe1b1fb 10 / * The FatFs module is a free software and there is NO WARRANTY.
emh203 0:2dbbafe1b1fb 11 / * No restriction on use. You can use, modify and redistribute it for
emh203 0:2dbbafe1b1fb 12 / personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
emh203 0:2dbbafe1b1fb 13 / * Redistributions of source code must retain the above copyright notice.
emh203 0:2dbbafe1b1fb 14 /----------------------------------------------------------------------------*/
emh203 0:2dbbafe1b1fb 15
emh203 0:2dbbafe1b1fb 16 #ifndef _FATFS
emh203 0:2dbbafe1b1fb 17 #define _FATFS 0x007E
emh203 0:2dbbafe1b1fb 18
emh203 0:2dbbafe1b1fb 19 #include "integer.h" /* Basic integer types */
emh203 0:2dbbafe1b1fb 20 #include "ffconf.h" /* FatFs configuration options */
emh203 0:2dbbafe1b1fb 21
emh203 0:2dbbafe1b1fb 22 #if _FATFS != _FFCONFIG
emh203 0:2dbbafe1b1fb 23 #error Wrong configuration file (ffconf.h).
emh203 0:2dbbafe1b1fb 24 #endif
emh203 0:2dbbafe1b1fb 25
emh203 0:2dbbafe1b1fb 26
emh203 0:2dbbafe1b1fb 27 /* DBCS code ranges and SBCS extend char conversion table */
emh203 0:2dbbafe1b1fb 28
emh203 0:2dbbafe1b1fb 29 #if _CODE_PAGE == 932 /* Japanese Shift-JIS */
emh203 0:2dbbafe1b1fb 30 #define _DF1S 0x81 /* DBC 1st byte range 1 start */
emh203 0:2dbbafe1b1fb 31 #define _DF1E 0x9F /* DBC 1st byte range 1 end */
emh203 0:2dbbafe1b1fb 32 #define _DF2S 0xE0 /* DBC 1st byte range 2 start */
emh203 0:2dbbafe1b1fb 33 #define _DF2E 0xFC /* DBC 1st byte range 2 end */
emh203 0:2dbbafe1b1fb 34 #define _DS1S 0x40 /* DBC 2nd byte range 1 start */
emh203 0:2dbbafe1b1fb 35 #define _DS1E 0x7E /* DBC 2nd byte range 1 end */
emh203 0:2dbbafe1b1fb 36 #define _DS2S 0x80 /* DBC 2nd byte range 2 start */
emh203 0:2dbbafe1b1fb 37 #define _DS2E 0xFC /* DBC 2nd byte range 2 end */
emh203 0:2dbbafe1b1fb 38
emh203 0:2dbbafe1b1fb 39 #elif _CODE_PAGE == 936 /* Simplified Chinese GBK */
emh203 0:2dbbafe1b1fb 40 #define _DF1S 0x81
emh203 0:2dbbafe1b1fb 41 #define _DF1E 0xFE
emh203 0:2dbbafe1b1fb 42 #define _DS1S 0x40
emh203 0:2dbbafe1b1fb 43 #define _DS1E 0x7E
emh203 0:2dbbafe1b1fb 44 #define _DS2S 0x80
emh203 0:2dbbafe1b1fb 45 #define _DS2E 0xFE
emh203 0:2dbbafe1b1fb 46
emh203 0:2dbbafe1b1fb 47 #elif _CODE_PAGE == 949 /* Korean */
emh203 0:2dbbafe1b1fb 48 #define _DF1S 0x81
emh203 0:2dbbafe1b1fb 49 #define _DF1E 0xFE
emh203 0:2dbbafe1b1fb 50 #define _DS1S 0x41
emh203 0:2dbbafe1b1fb 51 #define _DS1E 0x5A
emh203 0:2dbbafe1b1fb 52 #define _DS2S 0x61
emh203 0:2dbbafe1b1fb 53 #define _DS2E 0x7A
emh203 0:2dbbafe1b1fb 54 #define _DS3S 0x81
emh203 0:2dbbafe1b1fb 55 #define _DS3E 0xFE
emh203 0:2dbbafe1b1fb 56
emh203 0:2dbbafe1b1fb 57 #elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */
emh203 0:2dbbafe1b1fb 58 #define _DF1S 0x81
emh203 0:2dbbafe1b1fb 59 #define _DF1E 0xFE
emh203 0:2dbbafe1b1fb 60 #define _DS1S 0x40
emh203 0:2dbbafe1b1fb 61 #define _DS1E 0x7E
emh203 0:2dbbafe1b1fb 62 #define _DS2S 0xA1
emh203 0:2dbbafe1b1fb 63 #define _DS2E 0xFE
emh203 0:2dbbafe1b1fb 64
emh203 0:2dbbafe1b1fb 65 #elif _CODE_PAGE == 437 /* U.S. (OEM) */
emh203 0:2dbbafe1b1fb 66 #define _DF1S 0
emh203 0:2dbbafe1b1fb 67 #define _EXCVT {0x80,0x9A,0x90,0x41,0x8E,0x41,0x8F,0x80,0x45,0x45,0x45,0x49,0x49,0x49,0x8E,0x8F,0x90,0x92,0x92,0x4F,0x99,0x4F,0x55,0x55,0x59,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 68 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 69 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xC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0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
emh203 0:2dbbafe1b1fb 78
emh203 0:2dbbafe1b1fb 79 #elif _CODE_PAGE == 737 /* Greek (OEM) */
emh203 0:2dbbafe1b1fb 80 #define _DF1S 0
emh203 0:2dbbafe1b1fb 81 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x96,0x97,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, \
emh203 0:2dbbafe1b1fb 82 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0xAA,0x92,0x93,0x94,0x95,0x96,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 83 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 84 0x97,0xEA,0xEB,0xEC,0xE4,0xED,0xEE,0xE7,0xE8,0xF1,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
emh203 0:2dbbafe1b1fb 85
emh203 0:2dbbafe1b1fb 86 #elif _CODE_PAGE == 775 /* Baltic (OEM) */
emh203 0:2dbbafe1b1fb 87 #define _DF1S 0
emh203 0:2dbbafe1b1fb 88 #define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0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0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF}
emh203 0:2dbbafe1b1fb 113
emh203 0:2dbbafe1b1fb 114 #elif _CODE_PAGE == 857 /* Turkish (OEM) */
emh203 0:2dbbafe1b1fb 115 #define _DF1S 0
emh203 0:2dbbafe1b1fb 116 #define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0x98,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x98,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9E, \
emh203 0:2dbbafe1b1fb 117 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA6,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 118 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 119 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xDE,0x59,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
emh203 0:2dbbafe1b1fb 120
emh203 0:2dbbafe1b1fb 121 #elif _CODE_PAGE == 858 /* Multilingual Latin 1 + Euro (OEM) */
emh203 0:2dbbafe1b1fb 122 #define _DF1S 0
emh203 0:2dbbafe1b1fb 123 #define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xB7,0x8F,0x80,0xD2,0xD3,0xD4,0xD8,0xD7,0xDE,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0xE3,0xEA,0xEB,0x59,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 124 0xB5,0xD6,0xE0,0xE9,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 125 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 126 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE7,0xE7,0xE9,0xEA,0xEB,0xED,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
emh203 0:2dbbafe1b1fb 127
emh203 0:2dbbafe1b1fb 128 #elif _CODE_PAGE == 862 /* Hebrew (OEM) */
emh203 0:2dbbafe1b1fb 129 #define _DF1S 0
emh203 0:2dbbafe1b1fb 130 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 131 0x41,0x49,0x4F,0x55,0xA5,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0x21,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 132 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 133 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
emh203 0:2dbbafe1b1fb 134
emh203 0:2dbbafe1b1fb 135 #elif _CODE_PAGE == 866 /* Russian (OEM) */
emh203 0:2dbbafe1b1fb 136 #define _DF1S 0
emh203 0:2dbbafe1b1fb 137 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 138 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 139 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 140 0x90,0x91,0x92,0x93,0x9d,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F,0xF0,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
emh203 0:2dbbafe1b1fb 141
emh203 0:2dbbafe1b1fb 142 #elif _CODE_PAGE == 874 /* Thai (OEM, Windows) */
emh203 0:2dbbafe1b1fb 143 #define _DF1S 0
emh203 0:2dbbafe1b1fb 144 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 145 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 146 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 147 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
emh203 0:2dbbafe1b1fb 148
emh203 0:2dbbafe1b1fb 149 #elif _CODE_PAGE == 1250 /* Central Europe (Windows) */
emh203 0:2dbbafe1b1fb 150 #define _DF1S 0
emh203 0:2dbbafe1b1fb 151 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
emh203 0:2dbbafe1b1fb 152 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xA3,0xB4,0xB5,0xB6,0xB7,0xB8,0xA5,0xAA,0xBB,0xBC,0xBD,0xBC,0xAF, \
emh203 0:2dbbafe1b1fb 153 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 154 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
emh203 0:2dbbafe1b1fb 155
emh203 0:2dbbafe1b1fb 156 #elif _CODE_PAGE == 1251 /* Cyrillic (Windows) */
emh203 0:2dbbafe1b1fb 157 #define _DF1S 0
emh203 0:2dbbafe1b1fb 158 #define _EXCVT {0x80,0x81,0x82,0x82,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x80,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x8D,0x8E,0x8F, \
emh203 0:2dbbafe1b1fb 159 0xA0,0xA2,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB2,0xA5,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xA3,0xBD,0xBD,0xAF, \
emh203 0:2dbbafe1b1fb 160 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 161 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF}
emh203 0:2dbbafe1b1fb 162
emh203 0:2dbbafe1b1fb 163 #elif _CODE_PAGE == 1252 /* Latin 1 (Windows) */
emh203 0:2dbbafe1b1fb 164 #define _DF1S 0
emh203 0:2dbbafe1b1fb 165 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0xAd,0x9B,0x8C,0x9D,0xAE,0x9F, \
emh203 0:2dbbafe1b1fb 166 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 167 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 168 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
emh203 0:2dbbafe1b1fb 169
emh203 0:2dbbafe1b1fb 170 #elif _CODE_PAGE == 1253 /* Greek (Windows) */
emh203 0:2dbbafe1b1fb 171 #define _DF1S 0
emh203 0:2dbbafe1b1fb 172 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 173 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 174 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xA2,0xB8,0xB9,0xBA, \
emh203 0:2dbbafe1b1fb 175 0xE0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xFB,0xBC,0xFD,0xBF,0xFF}
emh203 0:2dbbafe1b1fb 176
emh203 0:2dbbafe1b1fb 177 #elif _CODE_PAGE == 1254 /* Turkish (Windows) */
emh203 0:2dbbafe1b1fb 178 #define _DF1S 0
emh203 0:2dbbafe1b1fb 179 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x8A,0x9B,0x8C,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 180 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 181 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 182 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0x9F}
emh203 0:2dbbafe1b1fb 183
emh203 0:2dbbafe1b1fb 184 #elif _CODE_PAGE == 1255 /* Hebrew (Windows) */
emh203 0:2dbbafe1b1fb 185 #define _DF1S 0
emh203 0:2dbbafe1b1fb 186 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 187 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 188 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 189 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
emh203 0:2dbbafe1b1fb 190
emh203 0:2dbbafe1b1fb 191 #elif _CODE_PAGE == 1256 /* Arabic (Windows) */
emh203 0:2dbbafe1b1fb 192 #define _DF1S 0
emh203 0:2dbbafe1b1fb 193 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x8C,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 194 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 195 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 196 0x41,0xE1,0x41,0xE3,0xE4,0xE5,0xE6,0x43,0x45,0x45,0x45,0x45,0xEC,0xED,0x49,0x49,0xF0,0xF1,0xF2,0xF3,0x4F,0xF5,0xF6,0xF7,0xF8,0x55,0xFA,0x55,0x55,0xFD,0xFE,0xFF}
emh203 0:2dbbafe1b1fb 197
emh203 0:2dbbafe1b1fb 198 #elif _CODE_PAGE == 1257 /* Baltic (Windows) */
emh203 0:2dbbafe1b1fb 199 #define _DF1S 0
emh203 0:2dbbafe1b1fb 200 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 201 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xA8,0xB9,0xAA,0xBB,0xBC,0xBD,0xBE,0xAF, \
emh203 0:2dbbafe1b1fb 202 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 203 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xFF}
emh203 0:2dbbafe1b1fb 204
emh203 0:2dbbafe1b1fb 205 #elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */
emh203 0:2dbbafe1b1fb 206 #define _DF1S 0
emh203 0:2dbbafe1b1fb 207 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0xAC,0x9D,0x9E,0x9F, \
emh203 0:2dbbafe1b1fb 208 0xA0,0x21,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, \
emh203 0:2dbbafe1b1fb 209 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
emh203 0:2dbbafe1b1fb 210 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xEC,0xCD,0xCE,0xCF,0xD0,0xD1,0xF2,0xD3,0xD4,0xD5,0xD6,0xF7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xFE,0x9F}
emh203 0:2dbbafe1b1fb 211
emh203 0:2dbbafe1b1fb 212 #elif _CODE_PAGE == 1 /* ASCII (for only non-LFN cfg) */
emh203 0:2dbbafe1b1fb 213 #define _DF1S 0
emh203 0:2dbbafe1b1fb 214
emh203 0:2dbbafe1b1fb 215 #else
emh203 0:2dbbafe1b1fb 216 #error Unknown code page
emh203 0:2dbbafe1b1fb 217
emh203 0:2dbbafe1b1fb 218 #endif
emh203 0:2dbbafe1b1fb 219
emh203 0:2dbbafe1b1fb 220
emh203 0:2dbbafe1b1fb 221
emh203 0:2dbbafe1b1fb 222 /* Character code support macros */
emh203 0:2dbbafe1b1fb 223
emh203 0:2dbbafe1b1fb 224 #define IsUpper(c) (((c)>='A')&&((c)<='Z'))
emh203 0:2dbbafe1b1fb 225 #define IsLower(c) (((c)>='a')&&((c)<='z'))
emh203 0:2dbbafe1b1fb 226
emh203 0:2dbbafe1b1fb 227 #if _DF1S /* DBCS configuration */
emh203 0:2dbbafe1b1fb 228
emh203 0:2dbbafe1b1fb 229 #ifdef _DF2S /* Two 1st byte areas */
emh203 0:2dbbafe1b1fb 230 #define IsDBCS1(c) (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E))
emh203 0:2dbbafe1b1fb 231 #else /* One 1st byte area */
emh203 0:2dbbafe1b1fb 232 #define IsDBCS1(c) ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E)
emh203 0:2dbbafe1b1fb 233 #endif
emh203 0:2dbbafe1b1fb 234
emh203 0:2dbbafe1b1fb 235 #ifdef _DS3S /* Three 2nd byte areas */
emh203 0:2dbbafe1b1fb 236 #define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E))
emh203 0:2dbbafe1b1fb 237 #else /* Two 2nd byte areas */
emh203 0:2dbbafe1b1fb 238 #define IsDBCS2(c) (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E))
emh203 0:2dbbafe1b1fb 239 #endif
emh203 0:2dbbafe1b1fb 240
emh203 0:2dbbafe1b1fb 241 #else /* SBCS configuration */
emh203 0:2dbbafe1b1fb 242
emh203 0:2dbbafe1b1fb 243 #define IsDBCS1(c) 0
emh203 0:2dbbafe1b1fb 244 #define IsDBCS2(c) 0
emh203 0:2dbbafe1b1fb 245
emh203 0:2dbbafe1b1fb 246 #endif /* _DF1S */
emh203 0:2dbbafe1b1fb 247
emh203 0:2dbbafe1b1fb 248
emh203 0:2dbbafe1b1fb 249
emh203 0:2dbbafe1b1fb 250 /* Definitions corresponds to multi partition */
emh203 0:2dbbafe1b1fb 251
emh203 0:2dbbafe1b1fb 252 #if _MULTI_PARTITION /* Multiple partition configuration */
emh203 0:2dbbafe1b1fb 253
emh203 0:2dbbafe1b1fb 254 typedef struct _PARTITION {
emh203 0:2dbbafe1b1fb 255 BYTE pd; /* Physical drive# */
emh203 0:2dbbafe1b1fb 256 BYTE pt; /* Partition # (0-3) */
emh203 0:2dbbafe1b1fb 257 } PARTITION;
emh203 0:2dbbafe1b1fb 258
emh203 0:2dbbafe1b1fb 259 extern
emh203 0:2dbbafe1b1fb 260 const PARTITION Drives[]; /* Logical drive# to physical location conversion table */
emh203 0:2dbbafe1b1fb 261 #define LD2PD(drv) (Drives[drv].pd) /* Get physical drive# */
emh203 0:2dbbafe1b1fb 262 #define LD2PT(drv) (Drives[drv].pt) /* Get partition# */
emh203 0:2dbbafe1b1fb 263
emh203 0:2dbbafe1b1fb 264 #else /* Single partition configuration */
emh203 0:2dbbafe1b1fb 265
emh203 0:2dbbafe1b1fb 266 #define LD2PD(drv) (drv) /* Physical drive# is equal to the logical drive# */
emh203 0:2dbbafe1b1fb 267 #define LD2PT(drv) 0 /* Always mounts the 1st partition */
emh203 0:2dbbafe1b1fb 268
emh203 0:2dbbafe1b1fb 269 #endif
emh203 0:2dbbafe1b1fb 270
emh203 0:2dbbafe1b1fb 271
emh203 0:2dbbafe1b1fb 272
emh203 0:2dbbafe1b1fb 273 /* Definitions corresponds to multiple sector size */
emh203 0:2dbbafe1b1fb 274
emh203 0:2dbbafe1b1fb 275 #if _MAX_SS == 512 /* Single sector size */
emh203 0:2dbbafe1b1fb 276 #define SS(fs) 512U
emh203 0:2dbbafe1b1fb 277
emh203 0:2dbbafe1b1fb 278 #elif _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096 /* Multiple sector size */
emh203 0:2dbbafe1b1fb 279 #define SS(fs) ((fs)->s_size)
emh203 0:2dbbafe1b1fb 280
emh203 0:2dbbafe1b1fb 281 #else
emh203 0:2dbbafe1b1fb 282 #error Sector size must be 512, 1024, 2048 or 4096.
emh203 0:2dbbafe1b1fb 283
emh203 0:2dbbafe1b1fb 284 #endif
emh203 0:2dbbafe1b1fb 285
emh203 0:2dbbafe1b1fb 286
emh203 0:2dbbafe1b1fb 287
emh203 0:2dbbafe1b1fb 288 /* Type of file name on FatFs API */
emh203 0:2dbbafe1b1fb 289
emh203 0:2dbbafe1b1fb 290 #if _LFN_UNICODE && _USE_LFN
emh203 0:2dbbafe1b1fb 291 typedef WCHAR XCHAR; /* Unicode */
emh203 0:2dbbafe1b1fb 292 #else
emh203 0:2dbbafe1b1fb 293 typedef char XCHAR; /* SBCS, DBCS */
emh203 0:2dbbafe1b1fb 294 #endif
emh203 0:2dbbafe1b1fb 295
emh203 0:2dbbafe1b1fb 296
emh203 0:2dbbafe1b1fb 297
emh203 0:2dbbafe1b1fb 298 /* File system object structure */
emh203 0:2dbbafe1b1fb 299
emh203 0:2dbbafe1b1fb 300 typedef struct _FATFS_ {
emh203 0:2dbbafe1b1fb 301 BYTE fs_type; /* FAT sub type */
emh203 0:2dbbafe1b1fb 302 BYTE drive; /* Physical drive number */
emh203 0:2dbbafe1b1fb 303 BYTE csize; /* Number of sectors per cluster */
emh203 0:2dbbafe1b1fb 304 BYTE n_fats; /* Number of FAT copies */
emh203 0:2dbbafe1b1fb 305 BYTE wflag; /* win[] dirty flag (1:must be written back) */
emh203 0:2dbbafe1b1fb 306 BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */
emh203 0:2dbbafe1b1fb 307 WORD id; /* File system mount ID */
emh203 0:2dbbafe1b1fb 308 WORD n_rootdir; /* Number of root directory entries (0 on FAT32) */
emh203 0:2dbbafe1b1fb 309 #if _FS_REENTRANT
emh203 0:2dbbafe1b1fb 310 _SYNC_t sobj; /* Identifier of sync object */
emh203 0:2dbbafe1b1fb 311 #endif
emh203 0:2dbbafe1b1fb 312 #if _MAX_SS != 512
emh203 0:2dbbafe1b1fb 313 WORD s_size; /* Sector size */
emh203 0:2dbbafe1b1fb 314 #endif
emh203 0:2dbbafe1b1fb 315 #if !_FS_READONLY
emh203 0:2dbbafe1b1fb 316 DWORD last_clust; /* Last allocated cluster */
emh203 0:2dbbafe1b1fb 317 DWORD free_clust; /* Number of free clusters */
emh203 0:2dbbafe1b1fb 318 DWORD fsi_sector; /* fsinfo sector */
emh203 0:2dbbafe1b1fb 319 #endif
emh203 0:2dbbafe1b1fb 320 #if _FS_RPATH
emh203 0:2dbbafe1b1fb 321 DWORD cdir; /* Current directory (0:root)*/
emh203 0:2dbbafe1b1fb 322 #endif
emh203 0:2dbbafe1b1fb 323 DWORD sects_fat; /* Sectors per fat */
emh203 0:2dbbafe1b1fb 324 DWORD max_clust; /* Maximum cluster# + 1. Number of clusters is max_clust - 2 */
emh203 0:2dbbafe1b1fb 325 DWORD fatbase; /* FAT start sector */
emh203 0:2dbbafe1b1fb 326 DWORD dirbase; /* Root directory start sector (Cluster# on FAT32) */
emh203 0:2dbbafe1b1fb 327 DWORD database; /* Data start sector */
emh203 0:2dbbafe1b1fb 328 DWORD winsect; /* Current sector appearing in the win[] */
emh203 0:2dbbafe1b1fb 329 BYTE win[_MAX_SS];/* Disk access window for Directory/FAT */
emh203 0:2dbbafe1b1fb 330 } FATFS;
emh203 0:2dbbafe1b1fb 331
emh203 0:2dbbafe1b1fb 332
emh203 0:2dbbafe1b1fb 333
emh203 0:2dbbafe1b1fb 334 /* Directory object structure */
emh203 0:2dbbafe1b1fb 335
emh203 0:2dbbafe1b1fb 336 typedef struct _DIR_ {
emh203 0:2dbbafe1b1fb 337 FATFS* fs; /* Pointer to the owner file system object */
emh203 0:2dbbafe1b1fb 338 WORD id; /* Owner file system mount ID */
emh203 0:2dbbafe1b1fb 339 WORD index; /* Current read/write index number */
emh203 0:2dbbafe1b1fb 340 DWORD sclust; /* Table start cluster (0:Static table) */
emh203 0:2dbbafe1b1fb 341 DWORD clust; /* Current cluster */
emh203 0:2dbbafe1b1fb 342 DWORD sect; /* Current sector */
emh203 0:2dbbafe1b1fb 343 BYTE* dir; /* Pointer to the current SFN entry in the win[] */
emh203 0:2dbbafe1b1fb 344 BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
emh203 0:2dbbafe1b1fb 345 #if _USE_LFN
emh203 0:2dbbafe1b1fb 346 WCHAR* lfn; /* Pointer to the LFN working buffer */
emh203 0:2dbbafe1b1fb 347 WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */
emh203 0:2dbbafe1b1fb 348 #endif
emh203 0:2dbbafe1b1fb 349 } eDIR;
emh203 0:2dbbafe1b1fb 350
emh203 0:2dbbafe1b1fb 351
emh203 0:2dbbafe1b1fb 352
emh203 0:2dbbafe1b1fb 353 /* File object structure */
emh203 0:2dbbafe1b1fb 354
emh203 0:2dbbafe1b1fb 355 typedef struct _FIL_ {
emh203 0:2dbbafe1b1fb 356 FATFS* fs; /* Pointer to the owner file system object */
emh203 0:2dbbafe1b1fb 357 WORD id; /* Owner file system mount ID */
emh203 0:2dbbafe1b1fb 358 BYTE flag; /* File status flags */
emh203 0:2dbbafe1b1fb 359 BYTE csect; /* Sector address in the cluster */
emh203 0:2dbbafe1b1fb 360 DWORD fptr; /* File R/W pointer */
emh203 0:2dbbafe1b1fb 361 DWORD fsize; /* File size */
emh203 0:2dbbafe1b1fb 362 DWORD org_clust; /* File start cluster */
emh203 0:2dbbafe1b1fb 363 DWORD curr_clust; /* Current cluster */
emh203 0:2dbbafe1b1fb 364 DWORD dsect; /* Current data sector */
emh203 0:2dbbafe1b1fb 365 #if !_FS_READONLY
emh203 0:2dbbafe1b1fb 366 DWORD dir_sect; /* Sector containing the directory entry */
emh203 0:2dbbafe1b1fb 367 BYTE* dir_ptr; /* Ponter to the directory entry in the window */
emh203 0:2dbbafe1b1fb 368 #endif
emh203 0:2dbbafe1b1fb 369 #if !_FS_TINY
emh203 0:2dbbafe1b1fb 370 BYTE buf[_MAX_SS];/* File R/W buffer */
emh203 0:2dbbafe1b1fb 371 #endif
emh203 0:2dbbafe1b1fb 372 } FIL;
emh203 0:2dbbafe1b1fb 373
emh203 0:2dbbafe1b1fb 374
emh203 0:2dbbafe1b1fb 375
emh203 0:2dbbafe1b1fb 376 /* File status structure */
emh203 0:2dbbafe1b1fb 377
emh203 0:2dbbafe1b1fb 378 typedef struct _FILINFO_ {
emh203 0:2dbbafe1b1fb 379 DWORD fsize; /* File size */
emh203 0:2dbbafe1b1fb 380 WORD fdate; /* Last modified date */
emh203 0:2dbbafe1b1fb 381 WORD ftime; /* Last modified time */
emh203 0:2dbbafe1b1fb 382 BYTE fattrib; /* Attribute */
emh203 0:2dbbafe1b1fb 383 char fname[13]; /* Short file name (8.3 format) */
emh203 0:2dbbafe1b1fb 384 #if _USE_LFN
emh203 0:2dbbafe1b1fb 385 XCHAR* lfname; /* Pointer to the LFN buffer */
emh203 0:2dbbafe1b1fb 386 int lfsize; /* Size of LFN buffer [chrs] */
emh203 0:2dbbafe1b1fb 387 #endif
emh203 0:2dbbafe1b1fb 388 } FILINFO;
emh203 0:2dbbafe1b1fb 389
emh203 0:2dbbafe1b1fb 390
emh203 0:2dbbafe1b1fb 391
emh203 0:2dbbafe1b1fb 392 /* File function return code (FRESULT) */
emh203 0:2dbbafe1b1fb 393
emh203 0:2dbbafe1b1fb 394 typedef enum {
emh203 0:2dbbafe1b1fb 395 FR_OK = 0, /* 0 */
emh203 0:2dbbafe1b1fb 396 FR_DISK_ERR, /* 1 */
emh203 0:2dbbafe1b1fb 397 FR_INT_ERR, /* 2 */
emh203 0:2dbbafe1b1fb 398 FR_NOT_READY, /* 3 */
emh203 0:2dbbafe1b1fb 399 FR_NO_FILE, /* 4 */
emh203 0:2dbbafe1b1fb 400 FR_NO_PATH, /* 5 */
emh203 0:2dbbafe1b1fb 401 FR_INVALID_NAME, /* 6 */
emh203 0:2dbbafe1b1fb 402 FR_DENIED, /* 7 */
emh203 0:2dbbafe1b1fb 403 FR_EXIST, /* 8 */
emh203 0:2dbbafe1b1fb 404 FR_INVALID_OBJECT, /* 9 */
emh203 0:2dbbafe1b1fb 405 FR_WRITE_PROTECTED, /* 10 */
emh203 0:2dbbafe1b1fb 406 FR_INVALID_DRIVE, /* 11 */
emh203 0:2dbbafe1b1fb 407 FR_NOT_ENABLED, /* 12 */
emh203 0:2dbbafe1b1fb 408 FR_NO_FILESYSTEM, /* 13 */
emh203 0:2dbbafe1b1fb 409 FR_MKFS_ABORTED, /* 14 */
emh203 0:2dbbafe1b1fb 410 FR_TIMEOUT /* 15 */
emh203 0:2dbbafe1b1fb 411 } FRESULT;
emh203 0:2dbbafe1b1fb 412
emh203 0:2dbbafe1b1fb 413
emh203 0:2dbbafe1b1fb 414
emh203 0:2dbbafe1b1fb 415 /*--------------------------------------------------------------*/
emh203 0:2dbbafe1b1fb 416 /* FatFs module application interface */
emh203 0:2dbbafe1b1fb 417
emh203 0:2dbbafe1b1fb 418 FRESULT f_mount (BYTE, FATFS*); /* Mount/Unmount a logical drive */
emh203 0:2dbbafe1b1fb 419 FRESULT f_open (FIL*, const XCHAR*, BYTE); /* Open or create a file */
emh203 0:2dbbafe1b1fb 420 FRESULT f_read (FIL*, void*, UINT, UINT*); /* Read data from a file */
emh203 0:2dbbafe1b1fb 421 FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */
emh203 0:2dbbafe1b1fb 422 FRESULT f_lseek (FIL*, DWORD); /* Move file pointer of a file object */
emh203 0:2dbbafe1b1fb 423 FRESULT f_close (FIL*); /* Close an open file object */
emh203 0:2dbbafe1b1fb 424 FRESULT f_opendir (eDIR*, const XCHAR*); /* Open an existing directory */
emh203 0:2dbbafe1b1fb 425 FRESULT f_readdir (eDIR*, FILINFO*); /* Read a directory item */
emh203 0:2dbbafe1b1fb 426 FRESULT f_stat (const XCHAR*, FILINFO*); /* Get file status */
emh203 0:2dbbafe1b1fb 427 FRESULT f_getfree (const XCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */
emh203 0:2dbbafe1b1fb 428 FRESULT f_truncate (FIL*); /* Truncate file */
emh203 0:2dbbafe1b1fb 429 FRESULT f_sync (FIL*); /* Flush cached data of a writing file */
emh203 0:2dbbafe1b1fb 430 FRESULT f_unlink (const XCHAR*); /* Delete an existing file or directory */
emh203 0:2dbbafe1b1fb 431 FRESULT f_mkdir (const XCHAR*); /* Create a new directory */
emh203 0:2dbbafe1b1fb 432 FRESULT f_chmod (const XCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */
emh203 0:2dbbafe1b1fb 433 FRESULT f_utime (const XCHAR*, const FILINFO*); /* Change timestamp of the file/dir */
emh203 0:2dbbafe1b1fb 434 FRESULT f_rename (const XCHAR*, const XCHAR*); /* Rename/Move a file or directory */
emh203 0:2dbbafe1b1fb 435 FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */
emh203 0:2dbbafe1b1fb 436 FRESULT f_mkfs (BYTE, BYTE, WORD); /* Create a file system on the drive */
emh203 0:2dbbafe1b1fb 437 FRESULT f_chdir (const XCHAR*); /* Change current directory */
emh203 0:2dbbafe1b1fb 438 FRESULT f_chdrive (BYTE); /* Change current drive */
emh203 0:2dbbafe1b1fb 439
emh203 0:2dbbafe1b1fb 440 #if _USE_STRFUNC
emh203 0:2dbbafe1b1fb 441 int f_putc (int, FIL*); /* Put a character to the file */
emh203 0:2dbbafe1b1fb 442 int f_puts (const char*, FIL*); /* Put a string to the file */
emh203 0:2dbbafe1b1fb 443 int f_printf (FIL*, const char*, ...); /* Put a formatted string to the file */
emh203 0:2dbbafe1b1fb 444 char* f_gets (char*, int, FIL*); /* Get a string from the file */
emh203 0:2dbbafe1b1fb 445 #define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
emh203 0:2dbbafe1b1fb 446 #define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
emh203 0:2dbbafe1b1fb 447 #ifndef EOF
emh203 0:2dbbafe1b1fb 448 #define EOF -1
emh203 0:2dbbafe1b1fb 449 #endif
emh203 0:2dbbafe1b1fb 450 #endif
emh203 0:2dbbafe1b1fb 451
emh203 0:2dbbafe1b1fb 452
emh203 0:2dbbafe1b1fb 453
emh203 0:2dbbafe1b1fb 454 /*--------------------------------------------------------------*/
emh203 0:2dbbafe1b1fb 455 /* User defined functions */
emh203 0:2dbbafe1b1fb 456
emh203 0:2dbbafe1b1fb 457 /* Real time clock */
emh203 0:2dbbafe1b1fb 458 #if !_FS_READONLY
emh203 0:2dbbafe1b1fb 459 DWORD get_fattime (void); /* 31-25: Year(0-127 org.1980), 24-21: Month(1-12), 20-16: Day(1-31) */
emh203 0:2dbbafe1b1fb 460 /* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */
emh203 0:2dbbafe1b1fb 461 #endif
emh203 0:2dbbafe1b1fb 462
emh203 0:2dbbafe1b1fb 463 /* Unicode - OEM code conversion */
emh203 0:2dbbafe1b1fb 464 #if _USE_LFN
emh203 0:2dbbafe1b1fb 465 WCHAR ff_convert (WCHAR, UINT);
emh203 0:2dbbafe1b1fb 466 WCHAR ff_wtoupper (WCHAR);
emh203 0:2dbbafe1b1fb 467 #endif
emh203 0:2dbbafe1b1fb 468
emh203 0:2dbbafe1b1fb 469 /* Sync functions */
emh203 0:2dbbafe1b1fb 470 #if _FS_REENTRANT
emh203 0:2dbbafe1b1fb 471 BOOL ff_cre_syncobj(BYTE, _SYNC_t*);
emh203 0:2dbbafe1b1fb 472 BOOL ff_del_syncobj(_SYNC_t);
emh203 0:2dbbafe1b1fb 473 BOOL ff_req_grant(_SYNC_t);
emh203 0:2dbbafe1b1fb 474 void ff_rel_grant(_SYNC_t);
emh203 0:2dbbafe1b1fb 475 #endif
emh203 0:2dbbafe1b1fb 476
emh203 0:2dbbafe1b1fb 477
emh203 0:2dbbafe1b1fb 478
emh203 0:2dbbafe1b1fb 479 /*--------------------------------------------------------------*/
emh203 0:2dbbafe1b1fb 480 /* Flags and offset address */
emh203 0:2dbbafe1b1fb 481
emh203 0:2dbbafe1b1fb 482
emh203 0:2dbbafe1b1fb 483 /* File access control and file status flags (FIL.flag) */
emh203 0:2dbbafe1b1fb 484
emh203 0:2dbbafe1b1fb 485 #define FA_READ 0x01
emh203 0:2dbbafe1b1fb 486 #define FA_OPEN_EXISTING 0x00
emh203 0:2dbbafe1b1fb 487 #if _FS_READONLY == 0
emh203 0:2dbbafe1b1fb 488 #define FA_WRITE 0x02
emh203 0:2dbbafe1b1fb 489 #define FA_CREATE_NEW 0x04
emh203 0:2dbbafe1b1fb 490 #define FA_CREATE_ALWAYS 0x08
emh203 0:2dbbafe1b1fb 491 #define FA_OPEN_ALWAYS 0x10
emh203 0:2dbbafe1b1fb 492 #define FA__WRITTEN 0x20
emh203 0:2dbbafe1b1fb 493 #define FA__DIRTY 0x40
emh203 0:2dbbafe1b1fb 494 #endif
emh203 0:2dbbafe1b1fb 495 #define FA__ERROR 0x80
emh203 0:2dbbafe1b1fb 496
emh203 0:2dbbafe1b1fb 497
emh203 0:2dbbafe1b1fb 498 /* FAT sub type (FATFS.fs_type) */
emh203 0:2dbbafe1b1fb 499
emh203 0:2dbbafe1b1fb 500 #define FS_FAT12 1
emh203 0:2dbbafe1b1fb 501 #define FS_FAT16 2
emh203 0:2dbbafe1b1fb 502 #define FS_FAT32 3
emh203 0:2dbbafe1b1fb 503
emh203 0:2dbbafe1b1fb 504
emh203 0:2dbbafe1b1fb 505 /* File attribute bits for directory entry */
emh203 0:2dbbafe1b1fb 506
emh203 0:2dbbafe1b1fb 507 #define AM_RDO 0x01 /* Read only */
emh203 0:2dbbafe1b1fb 508 #define AM_HID 0x02 /* Hidden */
emh203 0:2dbbafe1b1fb 509 #define AM_SYS 0x04 /* System */
emh203 0:2dbbafe1b1fb 510 #define AM_VOL 0x08 /* Volume label */
emh203 0:2dbbafe1b1fb 511 #define AM_LFN 0x0F /* LFN entry */
emh203 0:2dbbafe1b1fb 512 #define AM_DIR 0x10 /* Directory */
emh203 0:2dbbafe1b1fb 513 #define AM_ARC 0x20 /* Archive */
emh203 0:2dbbafe1b1fb 514 #define AM_MASK 0x3F /* Mask of defined bits */
emh203 0:2dbbafe1b1fb 515
emh203 0:2dbbafe1b1fb 516
emh203 0:2dbbafe1b1fb 517 /* FatFs refers the members in the FAT structures with byte offset instead
emh203 0:2dbbafe1b1fb 518 / of structure member because there are incompatibility of the packing option
emh203 0:2dbbafe1b1fb 519 / between various compilers. */
emh203 0:2dbbafe1b1fb 520
emh203 0:2dbbafe1b1fb 521 #define BS_jmpBoot 0
emh203 0:2dbbafe1b1fb 522 #define BS_OEMName 3
emh203 0:2dbbafe1b1fb 523 #define BPB_BytsPerSec 11
emh203 0:2dbbafe1b1fb 524 #define BPB_SecPerClus 13
emh203 0:2dbbafe1b1fb 525 #define BPB_RsvdSecCnt 14
emh203 0:2dbbafe1b1fb 526 #define BPB_NumFATs 16
emh203 0:2dbbafe1b1fb 527 #define BPB_RootEntCnt 17
emh203 0:2dbbafe1b1fb 528 #define BPB_TotSec16 19
emh203 0:2dbbafe1b1fb 529 #define BPB_Media 21
emh203 0:2dbbafe1b1fb 530 #define BPB_FATSz16 22
emh203 0:2dbbafe1b1fb 531 #define BPB_SecPerTrk 24
emh203 0:2dbbafe1b1fb 532 #define BPB_NumHeads 26
emh203 0:2dbbafe1b1fb 533 #define BPB_HiddSec 28
emh203 0:2dbbafe1b1fb 534 #define BPB_TotSec32 32
emh203 0:2dbbafe1b1fb 535 #define BS_55AA 510
emh203 0:2dbbafe1b1fb 536
emh203 0:2dbbafe1b1fb 537 #define BS_DrvNum 36
emh203 0:2dbbafe1b1fb 538 #define BS_BootSig 38
emh203 0:2dbbafe1b1fb 539 #define BS_VolID 39
emh203 0:2dbbafe1b1fb 540 #define BS_VolLab 43
emh203 0:2dbbafe1b1fb 541 #define BS_FilSysType 54
emh203 0:2dbbafe1b1fb 542
emh203 0:2dbbafe1b1fb 543 #define BPB_FATSz32 36
emh203 0:2dbbafe1b1fb 544 #define BPB_ExtFlags 40
emh203 0:2dbbafe1b1fb 545 #define BPB_FSVer 42
emh203 0:2dbbafe1b1fb 546 #define BPB_RootClus 44
emh203 0:2dbbafe1b1fb 547 #define BPB_FSInfo 48
emh203 0:2dbbafe1b1fb 548 #define BPB_BkBootSec 50
emh203 0:2dbbafe1b1fb 549 #define BS_DrvNum32 64
emh203 0:2dbbafe1b1fb 550 #define BS_BootSig32 66
emh203 0:2dbbafe1b1fb 551 #define BS_VolID32 67
emh203 0:2dbbafe1b1fb 552 #define BS_VolLab32 71
emh203 0:2dbbafe1b1fb 553 #define BS_FilSysType32 82
emh203 0:2dbbafe1b1fb 554
emh203 0:2dbbafe1b1fb 555 #define FSI_LeadSig 0
emh203 0:2dbbafe1b1fb 556 #define FSI_StrucSig 484
emh203 0:2dbbafe1b1fb 557 #define FSI_Free_Count 488
emh203 0:2dbbafe1b1fb 558 #define FSI_Nxt_Free 492
emh203 0:2dbbafe1b1fb 559
emh203 0:2dbbafe1b1fb 560 #define MBR_Table 446
emh203 0:2dbbafe1b1fb 561
emh203 0:2dbbafe1b1fb 562 #define DIR_Name 0
emh203 0:2dbbafe1b1fb 563 #define DIR_Attr 11
emh203 0:2dbbafe1b1fb 564 #define DIR_NTres 12
emh203 0:2dbbafe1b1fb 565 #define DIR_CrtTime 14
emh203 0:2dbbafe1b1fb 566 #define DIR_CrtDate 16
emh203 0:2dbbafe1b1fb 567 #define DIR_FstClusHI 20
emh203 0:2dbbafe1b1fb 568 #define DIR_WrtTime 22
emh203 0:2dbbafe1b1fb 569 #define DIR_WrtDate 24
emh203 0:2dbbafe1b1fb 570 #define DIR_FstClusLO 26
emh203 0:2dbbafe1b1fb 571 #define DIR_FileSize 28
emh203 0:2dbbafe1b1fb 572 #define LDIR_Ord 0
emh203 0:2dbbafe1b1fb 573 #define LDIR_Attr 11
emh203 0:2dbbafe1b1fb 574 #define LDIR_Type 12
emh203 0:2dbbafe1b1fb 575 #define LDIR_Chksum 13
emh203 0:2dbbafe1b1fb 576 #define LDIR_FstClusLO 26
emh203 0:2dbbafe1b1fb 577
emh203 0:2dbbafe1b1fb 578
emh203 0:2dbbafe1b1fb 579
emh203 0:2dbbafe1b1fb 580 /*--------------------------------*/
emh203 0:2dbbafe1b1fb 581 /* Multi-byte word access macros */
emh203 0:2dbbafe1b1fb 582
emh203 0:2dbbafe1b1fb 583 #if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
emh203 0:2dbbafe1b1fb 584 #define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
emh203 0:2dbbafe1b1fb 585 #define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
emh203 0:2dbbafe1b1fb 586 #define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
emh203 0:2dbbafe1b1fb 587 #define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
emh203 0:2dbbafe1b1fb 588 #else /* Use byte-by-byte access to the FAT structure */
emh203 0:2dbbafe1b1fb 589 #define LD_WORD(ptr) (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
emh203 0:2dbbafe1b1fb 590 #define LD_DWORD(ptr) (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
emh203 0:2dbbafe1b1fb 591 #define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
emh203 0:2dbbafe1b1fb 592 #define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)
emh203 0:2dbbafe1b1fb 593 #endif
emh203 0:2dbbafe1b1fb 594
emh203 0:2dbbafe1b1fb 595
emh203 0:2dbbafe1b1fb 596 #endif /* _FATFS */