Line buffer mode. sammple code with MIP8F_SPI_Ver40

Dependencies:   MIP8F_SPI_Ver40 mbed

Dependents:   MIP8f_FRDM_TransferMode_sample MIP8f_FRDM_Animation_sample

Introduction

Line buffer mode sample with MIP8F_SPI_Ver40 Display some color and monochrome bitmap.

Other information , please refer to https://os.mbed.com/teams/JapanDisplayInc/code/MIP8f_FRDM_sample/

Usage

Copy Setting File and Image to micro SD-CARD. (Same setting File and bitmap of MIP8f_FRDM_sample.)

a) Download the following file corresponding to the target panel, and rename file identifier (.bin -> .zip), and unzip the file on micro SD Card's root directory.

b) Insert micro SD-CARD to FRDM-K64F. c) Upload binary file to FRDM-K64F.and push Reset Button.

Other information

refer to Usage on https://os.mbed.com/teams/JapanDisplayInc/code/MIP8f_FRDM_sample/

this Sample Code (.bin)

/media/uploads/JDI_Mbed_Team/mip8f_frdm_linebuffer_sample.k64f.bin

Committer:
JDI_Mbed_Team
Date:
Tue Sep 04 06:44:01 2018 +0000
Revision:
0:33fe30a2b785
JDI_MIP8F sample

Who changed what in which revision?

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