mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
refactor(drivers): refactor the iram-safe option of the gdma peripherals
Closes https://github.com/espressif/esp-idf/issues/15771
This commit is contained in:
@@ -11,6 +11,7 @@ menu "ESP-Driver:Parallel IO Configurations"
|
||||
config PARLIO_ISR_IRAM_SAFE
|
||||
bool "Parallel IO ISR IRAM-Safe"
|
||||
default n
|
||||
select GDMA_ISR_HANDLER_IN_IRAM
|
||||
select GDMA_CTRL_FUNC_IN_IRAM # the driver needs to start the GDMA in the interrupt
|
||||
help
|
||||
Ensure the Parallel IO interrupt is IRAM-Safe by allowing the interrupt handler to be
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[mapping:parlio_driver_gdma]
|
||||
[mapping:parlio_driver_gdma_link]
|
||||
archive: libesp_hw_support.a
|
||||
entries:
|
||||
if PARLIO_ISR_IRAM_SAFE:
|
||||
|
||||
@@ -476,6 +476,9 @@ static esp_err_t s_parlio_rx_unit_init_dma(parlio_rx_unit_handle_t rx_unit)
|
||||
/* Allocate and connect the GDMA channel */
|
||||
gdma_channel_alloc_config_t dma_chan_config = {
|
||||
.direction = GDMA_CHANNEL_DIRECTION_RX,
|
||||
#if CONFIG_PARLIO_ISR_IRAM_SAFE
|
||||
.flags.isr_cache_safe = true,
|
||||
#endif
|
||||
};
|
||||
ESP_RETURN_ON_ERROR(PARLIO_GDMA_NEW_CHANNEL(&dma_chan_config, &rx_unit->dma_chan), TAG, "allocate RX DMA channel failed");
|
||||
gdma_connect(rx_unit->dma_chan, GDMA_MAKE_TRIGGER(GDMA_TRIG_PERIPH_PARLIO, 0));
|
||||
@@ -974,7 +977,7 @@ esp_err_t parlio_rx_unit_receive(parlio_rx_unit_handle_t rx_unit,
|
||||
ESP_RETURN_ON_FALSE(payload_size >= 2 * alignment, ESP_ERR_INVALID_ARG, TAG, "The payload size should greater than %"PRIu32, 2 * alignment);
|
||||
}
|
||||
#endif
|
||||
#if CONFIG_GDMA_ISR_IRAM_SAFE
|
||||
#if CONFIG_PARLIO_ISR_IRAM_SAFE
|
||||
ESP_RETURN_ON_FALSE(esp_ptr_internal(payload), ESP_ERR_INVALID_ARG, TAG, "payload not in internal RAM");
|
||||
#else
|
||||
ESP_RETURN_ON_FALSE(recv_cfg->flags.indirect_mount || esp_ptr_internal(payload), ESP_ERR_INVALID_ARG, TAG, "payload not in internal RAM");
|
||||
|
||||
@@ -200,6 +200,9 @@ static esp_err_t parlio_tx_unit_init_dma(parlio_tx_unit_t *tx_unit, const parlio
|
||||
{
|
||||
gdma_channel_alloc_config_t dma_chan_config = {
|
||||
.direction = GDMA_CHANNEL_DIRECTION_TX,
|
||||
#if CONFIG_PARLIO_ISR_IRAM_SAFE
|
||||
.flags.isr_cache_safe = true,
|
||||
#endif
|
||||
};
|
||||
ESP_RETURN_ON_ERROR(PARLIO_GDMA_NEW_CHANNEL(&dma_chan_config, &tx_unit->dma_chan), TAG, "allocate TX DMA channel failed");
|
||||
gdma_connect(tx_unit->dma_chan, GDMA_MAKE_TRIGGER(GDMA_TRIG_PERIPH_PARLIO, 0));
|
||||
|
||||
Reference in New Issue
Block a user