From ea6710ce988f643376850091455dd9c402b96b26 Mon Sep 17 00:00:00 2001 From: Alex Lisitsyn Date: Thu, 6 May 2021 16:20:54 +0800 Subject: [PATCH] soc/hal: add tinyusb support esp32s3 add usb hal/soc, usb_ll files and esp32s3 target for usb move usb_hal.h into soc common folder soc/hal: fix soc and periph for usb tinyusb: fix tinyusb io header hal: usb_ll fix pull up/down config for esp32s3 soc/hal: fix peripheral addresses --- components/driver/include/driver/gpio.h | 2 + components/driver/test/test_gpio.c | 16 +++---- components/esp32s3/ld/esp32s3.peripherals.ld | 1 + components/hal/CMakeLists.txt | 3 +- components/hal/component.mk | 2 +- components/hal/esp32s3/include/hal/usb_ll.h | 42 +++++++++++++++++++ components/hal/include/hal/gpio_types.h | 4 ++ components/hal/{esp32s2 => }/usb_hal.c | 0 components/soc/esp32s3/CMakeLists.txt | 3 +- .../soc/esp32s3/include/soc/gpio_caps.h | 4 +- components/soc/esp32s3/include/soc/soc.h | 2 +- components/soc/esp32s3/include/soc/soc_caps.h | 4 ++ components/soc/esp32s3/include/soc/soc_pins.h | 1 + components/soc/esp32s3/usb_periph.c | 31 ++++++++++++++ .../{esp32s2 => }/include/soc/usb_periph.h | 0 components/tinyusb/CMakeLists.txt | 17 +++++++- components/tinyusb/Kconfig | 2 +- components/tinyusb/additions/src/tinyusb.c | 1 - components/tinyusb/tinyusb | 2 +- tools/cmake/dfu.cmake | 2 +- 20 files changed, 116 insertions(+), 23 deletions(-) create mode 100644 components/hal/esp32s3/include/hal/usb_ll.h rename components/hal/{esp32s2 => }/usb_hal.c (100%) create mode 100644 components/soc/esp32s3/usb_periph.c rename components/soc/{esp32s2 => }/include/soc/usb_periph.h (100%) diff --git a/components/driver/include/driver/gpio.h b/components/driver/include/driver/gpio.h index aac81566fc..5112825f8b 100644 --- a/components/driver/include/driver/gpio.h +++ b/components/driver/include/driver/gpio.h @@ -35,6 +35,8 @@ #include "esp32s3/rom/gpio.h" #elif CONFIG_IDF_TARGET_ESP32C3 #include "esp32c3/rom/gpio.h" +#elif CONFIG_IDF_TARGET_ESP32S3 +#include "esp32s3/rom/gpio.h" #endif #ifdef CONFIG_LEGACY_INCLUDE_COMMON_HEADERS diff --git a/components/driver/test/test_gpio.c b/components/driver/test/test_gpio.c index 792421838b..6bf6a8623d 100644 --- a/components/driver/test/test_gpio.c +++ b/components/driver/test/test_gpio.c @@ -39,7 +39,7 @@ #define TEST_GPIO_EXT_IN_IO 20 // default input GPIO #define TEST_GPIO_OUTPUT_PIN 12 #define TEST_GPIO_INPUT_ONLY_PIN 46 -#define TEST_GPIO_OUTPUT_MAX GPIO_NUM_47 +#define TEST_GPIO_OUTPUT_MAX GPIO_NUM_MAX #elif CONFIG_IDF_TARGET_ESP32C3 #define TEST_GPIO_EXT_OUT_IO 2 // default output GPIO #define TEST_GPIO_EXT_IN_IO 3 // default input GPIO @@ -166,7 +166,7 @@ static void drive_capability_set_get(gpio_num_t num, gpio_drive_cap_t capability TEST_CASE("GPIO config parameters test", "[gpio]") { //error param test - //ESP32 test 41 bit, ESP32-S2 test 48 bit + //ESP32 test 41 bit, ESP32-S2 test 48 bit, ESP32-S3 test 49 bit gpio_config_t io_config = { 0 }; io_config.intr_type = GPIO_INTR_DISABLE; io_config.pin_bit_mask = ((uint64_t)1<<(GPIO_NUM_MAX+1)); @@ -176,7 +176,7 @@ TEST_CASE("GPIO config parameters test", "[gpio]") io_config.pin_bit_mask = 0; TEST_ASSERT(gpio_config(&io_config) == ESP_ERR_INVALID_ARG); - //ESP32 test 40 bit, ESP32-S2 test 47 bit + //ESP32 test 40 bit, ESP32-S2 test 47 bit, ESP32-S3 test 48 bit io_config.pin_bit_mask = ((uint64_t)1<