Data Counter functions.
More...
Data Counter functions.
===============================================================================
##### Data Counter functions #####
===============================================================================
[..]
This subsection provides function allowing to configure and read the buffer size
(number of data to be transferred).
[..]
The DMA data counter can be written only when the DMA Stream is disabled
(ie. after transfer complete event).
[..]
The following function can be used to write the Stream data counter value:
(+) void DMA_SetCurrDataCounter(DMA_Stream_TypeDef* DMAy_Streamx, uint16_t Counter);
-@- It is advised to use this function rather than DMA_Init() in situations
where only the Data buffer needs to be reloaded.
-@- If the Source and Destination Data Sizes are different, then the value
written in data counter, expressing the number of transfers, is relative
to the number of transfers from the Peripheral point of view.
ie. If Memory data size is Word, Peripheral data size is Half-Words,
then the value to be configured in the data counter is the number
of Half-Words to be transferred from/to the peripheral.
[..]
The DMA data counter can be read to indicate the number of remaining transfers for
the relative DMA Stream. This counter is decremented at the end of each data
transfer and when the transfer is complete:
(+) If Normal mode is selected: the counter is set to 0.
(+) If Circular mode is selected: the counter is reloaded with the initial value
(configured before enabling the DMA Stream)
[..]
The following function can be used to read the Stream data counter value:
(+) uint16_t DMA_GetCurrDataCounter(DMA_Stream_TypeDef* DMAy_Streamx);
===============================================================================
##### Data Counter functions #####
===============================================================================
[..] This subsection provides function allowing to configure and read the buffer
size (number of data to be transferred).The DMA data counter can be written
only when the DMA channel is disabled (ie. after transfer complete event).
[..] The following function can be used to write the Channel data counter value:
(+) void DMA_SetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx, uint16_t DataNumber).
[..]
(@) It is advised to use this function rather than DMA_Init() in situations
where only the Data buffer needs to be reloaded.
[..] The DMA data counter can be read to indicate the number of remaining transfers
for the relative DMA channel. This counter is decremented at the end of each
data transfer and when the transfer is complete:
(+) If Normal mode is selected: the counter is set to 0.
(+) If Circular mode is selected: the counter is reloaded with the initial
value(configured before enabling the DMA channel).
[..] The following function can be used to read the Channel data counter value:
(+) uint16_t DMA_GetCurrDataCounter(DMA_Channel_TypeDef* DMAy_Channelx).
Returns the number of remaining data units in the current DMAy Channelx transfer.
- Parameters
-
DMAy_Channelx | where y can be 1 or 2 to select the DMA and x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel. |
- Return values
-
The | number of remaining data units in the current DMAy Channelx transfer. |
Definition at line 405 of file stm32f30x_dma.c.
Returns the number of remaining data units in the current DMAy Streamx transfer.
- Parameters
-
DMAy_Streamx | where y can be 1 or 2 to select the DMA and x can be 0 to 7 to select the DMA Stream. |
- Return values
-
The | number of remaining data units in the current DMAy Streamx transfer. |
Definition at line 647 of file stm32f4xx_dma.c.
Sets the number of data units in the current DMAy Channelx transfer.
- Parameters
-
DMAy_Channelx | where y can be 1 or 2 to select the DMA and x can be 1 to 7 for DMA1 and 1 to 5 for DMA2 to select the DMA Channel. |
DataNumber | The number of data units in the current DMAy Channelx transfer. |
- Note
- This function can only be used when the DMAy_Channelx is disabled.
- Return values
-
Definition at line 387 of file stm32f30x_dma.c.
Writes the number of data units to be transferred on the DMAy Streamx.
- Parameters
-
DMAy_Streamx | where y can be 1 or 2 to select the DMA and x can be 0 to 7 to select the DMA Stream. |
Counter | Number of data units to be transferred (from 0 to 65535) Number of data items depends only on the Peripheral data format. |
- Note
- If Peripheral data format is Bytes: number of data units is equal to total number of bytes to be transferred.
-
If Peripheral data format is Half-Word: number of data units is equal to total number of bytes to be transferred / 2.
-
If Peripheral data format is Word: number of data units is equal to total number of bytes to be transferred / 4.
-
In Memory-to-Memory transfer mode, the memory buffer pointed by DMAy_SxPAR register is considered as Peripheral.
- Return values
-
The | number of remaining data units in the current DMAy Streamx transfer. |
Definition at line 632 of file stm32f4xx_dma.c.