Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.

Dependencies:   Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ff.h Source File

ff.h

00001 /*---------------------------------------------------------------------------/
00002 /  FatFs - FAT file system module include file  R0.08     (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 //Modified by Thomas Hamilton, Copyright 2010
00018 
00019 #ifndef _FATFS
00020 #define _FATFS    8085    /* Revision ID */
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 #include "integer.h"    /* Basic integer types */
00027 #include "ffconf.h"        /* FatFs configuration options */
00028 
00029 #if _FATFS != _FFCONF
00030 #error Wrong configuration file (ffconf.h).
00031 #endif
00032 
00033 
00034 /* DBCS code ranges and SBCS extend char conversion table */
00035 
00036 #if _CODE_PAGE == 932    /* Japanese Shift-JIS */
00037 #define _DF1S    0x81    /* DBC 1st byte range 1 start */
00038 #define _DF1E    0x9F    /* DBC 1st byte range 1 end */
00039 #define _DF2S    0xE0    /* DBC 1st byte range 2 start */
00040 #define _DF2E    0xFC    /* DBC 1st byte range 2 end */
00041 #define _DS1S    0x40    /* DBC 2nd byte range 1 start */
00042 #define _DS1E    0x7E    /* DBC 2nd byte range 1 end */
00043 #define _DS2S    0x80    /* DBC 2nd byte range 2 start */
00044 #define _DS2E    0xFC    /* DBC 2nd byte range 2 end */
00045 
00046 #elif _CODE_PAGE == 936    /* Simplified Chinese GBK */
00047 #define _DF1S    0x81
00048 #define _DF1E    0xFE
00049 #define _DS1S    0x40
00050 #define _DS1E    0x7E
00051 #define _DS2S    0x80
00052 #define _DS2E    0xFE
00053 
00054 #elif _CODE_PAGE == 949    /* Korean */
00055 #define _DF1S    0x81
00056 #define _DF1E    0xFE
00057 #define _DS1S    0x41
00058 #define _DS1E    0x5A
00059 #define _DS2S    0x61
00060 #define _DS2E    0x7A
00061 #define _DS3S    0x81
00062 #define _DS3E    0xFE
00063 
00064 #elif _CODE_PAGE == 950    /* Traditional Chinese Big5 */
00065 #define _DF1S    0x81
00066 #define _DF1E    0xFE
00067 #define _DS1S    0x40
00068 #define _DS1E    0x7E
00069 #define _DS2S    0xA1
00070 #define _DS2E    0xFE
00071 
00072 #elif _CODE_PAGE == 437    /* U.S. (OEM) */
00073 #define _DF1S    0
00074 #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, \
00075                 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, \
00076                 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, \
00077                 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}
00078 
00079 #elif _CODE_PAGE == 720    /* Arabic (OEM) */
00080 #define _DF1S    0
00081 #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, \
00082                 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, \
00083                 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, \
00084                 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}
00085 
00086 #elif _CODE_PAGE == 737    /* Greek (OEM) */
00087 #define _DF1S    0
00088 #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, \
00089                 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, \
00090                 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, \
00091                 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}
00092 
00093 #elif _CODE_PAGE == 775    /* Baltic (OEM) */
00094 #define _DF1S    0
00095 #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, \
00096                 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, \
00097                 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, \
00098                 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}
00099 
00100 #elif _CODE_PAGE == 850    /* Multilingual Latin 1 (OEM) */
00101 #define _DF1S    0
00102 #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, \
00103                 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, \
00104                 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, \
00105                 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}
00106 
00107 #elif _CODE_PAGE == 852    /* Latin 2 (OEM) */
00108 #define _DF1S    0
00109 #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, \
00110                 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, \
00111                 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, \
00112                 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}
00113 
00114 #elif _CODE_PAGE == 855    /* Cyrillic (OEM) */
00115 #define _DF1S    0
00116 #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, \
00117                 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, \
00118                 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, \
00119                 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}
00120 
00121 #elif _CODE_PAGE == 857    /* Turkish (OEM) */
00122 #define _DF1S    0
00123 #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, \
00124                 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, \
00125                 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, \
00126                 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}
00127 
00128 #elif _CODE_PAGE == 858    /* Multilingual Latin 1 + Euro (OEM) */
00129 #define _DF1S    0
00130 #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, \
00131                 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, \
00132                 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, \
00133                 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}
00134 
00135 #elif _CODE_PAGE == 862    /* Hebrew (OEM) */
00136 #define _DF1S    0
00137 #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, \
00138                 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, \
00139                 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, \
00140                 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}
00141 
00142 #elif _CODE_PAGE == 866    /* Russian (OEM) */
00143 #define _DF1S    0
00144 #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, \
00145                 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, \
00146                 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, \
00147                 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}
00148 
00149 #elif _CODE_PAGE == 874    /* Thai (OEM, Windows) */
00150 #define _DF1S    0
00151 #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, \
00152                 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, \
00153                 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, \
00154                 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}
00155 
00156 #elif _CODE_PAGE == 1250 /* Central Europe (Windows) */
00157 #define _DF1S    0
00158 #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, \
00159                 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, \
00160                 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, \
00161                 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}
00162 
00163 #elif _CODE_PAGE == 1251 /* Cyrillic (Windows) */
00164 #define _DF1S    0
00165 #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, \
00166                 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, \
00167                 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, \
00168                 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}
00169 
00170 #elif _CODE_PAGE == 1252 /* Latin 1 (Windows) */
00171 #define _DF1S    0
00172 #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, \
00173                 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, \
00174                 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, \
00175                 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}
00176 
00177 #elif _CODE_PAGE == 1253 /* Greek (Windows) */
00178 #define _DF1S    0
00179 #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, \
00180                 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, \
00181                 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, \
00182                 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}
00183 
00184 #elif _CODE_PAGE == 1254 /* Turkish (Windows) */
00185 #define _DF1S    0
00186 #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, \
00187                 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, \
00188                 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, \
00189                 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}
00190 
00191 #elif _CODE_PAGE == 1255 /* Hebrew (Windows) */
00192 #define _DF1S    0
00193 #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, \
00194                 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, \
00195                 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, \
00196                 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}
00197 
00198 #elif _CODE_PAGE == 1256 /* Arabic (Windows) */
00199 #define _DF1S    0
00200 #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, \
00201                 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, \
00202                 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, \
00203                 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}
00204 
00205 #elif _CODE_PAGE == 1257 /* Baltic (Windows) */
00206 #define _DF1S    0
00207 #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, \
00208                 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, \
00209                 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, \
00210                 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}
00211 
00212 #elif _CODE_PAGE == 1258 /* Vietnam (OEM, Windows) */
00213 #define _DF1S    0
00214 #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, \
00215                 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, \
00216                 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, \
00217                 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}
00218 
00219 #elif _CODE_PAGE == 1    /* ASCII (for only non-LFN cfg) */
00220 #define _DF1S    0
00221 
00222 #else
00223 #error Unknown code page
00224 
00225 #endif
00226 
00227 
00228 
00229 /* Definitions corresponds to volume management */
00230 
00231 #if _MULTI_PARTITION        /* Multiple partition configuration */
00232 #define LD2PD(drv) (Drives[drv].pd)    /* Get physical drive# */
00233 #define LD2PT(drv) (Drives[drv].pt)    /* Get partition# */
00234 typedef struct {
00235     BYTE pd;    /* Physical drive# */
00236     BYTE pt;    /* Partition # (0-3) */
00237 } PARTITION;
00238 extern const PARTITION Drives[];    /* Logical drive# to physical location conversion table */
00239 
00240 #else                        /* Single partition configuration */
00241 #define LD2PD(drv) (drv)    /* Physical drive# is equal to the logical drive# */
00242 #define LD2PT(drv) 0        /* Always mounts the 1st partition */
00243 
00244 #endif
00245 
00246 
00247 
00248 /* Type of path name strings on FatFs API */
00249 
00250 #if _LFN_UNICODE            /* Unicode string */
00251 #if !_USE_LFN
00252 #error _LFN_UNICODE must be 0 in non-LFN cfg.
00253 #endif
00254 #ifndef _INC_TCHAR
00255 typedef WCHAR TCHAR;
00256 #define _T(x) L ## x
00257 #define _TEXT(x) L ## x
00258 #endif
00259 
00260 #else                        /* ANSI/OEM string */
00261 #ifndef _INC_TCHAR
00262 typedef char TCHAR;
00263 #define _T(x) x
00264 #define _TEXT(x) x
00265 #endif
00266 
00267 #endif
00268 
00269 
00270 
00271 /* Definitions corresponds to file shareing feature */
00272 
00273 #if _FS_SHARE
00274 #if _FS_READONLY
00275 #error _FS_SHARE must be 0 on R/O cfg.
00276 #endif
00277 typedef struct {
00278     DWORD clu;                /* File ID 1, directory */
00279     WORD idx;                /* File ID 2, index in the directory */
00280     WORD ctr;                /* File open counter, 0:none, 0x01..0xFF:read open count, 0x100:in write open */
00281 } FILESEM;
00282 #endif
00283 
00284 
00285 
00286 /* File system object structure (FATFS) */
00287 
00288 typedef struct {
00289     BYTE    fs_type;        /* FAT sub-type (0:Not mounted) */
00290     BYTE    drv;            /* Physical drive number */
00291     BYTE    csize;            /* Sectors per cluster (1,2,4...128) */
00292     BYTE    n_fats;            /* Number of FAT copies (1,2) */
00293     BYTE    wflag;            /* win[] dirty flag (1:must be written back) */
00294     BYTE    fsi_flag;        /* fsinfo dirty flag (1:must be written back) */
00295     WORD    id;                /* File system mount ID */
00296     WORD    n_rootdir;        /* Number of root directory entries (FAT12/16) */
00297 #if _MAX_SS != 512
00298     WORD    ssize;            /* Bytes per sector (512,1024,2048,4096) */
00299 #endif
00300 #if _FS_REENTRANT
00301     _SYNC_t    sobj;            /* Identifier of sync object */
00302 #endif
00303 #if !_FS_READONLY
00304     DWORD    last_clust;        /* Last allocated cluster */
00305     DWORD    free_clust;        /* Number of free clusters */
00306     DWORD    fsi_sector;        /* fsinfo sector (FAT32) */
00307 #endif
00308 #if _FS_RPATH
00309     DWORD    cdir;            /* Current directory start cluster (0:root) */
00310 #endif
00311     DWORD    n_fatent;        /* Number of FAT entries (= number of clusters + 2) */
00312     DWORD    fsize;            /* Sectors per FAT */
00313     DWORD    fatbase;        /* FAT start sector */
00314     DWORD    dirbase;        /* Root directory start sector (FAT32:Cluster#) */
00315     DWORD    database;        /* Data start sector */
00316     DWORD    winsect;        /* Current sector appearing in the win[] */
00317     BYTE    win[_MAX_SS];    /* Disk access window for Directory, FAT (and Data on tiny cfg) */
00318 #if _FS_SHARE
00319     FILESEM    flsem[_FS_SHARE];    /* File lock semaphores */
00320 #endif
00321 } FATFS;
00322 
00323 
00324 
00325 /* File object structure (FIL) */
00326 
00327 typedef struct {
00328     FATFS*    fs;                /* Pointer to the owner file system object */
00329     WORD    id;                /* Owner file system mount ID */
00330     BYTE    flag;            /* File status flags */
00331     BYTE    pad1;
00332     DWORD    fptr;            /* File read/write pointer */
00333     DWORD    fsize;            /* File size */
00334     DWORD    org_clust;        /* File start cluster (0 when fsize==0) */
00335     DWORD    curr_clust;        /* Current cluster */
00336     DWORD    dsect;            /* Current data sector */
00337 #if !_FS_READONLY
00338     DWORD    dir_sect;        /* Sector containing the directory entry */
00339     BYTE*    dir_ptr;        /* Ponter to the directory entry in the window */
00340 #endif
00341 #if _USE_FASTSEEK
00342     DWORD*    cltbl;            /* Pointer to the cluster link map table */
00343 #endif
00344 #if _FS_SHARE
00345     UINT    lockid;            /* File lock ID */
00346 #endif
00347 #if !_FS_TINY
00348     BYTE    buf[_MAX_SS];    /* File data read/write buffer */
00349 #endif
00350 } FAT_FIL;
00351 
00352 
00353 
00354 /* Directory object structure (FAT_DIR) */
00355 
00356 typedef struct {
00357     FATFS*    fs;                /* Pointer to the owner file system object */
00358     WORD    id;                /* Owner file system mount ID */
00359     WORD    index;            /* Current read/write index number */
00360     DWORD    sclust;            /* Table start cluster (0:Root dir) */
00361     DWORD    clust;            /* Current cluster */
00362     DWORD    sect;            /* Current sector */
00363     BYTE*    dir;            /* Pointer to the current SFN entry in the win[] */
00364     BYTE*    fn;                /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
00365 #if _USE_LFN
00366     WCHAR*    lfn;            /* Pointer to the LFN working buffer */
00367     WORD    lfn_idx;        /* Last matched LFN index number (0xFFFF:No LFN) */
00368 #endif
00369 } FAT_DIR;
00370 
00371 
00372 
00373 /* File status structure (FILINFO) */
00374 
00375 typedef struct {
00376     DWORD    fsize;            /* File size */
00377     WORD    fdate;            /* Last modified date */
00378     WORD    ftime;            /* Last modified time */
00379     BYTE    fattrib;        /* Attribute */
00380     TCHAR    fname[13];        /* Short file name (8.3 format) */
00381 #if _USE_LFN
00382     TCHAR*    lfname;            /* Pointer to the LFN buffer */
00383     int     lfsize;            /* Size of LFN buffer [chrs] */
00384 #endif
00385 } FILINFO;
00386 
00387 
00388 
00389 /* File function return code (FRESULT) */
00390 
00391 typedef enum {
00392     FR_OK = 0,                /* (0) Succeeded */
00393     FR_DISK_ERR,            /* (1) A hard error occured in the low level disk I/O layer */
00394     FR_INT_ERR,                /* (2) Assertion failed */
00395     FR_NOT_READY,            /* (3) The physical drive cannot work */
00396     FR_NO_FILE,                /* (4) Could not find the file */
00397     FR_NO_PATH,                /* (5) Could not find the path */
00398     FR_INVALID_NAME,        /* (6) The path name format is invalid */
00399     FR_DENIED,                /* (7) Acces denied due to prohibited access or directory full */
00400     FR_EXIST,                /* (8) Acces denied due to prohibited access */
00401     FR_INVALID_OBJECT,        /* (9) The file/directory object is invalid */
00402     FR_WRITE_PROTECTED,        /* (10) The physical drive is write protected */
00403     FR_INVALID_DRIVE,        /* (11) The logical drive number is invalid */
00404     FR_NOT_ENABLED,            /* (12) The volume has no work area */
00405     FR_NO_FILESYSTEM,        /* (13) There is no valid FAT volume on the physical drive */
00406     FR_MKFS_ABORTED,        /* (14) The f_mkfs() aborted due to any parameter error */
00407     FR_TIMEOUT,                /* (15) Could not get a grant to access the volume within defined period */
00408     FR_LOCKED,                /* (16) The operation is rejected according to the file shareing policy */
00409     FR_NOT_ENOUGH_CORE,        /* (17) LFN working buffer could not be allocated */
00410     FR_TOO_MANY_OPEN_FILES    /* (18) Number of open files > _FS_SHARE */
00411 } FRESULT;
00412 
00413 
00414 
00415 /*--------------------------------------------------------------*/
00416 /* FatFs module application interface                           */
00417 
00418 FRESULT f_mount (BYTE, FATFS*);                        /* Mount/Unmount a logical drive */
00419 FRESULT f_open (FAT_FIL*, const TCHAR*, BYTE);            /* Open or create a file */
00420 FRESULT f_read (FAT_FIL*, void*, UINT, UINT*);            /* Read data from a file */
00421 FRESULT f_lseek (FAT_FIL*, DWORD);                        /* Move file pointer of a file object */
00422 FRESULT f_close (FAT_FIL*);                                /* Close an open file object */
00423 FRESULT f_opendir (FAT_DIR*, const TCHAR*);                /* Open an existing directory */
00424 FRESULT f_readdir (FAT_DIR*, FILINFO*);                    /* Read a directory item */
00425 FRESULT f_stat (const TCHAR*, FILINFO*);            /* Get file status */
00426 #if !_FS_READONLY
00427 FRESULT f_write (FAT_FIL*, const void*, UINT, UINT*);    /* Write data to a file */
00428 FRESULT f_getfree (const TCHAR*, DWORD*, FATFS**);    /* Get number of free clusters on the drive */
00429 FRESULT f_truncate (FAT_FIL*);                            /* Truncate file */
00430 FRESULT f_sync (FAT_FIL*);                                /* Flush cached data of a writing file */
00431 FRESULT f_unlink (const TCHAR*);                    /* Delete an existing file or directory */
00432 FRESULT f_mkdir (const TCHAR*);                        /* Create a new directory */
00433 FRESULT f_chmod (const TCHAR*, BYTE, BYTE);            /* Change attriburte of the file/dir */
00434 FRESULT f_utime (const TCHAR*, const FILINFO*);        /* Change timestamp of the file/dir */
00435 FRESULT f_rename (const TCHAR*, const TCHAR*);        /* Rename/Move a file or directory */
00436 #endif
00437 #if _USE_FORWARD
00438 FRESULT f_forward (FAT_FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*);    /* Forward data to the stream */
00439 #endif
00440 #if _USE_MKFS
00441 FRESULT f_mkfs (BYTE, BYTE, UINT);                    /* Create a file system on the drive */
00442 #endif
00443 #if _FS_RPATH
00444 FRESULT f_chdir (const TCHAR*);                        /* Change current directory */
00445 FRESULT f_chdrive (BYTE);                            /* Change current drive */
00446 #endif
00447 #if _USE_STRFUNC
00448 int f_putc (TCHAR, FAT_FIL*);                            /* Put a character to the file */
00449 int f_puts (const TCHAR*, FAT_FIL*);                    /* Put a string to the file */
00450 int f_printf (FAT_FIL*, const TCHAR*, ...);                /* Put a formatted string to the file */
00451 TCHAR* f_gets (TCHAR*, int, FAT_FIL*);                    /* Get a string from the file */
00452 #define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
00453 #define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
00454 #ifndef EOF
00455 #define EOF (-1)
00456 #endif
00457 #endif
00458 
00459 
00460 
00461 /*--------------------------------------------------------------*/
00462 /* Additional user defined functions                            */
00463 
00464 /* RTC function */
00465 #if !_FS_READONLY
00466 DWORD get_fattime (void);
00467 #endif
00468 
00469 /* Unicode support functions */
00470 #if _USE_LFN                        /* Unicode - OEM code conversion */
00471 WCHAR ff_convert (WCHAR, UINT);        /* OEM-Unicode bidirectional conversion */
00472 WCHAR ff_wtoupper (WCHAR);            /* Unicode upper-case conversion */
00473 #if _USE_LFN == 3                    /* Memory functions */
00474 void* ff_memalloc (UINT);            /* Allocate memory block */
00475 void ff_memfree (void*);            /* Free memory block */
00476 #endif
00477 #endif
00478 
00479 /* Sync functions */
00480 #if _FS_REENTRANT
00481 int ff_cre_syncobj (BYTE, _SYNC_t*);/* Create a sync object */
00482 int ff_del_syncobj (_SYNC_t);        /* Delete a sync object */
00483 int ff_req_grant (_SYNC_t);            /* Lock sync object */
00484 void ff_rel_grant (_SYNC_t);        /* Unlock sync object */
00485 #endif
00486 
00487 
00488 
00489 
00490 /*--------------------------------------------------------------*/
00491 /* Flags and offset address                                     */
00492 
00493 
00494 /* File access control and file status flags (FIL.flag) */
00495 
00496 #define    FA_READ                0x01
00497 #define    FA_OPEN_EXISTING    0x00
00498 #define FA__ERROR            0x80
00499 
00500 #if !_FS_READONLY
00501 #define    FA_WRITE            0x02
00502 #define    FA_CREATE_NEW        0x04
00503 #define    FA_CREATE_ALWAYS    0x08
00504 #define    FA_OPEN_ALWAYS        0x10
00505 #define FA__WRITTEN            0x20
00506 #define FA__DIRTY            0x40
00507 #endif
00508 
00509 
00510 /* FAT sub type (FATFS.fs_type) */
00511 
00512 #define FS_FAT12    1
00513 #define FS_FAT16    2
00514 #define FS_FAT32    3
00515 
00516 
00517 /* File attribute bits for directory entry */
00518 
00519 #define    AM_RDO    0x01    /* Read only */
00520 #define    AM_HID    0x02    /* Hidden */
00521 #define    AM_SYS    0x04    /* System */
00522 #define    AM_VOL    0x08    /* Volume label */
00523 #define AM_LFN    0x0F    /* LFN entry */
00524 #define AM_DIR    0x10    /* Directory */
00525 #define AM_ARC    0x20    /* Archive */
00526 #define AM_MASK    0x3F    /* Mask of defined bits */
00527 
00528 
00529 /* Fast seek function */
00530 #define CREATE_LINKMAP    0xFFFFFFFF
00531 
00532 
00533 /* FatFs refers the members in the FAT structures with byte offset instead of
00534 / structure member because there are incompatibility of the packing option
00535 / between various compilers. */
00536 
00537 #define BS_jmpBoot            0
00538 #define BS_OEMName            3
00539 #define BPB_BytsPerSec        11
00540 #define BPB_SecPerClus        13
00541 #define BPB_RsvdSecCnt        14
00542 #define BPB_NumFATs            16
00543 #define BPB_RootEntCnt        17
00544 #define BPB_TotSec16        19
00545 #define BPB_Media            21
00546 #define BPB_FATSz16            22
00547 #define BPB_SecPerTrk        24
00548 #define BPB_NumHeads        26
00549 #define BPB_HiddSec            28
00550 #define BPB_TotSec32        32
00551 #define BS_55AA                510
00552 
00553 #define BS_DrvNum            36
00554 #define BS_BootSig            38
00555 #define BS_VolID            39
00556 #define BS_VolLab            43
00557 #define BS_FilSysType        54
00558 
00559 #define BPB_FATSz32            36
00560 #define BPB_ExtFlags        40
00561 #define BPB_FSVer            42
00562 #define BPB_RootClus        44
00563 #define BPB_FSInfo            48
00564 #define BPB_BkBootSec        50
00565 #define BS_DrvNum32            64
00566 #define BS_BootSig32        66
00567 #define BS_VolID32            67
00568 #define BS_VolLab32            71
00569 #define BS_FilSysType32        82
00570 
00571 #define    FSI_LeadSig            0
00572 #define    FSI_StrucSig        484
00573 #define    FSI_Free_Count        488
00574 #define    FSI_Nxt_Free        492
00575 
00576 #define MBR_Table            446
00577 
00578 #define    DIR_Name            0
00579 #define    DIR_Attr            11
00580 #define    DIR_NTres            12
00581 #define    DIR_CrtTime            14
00582 #define    DIR_CrtDate            16
00583 #define    DIR_FstClusHI        20
00584 #define    DIR_WrtTime            22
00585 #define    DIR_WrtDate            24
00586 #define    DIR_FstClusLO        26
00587 #define    DIR_FileSize        28
00588 #define    LDIR_Ord            0
00589 #define    LDIR_Attr            11
00590 #define    LDIR_Type            12
00591 #define    LDIR_Chksum            13
00592 #define    LDIR_FstClusLO        26
00593 
00594 
00595 
00596 /*--------------------------------*/
00597 /* Multi-byte word access macros  */
00598 
00599 #if _WORD_ACCESS == 1    /* Enable word access to the FAT structure */
00600 #define    LD_WORD(ptr)        (WORD)(*(WORD*)(BYTE*)(ptr))
00601 #define    LD_DWORD(ptr)        (DWORD)(*(DWORD*)(BYTE*)(ptr))
00602 #define    ST_WORD(ptr,val)    *(WORD*)(BYTE*)(ptr)=(WORD)(val)
00603 #define    ST_DWORD(ptr,val)    *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
00604 #else                    /* Use byte-by-byte access to the FAT structure */
00605 #define    LD_WORD(ptr)        (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
00606 #define    LD_DWORD(ptr)        (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
00607 #define    ST_WORD(ptr,val)    *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
00608 #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)
00609 #endif
00610 
00611 #ifdef __cplusplus
00612 }
00613 #endif
00614 
00615 #endif /* _FATFS */