Minor change to DMA handling of IRQ DMA disable. Modify SPI handling of DMA ERROR macro.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14319 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
cinsights 2021-04-25 11:57:34 +00:00
parent 90ab355458
commit 623c3133ee
2 changed files with 7 additions and 8 deletions

View File

@ -96,9 +96,11 @@ static struct {
static void serve_interrupt(const rp_dma_channel_t *dmachp) {
uint32_t ct;
/* Getting and clearing error flags.*/
/* Get channel control, disable then clear any bus error flags.*/
ct = dmachp->channel->CTRL_TRIG;
dmachp->channel->CTRL_TRIG = DMA_CTRL_TRIG_READ_ERROR | DMA_CTRL_TRIG_WRITE_ERROR;
DMA->CLR.CH[dmachp->chnidx].CTRL_TRIG = DMA_CTRL_TRIG_EN;
DMA->SET.CH[dmachp->chnidx].CTRL_TRIG = DMA_CTRL_TRIG_READ_ERROR |
DMA_CTRL_TRIG_WRITE_ERROR;
/* Calling the associated function, if defined.*/
if (dma.channels[dmachp->chnidx].func != NULL) {

View File

@ -68,17 +68,14 @@ static uint16_t dummyrx;
static void spi_lld_serve_rx_interrupt(SPIDriver *spip, uint32_t ct) {
/* DMA errors handling.*/
#if defined(RP_SPI_DMA_ERROR_HOOK)
if ((ct & DMA_CTRL_TRIG_AHB_ERROR) != 0U) {
/* Stopping DMAs.*/
dmaChannelDisableX(spip->dmatx);
dmaChannelDisableX(spip->dmarx);
#if defined(RP_SPI_DMA_ERROR_HOOK)
RP_SPI_DMA_ERROR_HOOK(spip);
}
#else
(void)ct;
#endif
/* Portable SPI ISR code defined in the high level driver, note, it is
@ -202,13 +199,13 @@ void spi_lld_start(SPIDriver *spip) {
osalDbgAssert(false, "invalid SPI instance");
}
/* DMA setup.*/
/* DMA setup for SPI DR.*/
dmaChannelSetSourceX(spip->dmarx, (uint32_t)&spip->spi->SSPDR);
dmaChannelSetDestinationX(spip->dmatx, (uint32_t)&spip->spi->SSPDR);
}
/* Configuration-dependent DMA settings.*/
dss = (spip->config->SSPCR0 & SPI_SSPCR0_DSS_Msk)/* >> SPI_SSPCR0_DSS_Pos*/;
dss = (spip->config->SSPCR0 & SPI_SSPCR0_DSS_Msk);
if (dss <= SPI_SSPCR0_DSS_8BIT) {
/* Frame width is 8 bits or smaller.*/
spip->rxdmamode = (spip->rxdmamode & ~DMA_CTRL_TRIG_DATA_SIZE_Msk) |