mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
bl602: Fix bug in lli functionality for dma.
This commit is contained in:
committed by
Petro Karashchenko
parent
b0f9241ec1
commit
8b7d2d3da4
@@ -259,15 +259,14 @@ int bl602_dma_channel_start(uint8_t channel_id)
|
|||||||
/* Unmask interrupts for:
|
/* Unmask interrupts for:
|
||||||
* - DMA_INT_TCOMPLETED
|
* - DMA_INT_TCOMPLETED
|
||||||
* - DMA_INT_ERR
|
* - DMA_INT_ERR
|
||||||
* Enable Terminal Count interrupt.
|
* Note it is expected that the TC interupt to be enabled prior to this
|
||||||
|
* function call if needed as it is nominally controlled via the LLI
|
||||||
|
* mechanism.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
modifyreg32(BL602_DMA_CH_N_REG(BL602_DMA_CONFIG_OFFSET, channel_id),
|
modifyreg32(BL602_DMA_CH_N_REG(BL602_DMA_CONFIG_OFFSET, channel_id),
|
||||||
DMA_C0CONFIG_ITC | DMA_C0CONFIG_IE,
|
DMA_C0CONFIG_ITC | DMA_C0CONFIG_IE,
|
||||||
0);
|
0);
|
||||||
modifyreg32(BL602_DMA_CH_N_REG(BL602_DMA_CONTROL_OFFSET, channel_id),
|
|
||||||
0,
|
|
||||||
DMA_C0CONTROL_I);
|
|
||||||
|
|
||||||
/* Enable channel */
|
/* Enable channel */
|
||||||
|
|
||||||
|
|||||||
@@ -933,7 +933,8 @@ static int lli_list_init(struct bl602_spi_priv_s *priv,
|
|||||||
(*tx_lli)[i].dma_ctrl = dma_ctrl;
|
(*tx_lli)[i].dma_ctrl = dma_ctrl;
|
||||||
(*tx_lli)[i].dst_addr = BL602_SPI_FIFO_WDATA;
|
(*tx_lli)[i].dst_addr = BL602_SPI_FIFO_WDATA;
|
||||||
(*tx_lli)[i].src_addr = \
|
(*tx_lli)[i].src_addr = \
|
||||||
(uint32_t)txbuffer + (dma_ctrl.src_width * i * LLI_BUFF_SIZE);
|
(uint32_t)txbuffer + \
|
||||||
|
((dma_ctrl.src_width + 1) * i * LLI_BUFF_SIZE);
|
||||||
|
|
||||||
/* Assume last entry, we will overwrite as needed. */
|
/* Assume last entry, we will overwrite as needed. */
|
||||||
|
|
||||||
@@ -955,7 +956,8 @@ static int lli_list_init(struct bl602_spi_priv_s *priv,
|
|||||||
dma_ctrl.src_increment = 0;
|
dma_ctrl.src_increment = 0;
|
||||||
(*rx_lli)[i].dma_ctrl = dma_ctrl;
|
(*rx_lli)[i].dma_ctrl = dma_ctrl;
|
||||||
(*rx_lli)[i].dst_addr = \
|
(*rx_lli)[i].dst_addr = \
|
||||||
(uint32_t)rxbuffer + (dma_ctrl.dst_width * i * LLI_BUFF_SIZE);
|
(uint32_t)rxbuffer + \
|
||||||
|
((dma_ctrl.dst_width + 1) * i * LLI_BUFF_SIZE);
|
||||||
(*rx_lli)[i].src_addr = BL602_SPI_FIFO_RDATA;
|
(*rx_lli)[i].src_addr = BL602_SPI_FIFO_RDATA;
|
||||||
(*rx_lli)[i].next_lli = 0; /* Assume last entry, we will overwrite as needed. */
|
(*rx_lli)[i].next_lli = 0; /* Assume last entry, we will overwrite as needed. */
|
||||||
|
|
||||||
@@ -1006,7 +1008,6 @@ static void bl602_spi_dma_exchange(struct bl602_spi_priv_s *priv,
|
|||||||
void *rxbuffer, uint32_t nwords)
|
void *rxbuffer, uint32_t nwords)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_DMA_INFO
|
#ifdef CONFIG_DEBUG_DMA_INFO
|
||||||
struct bl602_dmaregs_s regs;
|
struct bl602_dmaregs_s regs;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user