STM32F439xx HAL User Manual
Defines | Functions
stm32f4xx_hal_dma2d.c File Reference

DMA2D HAL module driver. This file provides firmware functions to manage the following functionalities of the DMA2D peripheral: + Initialization and de-initialization functions + IO operation functions + Peripheral Control functions + Peripheral State and Errors functions. More...

#include "stm32f4xx_hal.h"

Go to the source code of this file.

Defines

#define DMA2D_TIMEOUT_ABORT   1000U
#define DMA2D_TIMEOUT_SUSPEND   1000U
#define DMA2D_POSITION_FGPFCCR_CS   (uint32_t)DMA2D_FGPFCCR_CS_Pos
#define DMA2D_POSITION_BGPFCCR_CS   (uint32_t)DMA2D_BGPFCCR_CS_Pos
#define DMA2D_POSITION_FGPFCCR_CCM   (uint32_t)DMA2D_FGPFCCR_CCM_Pos
#define DMA2D_POSITION_BGPFCCR_CCM   (uint32_t)DMA2D_BGPFCCR_CCM_Pos
#define DMA2D_POSITION_AMTCR_DT   (uint32_t)DMA2D_AMTCR_DT_Pos
#define DMA2D_POSITION_FGPFCCR_AM   (uint32_t)DMA2D_FGPFCCR_AM_Pos
#define DMA2D_POSITION_BGPFCCR_AM   (uint32_t)DMA2D_BGPFCCR_AM_Pos
#define DMA2D_POSITION_FGPFCCR_ALPHA   (uint32_t)DMA2D_FGPFCCR_ALPHA_Pos
#define DMA2D_POSITION_BGPFCCR_ALPHA   (uint32_t)DMA2D_BGPFCCR_ALPHA_Pos
#define DMA2D_POSITION_NLR_PL   (uint32_t)DMA2D_NLR_PL_Pos

Functions

static void DMA2D_SetConfig (DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
 Set the DMA2D transfer parameters.
HAL_StatusTypeDef HAL_DMA2D_Init (DMA2D_HandleTypeDef *hdma2d)
 Initialize the DMA2D according to the specified parameters in the DMA2D_InitTypeDef and create the associated handle.
HAL_StatusTypeDef HAL_DMA2D_DeInit (DMA2D_HandleTypeDef *hdma2d)
 Deinitializes the DMA2D peripheral registers to their default reset values.
__weak void HAL_DMA2D_MspInit (DMA2D_HandleTypeDef *hdma2d)
 Initializes the DMA2D MSP.
__weak void HAL_DMA2D_MspDeInit (DMA2D_HandleTypeDef *hdma2d)
 DeInitializes the DMA2D MSP.
HAL_StatusTypeDef HAL_DMA2D_Start (DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
 Start the DMA2D Transfer.
HAL_StatusTypeDef HAL_DMA2D_Start_IT (DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
 Start the DMA2D Transfer with interrupt enabled.
HAL_StatusTypeDef HAL_DMA2D_BlendingStart (DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height)
 Start the multi-source DMA2D Transfer.
HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT (DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height)
 Start the multi-source DMA2D Transfer with interrupt enabled.
HAL_StatusTypeDef HAL_DMA2D_Abort (DMA2D_HandleTypeDef *hdma2d)
 Abort the DMA2D Transfer.
HAL_StatusTypeDef HAL_DMA2D_Suspend (DMA2D_HandleTypeDef *hdma2d)
 Suspend the DMA2D Transfer.
HAL_StatusTypeDef HAL_DMA2D_Resume (DMA2D_HandleTypeDef *hdma2d)
 Resume the DMA2D Transfer.
HAL_StatusTypeDef HAL_DMA2D_EnableCLUT (DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
 Enable the DMA2D CLUT Transfer.
HAL_StatusTypeDef HAL_DMA2D_CLUTLoad (DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx)
 Start DMA2D CLUT Loading.
HAL_StatusTypeDef HAL_DMA2D_CLUTLoad_IT (DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx)
 Start DMA2D CLUT Loading with interrupt enabled.
HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Abort (DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
 Abort the DMA2D CLUT loading.
HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Suspend (DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
 Suspend the DMA2D CLUT loading.
HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Resume (DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
 Resume the DMA2D CLUT loading.
HAL_StatusTypeDef HAL_DMA2D_PollForTransfer (DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout)
 Polling for transfer complete or CLUT loading.
void HAL_DMA2D_IRQHandler (DMA2D_HandleTypeDef *hdma2d)
 Handle DMA2D interrupt request.
__weak void HAL_DMA2D_LineEventCallback (DMA2D_HandleTypeDef *hdma2d)
 Transfer watermark callback.
__weak void HAL_DMA2D_CLUTLoadingCpltCallback (DMA2D_HandleTypeDef *hdma2d)
 CLUT Transfer Complete callback.
HAL_StatusTypeDef HAL_DMA2D_ConfigLayer (DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
 Configure the DMA2D Layer according to the specified parameters in the DMA2D_InitTypeDef and create the associated handle.
HAL_StatusTypeDef HAL_DMA2D_ConfigCLUT (DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx)
 Configure the DMA2D CLUT Transfer.
HAL_StatusTypeDef HAL_DMA2D_ProgramLineEvent (DMA2D_HandleTypeDef *hdma2d, uint32_t Line)
 Configure the line watermark.
HAL_StatusTypeDef HAL_DMA2D_EnableDeadTime (DMA2D_HandleTypeDef *hdma2d)
 Enable DMA2D dead time feature.
HAL_StatusTypeDef HAL_DMA2D_DisableDeadTime (DMA2D_HandleTypeDef *hdma2d)
 Disable DMA2D dead time feature.
HAL_StatusTypeDef HAL_DMA2D_ConfigDeadTime (DMA2D_HandleTypeDef *hdma2d, uint8_t DeadTime)
 Configure dead time.
HAL_DMA2D_StateTypeDef HAL_DMA2D_GetState (DMA2D_HandleTypeDef *hdma2d)
 Return the DMA2D state.
uint32_t HAL_DMA2D_GetError (DMA2D_HandleTypeDef *hdma2d)
 Return the DMA2D error code.

Detailed Description

DMA2D HAL module driver. This file provides firmware functions to manage the following functionalities of the DMA2D peripheral: + Initialization and de-initialization functions + IO operation functions + Peripheral Control functions + Peripheral State and Errors functions.

Author:
MCD Application Team
  ==============================================================================
                        ##### How to use this driver #####
  ==============================================================================
    [..]
      (#) Program the required configuration through the following parameters:
          the transfer mode, the output color mode and the output offset using
          HAL_DMA2D_Init() function.

      (#) Program the required configuration through the following parameters:
          the input color mode, the input color, the input alpha value, the alpha mode,
          and the input offset using HAL_DMA2D_ConfigLayer() function for foreground 
          or/and background layer.
          
     *** Polling mode IO operation ***
     =================================
    [..]
       (#) Configure pdata parameter (explained hereafter), 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 ***
     ===================================
     [..]
       (#) Configure pdata parameter, destination and data length and enable 
           the transfer using HAL_DMA2D_Start_IT().
       (#) Use HAL_DMA2D_IRQHandler() called under DMA2D_IRQHandler() interrupt subroutine
       (#) 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 (member
           of DMA2D handle structure).
       (#) In case of error, the HAL_DMA2D_IRQHandler() function will call the callback
           XferErrorCallback.

         -@-   In Register-to-Memory transfer mode, pdata parameter is the register
               color, in Memory-to-memory or Memory-to-Memory with pixel format
               conversion pdata is the source address.

         -@-   Configure the foreground source address, the background source address,
               the destination and data length then 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.

      (#) Optionally, configure and enable the CLUT using HAL_DMA2D_CLUTLoad() in polling
          mode or HAL_DMA2D_CLUTLoad_IT() in interrupt mode.

      (#) Optionally, configure the line watermark in using the API HAL_DMA2D_ProgramLineEvent()

      (#) Optionally, configure the dead time value in the AHB clock cycle inserted between two 
          consecutive accesses on the AHB master port in using the API HAL_DMA2D_ConfigDeadTime()
          and enable/disable the functionality  with the APIs HAL_DMA2D_EnableDeadTime() or
          HAL_DMA2D_DisableDeadTime().

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

      (#) The CLUT loading can be suspended, resumed and aborted using the following
          functions: HAL_DMA2D_CLUTLoading_Suspend(), HAL_DMA2D_CLUTLoading_Resume(),
          HAL_DMA2D_CLUTLoading_Abort().

      (#) To control the DMA2D state, use the following function: HAL_DMA2D_GetState().
      
      (#) To read the DMA2D error code, use the following function: HAL_DMA2D_GetError().

     *** 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_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 is enabled or not

     [..]
      (@) You can refer to the DMA2D HAL driver header file for more useful macros

  
Attention:

© COPYRIGHT(c) 2017 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file stm32f4xx_hal_dma2d.c.