Atmel Software Framework

ff.h File Reference
#include "integer.h"
#include "ffconf.h"

Data Structures

struct  DIR
 
struct  FATFS
 
struct  FIL
 
struct  FILINFO
 

Macros

#define _FATFS   6502 /* Revision ID */
 
#define _T(x)   x
 
#define _TEXT(x)   x
 
#define AM_ARC   0x20 /* Archive */
 
#define AM_DIR   0x10 /* Directory */
 
#define AM_HID   0x02 /* Hidden */
 
#define AM_LFN   0x0F /* LFN entry */
 
#define AM_MASK   0x3F /* Mask of defined bits */
 
#define AM_RDO   0x01 /* Read only */
 
#define AM_SYS   0x04 /* System */
 
#define AM_VOL   0x08 /* Volume label */
 
#define CREATE_LINKMAP   0xFFFFFFFF
 
#define EOF   (-1)
 
#define f_eof(fp)   (((fp)->fptr == (fp)->fsize) ? 1 : 0)
 
#define f_error(fp)   (((fp)->flag & FA__ERROR) ? 1 : 0)
 
#define f_size(fp)   ((fp)->fsize)
 
#define f_tell(fp)   ((fp)->fptr)
 
#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 LD2PD(vol)   (vol) /* Each logical drive is bound to the same physical drive number */
 
#define LD2PT(vol)   0 /* Always mounts the 1st partition or in SFD */
 
#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 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)
 

Typedefs

typedef char TCHAR
 

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,
  FR_LOCKED,
  FR_NOT_ENOUGH_CORE,
  FR_TOO_MANY_OPEN_FILES,
  FR_INVALID_PARAMETER
}
 

Functions

FRESULT f_chdir (const TCHAR *)
 
FRESULT f_chdrive (BYTE)
 
FRESULT f_chmod (const TCHAR *, BYTE, BYTE)
 
FRESULT f_close (FIL *)
 
FRESULT f_fdisk (BYTE, const DWORD[], void *)
 
FRESULT f_forward (FIL *, UINT(*)(const BYTE *, UINT), UINT, UINT *)
 
FRESULT f_getcwd (TCHAR *, UINT)
 
FRESULT f_getfree (const TCHAR *, DWORD *, FATFS **)
 
TCHARf_gets (TCHAR *, int, FIL *)
 
FRESULT f_lseek (FIL *, DWORD)
 
FRESULT f_mkdir (const TCHAR *)
 
FRESULT f_mkfs (BYTE, BYTE, UINT)
 
FRESULT f_mount (BYTE, FATFS *)
 
FRESULT f_open (FIL *, const TCHAR *, BYTE)
 
FRESULT f_opendir (DIR *, const TCHAR *)
 
int f_printf (FIL *, const TCHAR *,...)
 
int f_putc (TCHAR, FIL *)
 
int f_puts (const TCHAR *, FIL *)
 
FRESULT f_read (FIL *, void *, UINT, UINT *)
 
FRESULT f_readdir (DIR *, FILINFO *)
 
FRESULT f_rename (const TCHAR *, const TCHAR *)
 
FRESULT f_stat (const TCHAR *, FILINFO *)
 
FRESULT f_sync (FIL *)
 
FRESULT f_truncate (FIL *)
 
FRESULT f_unlink (const TCHAR *)
 
FRESULT f_utime (const TCHAR *, const FILINFO *)
 
FRESULT f_write (FIL *, const void *, UINT, UINT *)
 
DWORD get_fattime (void)
 Current time returned is packed into a uint32_t value. More...
 

#define _FATFS   6502 /* Revision ID */
#define _T (   x)    x
#define _TEXT (   x)    x
#define AM_ARC   0x20 /* Archive */

Referenced by f_chmod(), f_rename(), and f_sync().

#define AM_DIR   0x10 /* Directory */
#define AM_HID   0x02 /* Hidden */

Referenced by f_chmod().

#define AM_LFN   0x0F /* LFN entry */

Referenced by dir_find(), and dir_read().

#define AM_MASK   0x3F /* Mask of defined bits */

Referenced by dir_find(), and dir_read().

#define AM_RDO   0x01 /* Read only */

Referenced by f_chmod(), f_open(), and f_unlink().

#define AM_SYS   0x04 /* System */

Referenced by f_chmod().

#define AM_VOL   0x08 /* Volume label */

Referenced by dir_find(), and dir_read().

#define CREATE_LINKMAP   0xFFFFFFFF

Referenced by f_lseek().

#define EOF   (-1)
#define f_eof (   fp)    (((fp)->fptr == (fp)->fsize) ? 1 : 0)
#define f_error (   fp)    (((fp)->flag & FA__ERROR) ? 1 : 0)
#define f_size (   fp)    ((fp)->fsize)
#define f_tell (   fp)    ((fp)->fptr)
#define FA__DIRTY   0x40

Referenced by f_lseek(), f_read(), f_sync(), and f_write().

#define FA__ERROR   0x80

Referenced by f_lseek(), f_read(), f_truncate(), and f_write().

#define FA__WRITTEN   0x20
#define FA_CREATE_ALWAYS   0x08

Referenced by f_open(), and run_fatfs_test().

#define FA_CREATE_NEW   0x04

Referenced by f_open().

#define FA_OPEN_ALWAYS   0x10

Referenced by f_open().

#define FA_OPEN_EXISTING   0x00

Referenced by run_fatfs_test().

#define FA_READ   0x01

Referenced by f_open(), f_read(), and run_fatfs_test().

#define FA_WRITE   0x02
#define FS_FAT12   1
#define FS_FAT16   2
#define FS_FAT32   3
#define LD2PD (   vol)    (vol) /* Each logical drive is bound to the same physical drive number */

Referenced by chk_mounted().

#define LD2PT (   vol)    0 /* Always mounts the 1st partition or in SFD */

Referenced by chk_mounted().

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

Referenced by f_mkdir(), f_open(), f_sync(), put_fat(), and sync().

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

Referenced by f_utime(), put_fat(), and sync().

typedef char TCHAR

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 
FR_LOCKED 
FR_NOT_ENOUGH_CORE 
FR_TOO_MANY_OPEN_FILES 
FR_INVALID_PARAMETER 

FRESULT f_chdir ( const TCHAR )
FRESULT f_chdrive ( BYTE  )
FRESULT f_fdisk ( BYTE  ,
const DWORD  [],
void *   
)
FRESULT f_forward ( FIL ,
UINT(*)(const BYTE *, UINT ,
UINT  ,
UINT  
)
FRESULT f_getcwd ( TCHAR ,
UINT   
)
TCHAR* f_gets ( TCHAR ,
int  ,
FIL  
)
FRESULT f_mkfs ( BYTE  ,
BYTE  ,
UINT   
)

Referenced by run_fatfs_test().

int f_printf ( FIL ,
const TCHAR ,
  ... 
)
int f_putc ( TCHAR  ,
FIL  
)
int f_puts ( const TCHAR ,
FIL  
)
DWORD get_fattime ( void  )

Current time returned is packed into a uint32_t value.

The bit field is as follows:

bit31:25 Year from 1980 (0..127)

bit24:21 Month (1..12)

bit20:16 Day in month(1..31)

bit15:11 Hour (0..23)

bit10:5 Minute (0..59)

bit4:0 Second (0..29)

Returns
Current time.

References calendar_timestamp_to_date(), calendar_date::date, calendar_date::hour, calendar_date::minute, calendar_date::month, rtc_get_time(), calendar_date::second, and calendar_date::year.

Referenced by f_mkdir(), f_open(), and f_sync().