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 2021/06/30 19:17:38 UTC

[GitHub] [incubator-nuttx] davids5 opened a new pull request #4002: Kinetis Replace DMA with a proper eDMA driver and use it on SPI and Serial

davids5 opened a new pull request #4002:
URL: https://github.com/apache/incubator-nuttx/pull/4002


   ## Summary
   
   This PR replaces the DMA driver from 2017 that was not very useful, with a port in of the S32K eDMA driver. Several fixes were needed to get it to build and run correctly. One simple enhancement was added for destination looping with only one channel/csd to facilitate a simple circular buffer. 
   
   The serial driver was updated to use the new interface.
   The Serial driver no longer needs a DMA poll as it is driven off of RX idle.
   Added SPI DMA using the new interface.
   
   ## Impact
   
   None in tree.
   
   ## Testing
   
   PX4 nxp_fmuk66-e
   
   


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

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] davids5 commented on a change in pull request #4002: Kinetis Replace DMA with a proper eDMA driver and use it on SPI and Serial

Posted by GitBox <gi...@apache.org>.
davids5 commented on a change in pull request #4002:
URL: https://github.com/apache/incubator-nuttx/pull/4002#discussion_r661805486



##########
File path: arch/arm/src/kinetis/kinetis_edma.h
##########
@@ -0,0 +1,455 @@
+/****************************************************************************
+ * arch/arm/src/kinetis/kinetis_edma.h
+ *
+ *   Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ *   Author: Gregory Nutt <gn...@nuttx.org>
+ *
+ * This file was leveraged from the NuttX i.MXRT port.
+ * Portions of that eDMA logic derived from NXP sample code which has
+ * a compatible BSD 3-clause license:
+ *

Review comment:
       @acassis do we have a CCLA from NXP? I thought this was still tied up and should not be changed until it was resolved. 




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

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #4002: Kinetis Replace DMA with a proper eDMA driver and use it on SPI and Serial

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #4002:
URL: https://github.com/apache/incubator-nuttx/pull/4002


   


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

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] davids5 commented on a change in pull request #4002: Kinetis Replace DMA with a proper eDMA driver and use it on SPI and Serial

Posted by GitBox <gi...@apache.org>.
davids5 commented on a change in pull request #4002:
URL: https://github.com/apache/incubator-nuttx/pull/4002#discussion_r661803408



##########
File path: arch/arm/src/kinetis/Kconfig
##########
@@ -1114,6 +1114,96 @@ config KINETIS_SD4BIT_FREQ
 endif
 endmenu # Kinetis SDHC Configuration
 
+menu "eDMA Configuration"
+	depends on KINETIS_EDMA
+
+config KINETIS_EDMA_NTCD
+	int "Number of transfer descriptors"
+	default 0
+	---help---
+		Number of pre-allocated transfer descriptors.  Needed for scatter-
+		gather DMA.  Make to be set to zero to disable in-memory TCDs in
+		which case only the TCD channel registers will be used and scatter-
+		will not be supported.
+
+config KINETIS_EDMA_ELINK
+	bool "Channeling Linking"
+	default n
+	---help---
+		This option enables optional minor or major loop channel linking:
+
+		Minor loop channel linking:  As the channel completes the minor
+		loop, this flag enables linking to another channel. The link target
+		channel initiates a channel service request via an internal
+		mechanism that sets the TCDn_CSR[START] bit of the specified
+		channel.
+
+		If minor loop channel linking is disabled, this link mechanism is
+		suppressed in favor of the major loop channel linking.
+
+		Major loop channel linking:  As the channel completes the minor
+		loop, this option enables the linking to another channel. The link
+		target channel initiates a channel service request via an internal
+		mechanism that sets the TCDn_CSR[START] bit of the linked channel.
+
+config KINETIS_EDMA_ERCA
+	bool "Round Robin Channel Arbitration"
+	default n
+	---help---
+		Normally, a fixed priority arbitration is used for channel
+		selection.  If this option is selected, round robin arbitration is
+		used for channel selection.
+
+config KINETIS_EDMA_ERGA
+	bool "Round Robin Group Arbitration"
+	default n
+	---help---
+		Normally, a fixed priority arbitration is used for channel
+		selection among the groups.  If this option is selected,
+		round Round robin arbitration is used for selection among
+		the groups.
+
+config KINETIS_EDMA_HOE
+	bool "Halt On Error"
+	default y
+	---help---
+		Any error causes the HALT bit to set. Subsequently, all service
+		requests are ignored until the HALT bit is cleared.
+
+config KINETIS_EDMA_CLM
+	bool "Continuous Link Mode"
+	default n
+	---help---
+		By default, A minor loop channel link made to itself goes through
+		channel arbitration before being activated again.  If this option is
+		selected, a minor loop channel link made to itself does not go
+		through channel arbitration before being activated again. Upon minor
+		loop completion, the channel activates again if that channel has a
+		minor loop channel link enabled and the link channel is itself. This
+		effectively applies the minor loop offsets and restarts the next
+		minor loop.
+
+config KINETIS_EDMA_EMLIM
+	bool "Minor Loop Mapping"
+	default n
+	---help---
+		Normally TCD word 2 is a 32-bit NBYTES field.  When this option is
+		enabled, TCD word 2 is redefined to include individual enable fields,
+		an offset field, and the NBYTES field.  The individual enable fields
+		allow the minor loop offset to be applied to the source address, the
+		destination address, or both. The NBYTES field is reduced when either
+		offset is enabled.
+
+config KINETIS_EDMA_EDBG
+	bool "Enable Debug"
+	default n

Review comment:
       No. This is the thing the allows the DMA to be stopped while stopped in a JTag.




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

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] acassis commented on a change in pull request #4002: Kinetis Replace DMA with a proper eDMA driver and use it on SPI and Serial

Posted by GitBox <gi...@apache.org>.
acassis commented on a change in pull request #4002:
URL: https://github.com/apache/incubator-nuttx/pull/4002#discussion_r661755381



##########
File path: arch/arm/src/kinetis/Kconfig
##########
@@ -1114,6 +1114,96 @@ config KINETIS_SD4BIT_FREQ
 endif
 endmenu # Kinetis SDHC Configuration
 
+menu "eDMA Configuration"
+	depends on KINETIS_EDMA
+
+config KINETIS_EDMA_NTCD
+	int "Number of transfer descriptors"
+	default 0
+	---help---
+		Number of pre-allocated transfer descriptors.  Needed for scatter-
+		gather DMA.  Make to be set to zero to disable in-memory TCDs in
+		which case only the TCD channel registers will be used and scatter-
+		will not be supported.
+
+config KINETIS_EDMA_ELINK
+	bool "Channeling Linking"
+	default n
+	---help---
+		This option enables optional minor or major loop channel linking:
+
+		Minor loop channel linking:  As the channel completes the minor
+		loop, this flag enables linking to another channel. The link target
+		channel initiates a channel service request via an internal
+		mechanism that sets the TCDn_CSR[START] bit of the specified
+		channel.
+
+		If minor loop channel linking is disabled, this link mechanism is
+		suppressed in favor of the major loop channel linking.
+
+		Major loop channel linking:  As the channel completes the minor
+		loop, this option enables the linking to another channel. The link
+		target channel initiates a channel service request via an internal
+		mechanism that sets the TCDn_CSR[START] bit of the linked channel.
+
+config KINETIS_EDMA_ERCA
+	bool "Round Robin Channel Arbitration"
+	default n
+	---help---
+		Normally, a fixed priority arbitration is used for channel
+		selection.  If this option is selected, round robin arbitration is
+		used for channel selection.
+
+config KINETIS_EDMA_ERGA
+	bool "Round Robin Group Arbitration"
+	default n
+	---help---
+		Normally, a fixed priority arbitration is used for channel
+		selection among the groups.  If this option is selected,
+		round Round robin arbitration is used for selection among
+		the groups.
+
+config KINETIS_EDMA_HOE
+	bool "Halt On Error"
+	default y
+	---help---
+		Any error causes the HALT bit to set. Subsequently, all service
+		requests are ignored until the HALT bit is cleared.
+
+config KINETIS_EDMA_CLM
+	bool "Continuous Link Mode"
+	default n
+	---help---
+		By default, A minor loop channel link made to itself goes through
+		channel arbitration before being activated again.  If this option is
+		selected, a minor loop channel link made to itself does not go
+		through channel arbitration before being activated again. Upon minor
+		loop completion, the channel activates again if that channel has a
+		minor loop channel link enabled and the link channel is itself. This
+		effectively applies the minor loop offsets and restarts the next
+		minor loop.
+
+config KINETIS_EDMA_EMLIM
+	bool "Minor Loop Mapping"
+	default n
+	---help---
+		Normally TCD word 2 is a 32-bit NBYTES field.  When this option is
+		enabled, TCD word 2 is redefined to include individual enable fields,
+		an offset field, and the NBYTES field.  The individual enable fields
+		allow the minor loop offset to be applied to the source address, the
+		destination address, or both. The NBYTES field is reduced when either
+		offset is enabled.
+
+config KINETIS_EDMA_EDBG
+	bool "Enable Debug"
+	default n

Review comment:
       Shouldn't it depend on DEBUG being enabled?

##########
File path: arch/arm/src/kinetis/kinetis_edma.h
##########
@@ -0,0 +1,455 @@
+/****************************************************************************
+ * arch/arm/src/kinetis/kinetis_edma.h
+ *
+ *   Copyright (C) 2019 Gregory Nutt. All rights reserved.
+ *   Author: Gregory Nutt <gn...@nuttx.org>
+ *
+ * This file was leveraged from the NuttX i.MXRT port.
+ * Portions of that eDMA logic derived from NXP sample code which has
+ * a compatible BSD 3-clause license:
+ *

Review comment:
       Please include the Apache License here and keep the Freescale/NXP BSD License below. This is how Samsung did when they released TIzenRT as Apache using NuttX BSD License.

##########
File path: arch/arm/src/kinetis/kinetis_edma.c
##########
@@ -0,0 +1,1464 @@
+/****************************************************************************
+ * arch/arm/src/kinetis/kinetis_edma.c
+ *
+ *   Copyright (C) 2019, 2021 Gregory Nutt. All rights reserved.
+ *   Authors: Gregory Nutt <gn...@nuttx.org>
+ *            David Sidrane <da...@nscdg.com>
+ *

Review comment:
       Please include the Apache License here and keep the Freescale/NXP BSD License below. This is how Samsung did when they released TIzenRT as Apache using NuttX BSD License.




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

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] davids5 commented on a change in pull request #4002: Kinetis Replace DMA with a proper eDMA driver and use it on SPI and Serial

Posted by GitBox <gi...@apache.org>.
davids5 commented on a change in pull request #4002:
URL: https://github.com/apache/incubator-nuttx/pull/4002#discussion_r661813657



##########
File path: arch/arm/src/kinetis/kinetis_spi.c
##########
@@ -1251,6 +1664,39 @@ FAR struct spi_dev_s *kinetis_spibus_initialize(int port)
   /* Initialize the SPI semaphore that enforces mutually exclusive access */
 
   nxsem_init(&priv->exclsem, 0, 1);
+#ifdef CONFIG_KINETIS_SPI_DMA
+  /* Initialize the SPI semaphores that is used to wait for DMA completion.
+   * This semaphore is used for signaling and, hence, should not have
+   * priority inheritance enabled.
+   */
+
+  if (priv->rxch && priv->txch)
+    {
+      if (priv->txdma == NULL && priv->rxdma == NULL)

Review comment:
       @acassis - this was the last force push. Kinetis:SPI only allocate DMA once




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

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] davids5 commented on a change in pull request #4002: Kinetis Replace DMA with a proper eDMA driver and use it on SPI and Serial

Posted by GitBox <gi...@apache.org>.
davids5 commented on a change in pull request #4002:
URL: https://github.com/apache/incubator-nuttx/pull/4002#discussion_r661805608



##########
File path: arch/arm/src/kinetis/kinetis_edma.c
##########
@@ -0,0 +1,1464 @@
+/****************************************************************************
+ * arch/arm/src/kinetis/kinetis_edma.c
+ *
+ *   Copyright (C) 2019, 2021 Gregory Nutt. All rights reserved.
+ *   Authors: Gregory Nutt <gn...@nuttx.org>
+ *            David Sidrane <da...@nscdg.com>
+ *

Review comment:
       "




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

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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