VSF Documented
vsf_fs_cfg.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18/*============================ INCLUDES ======================================*/
19
22
23#ifndef __VSF_FS_CFG_H__
24#define __VSF_FS_CFG_H__
25
26#if VSF_USE_FS == ENABLED
27
28/*============================ MACROS ========================================*/
29
30#ifndef VSF_FS_ASSERT
31# define VSF_FS_ASSERT VSF_ASSERT
32#endif
33
34#if VSF_FS_USE_FATFS == ENABLED
35# if VSF_FS_USE_MALFS != ENABLED
36# undef VSF_FS_USE_MALFS
37# define VSF_FS_USE_MALFS ENABLED
38# endif
39#endif
40
41#if VSF_FS_CFG_CACHE == ENABLED
42# warning cache is not supported now, disable VSF_FS_CFG_CACHE
43# undef VSF_FS_CFG_CACHE
44# define VSF_FS_CFG_CACHE DISABLED
45#endif
46
47#ifndef VSF_FS_CFG_LOCK
48# define VSF_FS_CFG_LOCK ENABLED
49#endif
50
51#ifndef VSF_FS_CFG_TIME
52# define VSF_FS_CFG_TIME ENABLED
53#endif
54
55#ifndef VSF_FS_CFG_VFS_FILE_HAS_OP
56# define VSF_FS_CFG_VFS_FILE_HAS_OP ENABLED
57#endif
58
59// VSF_FS_CFG_FILE_POOL_FILE_SIZE is file byte size in file pool
60// VSF_FS_CFG_FILE_POOL_SIZE is file number in file pool
61#if (defined(VSF_FS_CFG_FILE_POOL_SIZE) && !defined(VSF_FS_CFG_FILE_POOL_FILE_SIZE))\
62 || (!defined(VSF_FS_CFG_FILE_POOL_SIZE) && defined(VSF_FS_CFG_FILE_POOL_FILE_SIZE))
63# warning both VSF_FS_CFG_FILE_POOL_SIZE and VSF_FS_CFG_FILE_POOL_FILE_SIZE MUST\
64 be defined to enable file pool.
65#endif
66#if defined(VSF_FS_CFG_FILE_POOL_SIZE) && defined(VSF_FS_CFG_FILE_POOL_FILE_SIZE)
67# define VSF_FS_CFG_FILE_POOL ENABLED
68#endif
69#if VSF_FS_CFG_FILE_POOL == ENABLED && VSF_USE_POOL != ENABLED
70# error please enable VSF_USE_POOL to use file_pool
71#endif
72
73#if VSF_FS_CFG_FILE_POOL != ENABLED
74// file pool not enabled, check VSF_FS_CFG_MALLOC and VSF_FS_CFG_FREE
75#if defined(VSF_FS_CFG_MALLOC) && !defined(VSF_FS_CFG_FREE)
76# error VSF_FS_CFG_FREE must be defined
77#endif
78#if !defined(VSF_FS_CFG_MALLOC) && defined(VSF_FS_CFG_FREE)
79# error VSF_FS_CFG_MALLOC must be defined
80#endif
81
82#undef __VSF_FS_WARN_HEAP
83#ifndef VSF_FS_CFG_MALLOC
84# if VSF_USE_HEAP != ENABLED
85# define VSF_FS_CFG_MALLOC(...) ((vk_file_t *)NULL)
86# define VSF_FS_CFG_FREE(...)
87# define __VSF_FS_WARN_HEAP
88# else
89# define VSF_FS_CFG_MALLOC vsf_heap_malloc
90# define VSF_FS_CFG_FREE vsf_heap_free
91# endif
92#endif
93#endif
94
95/*============================ MACROFIED FUNCTIONS ===========================*/
96/*============================ TYPES =========================================*/
97
98// for libc sorce codes which want types and consts below
99typedef enum vk_file_attr_t {
106 // __VSF_FILE_ATTR_DYN is for internal usage only, to indicated resources are dynamically allocated
110 // make vk_file_attr_t 32bit
111 VSF_FILE_ATTR_MAX = 1UL << 31,
113
114typedef enum vk_file_whence_t {
119
120/*============================ GLOBAL VARIABLES ==============================*/
121/*============================ LOCAL VARIABLES ===============================*/
122/*============================ PROTOTYPES ====================================*/
123
124
125#endif // VSF_USE_FS
126#endif // __VSF_FS_CFG_H__
127/* EOF */
vk_file_attr_t
Definition vsf_fs_cfg.h:99
@ VSF_FILE_ATTR_WRITE
Definition vsf_fs_cfg.h:101
@ VSF_FILE_ATTR_READ
Definition vsf_fs_cfg.h:100
@ VSF_FILE_ATTR_HIDDEN
Definition vsf_fs_cfg.h:103
@ VSF_FILE_ATTR_EXT
Definition vsf_fs_cfg.h:108
@ VSF_FILE_ATTR_DIRECTORY
Definition vsf_fs_cfg.h:104
@ VSF_FILE_ATTR_USER
Definition vsf_fs_cfg.h:109
@ __VSF_FILE_ATTR_DYN
Definition vsf_fs_cfg.h:107
@ VSF_FILE_ATTR_MAX
Definition vsf_fs_cfg.h:111
@ VSF_FILE_ATTR_LNK
Definition vsf_fs_cfg.h:105
@ VSF_FILE_ATTR_EXECUTE
Definition vsf_fs_cfg.h:102
vk_file_whence_t
Definition vsf_fs_cfg.h:114
@ VSF_FILE_SEEK_CUR
Definition vsf_fs_cfg.h:116
@ VSF_FILE_SEEK_END
Definition vsf_fs_cfg.h:117
@ VSF_FILE_SEEK_SET
Definition vsf_fs_cfg.h:115