STM8L15x Standard Peripherals Drivers: DMA

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

DMA driver modules. More...

Modules

 DMA_Private_Functions
 DMA_Exported_Types
 DMA_Exported_Macros

Functions

void DMA_ClearFlag (DMA_FLAG_TypeDef DMA_FLAG)
 Clears the DMA Channels selected flags.
void DMA_ClearITPendingBit (DMA_IT_TypeDef DMA_IT)
 Clears the DMA Channelx�s interrupt pending bits.
void DMA_Cmd (DMA_Channel_TypeDef *DMA_Channelx, FunctionalState NewState)
 Enables or disables the specified DMA Channelx.
void DMA_DeInit (DMA_Channel_TypeDef *DMA_Channelx)
 Deinitializes the DMA Channelx registers to their default reset values.
uint8_t DMA_GetCurrDataCounter (DMA_Channel_TypeDef *DMA_Channelx)
 Returns the number of remaining data units in the current DMA Channelx transfer.
FlagStatus DMA_GetFlagStatus (DMA_FLAG_TypeDef DMA_FLAG)
 Checks whether the specified DMA Channelx flag is set or not.
ITStatus DMA_GetITStatus (DMA_IT_TypeDef DMA_IT)
 Checks whether the specified DMA Channelx interrupt has occurred or not.
void DMA_GlobalCmd (FunctionalState NewState)
 Enables or disables All the DMA.
void DMA_GlobalDeInit (void)
 Deinitializes the DMA Global Status register to its default reset values.
void DMA_Init (DMA_Channel_TypeDef *DMA_Channelx, uint32_t DMA_Memory0BaseAddr, uint16_t DMA_PeripheralMemory1BaseAddr, uint8_t DMA_BufferSize, DMA_DIR_TypeDef DMA_DIR, DMA_Mode_TypeDef DMA_Mode, DMA_MemoryIncMode_TypeDef DMA_MemoryIncMode, DMA_Priority_TypeDef DMA_Priority, DMA_MemoryDataSize_TypeDef DMA_MemoryDataSize)
 Initializes the DMA Channelx according to the specified parameters.
void DMA_ITConfig (DMA_Channel_TypeDef *DMA_Channelx, DMA_ITx_TypeDef DMA_ITx, FunctionalState NewState)
 Enables or disables the specified DMA Channelx interrupts.
void DMA_SetCurrDataCounter (DMA_Channel_TypeDef *DMA_Channelx, uint8_t DataNumber)
 Set the number of data units to transfer for DMA Channelx.
void DMA_SetTimeOut (uint8_t DMA_TimeOut)
 Sets the Time out Value.

Detailed Description

DMA driver modules.


Function Documentation

void DMA_ClearFlag ( DMA_FLAG_TypeDef  DMA_FLAG)

Clears the DMA Channels selected flags.

Parameters:
DMA_FLAG,:specifies the flag to clear. This parameter can be one or a combination (for the same channel)of the following values:
  • DMA1_FLAG_TC0: Transaction Complete Interrupt Flag Channel 0
  • DMA1_FLAG_TC1: Transaction Complete Interrupt Flag Channel 1
  • DMA1_FLAG_TC2: Transaction Complete Interrupt Flag Channel 2
  • DMA1_FLAG_TC2: Transaction Complete Interrupt Flag Channel 3
  • DMA1_FLAG_HT0: Half Transaction Interrupt Flag Channel 0
  • DMA1_FLAG_HT1: Half Transaction Interrupt Flag Channel 1
  • DMA1_FLAG_HT2: Half Transaction Interrupt Flag Channel 2
  • DMA1_FLAG_HT3: Half Transaction Interrupt Flag Channel 3
Return values:
None

Definition at line 591 of file stm8l15x_dma.c.

References DMA_Channel_struct::CSPR, DMA1_Channel0, DMA1_Channel1, DMA1_Channel2, DMA1_Channel3, IS_DMA_CLEAR_FLAG, and RESET.

void DMA_ClearITPendingBit ( DMA_IT_TypeDef  DMA_IT)

Clears the DMA Channelx�s interrupt pending bits.

Parameters:
DMA_IT,:specifies the DMA interrupt pending bit to clear. This parameter can be one or a combination(for the same channel)of the following values:
  • DMA1_IT_TC0: Transaction Complete Interrupt Channel 0
  • DMA1_IT_TC1: Transaction Complete Interrupt Channel 1
  • DMA1_IT_TC2: Transaction Complete Interrupt Channel 2
  • DMA1_IT_TC3: Transaction Complete Interrupt Channel 3
  • DMA1_IT_HT0: Half Transaction Interrupt Channel 0
  • DMA1_IT_HT1: Half Transaction Interrupt Channel 1
  • DMA1_IT_HT2: Half Transaction Interrupt Channel 2
  • DMA1_IT_HT3: Half Transaction Interrupt Channel 3
Return values:
None

Definition at line 698 of file stm8l15x_dma.c.

References DMA_Channel_struct::CSPR, DMA1_Channel0, DMA1_Channel1, DMA1_Channel2, DMA1_Channel3, IS_DMA_CLEAR_IT, and RESET.

void DMA_Cmd ( DMA_Channel_TypeDef DMA_Channelx,
FunctionalState  NewState 
)

Enables or disables the specified DMA Channelx.

Note:
DMA_GlobalCmd function must be called first to enable or disable the global DMA.
Parameters:
DMA_Channelx,:selects the DMA Channelx where x can be 0 to 3
NewState,:new state of the DMA Channelx. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 308 of file stm8l15x_dma.c.

References DMA_Channel_struct::CCR, DISABLE, DMA_CCR_CE, IS_DMA_CHANNEL, and IS_FUNCTIONAL_STATE.

uint8_t DMA_GetCurrDataCounter ( DMA_Channel_TypeDef DMA_Channelx)

Returns the number of remaining data units in the current DMA Channelx transfer.

Parameters:
DMA_Channelx,:selects the DMA Channelx where x can be 0 to 3
Return values:
Thenumber of remaining data units in the current DMA Channelx

Definition at line 409 of file stm8l15x_dma.c.

References DMA_Channel_struct::CNBTR, and IS_DMA_CHANNEL.

FlagStatus DMA_GetFlagStatus ( DMA_FLAG_TypeDef  DMA_FLAG)

Checks whether the specified DMA Channelx flag is set or not.

Parameters:
DMA_FLAG,:specifies the flag to check. This parameter can be one of the following values:
  • DMA1_FLAG_GB: Global Busy Flag
  • DMA1_FLAG_IFC0: Global Interrupt Flag Channel 0
  • DMA1_FLAG_IFC1: Global Interrupt Flag Channel 1
  • DMA1_FLAG_IFC2: Global Interrupt Flag Channel 2
  • DMA1_FLAG_IFC3: Global Interrupt Flag Channel 3
  • DMA1_FLAG_TC0: Transaction Complete Interrupt Flag Channel 0
  • DMA1_FLAG_TC1: Transaction Complete Interrupt Flag Channel 1
  • DMA1_FLAG_TC2: Transaction Complete Interrupt Flag Channel 2
  • DMA1_FLAG_TC2: Transaction Complete Interrupt Flag Channel 3
  • DMA1_FLAG_HT0: Half Transaction Interrupt Flag Channel 0
  • DMA1_FLAG_HT1: Half Transaction Interrupt Flag Channel 1
  • DMA1_FLAG_HT2: Half Transaction Interrupt Flag Channel 2
  • DMA1_FLAG_HT3: Half Transaction Interrupt Flag Channel 3
  • DMA1_FLAG_PEND0: DMA Request pending on Channel 0
  • DMA1_FLAG_PEND1: DMA Request pending on Channel 1
  • DMA1_FLAG_PEND2: DMA Request pending on Channel 2
  • DMA1_FLAG_PEND3: DMA Request pending on Channel 3
  • DMA1_FLAG_BUSY0: No DMA transfer on going in Channel 0
  • DMA1_FLAG_BUSY1: No DMA transfer on going in Channel 1
  • DMA1_FLAG_BUSY2: No DMA transfer on going in Channel 2
  • DMA1_FLAG_BUSY3: No DMA transfer on going in Channel 3
Return values:
Thestatus of DMA_FLAG (SET or RESET).

Definition at line 524 of file stm8l15x_dma.c.

References DMA_Channel_struct::CSPR, DMA1, DMA1_Channel0, DMA1_Channel1, DMA1_Channel2, DMA1_Channel3, DMA_GCSR_GB, IS_DMA_GET_FLAG, and RESET.

ITStatus DMA_GetITStatus ( DMA_IT_TypeDef  DMA_IT)

Checks whether the specified DMA Channelx interrupt has occurred or not.

Parameters:
DMA_IT,:specifies the DMA interrupt source to check. This parameter can be one or a combination of the following values:
  • DMA1_IT_TC0: Transaction Complete Interrupt Channel 0
  • DMA1_IT_TC1: Transaction Complete Interrupt Channel 1
  • DMA1_IT_TC2: Transaction Complete Interrupt Channel 2
  • DMA1_IT_TC3: Transaction Complete Interrupt Channel 3
  • DMA1_IT_HT0: Half Transaction Interrupt Channel 0
  • DMA1_IT_HT1: Half Transaction Interrupt Channel 1
  • DMA1_IT_HT2: Half Transaction Interrupt Channel 2
  • DMA1_IT_HT3: Half Transaction Interrupt Channel 3
Return values:
ITStatus,:The status of DMA_IT (SET or RESET).

Definition at line 640 of file stm8l15x_dma.c.

References DMA_Channel_struct::CCR, DMA_Channel_struct::CSPR, DMA1_Channel0, DMA1_Channel1, DMA1_Channel2, DMA1_Channel3, DMA_CCR_HTIE, DMA_CCR_TCIE, IS_DMA_GET_IT, and RESET.

void DMA_GlobalCmd ( FunctionalState  NewState)

Enables or disables All the DMA.

Parameters:
NewState,:new state of the DMA. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 282 of file stm8l15x_dma.c.

References DISABLE, DMA1, DMA_GCSR_GE, and IS_FUNCTIONAL_STATE.

void DMA_GlobalDeInit ( void  )

Deinitializes the DMA Global Status register to its default reset values.

Parameters:
None
Return values:
None

Definition at line 134 of file stm8l15x_dma.c.

References DMA1, DMA_GCSR_GE, and DMA_GCSR_RESET_VALUE.

void DMA_Init ( DMA_Channel_TypeDef DMA_Channelx,
uint32_t  DMA_Memory0BaseAddr,
uint16_t  DMA_PeripheralMemory1BaseAddr,
uint8_t  DMA_BufferSize,
DMA_DIR_TypeDef  DMA_DIR,
DMA_Mode_TypeDef  DMA_Mode,
DMA_MemoryIncMode_TypeDef  DMA_MemoryIncMode,
DMA_Priority_TypeDef  DMA_Priority,
DMA_MemoryDataSize_TypeDef  DMA_MemoryDataSize 
)

Initializes the DMA Channelx according to the specified parameters.

Parameters:
DMA_Channelx,:selects the DMA Channelx where x can be 0 to 3
DMA_Memory0BaseAddr,:Specifies Memory 0 Base Address
DMA_PeripheralMemory1BaseAddr,:Specifies DMA channelx Peripheral Base Address (if data is from/to peripheral) or DMA channelx Memory1 Base Address (if data is from Memory0 to Memory1).
DMA_BufferSize,:Specifies the size of the DMA channelx Buffer. This parameter must be a value greater than 0.
DMA_DIR,:Specifies the DMA Channelx transfer direction. This parameter can be one of the following values:
  • DMA_DIR_PeripheralToMemory: Data transfer direction is Peripheral To Memory
  • DMA_DIR_MemoryToPeripheral: Data transfer direction is Memory To Peripheral
  • DMA_DIR_Memory0ToMemory1: Data transfer direction is Memory0 To Memory 1
DMA_Mode,:Specifies the DMA channelx mode. This parameter can be one of the following values:
  • DMA_Mode_Normal: DMA normal buffer mode
  • DMA_Mode_Circular: DMA circular buffer mode
DMA_MemoryIncMode,:Specifies the DMA channelx memory Incremental/Decremental mode This parameter can be one of the following values:
  • DMA_MemoryIncMode_Dec: DMA memory incremented mode is decremental
  • DMA_MemoryIncMode_Inc: DMA memory incremented mode is incremental
DMA_Priority,:Specifies the DMA channelx priority. This parameter can be one of the following values:
  • DMA_Priority_Low: Software Priority is Low
  • DMA_Priority_Medium: Software Priority is Medium
  • DMA_Priority_High: Software Priority is High
  • DMA_Priority_VeryHigh: Software Priority is Very High
DMA_MemoryDataSize,:Specifies the DMA channelx transfer Data size This parameter can be one of the following values:
  • DMA_MemoryDataSize_Byte: Memory Data Size is 1 Byte
  • DMA_MemoryDataSize_HalfWord: Memory Data Size is 2 Bytes
Return values:
None

Definition at line 218 of file stm8l15x_dma.c.

References DMA_Channel_struct::CCR, DMA_Channel_struct::CM0ARH, DMA_Channel_struct::CM0ARL, DMA_Channel_struct::CM0EAR, DMA_Channel_struct::CNBTR, DMA_Channel_struct::CPARH, DMA_Channel_struct::CPARL, DMA_Channel_struct::CSPR, DMA1_Channel3, DMA_CCR_CE, DMA_CCR_RESET_VALUE, DMA_CSPR_16BM, DMA_CSPR_PL, IS_DMA_BUFFER_SIZE, IS_DMA_CHANNEL, IS_DMA_DIR, IS_DMA_MEMORY_INC_MODE, IS_DMA_MODE, and IS_DMA_PRIORITY.

void DMA_ITConfig ( DMA_Channel_TypeDef DMA_Channelx,
DMA_ITx_TypeDef  DMA_ITx,
FunctionalState  NewState 
)

Enables or disables the specified DMA Channelx interrupts.

Parameters:
DMA_Channelx,:selects the DMA Channelx where x can be 0 to 3
DMA_ITx,:specifies the DMA interrupts sources to be enabled or disabled. This parameter can be one of the following values:
  • DMA_ITx_TC: Transaction Complete Interrupt
  • DMA_ITx_HT: Half Transaction Interrupt
NewState,:new state of the specified DMA interrupts. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 476 of file stm8l15x_dma.c.

References DMA_Channel_struct::CCR, DISABLE, IS_DMA_CHANNEL, IS_DMA_CONFIG_ITX, and IS_FUNCTIONAL_STATE.

void DMA_SetCurrDataCounter ( DMA_Channel_TypeDef DMA_Channelx,
uint8_t  DataNumber 
)

Set the number of data units to transfer for DMA Channelx.

Parameters:
DMA_Channelx,:selects the DMA Channelx where x can be 0 to 3
DataNumber,:The number of data units to transfer, it can be any value from 0 to 255
Note:
It is advised to use this function rather than DMA_Init() in situations where only the Data buffer needs to be reloaded.
Return values:
None

Definition at line 395 of file stm8l15x_dma.c.

References DMA_Channel_struct::CNBTR, and IS_DMA_CHANNEL.

void DMA_SetTimeOut ( uint8_t  DMA_TimeOut)

Sets the Time out Value.

Parameters:
DMA_TimeOut,:an integer from 0 to 63
Note:
If timeout duration >0 (number of wait cycles starting from the latest request), the DMA waits until this timeout has elapsed before requesting from the core a high priority access to the bus.
If timeout duration =0, there is no timeout and once a request is served, the DMA immediately asks to the CPU a high priority access to the bus.
Return values:
None

Definition at line 336 of file stm8l15x_dma.c.

References DMA1, and IS_DMA_TIMEOUT.

STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com