feat(driver_spi): support esp32h4 spi driver

This commit is contained in:
wanckl
2025-07-28 21:59:17 +08:00
committed by Wan Lei
parent 72cb973022
commit 37c6608ab3
54 changed files with 1716 additions and 231 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -74,7 +74,7 @@
#define ESP_SPI_SLAVE_TV (12.5*3.5)
#define WIRE_DELAY 12.5
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32H4
#define SLAVE_IOMUX_PIN_MISO -1
#define SLAVE_IOMUX_PIN_MOSI -1
#define SLAVE_IOMUX_PIN_SCLK -1
@@ -82,7 +82,11 @@
#define SLAVE_IOMUX_PIN_WP -1
#define SLAVE_IOMUX_PIN_HD -1
#if CONFIG_IDF_TARGET_ESP32H4
#define UNCONNECTED_PIN 27
#else
#define UNCONNECTED_PIN 41
#endif
#define INPUT_ONLY_PIN 46
#define GPIO_DELAY 0
#define ESP_SPI_SLAVE_TV 0
@@ -113,22 +117,6 @@
#define MAX_TEST_SIZE 16 ///< in this test we run several transactions, this is the maximum trans that can be run
#define PSET_NAME_LEN 30 ///< length of each param set name
//test low frequency, high frequency until freq limit for worst case (both GPIO)
#define TEST_FREQ_DEFAULT(){ \
1 * 1000 * 1000, \
8 * 1000 * 1000, \
9 * 1000 * 1000, \
10 * 1000 * 1000, \
11 * 1000 * 1000, \
13 * 1000 * 1000, \
16 * 1000 * 1000, \
20 * 1000 * 1000, \
26 * 1000 * 1000, \
40 * 1000 * 1000, \
80 * 1000 * 1000, \
0,\
}
//default bus config for tests
#define SPI_BUS_TEST_DEFAULT_CONFIG() {\
.miso_io_num=PIN_NUM_MISO, \
@@ -234,9 +222,6 @@ typedef struct {
slave_txdata_t slave_trans[MAX_TEST_SIZE];
} spitest_context_t;
// fill default value of spitest_param_set_t
void spitest_def_param(void* arg);
// functions for slave task
esp_err_t init_slave_context(spi_slave_task_context_t *context, spi_host_device_t host);
void deinit_slave_context(spi_slave_task_context_t *context);

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -12,8 +12,6 @@
#include "hal/spi_ll.h"
#include "esp_rom_gpio.h"
int test_freq_default[] = TEST_FREQ_DEFAULT();
const char MASTER_TAG[] = "test_master";
const char SLAVE_TAG[] = "test_slave";
@@ -34,15 +32,6 @@ DRAM_ATTR uint8_t spitest_slave_send[] = {
0xda,
};
void spitest_def_param(void* arg)
{
spitest_param_set_t *param_set = (spitest_param_set_t*)arg;
param_set->test_size = 8;
if (param_set->freq_list == NULL) {
param_set->freq_list = test_freq_default;
}
}
/**********************************************************************************
* functions for slave task
*********************************************************************************/