mbed library sources

Fork of mbed-src by mbed official

Revision:
532:fe11edbda85c
Parent:
384:ef87175507f1
Child:
613:bc40b8d2aec4
--- a/targets/cmsis/TARGET_STM/TARGET_STM32F4/stm32f4xx_hal_dma2d.c	Thu Apr 30 13:00:08 2015 +0100
+++ b/targets/cmsis/TARGET_STM/TARGET_STM32F4/stm32f4xx_hal_dma2d.c	Thu Apr 30 13:45:11 2015 +0100
@@ -2,8 +2,8 @@
   ******************************************************************************
   * @file    stm32f4xx_hal_dma2d.c
   * @author  MCD Application Team
-  * @version V1.1.0
-  * @date    19-June-2014
+  * @version V1.3.0
+  * @date    09-March-2015
   * @brief   DMA2D HAL module driver.
   *          This file provides firmware functions to manage the following 
   *          functionalities of the DMA2D peripheral:
@@ -11,11 +11,11 @@
   *           + IO operation functions
   *           + Peripheral Control functions 
   *           + Peripheral State and Errors functions
-  *           
-  @verbatim                 
-  ============================================================================== 
+  *
+  @verbatim 
+  ==============================================================================
                         ##### How to use this driver #####
-  ============================================================================== 
+  ==============================================================================
     [..]
       (#) Program the required configuration through following parameters:   
           the Transfer Mode, the output color mode and the output offset using 
@@ -87,7 +87,7 @@
   ******************************************************************************
   * @attention
   *
-  * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
+  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
   *
   * Redistribution and use in source and binary forms, with or without modification,
   * are permitted provided that the following conditions are met:
@@ -120,7 +120,7 @@
 /** @addtogroup STM32F4xx_HAL_Driver
   * @{
   */
-/** @defgroup DMA2D 
+/** @addtogroup DMA2D
   * @brief DMA2D HAL module driver
   * @{
   */
@@ -129,18 +129,32 @@
 
 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
 
-/* Private typedef -----------------------------------------------------------*/
+/* Private types -------------------------------------------------------------*/
 /* Private define ------------------------------------------------------------*/
+/** @addtogroup DMA2D_Private_Defines
+  * @{
+  */
 #define HAL_TIMEOUT_DMA2D_ABORT      ((uint32_t)1000)  /* 1s  */
 #define HAL_TIMEOUT_DMA2D_SUSPEND    ((uint32_t)1000)  /* 1s  */
-/* Private macro -------------------------------------------------------------*/
+/**
+  * @}
+  */
+
 /* Private variables ---------------------------------------------------------*/
+/* Private constants ---------------------------------------------------------*/
+/* Private macro -------------------------------------------------------------*/
 /* Private function prototypes -----------------------------------------------*/
-static void DMA2D_SetConfig(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Heigh);
+/** @addtogroup DMA2D_Private_Functions_Prototypes
+  * @{
+  */
+static void DMA2D_SetConfig(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height);
+/**
+  * @}
+  */
 
 /* Private functions ---------------------------------------------------------*/
-
-/** @defgroup DMA2D_Private_Functions
+/* Exported functions --------------------------------------------------------*/
+/** @addtogroup DMA2D_Exported_Functions
   * @{
   */
 
@@ -184,6 +198,8 @@
 
   if(hdma2d->State == HAL_DMA2D_STATE_RESET)
   {
+    /* Allocate lock resource and initialize it */
+    hdma2d->Lock = HAL_UNLOCKED;
     /* Init the low level hardware */
     HAL_DMA2D_MspInit(hdma2d);
   }
@@ -336,10 +352,10 @@
   *                     the color value if register to memory DMA2D mode is selected.
   * @param  DstAddress: The destination memory Buffer address.
   * @param  Width:      The width of data to be transferred from source to destination.
-  * @param  Heigh:      The heigh of data to be transferred from source to destination.
+  * @param  Height:      The height of data to be transferred from source to destination.
   * @retval HAL status
   */
-HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width,  uint32_t Heigh)
+HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width,  uint32_t Height)
 {
   /* Process locked */
   __HAL_LOCK(hdma2d);
@@ -348,14 +364,14 @@
   hdma2d->State = HAL_DMA2D_STATE_BUSY;
 
   /* Check the parameters */
-  assert_param(IS_DMA2D_LINE(Heigh));
+  assert_param(IS_DMA2D_LINE(Height));
   assert_param(IS_DMA2D_PIXEL(Width));
 
   /* Disable the Peripheral */
   __HAL_DMA2D_DISABLE(hdma2d);
 
   /* Configure the source, destination address and the data size */
-  DMA2D_SetConfig(hdma2d, pdata, DstAddress, Width, Heigh);
+  DMA2D_SetConfig(hdma2d, pdata, DstAddress, Width, Height);
 
   /* Enable the Peripheral */
   __HAL_DMA2D_ENABLE(hdma2d);
@@ -373,10 +389,10 @@
   *                     the color value if register to memory DMA2D mode is selected.
   * @param  DstAddress: The destination memory Buffer address.
   * @param  Width:      The width of data to be transferred from source to destination.
-  * @param  Heigh:      The heigh of data to be transferred from source to destination.
+  * @param  Height:     The height of data to be transferred from source to destination.
   * @retval HAL status
   */
-HAL_StatusTypeDef HAL_DMA2D_Start_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width,  uint32_t Heigh)
+HAL_StatusTypeDef HAL_DMA2D_Start_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width,  uint32_t Height)
 {
   /* Process locked */
   __HAL_LOCK(hdma2d);
@@ -385,14 +401,14 @@
   hdma2d->State = HAL_DMA2D_STATE_BUSY;
 
   /* Check the parameters */
-  assert_param(IS_DMA2D_LINE(Heigh));
+  assert_param(IS_DMA2D_LINE(Height));
   assert_param(IS_DMA2D_PIXEL(Width));
 
   /* Disable the Peripheral */
   __HAL_DMA2D_DISABLE(hdma2d);
 
   /* Configure the source, destination address and the data size */
-  DMA2D_SetConfig(hdma2d, pdata, DstAddress, Width, Heigh);
+  DMA2D_SetConfig(hdma2d, pdata, DstAddress, Width, Height);
 
   /* Enable the transfer complete interrupt */
   __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_TC);
@@ -417,10 +433,10 @@
   * @param  SrcAddress2: The source memory Buffer address of the background layer.
   * @param  DstAddress:  The destination memory Buffer address
   * @param  Width:       The width of data to be transferred from source to destination.
-  * @param  Heigh:       The heigh of data to be transferred from source to destination.
+  * @param  Height:      The height of data to be transferred from source to destination.
   * @retval HAL status
   */
-HAL_StatusTypeDef HAL_DMA2D_BlendingStart(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t  SrcAddress2, uint32_t DstAddress, uint32_t Width,  uint32_t Heigh)
+HAL_StatusTypeDef HAL_DMA2D_BlendingStart(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t  SrcAddress2, uint32_t DstAddress, uint32_t Width,  uint32_t Height)
 {
   /* Process locked */
   __HAL_LOCK(hdma2d);
@@ -429,7 +445,7 @@
   hdma2d->State = HAL_DMA2D_STATE_BUSY; 
 
   /* Check the parameters */
-  assert_param(IS_DMA2D_LINE(Heigh));
+  assert_param(IS_DMA2D_LINE(Height));
   assert_param(IS_DMA2D_PIXEL(Width));
 
   /* Disable the Peripheral */
@@ -439,7 +455,7 @@
   hdma2d->Instance->BGMAR = SrcAddress2;
 
   /* Configure the source, destination address and the data size */
-  DMA2D_SetConfig(hdma2d, SrcAddress1, DstAddress, Width, Heigh);
+  DMA2D_SetConfig(hdma2d, SrcAddress1, DstAddress, Width, Height);
 
   /* Enable the Peripheral */
   __HAL_DMA2D_ENABLE(hdma2d);
@@ -455,10 +471,10 @@
   * @param  SrcAddress2: The source memory Buffer address of the background layer.
   * @param  DstAddress:  The destination memory Buffer address.
   * @param  Width:       The width of data to be transferred from source to destination.
-  * @param  Heigh:       The heigh of data to be transferred from source to destination.
+  * @param  Height:      The height of data to be transferred from source to destination.
   * @retval HAL status
   */
-HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t  SrcAddress2, uint32_t DstAddress, uint32_t Width,  uint32_t Heigh)
+HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t  SrcAddress2, uint32_t DstAddress, uint32_t Width,  uint32_t Height)
 {
   /* Process locked */
   __HAL_LOCK(hdma2d);
@@ -467,7 +483,7 @@
   hdma2d->State = HAL_DMA2D_STATE_BUSY;
 
   /* Check the parameters */
-  assert_param(IS_DMA2D_LINE(Heigh));
+  assert_param(IS_DMA2D_LINE(Height));
   assert_param(IS_DMA2D_PIXEL(Width));
 
   /* Disable the Peripheral */
@@ -477,7 +493,7 @@
   hdma2d->Instance->BGMAR = SrcAddress2;
 
   /* Configure the source, destination address and the data size */
-  DMA2D_SetConfig(hdma2d, SrcAddress1, DstAddress, Width, Heigh);
+  DMA2D_SetConfig(hdma2d, SrcAddress1, DstAddress, Width, Height);
 
   /* Enable the configuration error interrupt */
   __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_CE);
@@ -1165,10 +1181,10 @@
   * @param  pdata:      The source memory Buffer address
   * @param  DstAddress: The destination memory Buffer address
   * @param  Width:      The width of data to be transferred from source to destination.
-  * @param  Heigh:      The heigh of data to be transferred from source to destination.
+  * @param  Height:     The height of data to be transferred from source to destination.
   * @retval HAL status
   */
-static void DMA2D_SetConfig(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Heigh)
+static void DMA2D_SetConfig(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
 {  
   uint32_t tmp = 0;
   uint32_t tmp1 = 0;
@@ -1179,7 +1195,7 @@
   tmp = Width << 16;
   
   /* Configure DMA2D data size */
-  hdma2d->Instance->NLR = (Heigh | tmp);
+  hdma2d->Instance->NLR = (Height | tmp);
   
   /* Configure DMA2D destination address */
   hdma2d->Instance->OMAR = DstAddress;