ff.h

00001 /*---------------------------------------------------------------------------/
00002 /  FatFs - FAT file system module include file  R0.07e       (C)ChaN, 2009
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) 2009, 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 #ifndef _FATFS
00017 #define _FATFS  0x007E
00018 
00019 #include <types.h>                      /* Basic integer types */
00020 #include <diskmii/ffconf.h>             /* FatFs configuration options */
00021 #if _FS_REENTRANT
00022 #include <usync.h>
00023 #endif
00024 
00025 #if _FATFS != _FFCONFIG
00026 #error Wrong configuration file (ffconf.h).
00027 #endif
00028 
00029 
00030 /* DBCS code ranges and SBCS extend char conversion table */
00031 
00032 #if _CODE_PAGE == 932   /* Japanese Shift-JIS */
00033 #define _DF1S   0x81    /* DBC 1st byte range 1 start */
00034 #define _DF1E   0x9F    /* DBC 1st byte range 1 end */
00035 #define _DF2S   0xE0    /* DBC 1st byte range 2 start */
00036 #define _DF2E   0xFC    /* DBC 1st byte range 2 end */
00037 #define _DS1S   0x40    /* DBC 2nd byte range 1 start */
00038 #define _DS1E   0x7E    /* DBC 2nd byte range 1 end */
00039 #define _DS2S   0x80    /* DBC 2nd byte range 2 start */
00040 #define _DS2E   0xFC    /* DBC 2nd byte range 2 end */
00041 
00042 #elif _CODE_PAGE == 936 /* Simplified Chinese GBK */
00043 #define _DF1S   0x81
00044 #define _DF1E   0xFE
00045 #define _DS1S   0x40
00046 #define _DS1E   0x7E
00047 #define _DS2S   0x80
00048 #define _DS2E   0xFE
00049 
00050 #elif _CODE_PAGE == 949 /* Korean */
00051 #define _DF1S   0x81
00052 #define _DF1E   0xFE
00053 #define _DS1S   0x41
00054 #define _DS1E   0x5A
00055 #define _DS2S   0x61
00056 #define _DS2E   0x7A
00057 #define _DS3S   0x81
00058 #define _DS3E   0xFE
00059 
00060 #elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */
00061 #define _DF1S   0x81
00062 #define _DF1E   0xFE
00063 #define _DS1S   0x40
00064 #define _DS1E   0x7E
00065 #define _DS2S   0xA1
00066 #define _DS2E   0xFE
00067 
00068 #elif _CODE_PAGE == 437 /* U.S. (OEM) */
00069 #define _DF1S   0
00070 #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, \
00071                                 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, \
00072                                 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, \
00073                                 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}
00074 
00075 #elif _CODE_PAGE == 720 /* Arabic (OEM) */
00076 #define _DF1S   0
00077 #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, \
00078                                 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, \
00079                                 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, \
00080                                 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}
00081 
00082 #elif _CODE_PAGE == 737 /* Greek (OEM) */
00083 #define _DF1S   0
00084 #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, \
00085                                 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, \
00086                                 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, \
00087                                 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}
00088 
00089 #elif _CODE_PAGE == 775 /* Baltic (OEM) */
00090 #define _DF1S   0
00091 #define _EXCVT {0x80,0x9A,0x91,0xA0,0x8E,0x95,0x8F,0x80,0xAD,0xED,0x8A,0x8A,0xA1,0x8D,0x8E,0x8F,0x90,0x92,0x92,0xE2,0x99,0x95,0x96,0x97,0x97,0x99,0x9A,0x9D,0x9C,0x9D,0x9E,0x9F, \
00092                                 0xA0,0xA1,0xE0,0xA3,0xA3,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, \
00093                                 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xB5,0xB6,0xB7,0xB8,0xBD,0xBE,0xC6,0xC7,0xA5,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
00094                                 0xE0,0xE1,0xE2,0xE3,0xE5,0xE5,0xE6,0xE3,0xE8,0xE8,0xEA,0xEA,0xEE,0xED,0xEE,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}
00095 
00096 #elif _CODE_PAGE == 850 /* Multilingual Latin 1 (OEM) */
00097 #define _DF1S   0
00098 #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, \
00099                                 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, \
00100                                 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, \
00101                                 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}
00102 
00103 #elif _CODE_PAGE == 852 /* Latin 2 (OEM) */
00104 #define _DF1S   0
00105 #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, \
00106                                 0xB5,0xD6,0xE0,0xE9,0xA4,0xA4,0xA6,0xA6,0xA8,0xA8,0xAA,0x8D,0xAC,0xB8,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBD,0xBF, \
00107                                 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC6,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD2,0xD3,0xD2,0xD5,0xD6,0xD7,0xB7,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, \
00108                                 0xE0,0xE1,0xE2,0xE3,0xE3,0xD5,0xE6,0xE6,0xE8,0xE9,0xE8,0xEB,0xED,0xED,0xDD,0xEF,0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xEB,0xFC,0xFC,0xFE,0xFF}
00109 
00110 #elif _CODE_PAGE == 855 /* Cyrillic (OEM) */
00111 #define _DF1S   0
00112 #define _EXCVT {0x81,0x81,0x83,0x83,0x85,0x85,0x87,0x87,0x89,0x89,0x8B,0x8B,0x8D,0x8D,0x8F,0x8F,0x91,0x91,0x93,0x93,0x95,0x95,0x97,0x97,0x99,0x99,0x9B,0x9B,0x9D,0x9D,0x9F,0x9F, \
00113                                 0xA1,0xA1,0xA3,0xA3,0xA5,0xA5,0xA7,0xA7,0xA9,0xA9,0xAB,0xAB,0xAD,0xAD,0xAE,0xAF,0xB0,0xB1,0xB2,0xB3,0xB4,0xB6,0xB6,0xB8,0xB8,0xB9,0xBA,0xBB,0xBC,0xBE,0xBE,0xBF, \
00114                                 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC7,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD1,0xD1,0xD3,0xD3,0xD5,0xD5,0xD7,0xD7,0xDD,0xD9,0xDA,0xDB,0xDC,0xDD,0xE0,0xDF, \
00115                                 0xE0,0xE2,0xE2,0xE4,0xE4,0xE6,0xE6,0xE8,0xE8,0xEA,0xEA,0xEC,0xEC,0xEE,0xEE,0xEF,0xF0,0xF2,0xF2,0xF4,0xF4,0xF6,0xF6,0xF8,0xF8,0xFA,0xFA,0xFC,0xFC,0xFD,0xFE,0xFF}
00116 
00117 #elif _CODE_PAGE == 857 /* Turkish (OEM) */
00118 #define _DF1S   0
00119 #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, \
00120                                 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, \
00121                                 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, \
00122                                 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}
00123 
00124 #elif _CODE_PAGE == 858 /* Multilingual Latin 1 + Euro (OEM) */
00125 #define _DF1S   0
00126 #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, \
00127                                 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, \
00128                                 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, \
00129                                 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}
00130 
00131 #elif _CODE_PAGE == 862 /* Hebrew (OEM) */
00132 #define _DF1S   0
00133 #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, \
00134                                 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, \
00135                                 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, \
00136                                 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}
00137 
00138 #elif _CODE_PAGE == 866 /* Russian (OEM) */
00139 #define _DF1S   0
00140 #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, \
00141                                 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, \
00142                                 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, \
00143                                 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}
00144 
00145 #elif _CODE_PAGE == 874 /* Thai (OEM, Windows) */
00146 #define _DF1S   0
00147 #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, \
00148                                 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, \
00149                                 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, \
00150                                 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}
00151 
00152 #elif _CODE_PAGE == 1250 /* Central Europe (Windows) */
00153 #define _DF1S   0
00154 #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, \
00155                                 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, \
00156                                 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, \
00157                                 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}
00158 
00159 #elif _CODE_PAGE == 1251 /* Cyrillic (Windows) */
00160 #define _DF1S   0
00161 #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, \
00162                                 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, \
00163                                 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, \
00164                                 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}
00165 
00166 #elif _CODE_PAGE == 1252 /* Latin 1 (Windows) */
00167 #define _DF1S   0
00168 #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, \
00169                                 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, \
00170                                 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, \
00171                                 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}
00172 
00173 #elif _CODE_PAGE == 1253 /* Greek (Windows) */
00174 #define _DF1S   0
00175 #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, \
00176                                 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, \
00177                                 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, \
00178                                 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}
00179 
00180 #elif _CODE_PAGE == 1254 /* Turkish (Windows) */
00181 #define _DF1S   0
00182 #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, \
00183                                 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, \
00184                                 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, \
00185                                 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}
00186 
00187 #elif _CODE_PAGE == 1255 /* Hebrew (Windows) */
00188 #define _DF1S   0
00189 #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, \
00190                                 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, \
00191                                 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, \
00192                                 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}
00193 
00194 #elif _CODE_PAGE == 1256 /* Arabic (Windows) */
00195 #define _DF1S   0
00196 #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, \
00197                                 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, \
00198                                 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, \
00199                                 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}
00200 
00201 #elif _CODE_PAGE == 1257 /* Baltic (Windows) */
00202 #define _DF1S   0
00203 #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, \
00204                                 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, \
00205                                 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, \
00206                                 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}
00207 
00208 #elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */
00209 #define _DF1S   0
00210 #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, \
00211                                 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, \
00212                                 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, \
00213                                 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}
00214 
00215 #elif _CODE_PAGE == 1   /* ASCII (for only non-LFN cfg) */
00216 #define _DF1S   0
00217 
00218 #else
00219 #error Unknown code page
00220 
00221 #endif
00222 
00223 
00224 
00225 /* Character code support macros */
00226 
00227 #define IsUpper(c)      (((c)>='A')&&((c)<='Z'))
00228 #define IsLower(c)      (((c)>='a')&&((c)<='z'))
00229 
00230 #if _DF1S               /* DBCS configuration */
00231 
00232 #ifdef _DF2S    /* Two 1st byte areas */
00233 #define IsDBCS1(c)      (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E))
00234 #else                   /* One 1st byte area */
00235 #define IsDBCS1(c)      ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E)
00236 #endif
00237 
00238 #ifdef _DS3S    /* Three 2nd byte areas */
00239 #define IsDBCS2(c)      (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E))
00240 #else                   /* Two 2nd byte areas */
00241 #define IsDBCS2(c)      (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E))
00242 #endif
00243 
00244 #else                   /* SBCS configuration */
00245 
00246 #define IsDBCS1(c)      0
00247 #define IsDBCS2(c)      0
00248 
00249 #endif /* _DF1S */
00250 
00251 
00252 
00253 /* Definitions corresponds to multi partition */
00254 
00255 #if _MULTI_PARTITION            /* Multiple partition configuration */
00256 
00257 typedef struct _PARTITION {
00258         BYTE pd;        /* Physical drive# */
00259         BYTE pt;        /* Partition # (0-3) */
00260 } PARTITION;
00261 
00262 extern
00263 const PARTITION Drives[];                       /* Logical drive# to physical location conversion table */
00264 #define LD2PD(drv) (Drives[drv].pd)     /* Get physical drive# */
00265 #define LD2PT(drv) (Drives[drv].pt)     /* Get partition# */
00266 
00267 #else                                           /* Single partition configuration */
00268 
00269 #define LD2PD(drv) (drv)        /* Physical drive# is equal to the logical drive# */
00270 #define LD2PT(drv) 0            /* Always mounts the 1st partition */
00271 
00272 #endif
00273 
00274 
00275 
00276 /* Definitions corresponds to multiple sector size */
00277 
00278 #if _MAX_SS == 512              /* Single sector size */
00279 #define SS(fs)  512U
00280 
00281 #elif _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096     /* Multiple sector size */
00282 #define SS(fs)  ((fs)->s_size)
00283 
00284 #else
00285 #error Sector size must be 512, 1024, 2048 or 4096.
00286 
00287 #endif
00288 
00289 
00290 
00291 /* Type of file name on FatFs API */
00292 
00293 #if _LFN_UNICODE && _USE_LFN
00294 typedef WCHAR XCHAR;    /* Unicode */
00295 #else
00296 typedef char XCHAR;             /* SBCS, DBCS */
00297 #endif
00298 
00299 
00300 
00301 /* File system object structure */
00302 
00303 typedef struct _FATFS_ {
00304         BYTE    fs_type;        /* FAT sub type */
00305         BYTE    drive;          /* Physical drive number */
00306         BYTE    csize;          /* Number of sectors per cluster */
00307         BYTE    n_fats;         /* Number of FAT copies */
00308         BYTE    wflag;          /* win[] dirty flag (1:must be written back) */
00309         BYTE    fsi_flag;       /* fsinfo dirty flag (1:must be written back) */
00310         WORD    id;                     /* File system mount ID */
00311         WORD    n_rootdir;      /* Number of root directory entries (0 on FAT32) */
00312 #if _FS_REENTRANT
00313         _SYNC_t sobj;           /* Identifier of sync object */
00314 #endif
00315 #if _MAX_SS != 512
00316         WORD    s_size;         /* Sector size */
00317 #endif
00318 #if !_FS_READONLY
00319         DWORD   last_clust;     /* Last allocated cluster */
00320         DWORD   free_clust;     /* Number of free clusters */
00321         DWORD   fsi_sector;     /* fsinfo sector */
00322 #endif
00323 #if _FS_RPATH
00324         DWORD   cdir;           /* Current directory (0:root)*/
00325 #endif
00326         DWORD   sects_fat;      /* Sectors per fat */
00327         DWORD   max_clust;      /* Maximum cluster# + 1. Number of clusters is max_clust - 2 */
00328         DWORD   fatbase;        /* FAT start sector */
00329         DWORD   dirbase;        /* Root directory start sector (Cluster# on FAT32) */
00330         DWORD   database;       /* Data start sector */
00331         DWORD   winsect;        /* Current sector appearing in the win[] */
00332         BYTE    win[_MAX_SS];/* Disk access window for Directory/FAT */
00333 } FATFS;
00334 
00335 
00336 
00337 /* Directory object structure */
00338 
00339 typedef struct _DIR_ {
00340         FATFS*  fs;                     /* Pointer to the owner file system object */
00341         WORD    id;                     /* Owner file system mount ID */
00342         WORD    index;          /* Current read/write index number */
00343         DWORD   sclust;         /* Table start cluster (0:Static table) */
00344         DWORD   clust;          /* Current cluster */
00345         DWORD   sect;           /* Current sector */
00346         BYTE*   dir;            /* Pointer to the current SFN entry in the win[] */
00347         BYTE*   fn;                     /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
00348 #if _USE_LFN
00349         WCHAR*  lfn;            /* Pointer to the LFN working buffer */
00350         WORD    lfn_idx;        /* Last matched LFN index number (0xFFFF:No LFN) */
00351 #endif
00352 } DIR;
00353 
00354 
00355 
00356 /* File object structure */
00357 
00358 typedef struct _FIL_ {
00359         FATFS*  fs;                     /* Pointer to the owner file system object */
00360         WORD    id;                     /* Owner file system mount ID */
00361         BYTE    flag;           /* File status flags */
00362         BYTE    csect;          /* Sector address in the cluster */
00363         DWORD   fptr;           /* File R/W pointer */
00364         DWORD   fsize;          /* File size */
00365         DWORD   org_clust;      /* File start cluster */
00366         DWORD   curr_clust;     /* Current cluster */
00367         DWORD   dsect;          /* Current data sector */
00368 #if !_FS_READONLY
00369         DWORD   dir_sect;       /* Sector containing the directory entry */
00370         BYTE*   dir_ptr;        /* Ponter to the directory entry in the window */
00371 #endif
00372 #if !_FS_TINY
00373         BYTE    buf[_MAX_SS];/* File R/W buffer */
00374 #endif
00375 } FIL;
00376 
00377 
00378 
00379 /* File status structure */
00380 
00381 typedef struct _FILINFO_ {
00382         DWORD   fsize;          /* File size */
00383         WORD    fdate;          /* Last modified date */
00384         WORD    ftime;          /* Last modified time */
00385         BYTE    fattrib;        /* Attribute */
00386         char    fname[13];      /* Short file name (8.3 format) */
00387 #if _USE_LFN
00388         XCHAR*  lfname;         /* Pointer to the LFN buffer */
00389         int     lfsize;         /* Size of LFN buffer [chrs] */
00390 #endif
00391 } FILINFO;
00392 
00393 
00394 
00395 /* File function return code (FRESULT) */
00396 
00397 typedef enum {
00398         FR_OK = 0,              /* 0 */
00399         FR_DISK_ERR,            /* 1 */
00400         FR_INT_ERR,             /* 2 */
00401         FR_NOT_READY,           /* 3 */
00402         FR_NO_FILE,             /* 4 */
00403         FR_NO_PATH,             /* 5 */
00404         FR_INVALID_NAME,        /* 6 */
00405         FR_DENIED,              /* 7 */
00406         FR_EXIST,               /* 8 */
00407         FR_INVALID_OBJECT,      /* 9 */
00408         FR_WRITE_PROTECTED,     /* 10 */
00409         FR_INVALID_DRIVE,       /* 11 */
00410         FR_NOT_ENABLED,         /* 12 */
00411         FR_NO_FILESYSTEM,       /* 13 */
00412         FR_MKFS_ABORTED,        /* 14 */
00413         FR_TIMEOUT              /* 15 */
00414 } FRESULT;
00415 
00416 
00417 
00418 /*--------------------------------------------------------------*/
00419 /* FatFs module application interface                           */
00420 
00421 FRESULT f_mount (BYTE, FATFS*);                                         /* Mount/Unmount a logical drive */
00422 FRESULT f_open (FIL*, const XCHAR*, BYTE);                      /* Open or create a file */
00423 FRESULT f_read (FIL*, void*, UINT, UINT*);                      /* Read data from a file */
00424 FRESULT f_write (FIL*, const void*, UINT, UINT*);       /* Write data to a file */
00425 FRESULT f_lseek (FIL*, DWORD);                                          /* Move file pointer of a file object */
00426 FRESULT f_close (FIL*);                                                         /* Close an open file object */
00427 FRESULT f_opendir (DIR*, const XCHAR*);                         /* Open an existing directory */
00428 FRESULT f_readdir (DIR*, FILINFO*);                                     /* Read a directory item */
00429 FRESULT f_stat (const XCHAR*, FILINFO*);                        /* Get file status */
00430 FRESULT f_getfree (const XCHAR*, DWORD*, FATFS**);      /* Get number of free clusters on the drive */
00431 FRESULT f_truncate (FIL*);                                                      /* Truncate file */
00432 FRESULT f_sync (FIL*);                                                          /* Flush cached data of a writing file */
00433 FRESULT f_unlink (const XCHAR*);                                        /* Delete an existing file or directory */
00434 FRESULT f_mkdir (const XCHAR*);                                         /* Create a new directory */
00435 FRESULT f_chmod (const XCHAR*, BYTE, BYTE);                     /* Change attriburte of the file/dir */
00436 FRESULT f_utime (const XCHAR*, const FILINFO*);         /* Change timestamp of the file/dir */
00437 FRESULT f_rename (const XCHAR*, const XCHAR*);          /* Rename/Move a file or directory */
00438 FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*);       /* Forward data to the stream */
00439 FRESULT f_mkfs (BYTE, BYTE, WORD);                                      /* Create a file system on the drive */
00440 FRESULT f_chdir (const XCHAR*);                                         /* Change current directory */
00441 FRESULT f_chdrive (BYTE);                                                       /* Change current drive */
00442 
00443 #if _USE_STRFUNC
00444 int f_putc (int, FIL*);                                                         /* Put a character to the file */
00445 int f_puts (const char*, FIL*);                                         /* Put a string to the file */
00446 int f_printf (FIL*, const char*, ...);                          /* Put a formatted string to the file */
00447 char* f_gets (char*, int, FIL*);                                        /* Get a string from the file */
00448 #define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
00449 #define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
00450 #ifndef EOF
00451 #define EOF -1
00452 #endif
00453 #endif
00454 
00455 #ifndef _DONT_USE_STDIO_FUNCS
00456 #define fmount          f_mount
00457 #define fopen           f_open
00458 #define fread           f_read
00459 #define fwrite          f_write
00460 #define fseek           f_lseek
00461 #define fclose          f_close
00462 #define fopendir        f_opendir
00463 #define freaddir        f_readdir
00464 #define fstat           f_stat
00465 #define fgetfree        f_getfree
00466 #define ftruncate       f_truncate
00467 #define fsync           f_sync
00468 #define unlink          f_unlink
00469 #define mkdir           f_mkdir
00470 #define chmod           f_chmod
00471 #define utime           f_utime
00472 #define rename          f_rename
00473 #define fforward        f_forward
00474 #define mkfs            f_mkfs
00475 #define chdir           f_chdir
00476 #define chdrive         f_chdrive
00477 #endif
00478 
00479 /*--------------------------------------------------------------*/
00480 /* User defined functions                                       */
00481 
00482 /* Real time clock */
00483 #if !_FS_READONLY
00484 DWORD get_fattime (void);       /* 31-25: Year(0-127 org.1980), 24-21: Month(1-12), 20-16: Day(1-31) */
00485                                                         /* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */
00486 #endif
00487 
00488 /* Unicode - OEM code conversion */
00489 #if _USE_LFN
00490 WCHAR ff_convert (WCHAR, UINT);
00491 WCHAR ff_wtoupper (WCHAR);
00492 #endif
00493 
00494 /* Sync functions */
00495 #if _FS_REENTRANT
00496 BOOL ff_cre_syncobj(BYTE, _SYNC_t*);
00497 BOOL ff_del_syncobj(_SYNC_t);
00498 BOOL ff_req_grant(_SYNC_t);
00499 void ff_rel_grant(_SYNC_t);
00500 #endif
00501 
00502 
00503 
00504 /*--------------------------------------------------------------*/
00505 /* Flags and offset address                                     */
00506 
00507 
00508 /* File access control and file status flags (FIL.flag) */
00509 
00510 #define FA_READ                         0x01
00511 #define FA_OPEN_EXISTING        0x00
00512 #if _FS_READONLY == 0
00513 #define FA_WRITE                        0x02
00514 #define FA_CREATE_NEW           0x04
00515 #define FA_CREATE_ALWAYS        0x08
00516 #define FA_OPEN_ALWAYS          0x10
00517 #define FA__WRITTEN                     0x20
00518 #define FA__DIRTY                       0x40
00519 #endif
00520 #define FA__ERROR                       0x80
00521 
00522 
00523 /* FAT sub type (FATFS.fs_type) */
00524 
00525 #define FS_FAT12        1
00526 #define FS_FAT16        2
00527 #define FS_FAT32        3
00528 
00529 
00530 /* File attribute bits for directory entry */
00531 
00532 #define AM_RDO  0x01    /* Read only */
00533 #define AM_HID  0x02    /* Hidden */
00534 #define AM_SYS  0x04    /* System */
00535 #define AM_VOL  0x08    /* Volume label */
00536 #define AM_LFN  0x0F    /* LFN entry */
00537 #define AM_DIR  0x10    /* Directory */
00538 #define AM_ARC  0x20    /* Archive */
00539 #define AM_MASK 0x3F    /* Mask of defined bits */
00540 
00541 
00542 /* FatFs refers the members in the FAT structures with byte offset instead
00543 / of structure member because there are incompatibility of the packing option
00544 / between various compilers. */
00545 
00546 #define BS_jmpBoot                      0
00547 #define BS_OEMName                      3
00548 #define BPB_BytsPerSec          11
00549 #define BPB_SecPerClus          13
00550 #define BPB_RsvdSecCnt          14
00551 #define BPB_NumFATs                     16
00552 #define BPB_RootEntCnt          17
00553 #define BPB_TotSec16            19
00554 #define BPB_Media                       21
00555 #define BPB_FATSz16                     22
00556 #define BPB_SecPerTrk           24
00557 #define BPB_NumHeads            26
00558 #define BPB_HiddSec                     28
00559 #define BPB_TotSec32            32
00560 #define BS_55AA                         510
00561 
00562 #define BS_DrvNum                       36
00563 #define BS_BootSig                      38
00564 #define BS_VolID                        39
00565 #define BS_VolLab                       43
00566 #define BS_FilSysType           54
00567 
00568 #define BPB_FATSz32                     36
00569 #define BPB_ExtFlags            40
00570 #define BPB_FSVer                       42
00571 #define BPB_RootClus            44
00572 #define BPB_FSInfo                      48
00573 #define BPB_BkBootSec           50
00574 #define BS_DrvNum32                     64
00575 #define BS_BootSig32            66
00576 #define BS_VolID32                      67
00577 #define BS_VolLab32                     71
00578 #define BS_FilSysType32         82
00579 
00580 #define FSI_LeadSig                     0
00581 #define FSI_StrucSig            484
00582 #define FSI_Free_Count          488
00583 #define FSI_Nxt_Free            492
00584 
00585 #define MBR_Table                       446
00586 
00587 #define DIR_Name                        0
00588 #define DIR_Attr                        11
00589 #define DIR_NTres                       12
00590 #define DIR_CrtTime                     14
00591 #define DIR_CrtDate                     16
00592 #define DIR_FstClusHI           20
00593 #define DIR_WrtTime                     22
00594 #define DIR_WrtDate                     24
00595 #define DIR_FstClusLO           26
00596 #define DIR_FileSize            28
00597 #define LDIR_Ord                        0
00598 #define LDIR_Attr                       11
00599 #define LDIR_Type                       12
00600 #define LDIR_Chksum                     13
00601 #define LDIR_FstClusLO          26
00602 
00603 
00604 
00605 /*--------------------------------*/
00606 /* Multi-byte word access macros  */
00607 
00608 #if _WORD_ACCESS == 1   /* Enable word access to the FAT structure */
00609 #define LD_WORD(ptr)            (WORD)(*(WORD*)(BYTE*)(ptr))
00610 #define LD_DWORD(ptr)           (DWORD)(*(DWORD*)(BYTE*)(ptr))
00611 #define ST_WORD(ptr,val)        *(WORD*)(BYTE*)(ptr)=(WORD)(val)
00612 #define ST_DWORD(ptr,val)       *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
00613 #else                                   /* Use byte-by-byte access to the FAT structure */
00614 #define LD_WORD(ptr)            (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
00615 #define LD_DWORD(ptr)           (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
00616 #define ST_WORD(ptr,val)        *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
00617 #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)
00618 #endif
00619 
00620 
00621 #endif /* _FATFS */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated by  doxygen 1.6.3