mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
esp32[c3|c6|h2]: Add DMA function to have more capabilites
Add DMA function to increase DMA peripheral capabilities Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
This commit is contained in:
committed by
Lup Yuen Lee
parent
2d069231c5
commit
f286a63223
@@ -282,6 +282,125 @@ void esp_dma_load(struct esp_dmadesc_s *dmadesc, int chan, bool tx)
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_enable_interrupt
|
||||
*
|
||||
* Description:
|
||||
* Enable/Disable DMA interrupt.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
* mask - Interrupt mask to change
|
||||
* en - true: enable; false: disable
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp_dma_enable_interrupt(int chan, bool tx, uint32_t mask, bool en)
|
||||
{
|
||||
if (tx)
|
||||
{
|
||||
gdma_ll_tx_enable_interrupt(ctx.dev, chan, mask, en);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdma_ll_rx_enable_interrupt(ctx.dev, chan, mask, en);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_get_interrupt
|
||||
*
|
||||
* Description:
|
||||
* Gets DMA interrupt status.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
*
|
||||
* Returned Value:
|
||||
* Interrupt status value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp_dma_get_interrupt(int chan, bool tx)
|
||||
{
|
||||
uint32_t intr_status = 0;
|
||||
|
||||
if (tx)
|
||||
{
|
||||
intr_status = gdma_ll_tx_get_interrupt_status(ctx.dev, chan);
|
||||
}
|
||||
else
|
||||
{
|
||||
intr_status = gdma_ll_rx_get_interrupt_status(ctx.dev, chan);
|
||||
}
|
||||
|
||||
return intr_status;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_clear_interrupt
|
||||
*
|
||||
* Description:
|
||||
* Clear DMA interrupt.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
* mask - Interrupt mask to change
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp_dma_clear_interrupt(int chan, bool tx, uint32_t mask)
|
||||
{
|
||||
if (tx)
|
||||
{
|
||||
gdma_ll_tx_clear_interrupt_status(ctx.dev, chan, mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdma_ll_rx_clear_interrupt_status(ctx.dev, chan, mask);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_get_desc_addr
|
||||
*
|
||||
* Description:
|
||||
* Gets desc addr of DMA interrupt.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
*
|
||||
* Returned Value:
|
||||
* Desc addr.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp_dma_get_desc_addr(int chan, bool tx)
|
||||
{
|
||||
uint32_t desc_addr = 0;
|
||||
|
||||
if (tx)
|
||||
{
|
||||
desc_addr = gdma_ll_tx_get_eof_desc_addr(ctx.dev, chan);
|
||||
}
|
||||
else
|
||||
{
|
||||
desc_addr = gdma_ll_rx_get_success_eof_desc_addr(ctx.dev, chan);
|
||||
}
|
||||
|
||||
return desc_addr;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_enable
|
||||
*
|
||||
@@ -363,6 +482,33 @@ void esp_dma_wait_idle(int chan, bool tx)
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_reset_channel
|
||||
*
|
||||
* Description:
|
||||
* Resets dma channel.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp_dma_reset_channel(int chan, bool tx)
|
||||
{
|
||||
if (tx)
|
||||
{
|
||||
gdma_ll_tx_reset_channel(ctx.dev, chan);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdma_ll_rx_reset_channel(ctx.dev, chan);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_init
|
||||
*
|
||||
|
||||
@@ -150,6 +150,77 @@ uint32_t esp_dma_setup(int chan, bool tx,
|
||||
|
||||
void esp_dma_load(struct esp_dmadesc_s *dmadesc, int chan, bool tx);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_enable_interrupt
|
||||
*
|
||||
* Description:
|
||||
* Enable DMA interrupt.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
* mask - Interrupt mask to change
|
||||
* en - true: enable; false: disable
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp_dma_enable_interrupt(int chan, bool tx, uint32_t mask, bool en);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_get_interrupt
|
||||
*
|
||||
* Description:
|
||||
* Gets DMA interrupt status.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
*
|
||||
* Returned Value:
|
||||
* Interrupt status value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp_dma_get_interrupt(int chan, bool tx);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_clear_interrupt
|
||||
*
|
||||
* Description:
|
||||
* Clear DMA interrupt.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
* mask - Interrupt mask to change
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp_dma_clear_interrupt(int chan, bool tx, uint32_t mask);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_get_desc_addr
|
||||
*
|
||||
* Description:
|
||||
* Gets desc addr of DMA interrupt.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
*
|
||||
* Returned Value:
|
||||
* Desc addr.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int esp_dma_get_desc_addr(int chan, bool tx);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_enable
|
||||
*
|
||||
@@ -201,6 +272,23 @@ void esp_dma_disable(int chan, bool tx);
|
||||
|
||||
void esp_dma_wait_idle(int chan, bool tx);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_reset_channel
|
||||
*
|
||||
* Description:
|
||||
* Resets dma channel.
|
||||
*
|
||||
* Input Parameters:
|
||||
* chan - DMA channel
|
||||
* tx - true: TX mode; false: RX mode
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void esp_dma_reset_channel(int chan, bool tx);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_dma_init
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user