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 2022/08/04 15:55:56 UTC
[GitHub] [incubator-nuttx] davids5 opened a new pull request, #6786: IMX.RT EDMA Support
davids5 opened a new pull request, #6786:
URL: https://github.com/apache/incubator-nuttx/pull/6786
## Summary
This PR cleans up the it IMX.RT DMA code and makes it functional
- Header file clean up
- API fixed DMACH_HANDLE is a value (blind pointer) not a pointer to the DMACH_HANDLE
- Fixed compile errors for number of parameters for all the syslog statements.
- Hardfault cased by 8 bit registers accessed with 32 bit operations.
- TCD did not require endian configuration.
- HW TCD reset of DLASTSGA is 32 Bits.
- Fixed initialization so the `imxrt_dmach_getcount` reports 0 when Done.
- TCD has to be 32 byte aligned to work with Scatter Gather
- `ttype` was removed - it was used to apply `dcache` operation on external buffers, but the API does not know the buffer extent, so it is better to do the `dcache` operations in the code that owns the buffers.
- Support was added for source or destination looping. Useful for non binary or large sided circular buffers.
- Added Interrupt on Half or Major loop completion.
- Scatters gather supports Single interrupt at the end.
- Order of operations on the HW TCD were corrected.
- DMA Termination order of operations changed to be able to get meaningful status on DMA completion or Error
- i`rq_attach` and `up_enable_irq` placed in a loop to save code space
- DMAMUX selection left disabled until used
More driver dependent on this to follow
## Impact
Module builds and works now.
## Testing
PX4 nxp_imxrt1062-v2
--
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] pkarashchenko commented on a diff in pull request #6786: IMX.RT EDMA Support
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6786:
URL: https://github.com/apache/incubator-nuttx/pull/6786#discussion_r937998801
##########
arch/arm/src/imxrt/imxrt_edma.c:
##########
@@ -86,22 +90,16 @@
*/
#ifdef CONFIG_ARMV7M_DCACHE
-/* Align to the cache line size which we assume is >= 8 */
-
-# define EDMA_ALIGN ARMV7M_DCACHE_LINESIZE
-# define EDMA_ALIGN_MASK (EDMA_ALIGN-1)
-# define EDMA_ALIGN_UP(n) (((n) + EDMA_ALIGN_MASK) & ~EDMA_ALIGN_MASK)
-
-#else
-/* Special alignment is not required in this case,
- * but we will align to 8-bytes
- */
-
-# define EDMA_ALIGN 8
-# define EDMA_ALIGN_MASK 7
-# define EDMA_ALIGN_UP(n) (((n) + 7) & ~7)
+# if EDMA_ALIGN != ARMV7M_DCACHE_LINESIZE
+# warning EDMA_ALIGN != ARMV7M_DCACHE_LINESIZE
+# endif
+# undef EDMA_ALIGN
+# define EDMA_ALIGN ARMV7M_DCACHE_LINESIZE
#endif
+#define EDMA_ALIGN_MASK (EDMA_ALIGN-1)
Review Comment:
```suggestion
#define EDMA_ALIGN_MASK (EDMA_ALIGN - 1)
```
##########
arch/arm/src/imxrt/imxrt_edma.c:
##########
@@ -1018,19 +1003,23 @@ void imxrt_dmach_free(DMACH_HANDLE handle)
*
****************************************************************************/
-int imxrt_dmach_xfrsetup(DMACH_HANDLE *handle,
+int imxrt_dmach_xfrsetup(DMACH_HANDLE handle,
const struct imxrt_edma_xfrconfig_s *config)
{
struct imxrt_dmach_s *dmach = (struct imxrt_dmach_s *)handle;
#if CONFIG_IMXRT_EDMA_NTCD > 0
struct imxrt_edmatcd_s *tcd;
struct imxrt_edmatcd_s *prev;
+ uint16_t mask = config->flags & EDMA_CONFIG_INTMAJOR ? 0 :
+ EDMA_TCD_CSR_INTMAJOR;
#endif
uintptr_t regaddr;
uint16_t regval16;
DEBUGASSERT(dmach != NULL);
- dmainfo("dmach%u: %p config: %p\n", dmach, config);
+ dmainfo("dmach%u: %p config: %p\n", dmach->chan, dmach, config);
+
+ dmach->flags = config->flags;
Review Comment:
```suggestion
dmach->flags = config->flags;
```
##########
arch/arm/src/imxrt/imxrt_edma.c:
##########
@@ -404,13 +398,16 @@ static inline void imxrt_tcd_configure(struct imxrt_edmatcd_s *tcd,
tcd->attr = EDMA_TCD_ATTR_SSIZE(config->ssize) | /* Transfer Attributes */
EDMA_TCD_ATTR_DSIZE(config->dsize);
tcd->nbytes = config->nbytes;
- tcd->slast = tcd->slast;
+ tcd->slast = config->flags & EDMA_CONFIG_LOOPSRC ? -config->iter : 0;
Review Comment:
```suggestion
tcd->slast = config->flags & EDMA_CONFIG_LOOPSRC ? -config->iter : 0;
```
##########
arch/arm/src/imxrt/imxrt_edma.c:
##########
@@ -613,8 +605,18 @@ static void imxrt_dmach_interrupt(struct imxrt_dmach_s *dmach)
/* Terminate the transfer when it is done. */
- imxrt_dmaterminate(dmach, result);
+ if ((dmach->flags & EDMA_CONFIG_LOOP_MASK) == 0)
+ {
+ imxrt_dmaterminate(dmach, result);
+ }
+ else if (dmach->callback != NULL)
+ {
+ dmach->callback((DMACH_HANDLE)dmach, dmach->arg,
+ true, result);
+ }
Review Comment:
```suggestion
{
dmach->callback((DMACH_HANDLE)dmach, dmach->arg,
true, result);
}
```
##########
arch/arm/src/imxrt/imxrt_edma.c:
##########
@@ -1018,19 +1003,23 @@ void imxrt_dmach_free(DMACH_HANDLE handle)
*
****************************************************************************/
-int imxrt_dmach_xfrsetup(DMACH_HANDLE *handle,
+int imxrt_dmach_xfrsetup(DMACH_HANDLE handle,
const struct imxrt_edma_xfrconfig_s *config)
{
struct imxrt_dmach_s *dmach = (struct imxrt_dmach_s *)handle;
#if CONFIG_IMXRT_EDMA_NTCD > 0
struct imxrt_edmatcd_s *tcd;
struct imxrt_edmatcd_s *prev;
+ uint16_t mask = config->flags & EDMA_CONFIG_INTMAJOR ? 0 :
+ EDMA_TCD_CSR_INTMAJOR;
Review Comment:
```suggestion
uint16_t mask = config->flags & EDMA_CONFIG_INTMAJOR ? 0 :
EDMA_TCD_CSR_INTMAJOR;
```
##########
arch/arm/src/imxrt/imxrt_edma.c:
##########
@@ -86,22 +90,16 @@
*/
#ifdef CONFIG_ARMV7M_DCACHE
-/* Align to the cache line size which we assume is >= 8 */
-
-# define EDMA_ALIGN ARMV7M_DCACHE_LINESIZE
-# define EDMA_ALIGN_MASK (EDMA_ALIGN-1)
-# define EDMA_ALIGN_UP(n) (((n) + EDMA_ALIGN_MASK) & ~EDMA_ALIGN_MASK)
-
-#else
-/* Special alignment is not required in this case,
- * but we will align to 8-bytes
- */
-
-# define EDMA_ALIGN 8
-# define EDMA_ALIGN_MASK 7
-# define EDMA_ALIGN_UP(n) (((n) + 7) & ~7)
+# if EDMA_ALIGN != ARMV7M_DCACHE_LINESIZE
+# warning EDMA_ALIGN != ARMV7M_DCACHE_LINESIZE
+# endif
+# undef EDMA_ALIGN
+# define EDMA_ALIGN ARMV7M_DCACHE_LINESIZE
#endif
Review Comment:
Why not just
```
#ifdef CONFIG_ARMV7M_DCACHE
# define EDMA_ALIGN ARMV7M_DCACHE_LINESIZE
#else
# define EDMA_ALIGN 32
#endif
```
?
--
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 diff in pull request #6786: IMX.RT EDMA Support
Posted by GitBox <gi...@apache.org>.
davids5 commented on code in PR #6786:
URL: https://github.com/apache/incubator-nuttx/pull/6786#discussion_r938063697
##########
arch/arm/src/imxrt/imxrt_edma.c:
##########
@@ -86,22 +90,16 @@
*/
#ifdef CONFIG_ARMV7M_DCACHE
-/* Align to the cache line size which we assume is >= 8 */
-
-# define EDMA_ALIGN ARMV7M_DCACHE_LINESIZE
-# define EDMA_ALIGN_MASK (EDMA_ALIGN-1)
-# define EDMA_ALIGN_UP(n) (((n) + EDMA_ALIGN_MASK) & ~EDMA_ALIGN_MASK)
-
-#else
-/* Special alignment is not required in this case,
- * but we will align to 8-bytes
- */
-
-# define EDMA_ALIGN 8
-# define EDMA_ALIGN_MASK 7
-# define EDMA_ALIGN_UP(n) (((n) + 7) & ~7)
+# if EDMA_ALIGN != ARMV7M_DCACHE_LINESIZE
+# warning EDMA_ALIGN != ARMV7M_DCACHE_LINESIZE
+# endif
+# undef EDMA_ALIGN
+# define EDMA_ALIGN ARMV7M_DCACHE_LINESIZE
#endif
Review Comment:
Yeah - I just wanted honor the comment suggesting it may not be 32.
I will change it
--
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 #6786: IMX.RT EDMA Support
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #6786:
URL: https://github.com/apache/incubator-nuttx/pull/6786
--
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] pkarashchenko commented on a diff in pull request #6786: IMX.RT EDMA Support
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6786:
URL: https://github.com/apache/incubator-nuttx/pull/6786#discussion_r938103711
##########
arch/arm/src/imxrt/imxrt_edma.c:
##########
@@ -404,13 +394,16 @@ static inline void imxrt_tcd_configure(struct imxrt_edmatcd_s *tcd,
tcd->attr = EDMA_TCD_ATTR_SSIZE(config->ssize) | /* Transfer Attributes */
EDMA_TCD_ATTR_DSIZE(config->dsize);
tcd->nbytes = config->nbytes;
- tcd->slast = tcd->slast;
+ tcd->slast = config->flags & EDMA_CONFIG_LOOPSRC ? -config->iter : 0;
tcd->daddr = config->daddr;
tcd->doff = config->doff;
tcd->citer = config->iter & EDMA_TCD_CITER_CITER_MASK;
tcd->biter = config->iter & EDMA_TCD_BITER_BITER_MASK;
- tcd->csr = EDMA_TCD_CSR_DREQ; /* Assume last transfer */
- tcd->dlastsga = 0;
+ tcd->csr = config->flags & EDMA_CONFIG_LOOP_MASK ?
+ 0 : EDMA_TCD_CSR_DREQ;
+ tcd->csr |= config->flags & EDMA_CONFIG_INTHALF ?
+ EDMA_TCD_CSR_INTHALF : 0;
+ tcd->dlastsga = config->flags & EDMA_CONFIG_LOOPDEST ? -config->iter : 0;
Review Comment:
```suggestion
tcd->dlastsga = config->flags & EDMA_CONFIG_LOOPDEST ? -config->iter : 0;
```
##########
arch/arm/src/imxrt/imxrt_edma.c:
##########
@@ -404,13 +394,16 @@ static inline void imxrt_tcd_configure(struct imxrt_edmatcd_s *tcd,
tcd->attr = EDMA_TCD_ATTR_SSIZE(config->ssize) | /* Transfer Attributes */
EDMA_TCD_ATTR_DSIZE(config->dsize);
tcd->nbytes = config->nbytes;
- tcd->slast = tcd->slast;
+ tcd->slast = config->flags & EDMA_CONFIG_LOOPSRC ? -config->iter : 0;
tcd->daddr = config->daddr;
tcd->doff = config->doff;
tcd->citer = config->iter & EDMA_TCD_CITER_CITER_MASK;
tcd->biter = config->iter & EDMA_TCD_BITER_BITER_MASK;
- tcd->csr = EDMA_TCD_CSR_DREQ; /* Assume last transfer */
- tcd->dlastsga = 0;
+ tcd->csr = config->flags & EDMA_CONFIG_LOOP_MASK ?
+ 0 : EDMA_TCD_CSR_DREQ;
+ tcd->csr |= config->flags & EDMA_CONFIG_INTHALF ?
Review Comment:
```suggestion
tcd->csr |= config->flags & EDMA_CONFIG_INTHALF ?
```
--
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 pull request #6786: IMX.RT EDMA Support
Posted by GitBox <gi...@apache.org>.
davids5 commented on PR #6786:
URL: https://github.com/apache/incubator-nuttx/pull/6786#issuecomment-1205565812
@pkarashchenko - Thank you for the review!
--
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