diff options
Diffstat (limited to 'os/hal/platforms/STM32/DMAv2')
-rw-r--r-- | os/hal/platforms/STM32/DMAv2/stm32_dma.c | 6 | ||||
-rw-r--r-- | os/hal/platforms/STM32/DMAv2/stm32_dma.h | 19 |
2 files changed, 18 insertions, 7 deletions
diff --git a/os/hal/platforms/STM32/DMAv2/stm32_dma.c b/os/hal/platforms/STM32/DMAv2/stm32_dma.c index 48c0d4e95..5d320dab3 100644 --- a/os/hal/platforms/STM32/DMAv2/stm32_dma.c +++ b/os/hal/platforms/STM32/DMAv2/stm32_dma.c @@ -415,7 +415,7 @@ void dmaInit(void) { int i;
dma_streams_mask = 0;
- for (i = 0; i < STM32_DMA_STREAMS; i--) {
+ for (i = 0; i < STM32_DMA_STREAMS; i++) {
_stm32_dma_streams[i].stream->CR = 0;
dma_isr_redir[i].dma_func = NULL;
}
@@ -446,7 +446,7 @@ void dmaInit(void) { *
* @special
*/
-bool_t dmaAllocate(stm32_dma_stream_t *dmastp,
+bool_t dmaAllocate(const stm32_dma_stream_t *dmastp,
stm32_dmaisr_t func, void *param) {
chDbgCheck(dmastp != NULL, "dmaAllocate");
@@ -488,7 +488,7 @@ bool_t dmaAllocate(stm32_dma_stream_t *dmastp, *
* @special
*/
-void dmaRelease(stm32_dma_stream_t *dmastp) {
+void dmaRelease(const stm32_dma_stream_t *dmastp) {
chDbgCheck(dmastp != NULL, "dmaRelease");
diff --git a/os/hal/platforms/STM32/DMAv2/stm32_dma.h b/os/hal/platforms/STM32/DMAv2/stm32_dma.h index 5d87e67a9..88f594eec 100644 --- a/os/hal/platforms/STM32/DMAv2/stm32_dma.h +++ b/os/hal/platforms/STM32/DMAv2/stm32_dma.h @@ -217,11 +217,11 @@ typedef void (*stm32_dmaisr_t)(void *p, uint32_t flags); }
/**
- * @brief Associates an alternate memory destination to a DMA stream.
+ * @brief Sets the number of transfers to be performed.
* @note This function can be invoked in both ISR or thread context.
*
* @param[in] dmastp pointer to a stm32_dma_stream_t structure
- * @param[in] size value to be written in the NDTR register
+ * @param[in] size value to be written in the CNDTR register
*
* @special
*/
@@ -230,6 +230,17 @@ typedef void (*stm32_dmaisr_t)(void *p, uint32_t flags); }
/**
+ * @brief Returns the number of transfers to be performed.
+ * @note This function can be invoked in both ISR or thread context.
+ *
+ * @param[in] dmastp pointer to a stm32_dma_stream_t structure
+ * @return The number of transfers to be performed.
+ *
+ * @special
+ */
+#define dmaStreamGetTransactionSize(dmastp) ((size_t)((dmastp)->stream->NDTR))
+
+/**
* @brief Programs the stream mode settings.
* @note This function can be invoked in both ISR or thread context.
*
@@ -303,9 +314,9 @@ extern const stm32_dma_stream_t _stm32_dma_streams[STM32_DMA_STREAMS]; extern "C" {
#endif
void dmaInit(void);
- bool_t dmaAllocate(stm32_dma_stream_t *dmastp,
+ bool_t dmaAllocate(const stm32_dma_stream_t *dmastp,
stm32_dmaisr_t func, void *param);
- void dmaRelease(stm32_dma_stream_t *dmastp);
+ void dmaRelease(const stm32_dma_stream_t *dmastp);
#ifdef __cplusplus
}
#endif
|