MAVRK Embedded Software 0.91
Software Libraries for the MAVRK motherboard and related components
Defines | Functions

ff.c File Reference

#include "ff.h"
#include "diskio.h"

Defines

#define SS(fs)   512U
#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 _DF1S   0x81
#define _DF1E   0x9F
#define _DF2S   0xE0
#define _DF2E   0xFC
#define _DS1S   0x40
#define _DS1E   0x7E
#define _DS2S   0x80
#define _DS2E   0xFC
#define IsUpper(c)   (((c)>='A')&&((c)<='Z'))
#define IsLower(c)   (((c)>='a')&&((c)<='z'))
#define IsDigit(c)   (((c)>='0')&&((c)<='9'))
#define IsDBCS1(c)   (((unsigned char)(c) >= _DF1S && (unsigned char)(c) <= _DF1E) || ((unsigned char)(c) >= _DF2S && (unsigned char)(c) <= _DF2E))
#define IsDBCS2(c)   (((unsigned char)(c) >= _DS1S && (unsigned char)(c) <= _DS1E) || ((unsigned char)(c) >= _DS2S && (unsigned char)(c) <= _DS2E))
#define NS   11
#define NS_LOSS   0x01
#define NS_LFN   0x02
#define NS_LAST   0x04
#define NS_BODY   0x08
#define NS_EXT   0x10
#define NS_DOT   0x20
#define MIN_FAT16   4086
#define MIN_FAT32   65526
#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 SZ_PTE   16
#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 SZ_DIR   32
#define LLE   0x40
#define DDE   0xE5
#define NDDE   0x05
#define DEF_NAMEBUF   unsigned char sfn[12]
#define INIT_BUF(dobj)   (dobj).fn = sfn
#define FREE_BUF()

Functions

DWORD clust2sect (FATFS *fs, DWORD clst)
DWORD get_fat (FATFS *fs, DWORD clst)
FRESULT put_fat (FATFS *fs, DWORD clst, DWORD val)
FRESULT f_mount (unsigned char vol, FATFS *fs)
FRESULT f_open (FIL *fp, const TCHAR *path, unsigned char mode)
FRESULT f_read (FIL *fp, void *buff, UINT btr, UINT *br)
FRESULT f_write (FIL *fp, const void *buff, UINT btw, UINT *bw)
FRESULT f_sync (FIL *fp)
FRESULT f_close (FIL *fp)
FRESULT f_lseek (FIL *fp, DWORD ofs)
FRESULT f_opendir (DIRS *dj, const TCHAR *path)
FRESULT f_readdir (DIRS *dj, FILINFO *fno)
FRESULT f_stat (const TCHAR *path, FILINFO *fno)
FRESULT f_getfree (const TCHAR *path, DWORD *nclst, FATFS **fatfs)
FRESULT f_truncate (FIL *fp)
FRESULT f_unlink (const TCHAR *path)
FRESULT f_mkdir (const TCHAR *path)
FRESULT f_chmod (const TCHAR *path, unsigned char value, unsigned char mask)
FRESULT f_utime (const TCHAR *path, const FILINFO *fno)
FRESULT f_rename (const TCHAR *path_old, const TCHAR *path_new)

Define Documentation

#define _DF1E   0x9F
#define _DF1S   0x81
#define _DF2E   0xFC
#define _DF2S   0xE0
#define _DS1E   0x7E
#define _DS1S   0x40
#define _DS2E   0xFC
#define _DS2S   0x80
#define ABORT (   fs,
  res 
)    { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }
#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 DDE   0xE5
#define DEF_NAMEBUF   unsigned char sfn[12]
#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 ENTER_FF (   fs)
#define FREE_BUF ( )
#define FSI_Free_Count   488
#define FSI_LeadSig   0
#define FSI_Nxt_Free   492
#define FSI_StrucSig   484
#define INIT_BUF (   dobj)    (dobj).fn = sfn
#define IsDBCS1 (   c)    (((unsigned char)(c) >= _DF1S && (unsigned char)(c) <= _DF1E) || ((unsigned char)(c) >= _DF2S && (unsigned char)(c) <= _DF2E))
#define IsDBCS2 (   c)    (((unsigned char)(c) >= _DS1S && (unsigned char)(c) <= _DS1E) || ((unsigned char)(c) >= _DS2S && (unsigned char)(c) <= _DS2E))
#define IsDigit (   c)    (((c)>='0')&&((c)<='9'))
#define IsLower (   c)    (((c)>='a')&&((c)<='z'))
#define IsUpper (   c)    (((c)>='A')&&((c)<='Z'))
#define LD_CLUST (   dir)    (((DWORD)LD_WORD(dir+DIR_FstClusHI)<<16) | LD_WORD(dir+DIR_FstClusLO))
#define LDIR_Attr   11
#define LDIR_Chksum   13
#define LDIR_FstClusLO   26
#define LDIR_Ord   0
#define LDIR_Type   12
#define LEAVE_FF (   fs,
  res 
)    return res
#define LLE   0x40
#define MBR_Table   446
#define MIN_FAT16   4086
#define MIN_FAT32   65526
#define NDDE   0x05
#define NS   11
#define NS_BODY   0x08
#define NS_DOT   0x20
#define NS_EXT   0x10
#define NS_LAST   0x04
#define NS_LFN   0x02
#define NS_LOSS   0x01
#define SS (   fs)    512U
#define ST_CLUST (   dir,
  cl 
)    {ST_WORD(dir+DIR_FstClusLO, cl); ST_WORD(dir+DIR_FstClusHI, (DWORD)cl>>16);}
#define SZ_DIR   32
#define SZ_PTE   16

Function Documentation

DWORD clust2sect ( FATFS fs,
DWORD  clst 
)
FRESULT f_chmod ( const TCHAR path,
unsigned char  value,
unsigned char  mask 
)
FRESULT f_close ( FIL fp)
FRESULT f_getfree ( const TCHAR path,
DWORD nclst,
FATFS **  fatfs 
)
FRESULT f_lseek ( FIL fp,
DWORD  ofs 
)
FRESULT f_mkdir ( const TCHAR path)
FRESULT f_mount ( unsigned char  vol,
FATFS fs 
)
FRESULT f_open ( FIL fp,
const TCHAR path,
unsigned char  mode 
)
FRESULT f_opendir ( DIRS dj,
const TCHAR path 
)
FRESULT f_read ( FIL fp,
void *  buff,
UINT  btr,
UINT br 
)
FRESULT f_readdir ( DIRS dj,
FILINFO fno 
)
FRESULT f_rename ( const TCHAR path_old,
const TCHAR path_new 
)
FRESULT f_stat ( const TCHAR path,
FILINFO fno 
)
FRESULT f_sync ( FIL fp)
FRESULT f_truncate ( FIL fp)
FRESULT f_unlink ( const TCHAR path)
FRESULT f_utime ( const TCHAR path,
const FILINFO fno 
)
FRESULT f_write ( FIL fp,
const void *  buff,
UINT  btw,
UINT bw 
)
DWORD get_fat ( FATFS fs,
DWORD  clst 
)
FRESULT put_fat ( FATFS fs,
DWORD  clst,
DWORD  val 
)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines