From 7c7112a157d863665fe1b8fae2a94fbbb17dc199 Mon Sep 17 00:00:00 2001 From: px4dev Date: Tue, 8 Jan 2013 01:11:35 -0800 Subject: [PATCH] Implement stm32_dmaresidual for the F1 DMA driver. --- nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c b/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c index 89b279beaa..66a806d0c4 100644 --- a/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c +++ b/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c @@ -558,6 +558,24 @@ void stm32_dmastop(DMA_HANDLE handle) stm32_dmachandisable(dmach); } +/**************************************************************************** + * Name: stm32_dmaresidual + * + * Description: + * Returns the number of bytes remaining to be transferred + * + * Assumptions: + * - DMA handle allocated by stm32_dmachannel() + * + ****************************************************************************/ + +size_t stm32_dmaresidual(DMA_HANDLE handle) +{ + struct stm32_dma_s *dmach = (struct stm32_dma_s *)handle; + + return dmachan_getreg(dmach, STM32_DMACHAN_CNDTR_OFFSET); +} + /**************************************************************************** * Name: stm32_dmasample *