dd

Dependencies:   C12832 LM75B mbed

Committer:
pfe
Date:
Tue Apr 21 10:16:20 2015 +0000
Revision:
0:05a20e3e3179
dd

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pfe 0:05a20e3e3179 1 /*---------------------------------------------------------------------------/
pfe 0:05a20e3e3179 2 / FatFs - FAT file system module include file R0.09 (C)ChaN, 2011
pfe 0:05a20e3e3179 3 /----------------------------------------------------------------------------/
pfe 0:05a20e3e3179 4 / FatFs module is a generic FAT file system module for small embedded systems.
pfe 0:05a20e3e3179 5 / This is a free software that opened for education, research and commercial
pfe 0:05a20e3e3179 6 / developments under license policy of following trems.
pfe 0:05a20e3e3179 7 /
pfe 0:05a20e3e3179 8 / Copyright (C) 2011, ChaN, all right reserved.
pfe 0:05a20e3e3179 9 /
pfe 0:05a20e3e3179 10 / * The FatFs module is a free software and there is NO WARRANTY.
pfe 0:05a20e3e3179 11 / * No restriction on use. You can use, modify and redistribute it for
pfe 0:05a20e3e3179 12 / personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
pfe 0:05a20e3e3179 13 / * Redistributions of source code must retain the above copyright notice.
pfe 0:05a20e3e3179 14 /
pfe 0:05a20e3e3179 15 /----------------------------------------------------------------------------*/
pfe 0:05a20e3e3179 16
pfe 0:05a20e3e3179 17 #ifndef _FATFS
pfe 0:05a20e3e3179 18 #define _FATFS 6502 /* Revision ID */
pfe 0:05a20e3e3179 19
pfe 0:05a20e3e3179 20 #ifdef __cplusplus
pfe 0:05a20e3e3179 21 extern "C" {
pfe 0:05a20e3e3179 22 #endif
pfe 0:05a20e3e3179 23
pfe 0:05a20e3e3179 24 #include "integer.h" /* Basic integer types */
pfe 0:05a20e3e3179 25 #include "ffconf.h" /* FatFs configuration options */
pfe 0:05a20e3e3179 26
pfe 0:05a20e3e3179 27 #if _FATFS != _FFCONF
pfe 0:05a20e3e3179 28 #error Wrong configuration file (ffconf.h).
pfe 0:05a20e3e3179 29 #endif
pfe 0:05a20e3e3179 30
pfe 0:05a20e3e3179 31
pfe 0:05a20e3e3179 32
pfe 0:05a20e3e3179 33 /* Definitions of volume management */
pfe 0:05a20e3e3179 34
pfe 0:05a20e3e3179 35 #if _MULTI_PARTITION /* Multiple partition configuration */
pfe 0:05a20e3e3179 36 typedef struct {
pfe 0:05a20e3e3179 37 BYTE pd; /* Physical drive number */
pfe 0:05a20e3e3179 38 BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
pfe 0:05a20e3e3179 39 } PARTITION;
pfe 0:05a20e3e3179 40 extern PARTITION VolToPart[]; /* Volume - Partition resolution table */
pfe 0:05a20e3e3179 41 #define LD2PD(vol) (VolToPart[vol].pd) /* Get physical drive number */
pfe 0:05a20e3e3179 42 #define LD2PT(vol) (VolToPart[vol].pt) /* Get partition index */
pfe 0:05a20e3e3179 43
pfe 0:05a20e3e3179 44 #else /* Single partition configuration */
pfe 0:05a20e3e3179 45 #define LD2PD(vol) (vol) /* Each logical drive is bound to the same physical drive number */
pfe 0:05a20e3e3179 46 #define LD2PT(vol) 0 /* Always mounts the 1st partition or in SFD */
pfe 0:05a20e3e3179 47
pfe 0:05a20e3e3179 48 #endif
pfe 0:05a20e3e3179 49
pfe 0:05a20e3e3179 50
pfe 0:05a20e3e3179 51
pfe 0:05a20e3e3179 52 /* Type of path name strings on FatFs API */
pfe 0:05a20e3e3179 53
pfe 0:05a20e3e3179 54 #if _LFN_UNICODE /* Unicode string */
pfe 0:05a20e3e3179 55 #if !_USE_LFN
pfe 0:05a20e3e3179 56 #error _LFN_UNICODE must be 0 in non-LFN cfg.
pfe 0:05a20e3e3179 57 #endif
pfe 0:05a20e3e3179 58 #ifndef _INC_TCHAR
pfe 0:05a20e3e3179 59 typedef WCHAR TCHAR;
pfe 0:05a20e3e3179 60 #define _T(x) L ## x
pfe 0:05a20e3e3179 61 #define _TEXT(x) L ## x
pfe 0:05a20e3e3179 62 #endif
pfe 0:05a20e3e3179 63
pfe 0:05a20e3e3179 64 #else /* ANSI/OEM string */
pfe 0:05a20e3e3179 65 #ifndef _INC_TCHAR
pfe 0:05a20e3e3179 66 typedef char TCHAR;
pfe 0:05a20e3e3179 67 #define _T(x) x
pfe 0:05a20e3e3179 68 #define _TEXT(x) x
pfe 0:05a20e3e3179 69 #endif
pfe 0:05a20e3e3179 70
pfe 0:05a20e3e3179 71 #endif
pfe 0:05a20e3e3179 72
pfe 0:05a20e3e3179 73
pfe 0:05a20e3e3179 74
pfe 0:05a20e3e3179 75 /* File system object structure (FATFS) */
pfe 0:05a20e3e3179 76
pfe 0:05a20e3e3179 77 typedef struct {
pfe 0:05a20e3e3179 78 BYTE fs_type; /* FAT sub-type (0:Not mounted) */
pfe 0:05a20e3e3179 79 BYTE drv; /* Physical drive number */
pfe 0:05a20e3e3179 80 BYTE csize; /* Sectors per cluster (1,2,4...128) */
pfe 0:05a20e3e3179 81 BYTE n_fats; /* Number of FAT copies (1,2) */
pfe 0:05a20e3e3179 82 BYTE wflag; /* win[] dirty flag (1:must be written back) */
pfe 0:05a20e3e3179 83 BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */
pfe 0:05a20e3e3179 84 WORD id; /* File system mount ID */
pfe 0:05a20e3e3179 85 WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
pfe 0:05a20e3e3179 86 #if _MAX_SS != 512
pfe 0:05a20e3e3179 87 WORD ssize; /* Bytes per sector (512, 1024, 2048 or 4096) */
pfe 0:05a20e3e3179 88 #endif
pfe 0:05a20e3e3179 89 #if _FS_REENTRANT
pfe 0:05a20e3e3179 90 _SYNC_t sobj; /* Identifier of sync object */
pfe 0:05a20e3e3179 91 #endif
pfe 0:05a20e3e3179 92 #if !_FS_READONLY
pfe 0:05a20e3e3179 93 DWORD last_clust; /* Last allocated cluster */
pfe 0:05a20e3e3179 94 DWORD free_clust; /* Number of free clusters */
pfe 0:05a20e3e3179 95 DWORD fsi_sector; /* fsinfo sector (FAT32) */
pfe 0:05a20e3e3179 96 #endif
pfe 0:05a20e3e3179 97 #if _FS_RPATH
pfe 0:05a20e3e3179 98 DWORD cdir; /* Current directory start cluster (0:root) */
pfe 0:05a20e3e3179 99 #endif
pfe 0:05a20e3e3179 100 DWORD n_fatent; /* Number of FAT entries (= number of clusters + 2) */
pfe 0:05a20e3e3179 101 DWORD fsize; /* Sectors per FAT */
pfe 0:05a20e3e3179 102 DWORD fatbase; /* FAT start sector */
pfe 0:05a20e3e3179 103 DWORD dirbase; /* Root directory start sector (FAT32:Cluster#) */
pfe 0:05a20e3e3179 104 DWORD database; /* Data start sector */
pfe 0:05a20e3e3179 105 DWORD winsect; /* Current sector appearing in the win[] */
pfe 0:05a20e3e3179 106 BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and Data on tiny cfg) */
pfe 0:05a20e3e3179 107 } FATFS;
pfe 0:05a20e3e3179 108
pfe 0:05a20e3e3179 109
pfe 0:05a20e3e3179 110
pfe 0:05a20e3e3179 111 /* File object structure (FIL) */
pfe 0:05a20e3e3179 112
pfe 0:05a20e3e3179 113 typedef struct {
pfe 0:05a20e3e3179 114 FATFS* fs; /* Pointer to the owner file system object */
pfe 0:05a20e3e3179 115 WORD id; /* Owner file system mount ID */
pfe 0:05a20e3e3179 116 BYTE flag; /* File status flags */
pfe 0:05a20e3e3179 117 BYTE pad1;
pfe 0:05a20e3e3179 118 DWORD fptr; /* File read/write pointer (0 on file open) */
pfe 0:05a20e3e3179 119 DWORD fsize; /* File size */
pfe 0:05a20e3e3179 120 DWORD sclust; /* File start cluster (0 when fsize==0) */
pfe 0:05a20e3e3179 121 DWORD clust; /* Current cluster */
pfe 0:05a20e3e3179 122 DWORD dsect; /* Current data sector */
pfe 0:05a20e3e3179 123 #if !_FS_READONLY
pfe 0:05a20e3e3179 124 DWORD dir_sect; /* Sector containing the directory entry */
pfe 0:05a20e3e3179 125 BYTE* dir_ptr; /* Ponter to the directory entry in the window */
pfe 0:05a20e3e3179 126 #endif
pfe 0:05a20e3e3179 127 #if _USE_FASTSEEK
pfe 0:05a20e3e3179 128 DWORD* cltbl; /* Pointer to the cluster link map table (null on file open) */
pfe 0:05a20e3e3179 129 #endif
pfe 0:05a20e3e3179 130 #if _FS_SHARE
pfe 0:05a20e3e3179 131 UINT lockid; /* File lock ID (index of file semaphore table) */
pfe 0:05a20e3e3179 132 #endif
pfe 0:05a20e3e3179 133 #if !_FS_TINY
pfe 0:05a20e3e3179 134 BYTE buf[_MAX_SS]; /* File data read/write buffer */
pfe 0:05a20e3e3179 135 #endif
pfe 0:05a20e3e3179 136 } FIL;
pfe 0:05a20e3e3179 137
pfe 0:05a20e3e3179 138
pfe 0:05a20e3e3179 139
pfe 0:05a20e3e3179 140 /* Directory object structure (FATFS_DIR) */
pfe 0:05a20e3e3179 141
pfe 0:05a20e3e3179 142 typedef struct {
pfe 0:05a20e3e3179 143 FATFS* fs; /* Pointer to the owner file system object */
pfe 0:05a20e3e3179 144 WORD id; /* Owner file system mount ID */
pfe 0:05a20e3e3179 145 WORD index; /* Current read/write index number */
pfe 0:05a20e3e3179 146 DWORD sclust; /* Table start cluster (0:Root dir) */
pfe 0:05a20e3e3179 147 DWORD clust; /* Current cluster */
pfe 0:05a20e3e3179 148 DWORD sect; /* Current sector */
pfe 0:05a20e3e3179 149 BYTE* dir; /* Pointer to the current SFN entry in the win[] */
pfe 0:05a20e3e3179 150 BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
pfe 0:05a20e3e3179 151 #if _USE_LFN
pfe 0:05a20e3e3179 152 WCHAR* lfn; /* Pointer to the LFN working buffer */
pfe 0:05a20e3e3179 153 WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */
pfe 0:05a20e3e3179 154 #endif
pfe 0:05a20e3e3179 155 } FATFS_DIR;
pfe 0:05a20e3e3179 156
pfe 0:05a20e3e3179 157
pfe 0:05a20e3e3179 158
pfe 0:05a20e3e3179 159 /* File status structure (FILINFO) */
pfe 0:05a20e3e3179 160
pfe 0:05a20e3e3179 161 typedef struct {
pfe 0:05a20e3e3179 162 DWORD fsize; /* File size */
pfe 0:05a20e3e3179 163 WORD fdate; /* Last modified date */
pfe 0:05a20e3e3179 164 WORD ftime; /* Last modified time */
pfe 0:05a20e3e3179 165 BYTE fattrib; /* Attribute */
pfe 0:05a20e3e3179 166 TCHAR fname[13]; /* Short file name (8.3 format) */
pfe 0:05a20e3e3179 167 #if _USE_LFN
pfe 0:05a20e3e3179 168 TCHAR* lfname; /* Pointer to the LFN buffer */
pfe 0:05a20e3e3179 169 UINT lfsize; /* Size of LFN buffer in TCHAR */
pfe 0:05a20e3e3179 170 #endif
pfe 0:05a20e3e3179 171 } FILINFO;
pfe 0:05a20e3e3179 172
pfe 0:05a20e3e3179 173
pfe 0:05a20e3e3179 174
pfe 0:05a20e3e3179 175 /* File function return code (FRESULT) */
pfe 0:05a20e3e3179 176
pfe 0:05a20e3e3179 177 typedef enum {
pfe 0:05a20e3e3179 178 FR_OK = 0, /* (0) Succeeded */
pfe 0:05a20e3e3179 179 FR_DISK_ERR, /* (1) A hard error occured in the low level disk I/O layer */
pfe 0:05a20e3e3179 180 FR_INT_ERR, /* (2) Assertion failed */
pfe 0:05a20e3e3179 181 FR_NOT_READY, /* (3) The physical drive cannot work */
pfe 0:05a20e3e3179 182 FR_NO_FILE, /* (4) Could not find the file */
pfe 0:05a20e3e3179 183 FR_NO_PATH, /* (5) Could not find the path */
pfe 0:05a20e3e3179 184 FR_INVALID_NAME, /* (6) The path name format is invalid */
pfe 0:05a20e3e3179 185 FR_DENIED, /* (7) Acces denied due to prohibited access or directory full */
pfe 0:05a20e3e3179 186 FR_EXIST, /* (8) Acces denied due to prohibited access */
pfe 0:05a20e3e3179 187 FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
pfe 0:05a20e3e3179 188 FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
pfe 0:05a20e3e3179 189 FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
pfe 0:05a20e3e3179 190 FR_NOT_ENABLED, /* (12) The volume has no work area */
pfe 0:05a20e3e3179 191 FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
pfe 0:05a20e3e3179 192 FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any parameter error */
pfe 0:05a20e3e3179 193 FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
pfe 0:05a20e3e3179 194 FR_LOCKED, /* (16) The operation is rejected according to the file shareing policy */
pfe 0:05a20e3e3179 195 FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
pfe 0:05a20e3e3179 196 FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_SHARE */
pfe 0:05a20e3e3179 197 FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
pfe 0:05a20e3e3179 198 } FRESULT;
pfe 0:05a20e3e3179 199
pfe 0:05a20e3e3179 200
pfe 0:05a20e3e3179 201
pfe 0:05a20e3e3179 202 /*--------------------------------------------------------------*/
pfe 0:05a20e3e3179 203 /* FatFs module application interface */
pfe 0:05a20e3e3179 204
pfe 0:05a20e3e3179 205 FRESULT f_mount (BYTE, FATFS*); /* Mount/Unmount a logical drive */
pfe 0:05a20e3e3179 206 FRESULT f_open (FIL*, const TCHAR*, BYTE); /* Open or create a file */
pfe 0:05a20e3e3179 207 FRESULT f_read (FIL*, void*, UINT, UINT*); /* Read data from a file */
pfe 0:05a20e3e3179 208 FRESULT f_lseek (FIL*, DWORD); /* Move file pointer of a file object */
pfe 0:05a20e3e3179 209 FRESULT f_close (FIL*); /* Close an open file object */
pfe 0:05a20e3e3179 210 FRESULT f_opendir (FATFS_DIR*, const TCHAR*); /* Open an existing directory */
pfe 0:05a20e3e3179 211 FRESULT f_readdir (FATFS_DIR*, FILINFO*); /* Read a directory item */
pfe 0:05a20e3e3179 212 FRESULT f_stat (const TCHAR*, FILINFO*); /* Get file status */
pfe 0:05a20e3e3179 213 FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */
pfe 0:05a20e3e3179 214 FRESULT f_getfree (const TCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */
pfe 0:05a20e3e3179 215 FRESULT f_truncate (FIL*); /* Truncate file */
pfe 0:05a20e3e3179 216 FRESULT f_sync (FIL*); /* Flush cached data of a writing file */
pfe 0:05a20e3e3179 217 FRESULT f_unlink (const TCHAR*); /* Delete an existing file or directory */
pfe 0:05a20e3e3179 218 FRESULT f_mkdir (const TCHAR*); /* Create a new directory */
pfe 0:05a20e3e3179 219 FRESULT f_chmod (const TCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */
pfe 0:05a20e3e3179 220 FRESULT f_utime (const TCHAR*, const FILINFO*); /* Change timestamp of the file/dir */
pfe 0:05a20e3e3179 221 FRESULT f_rename (const TCHAR*, const TCHAR*); /* Rename/Move a file or directory */
pfe 0:05a20e3e3179 222 FRESULT f_chdrive (BYTE); /* Change current drive */
pfe 0:05a20e3e3179 223 FRESULT f_chdir (const TCHAR*); /* Change current directory */
pfe 0:05a20e3e3179 224 FRESULT f_getcwd (TCHAR*, UINT); /* Get current directory */
pfe 0:05a20e3e3179 225 FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */
pfe 0:05a20e3e3179 226 FRESULT f_mkfs (BYTE, BYTE, UINT); /* Create a file system on the drive */
pfe 0:05a20e3e3179 227 FRESULT f_fdisk (BYTE, const DWORD[], void*); /* Divide a physical drive into some partitions */
pfe 0:05a20e3e3179 228 int f_putc (TCHAR, FIL*); /* Put a character to the file */
pfe 0:05a20e3e3179 229 int f_puts (const TCHAR*, FIL*); /* Put a string to the file */
pfe 0:05a20e3e3179 230 int f_printf (FIL*, const TCHAR*, ...); /* Put a formatted string to the file */
pfe 0:05a20e3e3179 231 TCHAR* f_gets (TCHAR*, int, FIL*); /* Get a string from the file */
pfe 0:05a20e3e3179 232
pfe 0:05a20e3e3179 233 #define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
pfe 0:05a20e3e3179 234 #define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
pfe 0:05a20e3e3179 235 #define f_tell(fp) ((fp)->fptr)
pfe 0:05a20e3e3179 236 #define f_size(fp) ((fp)->fsize)
pfe 0:05a20e3e3179 237
pfe 0:05a20e3e3179 238 #ifndef EOF
pfe 0:05a20e3e3179 239 #define EOF (-1)
pfe 0:05a20e3e3179 240 #endif
pfe 0:05a20e3e3179 241
pfe 0:05a20e3e3179 242
pfe 0:05a20e3e3179 243
pfe 0:05a20e3e3179 244
pfe 0:05a20e3e3179 245 /*--------------------------------------------------------------*/
pfe 0:05a20e3e3179 246 /* Additional user defined functions */
pfe 0:05a20e3e3179 247
pfe 0:05a20e3e3179 248 /* RTC function */
pfe 0:05a20e3e3179 249 #if !_FS_READONLY
pfe 0:05a20e3e3179 250 DWORD get_fattime (void);
pfe 0:05a20e3e3179 251 #endif
pfe 0:05a20e3e3179 252
pfe 0:05a20e3e3179 253 /* Unicode support functions */
pfe 0:05a20e3e3179 254 #if _USE_LFN /* Unicode - OEM code conversion */
pfe 0:05a20e3e3179 255 WCHAR ff_convert (WCHAR, UINT); /* OEM-Unicode bidirectional conversion */
pfe 0:05a20e3e3179 256 WCHAR ff_wtoupper (WCHAR); /* Unicode upper-case conversion */
pfe 0:05a20e3e3179 257 #if _USE_LFN == 3 /* Memory functions */
pfe 0:05a20e3e3179 258 void* ff_memalloc (UINT); /* Allocate memory block */
pfe 0:05a20e3e3179 259 void ff_memfree (void*); /* Free memory block */
pfe 0:05a20e3e3179 260 #endif
pfe 0:05a20e3e3179 261 #endif
pfe 0:05a20e3e3179 262
pfe 0:05a20e3e3179 263 /* Sync functions */
pfe 0:05a20e3e3179 264 #if _FS_REENTRANT
pfe 0:05a20e3e3179 265 int ff_cre_syncobj (BYTE, _SYNC_t*);/* Create a sync object */
pfe 0:05a20e3e3179 266 int ff_req_grant (_SYNC_t); /* Lock sync object */
pfe 0:05a20e3e3179 267 void ff_rel_grant (_SYNC_t); /* Unlock sync object */
pfe 0:05a20e3e3179 268 int ff_del_syncobj (_SYNC_t); /* Delete a sync object */
pfe 0:05a20e3e3179 269 #endif
pfe 0:05a20e3e3179 270
pfe 0:05a20e3e3179 271
pfe 0:05a20e3e3179 272
pfe 0:05a20e3e3179 273
pfe 0:05a20e3e3179 274 /*--------------------------------------------------------------*/
pfe 0:05a20e3e3179 275 /* Flags and offset address */
pfe 0:05a20e3e3179 276
pfe 0:05a20e3e3179 277
pfe 0:05a20e3e3179 278 /* File access control and file status flags (FIL.flag) */
pfe 0:05a20e3e3179 279
pfe 0:05a20e3e3179 280 #define FA_READ 0x01
pfe 0:05a20e3e3179 281 #define FA_OPEN_EXISTING 0x00
pfe 0:05a20e3e3179 282 #define FA__ERROR 0x80
pfe 0:05a20e3e3179 283
pfe 0:05a20e3e3179 284 #if !_FS_READONLY
pfe 0:05a20e3e3179 285 #define FA_WRITE 0x02
pfe 0:05a20e3e3179 286 #define FA_CREATE_NEW 0x04
pfe 0:05a20e3e3179 287 #define FA_CREATE_ALWAYS 0x08
pfe 0:05a20e3e3179 288 #define FA_OPEN_ALWAYS 0x10
pfe 0:05a20e3e3179 289 #define FA__WRITTEN 0x20
pfe 0:05a20e3e3179 290 #define FA__DIRTY 0x40
pfe 0:05a20e3e3179 291 #endif
pfe 0:05a20e3e3179 292
pfe 0:05a20e3e3179 293
pfe 0:05a20e3e3179 294 /* FAT sub type (FATFS.fs_type) */
pfe 0:05a20e3e3179 295
pfe 0:05a20e3e3179 296 #define FS_FAT12 1
pfe 0:05a20e3e3179 297 #define FS_FAT16 2
pfe 0:05a20e3e3179 298 #define FS_FAT32 3
pfe 0:05a20e3e3179 299
pfe 0:05a20e3e3179 300
pfe 0:05a20e3e3179 301 /* File attribute bits for directory entry */
pfe 0:05a20e3e3179 302
pfe 0:05a20e3e3179 303 #define AM_RDO 0x01 /* Read only */
pfe 0:05a20e3e3179 304 #define AM_HID 0x02 /* Hidden */
pfe 0:05a20e3e3179 305 #define AM_SYS 0x04 /* System */
pfe 0:05a20e3e3179 306 #define AM_VOL 0x08 /* Volume label */
pfe 0:05a20e3e3179 307 #define AM_LFN 0x0F /* LFN entry */
pfe 0:05a20e3e3179 308 #define AM_DIR 0x10 /* Directory */
pfe 0:05a20e3e3179 309 #define AM_ARC 0x20 /* Archive */
pfe 0:05a20e3e3179 310 #define AM_MASK 0x3F /* Mask of defined bits */
pfe 0:05a20e3e3179 311
pfe 0:05a20e3e3179 312
pfe 0:05a20e3e3179 313 /* Fast seek feature */
pfe 0:05a20e3e3179 314 #define CREATE_LINKMAP 0xFFFFFFFF
pfe 0:05a20e3e3179 315
pfe 0:05a20e3e3179 316
pfe 0:05a20e3e3179 317
pfe 0:05a20e3e3179 318 /*--------------------------------*/
pfe 0:05a20e3e3179 319 /* Multi-byte word access macros */
pfe 0:05a20e3e3179 320
pfe 0:05a20e3e3179 321 #if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
pfe 0:05a20e3e3179 322 #define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
pfe 0:05a20e3e3179 323 #define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
pfe 0:05a20e3e3179 324 #define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
pfe 0:05a20e3e3179 325 #define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
pfe 0:05a20e3e3179 326 #else /* Use byte-by-byte access to the FAT structure */
pfe 0:05a20e3e3179 327 #define LD_WORD(ptr) (WORD)(((WORD)*((BYTE*)(ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
pfe 0:05a20e3e3179 328 #define LD_DWORD(ptr) (DWORD)(((DWORD)*((BYTE*)(ptr)+3)<<24)|((DWORD)*((BYTE*)(ptr)+2)<<16)|((WORD)*((BYTE*)(ptr)+1)<<8)|*(BYTE*)(ptr))
pfe 0:05a20e3e3179 329 #define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8)
pfe 0:05a20e3e3179 330 #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)
pfe 0:05a20e3e3179 331 #endif
pfe 0:05a20e3e3179 332
pfe 0:05a20e3e3179 333 #ifdef __cplusplus
pfe 0:05a20e3e3179 334 }
pfe 0:05a20e3e3179 335 #endif
pfe 0:05a20e3e3179 336
pfe 0:05a20e3e3179 337 #endif /* _FATFS */