You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by da...@apache.org on 2021/04/29 10:19:53 UTC

[incubator-nuttx] branch master updated: stm32h7: serial: use dma tx semaphore as resource holder

This is an automated email from the ASF dual-hosted git repository.

davids5 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 940c5b6  stm32h7: serial: use dma tx semaphore as resource holder
940c5b6 is described below

commit 940c5b69c36fd1210ada473a5665e4c83420be77
Author: Alexander Vasiljev <al...@gmail.com>
AuthorDate: Wed Apr 28 10:51:50 2021 +0300

    stm32h7: serial: use dma tx semaphore as resource holder
---
 arch/arm/src/stm32h7/stm32_serial.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/arm/src/stm32h7/stm32_serial.c b/arch/arm/src/stm32h7/stm32_serial.c
index f747879..5ac9391 100644
--- a/arch/arm/src/stm32h7/stm32_serial.c
+++ b/arch/arm/src/stm32h7/stm32_serial.c
@@ -2220,7 +2220,7 @@ static int up_dma_setup(struct uart_dev_s *dev)
     {
       priv->txdma = stm32_dmachannel(priv->txdma_channel);
 
-      nxsem_init(&priv->txdmasem, 0, 0);
+      nxsem_init(&priv->txdmasem, 0, 1);
       nxsem_set_protocol(&priv->txdmasem, SEM_PRIO_NONE);
 
       /* Enable receive Tx DMA for the UART */
@@ -3369,16 +3369,10 @@ static void up_dma_txcallback(DMA_HANDLE handle, uint8_t status, void *arg)
 static void up_dma_txavailable(struct uart_dev_s *dev)
 {
   struct up_dev_s *priv = (struct up_dev_s *)dev->priv;
-  size_t resid = 0;
-
-  resid = stm32_dmaresidual(priv->txdma);
 
   /* Only send when the DMA is idle */
 
-  if (resid != 0)
-    {
-      nxsem_wait(&priv->txdmasem);
-    }
+  nxsem_wait(&priv->txdmasem);
 
   uart_xmitchars_dma(dev);
 }