STM8L15x Standard Peripherals Drivers: Initialization and Configuration functions

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

Initialization and Configuration functions

Initialization and Configuration functions. More...

Functions

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.
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_SetTimeOut (uint8_t DMA_TimeOut)
 Sets the Time out Value.

Detailed Description

Initialization and Configuration functions.

 ===============================================================================
                 Initialization and Configuration functions
 ===============================================================================  

  This subsection provides functions allowing to initialize the DMA channel 
  source and destination addresses, incrementation and data sizes, transfer 
  direction, buffer size, circular/normal mode selection, memory-to-memory mode 
  selection and channel priority value.
  
  - The DMA_Init() function follows the DMA configuration procedures.
  - All DMA channels can be enabled and disabled in the same time using 
    DMA_GlobalCmd() function.
  - The DMA has 4 channels, User can enable or disable channels using 
    DMA_Cmd() function.
  - The timeout duration (number of wait cycles starting from the latest 
    request) is configured using DMA_SetTimeOut() function. The DMA then waits 
    until this timeout has elapsed before requesting from the core a high 
    priority access to the bus. 


Function Documentation

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.

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_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