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/ff.h"
28 #include "vfs.h"
29 
30 #ifndef FATFS_YEAR_OFFSET
31 
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 
50 #define FATFS_MAX_ABS_PATH_SIZE (FATFS_MAX_VOL_STR_LEN + VFS_NAME_MAX + 1)
51 
55 typedef struct fatfs_desc {
56  FATFS fat_fs;
57  uint8_t vol_idx;
62 } fatfs_desc_t;
63 
67 typedef struct fatfs_file_desc {
68  FIL file;
69  char fname[VFS_NAME_MAX + 1];
72 
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif /* FS_FATFS_H */
82 
fatfs_desc::fat_fs
FATFS fat_fs
FatFs work area needed for each volume.
Definition: fatfs.h:56
fatfs_file_desc
FatFs file instance descriptor.
Definition: fatfs.h:67
fatfs_desc
FatFs instance descriptor.
Definition: fatfs.h:55
fatfs_desc::vol_idx
uint8_t vol_idx
low level device that is used by FatFs
Definition: fatfs.h:57
vfs_file_system_t
A file system driver.
Definition: vfs.h:256
FATFS_MAX_ABS_PATH_SIZE
#define FATFS_MAX_ABS_PATH_SIZE
Size of path buffer for absolute paths.
Definition: fatfs.h:50
fatfs_file_system
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.
fatfs_file_desc::file
FIL file
FatFs work area for a single file.
Definition: fatfs.h:68
VFS_NAME_MAX
#define VFS_NAME_MAX
Maximum length of the name in a vfs_dirent_t (not including terminating null)
Definition: vfs.h:223
fatfs_desc_t
struct fatfs_desc fatfs_desc_t
FatFs instance descriptor.
fatfs_desc::abs_path_str_buff
char abs_path_str_buff[FATFS_MAX_ABS_PATH_SIZE]
most FatFs file operations need an absolute path.
Definition: fatfs.h:61
fatfs_file_desc_t
struct fatfs_file_desc fatfs_file_desc_t
FatFs file instance descriptor.
vfs.h
VFS layer API declarations.
fatfs_file_desc::fname
char fname[VFS_NAME_MAX+1]
name of the file (e.g.
Definition: fatfs.h:69