fs_com.h

Go to the documentation of this file.
00001 /*This file has been prepared for Doxygen automatic documentation generation.*/
00013 /* Copyright (C) 2006-2008, Atmel Corporation All rights reserved.
00014  *
00015  * Redistribution and use in source and binary forms, with or without
00016  * modification, are permitted provided that the following conditions are met:
00017  *
00018  * 1. Redistributions of source code must retain the above copyright notice,
00019  * this list of conditions and the following disclaimer.
00020  *
00021  * 2. Redistributions in binary form must reproduce the above copyright notice,
00022  * this list of conditions and the following disclaimer in the documentation
00023  * and/or other materials provided with the distribution.
00024  *
00025  * 3. The name of ATMEL may not be used to endorse or promote products derived
00026  * from this software without specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
00029  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00030  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
00031  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00032  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00033  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00034  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00035  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00036  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00037  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038  */
00039 
00040 #ifndef _FAT_COM_H_
00041 #define _FAT_COM_H_
00042 
00043 #include "conf_explorer.h"
00044 
00046 #undef _GLOBEXT_
00047 #if (defined _fat_c_)
00048 #  define _GLOBEXT_
00049 #else
00050 #  define _GLOBEXT_ extern
00051 #endif
00052 
00053 
00054 //------- Check configuration defined in conf_explorer.h
00055 
00056 #ifndef  FS_FAT_12
00057 #  error FS_FAT_12 must be defined with ENABLED or DISABLED in conf_explorer.h
00058 #endif
00059 #ifndef  FS_FAT_16
00060 #  error FS_FAT_16 must be defined with ENABLED or DISABLED in conf_explorer.h
00061 #endif
00062 #ifndef  FS_FAT_32
00063 #  error FS_FAT_32 must be defined with ENABLED or DISABLED in conf_explorer.h
00064 #endif
00065 
00066 #ifndef  FS_MULTI_PARTITION
00067 #  error FS_MULTI_PARTITION must be defined with ENABLED or DISABLED in conf_explorer.h
00068 #endif
00069 #ifndef  FS_NB_NAVIGATOR
00070 #  error FS_NB_NAVIGATOR must be defined in conf_explorer.h
00071 #endif
00072 
00073 
00074 //_____ D E F I N I T I O N S ______________________________________________
00075 
00076 
00077 //**** Defines used in function parameters
00078 
00081 #define  FS_NAME_GET          TRUE
00082 #define  FS_NAME_CHECK        FALSE
00084 
00087 #define  FS_SN_READ           TRUE
00088 #define  FS_SN_WRITE          FALSE
00090 
00093 #define  FS_LABEL_READ        TRUE
00094 #define  FS_LABEL_WRITE       FALSE
00096 
00099 #define  COPY_BUSY            0x00
00100 #define  COPY_FAIL            0x01
00101 #define  COPY_FINISH          0x02
00103 
00106 #define  FS_DATE_CREATION     TRUE
00107 #define  FS_DATE_LAST_WRITE   FALSE
00109 
00112 #define  FS_FILE              TRUE
00113 #define  FS_DIR               FALSE
00115 
00118 #define  FS_ID_DIR_EMPTY      0xFFFFFFFF     // ID no directory = bad cluster
00119 #define  FS_ID_DIR_ROOT       0              // ID of the root directory is always the cluster 0
00121 
00124 #define  FS_ATTR_FILE         ((Byte)0x00)   // Normal File attribute
00125 #define  FS_ATTR_READ_ONLY    ((Byte)0x01)   // Read Only File attribute
00126 #define  FS_ATTR_HIDDEN       ((Byte)0x02)   // Hidden File attribute
00127 #define  FS_ATTR_SYSTEM       ((Byte)0x04)   // System File attribute
00128 #define  FS_ATTR_VOLUME_ID    ((Byte)0x08)   // Volume id attribute
00129 #define  FS_ATTR_DIRECTORY    ((Byte)0x10)   // Directory attribute
00130 #define  FS_ATTR_ARCHIVE      ((Byte)0x20)   // Archive attribute
00131 #define  FS_ATTR_LFN_ENTRY    ((Byte)0x0F)   // LFN entry attribute
00132 #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))
00134 
00137 #define  FOPEN_READ_ACCESS    0x01                                                                    // autorize the read access
00138 #define  FOPEN_WRITE_ACCESS   0x02                                                                    // autorize the write access
00139 #define  FOPEN_CLEAR_SIZE     0x04                                                                    // reset size
00140 #define  FOPEN_CLEAR_PTR      0x08                                                                    // reset flux pointer
00141 #define  FOPEN_MODE_R         (FOPEN_READ_ACCESS|FOPEN_CLEAR_PTR)                                     
00142 #define  FOPEN_MODE_R_PLUS    (FOPEN_READ_ACCESS|FOPEN_WRITE_ACCESS|FOPEN_CLEAR_PTR)                  
00143 #define  FOPEN_MODE_W         (FOPEN_WRITE_ACCESS|FOPEN_CLEAR_PTR|FOPEN_CLEAR_SIZE)                   
00144 #define  FOPEN_MODE_W_PLUS    (FOPEN_READ_ACCESS|FOPEN_WRITE_ACCESS|FOPEN_CLEAR_PTR|FOPEN_CLEAR_SIZE) 
00145 #define  FOPEN_MODE_APPEND    (FOPEN_WRITE_ACCESS)                                                    
00146 
00147 
00149 #define  FS_EOF               0xFFFF
00150 
00153 #define  FS_FORMAT_DEFAULT       0x01     
00154 #define  FS_FORMAT_FAT           0x02     
00155 #define  FS_FORMAT_FAT32         0x03     
00156 #define  FS_FORMAT_NOMBR_FLAG    0x80     
00157 #define  FS_FORMAT_DEFAULT_NOMBR (FS_FORMAT_NOMBR_FLAG | FS_FORMAT_DEFAULT)  
00158 #define  FS_FORMAT_FAT_NOMBR     (FS_FORMAT_NOMBR_FLAG | FS_FORMAT_FAT)
00159 #define  FS_FORMAT_FAT32_NOMBR   (FS_FORMAT_NOMBR_FLAG | FS_FORMAT_FAT32)
00161 
00162 
00163 //**** communication STRUCTURES
00164 
00167 typedef U16 UNICODE;
00168 typedef char      _MEM_TYPE_SLOW_ * FS_STRING;
00169 typedef UNICODE   _MEM_TYPE_SLOW_ * FS_STR_UNICODE;
00171 
00173 typedef struct {
00174    U8    u8_lun;                       
00175 #if (FS_MULTI_PARTITION == ENABLED)
00176    U8    u8_partition;                 
00177 #endif
00178    U32   u32_cluster_sel_dir;          
00179    U16   u16_entry_pos_sel_file;       
00180 } Fs_index;
00181 
00182 
00183 //**** ERROR CODE
00184 
00187 #define  FS_ERR_HW               (FAIL+0)    
00188 #define  FS_ERR_NO_FORMAT        (FAIL+1)    
00189 #define  FS_ERR_NO_PART          (FAIL+2)    
00190 #define  FS_ERR_NO_SUPPORT_PART  (FAIL+3)    
00191 #define  FS_ERR_TOO_FILE_OPEN    (FAIL+4)    
00192 #define  FS_ERR_END_OF_DRIVE     (FAIL+5)    
00193 #define  FS_ERR_BAD_POS          (FAIL+6)    
00194 #define  FS_ERR_FS               (FAIL+7)    
00195 #define  FS_ERR_NO_FIND          (FAIL+8)    
00196 #define  FS_ERR_ENTRY_EMPTY      (FAIL+9)    
00197 #define  FS_ERR_ENTRY_BAD        (FAIL+10)   
00198 #define  FS_ERR_ENTRY_BADTYPE    (FAIL+11)   
00199 #define  FS_ERR_NO_DIR           (FAIL+12)   
00200 #define  FS_ERR_NO_MOUNT         (FAIL+13)   
00201 #define  FS_ERR_NO_FILE_SEL      (FAIL+14)   
00202 #define  FS_NO_LAST_LFN_ENTRY    (FAIL+15)   
00203 
00204 #define  FS_ERR_ID_FILE          (FAIL+17)   
00205 #define  FS_ERR_NO_FILE          (FAIL+18)   
00206 #define  FS_LUN_WP               (FAIL+19)   
00207 #define  FS_ERR_READ_ONLY        (FAIL+20)   
00208 #define  FS_ERR_NAME_INCORRECT   (FAIL+21)   
00209 #define  FS_ERR_FILE_NO_OPEN     (FAIL+22)   
00210 #define  FS_ERR_HW_NO_PRESENT    (FAIL+23)   
00211 #define  FS_ERR_IS_ROOT          (FAIL+24)   
00212 #define  FS_ERR_OUT_LIST         (FAIL+25)   
00213 #define  FS_ERR_NO_FREE_SPACE    (FAIL+26)   
00214 #define  FS_ERR_INCORRECT_NAME   (FAIL+27)   
00215 #define  FS_ERR_DIR_NOT_EMPTY    (FAIL+28)   
00216 #define  FS_ERR_WRITE_ONLY       (FAIL+29)   
00217 #define  FS_ERR_MODE_NOAVIALABLE (FAIL+30)   
00218 #define  FS_ERR_EOF              (FAIL+31)   
00219 #define  FS_ERR_BAD_SIZE_FAT     (FAIL+32)   
00220 #define  FS_ERR_COMMAND          (FAIL+33)   
00221 #define  FS_ERR_BUFFER_FULL      (FAIL+34)   
00222 #define  FS_ERR_COPY_DIR         (FAIL+35)   
00223 #define  FS_ERR_COPY_RUNNING     (FAIL+36)   
00224 #define  FS_ERR_COPY_IMPOSSIBLE  (FAIL+37)   
00225 #define  FS_ERR_BAD_NAV          (FAIL+38)   
00226 #define  FS_ERR_FILE_OPEN        (FAIL+39)   
00227 #define  FS_ERR_FILE_OPEN_WR     (FAIL+40)   
00228 #define  FS_ERR_FILE_EXIST       (FAIL+41)   
00229 #define  FS_ERR_NAME_TOO_LARGE   (FAIL+42)   
00230 
00231 #define  FS_ERR_PL_NOT_OPEN      (FAIL+50)   
00232 #define  FS_ERR_PL_ALREADY_OPEN  (FAIL+51)   
00233 #define  FS_ERR_PL_LST_END       (FAIL+52)   
00234 #define  FS_ERR_PL_LST_BEG       (FAIL+53)   
00235 #define  FS_ERR_PL_OUT_LST       (FAIL+54)   
00236 #define  FS_ERR_PL_READ_ONLY     (FAIL+55)   
00237 
00238 
00239 
00242 #define  FSFEATURE_READ                0x00  
00243 #define  FSFEATURE_WRITE               0x02  
00244 #define  FSFEATURE_WRITE_COMPLET       0x06  
00245 #define  FSFEATURE_ALL                 0xFF  
00246 
00247 
00248 
00250 typedef  U8                   Fs_status;
00252 _GLOBEXT_ _MEM_TYPE_SLOW_ Fs_status fs_g_status;
00253 
00254 #endif  // _FAT_COM_H_

Generated on Fri Oct 31 16:13:16 2008 for ATMEL by  doxygen 1.5.3