diff options
Diffstat (limited to 'cmd/sbc_harness/config')
-rw-r--r-- | cmd/sbc_harness/config/config.h | 112 | ||||
-rw-r--r-- | cmd/sbc_harness/config/tusb_config.h | 129 |
2 files changed, 0 insertions, 241 deletions
diff --git a/cmd/sbc_harness/config/config.h b/cmd/sbc_harness/config/config.h deleted file mode 100644 index c2d72e4..0000000 --- a/cmd/sbc_harness/config/config.h +++ /dev/null @@ -1,112 +0,0 @@ -/* config.h - Compile-time configuration for sbc_harness - * - * Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com> - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -#ifndef _CONFIG_H_ -#define _CONFIG_H_ - -#include <stddef.h> /* for size_t */ - -/* RP2040 *********************************************************************/ - -#define CONFIG_RP2040_SPI_DEBUG 1 /* bool */ - -/* W5500 **********************************************************************/ - -/** - * When allocating an arbitrary local port, what range should it be - * allocated from? - * - * These are the default values of the Linux kernel's - * net.ipv4.ip_local_port_range, so I figure they're probably good - * values to use. - */ -#define CONFIG_W5500_LOCAL_PORT_MIN 32768 -#define CONFIG_W5500_LOCAL_PORT_MAX 60999 - -#define CONFIG_W5500_VALIDATE_SPI 1 /* bool */ -#define CONFIG_W5500_DEBUG 0 /* bool */ -#define CONFIG_W5500_LL_DEBUG 0 /* bool */ - -/* 9P *************************************************************************/ - -#define CONFIG_9P_PORT LIB9P_DEFAULT_PORT_9FS -/** - * 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 ((4*1024)+24) -/** - * Maximum host-data-structure size. A message may be larger in - * unmarshaled-host-structures than marshaled-net-bytes due to (1) - * struct padding, (2) nul-terminator byes for strings. - */ -#define CONFIG_9P_MAX_HOSTMSG_SIZE CONFIG_9P_MAX_MSG_SIZE+16 -#define CONFIG_9P_MAX_ERR_SIZE 128 /* 128 is what Plan 9 4e uses */ -#define CONFIG_9P_SRV_MAX_FIDS 16 -#define CONFIG_9P_SRV_MAX_REQS 2 -#define CONFIG_9P_SRV_MAX_DEPTH 3 -#define CONFIG_9P_ENABLE_9P2000 1 /* bool */ -#define CONFIG_9P_ENABLE_9P2000_u 1 /* bool */ -#define CONFIG_9P_ENABLE_9P2000_e 0 /* bool */ -#define CONFIG_9P_ENABLE_9P2000_L 0 /* bool */ -#define CONFIG_9P_ENABLE_9P2000_p9p 0 /* bool */ - -/* DHCP ***********************************************************************/ - -#define CONFIG_DHCP_CAN_RECV_UNICAST_IP_WITHOUT_IP 0 /* bool */ -#define CONFIG_DHCP_DEBUG 1 /* bool */ -#define CONFIG_DHCP_OPT_SIZE 312 /* minimum of 312 */ -#define CONFIG_DHCP_SELECTING_NS (5*NS_PER_S) - -/* USB KEYBOARD ***************************************************************/ - -/** - * Which USB port to use for the Root Hub. - * - * The RP2040 only has 1 port, so it's gotta be port #0. - */ -#define CONFIG_USB_COMMON_RHPORT 0 - -#define CONFIG_USB_COMMON_DEBUG 1 /* bool */ - -/* COROUTINE ******************************************************************/ - -extern const size_t CONFIG_COROUTINE_STACK_SIZE_dhcp_cr; -extern const size_t CONFIG_COROUTINE_STACK_SIZE_init_cr; -extern const size_t CONFIG_COROUTINE_STACK_SIZE_lib9p_srv_write_cr; -extern const size_t CONFIG_COROUTINE_STACK_SIZE_read9p_cr; -extern const size_t CONFIG_COROUTINE_STACK_SIZE_usb_common_cr; -extern const size_t CONFIG_COROUTINE_STACK_SIZE_usb_keyboard_cr; -extern const size_t CONFIG_COROUTINE_STACK_SIZE_w5500_irq_cr; -#define CONFIG_COROUTINE_NAME_LEN 16 -#define CONFIG_COROUTINE_MEASURE_STACK 1 /* bool */ -#define CONFIG_COROUTINE_PROTECT_STACK 1 /* bool */ -#define CONFIG_COROUTINE_DEBUG 0 /* bool */ -#define CONFIG_COROUTINE_VALGRIND 0 /* bool */ -#define CONFIG_COROUTINE_GDB 1 /* bool */ - -#define _CONFIG_9P_NUM_SOCKS 3 /* FIXME: bump this back up to 8 */ -#define CONFIG_COROUTINE_NUM ( \ - 1 /* usb_common */ + \ - 1 /* usb_keyboard */ + \ - 1 /* W5500 irq handler */ + \ - _CONFIG_9P_NUM_SOCKS /* 9P accept()+read() */ + \ - (CONFIG_9P_SRV_MAX_REQS*_CONFIG_9P_NUM_SOCKS) /* 9P work+write() */ ) - -#endif /* _CONFIG_H_ */ diff --git a/cmd/sbc_harness/config/tusb_config.h b/cmd/sbc_harness/config/tusb_config.h deleted file mode 100644 index 0a6d3e4..0000000 --- a/cmd/sbc_harness/config/tusb_config.h +++ /dev/null @@ -1,129 +0,0 @@ -/* tusb_config.h - Compile-time configuration for the TinyUSB library - * - * Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> - * SPDX-License-Identifier: AGPL-3.0-or-later - * - * SPDX-License-Identifier: MIT - * The MIT License (MIT) - * - * Copyright (c) 2019 Ha Thach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#ifndef _TUSB_CONFIG_H_ -#define _TUSB_CONFIG_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -//-------------------------------------------------------------------- -// Override the default definition of TU_ASSERT() to use our logging -//-------------------------------------------------------------------- - -// "magically" select between the 1-arg and 2-args variants, inject a -// stringified version of `_cond`. -// -// Note: Use GNU-C `, ##__VA_ARGS__`, not standard C `__VA_OPT__(,) -// __VA_ARGS__`; because __VA_OPT__ doesn't handle present-but-empty -// arguments the way that we need. -#define TU_ASSERT(_cond, ...) \ - _GET_3RD_ARG(_cond, ##__VA_ARGS__, \ - _LIBMISC_TU_ASSERT_2ARGS, _LIBMISC_TU_ASSERT_1ARGS, _dummy) \ - (_cond, #_cond, ##__VA_ARGS__) - -#define _LIBMISC_TU_ASSERT_1ARGS(_cond, _cond_str) \ - _LIBMISC_TU_ASSERT_2ARGS(_cond, _cond_str, false) - -#define _LIBMISC_TU_ASSERT_2ARGS(_cond, _cond_str, _ret) \ - do { \ - if ( !(_cond) ) { \ - _libmisc_tu_mess_failed(_cond_str, \ - __FILE__, __LINE__, __func__); \ - TU_BREAKPOINT(); \ - return _ret; \ - } \ - } while(0) - -void _libmisc_tu_mess_failed(const char *expr, - const char *file, unsigned int line, const char *func); - -//-------------------------------------------------------------------- -// Configuration: common -//-------------------------------------------------------------------- - -// defined by compiler flags -#ifndef CFG_TUSB_MCU -#error CFG_TUSB_MCU must be defined -#endif - -// Conditional because it might be defined with `-D` on the command -// line if `cmake -DCMAKE_BUILD_TYPE=Debug`. -#ifndef CFG_TUSB_DEBUG -#define CFG_TUSB_DEBUG 0 -#endif - -// USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. -// Tinyusb use follows macros to declare transferring memory so that they can be put -// into those specific section. -// e.g -// - CFG_TUSB_MEM SECTION : [[gnu::section(".usb_ram")]] -// - CFG_TUSB_MEM_ALIGN : [[gnu::aligned(4)]] -#define CFG_TUSB_MEM_SECTION /* blank */ -#define CFG_TUSB_MEM_ALIGN [[gnu::aligned(4)]] - -#define CFG_TUD_ENABLED 1 -#define CFG_TUD_MAX_SPEED OPT_MODE_DEFAULT_SPEED - -//-------------------------------------------------------------------- -// Configuration: TinyUSB Device (TUD) -//-------------------------------------------------------------------- - -// control endpoint max packet size (only 8, 16, 32, or 64 are valid) -#define CFG_TUD_ENDPOINT0_SIZE 64 - -// Which of TinyUSB's built-in class drivers to enable. -// -// If a class takes an int, that's the maximum number of interfaces of -// that type that may be listed in the same configuration descriptor. -#define CFG_TUD_CDC 0 // int : Communications Device Class (e.g. ttyUSB) https://www.usb.org/sites/default/files/CDC1.2_WMC1.1_012011.zip -#define CFG_TUD_MSC 0 // bool: Mass Storage Class https://www.usb.org/sites/default/files/Mass_Storage_Specification_Overview_v1.4_2-19-2010.pdf -#define CFG_TUD_HID 1 // int : Human Interface Device https://www.usb.org/sites/default/files/hid1_11.pdf -#define CFG_TUD_AUDIO 0 // int : Audio https://www.usb.org/sites/default/files/audio10.pdf -#define CFG_TUD_VIDEO 0 // int : Video https://www.usb.org/sites/default/files/USB_Video_Class_1_5.zip -#define CFG_TUD_MIDI 0 // int : Musical Instrument Digital Interface https://www.usb.org/sites/default/files/USB%20MIDI%20v2_0.pdf -#define CFG_TUD_VENDOR 0 // int : ??? -#define CFG_TUD_USBTMC 0 // bool: Test & Measurement Class https://www.usb.org/sites/default/files/USBTMC_1_006a.zip -#define CFG_TUD_DFU_RUNTIME 0 // bool: Device Firmware Upgrade https://www.usb.org/sites/default/files/DFU_1.1.pdf -#define CFG_TUD_DFU 0 // bool: Device Firmware Upgrade https://www.usb.org/sites/default/files/DFU_1.1.pdf -#define CFG_TUD_ECM_RNDIS 0 // bool: net -#define CFG_TUD_NCM 0 // bool: net -#define CFG_TUD_BTH 0 // bool: Bluetooth - -// HID buffer size Should be sufficient to hold ID (if any) + Data -#define CFG_TUD_HID_EP_BUFSIZE 8 - -//-------------------------------------------------------------------- -#ifdef __cplusplus -} -#endif - -#endif /* _TUSB_CONFIG_H_ */ |