From a81b36394e02af348ceafe6132917d4d5e3011d3 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Tue, 21 Nov 2023 10:36:17 -0800 Subject: [PATCH] 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 *