/* config.h - Compile-time configuration for sbc-harness * * Copyright (C) 2024 Luke T. Shumaker * SPDX-Licence-Identifier: AGPL-3.0-or-later */ #ifndef _CONFIG_H_ #define _CONFIG_H_ /*#include */ #if defined(USE_CONFIG_NETIO_POSIX) || defined(USE_CONFIG_COROUTINE) # define CONFIG_NETIO_NUM_CONNS 8 #endif #ifdef USE_CONFIG_NETIO_POSIX # define CONFIG_NETIO_ISLINUX 1 /* can we use Linux-kernel-specific fcntls? */ # define CONFIG_NETIO_NUM_PORTS 1 #endif #ifdef USE_CONFIG_COROUTINE # define CONFIG_COROUTINE_DEFAULT_STACK_SIZE (8*1024) # define CONFIG_COROUTINE_MEASURE_STACK 1 /* bool */ # define CONFIG_COROUTINE_PROTECT_STACK 1 /* bool */ # define CONFIG_COROUTINE_DEBUG 0 /* bool */ # define CONFIG_COROUTINE_NUM (1 /* usb_common */ +\ 1 /* usb_keyboard */ +\ CONFIG_NETIO_NUM_CONNS /* accept+read */ +\ (2*CONFIG_NETIO_NUM_CONNS) /* work+write */ ) /*static_assert((CONFIG_COROUTINE_NUM * CONFIG_COROUTINE_DEFAULT_STACK_SIZE) < (264 * 1024)); */ #endif #ifdef USE_CONFIG_TUSB # include "tusb_config.h" #endif #ifdef USE_CONFIG_9P # define CONFIG_9P_PORT 564 /** * This max-msg-size is sized so that a Twrite message can return * 8KiB of data. * * This is the same as the default in Plan 9 4e's lib9p; it has the * comment that "24" is "ample room for Twrite/Rread header * (iounit)". In fact, the Twrite header is only 23 bytes * ("size[4] Twrite[1] tag[2] fid[4] offset[8] count[4]") and the * Rread header is even shorter at 11 bytes ("size[4] Rread[1] * tag[2] count[4]"), so "24" appears to be the size of the Twrite * header rounded up to a nice round number. * * In older versions of 9P ("9P1"), the max message size was * defined as part of the protocol specification rather than * negotiated. In Plan 9 1e it was (8*1024)+128, and was bumped to * (8*1024)+160 in 2e and 3e. */ # define CONFIG_9P_MAX_MSG_SIZE ((8*1024)+24) # define CONFIG_9P_MAX_ERR_SIZE 128 /* 128 is what Plan 9 4e uses */ #endif #endif /* _CONFIG_H */