# modules/fatfs/src/ff.h File Reference

`#include "integer.h"`
`#include "ffconf.h"`

## Data Structures
struct | _FATFS_
struct | _DIR_
struct | _FIL_
struct | _FILINFO_
## Defines
#define | _FATFS 0x007E
#define | IsUpper(c) (((c)>='A')&&((c)<='Z'))
#define | IsLower(c) (((c)>='a')&&((c)<='z'))
#define | IsDBCS1(c) 0
#define | IsDBCS2(c) 0
#define | LD2PD(drv) (drv)
#define | LD2PT(drv) 0
#define | FA_READ 0x01
#define | FA_OPEN_EXISTING 0x00
#define | FA_WRITE 0x02
#define | FA_CREATE_NEW 0x04
#define | FA_CREATE_ALWAYS 0x08
#define | FA_OPEN_ALWAYS 0x10
#define | FA__WRITTEN 0x20
#define | FA__DIRTY 0x40
#define | FA__ERROR 0x80
#define | FS_FAT12 1
#define | FS_FAT16 2
#define | FS_FAT32 3
#define | AM_RDO 0x01
#define | AM_HID 0x02
#define | AM_SYS 0x04
#define | AM_VOL 0x08
#define | AM_LFN 0x0F
#define | AM_DIR 0x10
#define | AM_ARC 0x20
#define | AM_MASK 0x3F
#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_55AA 510
#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 | 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 | LD_WORD(ptr) (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
#define | LD_DWORD(ptr) (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))
#define | ST_WORD(ptr, val) *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)
#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)
## Typedefs
typedef char | XCHAR
typedef struct _FATFS_ | FATFS
typedef struct _DIR_ | DIR
typedef struct _FIL_ | FIL
typedef struct _FILINFO_ | FILINFO
## Enumerations
enum | FRESULT { FR_OK = 0, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_NO_FILE, FR_NO_PATH, FR_INVALID_NAME, FR_DENIED, FR_EXIST, FR_INVALID_OBJECT, FR_WRITE_PROTECTED, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_MKFS_ABORTED, FR_TIMEOUT }
## Functions
FRESULT | f_mount (BYTE, FATFS *)
FRESULT | f_open (FIL *, const XCHAR *, BYTE)
FRESULT | f_read (FIL *, void *, UINT, UINT *)
FRESULT | f_write (FIL *, const void *, UINT, UINT *)
FRESULT | f_lseek (FIL *, DWORD)
FRESULT | f_close (FIL *)
FRESULT | f_opendir (DIR *, const XCHAR *)
FRESULT | f_readdir (DIR *, FILINFO *)
FRESULT | f_stat (const XCHAR *, FILINFO *)
FRESULT | f_getfree (const XCHAR *, DWORD *, FATFS **)
FRESULT | f_truncate (FIL *)
FRESULT | f_sync (FIL *)
FRESULT | f_unlink (const XCHAR *)
FRESULT | f_mkdir (const XCHAR *)
FRESULT | f_chmod (const XCHAR *, BYTE, BYTE)
FRESULT | f_utime (const XCHAR *, const FILINFO *)
FRESULT | f_rename (const XCHAR *, const XCHAR *)
FRESULT | f_forward (FIL *, UINT(*)(const BYTE *, UINT), UINT, UINT *)
FRESULT | f_mkfs (BYTE, BYTE, WORD)
FRESULT | f_chdir (const XCHAR *)
FRESULT | f_chdrive (BYTE)
DWORD | get_fattime (void)

## Define Documentation

#define _FATFS 0x007E

#define AM_ARC 0x20

#define AM_DIR 0x10

#define AM_HID 0x02

#define AM_LFN 0x0F

#define AM_MASK 0x3F

#define AM_RDO 0x01

#define AM_SYS 0x04

#define AM_VOL 0x08

#define BPB_BkBootSec 50

#define BPB_BytsPerSec 11

#define BPB_ExtFlags 40

#define BPB_FATSz16 22

#define BPB_FATSz32 36

#define BPB_FSInfo 48

#define BPB_FSVer 42

#define BPB_HiddSec 28

#define BPB_Media 21

#define BPB_NumFATs 16

#define BPB_NumHeads 26

#define BPB_RootClus 44

#define BPB_RootEntCnt 17

#define BPB_RsvdSecCnt 14

#define BPB_SecPerClus 13

#define BPB_SecPerTrk 24

#define BPB_TotSec16 19

#define BPB_TotSec32 32

#define BS_55AA 510

#define BS_BootSig 38

#define BS_BootSig32 66

#define BS_DrvNum 36

#define BS_DrvNum32 64

#define BS_FilSysType 54

#define BS_FilSysType32 82

#define BS_jmpBoot 0

#define BS_OEMName 3

#define BS_VolID 39

#define BS_VolID32 67

#define BS_VolLab 43

#define BS_VolLab32 71

#define DIR_Attr 11

#define DIR_CrtDate 16

#define DIR_CrtTime 14

#define DIR_FileSize 28

#define DIR_FstClusHI 20

#define DIR_FstClusLO 26

#define DIR_Name 0

#define DIR_NTres 12

#define DIR_WrtDate 24

#define DIR_WrtTime 22

#define FA__DIRTY 0x40

#define FA__ERROR 0x80

#define FA__WRITTEN 0x20

#define FA_CREATE_ALWAYS 0x08

#define FA_CREATE_NEW 0x04

#define FA_OPEN_ALWAYS 0x10

#define FA_OPEN_EXISTING 0x00

#define FA_READ 0x01

#define FA_WRITE 0x02

#define FS_FAT12 1

#define FS_FAT16 2

#define FS_FAT32 3

#define FSI_Free_Count 488

#define FSI_LeadSig 0

#define FSI_Nxt_Free 492

#define FSI_StrucSig 484

#define IsDBCS1 | ( | c |  | ) | 0

#define IsDBCS2 | ( | c |  | ) | 0

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

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

#define LD2PD | ( | drv |  | ) | (drv)

#define LD2PT | ( | drv |  | ) | 0

#define LD_DWORD | ( | ptr |  | ) | (DWORD)(((DWORD)*(BYTE*)((ptr)+3)<<24)|((DWORD)*(BYTE*)((ptr)+2)<<16)|((WORD)*(BYTE*)((ptr)+1)<<8)|*(BYTE*)(ptr))

#define LD_WORD | ( | ptr |  | ) | (WORD)(((WORD)*(BYTE*)((ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))

#define LDIR_Attr 11

#define LDIR_Chksum 13

#define LDIR_FstClusLO 26

#define LDIR_Ord 0

#define LDIR_Type 12

#define MBR_Table 446

#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)

#define ST_WORD | ( | ptr,
|  | val |  | ) | *(BYTE*)(ptr)=(BYTE)(val); *(BYTE*)((ptr)+1)=(BYTE)((WORD)(val)>>8)

## Typedef Documentation

typedef struct _DIR_ DIR

typedef struct _FATFS_ FATFS

typedef struct _FIL_ FIL

typedef struct _FILINFO_ FILINFO

typedef char XCHAR

## Enumeration Type Documentation

enum FRESULT

Enumerator:

  FR_OK |
  FR_DISK_ERR |
  FR_INT_ERR |
  FR_NOT_READY |
  FR_NO_FILE |
  FR_NO_PATH |
  FR_INVALID_NAME |
  FR_DENIED |
  FR_EXIST |
  FR_INVALID_OBJECT |
  FR_WRITE_PROTECTED |
  FR_INVALID_DRIVE |
  FR_NOT_ENABLED |
  FR_NO_FILESYSTEM |
  FR_MKFS_ABORTED |
  FR_TIMEOUT |

## Function Documentation

FRESULT f_chdir | ( | const XCHAR * |  | ) |

FRESULT f_chdrive | ( | BYTE |  | ) |

FRESULT f_chmod | ( | const XCHAR * | ,
|  | BYTE | ,
|  | BYTE |  |
| ) |  |  |

Here is the call graph for this function:

FRESULT f_close | ( | FIL * |  | ) |

Here is the call graph for this function:

FRESULT f_forward | ( | FIL * | ,
|  | UINT(*)(const BYTE *, UINT) | ,
|  | UINT | ,
|  | UINT * |  |
| ) |  |  |

FRESULT f_getfree | ( | const XCHAR * | ,
|  | DWORD * | ,
|  | FATFS ** |  |
| ) |  |  |

Here is the call graph for this function:

FRESULT f_lseek | ( | FIL * | ,
|  | DWORD |  |
| ) |  |  |

Here is the call graph for this function:

FRESULT f_mkdir | ( | const XCHAR * |  | ) |

Here is the call graph for this function:

FRESULT f_mkfs | ( | BYTE | ,
|  | BYTE | ,
|  | WORD |  |
| ) |  |  |

FRESULT f_mount | ( | BYTE | ,
|  | FATFS * |  |
| ) |  |  |

FRESULT f_open | ( | FIL * | ,
|  | const XCHAR * | ,
|  | BYTE |  |
| ) |  |  |

Here is the call graph for this function:

FRESULT f_opendir | ( | DIR * | ,
|  | const XCHAR * |  |
| ) |  |  |

Here is the call graph for this function:

FRESULT f_read | ( | FIL * | ,
|  | void * | ,
|  | UINT | ,
|  | UINT * |  |
| ) |  |  |

Here is the call graph for this function:

FRESULT f_readdir | ( | DIR * | ,
|  | FILINFO * |  |
| ) |  |  |

FRESULT f_rename | ( | const XCHAR * | ,
|  | const XCHAR * |  |
| ) |  |  |

Here is the call graph for this function:

FRESULT f_stat | ( | const XCHAR * | ,
|  | FILINFO * |  |
| ) |  |  |

Here is the call graph for this function:

FRESULT f_sync | ( | FIL * |  | ) |

Here is the call graph for this function:

FRESULT f_truncate | ( | FIL * |  | ) |

Here is the call graph for this function:

FRESULT f_unlink | ( | const XCHAR * |  | ) |

Here is the call graph for this function:

FRESULT f_utime | ( | const XCHAR * | ,
|  | const FILINFO * |  |
| ) |  |  |

Here is the call graph for this function:

FRESULT f_write | ( | FIL * | ,
|  | const void * | ,
|  | UINT | ,
|  | UINT * |  |
| ) |  |  |

Here is the call graph for this function:

DWORD get_fattime | ( | void |  | ) |