Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
cubexHal.pdf
Скачиваний:
110
Добавлен:
10.02.2016
Размер:
16.16 Mб
Скачать

HAL DMA2D Generic Driver

UM1725

void(* XferErrorCallback

DMA2D_LayerCfgTypeDef LayerCfg

HAL_LockTypeDef Lock

__IO HAL_DMA2D_StateTypeDef State

__IO uint32_t ErrorCode

Field Documentation

DMA2D_TypeDef* __DMA2D_HandleTypeDef::Instance

DMA2D Register base address

DMA2D_InitTypeDef __DMA2D_HandleTypeDef::Init

DMA2D communication parameters

void(* __DMA2D_HandleTypeDef::XferCpltCallback)(struct __DMA2D_HandleTypeDef *hdma2d)

DMA2D transfer complete callback

void(* __DMA2D_HandleTypeDef::XferErrorCallback)(struct __DMA2D_HandleTypeDef *hdma2d)

DMA2D transfer error callback

DMA2D_LayerCfgTypeDef __DMA2D_HandleTypeDef::LayerCfg[MAX_DMA2D_LAYER]

DMA2D Layers parameters

HAL_LockTypeDef __DMA2D_HandleTypeDef::Lock

DMA2D Lock

__IO HAL_DMA2D_StateTypeDef __DMA2D_HandleTypeDef::State

DMA2D transfer state

__IO uint32_t __DMA2D_HandleTypeDef::ErrorCode

DMA2D Error code

18.2DMA2D Firmware driver API description

18.2.1How to use this driver

1.Program the required configuration through following parameters: the Transfer Mode, the output color mode and the output offset using HAL_DMA2D_Init() function.

2.Program the required configuration through following parameters: the input color mode, the input color, input alpha value, alpha mode and the input offset using HAL_DMA2D_ConfigLayer() function for foreground or/and background layer.

Polling mode IO operation

Configure the pdata, Destination and data length and Enable the transfer using HAL_DMA2D_Start()

Wait for end of transfer using HAL_DMA2D_PollForTransfer(), at this stage user can specify the value of timeout according to his end application.

Interrupt mode IO operation

1. Configure the pdata, Destination and data length and Enable the transfer using HAL_DMA2D_Start_IT()

250/900

DOCID025834 Rev 2

UM1725

HAL DMA2D Generic Driver

2.Use HAL_DMA2D_IRQHandler() called under DMA2D_IRQHandler() Interrupt subroutine

3.At the end of data transfer HAL_DMA2D_IRQHandler() function is executed and user can add his own function by customization of function pointer XferCpltCallback and XferErrorCallback (i.e a member of DMA2D handle structure). In Register-to-Memory transfer mode, the pdata parameter is the register color, in Memory-to-memory or memory-to-memory with pixel format conversion the pdata is the source address. Configure the foreground source address, the background source address, the Destination and data length and Enable the transfer using HAL_DMA2D_BlendingStart() in polling mode and HAL_DMA2D_BlendingStart_IT() in interrupt mode. HAL_DMA2D_BlendingStart() and HAL_DMA2D_BlendingStart_IT() functions are used if the memory to memory with blending transfer mode is selected.

4.Optionally, configure and enable the CLUT using HAL_DMA2D_ConfigCLUT()

HAL_DMA2D_EnableCLUT() functions.

5.Optionally, configure and enable LineInterrupt using the following function: HAL_DMA2D_ProgramLineEvent().

6.The transfer can be suspended, continued and aborted using the following functions: HAL_DMA2D_Suspend(), HAL_DMA2D_Resume(), HAL_DMA2D_Abort().

7.To control DMA2D state you can use the following function: HAL_DMA2D_GetState()

DMA2D HAL driver macros list

Below the list of most used macros in DMA2D HAL driver :

__HAL_DMA2D_ENABLE: Enable the DMA2D peripheral.

__HAL_DMA2D_DISABLE: Disable the DMA2D peripheral.

__HAL_DMA2D_GET_FLAG: Get the DMA2D pending flags.

__HAL_DMA2D_CLEAR_FLAG: Clear the DMA2D pending flags.

__HAL_DMA2D_ENABLE_IT: Enable the specified DMA2D interrupts.

__HAL_DMA2D_DISABLE_IT: Disable the specified DMA2D interrupts.

__HAL_DMA2D_GET_IT_SOURCE: Check whether the specified DMA2D interrupt has occurred or not.

You can refer to the DMA2D HAL driver header file for more useful macros

18.2.2Initialization and Configuration functions

This section provides functions allowing to:

Initialize and configure the DMA2D

De-initialize the DMA2D

This section contains the following APIs:

HAL_DMA2D_Init()

HAL_DMA2D_DeInit()

HAL_DMA2D_MspInit()

HAL_DMA2D_MspDeInit()

18.2.3IO operation functions

This section provides functions allowing to:

Configure the pdata, destination address and data size and Start DMA2D transfer.

DOCID025834 Rev 2

251/900

HAL DMA2D Generic Driver

UM1725

Configure the source for foreground and background, destination address and data size and Start MultiBuffer DMA2D transfer.

Configure the pdata, destination address and data size and Start DMA2D transfer with interrupt.

Configure the source for foreground and background, destination address and data size and Start MultiBuffer DMA2D transfer with interrupt.

Abort DMA2D transfer.

Suspend DMA2D transfer.

Continue DMA2D transfer.

Poll for transfer complete.

handle DMA2D interrupt request.

This section contains the following APIs:

HAL_DMA2D_Start()

HAL_DMA2D_Start_IT()

HAL_DMA2D_BlendingStart()

HAL_DMA2D_BlendingStart_IT()

HAL_DMA2D_Abort()

HAL_DMA2D_Suspend()

HAL_DMA2D_Resume()

HAL_DMA2D_PollForTransfer()

HAL_DMA2D_IRQHandler()

18.2.4Peripheral Control functions

This section provides functions allowing to:

Configure the DMA2D foreground or/and background parameters.

Configure the DMA2D CLUT transfer.

Enable DMA2D CLUT.

Disable DMA2D CLUT.

Configure the line watermark

This section contains the following APIs:

HAL_DMA2D_ConfigLayer()

HAL_DMA2D_ConfigCLUT()

HAL_DMA2D_EnableCLUT()

HAL_DMA2D_DisableCLUT()

HAL_DMA2D_ProgramLineEvent()

18.2.5Peripheral State and Errors functions

This subsection provides functions allowing to :

Check the DMA2D state

Get error code

This section contains the following APIs:

HAL_DMA2D_GetState()

HAL_DMA2D_GetError()

18.2.6HAL_DMA2D_Init

Function Name

HAL_StatusTypeDef HAL_DMA2D_Init

 

(DMA2D_HandleTypeDef * hdma2d)

252/900

DOCID025834 Rev 2

UM1725

 

HAL DMA2D Generic Driver

Function Description

Initializes the DMA2D according to the specified parameters in the

 

DMA2D_InitTypeDef and create the associated handle.

Parameters

 

hdma2d: pointer to a DMA2D_HandleTypeDef structure that

 

 

contains the configuration information for the DMA2D.

Return values

 

HAL status

18.2.7HAL_DMA2D_DeInit

Function Name

HAL_StatusTypeDef HAL_DMA2D_DeInit

 

(DMA2D_HandleTypeDef * hdma2d)

Function Description

Deinitializes the DMA2D peripheral registers to their default reset

 

values.

Parameters

 

hdma2d: pointer to a DMA2D_HandleTypeDef structure that

 

 

contains the configuration information for the DMA2D.

Return values

 

None

18.2.8HAL_DMA2D_MspInit

Function Name

void HAL_DMA2D_MspInit (DMA2D_HandleTypeDef *

 

hdma2d)

Function Description

Initializes the DMA2D MSP.

Parameters

 

hdma2d: pointer to a DMA2D_HandleTypeDef structure that

 

 

contains the configuration information for the DMA2D.

Return values

 

None

18.2.9HAL_DMA2D_MspDeInit

Function Name

void HAL_DMA2D_MspDeInit (DMA2D_HandleTypeDef *

 

hdma2d)

Function Description

DeInitializes the DMA2D MSP.

Parameters

 

hdma2d: pointer to a DMA2D_HandleTypeDef structure that

 

 

contains the configuration information for the DMA2D.

Return values

 

None

18.2.10HAL_DMA2D_Start

Function Name

HAL_StatusTypeDef HAL_DMA2D_Start

 

 

(DMA2D_HandleTypeDef * hdma2d, uint32_t pdata, uint32_t

 

DstAddress, uint32_t Width, uint32_t Height)

 

Function Description

Start the DMA2D Transfer.

 

Parameters

hdma2d: pointer to a DMA2D_HandleTypeDef structure that

 

contains the configuration information for the DMA2D.

 

 

pdata: Configure the source memory Buffer address if the

 

memory to memory or memory to memory with pixel format

 

conversion DMA2D mode is selected, and configure the color

 

value if register to memory DMA2D mode is selected.

 

 

DstAddress: The destination memory Buffer address.

 

Width: The width of data to be transferred from source to

 

DOCID025834 Rev 2

253/900

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]