stm32/dma: STM32L4: always deinit/reinit DMA channels
This commit is contained in:
parent
b8a5167517
commit
f826f6172b
@ -498,6 +498,7 @@ void dma_init(DMA_HandleTypeDef *dma, const dma_descr_t *dma_descr, void *data){
|
||||
|
||||
dma_enable_clock(dma_id);
|
||||
|
||||
#if !defined(STM32L4)
|
||||
// if this stream was previously configured for this channel/request then we
|
||||
// can skip most of the initialisation
|
||||
uint8_t sub_inst = DMA_SUB_INSTANCE_AS_UINT8(dma_descr->sub_instance);
|
||||
@ -524,6 +525,13 @@ void dma_init(DMA_HandleTypeDef *dma, const dma_descr_t *dma_descr, void *data){
|
||||
dma->ChannelIndex = (((uint32_t)dma->Instance - (uint32_t)dma->DmaBaseAddress) /20)*4;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
// ALWAYS reset and configure DMA peripheral
|
||||
// (dma->State is set to HAL_DMA_STATE_RESET by memset above)
|
||||
HAL_DMA_DeInit(dma);
|
||||
HAL_DMA_Init(dma);
|
||||
HAL_NVIC_SetPriority(dma_irqn[dma_id], IRQ_PRI_DMA, IRQ_SUBPRI_DMA);
|
||||
#endif
|
||||
|
||||
HAL_NVIC_EnableIRQ(dma_irqn[dma_id]);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user