00001
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef _FAT_COM_H_
00044 #define _FAT_COM_H_
00045
00046 #include "conf_explorer.h"
00047
00049 #undef _GLOBEXT_
00050 #if (defined _fat_c_)
00051 # define _GLOBEXT_
00052 #else
00053 # define _GLOBEXT_ extern
00054 #endif
00055
00056
00057
00058
00059 #ifndef FS_FAT_12
00060 # error FS_FAT_12 must be defined with ENABLED or DISABLED in conf_explorer.h
00061 #endif
00062 #ifndef FS_FAT_16
00063 # error FS_FAT_16 must be defined with ENABLED or DISABLED in conf_explorer.h
00064 #endif
00065 #ifndef FS_FAT_32
00066 # error FS_FAT_32 must be defined with ENABLED or DISABLED in conf_explorer.h
00067 #endif
00068
00069 #ifndef FS_MULTI_PARTITION
00070 # error FS_MULTI_PARTITION must be defined with ENABLED or DISABLED in conf_explorer.h
00071 #endif
00072 #ifndef FS_NB_NAVIGATOR
00073 # error FS_NB_NAVIGATOR must be defined in conf_explorer.h
00074 #endif
00075
00076
00077
00078
00079
00080
00081
00084 #define FS_NAME_GET TRUE
00085 #define FS_NAME_CHECK FALSE
00087
00090 #define FS_SN_READ TRUE
00091 #define FS_SN_WRITE FALSE
00093
00096 #define FS_LABEL_READ TRUE
00097 #define FS_LABEL_WRITE FALSE
00099
00102 #define COPY_BUSY 0x00
00103 #define COPY_FAIL 0x01
00104 #define COPY_FINISH 0x02
00106
00109 #define FS_DATE_CREATION TRUE
00110 #define FS_DATE_LAST_WRITE FALSE
00112
00115 #define FS_FILE TRUE
00116 #define FS_DIR FALSE
00118
00121 #define FS_ID_DIR_EMPTY 0xFFFFFFFF // ID no directory = bad cluster
00122 #define FS_ID_DIR_ROOT 0 // ID of the root directory is always the cluster 0
00124
00127 #define FS_ATTR_FILE ((Byte)0x00) // Normal File attribute
00128 #define FS_ATTR_READ_ONLY ((Byte)0x01) // Read Only File attribute
00129 #define FS_ATTR_HIDDEN ((Byte)0x02) // Hidden File attribute
00130 #define FS_ATTR_SYSTEM ((Byte)0x04) // System File attribute
00131 #define FS_ATTR_VOLUME_ID ((Byte)0x08) // Volume id attribute
00132 #define FS_ATTR_DIRECTORY ((Byte)0x10) // Directory attribute
00133 #define FS_ATTR_ARCHIVE ((Byte)0x20) // Archive attribute
00134 #define FS_ATTR_LFN_ENTRY ((Byte)0x0F) // LFN entry attribute
00135 #define Fat_is_not_a_file ((FS_ATTR_DIRECTORY & fs_g_nav_entry.u8_attr) || (FS_ATTR_VOLUME_ID & fs_g_nav_entry.u8_attr))
00137
00140 #define FOPEN_READ_ACCESS 0x01 // autorize the read access
00141 #define FOPEN_WRITE_ACCESS 0x02 // autorize the write access
00142 #define FOPEN_CLEAR_SIZE 0x04 // reset size
00143 #define FOPEN_CLEAR_PTR 0x08 // reset flux pointer
00144 #define FOPEN_MODE_R (FOPEN_READ_ACCESS|FOPEN_CLEAR_PTR)
00145 #define FOPEN_MODE_R_PLUS (FOPEN_READ_ACCESS|FOPEN_WRITE_ACCESS|FOPEN_CLEAR_PTR)
00146 #define FOPEN_MODE_W (FOPEN_WRITE_ACCESS|FOPEN_CLEAR_PTR|FOPEN_CLEAR_SIZE)
00147 #define FOPEN_MODE_W_PLUS (FOPEN_READ_ACCESS|FOPEN_WRITE_ACCESS|FOPEN_CLEAR_PTR|FOPEN_CLEAR_SIZE)
00148 #define FOPEN_MODE_APPEND (FOPEN_WRITE_ACCESS)
00149
00150
00152 #define FS_EOF 0xFFFF
00153
00156 #define FS_FORMAT_DEFAULT 0x01
00157 #define FS_FORMAT_FAT 0x02
00158 #define FS_FORMAT_FAT32 0x03
00159 #define FS_FORMAT_NOMBR_FLAG 0x80
00160 #define FS_FORMAT_DEFAULT_NOMBR (FS_FORMAT_NOMBR_FLAG | FS_FORMAT_DEFAULT)
00161 #define FS_FORMAT_FAT_NOMBR (FS_FORMAT_NOMBR_FLAG | FS_FORMAT_FAT)
00162 #define FS_FORMAT_FAT32_NOMBR (FS_FORMAT_NOMBR_FLAG | FS_FORMAT_FAT32)
00164
00165
00166
00167
00170 typedef U16 UNICODE;
00171 typedef char _MEM_TYPE_SLOW_ * FS_STRING;
00172 typedef UNICODE _MEM_TYPE_SLOW_ * FS_STR_UNICODE;
00174
00176 typedef struct {
00177 U8 u8_lun;
00178 #if (FS_MULTI_PARTITION == ENABLED)
00179 U8 u8_partition;
00180 #endif
00181 U32 u32_cluster_sel_dir;
00182 U16 u16_entry_pos_sel_file;
00183 } Fs_index;
00184
00185
00186
00187
00190 #define FS_ERR_HW (FAIL+0)
00191 #define FS_ERR_NO_FORMAT (FAIL+1)
00192 #define FS_ERR_NO_PART (FAIL+2)
00193 #define FS_ERR_NO_SUPPORT_PART (FAIL+3)
00194 #define FS_ERR_TOO_FILE_OPEN (FAIL+4)
00195 #define FS_ERR_END_OF_DRIVE (FAIL+5)
00196 #define FS_ERR_BAD_POS (FAIL+6)
00197 #define FS_ERR_FS (FAIL+7)
00198 #define FS_ERR_NO_FIND (FAIL+8)
00199 #define FS_ERR_ENTRY_EMPTY (FAIL+9)
00200 #define FS_ERR_ENTRY_BAD (FAIL+10)
00201 #define FS_ERR_ENTRY_BADTYPE (FAIL+11)
00202 #define FS_ERR_NO_DIR (FAIL+12)
00203 #define FS_ERR_NO_MOUNT (FAIL+13)
00204 #define FS_ERR_NO_FILE_SEL (FAIL+14)
00205 #define FS_NO_LAST_LFN_ENTRY (FAIL+15)
00206
00207 #define FS_ERR_ID_FILE (FAIL+17)
00208 #define FS_ERR_NO_FILE (FAIL+18)
00209 #define FS_LUN_WP (FAIL+19)
00210 #define FS_ERR_READ_ONLY (FAIL+20)
00211 #define FS_ERR_NAME_INCORRECT (FAIL+21)
00212 #define FS_ERR_FILE_NO_OPEN (FAIL+22)
00213 #define FS_ERR_HW_NO_PRESENT (FAIL+23)
00214 #define FS_ERR_IS_ROOT (FAIL+24)
00215 #define FS_ERR_OUT_LIST (FAIL+25)
00216 #define FS_ERR_NO_FREE_SPACE (FAIL+26)
00217 #define FS_ERR_INCORRECT_NAME (FAIL+27)
00218 #define FS_ERR_DIR_NOT_EMPTY (FAIL+28)
00219 #define FS_ERR_WRITE_ONLY (FAIL+29)
00220 #define FS_ERR_MODE_NOAVIALABLE (FAIL+30)
00221 #define FS_ERR_EOF (FAIL+31)
00222 #define FS_ERR_BAD_SIZE_FAT (FAIL+32)
00223 #define FS_ERR_COMMAND (FAIL+33)
00224 #define FS_ERR_BUFFER_FULL (FAIL+34)
00225 #define FS_ERR_COPY_DIR (FAIL+35)
00226 #define FS_ERR_COPY_RUNNING (FAIL+36)
00227 #define FS_ERR_COPY_IMPOSSIBLE (FAIL+37)
00228 #define FS_ERR_BAD_NAV (FAIL+38)
00229 #define FS_ERR_FILE_OPEN (FAIL+39)
00230 #define FS_ERR_FILE_OPEN_WR (FAIL+40)
00231 #define FS_ERR_FILE_EXIST (FAIL+41)
00232 #define FS_ERR_NAME_TOO_LARGE (FAIL+42)
00233 #define FS_ERR_DEVICE_TOO_SMALL (FAIL+43)
00234
00235 #define FS_ERR_PL_NOT_OPEN (FAIL+50)
00236 #define FS_ERR_PL_ALREADY_OPEN (FAIL+51)
00237 #define FS_ERR_PL_LST_END (FAIL+52)
00238 #define FS_ERR_PL_LST_BEG (FAIL+53)
00239 #define FS_ERR_PL_OUT_LST (FAIL+54)
00240 #define FS_ERR_PL_READ_ONLY (FAIL+55)
00241
00242
00243
00246 #define FSFEATURE_READ 0x00
00247 #define FSFEATURE_WRITE 0x02
00248 #define FSFEATURE_WRITE_COMPLET 0x06
00249 #define FSFEATURE_ALL 0xFF
00250
00251
00252
00254 typedef U8 Fs_status;
00256 _GLOBEXT_ _MEM_TYPE_SLOW_ Fs_status fs_g_status;
00257
00258 #endif // _FAT_COM_H_