aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-09-24 15:26:18 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-09-24 15:26:18 +0000
commit9a4f19c574e04934cdc045fcf1e0bd535cf93b71 (patch)
treee61f907448b1fd9b3b33e7a62ded60709f06b6f6
parent56ba4c2220fd667a655dd60273d9be26f0bc773d (diff)
downloadChibiOS-9a4f19c574e04934cdc045fcf1e0bd535cf93b71.tar.gz
ChibiOS-9a4f19c574e04934cdc045fcf1e0bd535cf93b71.tar.bz2
ChibiOS-9a4f19c574e04934cdc045fcf1e0bd535cf93b71.zip
Added new macro to DMAv2 dmaStreamGetCurrentTarget().
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10708 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/ports/STM32/LLD/DMAv2/stm32_dma.h14
1 files changed, 14 insertions, 0 deletions
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)
/** @} */
/*===========================================================================*/