fatfs.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2017 HAW-Hamburg
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #include "fatfs/source/ff.h"
24 #include "vfs.h"
25 
26 #ifndef FATFS_YEAR_OFFSET
28 #define FATFS_YEAR_OFFSET (1980)
29 #endif
30 
32 #define EPOCH_YEAR_OFFSET (1970)
33 
35 #define FATFS_MAX_VOL_STR_LEN (6)
36 
38 #define FATFS_MOUNT_OPT (1)
39 
41 #ifndef CONFIG_FATFS_FORMAT_TYPE
42 #if FF_FS_EXFAT
43 #define CONFIG_FATFS_FORMAT_TYPE FM_EXFAT
44 #else
45 #define CONFIG_FATFS_FORMAT_TYPE FM_ANY
46 #endif
47 #endif
48 
58 #ifndef CONFIG_FATFS_FORMAT_ALLOC_STATIC
59 #define CONFIG_FATFS_FORMAT_ALLOC_STATIC 0
60 #endif
61 
68 #define FATFS_MAX_ABS_PATH_SIZE (FATFS_MAX_VOL_STR_LEN + VFS_NAME_MAX + 1)
69 
73 typedef struct fatfs_desc {
74  FATFS fat_fs;
76  uint8_t vol_idx;
82 
86 typedef struct fatfs_file_desc {
87  FIL file;
88  char fname[VFS_NAME_MAX + 1];
91 
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
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:68
#define VFS_NAME_MAX
Maximum length of the name in a vfs_dirent_t (not including terminating null)
Definition: vfs.h:313
FatFs instance descriptor.
Definition: fatfs.h:73
uint8_t vol_idx
low level device that is used by FatFs
Definition: fatfs.h:76
char abs_path_str_buff[FATFS_MAX_ABS_PATH_SIZE]
most FatFs file operations need an absolute path.
Definition: fatfs.h:80
FATFS fat_fs
FatFs work area needed for each volume.
Definition: fatfs.h:74
mtd_dev_t * dev
MTD device to use.
Definition: fatfs.h:75
FatFs file instance descriptor.
Definition: fatfs.h:86
char fname[VFS_NAME_MAX+1]
name of the file (e.g.
Definition: fatfs.h:88
FIL file
FatFs work area for a single file.
Definition: fatfs.h:87
MTD device descriptor.
Definition: mtd.h:111
A file system driver.
Definition: vfs.h:386