Skip to content

Commit

Permalink
stm32h7:Enable IDEL INT only if DMA in use
Browse files Browse the repository at this point in the history
  • Loading branch information
davids5 committed Apr 4, 2022
1 parent 78e1190 commit e00b9b7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions arch/arm/src/stm32h7/stm32_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1561,9 +1561,14 @@ static inline void up_setusartint(struct up_dev_s *priv, uint16_t ie)
cr = up_serialin(priv, STM32_USART_CR1_OFFSET);
cr &= ~(USART_CR1_USED_INTS);
cr |= (ie & (USART_CR1_USED_INTS));

#ifdef SERIAL_HAVE_RXDMA
cr |= USART_CR1_IDLEIE;
if (priv->rxdma != 0)
{
cr |= USART_CR1_IDLEIE;
}
#endif

up_serialout(priv, STM32_USART_CR1_OFFSET, cr);

cr = up_serialin(priv, STM32_USART_CR3_OFFSET);
Expand Down Expand Up @@ -2142,7 +2147,8 @@ static int up_setup(struct uart_dev_s *dev)
*/

regval = up_serialin(priv, STM32_USART_CR1_OFFSET);
regval &= ~(USART_CR1_TE | USART_CR1_RE | USART_CR1_ALLINTS);
regval &= ~(USART_CR1_TE | USART_CR1_RE | USART_CR1_IDLE |
USART_CR1_ALLINTS);

up_serialout(priv, STM32_USART_CR1_OFFSET, regval);

Expand Down Expand Up @@ -2172,7 +2178,10 @@ static int up_setup(struct uart_dev_s *dev)
regval = up_serialin(priv, STM32_USART_CR1_OFFSET);
regval |= (USART_CR1_UE | USART_CR1_TE | USART_CR1_RE);
#ifdef SERIAL_HAVE_RXDMA
regval |= USART_CR1_IDLEIE;
if (priv->rxdma != 0)
{
regval |= USART_CR1_IDLEIE;
}
#endif

regval |= USART_CR1_FIFOEN;
Expand Down Expand Up @@ -2523,10 +2532,7 @@ static int up_interrupt(int irq, void *context, FAR void *arg)
if ((priv->sr & USART_ISR_IDLE) != 0)
{
up_serialout(priv, STM32_USART_ICR_OFFSET, USART_ICR_IDLECF);
if (priv->rxdma != 0)
{
up_dma_rxcallback(priv->rxdma, 0, priv);
}
up_dma_rxcallback(priv->rxdma, 0, priv);
}
#endif

Expand Down

0 comments on commit e00b9b7

Please sign in to comment.