1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/tinyusb: add Kconfig variables for common tinyUSB descriptors

This commit is contained in:
Gunar Schorcht 2022-11-06 11:40:22 +01:00
parent 5685718bcf
commit 028c22083b
4 changed files with 135 additions and 8 deletions

View File

@ -19,6 +19,8 @@ menuconfig PACKAGE_TINYUSB
bool "TinyUSB stack package"
depends on HAS_ARCH_32BIT
depends on HAS_TINYUSB_DEVICE || HAS_TINYUSB_HOST
select MODULE_FMT
select MODULE_LUID
select MODULE_PERIPH_USBDEV_CLK
select MODULE_SEMA
select MODULE_TINYUSB_COMMON
@ -39,8 +41,8 @@ menuconfig PACKAGE_TINYUSB
|| CPU_COMMON_SAMD5X || CPU_FAM_SAML21 || CPU_FAM_SAMR34 \
|| CPU_FAM_SAMR30
select MODULE_TINYUSB_PORTABLE_NRF5X if CPU_FAM_NRF52
select PACKAGE_NRFX if CPU_FAM_NRF52
select MODULE_ZTIMER_MSEC
select PACKAGE_NRFX if CPU_FAM_NRF52
help
tinyUSB is an open-source cross-platform USB Host/Device stack for
embedded systems.
@ -74,6 +76,7 @@ config MODULE_TINYUSB_HW
config MODULE_TINYUSB_DEVICE
bool "Device Stack"
depends on HAS_TINYUSB_DEVICE
default y
help
Select to enable tinyUSB device stack
@ -117,8 +120,7 @@ menu "Device Classes"
bool "Bluetooth Host Controller Interface (BTH HCI)"
depends on MODULE_TINYUSB_DEVICE
config MODULE_TINYUSB_CLASS_CDC
bool "Communication Device Class (CDC)"
rsource "Kconfig.cdc"
config MODULE_TINYUSB_CLASS_DFU
bool "Device Firmware Update (DFU) Runtime"
@ -128,11 +130,8 @@ menu "Device Classes"
bool "Device Firmware Update (DFU)"
depends on MODULE_TINYUSB_DEVICE
config MODULE_TINYUSB_CLASS_HID
bool "Human Interface Device (HID)"
config MODULE_TINYUSB_CLASS_MSC
bool "Mass Storage Class (MSC)"
rsource "Kconfig.hid"
rsource "Kconfig.msc"
config MODULE_TINYUSB_CLASS_MIDI
bool "Musical Instrument Digital Interface (MIDI)"
@ -159,4 +158,32 @@ menu "Device Classes"
endmenu
if MODULE_TINYUSB_DEVICE
config TUSBD_EP0_SIZE
int "Device control endpoint (EP0) size [byte]"
default 64
config TUSBD_FS_EP_SIZE
int "Device endpoint size in Full-Speed mode [byte]"
default 64
config TUSBD_HS_EP_SIZE
int "Device endpoint Size in High-Speed mode [byte]"
default 512
config TUSBD_USE_CUSTOM_DESC
bool "Custom device descriptors"
depends on MODULE_TINYUSB_DEVICE
help
Enable this option to define custom descriptors for the selected
device classes. Otherwise, generic descriptors will be generated
according to the selected device classes.
At the moment, the generation of generic descriptors is only supported
for all combinations of up to two CDC interfaces, up to two generic
In/Out HID interfaces, up to one MSC interface and up to one vendor
interface. In all other cases, custom descriptors must be implemented
and handled.
endif # MODULE_TINYUSB_DEVICE
endif # PACKAGE_TINYUSB

32
pkg/tinyusb/Kconfig.cdc Normal file
View File

@ -0,0 +1,32 @@
# Copyright (c) 2022 Gunar Schorcht
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
menuconfig MODULE_TINYUSB_CLASS_CDC
bool "Communication Device Class (CDC)"
if MODULE_TINYUSB_CLASS_CDC && MODULE_TINYUSB_DEVICE
config TUSBD_CDC_NUMOF
int "Number of CDC interfaces"
default 1
range 1 2
config TUSBD_CDC_NOTIF_EP_SIZE
int "CDC notification endpoint size [byte]"
default 8
config TUSBD_CDC_0_STRING
string "CDC0 descriptor string"
depends on TUSBD_CDC_NUMOF > 0
default "TinyUSB CDC0"
config TUSBD_CDC_1_STRING
string "CDC1 descriptor string"
depends on TUSBD_CDC_NUMOF > 1
default "TinyUSB CDC1"
endif

42
pkg/tinyusb/Kconfig.hid Normal file
View File

@ -0,0 +1,42 @@
# Copyright (c) 2022 Gunar Schorcht
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
menuconfig MODULE_TINYUSB_CLASS_HID
bool "Human Interface Device (HID)"
if MODULE_TINYUSB_CLASS_HID && MODULE_TINYUSB_DEVICE
config TUSBD_HID_NUMOF
int "Number of HID interfaces"
default 1
range 1 2
config TUSBD_HID_EP_SIZE
int "HID endpoint size [byte]"
default 64
config TUSBD_HID_0_POLL_INTERVALL
int "HID0 polling interval [ms]"
depends on TUSBD_HID_NUMOF > 0
default 10
config TUSBD_HID_0_STRING
string "HID0 descriptor string"
depends on TUSBD_HID_NUMOF > 0
default "TinyUSB HID0 (Generic In/Out)"
config TUSBD_HID_1_POLL_INTERVALL
int "HID1 polling interval [ms]"
depends on TUSBD_HID_NUMOF > 1
default 10
config TUSBD_HID_1_STRING
string "HID1 descriptor string"
depends on TUSBD_HID_NUMOF > 1
default "TinyUSB HID1 (Generic In/Out)"
endif

26
pkg/tinyusb/Kconfig.msc Normal file
View File

@ -0,0 +1,26 @@
# Copyright (c) 2022 Gunar Schorcht
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
menuconfig MODULE_TINYUSB_CLASS_MSC
bool "Mass Storage Class (MSC)"
if MODULE_TINYUSB_CLASS_MSC && MODULE_TINYUSB_DEVICE
config TUSBD_MSC_NUMOF
int
default 1
config TUSBD_MSC_EP_SIZE
int "MSC endpoint size [byte]"
default 512
config TUSBD_MSC_STRING
string "MSC descriptor string"
depends on TUSBD_MSC_NUMOF > 0
default "TinyUSB MSC"
endif