mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'refactor/remove_gdma_trigger_peripheral_t_v6.0' into 'release/v6.0'
refactor: remove gdma_trigger_peripheral_t (v6.0) See merge request espressif/esp-idf!45063
This commit is contained in:
@@ -122,6 +122,8 @@ static esp_err_t esp_async_memcpy_install_gdma_template(const async_memcpy_confi
|
||||
gdma_channel_alloc_config_t channel_config = {0};
|
||||
ESP_GOTO_ON_ERROR(new_channel_func(&channel_config, &mcp_gdma->tx_channel, &mcp_gdma->rx_channel), err, TAG, "failed to alloc GDMA channels");
|
||||
|
||||
gdma_reset(mcp_gdma->tx_channel);
|
||||
gdma_reset(mcp_gdma->rx_channel);
|
||||
// get a free DMA trigger ID for memory copy
|
||||
gdma_trigger_t m2m_trigger = GDMA_MAKE_TRIGGER(GDMA_TRIG_PERIPH_M2M, 0);
|
||||
uint32_t free_m2m_id_mask = 0;
|
||||
|
||||
@@ -333,7 +333,12 @@ esp_err_t gdma_connect(gdma_channel_handle_t dma_chan, gdma_trigger_t trig_perip
|
||||
}
|
||||
|
||||
ESP_RETURN_ON_FALSE(!periph_conflict, ESP_ERR_INVALID_STATE, TAG, "peripheral %d is already used by another channel", trig_periph.instance_id);
|
||||
gdma_hal_connect_peri(hal, pair->pair_id, dma_chan->direction, trig_periph.periph, trig_periph.instance_id);
|
||||
if (trig_periph.bus_id == SOC_GDMA_TRIG_PERIPH_M2M0_BUS) {
|
||||
// M2M transfer
|
||||
gdma_hal_connect_mem(hal, pair->pair_id, dma_chan->direction, trig_periph.instance_id);
|
||||
} else {
|
||||
gdma_hal_connect_peri(hal, pair->pair_id, dma_chan->direction, trig_periph.instance_id);
|
||||
}
|
||||
dma_chan->periph_id = trig_periph.instance_id;
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -362,7 +367,7 @@ esp_err_t gdma_disconnect(gdma_channel_handle_t dma_chan)
|
||||
}
|
||||
}
|
||||
|
||||
gdma_hal_disconnect_peri(hal, pair->pair_id, dma_chan->direction);
|
||||
gdma_hal_disconnect_all(hal, pair->pair_id, dma_chan->direction);
|
||||
|
||||
dma_chan->periph_id = GDMA_INVALID_PERIPH_TRIG;
|
||||
return ESP_OK;
|
||||
|
||||
@@ -82,19 +82,16 @@ typedef struct {
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
gdma_trigger_peripheral_t periph; /*!< Target peripheral which will trigger DMA operations */
|
||||
int instance_id; /*!< Peripheral instance ID. Supported IDs are listed in `hal/gdma_channel.h`, e.g. SOC_GDMA_TRIG_PERIPH_UHCI0 */
|
||||
int bus_id; /*!< Which system bus should the DMA attached to */
|
||||
} gdma_trigger_t;
|
||||
|
||||
/**
|
||||
* @brief Helper macro to initialize GDMA trigger
|
||||
* @note value of `peri` must be selected from `gdma_trigger_peripheral_t` enum.
|
||||
* e.g. GDMA_MAKE_TRIGGER(GDMA_TRIG_PERIPH_I2S,0)
|
||||
*
|
||||
* @example
|
||||
* GDMA_MAKE_TRIGGER(GDMA_TRIG_PERIPH_SPI,2)
|
||||
*/
|
||||
#define GDMA_MAKE_TRIGGER(peri, id) \
|
||||
(gdma_trigger_t) { .periph = peri, .instance_id = SOC_##peri##id, .bus_id = SOC_##peri##id##_BUS }
|
||||
#define GDMA_MAKE_TRIGGER(peri, id) (gdma_trigger_t) {.instance_id = SOC_##peri##id, .bus_id = SOC_##peri##id##_BUS }
|
||||
|
||||
/**
|
||||
* @brief A collection of strategy item that each GDMA channel could apply
|
||||
|
||||
@@ -67,12 +67,10 @@ TEST_CASE("GDMA channel allocation", "[GDMA]")
|
||||
TEST_ESP_OK(gdma_new_ahb_channel(&channel_config, NULL, &rx_channels[0]));
|
||||
|
||||
gdma_trigger_t fake_ahb_trigger1 = {
|
||||
.periph = 1,
|
||||
.bus_id = SOC_GDMA_BUS_AHB,
|
||||
.instance_id = 0,
|
||||
};
|
||||
gdma_trigger_t fake_ahb_trigger2 = {
|
||||
.periph = 2,
|
||||
.bus_id = SOC_GDMA_BUS_AHB,
|
||||
.instance_id = 1,
|
||||
};
|
||||
@@ -126,12 +124,10 @@ TEST_CASE("GDMA channel allocation", "[GDMA]")
|
||||
TEST_ESP_OK(gdma_new_axi_channel(&channel_config, NULL, &rx_channels[0]));
|
||||
|
||||
gdma_trigger_t fake_axi_trigger1 = {
|
||||
.periph = 1,
|
||||
.bus_id = SOC_GDMA_BUS_AXI,
|
||||
.instance_id = 0,
|
||||
};
|
||||
gdma_trigger_t fake_axi_trigger2 = {
|
||||
.periph = 2,
|
||||
.bus_id = SOC_GDMA_BUS_AXI,
|
||||
.instance_id = 1,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user