• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ----------------------------------------------------------------------------
2  * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
3  * Description: LiteOS compat headfile for nuttx config
4  * Author: Huawei LiteOS Team
5  * Create: 2022-07-15
6  * Redistribution and use in source and binary forms, with or without modification,
7  * are permitted provided that the following conditions are met:
8  * 1. Redistributions of source code must retain the above copyright notice, this list of
9  * conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11  * of conditions and the following disclaimer in the documentation and/or other materials
12  * provided with the distribution.
13  * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14  * to endorse or promote products derived from this software without specific prior written
15  * permission.
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  * --------------------------------------------------------------------------- */
28 
29 #ifndef __INCLUDE_NUTTX_CONFIG_H
30 #define __INCLUDE_NUTTX_CONFIG_H
31 
32 /****************************************************************************
33  * Included Files
34  ****************************************************************************/
35 
36 #include "nuttx/net_config.h"
37 #include "nuttx/vfs_oflags.h"
38 #include "limits.h"
39 
40 /****************************************************************************
41  * Pre-processor Definitions
42  ****************************************************************************/
43 
44 /* Do not modify the following macro definition switch. */
45 #ifdef LOSCFG_FS_VFS
46 #define CONFIG_VFS_64BIT_ACCESS /* To support access to files and devices larger than 2 ^ 32 byte size. */
47 #define CONFIG_VFS_FILE_FORCE_RELEASE
48 #define CONFIG_VFS_POSIX_OFLAGS /* LiteOS uses the POSIX standard oflags. */
49 #define CONFIG_VFS_BIND_WITH_PATH
50 #define CONFIG_VFS_UNBIND_WITHOUT_FLAGS
51 #define CONFIG_VFS_OPERATION_EXTEND
52 #define CONFIG_VFS_FILES_EXTEND_DISABLE
53 
54 #define CONFIG_VFS_DIR_VERIFY
55 #define CONFIG_VFS_FULLPATH_ACQUIRE
56 #define CONFIG_VFS_DRIVER_PATH_VERIFY
57 #define CONFIG_VFS_DIR_POSITION_RESET
58 #define CONFIG_VFS_BLOCKPROXY_SEM
59 
60 #define CONFIG_VFS_FILELIST_ALLOC
61 #define CONFIG_FILES_ALLOCATE_WITH_FILEP
62 #define CONFIG_VFS_MINFD_VERIFY
63 #define FILE_START_FD 3
64 #define CONFIG_VFS_SOCKET
65 #define CONFIG_VFS_CONSOLE
66 #define CONFIG_VFS_CLOSE_SOCKET
67 #define CONFIG_VFS_VFCNTL_SOCKET
68 #define CONFIG_VFS_IOCTL_EXTEND
69 #define CONFIG_VFS_READ_EXTEND
70 #define CONFIG_VFS_WRITE_EXTEND
71 #define CONFIG_VFS_INODE_FREE
72 #define CONFIG_VFS_INODE_ALLOC
73 #define CONFIG_VFS_INODE_PATH_VERIFY
74 #define CONFIG_VFS_FD_PRE_ALLOC
75 #define CONFIG_VFS_SUPPORT_ERROR_RETURN
76 #define CONFIG_VFS_SEEK_VERIFY
77 #define CONFIG_VFS_DISK_STATUS_VERIFY
78 #define CONFIG_VFS_SPECIAL_FD_VERIFY
79 #define CONFIG_VFS_SET_STATFSBUF_DISABLE
80 #define CONFIG_VFS_DISABLE_REMOVE_OLDINODE
81 #define CONFIG_VFS_ENABLE_SAME_DIR_RENAME
82 #define CONFIG_VFS_ENABLE_FILE_STRUCT_PATH
83 #define CONFIG_VFS_DISABLE_INODE_CHECKFLAGS
84 #define CONFIG_VFS_FILE_PRE_CLOSE
85 #ifdef LOSCFG_COMPAT_LINUX
86 #define CONFIG_VFS_POLL_WITHOUT_SETUP
87 #define CONFIG_VFS_OPTIMIZATION_ALLOC_POLLFD
88 #else
89 #define CONFIG_VFS_POLL_DISABLE
90 #endif
91 #define CONFIG_VFS_POLLSET_EVENT_EXTEND
92 #define CONFIG_VFS_UMOUNT_WITHOUT_FLAGS
93 #define CONFIG_VFS_CHANGE_REFERENCE_COUNT
94 #define CONFIG_VFS_INODE_UBIND
95 #define CONFIG_VFS_DESC_PATH_VERIFY
96 #define CONFIG_VFS_OFFSETOF_MARCO_DISABLE
97 #define CONFIG_VFS_DISABLE_INCLUDE_NUTTX_FS_H
98 #define CONFIG_VFS_SIMPLE_DEBUG
99 #define CONFIG_VFS_DIRENT_FS
100 #define CONFIG_VFS_RMDIR_RELPATH_VERIFY
101 #define CONFIG_VFS_TRUNCATE_LENGTH_VERIFY
102 #define CONFIG_VFS_WRITEV_SUPPORT
103 #define CONFIG_VFS_FILELIST_EXTERN
104 #define CONFIG_VFS_MOUNT_STATUS_ENABLE
105 #define CONFIG_VFS_READV_VERIFY
106 #define CONFIG_VFS_READV_ONCE
107 #define CONFIG_VFS_EXTEND_HEADER_FILE
108 
109 #undef  OK
110 #define OK 0
111 
112 /* POSIX-like OS return values: */
113 #ifndef VFS_ERROR
114 #define VFS_ERROR -1
115 #endif
116 #endif
117 
118 #ifdef LOSCFG_FS_VFS_BLOCK_DEVICE
119 #define CONFIG_BCH_EXTEND_SIZE 16
120 #else
121 #define CONFIG_VFS_DISABLE_BLOCK_DEVICE
122 #endif
123 
124 #ifdef LOSCFG_DRIVERS_VIDEO
125 #define CONFIG_FB_CMAP
126 #define CONFIG_FB_OVERLAY_BLIT
127 #define CONFIG_FB_OVERLAY
128 #define CONFIG_FB_TRANSPARENCY
129 #define CONFIG_FB_FUNCTIONS_EXTEND
130 #define CONFIG_FB_OPEN_ENABLE
131 #define CONFIG_FB_CLOSE_ENABLE
132 #define CONFIG_FB_COPY_WITHOUT_OFFSET
133 #define CONFIG_FB_IOCTL_DEFAULT_FUNC
134 #define CONFIG_FB_UNREGISTER_FUNC
135 #define CONFIG_FB_DISPLAY_CHECK
136 #define CONFIG_FB_GLOBAL_DEVICE
137 #define CONFIG_FB_PRIVATE_IOCTL
138 #define CONFIG_FB_VTABLE_EXTEND
139 
140 #define FB_DEV_MAXNUM   32
141 #endif
142 
143 #ifdef LOSCFG_FS_NFS
144 #define CONFIG_NFS_EXTEND
145 #define CONFIG_NFS_READDIR_HANEWIN_SERVER_SUPPORT
146 #define CONFIG_NFS_RPC_PATH_MAX
147 #define CONFIG_NFS_BIND_BAD_JUMP
148 #define CONFIG_NFS_UMOUNT_STATUS_ACQUIRE
149 #define CONFIG_NFS_SOCKADDR_USED
150 #define CONFIG_NFS_FWARN_USED
151 #define CONFIG_NFS_ENTRY3_USED
152 
153 #define CONFIG_NFS_FILE_ATTR_UPDATE
154 #define CONFIG_NFS_ATTR_FIELD_PARSE
155 #define CONFIG_NFS_DIR_OPEN_CHECK
156 #define CONFIG_NFS_UDP_BIG_MSS
157 #define CONFIG_NFS_SEEK_ENABLE
158 #define CONFIG_NFS_RAND_XID
159 #define CONFIG_NFS_RPC_PATH_VERIFY
160 #define CONFIG_NFS_RPC_FHSIZIE_VERIFY
161 #define CONFIG_NFS_APPEND_OFLAGS_SUPPORT
162 
163 #define CONFIG_NFS_PSOCK_INIT
164 
165 #define CONFIG_NFS_TCP_ALIVE_CHECK
166 #define CONFIG_NFS_TCP_RECONNECT
167 #define CONFIG_NFS_TCP_PORT_BIND
168 #define CONFIG_NFS_TCP_RECV_RETRY
169 
170 #define CONFIG_NFS_UNIX_CONFIG
171 
172 #define CONFIG_NFS_PARAMS_DEFINED
173 #define CONFIG_NFS_UNSTABLE_WRITE /* Write to NFS server cache instead of disk */
174 #define CONFIG_NFS_TCP_TIMEOUT 50
175 
176 #define NFS_TIMEO          10             /* 10 tick = 1 second */
177 #define NFS_MINTIMEO       10             /* Min timeout to use */
178 #define NFS_MAXTIMEO       255            /* Max timeout to backoff to */
179 #define NFS_MAXREXMIT      10             /* Stop counting after this many */
180 #define NFS_RETRANS        5              /* Num of retrans for soft mounts */
181 #define NFS_WSIZE          (8192 * 4)     /* Def. write data size <= 8192 * 4 */
182 #define NFS_RSIZE          (8192 * 4)     /* Def. read data size <= 8192 * 4 */
183 #define NFS_READDIRSIZE    1024           /* Def. readdir size */
184 #define DIRENT_NFS_MAXHANDLE    64        /* Maximum length of an NFSv3 file handle */
185 #define DIRENT_NFS_VERFLEN      8         /* Length of the copy verifier */
186 #endif
187 
188 #ifdef LOSCFG_FS_ROMFS
189 #define CONFIG_FS_ROMFS
190 #define CONFIG_ROMFS_EXTEND_SIZE 8
191 #define CONFIG_ROMFS_DISABLE_IOCTL
192 #endif
193 
194 #ifdef LOSCFG_FS_RAMFS
195 #define CONFIG_FS_TMPFS
196 #define TMPFS_MAGIC RAMFS_MAGIC
197 #define CONFIG_TMPFS_ENABLE_SYNC
198 #define CONFIG_TMPFS_DISABLE_IOCTL
199 #define CONFIG_TMPFS_DISABLE_DUP
200 #define CONFIG_TMPFS_TIME_EXTEND
201 #define CONFIG_TMPFS_NLINK_EXTEND
202 #define CONFIG_TMPFS_D_OFF_EXTEND
203 #define CONFIG_TMPFS_RETURN_VALUE_EXTEND
204 #define CONFIG_TMPFS_RENAME_DELETE_EXISTING_FILE
205 #define CONFIG_TMPFS_RENAME_CHECK_NAME_LEN_EXTEND
206 #define CONFIG_TMPFS_STRNDUP_NOT_SUPPORT
207 #define CONFIG_TMPFS_WRITE_UNIT_EXTEND
208 #define CONFIG_TMPFS_READ_VERIFY
209 #define CONFIG_TMPFS_LEN_VERIFY
210 #define CONFIG_TMPFS_PARAM_NEGATIVE_VERIFY
211 #define CONFIG_TMPFS_SEM_INIT_VERIFY
212 #define CONFIG_TMPFS_DYNAMIC_SEM_DESTROY
213 #define CONFIG_TMPFS_UNBIND_BUSY
214 #define CONFIG_TMPFS_STATIC_SUPER_BLOCK
215 
216 #define CONFIG_FS_TMPFS_DIRECTORY_FREEGUARD	64
217 #define CONFIG_FS_TMPFS_DIRECTORY_ALLOCGUARD	48
218 #define CONFIG_FS_TMPFS_FILE_FREEGUARD  ~0UL
219 #define CONFIG_FS_TMPFS_FILE_ALLOCGUARD 48
220 #define CONFIG_FS_TMPFS_BLOCKSIZE   1
221 #endif
222 
223 #define CONFIG_DISABLE_MQUEUE   // disable posix mqueue inode configure
224 #define CONFIG_DISABLE_ENVIRON  // disable obtain the current working path by environment variables
225 #define CONFIG_BCH
226 /* file system configur */
227 
228 #define CONFIG_FS_WRITABLE      // enable file system can be written
229 #define CONFIG_FS_READABLE      // enable file system can be read
230 #define CONFIG_DEBUG_FS         // enable vfs debug function
231 #define CONFIG_DEBUG_FEATURES   // enable param check
232 
233 /* pollfd count in stack, optimization in order to avoid small memory allocation */
234 
235 #define POLL_STACK_CNT 5
236 
237 /* nfs configure */
238 
239 #define CONFIG_NFS_MACHINE_NAME "IPC"   // nfs device name is IPC
240 #define CONFIG_NFS_MACHINE_NAME_SIZE 3  // size of nfs machine name
241 
242 /* file descriptors configure */
243 
244 #define CONFIG_NFILE_STREAMS        1   // enable file stream
245 #define CONFIG_STDIO_BUFFER_SIZE    0
246 #define CONFIG_NUNGET_CHARS         0
247 
248 #ifndef FD_SETSIZE
249 #define FD_SETSIZE  512  // total fds
250 #endif
251 
252 #ifndef CONFIG_NFILE_DESCRIPTORS
253 #define CONFIG_NFILE_DESCRIPTORS    256
254 #endif
255 /* directory configure */
256 
257 #define VFS_USING_WORKDIR               // enable current working directory
258 
259 #ifdef LOSCFG_DRIVERS_USB_GADGET
260 #define CONFIG_USBDEV_COMPOSITE
261 #define CONFIG_USBDEV_DMA
262 
263 #define CONFIG_COMPOSITE_VENDORID   0x03eb
264 #define CONFIG_COMPOSITE_PRODUCTID  0x2022
265 #define CONFIG_COMPOSITE_VENDORSTR  "NuttX"
266 #define CONFIG_COMPOSITE_PRODUCTSTR "Composite Device"
267 
268 #ifdef LOSCFG_DRIVERS_USB3_DEVICE_CONTROLLER
269 #define CONFIG_USBDEV_EXTEND_USB3_DEVICE_CONTROLLER
270 #endif
271 #define CONFIG_USBDEV_EXTEND_EP
272 #define CONFIG_USBDEV_EXTEND_EP_FLUSH
273 #define CONFIG_USBDEV_ALT_ALLOCEP_BY_DESC
274 #define CONFIG_USBDEV_ALT_UNBIND_WITH_RET
275 
276 #define CONFIG_COMPOSITE_DISABLE_CRITICAL
277 #define CONFIG_COMPOSITE_EXTEND_MKDEVDESC
278 #define CONFIG_COMPOSITE_EXTEND_CLASSUP
279 #define CONFIG_COMPOSITE_EXTEND_SPECIFIC_CTRLREQ_SIZE
280 #define CONFIG_COMPOSITE_EXTEND_SETUP
281 #define CONFIG_COMPOSITE_EXTEND_BOS_DESC
282 #define CONFIG_COMPOSITE_ALT_EPBUF_NONCACHE
283 #define CONFIG_COMPOSITE_ALT_SPEED_HIGH
284 #define CONFIG_COMPOSITE_ALT_REQ_TYPE_STADDARD_ALL
285 #define CONFIG_COMPOSITE_ALT_GET_USB_CLASS_DESC
286 #define CONFIG_COMPOSITE_ALT_SETCONFIG_SUBMIT
287 #define CONFIG_COMPOSITE_ALT_GETCONFIG_SUBMIT
288 #define CONFIG_COMPOSITE_ALT_RELEASE_ONCE
289 #endif /* LOSCFG_DRIVERS_USB_GADGET */
290 
291 #if defined(LOSCFG_DRIVERS_USB_ETHERNET_GADGET) || defined(LOSCFG_DRIVERS_USB_ETH_SER_GADGET)
292 #define CONFIG_NET_GUARDSIZE       2
293 #define CONFIG_NET_ETH_PKTSIZE     1500
294 #define CONFIG_RNDIS_COMPOSITE
295 #define CONFIG_RNDIS_NWRREQS       0
296 
297 #ifdef LOSCFG_DRIVERS_USB3_DEVICE_CONTROLLER
298 #define CONFIG_RNDIS_BULKIN_REQLEN 0x800
299 #else
300 #define CONFIG_RNDIS_BULKIN_REQLEN 0x600
301 #endif /* LOSCFG_DRIVERS_USB3_DEVICE_CONTROLLER */
302 
303 #define CONFIG_RNDIS_ALT_ALLOC_DYNAMIC
304 #define CONFIG_RNDIS_ALT_LWIP
305 #define CONFIG_RNDIS_ALT_DESC
306 #define CONFIG_RNDIS_ALT_HANDLE_BY_CALLBACK
307 #define CONFIG_RNDIS_ALT_GET_CTRLREQ_BY_DEV
308 #define CONFIG_RNDIS_ALT_EP_CONFIG
309 #define CONFIG_RNDIS_ALT_SPEED_HIGH
310 #define CONFIG_RNDIS_ENBALE_DATA_CRITICAL
311 #define CONFIG_RNDIS_DISABLE_CTRL_CRITICAL
312 #define CONFIG_RNDIS_DISABLE_EP_CANCEL
313 #define CONFIG_RNDIS_EXTEND_INITIALIZE
314 #define CONFIG_RNDIS_EXTEND_UNINITIALIZE
315 #define CONFIG_RNDIS_EXTEND_BIND_DEV
316 #define CONFIG_RNDIS_EXTEND_RANDOM_MAC
317 #define CONFIG_RNDIS_EXTEND_SETINTERFACE
318 #endif /* LOSCFG_DRIVERS_USB_ETHERNET_GADGET || LOSCFG_DRIVERS_USB_ETH_SER_GADGET */
319 
320 #ifdef CONFIG_DRIVERS_USB_DFU_GADGET
321 #define CONFIG_DFU_INTERFACE_NAME "DFU interface"
322 #define CONFIG_DFU_ALT_CONFIG_DESC
323 #define CONFIG_DFU_ALT_HANDLE_CLASS_REQ
324 #define CONFIG_DFU_ALT_GET_CTRLREQ_BY_DEV
325 #define CONFIG_DFU_EXTEND_SETCONFIG
326 #define CONFIG_DFU_EXTEND_INIT
327 #define CONFIG_DFU_EXTEND_UNBIND_CHECK
328 #endif /* CONFIG_DRIVERS_USB_DFU_GADGET */
329 
330 #endif /* __INCLUDE_NUTTX_CONFIG_H */
331