Remove documentation and move fatfs src dir.
[bertos.git] / bertos / fs / fatfs / ff.h
1 /*---------------------------------------------------------------------------/
2 /  FatFs - FAT file system module include file  R0.07a       (C)ChaN, 2009
3 /----------------------------------------------------------------------------/
4 / FatFs module is an open source software to implement FAT file system to
5 / small embedded systems. This is a free software and is opened for education,
6 / research and commercial developments under license policy of following trems.
7 /
8 /  Copyright (C) 2009, ChaN, all right reserved.
9 /
10 / * The FatFs module is a free software and there is NO WARRANTY.
11 / * No restriction on use. You can use, modify and redistribute it for
12 /   personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY.
13 / * Redistributions of source code must retain the above copyright notice.
14 /----------------------------------------------------------------------------*/
15
16 /*---------------------------------------------------------------------------/
17 / FatFs Configuration Options
18 /
19 / CAUTION! Do not forget to make clean the project after any changes to
20 / the configuration options.
21 /
22 /----------------------------------------------------------------------------*/
23 #ifndef _FATFS
24 #define _FATFS
25
26 #include "integer.h"
27 #include "cfg/cfg_fat.h"
28
29 #ifndef _WORD_ACCESS
30 #define _WORD_ACCESS    0
31 #endif
32 /* The _WORD_ACCESS option defines which access method is used to the word
33 /  data in the FAT structure.
34 /
35 /   0: Byte-by-byte access. Always compatible with all platforms.
36 /   1: Word access. Do not choose this unless following condition is met.
37 /
38 /  When the byte order on the memory is big-endian or address miss-aligned
39 /  word access results incorrect behavior, the _WORD_ACCESS must be set to 0.
40 /  If it is not the case, the value can also be set to 1 to improve the
41 /  performance and code efficiency. */
42
43 #ifndef _FS_READONLY
44 #define _FS_READONLY    0
45 #endif
46 /* Setting _FS_READONLY to 1 defines read only configuration. This removes
47 /  writing functions, f_write, f_sync, f_unlink, f_mkdir, f_chmod, f_rename,
48 /  f_truncate and useless f_getfree. */
49
50 #ifndef _FS_MINIMIZE
51 #define _FS_MINIMIZE    0
52 #endif
53 /* The _FS_MINIMIZE option defines minimization level to remove some functions.
54 /
55 /   0: Full function.
56 /   1: f_stat, f_getfree, f_unlink, f_mkdir, f_chmod, f_truncate and f_rename
57 /      are removed.
58 /   2: f_opendir and f_readdir are removed in addition to level 1.
59 /   3: f_lseek is removed in addition to level 2. */
60
61 #ifndef _FS_TINY
62 #define _FS_TINY        0
63 #endif
64 /* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
65 /  object instead of the sector buffer in the individual file object for file
66 /  data transfer. This reduces memory consumption 512 bytes each file object. */
67
68 #ifndef _USE_STRFUNC
69 #define _USE_STRFUNC    0
70 #endif
71 /* To enable string functions, set _USE_STRFUNC to 1 or 2. */
72
73 #ifndef _USE_MKFS
74 #define _USE_MKFS       0
75 #endif
76 /* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
77
78
79 #ifndef _USE_FORWARD
80 #define _USE_FORWARD    0
81 #endif
82 /* To enable f_forward function, set _USE_FORWARD to 1 and set _FS_TINY to 1. */
83
84
85 #ifndef _DRIVES
86 #define _DRIVES         1
87 #endif
88 /* Number of volumes (logical drives) to be used. */
89
90 #ifndef _MAX_SS
91 #define _MAX_SS 512
92 #endif
93 /* Maximum sector size to be handled. (512/1024/2048/4096) */
94 /* 512 for memroy card and hard disk, 1024 for floppy disk, 2048 for MO disk */
95
96 #ifndef _MULTI_PARTITION
97 #define _MULTI_PARTITION        0
98 #endif
99 /* When _MULTI_PARTITION is set to 0, each volume is bound to the same physical
100 / drive number and can mount only first primaly partition. When it is set to 1,
101 / each volume is tied to the partitions listed in Drives[]. */
102
103 #ifndef _CODE_PAGE
104 #define _CODE_PAGE      932
105 #endif
106 /* The _CODE_PAGE specifies the OEM code page to be used on the target system.
107 /  When it is non LFN configuration, there is no difference between SBCS code
108 /  pages. When LFN is enabled, the code page must always be set correctly.
109 /   437 - U.S.
110 /   720 - Arabic
111 /   737 - Greek
112 /   775 - Baltic
113 /   850 - Multilingual Latin 1
114 /   852 - Latin 2
115 /   855 - Cyrillic
116 /   857 - Turkish
117 /   858 - Multilingual Latin 1 + Euro
118 /   862 - Hebrew
119 /   866 - Russian
120 /   874 - Thai
121 /   932 - Japanese Shift-JIS       (DBCS)
122 /   936 - Simplified Chinese GBK   (DBCS)
123 /   949 - Korean                   (DBCS)
124 /   950 - Traditional Chinese Big5 (DBCS)
125 /   1258 - Vietnam
126 */
127
128 #ifndef _USE_LFN
129 #define _USE_LFN        0
130 #endif
131 #ifndef _MAX_LFN
132 #define _MAX_LFN        255             /* Maximum LFN length to handle (max:255) */
133 #endif
134 /* The _USE_LFN option switches the LFN support.
135 /
136 /   0: Disable LFN.
137 /   1: Enable LFN with static working buffer on the bss. NOT REENTRANT.
138 /   2: Enable LFN with dynamic working buffer on the caller's STACK.
139 /
140 /  The working buffer occupies (_MAX_LFN + 1) * 2 bytes. When enable LFN,
141 /  a Unicode - OEM code conversion function ff_convert() must be added to
142 /  the project. */
143
144 #ifndef _FS_REENTRANT
145 #define _FS_REENTRANT   0
146 #endif
147 #ifndef _TIMEOUT
148 #define _TIMEOUT                1000    /* Timeout period in unit of time ticks */
149 #endif
150 #ifndef _SYNC_t
151 #define _SYNC_t                 HANDLE  /* Type of sync object used on the OS. */
152                                                                 /* e.g. HANDLE, OS_EVENT*, ID and etc.. */
153 #endif
154 /* To make the FatFs module re-entrant, set _FS_REENTRANT to 1 and add user
155 /  provided synchronization handlers, ff_req_grant, ff_rel_grant,
156 /  ff_del_syncobj and ff_cre_syncobj function to the project. */
157
158
159
160 /* End of configuration options. Do not change followings without care.     */
161 /*--------------------------------------------------------------------------*/
162
163
164
165 /* Definitions corresponds to multiple sector size */
166
167 #if _MAX_SS == 512
168 #define SS(fs)  512
169 #else
170 #if _MAX_SS == 1024 || _MAX_SS == 2048 || _MAX_SS == 4096
171 #define SS(fs)  ((fs)->s_size)
172 #else
173 #error Sector size must be 512, 1024, 2048 or 4096.
174 #endif
175 #endif
176
177
178
179 /* File system object structure */
180
181 typedef struct _FATFS {
182         BYTE    fs_type;        /* FAT sub type */
183         BYTE    drive;          /* Physical drive number */
184         BYTE    csize;          /* Number of sectors per cluster */
185         BYTE    n_fats;         /* Number of FAT copies */
186         BYTE    wflag;          /* win[] dirty flag (1:must be written back) */
187         BYTE    pad1;
188         WORD    id;                     /* File system mount ID */
189         WORD    n_rootdir;      /* Number of root directory entries (0 on FAT32) */
190 #if _FS_REENTRANT
191         _SYNC_t sobj;           /* Identifier of sync object */
192 #endif
193 #if _MAX_SS != 512U
194         WORD    s_size;         /* Sector size */
195 #endif
196 #if !_FS_READONLY
197         BYTE    fsi_flag;       /* fsinfo dirty flag (1:must be written back) */
198         BYTE    pad2;
199         DWORD   last_clust;     /* Last allocated cluster */
200         DWORD   free_clust;     /* Number of free clusters */
201         DWORD   fsi_sector;     /* fsinfo sector */
202 #endif
203         DWORD   sects_fat;      /* Sectors per fat */
204         DWORD   max_clust;      /* Maximum cluster# + 1. Number of clusters is max_clust - 2 */
205         DWORD   fatbase;        /* FAT start sector */
206         DWORD   dirbase;        /* Root directory start sector (Cluster# on FAT32) */
207         DWORD   database;       /* Data start sector */
208         DWORD   winsect;        /* Current sector appearing in the win[] */
209         BYTE    win[_MAX_SS];/* Disk access window for Directory/FAT */
210 } FATFS;
211
212
213
214 /* Directory object structure */
215
216 typedef struct _DIR {
217         WORD    id;                     /* Owner file system mount ID */
218         WORD    index;          /* Current index number */
219         FATFS*  fs;                     /* Pointer to the owner file system object */
220         DWORD   sclust;         /* Table start cluster (0:Static table) */
221         DWORD   clust;          /* Current cluster */
222         DWORD   sect;           /* Current sector */
223         BYTE*   dir;            /* Pointer to the current SFN entry in the win[] */
224         BYTE*   fn;                     /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
225 #if _USE_LFN
226         WCHAR*  lfn;            /* Pointer to the LFN working buffer */
227         WORD    lfn_idx;        /* Last matched LFN index (0xFFFF:No LFN) */
228 #endif
229 } DIR;
230
231
232
233 /* File object structure */
234
235 typedef struct _FIL {
236         FATFS*  fs;                     /* Pointer to the owner file system object */
237         WORD    id;                     /* Owner file system mount ID */
238         BYTE    flag;           /* File status flags */
239         BYTE    csect;          /* Sector address in the cluster */
240         DWORD   fptr;           /* File R/W pointer */
241         DWORD   fsize;          /* File size */
242         DWORD   org_clust;      /* File start cluster */
243         DWORD   curr_clust;     /* Current cluster */
244         DWORD   dsect;          /* Current data sector */
245 #if !_FS_READONLY
246         DWORD   dir_sect;       /* Sector containing the directory entry */
247         BYTE*   dir_ptr;        /* Ponter to the directory entry in the window */
248 #endif
249 #if !_FS_TINY
250         BYTE    buf[_MAX_SS];/* File R/W buffer */
251 #endif
252 } FIL;
253
254
255
256 /* File status structure */
257
258 typedef struct _FILINFO {
259         DWORD fsize;            /* File size */
260         WORD fdate;                     /* Last modified date */
261         WORD ftime;                     /* Last modified time */
262         BYTE fattrib;           /* Attribute */
263         char fname[13];         /* Short file name (8.3 format) */
264 #if _USE_LFN
265         char *lfname;           /* Pointer to the LFN buffer */
266         int lfsize;                     /* Size of LFN buffer [bytes] */
267 #endif
268 } FILINFO;
269
270
271
272 /* DBCS code ranges */
273
274 #if _CODE_PAGE == 932   /* CP932 (Japanese Shift-JIS) */
275 #define _DF1S   0x81    /* DBC 1st byte range 1 start */
276 #define _DF1E   0x9F    /* DBC 1st byte range 1 end */
277 #define _DF2S   0xE0    /* DBC 1st byte range 2 start */
278 #define _DF2E   0xFC    /* DBC 1st byte range 2 end */
279 #define _DS1S   0x40    /* DBC 2nd byte range 1 start */
280 #define _DS1E   0x7E    /* DBC 2nd byte range 1 end */
281 #define _DS2S   0x80    /* DBC 2nd byte range 2 start */
282 #define _DS2E   0xFC    /* DBC 2nd byte range 2 end */
283
284 #elif _CODE_PAGE == 936 /* CP936 (Simplified Chinese GBK) */
285 #define _DF1S   0x81
286 #define _DF1E   0xFE
287 #define _DS1S   0x40
288 #define _DS1E   0x7E
289 #define _DS2S   0x80
290 #define _DS2E   0xFE
291
292 #elif _CODE_PAGE == 949 /* CP949 (Korean) */
293 #define _DF1S   0x81
294 #define _DF1E   0xFE
295 #define _DS1S   0x41
296 #define _DS1E   0x5A
297 #define _DS2S   0x61
298 #define _DS2E   0x7A
299 #define _DS3S   0x81
300 #define _DS3E   0xFE
301
302 #elif _CODE_PAGE == 950 /* CP950 (Traditional Chinese Big5) */
303 #define _DF1S   0x81
304 #define _DF1E   0xFE
305 #define _DS1S   0x40
306 #define _DS1E   0x7E
307 #define _DS2S   0xA1
308 #define _DS2E   0xFE
309
310 #else                                   /* SBCS code pages */
311 #define _DF1S   0
312
313 #endif
314
315
316
317 /* Character code support macros */
318
319 #define IsUpper(c)      (((c)>='A')&&((c)<='Z'))
320 #define IsLower(c)      (((c)>='a')&&((c)<='z'))
321 #define IsDigit(c)      (((c)>='0')&&((c)<='9'))
322
323 #if _DF1S       /* DBCS configuration */
324
325 #if _DF2S       /* Two 1st byte areas */
326 #define IsDBCS1(c)      (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E))
327 #else           /* One 1st byte area */
328 #define IsDBCS1(c)      ((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E)
329 #endif
330
331 #if _DS3S       /* Three 2nd byte areas */
332 #define IsDBCS2(c)      (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E) || ((BYTE)(c) >= _DS3S && (BYTE)(c) <= _DS3E))
333 #else           /* Two 2nd byte areas */
334 #define IsDBCS2(c)      (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E))
335 #endif
336
337 #else           /* SBCS configuration */
338
339 #define IsDBCS1(c)      0
340 #define IsDBCS2(c)      0
341
342 #endif /* _DF1S */
343
344
345
346 /* Definitions corresponds to multi partition */
347
348 #if _MULTI_PARTITION            /* Multiple partition configuration */
349
350 typedef struct _PARTITION {
351         BYTE pd;        /* Physical drive# */
352         BYTE pt;        /* Partition # (0-3) */
353 } PARTITION;
354
355 extern
356 const PARTITION Drives[];                       /* Logical drive# to physical location conversion table */
357 #define LD2PD(drv) (Drives[drv].pd)     /* Get physical drive# */
358 #define LD2PT(drv) (Drives[drv].pt)     /* Get partition# */
359
360 #else                                           /* Single partition configuration */
361
362 #define LD2PD(drv) (drv)        /* Physical drive# is equal to the logical drive# */
363 #define LD2PT(drv) 0            /* Always mounts the 1st partition */
364
365 #endif
366
367
368
369 /* File function return code (FRESULT) */
370
371 typedef enum {
372         FR_OK = 0,                      /* 0 */
373         FR_DISK_ERR,            /* 1 */
374         FR_INT_ERR,                     /* 2 */
375         FR_NOT_READY,           /* 3 */
376         FR_NO_FILE,                     /* 4 */
377         FR_NO_PATH,                     /* 5 */
378         FR_INVALID_NAME,        /* 6 */
379         FR_DENIED,                      /* 7 */
380         FR_EXIST,                       /* 8 */
381         FR_INVALID_OBJECT,      /* 9 */
382         FR_WRITE_PROTECTED,     /* 10 */
383         FR_INVALID_DRIVE,       /* 11 */
384         FR_NOT_ENABLED,         /* 12 */
385         FR_NO_FILESYSTEM,       /* 13 */
386         FR_MKFS_ABORTED,        /* 14 */
387         FR_TIMEOUT                      /* 15 */
388 } FRESULT;
389
390
391
392 /*--------------------------------------------------------------*/
393 /* FatFs module application interface                           */
394
395 FRESULT f_mount (BYTE, FATFS*);                                         /* Mount/Unmount a logical drive */
396 FRESULT f_open (FIL*, const char*, BYTE);                       /* Open or create a file */
397 FRESULT f_read (FIL*, void*, UINT, UINT*);                      /* Read data from a file */
398 FRESULT f_write (FIL*, const void*, UINT, UINT*);       /* Write data to a file */
399 FRESULT f_lseek (FIL*, DWORD);                                          /* Move file pointer of a file object */
400 FRESULT f_close (FIL*);                                                         /* Close an open file object */
401 FRESULT f_opendir (DIR*, const char*);                          /* Open an existing directory */
402 FRESULT f_readdir (DIR*, FILINFO*);                                     /* Read a directory item */
403 FRESULT f_stat (const char*, FILINFO*);                         /* Get file status */
404 FRESULT f_getfree (const char*, DWORD*, FATFS**);       /* Get number of free clusters on the drive */
405 FRESULT f_truncate (FIL*);                                                      /* Truncate file */
406 FRESULT f_sync (FIL*);                                                          /* Flush cached data of a writing file */
407 FRESULT f_unlink (const char*);                                         /* Delete an existing file or directory */
408 FRESULT f_mkdir (const char*);                                          /* Create a new directory */
409 FRESULT f_chmod (const char*, BYTE, BYTE);                      /* Change attriburte of the file/dir */
410 FRESULT f_utime (const char*, const FILINFO*);          /* Change timestamp of the file/dir */
411 FRESULT f_rename (const char*, const char*);            /* Rename/Move a file or directory */
412 FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*);       /* Forward data to the stream */
413 FRESULT f_mkfs (BYTE, BYTE, WORD);                                      /* Create a file system on the drive */
414
415 #if _USE_STRFUNC
416 int f_putc (int, FIL*);                                                         /* Put a character to the file */
417 int f_puts (const char*, FIL*);                                         /* Put a string to the file */
418 int f_printf (FIL*, const char*, ...);                          /* Put a formatted string to the file */
419 char* f_gets (char*, int, FIL*);                                        /* Get a string from the file */
420 #define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
421 #define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
422 #ifndef EOF
423 #define EOF -1
424 #endif
425 #endif
426
427
428
429 /*--------------------------------------------------------------*/
430 /* User defined functions                                       */
431
432 /* Real time clock */
433 #if !_FS_READONLY
434 DWORD get_fattime (void);       /* 31-25: Year(0-127 org.1980), 24-21: Month(1-12), 20-16: Day(1-31) */
435                                                         /* 15-11: Hour(0-23), 10-5: Minute(0-59), 4-0: Second(0-29 *2) */
436 #endif
437
438 /* Unicode - OEM code conversion */
439 #if _USE_LFN
440 WCHAR ff_convert (WCHAR, UINT);
441 #endif
442
443 /* Sync functions */
444 #if _FS_REENTRANT
445 BOOL ff_cre_syncobj(BYTE, _SYNC_t*);
446 BOOL ff_del_syncobj(_SYNC_t);
447 BOOL ff_req_grant(_SYNC_t);
448 void ff_rel_grant(_SYNC_t);
449 #endif
450
451
452
453 /*--------------------------------------------------------------*/
454 /* Flags and offset address                                     */
455
456
457 /* File access control and file status flags (FIL.flag) */
458
459 #define FA_READ                         0x01
460 #define FA_OPEN_EXISTING        0x00
461 #if _FS_READONLY == 0
462 #define FA_WRITE                        0x02
463 #define FA_CREATE_NEW           0x04
464 #define FA_CREATE_ALWAYS        0x08
465 #define FA_OPEN_ALWAYS          0x10
466 #define FA__WRITTEN                     0x20
467 #define FA__DIRTY                       0x40
468 #endif
469 #define FA__ERROR                       0x80
470
471
472 /* FAT sub type (FATFS.fs_type) */
473
474 #define FS_FAT12        1
475 #define FS_FAT16        2
476 #define FS_FAT32        3
477
478
479 /* File attribute bits for directory entry */
480
481 #define AM_RDO  0x01    /* Read only */
482 #define AM_HID  0x02    /* Hidden */
483 #define AM_SYS  0x04    /* System */
484 #define AM_VOL  0x08    /* Volume label */
485 #define AM_LFN  0x0F    /* LFN entry */
486 #define AM_DIR  0x10    /* Directory */
487 #define AM_ARC  0x20    /* Archive */
488 #define AM_MASK 0x3F    /* Mask of defined bits */
489
490
491 /* FatFs refers the members in the FAT structures with byte offset instead
492 / of structure member because there are incompatibility of the packing option
493 / between various compilers. */
494
495 #define BS_jmpBoot                      0
496 #define BS_OEMName                      3
497 #define BPB_BytsPerSec          11
498 #define BPB_SecPerClus          13
499 #define BPB_RsvdSecCnt          14
500 #define BPB_NumFATs                     16
501 #define BPB_RootEntCnt          17
502 #define BPB_TotSec16            19
503 #define BPB_Media                       21
504 #define BPB_FATSz16                     22
505 #define BPB_SecPerTrk           24
506 #define BPB_NumHeads            26
507 #define BPB_HiddSec                     28
508 #define BPB_TotSec32            32
509 #define BS_55AA                         510
510
511 #define BS_DrvNum                       36
512 #define BS_BootSig                      38
513 #define BS_VolID                        39
514 #define BS_VolLab                       43
515 #define BS_FilSysType           54
516
517 #define BPB_FATSz32                     36
518 #define BPB_ExtFlags            40
519 #define BPB_FSVer                       42
520 #define BPB_RootClus            44
521 #define BPB_FSInfo                      48
522 #define BPB_BkBootSec           50
523 #define BS_DrvNum32                     64
524 #define BS_BootSig32            66
525 #define BS_VolID32                      67
526 #define BS_VolLab32                     71
527 #define BS_FilSysType32         82
528
529 #define FSI_LeadSig                     0
530 #define FSI_StrucSig            484
531 #define FSI_Free_Count          488
532 #define FSI_Nxt_Free            492
533
534 #define MBR_Table                       446
535
536 #define DIR_Name                        0
537 #define DIR_Attr                        11
538 #define DIR_NTres                       12
539 #define DIR_CrtTime                     14
540 #define DIR_CrtDate                     16
541 #define DIR_FstClusHI           20
542 #define DIR_WrtTime                     22
543 #define DIR_WrtDate                     24
544 #define DIR_FstClusLO           26
545 #define DIR_FileSize            28
546 #define LDIR_Ord                        0
547 #define LDIR_Attr                       11
548 #define LDIR_Type                       12
549 #define LDIR_Chksum                     13
550 #define LDIR_FstClusLO          26
551
552
553
554 /*--------------------------------*/
555 /* Multi-byte word access macros  */
556
557 #if _WORD_ACCESS == 1   /* Enable word access to the FAT structure */
558 #define LD_WORD(ptr)            (WORD)(*(WORD*)(BYTE*)(ptr))
559 #define LD_DWORD(ptr)           (DWORD)(*(DWORD*)(BYTE*)(ptr))
560 #define ST_WORD(ptr,val)        *(WORD*)(BYTE*)(ptr)=(WORD)(val)
561 #define ST_DWORD(ptr,val)       *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
562 #else                                   /* Use byte-by-byte access to the FAT structure */
563 #define LD_WORD(ptr)            (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
564 #define LD_DWORD(ptr)           (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
565 #define ST_WORD(ptr,val)        *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
566 #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)
567 #endif
568
569
570 #endif /* _FATFS */