mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(usb_host): Move DMA capable memory to external ram on P4
- DWC-OTG internal DMA can access psram on esp32p4
- Move DMA memory buffs to psram, to save internal ram
- HCD tests and MSC example runs in CI with psram enabled
This commit is contained in:
@@ -23,6 +23,10 @@
|
||||
#include "unity.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
// ----------------------------------------------------- Macros --------------------------------------------------------
|
||||
|
||||
// --------------------- Constants -------------------------
|
||||
|
||||
#define PORT_NUM 1
|
||||
#define EVENT_QUEUE_LEN 5
|
||||
#define ENUM_ADDR 1 // Device address to use for tests that enumerate the device
|
||||
@@ -261,9 +265,15 @@ void test_hcd_pipe_free(hcd_pipe_handle_t pipe_hdl)
|
||||
}
|
||||
|
||||
#include "esp_private/esp_cache_private.h"
|
||||
#define DATA_BUFFER_CAPS (MALLOC_CAP_DMA | MALLOC_CAP_CACHE_ALIGNED)
|
||||
|
||||
#define ALIGN_UP(num, align) ((align) == 0 ? (num) : (((num) + ((align) - 1)) & ~((align) - 1)))
|
||||
|
||||
#ifdef CONFIG_USB_HOST_DWC_DMA_CAP_MEMORY_IN_PSRAM // In esp32p4, the USB-DWC internal DMA can access external RAM
|
||||
#define DATA_BUFFER_CAPS (MALLOC_CAP_DMA | MALLOC_CAP_CACHE_ALIGNED | MALLOC_CAP_SPIRAM)
|
||||
#else
|
||||
#define DATA_BUFFER_CAPS (MALLOC_CAP_DMA | MALLOC_CAP_CACHE_ALIGNED | MALLOC_CAP_INTERNAL)
|
||||
#endif
|
||||
|
||||
urb_t *test_hcd_alloc_urb(int num_isoc_packets, size_t data_buffer_size)
|
||||
{
|
||||
// Allocate a URB and data buffer
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
# USB: Host test application
|
||||
|
||||
There are two sets of tests in this application:
|
||||
There are three sets of tests in this application:
|
||||
1. Low-speed: Expects low-speed USB mouse with interrupt endpoint to be connected
|
||||
2. Full-speed: Expects full-speed USB flash disk with 2 bulk endpoints to be connected
|
||||
3. High-speed: Expects high-speed USB flash disk with 2 bulk endpoints to be connected
|
||||
|
||||
For running these tests locally, you will have to update device definitions (VID, PID, ...) in [test_usb_mock_classes.h](../common/test_usb_mock_classes.h).
|
||||
For running these tests locally, you will have to update device definitions (VID, PID, ...) in [dev_msc.c](../common/dev_msc.c), [dev_hid.c](../common/dev_hid.c) and [dev_isoc.c](../common/dev_isoc.c).
|
||||
|
||||
@@ -7,9 +7,13 @@ from pytest_embedded_idf.utils import idf_parametrize
|
||||
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32s2'], reason='lack of runners with usb_host_flash_disk tag')
|
||||
@pytest.mark.usb_host_flash_disk
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
@idf_parametrize(
|
||||
'config,target',
|
||||
[('default', 'esp32s2'), ('default', 'esp32s3'), ('default', 'esp32p4'), ('esp32p4_psram', 'esp32p4')],
|
||||
indirect=['config', 'target'],
|
||||
)
|
||||
def test_usb_hcd(dut: Dut) -> None:
|
||||
if dut.target == 'esp32s3':
|
||||
dut.run_all_single_board_cases(group='full_speed', reset=True)
|
||||
else:
|
||||
if dut.target == 'esp32p4':
|
||||
dut.run_all_single_board_cases(group='high_speed', reset=True)
|
||||
else:
|
||||
dut.run_all_single_board_cases(group='full_speed', reset=True)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
CONFIG_IDF_TARGET="esp32p4"
|
||||
|
||||
# Enable experimental features, to set PSRAM frequency to 200 MHz
|
||||
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
|
||||
|
||||
# Enable PSRAM and set PSRAM frequency
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_SPEED_200M=y
|
||||
# CONFIG_SPIRAM_MEMTEST is not set
|
||||
|
||||
# Allocate USB_DWC DMA capable memory in PSRAM
|
||||
CONFIG_USB_HOST_DWC_DMA_CAP_MEMORY_IN_PSRAM=y
|
||||
@@ -3,9 +3,10 @@
|
||||
|
||||
# USB: Host test application
|
||||
|
||||
There are two sets of tests in this application:
|
||||
There are three sets of tests in this application:
|
||||
1. Low-speed: Expects low-speed USB mouse with interrupt endpoint to be connected
|
||||
2. Full-speed: Expects full-speed USB flash disk with 2 bulk endpoints to be connected
|
||||
3. High-speed: Expects high-speed USB flash disk with 2 bulk endpoints to be connected
|
||||
|
||||
For running these tests locally, you will have to update device definitions (VID, PID, ...) in [mock_msc.h](../common/mock_msc.h) and [mock_hid.h](../common/mock_hid.h).
|
||||
For running these tests locally, you will have to update device definitions (VID, PID, ...) in [dev_msc.c](../common/dev_msc.c) and [dev_hid.c](../common/dev_hid.c).
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from pytest_embedded_idf.utils import idf_parametrize
|
||||
@pytest.mark.usb_host_flash_disk
|
||||
@idf_parametrize('target', ['esp32s2', 'esp32s3', 'esp32p4'], indirect=['target'])
|
||||
def test_usb_host(dut: Dut) -> None:
|
||||
if dut.target == 'esp32s3':
|
||||
dut.run_all_single_board_cases(group='full_speed', reset=True)
|
||||
else:
|
||||
if dut.target == 'esp32p4':
|
||||
dut.run_all_single_board_cases(group='high_speed', reset=True)
|
||||
else:
|
||||
dut.run_all_single_board_cases(group='full_speed', reset=True)
|
||||
|
||||
Reference in New Issue
Block a user