CircleOS  1
Macros | Functions | Variables
ff.c File Reference

Go to the source code of this file.

Macros

#define SS(fs)   ((fs)->ssize) /* Multiple sector size */
 
#define ENTER_FF(fs)
 
#define LEAVE_FF(fs, res)   return res
 
#define ABORT(fs, res)   { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }
 
#define LD_CLUST(dir)   (((DWORD)LD_WORD(dir+DIR_FstClusHI)<<16) | LD_WORD(dir+DIR_FstClusLO))
 
#define ST_CLUST(dir, cl)   {ST_WORD(dir+DIR_FstClusLO, cl); ST_WORD(dir+DIR_FstClusHI, (DWORD)cl>>16);}
 
#define IsUpper(c)   (((c)>='A')&&((c)<='Z'))
 
#define IsLower(c)   (((c)>='a')&&((c)<='z'))
 
#define IsDigit(c)   (((c)>='0')&&((c)<='9'))
 
#define IsDBCS1(c)   0
 
#define IsDBCS2(c)   0
 
#define NS   11 /* Offset of name status byte */
 
#define NS_LOSS   0x01 /* Out of 8.3 format */
 
#define NS_LFN   0x02 /* Force to create LFN entry */
 
#define NS_LAST   0x04 /* Last segment */
 
#define NS_BODY   0x08 /* Lower case flag (body) */
 
#define NS_EXT   0x10 /* Lower case flag (ext) */
 
#define NS_DOT   0x20 /* Dot entry */
 
#define MIN_FAT16   4086 /* Minimum number of clusters for FAT16 */
 
#define MIN_FAT32   65526 /* Minimum number of clusters for FAT32 */
 
#define BS_jmpBoot   0
 
#define BS_OEMName   3
 
#define BPB_BytsPerSec   11
 
#define BPB_SecPerClus   13
 
#define BPB_RsvdSecCnt   14
 
#define BPB_NumFATs   16
 
#define BPB_RootEntCnt   17
 
#define BPB_TotSec16   19
 
#define BPB_Media   21
 
#define BPB_FATSz16   22
 
#define BPB_SecPerTrk   24
 
#define BPB_NumHeads   26
 
#define BPB_HiddSec   28
 
#define BPB_TotSec32   32
 
#define BS_DrvNum   36
 
#define BS_BootSig   38
 
#define BS_VolID   39
 
#define BS_VolLab   43
 
#define BS_FilSysType   54
 
#define BPB_FATSz32   36
 
#define BPB_ExtFlags   40
 
#define BPB_FSVer   42
 
#define BPB_RootClus   44
 
#define BPB_FSInfo   48
 
#define BPB_BkBootSec   50
 
#define BS_DrvNum32   64
 
#define BS_BootSig32   66
 
#define BS_VolID32   67
 
#define BS_VolLab32   71
 
#define BS_FilSysType32   82
 
#define FSI_LeadSig   0
 
#define FSI_StrucSig   484
 
#define FSI_Free_Count   488
 
#define FSI_Nxt_Free   492
 
#define MBR_Table   446
 
#define BS_55AA   510
 
#define DIR_Name   0
 
#define DIR_Attr   11
 
#define DIR_NTres   12
 
#define DIR_CrtTime   14
 
#define DIR_CrtDate   16
 
#define DIR_FstClusHI   20
 
#define DIR_WrtTime   22
 
#define DIR_WrtDate   24
 
#define DIR_FstClusLO   26
 
#define DIR_FileSize   28
 
#define LDIR_Ord   0
 
#define LDIR_Attr   11
 
#define LDIR_Type   12
 
#define LDIR_Chksum   13
 
#define LDIR_FstClusLO   26
 
#define DEF_NAMEBUF   BYTE sfn[12]
 
#define INIT_BUF(dobj)   (dobj).fn = sfn
 
#define FREE_BUF()
 

Functions

NODEBUG void mem_cpy (void *dst, const void *src, UINT cnt)
 
NODEBUG void str_cpy (char *Dest, const char *Src)
 
NODEBUG void mem_set (void *dst, int val, UINT cnt)
 
NODEBUG int mem_cmp (const void *dst, const void *src, UINT cnt)
 
NODEBUG int chk_chr (const char *str, int chr)
 
static NODEBUG FRESULT move_window (FATFS *fs, DWORD sector)
 
static NODEBUG FRESULT sync (FATFS *fs)
 
NODEBUG2 DWORD clust2sect (FATFS *fs, DWORD clst)
 
NODEBUG2 DWORD get_fat (FATFS *fs, DWORD clst)
 
NODEBUG2 FRESULT put_fat (FATFS *fs, DWORD clst, DWORD val)
 
static NODEBUG FRESULT remove_chain (FATFS *fs, DWORD clst)
 
static NODEBUG DWORD create_chain (FATFS *fs, DWORD clst)
 
static NODEBUG FRESULT dir_sdi (DIR *dj, WORD idx)
 
static NODEBUG FRESULT dir_next (DIR *dj, int stretch)
 
static NODEBUG FRESULT dir_find (DIR *dj)
 
static NODEBUG FRESULT dir_read (DIR *dj)
 
static NODEBUG FRESULT dir_register (DIR *dj)
 
static NODEBUG FRESULT dir_remove (DIR *dj)
 
static NODEBUG FRESULT create_name (DIR *dj, const TCHAR **path)
 
static NODEBUG void get_fileinfo (DIR *dj, FILINFO *fno)
 
static NODEBUG FRESULT follow_path (DIR *dj, const TCHAR *path)
 
static NODEBUG BYTE check_fs (FATFS *fs, DWORD sect)
 
NODEBUG2 FRESULT chk_mounted (const TCHAR **path, FATFS **rfs, BYTE chk_wp)
 
static NODEBUG FRESULT validate (FATFS *fs, WORD id)
 
NODEBUG FRESULT f_mount (BYTE vol, FATFS *fs)
 
NODEBUG FRESULT f_open (FIL *fp, const TCHAR *path, BYTE mode)
 
NODEBUG FRESULT f_read (FIL *fp, void *buff, UINT btr, UINT *br)
 
NODEBUG FRESULT f_write (FIL *fp, const void *buff, UINT btw, UINT *bw)
 
NODEBUG FRESULT f_sync (FIL *fp)
 
NODEBUG FRESULT f_close (FIL *fp)
 
NODEBUG FRESULT f_lseek (FIL *fp, DWORD ofs)
 
NODEBUG FRESULT f_opendir (DIR *dj, const TCHAR *path)
 
NODEBUG FRESULT f_readdir (DIR *dj, FILINFO *fno)
 
NODEBUG FRESULT f_stat (const TCHAR *path, FILINFO *fno)
 
NODEBUG FRESULT f_getfree (const TCHAR *path, DWORD *nclst, FATFS **fatfs)
 
NODEBUG FRESULT f_truncate (FIL *fp)
 
NODEBUG FRESULT f_unlink (const TCHAR *path)
 
NODEBUG FRESULT f_mkdir (const TCHAR *path)
 
NODEBUG FRESULT f_chmod (const TCHAR *path, BYTE value, BYTE mask)
 
NODEBUG FRESULT f_utime (const TCHAR *path, const FILINFO *fno)
 
NODEBUG FRESULT f_rename (const TCHAR *path_old, const TCHAR *path_new)
 

Variables

static WORD Fsid
 

Macro Definition Documentation

#define ABORT (   fs,
  res 
)    { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }

Definition at line 126 of file ff.c.

#define BPB_BkBootSec   50

Definition at line 220 of file ff.c.

#define BPB_BytsPerSec   11

Definition at line 198 of file ff.c.

#define BPB_ExtFlags   40

Definition at line 216 of file ff.c.

#define BPB_FATSz16   22

Definition at line 205 of file ff.c.

#define BPB_FATSz32   36

Definition at line 215 of file ff.c.

#define BPB_FSInfo   48

Definition at line 219 of file ff.c.

#define BPB_FSVer   42

Definition at line 217 of file ff.c.

#define BPB_HiddSec   28

Definition at line 208 of file ff.c.

#define BPB_Media   21

Definition at line 204 of file ff.c.

#define BPB_NumFATs   16

Definition at line 201 of file ff.c.

#define BPB_NumHeads   26

Definition at line 207 of file ff.c.

#define BPB_RootClus   44

Definition at line 218 of file ff.c.

#define BPB_RootEntCnt   17

Definition at line 202 of file ff.c.

#define BPB_RsvdSecCnt   14

Definition at line 200 of file ff.c.

#define BPB_SecPerClus   13

Definition at line 199 of file ff.c.

#define BPB_SecPerTrk   24

Definition at line 206 of file ff.c.

#define BPB_TotSec16   19

Definition at line 203 of file ff.c.

#define BPB_TotSec32   32

Definition at line 209 of file ff.c.

#define BS_55AA   510

Definition at line 231 of file ff.c.

#define BS_BootSig   38

Definition at line 211 of file ff.c.

#define BS_BootSig32   66

Definition at line 222 of file ff.c.

#define BS_DrvNum   36

Definition at line 210 of file ff.c.

#define BS_DrvNum32   64

Definition at line 221 of file ff.c.

#define BS_FilSysType   54

Definition at line 214 of file ff.c.

#define BS_FilSysType32   82

Definition at line 225 of file ff.c.

#define BS_jmpBoot   0

Definition at line 196 of file ff.c.

#define BS_OEMName   3

Definition at line 197 of file ff.c.

#define BS_VolID   39

Definition at line 212 of file ff.c.

#define BS_VolID32   67

Definition at line 223 of file ff.c.

#define BS_VolLab   43

Definition at line 213 of file ff.c.

#define BS_VolLab32   71

Definition at line 224 of file ff.c.

#define DEF_NAMEBUF   BYTE sfn[12]

Definition at line 274 of file ff.c.

#define DIR_Attr   11

Definition at line 234 of file ff.c.

#define DIR_CrtDate   16

Definition at line 237 of file ff.c.

#define DIR_CrtTime   14

Definition at line 236 of file ff.c.

#define DIR_FileSize   28

Definition at line 242 of file ff.c.

#define DIR_FstClusHI   20

Definition at line 238 of file ff.c.

#define DIR_FstClusLO   26

Definition at line 241 of file ff.c.

#define DIR_Name   0

Definition at line 233 of file ff.c.

#define DIR_NTres   12

Definition at line 235 of file ff.c.

#define DIR_WrtDate   24

Definition at line 240 of file ff.c.

#define DIR_WrtTime   22

Definition at line 239 of file ff.c.

#define ENTER_FF (   fs)

Definition at line 122 of file ff.c.

#define FREE_BUF ( )

Definition at line 276 of file ff.c.

#define FSI_Free_Count   488

Definition at line 228 of file ff.c.

#define FSI_LeadSig   0

Definition at line 226 of file ff.c.

#define FSI_Nxt_Free   492

Definition at line 229 of file ff.c.

#define FSI_StrucSig   484

Definition at line 227 of file ff.c.

#define INIT_BUF (   dobj)    (dobj).fn = sfn

Definition at line 275 of file ff.c.

#define IsDBCS1 (   c)    0

Definition at line 170 of file ff.c.

#define IsDBCS2 (   c)    0

Definition at line 171 of file ff.c.

#define IsDigit (   c)    (((c)>='0')&&((c)<='9'))

Definition at line 152 of file ff.c.

#define IsLower (   c)    (((c)>='a')&&((c)<='z'))

Definition at line 151 of file ff.c.

#define IsUpper (   c)    (((c)>='A')&&((c)<='Z'))

Definition at line 150 of file ff.c.

#define LD_CLUST (   dir)    (((DWORD)LD_WORD(dir+DIR_FstClusHI)<<16) | LD_WORD(dir+DIR_FstClusLO))

Definition at line 145 of file ff.c.

#define LDIR_Attr   11

Definition at line 244 of file ff.c.

#define LDIR_Chksum   13

Definition at line 246 of file ff.c.

#define LDIR_FstClusLO   26

Definition at line 247 of file ff.c.

#define LDIR_Ord   0

Definition at line 243 of file ff.c.

#define LDIR_Type   12

Definition at line 245 of file ff.c.

#define LEAVE_FF (   fs,
  res 
)    return res

Definition at line 123 of file ff.c.

#define MBR_Table   446

Definition at line 230 of file ff.c.

#define MIN_FAT16   4086 /* Minimum number of clusters for FAT16 */

Definition at line 188 of file ff.c.

#define MIN_FAT32   65526 /* Minimum number of clusters for FAT32 */

Definition at line 189 of file ff.c.

#define NS   11 /* Offset of name status byte */

Definition at line 177 of file ff.c.

#define NS_BODY   0x08 /* Lower case flag (body) */

Definition at line 181 of file ff.c.

#define NS_DOT   0x20 /* Dot entry */

Definition at line 183 of file ff.c.

#define NS_EXT   0x10 /* Lower case flag (ext) */

Definition at line 182 of file ff.c.

#define NS_LAST   0x04 /* Last segment */

Definition at line 180 of file ff.c.

#define NS_LFN   0x02 /* Force to create LFN entry */

Definition at line 179 of file ff.c.

#define NS_LOSS   0x01 /* Out of 8.3 format */

Definition at line 178 of file ff.c.

#define SS (   fs)    ((fs)->ssize) /* Multiple sector size */

Definition at line 108 of file ff.c.

#define ST_CLUST (   dir,
  cl 
)    {ST_WORD(dir+DIR_FstClusLO, cl); ST_WORD(dir+DIR_FstClusHI, (DWORD)cl>>16);}

Definition at line 146 of file ff.c.

Function Documentation

static NODEBUG BYTE check_fs ( FATFS *  fs,
DWORD  sect 
)
static

Definition at line 1917 of file ff.c.

NODEBUG int chk_chr ( const char *  str,
int  chr 
)

Definition at line 364 of file ff.c.

NODEBUG2 FRESULT chk_mounted ( const TCHAR **  path,
FATFS **  rfs,
BYTE  chk_wp 
)

Definition at line 1941 of file ff.c.

NODEBUG2 DWORD clust2sect ( FATFS *  fs,
DWORD  clst 
)

Definition at line 619 of file ff.c.

static NODEBUG DWORD create_chain ( FATFS *  fs,
DWORD  clst 
)
static

Definition at line 809 of file ff.c.

static NODEBUG FRESULT create_name ( DIR *  dj,
const TCHAR **  path 
)
static

Definition at line 1506 of file ff.c.

static NODEBUG FRESULT dir_find ( DIR *  dj)
static

Definition at line 1194 of file ff.c.

static NODEBUG FRESULT dir_next ( DIR *  dj,
int  stretch 
)
static

Definition at line 929 of file ff.c.

static NODEBUG FRESULT dir_read ( DIR *  dj)
static

Definition at line 1265 of file ff.c.

static NODEBUG FRESULT dir_register ( DIR *  dj)
static

Definition at line 1330 of file ff.c.

static NODEBUG FRESULT dir_remove ( DIR *  dj)
static

Definition at line 1456 of file ff.c.

static NODEBUG FRESULT dir_sdi ( DIR *  dj,
WORD  idx 
)
static

Definition at line 878 of file ff.c.

NODEBUG FRESULT f_chmod ( const TCHAR *  path,
BYTE  value,
BYTE  mask 
)

Definition at line 3421 of file ff.c.

NODEBUG FRESULT f_close ( FIL *  fp)

Definition at line 2619 of file ff.c.

NODEBUG FRESULT f_getfree ( const TCHAR *  path,
DWORD *  nclst,
FATFS **  fatfs 
)

Definition at line 3123 of file ff.c.

NODEBUG FRESULT f_lseek ( FIL *  fp,
DWORD  ofs 
)

Definition at line 2799 of file ff.c.

NODEBUG FRESULT f_mkdir ( const TCHAR *  path)

Definition at line 3341 of file ff.c.

NODEBUG FRESULT f_mount ( BYTE  vol,
FATFS *  fs 
)

Definition at line 2149 of file ff.c.

NODEBUG FRESULT f_open ( FIL *  fp,
const TCHAR *  path,
BYTE  mode 
)

Definition at line 2192 of file ff.c.

NODEBUG FRESULT f_opendir ( DIR *  dj,
const TCHAR *  path 
)

Definition at line 2992 of file ff.c.

NODEBUG FRESULT f_read ( FIL *  fp,
void *  buff,
UINT  btr,
UINT *  br 
)

Definition at line 2343 of file ff.c.

NODEBUG FRESULT f_readdir ( DIR *  dj,
FILINFO *  fno 
)

Definition at line 3039 of file ff.c.

NODEBUG FRESULT f_rename ( const TCHAR *  path_old,
const TCHAR *  path_new 
)

Definition at line 3514 of file ff.c.

NODEBUG FRESULT f_stat ( const TCHAR *  path,
FILINFO *  fno 
)

Definition at line 3088 of file ff.c.

NODEBUG FRESULT f_sync ( FIL *  fp)

Definition at line 2568 of file ff.c.

NODEBUG FRESULT f_truncate ( FIL *  fp)

Definition at line 3203 of file ff.c.

NODEBUG FRESULT f_unlink ( const TCHAR *  path)

Definition at line 3261 of file ff.c.

NODEBUG FRESULT f_utime ( const TCHAR *  path,
const FILINFO *  fno 
)

Definition at line 3468 of file ff.c.

NODEBUG FRESULT f_write ( FIL *  fp,
const void *  buff,
UINT  btw,
UINT *  bw 
)

Definition at line 2442 of file ff.c.

static NODEBUG FRESULT follow_path ( DIR *  dj,
const TCHAR *  path 
)
static

Definition at line 1842 of file ff.c.

NODEBUG2 DWORD get_fat ( FATFS *  fs,
DWORD  clst 
)

Definition at line 637 of file ff.c.

static NODEBUG void get_fileinfo ( DIR *  dj,
FILINFO *  fno 
)
static

Definition at line 1753 of file ff.c.

NODEBUG int mem_cmp ( const void *  dst,
const void *  src,
UINT  cnt 
)

Definition at line 354 of file ff.c.

NODEBUG void mem_cpy ( void *  dst,
const void *  src,
UINT  cnt 
)

Definition at line 315 of file ff.c.

NODEBUG void mem_set ( void *  dst,
int  val,
UINT  cnt 
)

Definition at line 345 of file ff.c.

static NODEBUG FRESULT move_window ( FATFS *  fs,
DWORD  sector 
)
static

Definition at line 532 of file ff.c.

NODEBUG2 FRESULT put_fat ( FATFS *  fs,
DWORD  clst,
DWORD  val 
)

Definition at line 681 of file ff.c.

static NODEBUG FRESULT remove_chain ( FATFS *  fs,
DWORD  clst 
)
static

Definition at line 748 of file ff.c.

NODEBUG void str_cpy ( char *  Dest,
const char *  Src 
)

Definition at line 333 of file ff.c.

static NODEBUG FRESULT sync ( FATFS *  fs)
static

Definition at line 579 of file ff.c.

static NODEBUG FRESULT validate ( FATFS *  fs,
WORD  id 
)
static

Definition at line 2118 of file ff.c.

Variable Documentation

WORD Fsid
static

Definition at line 261 of file ff.c.