Interrupts and flags management functions.
More...
Interrupts and flags management functions.
===============================================================================
##### Interrupts and flags management functions #####
===============================================================================
[..]
This subsection provides functions allowing to
(+) Check the DMA enable status
(+) Check the FIFO status
(+) Configure the DMA Interrupts sources and check or clear the flags or
pending bits status.
[..]
(#) DMA Enable status:
After configuring the DMA Stream (DMA_Init() function) and enabling
the stream, it is recommended to check (or wait until) the DMA Stream
is effectively enabled. A Stream may remain disabled if a configuration
parameter is wrong. After disabling a DMA Stream, it is also recommended
to check (or wait until) the DMA Stream is effectively disabled.
If a Stream is disabled while a data transfer is ongoing, the current
data will be transferred and the Stream will be effectively disabled
only after this data transfer completion.
To monitor this state it is possible to use the following function:
(++) FunctionalState DMA_GetCmdStatus(DMA_Stream_TypeDef* DMAy_Streamx);
(#) FIFO Status:
It is possible to monitor the FIFO status when a transfer is ongoing
using the following function:
(++) uint32_t DMA_GetFIFOStatus(DMA_Stream_TypeDef* DMAy_Streamx);
(#) DMA Interrupts and Flags:
The user should identify which mode will be used in his application
to manage the DMA controller events: Polling mode or Interrupt mode.
*** Polling Mode ***
====================
[..]
Each DMA stream can be managed through 4 event Flags:
(x : DMA Stream number )
(#) DMA_FLAG_FEIFx : to indicate that a FIFO Mode Transfer Error event occurred.
(#) DMA_FLAG_DMEIFx : to indicate that a Direct Mode Transfer Error event occurred.
(#) DMA_FLAG_TEIFx : to indicate that a Transfer Error event occurred.
(#) DMA_FLAG_HTIFx : to indicate that a Half-Transfer Complete event occurred.
(#) DMA_FLAG_TCIFx : to indicate that a Transfer Complete event occurred .
[..]
In this Mode it is advised to use the following functions:
(+) FlagStatus DMA_GetFlagStatus(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_FLAG);
(+) void DMA_ClearFlag(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_FLAG);
*** Interrupt Mode ***
======================
[..]
Each DMA Stream can be managed through 4 Interrupts:
*** Interrupt Source ***
========================
[..]
(#) DMA_IT_FEIFx : specifies the interrupt source for the FIFO Mode Transfer Error event.
(#) DMA_IT_DMEIFx : specifies the interrupt source for the Direct Mode Transfer Error event.
(#) DMA_IT_TEIFx : specifies the interrupt source for the Transfer Error event.
(#) DMA_IT_HTIFx : specifies the interrupt source for the Half-Transfer Complete event.
(#) DMA_IT_TCIFx : specifies the interrupt source for the a Transfer Complete event.
[..]
In this Mode it is advised to use the following functions:
(+) void DMA_ITConfig(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT, FunctionalState NewState);
(+) ITStatus DMA_GetITStatus(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT);
(+) void DMA_ClearITPendingBit(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT);
Clears the DMAy Streamx's pending flags.
- 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. |
DMA_FLAG | specifies the flag to clear. This parameter can be any combination of the following values:
- DMA_FLAG_TCIFx: Streamx transfer complete flag
- DMA_FLAG_HTIFx: Streamx half transfer complete flag
- DMA_FLAG_TEIFx: Streamx transfer error flag
- DMA_FLAG_DMEIFx: Streamx direct mode error flag
- DMA_FLAG_FEIFx: Streamx FIFO error flag Where x can be 0 to 7 to select the DMA Stream.
|
- Return values
-
Definition at line 1071 of file stm32f4xx_dma.c.
Clears the DMAy Streamx's interrupt pending bits.
- 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. |
DMA_IT | specifies the DMA interrupt pending bit to clear. This parameter can be any combination of the following values:
- DMA_IT_TCIFx: Streamx transfer complete interrupt
- DMA_IT_HTIFx: Streamx half transfer complete interrupt
- DMA_IT_TEIFx: Streamx transfer error interrupt
- DMA_IT_DMEIFx: Streamx direct mode error interrupt
- DMA_IT_FEIFx: Streamx FIFO error interrupt Where x can be 0 to 7 to select the DMA Stream.
|
- Return values
-
Definition at line 1252 of file stm32f4xx_dma.c.
Returns the status of EN bit for the specified 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. |
- Note
- After configuring the DMA Stream (DMA_Init() function) and enabling the stream, it is recommended to check (or wait until) the DMA Stream is effectively enabled. A Stream may remain disabled if a configuration parameter is wrong. After disabling a DMA Stream, it is also recommended to check (or wait until) the DMA Stream is effectively disabled. If a Stream is disabled while a data transfer is ongoing, the current data will be transferred and the Stream will be effectively disabled only after the transfer of this single data is finished.
- Return values
-
Current | state of the DMAy Streamx (ENABLE or DISABLE). |
Definition at line 943 of file stm32f4xx_dma.c.
Returns the current DMAy Streamx FIFO filled level.
- 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 | FIFO filling state.
- DMA_FIFOStatus_Less1QuarterFull: when FIFO is less than 1 quarter-full and not empty.
- DMA_FIFOStatus_1QuarterFull: if more than 1 quarter-full.
- DMA_FIFOStatus_HalfFull: if more than 1 half-full.
- DMA_FIFOStatus_3QuartersFull: if more than 3 quarters-full.
- DMA_FIFOStatus_Empty: when FIFO is empty
- DMA_FIFOStatus_Full: when FIFO is full
|
Definition at line 977 of file stm32f4xx_dma.c.
Checks whether the specified DMAy Streamx flag is set or not.
- 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. |
DMA_FLAG | specifies the flag to check. This parameter can be one of the following values:
- DMA_FLAG_TCIFx: Streamx transfer complete flag
- DMA_FLAG_HTIFx: Streamx half transfer complete flag
- DMA_FLAG_TEIFx: Streamx transfer error flag
- DMA_FLAG_DMEIFx: Streamx direct mode error flag
- DMA_FLAG_FEIFx: Streamx FIFO error flag Where x can be 0 to 7 to select the DMA Stream.
|
- Return values
-
The | new state of DMA_FLAG (SET or RESET). |
Definition at line 1004 of file stm32f4xx_dma.c.
Checks whether the specified DMAy Streamx interrupt has occurred or not.
- 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. |
DMA_IT | specifies the DMA interrupt source to check. This parameter can be one of the following values:
- DMA_IT_TCIFx: Streamx transfer complete interrupt
- DMA_IT_HTIFx: Streamx half transfer complete interrupt
- DMA_IT_TEIFx: Streamx transfer error interrupt
- DMA_IT_DMEIFx: Streamx direct mode error interrupt
- DMA_IT_FEIFx: Streamx FIFO error interrupt Where x can be 0 to 7 to select the DMA Stream.
|
- Return values
-
The | new state of DMA_IT (SET or RESET). |
Definition at line 1170 of file stm32f4xx_dma.c.
Enables or disables the specified DMAy Streamx interrupts.
- 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. |
DMA_IT | specifies the DMA interrupt sources to be enabled or disabled. This parameter can be any combination of the following values:
- DMA_IT_TC: Transfer complete interrupt mask
- DMA_IT_HT: Half transfer complete interrupt mask
- DMA_IT_TE: Transfer error interrupt mask
- DMA_IT_FE: FIFO error interrupt mask
|
NewState | new state of the specified DMA interrupts. This parameter can be: ENABLE or DISABLE. |
- Return values
-
Definition at line 1118 of file stm32f4xx_dma.c.