Merge branch 'feat/gdma_weight_based_arbitration' into 'master'

feat(gdma): support gdma weighted arbitration on C5 ECO2

Closes IDF-8007

See merge request espressif/esp-idf!32826
This commit is contained in:
Chen Ji Chang
2025-05-29 19:59:44 +08:00
15 changed files with 317 additions and 17 deletions

View File

@@ -22,6 +22,7 @@ extern "C" {
#define AHB_DMA_LL_GET_HW(id) (((id) == 0) ? (&AHB_DMA) : NULL)
#define GDMA_LL_CHANNEL_MAX_PRIORITY 5 // supported priority levels: [0,5]
#define GDMA_LL_CHANNEL_MAX_WEIGHT 15 // supported weight levels: [0,15]
#define GDMA_LL_RX_EVENT_MASK (0x7F)
#define GDMA_LL_TX_EVENT_MASK (0x3F)
@@ -138,6 +139,25 @@ static inline void ahb_dma_ll_set_default_memory_range(ahb_dma_dev_t *dev)
dev->intr_mem_end_addr.val = 0x44000000;
}
/**
* @brief Enable the weighted arbitration for AHB-DMA
*/
static inline void ahb_dma_ll_enable_weighted_arb(ahb_dma_dev_t *dev, bool enable)
{
dev->weight_en.weight_en = enable;
}
/**
* @brief Set the weighted arbitration timeout for AHB-DMA
*
* @param timeout AHB bus clock cycle
*/
static inline void ahb_dma_ll_set_weighted_arb_timeout(ahb_dma_dev_t *dev, uint32_t timeout)
{
HAL_ASSERT(timeout != 0 && timeout <= 65535);
dev->arb_timeout.arb_timeout_num = timeout;
}
///////////////////////////////////// RX /////////////////////////////////////////
/**
* @brief Get DMA RX channel interrupt status word
@@ -391,6 +411,22 @@ static inline void ahb_dma_ll_rx_enable_etm_task(ahb_dma_dev_t *dev, uint32_t ch
dev->channel[channel].in.in_conf0.in_etm_en_chn = enable;
}
/**
* @brief Enable the weighted arbitration optimize for DMA RX channel
*/
static inline void ahb_dma_ll_rx_enable_weighted_arb_opt(ahb_dma_dev_t *dev, uint32_t channel, bool enable)
{
dev->in_crc_arb[channel].arb_weight_opt.rx_arb_weight_opt_dis_chn = !enable;
}
/**
* @brief Set the weight for DMA RX channel
*/
static inline void ahb_dma_ll_rx_set_weight(ahb_dma_dev_t *dev, uint32_t channel, uint32_t weight)
{
dev->in_crc_arb[channel].ch_arb_weight.rx_arb_weight_value_chn = weight;
}
///////////////////////////////////// TX /////////////////////////////////////////
/**
* @brief Get DMA TX channel interrupt status word
@@ -642,6 +678,22 @@ static inline void ahb_dma_ll_tx_enable_etm_task(ahb_dma_dev_t *dev, uint32_t ch
dev->channel[channel].out.out_conf0.out_etm_en_chn = enable;
}
/**
* @brief Enable the weighted arbitration optimize for DMA TX channel
*/
static inline void ahb_dma_ll_tx_enable_weighted_arb_opt(ahb_dma_dev_t *dev, uint32_t channel, bool enable)
{
dev->out_crc_arb[channel].arb_weight_opt.tx_arb_weight_opt_dis_chn = !enable;
}
/**
* @brief Set the weight for DMA TX channel
*/
static inline void ahb_dma_ll_tx_set_weight(ahb_dma_dev_t *dev, uint32_t channel, uint32_t weight)
{
dev->out_crc_arb[channel].ch_arb_weight.tx_arb_weight_value_chn = weight;
}
#ifdef __cplusplus
}
#endif