Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thirdpin/libopencm3.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2017-01-13 15:57:42 +0300
committerKarl Palsson <karlp@tweak.net.au>2018-08-29 01:00:01 +0300
commit743513a4b1b15901fd6ff35f9b3c8812dc96dcaa (patch)
tree5cfe608c05835dea3241373bfeaf8e8c20bb9517
parent824beaa472c26d09bc4a2f152d7003a0e632fdb3 (diff)
stm32: add dma_get_number_of_data
Original discussion at: https://github.com/libopencm3/libopencm3/pull/702
-rw-r--r--include/libopencm3/stm32/common/dma_common_f24.h1
-rw-r--r--include/libopencm3/stm32/common/dma_common_l1f013.h1
-rw-r--r--lib/stm32/common/dma_common_f24.c14
-rw-r--r--lib/stm32/common/dma_common_l1f013.c14
4 files changed, 30 insertions, 0 deletions
diff --git a/include/libopencm3/stm32/common/dma_common_f24.h b/include/libopencm3/stm32/common/dma_common_f24.h
index e32114b1..896f0ef5 100644
--- a/include/libopencm3/stm32/common/dma_common_f24.h
+++ b/include/libopencm3/stm32/common/dma_common_f24.h
@@ -613,6 +613,7 @@ void dma_disable_stream(uint32_t dma, uint8_t stream);
void dma_set_peripheral_address(uint32_t dma, uint8_t stream, uint32_t address);
void dma_set_memory_address(uint32_t dma, uint8_t stream, uint32_t address);
void dma_set_memory_address_1(uint32_t dma, uint8_t stream, uint32_t address);
+uint16_t dma_get_number_of_data(uint32_t dma, uint8_t stream);
void dma_set_number_of_data(uint32_t dma, uint8_t stream, uint16_t number);
END_DECLS
diff --git a/include/libopencm3/stm32/common/dma_common_l1f013.h b/include/libopencm3/stm32/common/dma_common_l1f013.h
index a00834ab..489c9def 100644
--- a/include/libopencm3/stm32/common/dma_common_l1f013.h
+++ b/include/libopencm3/stm32/common/dma_common_l1f013.h
@@ -410,6 +410,7 @@ void dma_disable_channel(uint32_t dma, uint8_t channel);
void dma_set_peripheral_address(uint32_t dma, uint8_t channel,
uint32_t address);
void dma_set_memory_address(uint32_t dma, uint8_t channel, uint32_t address);
+uint16_t dma_get_number_of_data(uint32_t dma, uint8_t channel);
void dma_set_number_of_data(uint32_t dma, uint8_t channel, uint16_t number);
END_DECLS
diff --git a/lib/stm32/common/dma_common_f24.c b/lib/stm32/common/dma_common_f24.c
index 6b655636..d706674f 100644
--- a/lib/stm32/common/dma_common_f24.c
+++ b/lib/stm32/common/dma_common_f24.c
@@ -775,6 +775,20 @@ void dma_set_memory_address_1(uint32_t dma, uint8_t stream, uint32_t address)
}
/*---------------------------------------------------------------------------*/
+/** @brief DMA Stream Get the Transfer Block Size
+
+@param[in] dma unsigned int32. DMA controller base address: DMA1 or DMA2
+@param[in] stream unsigned int8. Stream number: @ref dma_st_number
+@returns unsigned int16. Number of remaining data words to transfer (65535
+maximum).
+*/
+
+uint16_t dma_get_number_of_data(uint32_t dma, uint8_t stream)
+{
+ return DMA_SNDTR(dma, stream);
+}
+
+/*---------------------------------------------------------------------------*/
/** @brief DMA Stream Set the Transfer Block Size
@note The DMA stream must be disabled before setting this count value. The count
diff --git a/lib/stm32/common/dma_common_l1f013.c b/lib/stm32/common/dma_common_l1f013.c
index 0005c113..47abfa24 100644
--- a/lib/stm32/common/dma_common_l1f013.c
+++ b/lib/stm32/common/dma_common_l1f013.c
@@ -416,6 +416,20 @@ void dma_set_memory_address(uint32_t dma, uint8_t channel, uint32_t address)
}
/*---------------------------------------------------------------------------*/
+/** @brief DMA Channel Get the Transfer Block Size
+
+@param[in] dma unsigned int32. DMA controller base address: DMA1 or DMA2
+@param[in] channel unsigned int8. Channel number: 1-7 for DMA1 or 1-5 for DMA2
+@returns unsigned int16. Number of remaining data words to transfer (65535
+maximum).
+*/
+
+uint16_t dma_get_number_of_data(uint32_t dma, uint8_t channel)
+{
+ return DMA_CNDTR(dma, channel);
+}
+
+/*---------------------------------------------------------------------------*/
/** @brief DMA Channel Set the Transfer Block Size
@note The DMA channel must be disabled before setting this count value. The