Rename tinyusb component to usbglue, use esp-idf's tinyusb

Renamed the component to avoid conflicts with the esp-idf component. The tinyusb
submodule has been removed and replaced, with Espressif's tinyusb managed component.

Adjusted CMakeLists.txt not to build tinyusb, leave it up to the managed component.

Added missing include to esp_mac.h
This commit is contained in:
alufers 2023-05-28 02:25:07 +02:00
parent 0e87b51e50
commit 1b11ffc6ae
15 changed files with 695 additions and 341 deletions

2
.gitmodules vendored
View File

@ -4,8 +4,6 @@
[submodule "components/mlib/mlib"]
path = components/mlib/mlib
url = https://github.com/P-p-H-d/mlib.git
[submodule "components/tinyusb/tinyusb"]
path = components/tinyusb/tinyusb
url = https://github.com/hathach/tinyusb
[submodule "components/dap-link/free-dap"]
path = components/dap-link/free-dap

View File

@ -1,65 +0,0 @@
idf_component_register(REQUIRES esp_rom app_update spi_flash freertos soc driver)
idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)
idf_build_get_property(idf_target IDF_TARGET)
if(${idf_target} STREQUAL "esp32s2")
target_compile_options(${COMPONENT_TARGET} INTERFACE
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
)
endif()
if(${idf_target} STREQUAL "esp32s3")
target_compile_options(${COMPONENT_TARGET} INTERFACE
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S3"
)
endif()
target_include_directories(${COMPONENT_TARGET} INTERFACE
"${FREERTOS_ORIG_INCLUDE_PATH}"
"${COMPONENT_DIR}/config/"
"${COMPONENT_DIR}/drivers/"
"${COMPONENT_DIR}/drivers/dual-cdc/"
"${COMPONENT_DIR}/tinyusb/hw/bsp/"
"${COMPONENT_DIR}/tinyusb/src/"
"${COMPONENT_DIR}/tinyusb/src/device"
"${COMPONENT_DIR}/tinyusb/src/class"
)
target_sources(${COMPONENT_TARGET} INTERFACE
"${COMPONENT_DIR}/tinyusb/src/tusb.c"
"${COMPONENT_DIR}/tinyusb/src/common/tusb_fifo.c"
"${COMPONENT_DIR}/tinyusb/src/device/usbd.c"
"${COMPONENT_DIR}/tinyusb/src/device/usbd_control.c"
"${COMPONENT_DIR}/tinyusb/src/class/audio/audio_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/bth/bth_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/cdc/cdc_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/cdc/cdc_host.c"
"${COMPONENT_DIR}/tinyusb/src/class/cdc/cdc_rndis_host.c"
"${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_rt_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/dfu/dfu_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/hid/hid_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/hid/hid_host.c"
"${COMPONENT_DIR}/tinyusb/src/class/midi/midi_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/msc/msc_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/msc/msc_host.c"
"${COMPONENT_DIR}/tinyusb/src/class/net/ncm_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/net/ecm_rndis_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/usbtmc/usbtmc_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/vendor/vendor_device.c"
"${COMPONENT_DIR}/tinyusb/src/class/vendor/vendor_host.c"
"${COMPONENT_DIR}/tinyusb/src/class/video/video_device.c"
"${COMPONENT_DIR}/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c"
"${COMPONENT_DIR}/tinyusb/src/host/hub.c"
"${COMPONENT_DIR}/tinyusb/src/host/usbh.c"
"${COMPONENT_DIR}/tinyusb/src/host/usbh_control.c"
"${COMPONENT_DIR}/drivers/usb-glue.c"
# "${COMPONENT_DIR}/drivers/dual-cdc/dual-cdc-driver.c"
"${COMPONENT_DIR}/drivers/dual-cdc/dual-cdc-descriptors.c"
# "${COMPONENT_DIR}/drivers/dap-link/vendor_device.c"
"${COMPONENT_DIR}/drivers/dap-link/dap-link-descriptors.c"
)

@ -1 +0,0 @@
Subproject commit dd30f2c648b984949b858d7dcc914297985a20bb

View File

@ -0,0 +1,41 @@
idf_component_register(REQUIRES esp_rom app_update spi_flash freertos soc driver)
idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos ORIG_INCLUDE_PATH)
idf_build_get_property(idf_target IDF_TARGET)
if(${idf_target} STREQUAL "esp32s2")
target_compile_options(${COMPONENT_TARGET} INTERFACE
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
)
endif()
if(${idf_target} STREQUAL "esp32s3")
target_compile_options(${COMPONENT_TARGET} INTERFACE
"-DCFG_TUSB_MCU=OPT_MCU_ESP32S3"
)
endif()
idf_component_get_property(tusb_lib espressif__tinyusb COMPONENT_LIB)
target_include_directories(${tusb_lib} PRIVATE ./config)
target_include_directories(${COMPONENT_TARGET} INTERFACE
"${FREERTOS_ORIG_INCLUDE_PATH}"
"${COMPONENT_DIR}/config/"
"${COMPONENT_DIR}/drivers/"
"${COMPONENT_DIR}/drivers/dual-cdc/"
"${COMPONENT_DIR}/tinyusb/hw/bsp/"
"${COMPONENT_DIR}/tinyusb/src/"
"${COMPONENT_DIR}/tinyusb/src/device"
"${COMPONENT_DIR}/tinyusb/src/class"
)
target_sources(${COMPONENT_TARGET} INTERFACE
"${COMPONENT_DIR}/drivers/usb-glue.c"
# "${COMPONENT_DIR}/drivers/dual-cdc/dual-cdc-driver.c"
"${COMPONENT_DIR}/drivers/dual-cdc/dual-cdc-descriptors.c"
# "${COMPONENT_DIR}/drivers/dap-link/vendor_device.c"
"${COMPONENT_DIR}/drivers/dap-link/dap-link-descriptors.c"
)

View File

@ -1,4 +1,6 @@
#include <tusb.h>
#include <esp_mac.h>
#include "dap-link/dap-link-descriptors.h"
#include "dual-cdc/dual-cdc-descriptors.h"
#include "usb-glue.h"
@ -247,6 +249,10 @@ void tud_cdc_line_coding_cb(uint8_t interface, cdc_line_coding_t const* p_line_c
#include <esp_log.h>
#include <esp_check.h>
#define GPIO_FUNC_IN_HIGH 0x38
#define GPIO_FUNC_IN_LOW 0x3C
static void usb_hal_init_pins(usb_hal_context_t* usb) {
/* usb_periph_iopins currently configures USB_OTG as USB Device.
* Introduce additional parameters in usb_hal_context_t when adding support
@ -274,7 +280,7 @@ static void usb_hal_init_pins(usb_hal_context_t* usb) {
static void usb_hal_bus_reset() {
gpio_config_t io_conf;
io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
io_conf.intr_type = GPIO_INTR_DISABLE;
io_conf.mode = GPIO_MODE_OUTPUT_OD;
io_conf.pin_bit_mask = ((1 << USBPHY_DM_NUM) | (1 << USBPHY_DP_NUM));
io_conf.pull_down_en = GPIO_PULLDOWN_ENABLE;

View File

@ -51,4 +51,4 @@ void usb_glue_dap_send(const uint8_t* buf, size_t len, bool flush);
void usb_glue_dap_set_receive_callback(void (*callback)(void* context), void* context);
size_t usb_glue_dap_receive(uint8_t* buf, size_t len);
size_t usb_glue_dap_receive(uint8_t* buf, size_t len);

View File

@ -0,0 +1,7 @@
## IDF Component Manager Manifest File
dependencies:
## Required IDF version
idf:
version: ">=4.1.0"
tinyusb:
version: ">=0.14.3"

910
sdkconfig

File diff suppressed because it is too large Load Diff