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 
9 #pragma once
10 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include "fatfs/source/ff.h"
27 #include "vfs.h"
28 
29 #ifndef FATFS_YEAR_OFFSET
31 #define FATFS_YEAR_OFFSET (1980)
32 #endif
33 
35 #define EPOCH_YEAR_OFFSET (1970)
36 
38 #define FATFS_MAX_VOL_STR_LEN (6)
39 
41 #define FATFS_MOUNT_OPT (1)
42 
44 #ifndef CONFIG_FATFS_FORMAT_TYPE
45 #if FF_FS_EXFAT
46 #define CONFIG_FATFS_FORMAT_TYPE FM_EXFAT
47 #else
48 #define CONFIG_FATFS_FORMAT_TYPE FM_ANY
49 #endif
50 #endif
51 
61 #ifndef CONFIG_FATFS_FORMAT_ALLOC_STATIC
62 #define CONFIG_FATFS_FORMAT_ALLOC_STATIC 0
63 #endif
64 
71 #define FATFS_MAX_ABS_PATH_SIZE (FATFS_MAX_VOL_STR_LEN + VFS_NAME_MAX + 1)
72 
76 typedef struct fatfs_desc {
77  FATFS fat_fs;
79  uint8_t vol_idx;
85 
89 typedef struct fatfs_file_desc {
90  FIL file;
91  char fname[VFS_NAME_MAX + 1];
94 
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
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:71
#define VFS_NAME_MAX
Maximum length of the name in a vfs_dirent_t (not including terminating null)
Definition: vfs.h:301
FatFs instance descriptor.
Definition: fatfs.h:76
uint8_t vol_idx
low level device that is used by FatFs
Definition: fatfs.h:79
char abs_path_str_buff[FATFS_MAX_ABS_PATH_SIZE]
most FatFs file operations need an absolute path.
Definition: fatfs.h:83
FATFS fat_fs
FatFs work area needed for each volume.
Definition: fatfs.h:77
mtd_dev_t * dev
MTD device to use.
Definition: fatfs.h:78
FatFs file instance descriptor.
Definition: fatfs.h:89
char fname[VFS_NAME_MAX+1]
name of the file (e.g.
Definition: fatfs.h:91
FIL file
FatFs work area for a single file.
Definition: fatfs.h:90
MTD device descriptor.
Definition: mtd.h:111
A file system driver.
Definition: vfs.h:374