Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
ff.h
00001 /*---------------------------------------------------------------------------/ 00002 / FatFs - FAT file system module include file R0.08a (C)ChaN, 2010 00003 /----------------------------------------------------------------------------/ 00004 / FatFs module is a generic FAT file system module for small embedded systems. 00005 / This is a free software that opened for education, research and commercial 00006 / developments under license policy of following trems. 00007 / 00008 / Copyright (C) 2010, ChaN, all right reserved. 00009 / 00010 / * The FatFs module is a free software and there is NO WARRANTY. 00011 / * No restriction on use. You can use, modify and redistribute it for 00012 / personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY. 00013 / * Redistributions of source code must retain the above copyright notice. 00014 / 00015 /----------------------------------------------------------------------------*/ 00016 00017 #ifndef _FATFS 00018 #define _FATFS 8255 /* Revision ID */ 00019 00020 #ifdef __cplusplus 00021 extern "C" { 00022 #endif 00023 00024 #include "integer.h" /* Basic integer types */ 00025 #include "ffconf.h" /* FatFs configuration options */ 00026 00027 #if _FATFS != _FFCONF 00028 #error Wrong configuration file (ffconf.h). 00029 #endif 00030 00031 00032 /* DBCS code ranges and SBCS extend char conversion table */ 00033 00034 #if _CODE_PAGE == 932 /* Japanese Shift-JIS */ 00035 #define _DF1S 0x81 /* DBC 1st byte range 1 start */ 00036 #define _DF1E 0x9F /* DBC 1st byte range 1 end */ 00037 #define _DF2S 0xE0 /* DBC 1st byte range 2 start */ 00038 #define _DF2E 0xFC /* DBC 1st byte range 2 end */ 00039 #define _DS1S 0x40 /* DBC 2nd byte range 1 start */ 00040 #define _DS1E 0x7E /* DBC 2nd byte range 1 end */ 00041 #define _DS2S 0x80 /* DBC 2nd byte range 2 start */ 00042 #define _DS2E 0xFC /* DBC 2nd byte range 2 end */ 00043 00044 #elif _CODE_PAGE == 936 /* Simplified Chinese GBK */ 00045 #define _DF1S 0x81 00046 #define _DF1E 0xFE 00047 #define _DS1S 0x40 00048 #define _DS1E 0x7E 00049 #define _DS2S 0x80 00050 #define _DS2E 0xFE 00051 00052 #elif _CODE_PAGE == 949 /* Korean */ 00053 #define _DF1S 0x81 00054 #define _DF1E 0xFE 00055 #define _DS1S 0x41 00056 #define _DS1E 0x5A 00057 #define _DS2S 0x61 00058 #define _DS2E 0x7A 00059 #define _DS3S 0x81 00060 #define _DS3E 0xFE 00061 00062 #elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */ 00063 #define _DF1S 0x81 00064 #define _DF1E 0xFE 00065 #define _DS1S 0x40 00066 #define _DS1E 0x7E 00067 #define _DS2S 0xA1 00068 #define _DS2E 0xFE 00069 00070 #elif _CODE_PAGE == 437 /* U.S. (OEM) */ 00071 #define _DF1S 0 00072 #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, \ 00073 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, \ 00074 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, \ 00075 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} 00076 00077 #elif _CODE_PAGE == 720 /* Arabic (OEM) */ 00078 #define _DF1S 0 00079 #define _EXCVT {0x80,0x81,0x45,0x41,0x84,0x41,0x86,0x43,0x45,0x45,0x45,0x49,0x49,0x8D,0x8E,0x8F,0x90,0x92,0x92,0x93,0x94,0x95,0x49,0x49,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, \ 00080 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, \ 00081 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, \ 00082 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} 00083 00084 #elif _CODE_PAGE == 737 /* Greek (OEM) */ 00085 #define _DF1S 0 00086 #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, \ 00087 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0xAA,0x92,0x93,0x94,0x95,0x96,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB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6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF} 00097 00098 #elif _CODE_PAGE == 850 /* Multilingual Latin 1 (OEM) */ 00099 #define _DF1S 0 00100 #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, \ 00101 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, \ 00102 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, \ 00103 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} 00104 00105 #elif _CODE_PAGE == 852 /* Latin 2 (OEM) */ 00106 #define _DF1S 0 00107 #define _EXCVT {0x80,0x9A,0x90,0xB6,0x8E,0xDE,0x8F,0x80,0x9D,0xD3,0x8A,0x8A,0xD7,0x8D,0x8E,0x8F,0x90,0x91,0x91,0xE2,0x99,0x95,0x95,0x97,0x97,0x99,0x9A,0x9B,0x9B,0x9D,0x9E,0x9F, \ 00108 0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8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xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE,0xEF,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF} 00118 00119 #elif _CODE_PAGE == 857 /* Turkish (OEM) */ 00120 #define _DF1S 0 00121 #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, \ 00122 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, \ 00123 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, \ 00124 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} 00125 00126 #elif _CODE_PAGE == 858 /* Multilingual Latin 1 + Euro (OEM) */ 00127 #define _DF1S 0 00128 #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,0x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xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ 00138 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} 00139 00140 #elif _CODE_PAGE == 866 /* Russian (OEM) */ 00141 #define _DF1S 0 00142 #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, \ 00143 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, \ 00144 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, \ 00145 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} 00146 00147 #elif _CODE_PAGE == 874 /* Thai (OEM, Windows) */ 00148 #define _DF1S 0 00149 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x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xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \ 00159 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} 00160 00161 #elif _CODE_PAGE == 1251 /* Cyrillic (Windows) */ 00162 #define _DF1S 0 00163 #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, \ 00164 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, \ 00165 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, \ 00166 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} 00167 00168 #elif _CODE_PAGE == 1252 /* Latin 1 (Windows) */ 00169 #define _DF1S 0 00170 #define _EXCVT {0x80,0x81,0x82,0x83,0x84,0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Windows) */ 00190 #define _DF1S 0 00191 #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, \ 00192 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, \ 00193 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, \ 00194 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} 00195 00196 #elif _CODE_PAGE == 1256 /* Arabic (Windows) */ 00197 #define _DF1S 0 00198 #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, \ 00199 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,0x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xDE,0xFF} 00209 00210 #elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */ 00211 #define _DF1S 0 00212 #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, \ 00213 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, \ 00214 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, \ 00215 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} 00216 00217 #elif _CODE_PAGE == 1 /* ASCII (for only non-LFN cfg) */ 00218 #define _DF1S 0 00219 00220 #else 00221 #error Unknown code page 00222 00223 #endif 00224 00225 00226 00227 /* Definitions of volume management */ 00228 00229 #if _MULTI_PARTITION /* Multiple partition configuration */ 00230 #define LD2PD(vol) (VolToPart[vol].pd) /* Get physical drive# */ 00231 #define LD2PT(vol) (VolToPart[vol].pt) /* Get partition# */ 00232 typedef struct { 00233 BYTE pd; /* Physical drive# */ 00234 BYTE pt; /* Partition # (0-3) */ 00235 } PARTITION; 00236 extern const PARTITION VolToPart[]; /* Volume - Physical location resolution table */ 00237 00238 #else /* Single partition configuration */ 00239 #define LD2PD(vol) (vol) /* Logical drive# is bound to the same physical drive# */ 00240 #define LD2PT(vol) 0 /* Always mounts the 1st partition */ 00241 00242 #endif 00243 00244 00245 00246 /* Type of path name strings on FatFs API */ 00247 00248 #if _LFN_UNICODE /* Unicode string */ 00249 #if !_USE_LFN 00250 #error _LFN_UNICODE must be 0 in non-LFN cfg. 00251 #endif 00252 #ifndef _INC_TCHAR 00253 typedef WCHAR TCHAR; 00254 #define _T(x) L ## x 00255 #define _TEXT(x) L ## x 00256 #endif 00257 00258 #else /* ANSI/OEM string */ 00259 #ifndef _INC_TCHAR 00260 typedef char TCHAR; 00261 #define _T(x) x 00262 #define _TEXT(x) x 00263 #endif 00264 00265 #endif 00266 00267 00268 00269 /* File system object structure (FATFS) */ 00270 00271 typedef struct { 00272 BYTE fs_type; /* FAT sub-type (0:Not mounted) */ 00273 BYTE drv; /* Physical drive number */ 00274 BYTE csize; /* Sectors per cluster (1,2,4...128) */ 00275 BYTE n_fats; /* Number of FAT copies (1,2) */ 00276 BYTE wflag; /* win[] dirty flag (1:must be written back) */ 00277 BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */ 00278 WORD id; /* File system mount ID */ 00279 WORD n_rootdir; /* Number of root directory entries (FAT12/16) */ 00280 #if _MAX_SS != 512 00281 WORD ssize; /* Bytes per sector (512,1024,2048,4096) */ 00282 #endif 00283 #if _FS_REENTRANT 00284 _SYNC_t sobj; /* Identifier of sync object */ 00285 #endif 00286 #if !_FS_READONLY 00287 DWORD last_clust; /* Last allocated cluster */ 00288 DWORD free_clust; /* Number of free clusters */ 00289 DWORD fsi_sector; /* fsinfo sector (FAT32) */ 00290 #endif 00291 #if _FS_RPATH 00292 DWORD cdir; /* Current directory start cluster (0:root) */ 00293 #endif 00294 DWORD n_fatent; /* Number of FAT entries (= number of clusters + 2) */ 00295 DWORD fsize; /* Sectors per FAT */ 00296 DWORD fatbase; /* FAT start sector */ 00297 DWORD dirbase; /* Root directory start sector (FAT32:Cluster#) */ 00298 DWORD database; /* Data start sector */ 00299 DWORD winsect; /* Current sector appearing in the win[] */ 00300 BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and Data on tiny cfg) */ 00301 } FATFS; 00302 00303 00304 00305 /* File object structure (FIL) */ 00306 00307 typedef struct { 00308 FATFS* fs; /* Pointer to the owner file system object */ 00309 WORD id; /* Owner file system mount ID */ 00310 BYTE flag; /* File status flags */ 00311 BYTE pad1; 00312 DWORD fptr; /* File read/write pointer (0 on file open) */ 00313 DWORD fsize; /* File size */ 00314 DWORD org_clust; /* File start cluster (0 when fsize==0) */ 00315 DWORD curr_clust; /* Current cluster */ 00316 DWORD dsect; /* Current data sector */ 00317 #if !_FS_READONLY 00318 DWORD dir_sect; /* Sector containing the directory entry */ 00319 BYTE* dir_ptr; /* Ponter to the directory entry in the window */ 00320 #endif 00321 #if _USE_FASTSEEK 00322 DWORD* cltbl; /* Pointer to the cluster link map table (null on file open) */ 00323 #endif 00324 #if _FS_SHARE 00325 UINT lockid; /* File lock ID (index of file semaphore table) */ 00326 #endif 00327 #if !_FS_TINY 00328 BYTE buf[_MAX_SS]; /* File data read/write buffer */ 00329 #endif 00330 } FIL; 00331 00332 00333 00334 /* Directory object structure (DIR) */ 00335 00336 typedef struct { 00337 FATFS* fs; /* Pointer to the owner file system object */ 00338 WORD id; /* Owner file system mount ID */ 00339 WORD index; /* Current read/write index number */ 00340 DWORD sclust; /* Table start cluster (0:Root dir) */ 00341 DWORD clust; /* Current cluster */ 00342 DWORD sect; /* Current sector */ 00343 BYTE* dir; /* Pointer to the current SFN entry in the win[] */ 00344 BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */ 00345 #if _USE_LFN 00346 WCHAR* lfn; /* Pointer to the LFN working buffer */ 00347 WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */ 00348 #endif 00349 } DIR; 00350 00351 00352 00353 /* File status structure (FILINFO) */ 00354 00355 typedef struct { 00356 DWORD fsize; /* File size */ 00357 WORD fdate; /* Last modified date */ 00358 WORD ftime; /* Last modified time */ 00359 BYTE fattrib; /* Attribute */ 00360 TCHAR fname[13]; /* Short file name (8.3 format) */ 00361 #if _USE_LFN 00362 TCHAR* lfname; /* Pointer to the LFN buffer */ 00363 UINT lfsize; /* Size of LFN buffer in TCHAR */ 00364 #endif 00365 } FILINFO; 00366 00367 00368 00369 /* File function return code (FRESULT) */ 00370 00371 typedef enum { 00372 FR_OK = 0, /* (0) Succeeded */ 00373 FR_DISK_ERR, /* (1) A hard error occured in the low level disk I/O layer */ 00374 FR_INT_ERR, /* (2) Assertion failed */ 00375 FR_NOT_READY, /* (3) The physical drive cannot work */ 00376 FR_NO_FILE, /* (4) Could not find the file */ 00377 FR_NO_PATH, /* (5) Could not find the path */ 00378 FR_INVALID_NAME, /* (6) The path name format is invalid */ 00379 FR_DENIED, /* (7) Acces denied due to prohibited access or directory full */ 00380 FR_EXIST, /* (8) Acces denied due to prohibited access */ 00381 FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */ 00382 FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */ 00383 FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */ 00384 FR_NOT_ENABLED, /* (12) The volume has no work area */ 00385 FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume on the physical drive */ 00386 FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any parameter error */ 00387 FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */ 00388 FR_LOCKED, /* (16) The operation is rejected according to the file shareing policy */ 00389 FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */ 00390 FR_TOO_MANY_OPEN_FILES /* (18) Number of open files > _FS_SHARE */ 00391 } FRESULT; 00392 00393 00394 00395 /*--------------------------------------------------------------*/ 00396 /* FatFs module application interface */ 00397 00398 FRESULT f_mount (BYTE, FATFS*); /* Mount/Unmount a logical drive */ 00399 FRESULT f_open (FIL*, const TCHAR*, BYTE); /* Open or create a file */ 00400 FRESULT f_read (FIL*, void*, UINT, UINT*); /* Read data from a file */ 00401 FRESULT f_lseek (FIL*, DWORD); /* Move file pointer of a file object */ 00402 FRESULT f_close (FIL*); /* Close an open file object */ 00403 FRESULT f_opendir (DIR*, const TCHAR*); /* Open an existing directory */ 00404 FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */ 00405 FRESULT f_stat (const TCHAR*, FILINFO*); /* Get file status */ 00406 00407 #if !_FS_READONLY 00408 FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */ 00409 FRESULT f_getfree (const TCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */ 00410 FRESULT f_truncate (FIL*); /* Truncate file */ 00411 FRESULT f_sync (FIL*); /* Flush cached data of a writing file */ 00412 FRESULT f_unlink (const TCHAR*); /* Delete an existing file or directory */ 00413 FRESULT f_mkdir (const TCHAR*); /* Create a new directory */ 00414 FRESULT f_chmod (const TCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */ 00415 FRESULT f_utime (const TCHAR*, const FILINFO*); /* Change timestamp of the file/dir */ 00416 FRESULT f_rename (const TCHAR*, const TCHAR*); /* Rename/Move a file or directory */ 00417 #endif 00418 00419 #if _USE_FORWARD 00420 FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */ 00421 #endif 00422 00423 #if _USE_MKFS 00424 FRESULT f_mkfs (BYTE, BYTE, UINT); /* Create a file system on the drive */ 00425 #endif 00426 00427 #if _FS_RPATH 00428 FRESULT f_chdrive (BYTE); /* Change current drive */ 00429 FRESULT f_chdir (const TCHAR*); /* Change current directory */ 00430 FRESULT f_getcwd (TCHAR*, UINT); /* Get current directory */ 00431 #endif 00432 00433 #if _USE_STRFUNC 00434 int f_putc (TCHAR, FIL*); /* Put a character to the file */ 00435 int f_puts (const TCHAR*, FIL*); /* Put a string to the file */ 00436 int f_printf (FIL*, const TCHAR*, ...); /* Put a formatted string to the file */ 00437 TCHAR* f_gets (TCHAR*, int, FIL*); /* Get a string from the file */ 00438 #ifndef EOF 00439 #define EOF (-1) 00440 #endif 00441 #endif 00442 00443 #define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0) 00444 #define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0) 00445 #define f_tell(fp) ((fp)->fptr) 00446 #define f_size(fp) ((fp)->fsize) 00447 00448 00449 00450 /*--------------------------------------------------------------*/ 00451 /* Additional user defined functions */ 00452 00453 /* RTC function */ 00454 #if !_FS_READONLY 00455 DWORD get_fattime (void); 00456 #endif 00457 00458 /* Unicode support functions */ 00459 #if _USE_LFN /* Unicode - OEM code conversion */ 00460 WCHAR ff_convert (WCHAR, UINT); /* OEM-Unicode bidirectional conversion */ 00461 WCHAR ff_wtoupper (WCHAR); /* Unicode upper-case conversion */ 00462 #if _USE_LFN == 3 /* Memory functions */ 00463 void* ff_memalloc (UINT); /* Allocate memory block */ 00464 void ff_memfree (void*); /* Free memory block */ 00465 #endif 00466 #endif 00467 00468 /* Sync functions */ 00469 #if _FS_REENTRANT 00470 int ff_cre_syncobj (BYTE, _SYNC_t*);/* Create a sync object */ 00471 int ff_del_syncobj (_SYNC_t); /* Delete a sync object */ 00472 int ff_req_grant (_SYNC_t); /* Lock sync object */ 00473 void ff_rel_grant (_SYNC_t); /* Unlock sync object */ 00474 #endif 00475 00476 00477 00478 00479 /*--------------------------------------------------------------*/ 00480 /* Flags and offset address */ 00481 00482 00483 /* File access control and file status flags (FIL.flag) */ 00484 00485 #define FA_READ 0x01 00486 #define FA_OPEN_EXISTING 0x00 00487 #define FA__ERROR 0x80 00488 00489 #if !_FS_READONLY 00490 #define FA_WRITE 0x02 00491 #define FA_CREATE_NEW 0x04 00492 #define FA_CREATE_ALWAYS 0x08 00493 #define FA_OPEN_ALWAYS 0x10 00494 #define FA__WRITTEN 0x20 00495 #define FA__DIRTY 0x40 00496 #endif 00497 00498 00499 /* FAT sub type (FATFS.fs_type) */ 00500 00501 #define FS_FAT12 1 00502 #define FS_FAT16 2 00503 #define FS_FAT32 3 00504 00505 00506 /* File attribute bits for directory entry */ 00507 00508 #define AM_RDO 0x01 /* Read only */ 00509 #define AM_HID 0x02 /* Hidden */ 00510 #define AM_SYS 0x04 /* System */ 00511 #define AM_VOL 0x08 /* Volume label */ 00512 #define AM_LFN 0x0F /* LFN entry */ 00513 #define AM_DIR 0x10 /* Directory */ 00514 #define AM_ARC 0x20 /* Archive */ 00515 #define AM_MASK 0x3F /* Mask of defined bits */ 00516 00517 00518 /* Fast seek function */ 00519 #define CREATE_LINKMAP 0xFFFFFFFF 00520 00521 00522 /*--------------------------------*/ 00523 /* Multi-byte word access macros */ 00524 00525 #if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */ 00526 #define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr)) 00527 #define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr)) 00528 #define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val) 00529 #define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val) 00530 #else /* Use byte-by-byte access to the FAT structure */ 00531 #define LD_WORD(ptr) (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr)) 00532 #define LD_DWORD(ptr) (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr)) 00533 #define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8) 00534 #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) 00535 #endif 00536 00537 #ifdef __cplusplus 00538 } 00539 #endif 00540 00541 #endif /* _FATFS */
Generated on Tue Jul 12 2022 18:05:35 by
1.7.2