// for the STM32F0, interrupts for DMA_CH4 and DMA_CH5 are combined void dma1_channel4_5_isr(void) { usart_disable_tx_dma(USART2); usart_disable_rx_dma(USART2); dma_clear_interrupt_flags(DMA1, DMA_CHANNEL4, DMA_TCIF); dma_clear_interrupt_flags(DMA1, DMA_CHANNEL5, DMA_TCIF); dma_disable_channel(DMA1, DMA_CHANNEL4); dma_disable_channel(DMA1, DMA_CHANNEL5); }
// DMA1_CHANNEL2 UART3_RX void dma1_channel3_isr(void){ if ((DMA1_ISR & DMA_ISR_TCIF3) != 0) { DMA1_IFCR |= DMA_IFCR_CTCIF3; dma_disable_transfer_complete_interrupt(DMA1, DMA_CHANNEL3); usart_disable_rx_dma(USART3); dma_disable_channel(DMA1, DMA_CHANNEL3); gpio_set(GPIOB, GPIO_DEBUG_1); // hal_uart_manual_rts_set(); (*rx_done_handler)(); } }
/** Disable USART RX DMA. * \param s The USART DMA state structure. */ void usart_rx_dma_disable(usart_rx_dma_state* s) { /* Disable DMA stream interrupts with the NVIC. */ if (s->dma == DMA1) nvicDisableVector(dma_irq_lookup[0][s->stream]); else if (s->dma == DMA2) nvicDisableVector(dma_irq_lookup[1][s->stream]); /* Disable DMA stream. */ DMA_SCR(s->dma, s->stream) &= ~DMA_SxCR_EN; while (DMA_SCR(s->dma, s->stream) & DMA_SxCR_EN) ; /* Disable RX DMA on the USART. */ usart_disable_rx_dma(s->usart); /* Clear the DMA transmit complete and half complete interrupt flags. */ dma_clear_interrupt_flags(s->dma, s->stream, DMA_HTIF | DMA_TCIF); }