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

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

commit a81b36394e02af348ceafe6132917d4d5e3011d3
Author: David Sidrane <david.sidr...@nscdg.com>
AuthorDate: Tue Nov 21 10:36:17 2023 -0800

    imxrt:edma Add idle chack
---
 arch/arm/src/imxrt/imxrt_edma.c | 18 ++++++++++++++++++
 arch/arm/src/imxrt/imxrt_edma.h | 14 ++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/arch/arm/src/imxrt/imxrt_edma.c b/arch/arm/src/imxrt/imxrt_edma.c
index 6ce69fbb92..ebd8e867b4 100644
--- a/arch/arm/src/imxrt/imxrt_edma.c
+++ b/arch/arm/src/imxrt/imxrt_edma.c
@@ -1273,6 +1273,24 @@ unsigned int imxrt_dmach_getcount(DMACH_HANDLE handle)
   return remaining;
 }
 
+/****************************************************************************
+ * Name: imxrt_dmach_idle
+ *
+ * Description:
+ *   This function checks if the dma is idle
+ *
+ * Returned Value:
+ *   0  - if idle
+ *   !0 - not
+ *
+ ****************************************************************************/
+
+unsigned int imxrt_dmach_idle(DMACH_HANDLE handle)
+{
+  struct imxrt_dmach_s *dmach = (struct imxrt_dmach_s *)handle;
+  return dmach->state == IMXRT_DMA_IDLE ? 0 : -1;
+}
+
 /****************************************************************************
  * Name: imxrt_dmasample
  *
diff --git a/arch/arm/src/imxrt/imxrt_edma.h b/arch/arm/src/imxrt/imxrt_edma.h
index 39d89895a5..f39e553814 100644
--- a/arch/arm/src/imxrt/imxrt_edma.h
+++ b/arch/arm/src/imxrt/imxrt_edma.h
@@ -411,6 +411,20 @@ void imxrt_dmach_stop(DMACH_HANDLE handle);
 
 unsigned int imxrt_dmach_getcount(DMACH_HANDLE handle);
 
+/****************************************************************************
+ * Name: imxrt_dmach_idle
+ *
+ * Description:
+ *   This function checks if the dma is idle
+ *
+ * Returned Value:
+ *   0  - if idle
+ *   !0 - not
+ *
+ ****************************************************************************/
+
+unsigned int imxrt_dmach_idle(DMACH_HANDLE handle);
+
 /****************************************************************************
  * Name: imxrt_dmasample
  *

Reply via email to