うおーるぼっとをWiiリモコンでコントロールする新しいプログラムです。 以前のものより、Wiiリモコンが早く繋がる様になりました。 It is a program which controls A with the Wii remote. ※ A Bluetooth dongle and a Wii remote control are needed.

Dependencies:   USBHost mbed FATFileSystem mbed-rtos

Committer:
jksoft
Date:
Mon Jun 10 16:01:50 2013 +0000
Revision:
0:fccb789424fc
1.0

Who changed what in which revision?

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