diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index 1adf4f90f6d..5469ed64bff 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -248,9 +248,10 @@ if(NOT BOOTLOADER_BUILD) endif() if(CONFIG_SOC_USB_OTG_SUPPORTED) - list(APPEND srcs - "usb_dwc_hal.c" - "usb_fsls_phy_hal.c") + list(APPEND srcs "usb_dwc_hal.c") + if(NOT ${target} STREQUAL "esp32p4") + list(APPEND srcs "usb_fsls_phy_hal.c") + endif() endif() if(${target} STREQUAL "esp32") diff --git a/components/soc/CMakeLists.txt b/components/soc/CMakeLists.txt index 00887b69d5a..7dd580e1368 100644 --- a/components/soc/CMakeLists.txt +++ b/components/soc/CMakeLists.txt @@ -114,8 +114,10 @@ if(CONFIG_SOC_IEEE802154_SUPPORTED) endif() if(CONFIG_SOC_USB_OTG_SUPPORTED) - list(APPEND srcs "${target}/usb_periph.c" - "${target}/usb_dwc_periph.c") + if(NOT ${target} STREQUAL "esp32p4") + list(APPEND srcs "${target}/usb_periph.c" + "${target}/usb_dwc_periph.c") + endif() endif() if(CONFIG_SOC_DAC_SUPPORTED) diff --git a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in index d26c2659f38..26125903bfc 100644 --- a/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32p4/include/soc/Kconfig.soc_caps.in @@ -63,6 +63,10 @@ config SOC_EMAC_SUPPORTED bool default y +config SOC_USB_OTG_SUPPORTED + bool + default y + config SOC_TEMP_SENSOR_SUPPORTED bool default y diff --git a/components/soc/esp32p4/include/soc/soc_caps.h b/components/soc/esp32p4/include/soc/soc_caps.h index c7edab97dde..63ca436f428 100644 --- a/components/soc/esp32p4/include/soc/soc_caps.h +++ b/components/soc/esp32p4/include/soc/soc_caps.h @@ -36,6 +36,7 @@ // #define SOC_PARLIO_SUPPORTED 1 //TODO: IDF-7471 #define SOC_ASYNC_MEMCPY_SUPPORTED 1 #define SOC_EMAC_SUPPORTED 1 +#define SOC_USB_OTG_SUPPORTED 1 // disable usb serial jtag for esp32p4, current image does not support // #define SOC_USB_SERIAL_JTAG_SUPPORTED 1 //TODO: IDF-7496 #define SOC_TEMP_SENSOR_SUPPORTED 1 diff --git a/components/soc/esp32p4/include/soc/usb_pins.h b/components/soc/esp32p4/include/soc/usb_pins.h new file mode 100644 index 00000000000..bbcb7c3ca41 --- /dev/null +++ b/components/soc/esp32p4/include/soc/usb_pins.h @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +/* +Note: These macros are deprecated. +We define them for P4 only for backward compatibility with older version of esp_tinyusb + +Todo: Remove in IDF v6.0 (IDF-9029) +*/ +#define USBPHY_VP_NUM -1 +#define USBPHY_VM_NUM -1 +#define USBPHY_RCV_NUM -1 +#define USBPHY_OEN_NUM -1 +#define USBPHY_VPO_NUM -1 +#define USBPHY_VMO_NUM -1 diff --git a/components/usb/CMakeLists.txt b/components/usb/CMakeLists.txt index d2a7cbefdeb..774177d0339 100644 --- a/components/usb/CMakeLists.txt +++ b/components/usb/CMakeLists.txt @@ -18,8 +18,12 @@ if(CONFIG_SOC_USB_OTG_SUPPORTED) "usb_helpers.c" "usb_host.c" "usb_private.c" - "usbh.c" - "usb_phy.c") + "usbh.c") + if(NOT ${target} STREQUAL "esp32p4") + list(APPEND srcs "usb_phy.c") + else() + list(APPEND srcs "usb_phy_p4.c") + endif() list(APPEND include "include") list(APPEND priv_includes "private_include") endif() diff --git a/components/usb/include/esp_private/usb_phy.h b/components/usb/include/esp_private/usb_phy.h index 7848e7cdbaf..65ad137b72b 100644 --- a/components/usb/include/esp_private/usb_phy.h +++ b/components/usb/include/esp_private/usb_phy.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include "esp_err.h" #include "soc/soc_caps.h" #include "hal/usb_phy_types.h" diff --git a/components/usb/test_apps/.build-test-rules.yml b/components/usb/test_apps/.build-test-rules.yml index 77a723b1551..9406f23a66c 100644 --- a/components/usb/test_apps/.build-test-rules.yml +++ b/components/usb/test_apps/.build-test-rules.yml @@ -3,8 +3,17 @@ components/usb/test_apps: enable: - if: SOC_USB_OTG_SUPPORTED == 1 + disable_test: + - if: IDF_TARGET not in ["esp32s3"] + temporary: true + reason: lack of runners with usb_host_flash_disk tag depends_components: - usb depends_filepatterns: - components/hal/usb*.c + - components/hal/include/hal/usb*.h - components/hal/esp32*/include/hal/usb*.h + - components/soc/esp32*/usb*.c + - components/soc/include/soc/usb*.h + - components/soc/esp32*/include/soc/usb_dwc_*.h + - components/soc/esp32*/include/soc/usb_wrap_*.h diff --git a/components/usb/test_apps/hcd/README.md b/components/usb/test_apps/hcd/README.md index 8dad6d2f951..01e95ae9738 100644 --- a/components/usb/test_apps/hcd/README.md +++ b/components/usb/test_apps/hcd/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB: Host test application diff --git a/components/usb/test_apps/hcd/pytest_usb_hcd.py b/components/usb/test_apps/hcd/pytest_usb_hcd.py index d91f79b14e2..8498cb2403b 100644 --- a/components/usb/test_apps/hcd/pytest_usb_hcd.py +++ b/components/usb/test_apps/hcd/pytest_usb_hcd.py @@ -1,12 +1,13 @@ -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 - import pytest from pytest_embedded import Dut @pytest.mark.esp32s2 @pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s2', 'esp32p4'], reason='lack of runners with usb_host_flash_disk tag') @pytest.mark.usb_host_flash_disk def test_usb_hcd(dut: Dut) -> None: dut.run_all_single_board_cases(group='full_speed') diff --git a/components/usb/test_apps/usb_host/README.md b/components/usb/test_apps/usb_host/README.md index 98dda595dc8..afe40d8da3b 100644 --- a/components/usb/test_apps/usb_host/README.md +++ b/components/usb/test_apps/usb_host/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB: Host test application diff --git a/components/usb/test_apps/usb_host/pytest_usb_host.py b/components/usb/test_apps/usb_host/pytest_usb_host.py index 7a6a5740c7e..63025a6a3ad 100644 --- a/components/usb/test_apps/usb_host/pytest_usb_host.py +++ b/components/usb/test_apps/usb_host/pytest_usb_host.py @@ -1,12 +1,13 @@ -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 - import pytest from pytest_embedded import Dut @pytest.mark.esp32s2 @pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s2', 'esp32p4'], reason='lack of runners with usb_host_flash_disk tag') @pytest.mark.usb_host_flash_disk def test_usb_host(dut: Dut) -> None: dut.run_all_single_board_cases(group='full_speed') diff --git a/components/usb/usb_phy_p4.c b/components/usb/usb_phy_p4.c new file mode 100644 index 00000000000..cff6420e082 --- /dev/null +++ b/components/usb/usb_phy_p4.c @@ -0,0 +1,30 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ + +// This is only a dummy USB PHY file for successful linking of ESP32-P4 target +// The internal HS PHY is enabled by default, therefore it needs no configuration +// TODO: Remove this file when proper support of P4 PHYs is implemented IDF-7323 +#include "esp_private/usb_phy.h" + +esp_err_t usb_new_phy(const usb_phy_config_t *config, usb_phy_handle_t *handle_ret) +{ + return ESP_OK; +} + +esp_err_t usb_del_phy(usb_phy_handle_t handle) +{ + return ESP_OK; +} + +esp_err_t usb_phy_get_phy_status(usb_phy_target_t target, usb_phy_status_t *status) +{ + return ESP_OK; +} + +esp_err_t usb_phy_action(usb_phy_handle_t handle, usb_phy_action_t action) +{ + return ESP_OK; +} diff --git a/docs/conf_common.py b/docs/conf_common.py index 032e88a54af..d9c0aa45764 100644 --- a/docs/conf_common.py +++ b/docs/conf_common.py @@ -4,13 +4,9 @@ # # This file is imported from a language-specific conf.py (ie en/conf.py or # zh_CN/conf.py) - # type: ignore # pylint: disable=wildcard-import # pylint: disable=undefined-variable - -from __future__ import print_function, unicode_literals - import os.path import re from pathlib import Path @@ -113,9 +109,12 @@ USB_DOCS = ['api-reference/peripherals/usb_device.rst', 'api-reference/peripherals/usb_host/usb_host_notes_arch.rst', 'api-reference/peripherals/usb_host/usb_host_notes_design.rst', 'api-reference/peripherals/usb_host/usb_host_notes_dwc_otg.rst', - 'api-reference/peripherals/usb_host/usb_host_notes_index.rst', - 'api-guides/usb-otg-console.rst', - 'api-guides/dfu.rst'] + 'api-reference/peripherals/usb_host/usb_host_notes_index.rst'] + +# TODO: Merge this back with `USB_DOCS` IDF-9919 IDF-9920 IDF-9133 +USB_OTG_DFU_DOCS = ['api-guides/dfu.rst'] + +USB_OTG_CONSOLE_DOCS = ['api-guides/usb-otg-console.rst'] FTDI_JTAG_DOCS = ['api-guides/jtag-debugging/configure-ft2232h-jtag.rst'] @@ -168,13 +167,13 @@ ESP32S2_DOCS = ['hw-reference/esp32s2/**', 'api-reference/peripherals/temp_sensor.rst', 'api-reference/system/async_memcpy.rst', 'api-reference/peripherals/touch_element.rst', - 'api-guides/RF_calibration.rst'] + FTDI_JTAG_DOCS + 'api-guides/RF_calibration.rst'] + FTDI_JTAG_DOCS + USB_OTG_DFU_DOCS + USB_OTG_CONSOLE_DOCS ESP32S3_DOCS = ['hw-reference/esp32s3/**', 'api-reference/system/ipc.rst', 'api-guides/flash_psram_config.rst', 'api-reference/peripherals/sd_pullup_requirements.rst', - 'api-guides/RF_calibration.rst'] + 'api-guides/RF_calibration.rst'] + USB_OTG_DFU_DOCS + USB_OTG_CONSOLE_DOCS # No JTAG docs for this one as it gets gated on SOC_USB_SERIAL_JTAG_SUPPORTED down below. ESP32C3_DOCS = ['hw-reference/esp32c3/**', diff --git a/docs/doxygen/Doxyfile_esp32p4 b/docs/doxygen/Doxyfile_esp32p4 index a2f272484f4..2d373662b70 100644 --- a/docs/doxygen/Doxyfile_esp32p4 +++ b/docs/doxygen/Doxyfile_esp32p4 @@ -8,3 +8,7 @@ INPUT += \ $(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_uart.h \ $(PROJECT_PATH)/components/ulp/lp_core/lp_core/include/ulp_lp_core_utils.h \ $(PROJECT_PATH)/components/ulp/ulp_common/include/ulp_common.h \ + $(PROJECT_PATH)/components/usb/include/usb/usb_helpers.h \ + $(PROJECT_PATH)/components/usb/include/usb/usb_host.h \ + $(PROJECT_PATH)/components/usb/include/usb/usb_types_ch9.h \ + $(PROJECT_PATH)/components/usb/include/usb/usb_types_stack.h \ diff --git a/docs/en/api-guides/index.rst b/docs/en/api-guides/index.rst index c3ceeeb0583..5f13efe0c77 100644 --- a/docs/en/api-guides/index.rst +++ b/docs/en/api-guides/index.rst @@ -17,7 +17,7 @@ API Guides core_dump current-consumption-measurement-modules :SOC_RTC_MEM_SUPPORTED: deep-sleep-stub - :SOC_USB_OTG_SUPPORTED: dfu + :SOC_USB_OTG_SUPPORTED and not esp32p4: dfu error-handling :SOC_BLE_MESH_SUPPORTED: esp-ble-mesh/ble-mesh-index :SOC_WIFI_MESH_SUPPORT: esp-wifi-mesh @@ -39,7 +39,7 @@ API Guides tools/index unit-tests host-apps - :SOC_USB_OTG_SUPPORTED: usb-otg-console + :SOC_USB_OTG_SUPPORTED and not esp32p4: usb-otg-console :SOC_USB_SERIAL_JTAG_SUPPORTED: usb-serial-jtag-console :SOC_WIFI_SUPPORTED: wifi :SOC_WIFI_SUPPORTED: wifi-security diff --git a/docs/zh_CN/api-guides/index.rst b/docs/zh_CN/api-guides/index.rst index 5896478b9be..0ddbb1574eb 100644 --- a/docs/zh_CN/api-guides/index.rst +++ b/docs/zh_CN/api-guides/index.rst @@ -17,7 +17,7 @@ API 指南 core_dump current-consumption-measurement-modules :SOC_RTC_MEM_SUPPORTED: deep-sleep-stub - :SOC_USB_OTG_SUPPORTED: dfu + :SOC_USB_OTG_SUPPORTED and not esp32p4: dfu error-handling :SOC_BLE_MESH_SUPPORTED: esp-ble-mesh/ble-mesh-index :SOC_WIFI_MESH_SUPPORT: esp-wifi-mesh @@ -39,7 +39,7 @@ API 指南 tools/index unit-tests host-apps - :SOC_USB_OTG_SUPPORTED: usb-otg-console + :SOC_USB_OTG_SUPPORTED and not esp32p4: usb-otg-console :SOC_USB_SERIAL_JTAG_SUPPORTED: usb-serial-jtag-console :SOC_WIFI_SUPPORTED: wifi :SOC_WIFI_SUPPORTED: wifi-security diff --git a/examples/peripherals/.build-test-rules.yml b/examples/peripherals/.build-test-rules.yml index ea2d3e6786a..49048003fd7 100644 --- a/examples/peripherals/.build-test-rules.yml +++ b/examples/peripherals/.build-test-rules.yml @@ -421,24 +421,49 @@ examples/peripherals/uart/uart_echo_rs485: enable: - if: INCLUDE_DEFAULT == 1 -examples/peripherals/usb: +examples/peripherals/usb/device: disable: - if: SOC_USB_OTG_SUPPORTED != 1 - -examples/peripherals/usb/device: - enable: - - if: SOC_USB_OTG_SUPPORTED == 1 disable_test: - - if: IDF_TARGET == "esp32s3" + - if: IDF_TARGET not in ["esp32s2"] temporary: true - reason: lack of runners + reason: lack of runners with usb_device tag + depends_components: + - usb + depends_filepatterns: + - examples/peripherals/usb/device/**/* + +examples/peripherals/usb/device/tusb_ncm: + disable: + - if: SOC_USB_OTG_SUPPORTED != 1 or SOC_WIFI_SUPPORTED != 1 + disable_test: + - if: IDF_TARGET not in ["esp32s2"] + temporary: true + reason: lack of runners with usb_device tag + depends_components: + - usb + - esp_wifi + depends_filepatterns: + - examples/peripherals/usb/device/tusb_ncm/**/* + +examples/peripherals/usb/host: + disable: + - if: SOC_USB_OTG_SUPPORTED != 1 + disable_test: + - if: IDF_TARGET not in ["esp32s3"] + temporary: true + reason: lack of runners with usb_host_flash_disk tag depends_components: - usb depends_filepatterns: - components/hal/usb*.c + - components/hal/include/hal/usb*.h - components/hal/esp32*/include/hal/usb*.h + - components/soc/esp32*/usb*.c + - components/soc/include/soc/usb*.h + - components/soc/esp32*/include/soc/usb_dwc_*.h + - components/soc/esp32*/include/soc/usb_wrap_*.h - examples/peripherals/usb/host/**/* - - examples/peripherals/usb/device/**/* examples/peripherals/usb_serial_jtag/usb_serial_jtag_echo: disable: diff --git a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/CMakeLists.txt b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/CMakeLists.txt index c3c65dae944..9cfe2365c2f 100644 --- a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/CMakeLists.txt +++ b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/CMakeLists.txt @@ -4,6 +4,7 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.16) +add_compile_options(-w) # Turn off warnings until esp_tinyusb is updated IEC-86 # "Trim" the build. Include the minimal set of components, main, and anything it depends on. set(COMPONENTS main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/README.md b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/README.md index d7bff1f7cff..a7a32c4567a 100644 --- a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/README.md +++ b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB Composite Device (MSC + Serial) Example diff --git a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/pytest_usb_device_composite.py b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/pytest_usb_device_composite.py index 6adfa49573b..843b7031282 100644 --- a/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/pytest_usb_device_composite.py +++ b/examples/peripherals/usb/device/tusb_composite_msc_serialdevice/pytest_usb_device_composite.py @@ -9,6 +9,9 @@ from serial.tools.list_ports import comports @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_composite_device_serial_example(dut: Dut) -> None: dut.expect_exact('Hello World!') diff --git a/examples/peripherals/usb/device/tusb_console/CMakeLists.txt b/examples/peripherals/usb/device/tusb_console/CMakeLists.txt index 37eb8efa988..261df3fb6ef 100644 --- a/examples/peripherals/usb/device/tusb_console/CMakeLists.txt +++ b/examples/peripherals/usb/device/tusb_console/CMakeLists.txt @@ -2,6 +2,7 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.16) +add_compile_options(-w) # Turn off warnings until esp_tinyusb is updated IEC-86 # "Trim" the build. Include the minimal set of components, main, and anything it depends on. set(COMPONENTS main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/examples/peripherals/usb/device/tusb_console/README.md b/examples/peripherals/usb/device/tusb_console/README.md index f86ee662663..aeccaab2514 100644 --- a/examples/peripherals/usb/device/tusb_console/README.md +++ b/examples/peripherals/usb/device/tusb_console/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB Sample Descriptor diff --git a/examples/peripherals/usb/device/tusb_console/pytest_usb_device_console.py b/examples/peripherals/usb/device/tusb_console/pytest_usb_device_console.py index 0cd523dad93..b32b19f5d85 100644 --- a/examples/peripherals/usb/device/tusb_console/pytest_usb_device_console.py +++ b/examples/peripherals/usb/device/tusb_console/pytest_usb_device_console.py @@ -9,6 +9,9 @@ from serial.tools.list_ports import comports @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_console_example(dut: Dut) -> None: dut.expect_exact('USB initialization DONE') diff --git a/examples/peripherals/usb/device/tusb_hid/README.md b/examples/peripherals/usb/device/tusb_hid/README.md index f0c1b79487e..e784742510c 100644 --- a/examples/peripherals/usb/device/tusb_hid/README.md +++ b/examples/peripherals/usb/device/tusb_hid/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB Human Interface Device Example diff --git a/examples/peripherals/usb/device/tusb_hid/pytest_usb_device_hid.py b/examples/peripherals/usb/device/tusb_hid/pytest_usb_device_hid.py index f38b3a74158..d3b41ff0387 100644 --- a/examples/peripherals/usb/device/tusb_hid/pytest_usb_device_hid.py +++ b/examples/peripherals/usb/device/tusb_hid/pytest_usb_device_hid.py @@ -5,6 +5,9 @@ from pytest_embedded import Dut @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_hid_example(dut: Dut) -> None: dut.expect_exact('USB initialization DONE') diff --git a/examples/peripherals/usb/device/tusb_midi/README.md b/examples/peripherals/usb/device/tusb_midi/README.md index f510b153669..7007230dfec 100644 --- a/examples/peripherals/usb/device/tusb_midi/README.md +++ b/examples/peripherals/usb/device/tusb_midi/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB MIDI Device Example diff --git a/examples/peripherals/usb/device/tusb_midi/pytest_usb_device_midi.py b/examples/peripherals/usb/device/tusb_midi/pytest_usb_device_midi.py index b0b55a1f287..2e9c7d05ba0 100644 --- a/examples/peripherals/usb/device/tusb_midi/pytest_usb_device_midi.py +++ b/examples/peripherals/usb/device/tusb_midi/pytest_usb_device_midi.py @@ -5,6 +5,9 @@ from pytest_embedded import Dut @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_midi_example(dut: Dut) -> None: dut.expect_exact('USB initialization DONE') diff --git a/examples/peripherals/usb/device/tusb_msc/README.md b/examples/peripherals/usb/device/tusb_msc/README.md index 721840c3ea1..134b2ecba2e 100644 --- a/examples/peripherals/usb/device/tusb_msc/README.md +++ b/examples/peripherals/usb/device/tusb_msc/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB Mass Storage Device Example diff --git a/examples/peripherals/usb/device/tusb_msc/pytest_usb_device_msc.py b/examples/peripherals/usb/device/tusb_msc/pytest_usb_device_msc.py index 68a7e34cf08..dc730667b81 100644 --- a/examples/peripherals/usb/device/tusb_msc/pytest_usb_device_msc.py +++ b/examples/peripherals/usb/device/tusb_msc/pytest_usb_device_msc.py @@ -5,6 +5,9 @@ from pytest_embedded import Dut @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_msc_example(dut: Dut) -> None: dut.expect('Mount storage') diff --git a/examples/peripherals/usb/device/tusb_ncm/pytest_usb_device_ncm.py b/examples/peripherals/usb/device/tusb_ncm/pytest_usb_device_ncm.py index 96685127bcb..e31841b8b94 100644 --- a/examples/peripherals/usb/device/tusb_ncm/pytest_usb_device_ncm.py +++ b/examples/peripherals/usb/device/tusb_ncm/pytest_usb_device_ncm.py @@ -8,6 +8,8 @@ from pytest_embedded import Dut @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.temp_skip_ci(targets=['esp32s3'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_ncm_example(dut: Dut) -> None: netif_mac = dut.expect(r'Network interface HW address: ([0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2})') diff --git a/examples/peripherals/usb/device/tusb_serial_device/CMakeLists.txt b/examples/peripherals/usb/device/tusb_serial_device/CMakeLists.txt index f46c3b75418..319eb018224 100644 --- a/examples/peripherals/usb/device/tusb_serial_device/CMakeLists.txt +++ b/examples/peripherals/usb/device/tusb_serial_device/CMakeLists.txt @@ -2,6 +2,7 @@ # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.16) +add_compile_options(-w) # Turn off warnings until esp_tinyusb is updated IEC-86 # "Trim" the build. Include the minimal set of components, main, and anything it depends on. set(COMPONENTS main) include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/examples/peripherals/usb/device/tusb_serial_device/README.md b/examples/peripherals/usb/device/tusb_serial_device/README.md index 8a28f426dd9..60ef9a9b44d 100644 --- a/examples/peripherals/usb/device/tusb_serial_device/README.md +++ b/examples/peripherals/usb/device/tusb_serial_device/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # TinyUSB Serial Device Example diff --git a/examples/peripherals/usb/device/tusb_serial_device/pytest_usb_device_serial.py b/examples/peripherals/usb/device/tusb_serial_device/pytest_usb_device_serial.py index bcf6c90203f..545b4ee3a4d 100644 --- a/examples/peripherals/usb/device/tusb_serial_device/pytest_usb_device_serial.py +++ b/examples/peripherals/usb/device/tusb_serial_device/pytest_usb_device_serial.py @@ -9,6 +9,9 @@ from serial.tools.list_ports import comports @pytest.mark.esp32s2 +@pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s3', 'esp32p4'], reason='lack of runners with usb_device tag') @pytest.mark.usb_device def test_usb_device_serial_example(dut: Dut) -> None: dut.expect_exact('USB initialization DONE') diff --git a/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md b/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md index c4af5faabef..8f1d6652ff2 100644 --- a/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md +++ b/examples/peripherals/usb/host/cdc/cdc_acm_host/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB CDC-ACM Host Driver Example diff --git a/examples/peripherals/usb/host/cdc/cdc_acm_vcp/README.md b/examples/peripherals/usb/host/cdc/cdc_acm_vcp/README.md index 71fdfb331d9..23193375d11 100644 --- a/examples/peripherals/usb/host/cdc/cdc_acm_vcp/README.md +++ b/examples/peripherals/usb/host/cdc/cdc_acm_vcp/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB CDC-ACM Virtual COM Port example diff --git a/examples/peripherals/usb/host/hid/README.md b/examples/peripherals/usb/host/hid/README.md index 182ad685b9b..281c1805f08 100644 --- a/examples/peripherals/usb/host/hid/README.md +++ b/examples/peripherals/usb/host/hid/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB HID Class example This example implements a basic USB Host HID Class Driver, and demonstrates how to use the driver to communicate with USB HID devices (such as Keyboard and Mouse or both) on the ESP32-S2/S3. Currently, the example only supports the HID boot protocol which should be present on most USB Mouse and Keyboards. The example will continuously scan for the connection of any HID Mouse or Keyboard, and attempt to fetch HID reports from those devices once connected. To quit the example (and shut down the HID driver), users can GPIO0 to low (i.e., pressing the "Boot" button on most ESP dev kits). diff --git a/examples/peripherals/usb/host/msc/README.md b/examples/peripherals/usb/host/msc/README.md index 873554fa9af..94fe45587ac 100644 --- a/examples/peripherals/usb/host/msc/README.md +++ b/examples/peripherals/usb/host/msc/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB Mass Storage Class example diff --git a/examples/peripherals/usb/host/msc/pytest_usb_host_msc.py b/examples/peripherals/usb/host/msc/pytest_usb_host_msc.py index 74474226293..44e1444b3bf 100644 --- a/examples/peripherals/usb/host/msc/pytest_usb_host_msc.py +++ b/examples/peripherals/usb/host/msc/pytest_usb_host_msc.py @@ -1,5 +1,4 @@ - -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import pytest from pytest_embedded import Dut @@ -7,6 +6,8 @@ from pytest_embedded import Dut @pytest.mark.esp32s2 @pytest.mark.esp32s3 +@pytest.mark.esp32p4 +@pytest.mark.temp_skip_ci(targets=['esp32s2', 'esp32p4'], reason='lack of runners with usb_host_flash_disk tag') @pytest.mark.usb_host_flash_disk def test_usb_host_msc_example(dut: Dut) -> None: # Check result of file_operations() diff --git a/examples/peripherals/usb/host/usb_host_lib/README.md b/examples/peripherals/usb/host/usb_host_lib/README.md index bb60eab1114..a391aedd9bf 100644 --- a/examples/peripherals/usb/host/usb_host_lib/README.md +++ b/examples/peripherals/usb/host/usb_host_lib/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB Host Library Example @@ -193,4 +193,4 @@ The log output demonstrates a device that has failed. The Hub Driver will output ### Blank String Descriptors -The current USB Host Library will automatically cache the Manufacturer, Product, and Serial Number string descriptors of the device during enumeration. However, when fetching the string descriptors, the USB Host Library will only fetch those strings descriptors of they of LANGID code 0x0409 (i.e., English - United States). Therefore, if the example does not print a particular descriptor, it is likely that the string descriptor was not cached during enumeration. \ No newline at end of file +The current USB Host Library will automatically cache the Manufacturer, Product, and Serial Number string descriptors of the device during enumeration. However, when fetching the string descriptors, the USB Host Library will only fetch those strings descriptors of they of LANGID code 0x0409 (i.e., English - United States). Therefore, if the example does not print a particular descriptor, it is likely that the string descriptor was not cached during enumeration. diff --git a/examples/peripherals/usb/host/uvc/README.md b/examples/peripherals/usb/host/uvc/README.md index 06f908e0b0a..3fab9cf6107 100644 --- a/examples/peripherals/usb/host/uvc/README.md +++ b/examples/peripherals/usb/host/uvc/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | +| Supported Targets | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | # USB Camera Example diff --git a/examples/peripherals/usb/host/uvc/sdkconfig.defaults b/examples/peripherals/usb/host/uvc/sdkconfig.defaults index 5d25a8f16c8..ffa47d42e86 100644 --- a/examples/peripherals/usb/host/uvc/sdkconfig.defaults +++ b/examples/peripherals/usb/host/uvc/sdkconfig.defaults @@ -4,12 +4,6 @@ CONFIG_SPIRAM=y CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=150000 CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y -CONFIG_SPIRAM_SPEED_80M=y - -# -# SYSTEM -# -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y # # USB diff --git a/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s2 b/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s2 new file mode 100644 index 00000000000..864fd356e1b --- /dev/null +++ b/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s2 @@ -0,0 +1,9 @@ +# +# SPIRAM +# +CONFIG_SPIRAM_SPEED_80M=y + +# +# SYSTEM +# +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y diff --git a/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s3 b/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s3 new file mode 100644 index 00000000000..864fd356e1b --- /dev/null +++ b/examples/peripherals/usb/host/uvc/sdkconfig.defaults.esp32s3 @@ -0,0 +1,9 @@ +# +# SPIRAM +# +CONFIG_SPIRAM_SPEED_80M=y + +# +# SYSTEM +# +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y diff --git a/examples/system/.build-test-rules.yml b/examples/system/.build-test-rules.yml index 6983c3bec6f..af6bf5748b3 100644 --- a/examples/system/.build-test-rules.yml +++ b/examples/system/.build-test-rules.yml @@ -30,7 +30,7 @@ examples/system/console/advanced: examples/system/console/advanced_usb_cdc: disable: - - if: SOC_USB_OTG_SUPPORTED != 1 + - if: SOC_USB_OTG_SUPPORTED != 1 or IDF_TARGET == "esp32p4" # TODO: IDF-8078, IDF-9120 and IDF-9133 depends_components: - console - vfs