From 9a4f19c574e04934cdc045fcf1e0bd535cf93b71 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 24 Sep 2017 15:26:18 +0000 Subject: Added new macro to DMAv2 dmaStreamGetCurrentTarget(). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10708 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/DMAv2/stm32_dma.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/os/hal/ports/STM32/LLD/DMAv2/stm32_dma.h b/os/hal/ports/STM32/LLD/DMAv2/stm32_dma.h index d0ec96864..3d8c08f13 100644 --- a/os/hal/ports/STM32/LLD/DMAv2/stm32_dma.h +++ b/os/hal/ports/STM32/LLD/DMAv2/stm32_dma.h @@ -648,6 +648,20 @@ typedef void (*stm32_dmaisr_t)(void *p, uint32_t flags); ; \ dmaStreamClearInterrupt(dmastp); \ } + +/** + * @brief DMA stream current target. + * @note This function can be invoked in both ISR or thread context. + * @pre The stream must have been allocated using @p dmaStreamAllocate(). + * @post After use the stream can be released using @p dmaStreamRelease(). + * + * @param[in] dmastp pointer to a stm32_dma_stream_t structure + * @return Current memory target index. + * + * @special + */ +#define dmaStreamGetCurrentTarget(dmastp) \ + (((dmastp)->stream->CR >> DMA_SxCR_CT_Pos) & 1U) /** @} */ /*===========================================================================*/ -- cgit v1.2.3