From d0415bd8f627251f852bd66ee19ce0cb2e883b7d Mon Sep 17 00:00:00 2001 From: Armando Date: Sun, 7 Feb 2021 14:39:07 +0800 Subject: [PATCH] spi: remove hard-coded DMA chan in soc_caps.h --- components/driver/spi_common.c | 4 ++-- components/soc/esp32c3/include/soc/soc_caps.h | 12 ------------ components/soc/esp32c3/spi_periph.c | 2 +- components/soc/esp32s3/include/soc/soc_caps.h | 2 -- components/soc/esp32s3/spi_periph.c | 4 ++-- 5 files changed, 5 insertions(+), 19 deletions(-) diff --git a/components/driver/spi_common.c b/components/driver/spi_common.c index c8f547b30b..fae1e0694e 100644 --- a/components/driver/spi_common.c +++ b/components/driver/spi_common.c @@ -53,7 +53,7 @@ static const char *SPI_TAG = "spi"; SPI_CHECK(GPIO_IS_VALID_GPIO(pin_num), pin_name" not valid", ESP_ERR_INVALID_ARG); \ } -#define MAIN_BUS_DEFAULT() { \ +#define SPI_MAIN_BUS_DEFAULT() { \ .host_id = 0, \ .bus_attr = { \ .tx_dma_chan = 0, \ @@ -88,7 +88,7 @@ ATOMIC_VAR_INIT(false), }; static const char* spi_claiming_func[3] = {NULL, NULL, NULL}; -static spicommon_bus_context_t s_mainbus = MAIN_BUS_DEFAULT(); +static spicommon_bus_context_t s_mainbus = SPI_MAIN_BUS_DEFAULT(); static spicommon_bus_context_t* bus_ctx[SOC_SPI_PERIPH_NUM] = {&s_mainbus}; #if !SOC_GDMA_SUPPORTED diff --git a/components/soc/esp32c3/include/soc/soc_caps.h b/components/soc/esp32c3/include/soc/soc_caps.h index 7d75ce4a18..c5b6503634 100644 --- a/components/soc/esp32c3/include/soc/soc_caps.h +++ b/components/soc/esp32c3/include/soc/soc_caps.h @@ -10,20 +10,8 @@ #define SOC_TWAI_SUPPORTED 1 #define SOC_BT_SUPPORTED 1 -// There are 3 DMA channels on ESP32-C3 -// Attention: These fixed DMA channels are temporarily workaround before we have a centralized DMA controller API to help alloc the channel dynamically -// Remove them when GDMA driver API is ready -#define SOC_GDMA_SPI2_DMA_CHANNEL (2) - -//NOTE: The CHx number should be consistent with the selected DMA channel above -#define SOC_GDMA_SPI2_INTR_SOURCE ETS_DMA_CH2_INTR_SOURCE -//On C3, there is only 1 GPSPI controller (GPSPI2) -#define SOC_GDMA_SPI3_DMA_CHANNEL SOC_GDMA_SPI2_DMA_CHANNEL - - #include "rmt_caps.h" - /*-------------------------- DAC CAPS ----------------------------------------*/ #define SOC_DAC_PERIPH_NUM 0 diff --git a/components/soc/esp32c3/spi_periph.c b/components/soc/esp32c3/spi_periph.c index 1d1b41df8f..ada81b36c3 100644 --- a/components/soc/esp32c3/spi_periph.c +++ b/components/soc/esp32c3/spi_periph.c @@ -63,7 +63,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = { .spihd_iomux_pin = FSPI_IOMUX_PIN_NUM_HD, .spics0_iomux_pin = FSPI_IOMUX_PIN_NUM_CS, .irq = ETS_SPI2_INTR_SOURCE, - .irq_dma = SOC_GDMA_SPI2_INTR_SOURCE, + .irq_dma = -1, .module = PERIPH_SPI2_MODULE, .hw = &GPSPI2, .func = FSPI_FUNC_NUM, diff --git a/components/soc/esp32s3/include/soc/soc_caps.h b/components/soc/esp32s3/include/soc/soc_caps.h index fe949f659f..b6a03c4a07 100644 --- a/components/soc/esp32s3/include/soc/soc_caps.h +++ b/components/soc/esp32s3/include/soc/soc_caps.h @@ -159,8 +159,6 @@ // Attention: These fixed DMA channels are temporarily workaround before we have a centralized DMA controller API to help alloc the channel dynamically // Remove them when GDMA driver API is ready -#define SOC_GDMA_SPI2_DMA_CHANNEL (1) -#define SOC_GDMA_SPI3_DMA_CHANNEL (2) #define SOC_GDMA_SHA_DMA_CHANNEL (3) #define SOC_GDMA_AES_DMA_CHANNEL (4) diff --git a/components/soc/esp32s3/spi_periph.c b/components/soc/esp32s3/spi_periph.c index de93c48ae6..4554c12f17 100644 --- a/components/soc/esp32s3/spi_periph.c +++ b/components/soc/esp32s3/spi_periph.c @@ -63,7 +63,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = { .spihd_iomux_pin = FSPI_IOMUX_PIN_NUM_HD, .spics0_iomux_pin = FSPI_IOMUX_PIN_NUM_CS, .irq = ETS_SPI2_INTR_SOURCE, - .irq_dma = ETS_SPI2_DMA_INTR_SOURCE, + .irq_dma = -1, .module = PERIPH_FSPI_MODULE, .hw = &GPSPI2, .func = FSPI_FUNC_NUM, @@ -89,7 +89,7 @@ const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM] = { .spihd_iomux_pin = -1, .spics0_iomux_pin = -1, .irq = ETS_SPI3_INTR_SOURCE, - .irq_dma = ETS_SPI3_DMA_INTR_SOURCE, + .irq_dma = -1, .module = PERIPH_HSPI_MODULE, .hw = &GPSPI3, .func = -1,