diff options
Diffstat (limited to 'tusb_config.h')
-rw-r--r-- | tusb_config.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/tusb_config.h b/tusb_config.h new file mode 100644 index 0000000..051c39c --- /dev/null +++ b/tusb_config.h @@ -0,0 +1,100 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2019 Ha Thach (tinyusb.org) + * Copyright (c) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> + * + * 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 + +//-------------------------------------------------------------------- +// TinyUSB Device (TUD) initialization for rp2040-based boards +//-------------------------------------------------------------------- + +// Which USB port to use for the RootHub. +// The rp2040 only has 1 port, so it's gotta be port #0. +#define BOARD_TUD_RHPORT 0 + +// RHPort max operational speed. +// Use OPT_MODE_DEFAULT_SPEED for max speed supported by MCU. +#define BOARD_TUD_MAX_SPEED OPT_MODE_DEFAULT_SPEED + +//-------------------------------------------------------------------- +// Configuration: common +//-------------------------------------------------------------------- + +// defined by compiler flags +#ifndef CFG_TUSB_MCU +#error CFG_TUSB_MCU must be defined +#endif + +#define CFG_TUSB_OS OPT_OS_NONE +#define CFG_TUSB_DEBUG 0 + +// 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 : __attribute__ (( section(".usb_ram") )) +// - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) +#define CFG_TUSB_MEM_SECTION /* blank */ +#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4))) + +#define CFG_TUD_ENABLED 1 +#define CFG_TUD_MAX_SPEED BOARD_TUD_MAX_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. +#define CFG_TUD_CDC 0 // Communications Device Class (e.g. ttyUSB) https://www.usb.org/sites/default/files/CDC1.2_WMC1.1_012011.zip +#define CFG_TUD_MSC 0 // 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 // Human Interface Device (num is how many interfaces) https://www.usb.org/sites/default/files/hid1_11.pdf +#define CFG_TUD_AUDIO 0 // Audio https://www.usb.org/sites/default/files/audio10.pdf +#define CFG_TUD_VIDEO 0 // Video https://www.usb.org/sites/default/files/USB_Video_Class_1_5.zip +#define CFG_TUD_MIDI 0 // Musical Instrument Digital Interface https://www.usb.org/sites/default/files/USB%20MIDI%20v2_0.pdf +#define CFG_TUD_VENDOR 0 // ??? +#define CFG_TUD_USBTMC 0 // Test & Measurement Class https://www.usb.org/sites/default/files/USBTMC_1_006a.zip +#define CFG_TUD_DFU_RUNTIME 0 // Device Firmware Upgrade https://www.usb.org/sites/default/files/DFU_1.1.pdf +#define CFG_TUD_DFU 0 // Device Firmware Upgrade https://www.usb.org/sites/default/files/DFU_1.1.pdf +#define CFG_TUD_ECM_RNDIS 0 // net +#define CFG_TUD_NCM 0 // net +#define CFG_TUD_BTH 0 // 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_ */ |