nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #706: stm32h7:SPI Add buffers for DMA & and FIX DMA
Date Fri, 03 Apr 2020 13:50:38 GMT
xiaoxiang781216 commented on a change in pull request #706: stm32h7:SPI Add buffers for DMA
& and FIX DMA
URL: https://github.com/apache/incubator-nuttx/pull/706#discussion_r403019222
 
 

 ##########
 File path: arch/arm/src/stm32h7/stm32_spi.c
 ##########
 @@ -1768,23 +1840,48 @@ static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void
*txbuffer,
     }
 
 #ifdef CONFIG_STM32H7_DMACAPABLE
-  stm32_dmacfg_t dmacfg1;
-  stm32_dmacfg_t dmacfg2;
+  stm32_dmacfg_t dmatxcfg;
+  stm32_dmacfg_t dmarxcfg;
+
+  /* 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 (txbuffer && priv->txbuf)
+    {
+      if (nbytes > priv->buflen)
 
 Review comment:
   Instead of returning error, it's better to:
   1.Send the buffer segment by segment or
   2.Switch to PIO mode

----------------------------------------------------------------
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


With regards,
Apache Git Services

Mime
View raw message