fs_port.h
Go to the documentation of this file.
1 /**
2  * @file fs_port.h
3  * @brief File system abstraction layer
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.6
27  **/
28 
29 #ifndef _FS_PORT_H
30 #define _FS_PORT_H
31 
32 //Dependencies
33 #include "fs_port_config.h"
34 #include "os_port.h"
35 #include "date_time.h"
36 #include "error.h"
37 
38 //Maximum filename length
39 #ifndef FS_MAX_NAME_LEN
40  #define FS_MAX_NAME_LEN 127
41 #elif (FS_MAX_NAME_LEN < 11)
42  #error FS_MAX_NAME_LEN parameter is not valid
43 #endif
44 
45 //C++ guard
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 
51 /**
52  * @brief File attributes
53  **/
54 
55 typedef enum
56 {
64 
65 
66 /**
67  * @brief File access mode
68  **/
69 
70 typedef enum
71 {
76 } FsFileMode;
77 
78 
79 /**
80  * @brief File seek origin
81  **/
82 
83 typedef enum
84 {
88 } FsSeekOrigin;
89 
90 
91 /**
92  * @brief Directory entry
93  **/
94 
95 typedef struct
96 {
97  uint32_t attributes;
98  uint32_t size;
101 } FsDirEntry;
102 
103 
104 //FatFs port?
105 #if defined(USE_FATFS)
106  #include "fs_port_fatfs.h"
107 //SPIFFS port?
108 #elif defined(USE_SPIFFS)
109  #include "fs_port_spiffs.h"
110 //Windows port?
111 #elif defined(_WIN32)
112  #include "fs_port_posix.h"
113 //POSIX port?
114 #elif defined(__linux__) || defined(__FreeBSD__)
115  #include "fs_port_posix.h"
116 //Custom port?
117 #elif defined(USE_CUSTOM_FS)
118  #include "fs_port_custom.h"
119 #endif
120 
121 //C++ guard
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif
@ FS_FILE_ATTR_SYSTEM
Definition: fs_port.h:59
Date and time management.
@ FS_SEEK_SET
Definition: fs_port.h:85
char_t name[]
@ FS_FILE_MODE_WRITE
Definition: fs_port.h:73
@ FS_FILE_ATTR_HIDDEN
Definition: fs_port.h:58
@ FS_FILE_ATTR_DIRECTORY
Definition: fs_port.h:61
FsSeekOrigin
File seek origin.
Definition: fs_port.h:83
@ FS_FILE_ATTR_VOLUME_NAME
Definition: fs_port.h:60
@ FS_SEEK_END
Definition: fs_port.h:87
@ FS_SEEK_CUR
Definition: fs_port.h:86
#define FS_MAX_NAME_LEN
Definition: fs_port.h:40
Error codes description.
Date and time representation.
Definition: date_time.h:46
File system abstraction layer (POSIX)
char char_t
Definition: compiler_port.h:43
FsFileMode
File access mode.
Definition: fs_port.h:70
@ FS_FILE_ATTR_ARCHIVE
Definition: fs_port.h:62
DateTime modified
Definition: fs_port.h:99
Directory entry.
Definition: fs_port.h:95
uint32_t attributes
Definition: fs_port.h:97
uint32_t size
Definition: fs_port.h:98
@ FS_FILE_MODE_TRUNC
Definition: fs_port.h:75
FsFileAttributes
File attributes.
Definition: fs_port.h:55
@ FS_FILE_MODE_READ
Definition: fs_port.h:72
File system abstraction layer (FatFs)
@ FS_FILE_ATTR_READ_ONLY
Definition: fs_port.h:57
RTOS abstraction layer.
@ FS_FILE_MODE_CREATE
Definition: fs_port.h:74