From 274e1c0089400bf243a9c9920050ef84882cde9d Mon Sep 17 00:00:00 2001 From: laokaiyao Date: Mon, 24 Jul 2023 12:22:31 +0800 Subject: [PATCH] fix(gdma): fixed compilation failure of gdma --- components/esp_hw_support/dma/gdma.c | 6 +++--- components/hal/gdma_hal_ahb_v1.c | 8 ++++++-- components/hal/gdma_hal_ahb_v2.c | 8 ++++++-- components/hal/gdma_hal_axi.c | 8 ++++++-- components/hal/gdma_hal_top.c | 4 ++-- components/hal/include/hal/gdma_hal.h | 4 ++-- components/hal/include/hal/gdma_hal_ahb.h | 2 +- components/hal/include/hal/gdma_hal_axi.h | 2 +- 8 files changed, 27 insertions(+), 15 deletions(-) diff --git a/components/esp_hw_support/dma/gdma.c b/components/esp_hw_support/dma/gdma.c index 0291896e51..ce246ca09d 100644 --- a/components/esp_hw_support/dma/gdma.c +++ b/components/esp_hw_support/dma/gdma.c @@ -755,14 +755,14 @@ void gdma_default_rx_isr(void *args) need_yield |= rx_chan->cbs.on_descr_err(&rx_chan->base, NULL, rx_chan->user_data); } if ((intr_status & GDMA_LL_EVENT_RX_SUC_EOF) && rx_chan->cbs.on_recv_eof) { - uint32_t eof_addr = gdma_ll_rx_get_success_eof_desc_addr(group->hal.dev, pair->pair_id); + uint32_t eof_addr = gdma_hal_get_eof_desc_addr(&group->hal, pair->pair_id, GDMA_CHANNEL_DIRECTION_RX, true); gdma_event_data_t suc_eof_data = { .rx_eof_desc_addr = eof_addr, }; need_yield |= rx_chan->cbs.on_recv_eof(&rx_chan->base, &suc_eof_data, rx_chan->user_data); } if ((intr_status & GDMA_LL_EVENT_RX_ERR_EOF) && rx_chan->cbs.on_recv_eof) { - uint32_t eof_addr = gdma_ll_rx_get_error_eof_desc_addr(group->hal.dev, pair->pair_id); + uint32_t eof_addr = gdma_hal_get_eof_desc_addr(&group->hal, pair->pair_id, GDMA_CHANNEL_DIRECTION_RX, false); gdma_event_data_t err_eof_data = { .rx_eof_desc_addr = eof_addr, .flags.abnormal_eof = true, @@ -788,7 +788,7 @@ void gdma_default_tx_isr(void *args) gdma_hal_clear_intr(hal, pair_id, GDMA_CHANNEL_DIRECTION_TX, intr_status); if ((intr_status & GDMA_LL_EVENT_TX_EOF) && tx_chan->cbs.on_trans_eof) { - uint32_t eof_addr = gdma_hal_get_eof_desc_addr(hal, pair_id, GDMA_CHANNEL_DIRECTION_TX); + uint32_t eof_addr = gdma_hal_get_eof_desc_addr(hal, pair_id, GDMA_CHANNEL_DIRECTION_TX, true); gdma_event_data_t edata = { .tx_eof_desc_addr = eof_addr, }; diff --git a/components/hal/gdma_hal_ahb_v1.c b/components/hal/gdma_hal_ahb_v1.c index 269f238e2c..38d02a887b 100644 --- a/components/hal/gdma_hal_ahb_v1.c +++ b/components/hal/gdma_hal_ahb_v1.c @@ -148,11 +148,15 @@ uint32_t gdma_ahb_hal_get_intr_status_reg(gdma_hal_context_t *hal, int chan_id, } } -uint32_t gdma_ahb_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir) +uint32_t gdma_ahb_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir, bool is_success) { if (dir == GDMA_CHANNEL_DIRECTION_RX) { - return gdma_ll_rx_get_success_eof_desc_addr(hal->dev, chan_id); + if (is_success) { + return gdma_ll_rx_get_success_eof_desc_addr(hal->dev, chan_id); + } + return gdma_ll_rx_get_error_eof_desc_addr(hal->dev, chan_id); } else { + // The TX direction only has success EOF, parameter 'is_success' is ignored return gdma_ll_tx_get_eof_desc_addr(hal->dev, chan_id); } } diff --git a/components/hal/gdma_hal_ahb_v2.c b/components/hal/gdma_hal_ahb_v2.c index 2c2678e052..348f878baf 100644 --- a/components/hal/gdma_hal_ahb_v2.c +++ b/components/hal/gdma_hal_ahb_v2.c @@ -137,11 +137,15 @@ uint32_t gdma_ahb_hal_get_intr_status_reg(gdma_hal_context_t *hal, int chan_id, } } -uint32_t gdma_ahb_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir) +uint32_t gdma_ahb_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir, bool is_success) { if (dir == GDMA_CHANNEL_DIRECTION_RX) { - return ahb_dma_ll_rx_get_success_eof_desc_addr(hal->ahb_dma_dev, chan_id); + if (is_success) { + return ahb_dma_ll_rx_get_success_eof_desc_addr(hal->ahb_dma_dev, chan_id); + } + return ahb_dma_ll_rx_get_error_eof_desc_addr(hal->ahb_dma_dev, chan_id); } else { + // The TX direction only has success EOF, parameter 'is_success' is ignored return ahb_dma_ll_tx_get_eof_desc_addr(hal->ahb_dma_dev, chan_id); } } diff --git a/components/hal/gdma_hal_axi.c b/components/hal/gdma_hal_axi.c index c84d7693cc..3555181c41 100644 --- a/components/hal/gdma_hal_axi.c +++ b/components/hal/gdma_hal_axi.c @@ -137,11 +137,15 @@ uint32_t gdma_axi_hal_get_intr_status_reg(gdma_hal_context_t *hal, int chan_id, } } -uint32_t gdma_axi_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir) +uint32_t gdma_axi_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir, bool is_success) { if (dir == GDMA_CHANNEL_DIRECTION_RX) { - return axi_dma_ll_rx_get_success_eof_desc_addr(hal->axi_dma_dev, chan_id); + if (is_success) { + return axi_dma_ll_rx_get_success_eof_desc_addr(hal->axi_dma_dev, chan_id); + } + return axi_dma_ll_rx_get_error_eof_desc_addr(hal->axi_dma_dev, chan_id); } else { + // The TX direction only has success EOF, parameter 'is_success' is ignored return axi_dma_ll_tx_get_eof_desc_addr(hal->axi_dma_dev, chan_id); } } diff --git a/components/hal/gdma_hal_top.c b/components/hal/gdma_hal_top.c index fb005e8733..ccbcd608a6 100644 --- a/components/hal/gdma_hal_top.c +++ b/components/hal/gdma_hal_top.c @@ -85,7 +85,7 @@ uint32_t gdma_hal_get_intr_status_reg(gdma_hal_context_t *hal, int chan_id, gdma return hal->get_intr_status_reg(hal, chan_id, dir); } -uint32_t gdma_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir) +uint32_t gdma_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir, bool is_success) { - return hal->get_eof_desc_addr(hal, chan_id, dir); + return hal->get_eof_desc_addr(hal, chan_id, dir, is_success); } diff --git a/components/hal/include/hal/gdma_hal.h b/components/hal/include/hal/gdma_hal.h index 420b8f61ef..6bd5221e64 100644 --- a/components/hal/include/hal/gdma_hal.h +++ b/components/hal/include/hal/gdma_hal.h @@ -79,7 +79,7 @@ struct gdma_hal_context_t { void (*enable_intr)(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir, uint32_t intr_event_mask, bool en_or_dis); /// Enable the channel interrupt void (*clear_intr)(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir, uint32_t intr_event_mask); /// Clear the channel interrupt uint32_t (*read_intr_status)(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir); /// Read the channel interrupt status - uint32_t (*get_eof_desc_addr)(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir); /// Get the address of the descriptor with EOF flag set + uint32_t (*get_eof_desc_addr)(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir, bool is_success); /// Get the address of the descriptor with success/error EOF flag set }; void gdma_hal_deinit(gdma_hal_context_t *hal); @@ -112,7 +112,7 @@ uint32_t gdma_hal_get_intr_status_reg(gdma_hal_context_t *hal, int chan_id, gdma uint32_t gdma_hal_read_intr_status(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir); -uint32_t gdma_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir); +uint32_t gdma_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir, bool is_success); #ifdef __cplusplus } diff --git a/components/hal/include/hal/gdma_hal_ahb.h b/components/hal/include/hal/gdma_hal_ahb.h index 46b094f31a..382f49ff5b 100644 --- a/components/hal/include/hal/gdma_hal_ahb.h +++ b/components/hal/include/hal/gdma_hal_ahb.h @@ -40,7 +40,7 @@ uint32_t gdma_ahb_hal_read_intr_status(gdma_hal_context_t *hal, int chan_id, gdm uint32_t gdma_ahb_hal_get_intr_status_reg(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir); -uint32_t gdma_ahb_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir); +uint32_t gdma_ahb_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir, bool is_success); void gdma_ahb_hal_init(gdma_hal_context_t *hal, const gdma_hal_config_t *config); diff --git a/components/hal/include/hal/gdma_hal_axi.h b/components/hal/include/hal/gdma_hal_axi.h index a10ee22c03..918e1926a2 100644 --- a/components/hal/include/hal/gdma_hal_axi.h +++ b/components/hal/include/hal/gdma_hal_axi.h @@ -40,7 +40,7 @@ uint32_t gdma_axi_hal_read_intr_status(gdma_hal_context_t *hal, int chan_id, gdm uint32_t gdma_axi_hal_get_intr_status_reg(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir); -uint32_t gdma_axi_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir); +uint32_t gdma_axi_hal_get_eof_desc_addr(gdma_hal_context_t *hal, int chan_id, gdma_channel_direction_t dir, bool is_success); void gdma_axi_hal_init(gdma_hal_context_t *hal, const gdma_hal_config_t *config);