Radio Datalogger Project  Version 2.0
Macros | Functions | Variables
ff.c File Reference
#include "ff.h"
#include "diskio.h"

Macros

#define MIN_FAT16   4086 /* Minimum number of clusters for FAT16 */
 
#define MIN_FAT32   65526 /* Minimum number of clusters for FAT32 */
 
#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 IsUpper(c)   (((c)>='A')&&((c)<='Z'))
 
#define IsLower(c)   (((c)>='a')&&((c)<='z'))
 
#define IsDigit(c)   (((c)>='0')&&((c)<='9'))
 
#define IsDBCS1(c)   (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E))
 
#define IsDBCS2(c)   (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E))
 
#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 DEF_NAMEBUF   BYTE sfn[12]
 
#define INIT_BUF(dobj)   (dobj).fn = sfn
 
#define FREE_BUF()
 

Functions

static void mem_cpy (void *dst, const void *src, int cnt)
 
static void mem_set (void *dst, int val, int cnt)
 
static int mem_cmp (const void *dst, const void *src, int cnt)
 
static int chk_chr (const char *str, int chr)
 
static FRESULT move_window (FATFS *fs, DWORD sector)
 
static FRESULT sync (FATFS *fs)
 
DWORD get_fat (FATFS *fs, DWORD clst)
 
FRESULT put_fat (FATFS *fs, DWORD clst, DWORD val)
 
static FRESULT remove_chain (FATFS *fs, DWORD clst)
 
static DWORD create_chain (FATFS *fs, DWORD clst)
 
DWORD clust2sect (FATFS *fs, DWORD clst)
 
static FRESULT dir_sdi (DIR *dj, WORD idx)
 
static FRESULT dir_next (DIR *dj, int stretch)
 
static FRESULT dir_find (DIR *dj)
 
static FRESULT dir_read (DIR *dj)
 
static FRESULT dir_register (DIR *dj)
 
static FRESULT dir_remove (DIR *dj)
 
static FRESULT create_name (DIR *dj, const TCHAR **path)
 
static void get_fileinfo (DIR *dj, FILINFO *fno)
 
static FRESULT follow_path (DIR *dj, const TCHAR *path)
 
static BYTE check_fs (FATFS *fs, DWORD sect)
 
static FRESULT chk_mounted (const TCHAR **path, FATFS **rfs, BYTE chk_wp)
 
static FRESULT validate (FATFS *fs, WORD id)
 
FRESULT f_mount (BYTE vol, FATFS *fs)
 
FRESULT f_open (FIL *fp, const TCHAR *path, BYTE 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 (DIR *dj, const TCHAR *path)
 
FRESULT f_readdir (DIR *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, BYTE value, BYTE mask)
 
FRESULT f_utime (const TCHAR *path, const FILINFO *fno)
 
FRESULT f_rename (const TCHAR *path_old, const TCHAR *path_new)
 

Variables

static WORD Fsid
 
static FATFSFatFs [_DRIVES]
 

Macro Definition Documentation

#define ABORT (   fs,
  res 
)    { fp->flag |= FA__ERROR; LEAVE_FF(fs, res); }
#define DEF_NAMEBUF   BYTE sfn[12]
#define ENTER_FF (   fs)
#define FREE_BUF ( )
#define INIT_BUF (   dobj)    (dobj).fn = sfn
#define IsDBCS1 (   c)    (((BYTE)(c) >= _DF1S && (BYTE)(c) <= _DF1E) || ((BYTE)(c) >= _DF2S && (BYTE)(c) <= _DF2E))
#define IsDBCS2 (   c)    (((BYTE)(c) >= _DS1S && (BYTE)(c) <= _DS1E) || ((BYTE)(c) >= _DS2S && (BYTE)(c) <= _DS2E))
#define IsDigit (   c)    (((c)>='0')&&((c)<='9'))
#define IsLower (   c)    (((c)>='a')&&((c)<='z'))
#define IsUpper (   c)    (((c)>='A')&&((c)<='Z'))
#define LEAVE_FF (   fs,
  res 
)    return res
#define MIN_FAT16   4086 /* Minimum number of clusters for FAT16 */
#define MIN_FAT32   65526 /* Minimum number of clusters for FAT32 */
#define NS   11 /* Offset of name status byte */
#define NS_BODY   0x08 /* Lower case flag (body) */
#define NS_DOT   0x20 /* Dot entry */
#define NS_EXT   0x10 /* Lower case flag (ext) */
#define NS_LAST   0x04 /* Last segment */
#define NS_LFN   0x02 /* Force to create LFN entry */
#define NS_LOSS   0x01 /* Out of 8.3 format */
#define SS (   fs)    512U

Function Documentation

static BYTE check_fs ( FATFS fs,
DWORD  sect 
)
static
static int chk_chr ( const char *  str,
int  chr 
)
static
static FRESULT chk_mounted ( const TCHAR **  path,
FATFS **  rfs,
BYTE  chk_wp 
)
static
DWORD clust2sect ( FATFS fs,
DWORD  clst 
)
static DWORD create_chain ( FATFS fs,
DWORD  clst 
)
static
static FRESULT create_name ( DIR dj,
const TCHAR **  path 
)
static
static FRESULT dir_find ( DIR dj)
static
static FRESULT dir_next ( DIR dj,
int  stretch 
)
static
static FRESULT dir_read ( DIR dj)
static
static FRESULT dir_register ( DIR dj)
static
static FRESULT dir_remove ( DIR dj)
static
static FRESULT dir_sdi ( DIR dj,
WORD  idx 
)
static
FRESULT f_chmod ( const TCHAR path,
BYTE  value,
BYTE  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 ( BYTE  vol,
FATFS fs 
)
FRESULT f_open ( FIL fp,
const TCHAR path,
BYTE  mode 
)
FRESULT f_opendir ( DIR dj,
const TCHAR path 
)
FRESULT f_read ( FIL fp,
void *  buff,
UINT  btr,
UINT br 
)
FRESULT f_readdir ( DIR 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 
)
static FRESULT follow_path ( DIR dj,
const TCHAR path 
)
static
DWORD get_fat ( FATFS fs,
DWORD  clst 
)
static void get_fileinfo ( DIR dj,
FILINFO fno 
)
static
static int mem_cmp ( const void *  dst,
const void *  src,
int  cnt 
)
static
static void mem_cpy ( void *  dst,
const void *  src,
int  cnt 
)
static
static void mem_set ( void *  dst,
int  val,
int  cnt 
)
static
static FRESULT move_window ( FATFS fs,
DWORD  sector 
)
static
FRESULT put_fat ( FATFS fs,
DWORD  clst,
DWORD  val 
)
static FRESULT remove_chain ( FATFS fs,
DWORD  clst 
)
static
static FRESULT sync ( FATFS fs)
static
static FRESULT validate ( FATFS fs,
WORD  id 
)
static

Variable Documentation

FATFS* FatFs[_DRIVES]
static
WORD Fsid
static