Dependencies:   mbed

Committer:
simon
Date:
Thu Jan 12 12:59:33 2012 +0000
Revision:
1:208803a150b2
Parent:
0:560a6744936c
fix on line 61 of diskio, sector -> s

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 0:560a6744936c 1 /*--------------------------------------------------------------------------/
simon 0:560a6744936c 2 / FatFs - FAT file system module include file R0.06 (C)ChaN, 2008
simon 0:560a6744936c 3 /---------------------------------------------------------------------------/
simon 0:560a6744936c 4 / FatFs module is an experimenal project to implement FAT file system to
simon 0:560a6744936c 5 / cheap microcontrollers. This is a free software and is opened for education,
simon 0:560a6744936c 6 / research and development under license policy of following trems.
simon 0:560a6744936c 7 /
simon 0:560a6744936c 8 / Copyright (C) 2008, ChaN, all right reserved.
simon 0:560a6744936c 9 /
simon 0:560a6744936c 10 / * The FatFs module is a free software and there is no warranty.
simon 0:560a6744936c 11 / * You can use, modify and/or redistribute it for personal, non-profit or
simon 0:560a6744936c 12 / commercial use without any restriction under your responsibility.
simon 0:560a6744936c 13 / * Redistributions of source code must retain the above copyright notice.
simon 0:560a6744936c 14 /
simon 0:560a6744936c 15 /---------------------------------------------------------------------------*/
simon 0:560a6744936c 16
simon 0:560a6744936c 17 #ifndef _FATFS
simon 0:560a6744936c 18
simon 0:560a6744936c 19 #define _MCU_ENDIAN 2
simon 0:560a6744936c 20 /* The _MCU_ENDIAN defines which access method is used to the FAT structure.
simon 0:560a6744936c 21 / 1: Enable word access.
simon 0:560a6744936c 22 / 2: Disable word access and use byte-by-byte access instead.
simon 0:560a6744936c 23 / When the architectural byte order of the MCU is big-endian and/or address
simon 0:560a6744936c 24 / miss-aligned access results incorrect behavior, the _MCU_ENDIAN must be set to 2.
simon 0:560a6744936c 25 / If it is not the case, it can also be set to 1 for good code efficiency. */
simon 0:560a6744936c 26
simon 0:560a6744936c 27 #define _FS_READONLY 0
simon 0:560a6744936c 28 /* Setting _FS_READONLY to 1 defines read only configuration. This removes
simon 0:560a6744936c 29 / writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
simon 0:560a6744936c 30 / f_truncate and useless f_getfree. */
simon 0:560a6744936c 31
simon 0:560a6744936c 32 #define _FS_MINIMIZE 0
simon 0:560a6744936c 33 /* The _FS_MINIMIZE option defines minimization level to remove some functions.
simon 0:560a6744936c 34 / 0: Full function.
simon 0:560a6744936c 35 / 1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename are removed.
simon 0:560a6744936c 36 / 2: f_opendir and f_readdir are removed in addition to level 1.
simon 0:560a6744936c 37 / 3: f_lseek is removed in addition to level 2. */
simon 0:560a6744936c 38
simon 0:560a6744936c 39 #define _USE_STRFUNC 0
simon 0:560a6744936c 40 /* To enable string functions, set _USE_STRFUNC to 1 or 2. */
simon 0:560a6744936c 41
simon 0:560a6744936c 42 #define _USE_MKFS 1
simon 0:560a6744936c 43 /* When _USE_MKFS is set to 1 and _FS_READONLY is set to 0, f_mkfs function is
simon 0:560a6744936c 44 / enabled. */
simon 0:560a6744936c 45
simon 0:560a6744936c 46 #define _DRIVES 4
simon 0:560a6744936c 47 /* Number of logical drives to be used. This affects the size of internal table. */
simon 0:560a6744936c 48
simon 0:560a6744936c 49 #define _MULTI_PARTITION 0
simon 0:560a6744936c 50 /* When _MULTI_PARTITION is set to 0, each logical drive is bound to same
simon 0:560a6744936c 51 / physical drive number and can mount only 1st primaly partition. When it is
simon 0:560a6744936c 52 / set to 1, each logical drive can mount a partition listed in Drives[]. */
simon 0:560a6744936c 53
simon 0:560a6744936c 54 #define _USE_FSINFO 0
simon 0:560a6744936c 55 /* To enable FSInfo support on FAT32 volume, set _USE_FSINFO to 1. */
simon 0:560a6744936c 56
simon 0:560a6744936c 57 #define _USE_SJIS 1
simon 0:560a6744936c 58 /* When _USE_SJIS is set to 1, Shift-JIS code transparency is enabled, otherwise
simon 0:560a6744936c 59 / only US-ASCII(7bit) code can be accepted as file/directory name. */
simon 0:560a6744936c 60
simon 0:560a6744936c 61 #define _USE_NTFLAG 1
simon 0:560a6744936c 62 /* When _USE_NTFLAG is set to 1, upper/lower case of the file name is preserved.
simon 0:560a6744936c 63 / Note that the files are always accessed in case insensitive. */
simon 0:560a6744936c 64
simon 0:560a6744936c 65
simon 0:560a6744936c 66 #include "integer.h"
simon 0:560a6744936c 67
simon 0:560a6744936c 68
simon 0:560a6744936c 69
simon 0:560a6744936c 70 /* Definitions corresponds to multiple sector size (not tested) */
simon 0:560a6744936c 71 #define S_MAX_SIZ 512U /* Do not change */
simon 0:560a6744936c 72 #if S_MAX_SIZ > 512U
simon 0:560a6744936c 73 #define SS(fs) ((fs)->s_size)
simon 0:560a6744936c 74 #else
simon 0:560a6744936c 75 #define SS(fs) 512U
simon 0:560a6744936c 76 #endif
simon 0:560a6744936c 77
simon 0:560a6744936c 78
simon 0:560a6744936c 79 /* File system object structure */
simon 0:560a6744936c 80 typedef struct _FATFS {
simon 0:560a6744936c 81 WORD id; /* File system mount ID */
simon 0:560a6744936c 82 WORD n_rootdir; /* Number of root directory entries */
simon 0:560a6744936c 83 DWORD winsect; /* Current sector appearing in the win[] */
simon 0:560a6744936c 84 DWORD sects_fat; /* Sectors per fat */
simon 0:560a6744936c 85 DWORD max_clust; /* Maximum cluster# + 1 */
simon 0:560a6744936c 86 DWORD fatbase; /* FAT start sector */
simon 0:560a6744936c 87 DWORD dirbase; /* Root directory start sector (cluster# for FAT32) */
simon 0:560a6744936c 88 DWORD database; /* Data start sector */
simon 0:560a6744936c 89 #if !_FS_READONLY
simon 0:560a6744936c 90 DWORD last_clust; /* Last allocated cluster */
simon 0:560a6744936c 91 DWORD free_clust; /* Number of free clusters */
simon 0:560a6744936c 92 #if _USE_FSINFO
simon 0:560a6744936c 93 DWORD fsi_sector; /* fsinfo sector */
simon 0:560a6744936c 94 BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */
simon 0:560a6744936c 95 BYTE pad2;
simon 0:560a6744936c 96 #endif
simon 0:560a6744936c 97 #endif
simon 0:560a6744936c 98 BYTE fs_type; /* FAT sub type */
simon 0:560a6744936c 99 BYTE csize; /* Number of sectors per cluster */
simon 0:560a6744936c 100 #if S_MAX_SIZ > 512U
simon 0:560a6744936c 101 WORD s_size; /* Sector size */
simon 0:560a6744936c 102 #endif
simon 0:560a6744936c 103 BYTE n_fats; /* Number of FAT copies */
simon 0:560a6744936c 104 BYTE drive; /* Physical drive number */
simon 0:560a6744936c 105 BYTE winflag; /* win[] dirty flag (1:must be written back) */
simon 0:560a6744936c 106 BYTE pad1;
simon 0:560a6744936c 107 BYTE win[S_MAX_SIZ]; /* Disk access window for Directory/FAT */
simon 0:560a6744936c 108 } FATFS;
simon 0:560a6744936c 109
simon 0:560a6744936c 110
simon 0:560a6744936c 111 /* Directory object structure */
simon 0:560a6744936c 112 typedef struct _DIR {
simon 0:560a6744936c 113 WORD id; /* Owner file system mount ID */
simon 0:560a6744936c 114 WORD index; /* Current index */
simon 0:560a6744936c 115 FATFS* fs; /* Pointer to the owner file system object */
simon 0:560a6744936c 116 DWORD sclust; /* Start cluster */
simon 0:560a6744936c 117 DWORD clust; /* Current cluster */
simon 0:560a6744936c 118 DWORD sect; /* Current sector */
simon 0:560a6744936c 119 } FATFS_DIR;
simon 0:560a6744936c 120
simon 0:560a6744936c 121
simon 0:560a6744936c 122 /* File object structure */
simon 0:560a6744936c 123 typedef struct _FIL {
simon 0:560a6744936c 124 WORD id; /* Owner file system mount ID */
simon 0:560a6744936c 125 BYTE flag; /* File status flags */
simon 0:560a6744936c 126 BYTE csect; /* Sector address in the cluster */
simon 0:560a6744936c 127 FATFS* fs; /* Pointer to the owner file system object */
simon 0:560a6744936c 128 DWORD fptr; /* File R/W pointer */
simon 0:560a6744936c 129 DWORD fsize; /* File size */
simon 0:560a6744936c 130 DWORD org_clust; /* File start cluster */
simon 0:560a6744936c 131 DWORD curr_clust; /* Current cluster */
simon 0:560a6744936c 132 DWORD curr_sect; /* Current sector */
simon 0:560a6744936c 133 #if _FS_READONLY == 0
simon 0:560a6744936c 134 DWORD dir_sect; /* Sector containing the directory entry */
simon 0:560a6744936c 135 BYTE* dir_ptr; /* Ponter to the directory entry in the window */
simon 0:560a6744936c 136 #endif
simon 0:560a6744936c 137 BYTE buffer[S_MAX_SIZ]; /* File R/W buffer */
simon 0:560a6744936c 138 } FIL;
simon 0:560a6744936c 139
simon 0:560a6744936c 140
simon 0:560a6744936c 141 /* File status structure */
simon 0:560a6744936c 142 typedef struct _FILINFO {
simon 0:560a6744936c 143 DWORD fsize; /* Size */
simon 0:560a6744936c 144 WORD fdate; /* Date */
simon 0:560a6744936c 145 WORD ftime; /* Time */
simon 0:560a6744936c 146 BYTE fattrib; /* Attribute */
simon 0:560a6744936c 147 char fname[8+1+3+1]; /* Name (8.3 format) */
simon 0:560a6744936c 148 } FILINFO;
simon 0:560a6744936c 149
simon 0:560a6744936c 150
simon 0:560a6744936c 151
simon 0:560a6744936c 152 /* Definitions corresponds to multi partition */
simon 0:560a6744936c 153
simon 0:560a6744936c 154 #if _MULTI_PARTITION != 0 /* Multiple partition cfg */
simon 0:560a6744936c 155
simon 0:560a6744936c 156 typedef struct _PARTITION {
simon 0:560a6744936c 157 BYTE pd; /* Physical drive # (0-255) */
simon 0:560a6744936c 158 BYTE pt; /* Partition # (0-3) */
simon 0:560a6744936c 159 } PARTITION;
simon 0:560a6744936c 160 extern
simon 0:560a6744936c 161 const PARTITION Drives[]; /* Logical drive# to physical location conversion table */
simon 0:560a6744936c 162 #define LD2PD(drv) (Drives[drv].pd) /* Get physical drive# */
simon 0:560a6744936c 163 #define LD2PT(drv) (Drives[drv].pt) /* Get partition# */
simon 0:560a6744936c 164
simon 0:560a6744936c 165 #else /* Single partition cfg */
simon 0:560a6744936c 166
simon 0:560a6744936c 167 #define LD2PD(drv) (drv) /* Physical drive# is equal to logical drive# */
simon 0:560a6744936c 168 #define LD2PT(drv) 0 /* Always mounts the 1st partition */
simon 0:560a6744936c 169
simon 0:560a6744936c 170 #endif
simon 0:560a6744936c 171
simon 0:560a6744936c 172
simon 0:560a6744936c 173 /* File function return code (FRESULT) */
simon 0:560a6744936c 174
simon 0:560a6744936c 175 typedef enum {
simon 0:560a6744936c 176 FR_OK = 0, /* 0 */
simon 0:560a6744936c 177 FR_NOT_READY, /* 1 */
simon 0:560a6744936c 178 FR_NO_FILE, /* 2 */
simon 0:560a6744936c 179 FR_NO_PATH, /* 3 */
simon 0:560a6744936c 180 FR_INVALID_NAME, /* 4 */
simon 0:560a6744936c 181 FR_INVALID_DRIVE, /* 5 */
simon 0:560a6744936c 182 FR_DENIED, /* 6 */
simon 0:560a6744936c 183 FR_EXIST, /* 7 */
simon 0:560a6744936c 184 FR_RW_ERROR, /* 8 */
simon 0:560a6744936c 185 FR_WRITE_PROTECTED, /* 9 */
simon 0:560a6744936c 186 FR_NOT_ENABLED, /* 10 */
simon 0:560a6744936c 187 FR_NO_FILESYSTEM, /* 11 */
simon 0:560a6744936c 188 FR_INVALID_OBJECT, /* 12 */
simon 0:560a6744936c 189 FR_MKFS_ABORTED /* 13 */
simon 0:560a6744936c 190 } FRESULT;
simon 0:560a6744936c 191
simon 0:560a6744936c 192
simon 0:560a6744936c 193
simon 0:560a6744936c 194 /*-----------------------------------------------------*/
simon 0:560a6744936c 195 /* FatFs module application interface */
simon 0:560a6744936c 196
simon 0:560a6744936c 197 FRESULT f_mount (BYTE, FATFS*); /* Mount/Unmount a logical drive */
simon 0:560a6744936c 198 FRESULT f_open (FIL*, const char*, BYTE); /* Open or create a file */
simon 0:560a6744936c 199 FRESULT f_read (FIL*, void*, UINT, UINT*); /* Read data from a file */
simon 0:560a6744936c 200 FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */
simon 0:560a6744936c 201 FRESULT f_lseek (FIL*, DWORD); /* Move file pointer of a file object */
simon 0:560a6744936c 202 FRESULT f_close (FIL*); /* Close an open file object */
simon 0:560a6744936c 203 FRESULT f_opendir (FATFS_DIR*, const char*); /* Open an existing directory */
simon 0:560a6744936c 204 FRESULT f_readdir (FATFS_DIR*, FILINFO*); /* Read a directory item */
simon 0:560a6744936c 205 FRESULT f_stat (const char*, FILINFO*); /* Get file status */
simon 0:560a6744936c 206 FRESULT f_getfree (const char*, DWORD*, FATFS**); /* Get number of free clusters on the drive */
simon 0:560a6744936c 207 FRESULT f_truncate (FIL*); /* Truncate file */
simon 0:560a6744936c 208 FRESULT f_sync (FIL*); /* Flush cached data of a writing file */
simon 0:560a6744936c 209 FRESULT f_unlink (const char*); /* Delete an existing file or directory */
simon 0:560a6744936c 210 FRESULT f_mkdir (const char*); /* Create a new directory */
simon 0:560a6744936c 211 FRESULT f_chmod (const char*, BYTE, BYTE); /* Change file/dir attriburte */
simon 0:560a6744936c 212 FRESULT f_utime (const char*, const FILINFO*); /* Change file/dir timestamp */
simon 0:560a6744936c 213 FRESULT f_rename (const char*, const char*); /* Rename/Move a file or directory */
simon 0:560a6744936c 214 FRESULT f_mkfs (BYTE, BYTE, WORD); /* Create a file system on the drive */
simon 0:560a6744936c 215 #if _USE_STRFUNC
simon 0:560a6744936c 216 #define feof(fp) ((fp)->fptr == (fp)->fsize)
simon 0:560a6744936c 217 #define EOF -1
simon 0:560a6744936c 218 int fputc (int, FIL*); /* Put a character to the file */
simon 0:560a6744936c 219 int fputs (const char*, FIL*); /* Put a string to the file */
simon 0:560a6744936c 220 int fprintf (FIL*, const char*, ...); /* Put a formatted string to the file */
simon 0:560a6744936c 221 char* fgets (char*, int, FIL*); /* Get a string from the file */
simon 0:560a6744936c 222 #endif
simon 0:560a6744936c 223
simon 0:560a6744936c 224 /* User defined function to give a current time to fatfs module */
simon 0:560a6744936c 225
simon 0:560a6744936c 226 DWORD get_fattime (void); /* 31-25: Year(0-127 org.1980), 24-21: Month(1-12), 20-16: Day(1-31) */
simon 0:560a6744936c 227 /* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */
simon 0:560a6744936c 228
simon 0:560a6744936c 229
simon 0:560a6744936c 230
simon 0:560a6744936c 231 /* File access control and file status flags (FIL.flag) */
simon 0:560a6744936c 232
simon 0:560a6744936c 233 #define FA_READ 0x01
simon 0:560a6744936c 234 #define FA_OPEN_EXISTING 0x00
simon 0:560a6744936c 235 #if _FS_READONLY == 0
simon 0:560a6744936c 236 #define FA_WRITE 0x02
simon 0:560a6744936c 237 #define FA_CREATE_NEW 0x04
simon 0:560a6744936c 238 #define FA_CREATE_ALWAYS 0x08
simon 0:560a6744936c 239 #define FA_OPEN_ALWAYS 0x10
simon 0:560a6744936c 240 #define FA__WRITTEN 0x20
simon 0:560a6744936c 241 #define FA__DIRTY 0x40
simon 0:560a6744936c 242 #endif
simon 0:560a6744936c 243 #define FA__ERROR 0x80
simon 0:560a6744936c 244
simon 0:560a6744936c 245
simon 0:560a6744936c 246 /* FAT sub type (FATFS.fs_type) */
simon 0:560a6744936c 247
simon 0:560a6744936c 248 #define FS_FAT12 1
simon 0:560a6744936c 249 #define FS_FAT16 2
simon 0:560a6744936c 250 #define FS_FAT32 3
simon 0:560a6744936c 251
simon 0:560a6744936c 252
simon 0:560a6744936c 253 /* File attribute bits for directory entry */
simon 0:560a6744936c 254
simon 0:560a6744936c 255 #define AM_RDO 0x01 /* Read only */
simon 0:560a6744936c 256 #define AM_HID 0x02 /* Hidden */
simon 0:560a6744936c 257 #define AM_SYS 0x04 /* System */
simon 0:560a6744936c 258 #define AM_VOL 0x08 /* Volume label */
simon 0:560a6744936c 259 #define AM_LFN 0x0F /* LFN entry */
simon 0:560a6744936c 260 #define AM_DIR 0x10 /* Directory */
simon 0:560a6744936c 261 #define AM_ARC 0x20 /* Archive */
simon 0:560a6744936c 262
simon 0:560a6744936c 263
simon 0:560a6744936c 264
simon 0:560a6744936c 265 /* Offset of FAT structure members */
simon 0:560a6744936c 266
simon 0:560a6744936c 267 #define BS_jmpBoot 0
simon 0:560a6744936c 268 #define BS_OEMName 3
simon 0:560a6744936c 269 #define BPB_BytsPerSec 11
simon 0:560a6744936c 270 #define BPB_SecPerClus 13
simon 0:560a6744936c 271 #define BPB_RsvdSecCnt 14
simon 0:560a6744936c 272 #define BPB_NumFATs 16
simon 0:560a6744936c 273 #define BPB_RootEntCnt 17
simon 0:560a6744936c 274 #define BPB_TotSec16 19
simon 0:560a6744936c 275 #define BPB_Media 21
simon 0:560a6744936c 276 #define BPB_FATSz16 22
simon 0:560a6744936c 277 #define BPB_SecPerTrk 24
simon 0:560a6744936c 278 #define BPB_NumHeads 26
simon 0:560a6744936c 279 #define BPB_HiddSec 28
simon 0:560a6744936c 280 #define BPB_TotSec32 32
simon 0:560a6744936c 281 #define BS_55AA 510
simon 0:560a6744936c 282
simon 0:560a6744936c 283 #define BS_DrvNum 36
simon 0:560a6744936c 284 #define BS_BootSig 38
simon 0:560a6744936c 285 #define BS_VolID 39
simon 0:560a6744936c 286 #define BS_VolLab 43
simon 0:560a6744936c 287 #define BS_FilSysType 54
simon 0:560a6744936c 288
simon 0:560a6744936c 289 #define BPB_FATSz32 36
simon 0:560a6744936c 290 #define BPB_ExtFlags 40
simon 0:560a6744936c 291 #define BPB_FSVer 42
simon 0:560a6744936c 292 #define BPB_RootClus 44
simon 0:560a6744936c 293 #define BPB_FSInfo 48
simon 0:560a6744936c 294 #define BPB_BkBootSec 50
simon 0:560a6744936c 295 #define BS_DrvNum32 64
simon 0:560a6744936c 296 #define BS_BootSig32 66
simon 0:560a6744936c 297 #define BS_VolID32 67
simon 0:560a6744936c 298 #define BS_VolLab32 71
simon 0:560a6744936c 299 #define BS_FilSysType32 82
simon 0:560a6744936c 300
simon 0:560a6744936c 301 #define FSI_LeadSig 0
simon 0:560a6744936c 302 #define FSI_StrucSig 484
simon 0:560a6744936c 303 #define FSI_Free_Count 488
simon 0:560a6744936c 304 #define FSI_Nxt_Free 492
simon 0:560a6744936c 305
simon 0:560a6744936c 306 #define MBR_Table 446
simon 0:560a6744936c 307
simon 0:560a6744936c 308 #define DIR_Name 0
simon 0:560a6744936c 309 #define DIR_Attr 11
simon 0:560a6744936c 310 #define DIR_NTres 12
simon 0:560a6744936c 311 #define DIR_CrtTime 14
simon 0:560a6744936c 312 #define DIR_CrtDate 16
simon 0:560a6744936c 313 #define DIR_FstClusHI 20
simon 0:560a6744936c 314 #define DIR_WrtTime 22
simon 0:560a6744936c 315 #define DIR_WrtDate 24
simon 0:560a6744936c 316 #define DIR_FstClusLO 26
simon 0:560a6744936c 317 #define DIR_FileSize 28
simon 0:560a6744936c 318
simon 0:560a6744936c 319
simon 0:560a6744936c 320
simon 0:560a6744936c 321 /* Multi-byte word access macros */
simon 0:560a6744936c 322
simon 0:560a6744936c 323 #if _MCU_ENDIAN == 1 /* Use word access */
simon 0:560a6744936c 324 #define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
simon 0:560a6744936c 325 #define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
simon 0:560a6744936c 326 #define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
simon 0:560a6744936c 327 #define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
simon 0:560a6744936c 328 #elif _MCU_ENDIAN == 2 /* Use byte-by-byte access */
simon 0:560a6744936c 329 #define LD_WORD(ptr) (WORD)(((WORD)*(volatile BYTE*)((ptr)+1)<<8)|(WORD)*(volatile BYTE*)(ptr))
simon 0:560a6744936c 330 #define LD_DWORD(ptr) (DWORD)(((DWORD)*(volatile BYTE*)((ptr)+3)<<24)|((DWORD)*(volatile BYTE*)((ptr)+2)<<16)|((WORD)*(volatile BYTE*)((ptr)+1)<<8)|*(volatile BYTE*)(ptr))
simon 0:560a6744936c 331 #define ST_WORD(ptr,val) *(volatile BYTE*)(ptr)=(BYTE)(val); *(volatile BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
simon 0:560a6744936c 332 #define ST_DWORD(ptr,val) *(volatile BYTE*)(ptr)=(BYTE)(val); *(volatile BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8); *(volatile BYTE*)((ptr)+2)=(BYTE)((DWORD)(val)>>16); *(volatile BYTE*)((ptr)+3)=(BYTE)((DWORD)(val)>>24)
simon 0:560a6744936c 333 #else
simon 0:560a6744936c 334 #error Do not forget to set _MCU_ENDIAN properly!
simon 0:560a6744936c 335 #endif
simon 0:560a6744936c 336
simon 0:560a6744936c 337
simon 0:560a6744936c 338 #define _FATFS
simon 0:560a6744936c 339 #endif /* _FATFS */