diff --git a/arch/arm/src/imxrt/imxrt_edma.c b/arch/arm/src/imxrt/imxrt_edma.c index 6ce69fbb921..ebd8e867b46 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 39d89895a5e..f39e5538146 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 *