You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/05/29 13:32:15 UTC

[GitHub] [incubator-nuttx] jlaitine commented on a change in pull request #1147: stm32h7:stm32_spi Restores internal DMA buffer broken in 574b25 and improvements.

jlaitine commented on a change in pull request #1147:
URL: https://github.com/apache/incubator-nuttx/pull/1147#discussion_r432484340



##########
File path: arch/arm/src/stm32h7/stm32_spi.c
##########
@@ -1955,39 +1956,53 @@ static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer,
       return;
     }
 
-  /* Setup the DMA configs */
-
-  spi_dmatxsetup(priv, txbuffer, &txdummy, nwords, &txdmacfg);
-  spi_dmarxsetup(priv, rxbuffer, (uint16_t *)rxdummy, nwords, &rxdmacfg);
-
-#ifdef CONFIG_STM32H7_DMACAPABLE
-
-  /* Setup DMAs */
-
-  /* If this bus uses a in driver buffers we will incur 2 copies,
-   * The copy cost is << less the non DMA transfer time and having
-   * the buffer in the driver ensures DMA can be used. This is bacause
-   * the API does not support passing the buffer extent so the only
-   * extent is buffer + the transfer size. These can sizes be less than
-   * the cache line size, and not aligned and tyicaly greater then 4
-   * bytes, which is about the break even point for the DMA IO overhead.
+  /* If this bus uses the driver's DMA aligned buffers (priv->txbuf != NULL)
+   * we will incur 2 copies. However the copy cost is much less the non
+   * DMA transfer time. Having the buffer in the driver ensures DMA can be
+   * used. This is needed because the stm32_dmacapable API does not support
+   * passing the buffer extent. So the only extent calculated is buffer
+   * plus the transfer size. The sizes can be less than a cache line size,
+   * and not aligned and are typically greater then 4 bytes, which is
+   * about the break even point for the DMA IO overhead.
    */
 
   if (txbuffer && priv->txbuf)

Review comment:
       Here I would do just if (priv->txbuf) and check for txbuffer down below




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org