fatfs.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 HAW-Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef FS_FATFS_H
21 #define FS_FATFS_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include "fatfs/source/ff.h"
28 #include "vfs.h"
29 
30 #ifndef FATFS_YEAR_OFFSET
32 #define FATFS_YEAR_OFFSET (1980)
33 #endif
34 
36 #define EPOCH_YEAR_OFFSET (1970)
37 
39 #define FATFS_MAX_VOL_STR_LEN (6)
40 
42 #define FATFS_MOUNT_OPT (1)
43 
45 #ifndef CONFIG_FATFS_FORMAT_TYPE
46 #if FF_FS_EXFAT
47 #define CONFIG_FATFS_FORMAT_TYPE FM_EXFAT
48 #else
49 #define CONFIG_FATFS_FORMAT_TYPE FM_ANY
50 #endif
51 #endif
52 
62 #ifndef CONFIG_FATFS_FORMAT_ALLOC_STATIC
63 #define CONFIG_FATFS_FORMAT_ALLOC_STATIC 0
64 #endif
65 
72 #define FATFS_MAX_ABS_PATH_SIZE (FATFS_MAX_VOL_STR_LEN + VFS_NAME_MAX + 1)
73 
77 typedef struct fatfs_desc {
78  FATFS fat_fs;
80  uint8_t vol_idx;
86 
90 typedef struct fatfs_file_desc {
91  FIL file;
92  char fname[VFS_NAME_MAX + 1];
95 
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* FS_FATFS_H */
105 
struct fatfs_desc fatfs_desc_t
FatFs instance descriptor.
struct fatfs_file_desc fatfs_file_desc_t
FatFs file instance descriptor.
const vfs_file_system_t fatfs_file_system
The FatFs vfs driver, a pointer to a fatfs_desc_t must be provided as vfs_mountp::private_data.
#define FATFS_MAX_ABS_PATH_SIZE
Size of path buffer for absolute paths.
Definition: fatfs.h:72
#define VFS_NAME_MAX
Maximum length of the name in a vfs_dirent_t (not including terminating null)
Definition: vfs.h:302
FatFs instance descriptor.
Definition: fatfs.h:77
uint8_t vol_idx
low level device that is used by FatFs
Definition: fatfs.h:80
char abs_path_str_buff[FATFS_MAX_ABS_PATH_SIZE]
most FatFs file operations need an absolute path.
Definition: fatfs.h:84
FATFS fat_fs
FatFs work area needed for each volume.
Definition: fatfs.h:78
mtd_dev_t * dev
MTD device to use.
Definition: fatfs.h:79
FatFs file instance descriptor.
Definition: fatfs.h:90
char fname[VFS_NAME_MAX+1]
name of the file (e.g.
Definition: fatfs.h:92
FIL file
FatFs work area for a single file.
Definition: fatfs.h:91
MTD device descriptor.
Definition: mtd.h:112
A file system driver.
Definition: vfs.h:375