mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
93:e188a91d3eaa
remove SerialHalfDuplex.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 93:e188a91d3eaa 1 /**
Kojto 93:e188a91d3eaa 2 ******************************************************************************
Kojto 93:e188a91d3eaa 3 * @file stm32f4xx_hal_dma2d.h
Kojto 93:e188a91d3eaa 4 * @author MCD Application Team
Kojto 93:e188a91d3eaa 5 * @version V1.1.0
Kojto 93:e188a91d3eaa 6 * @date 19-June-2014
Kojto 93:e188a91d3eaa 7 * @brief Header file of DMA2D HAL module.
Kojto 93:e188a91d3eaa 8 ******************************************************************************
Kojto 93:e188a91d3eaa 9 * @attention
Kojto 93:e188a91d3eaa 10 *
Kojto 93:e188a91d3eaa 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 93:e188a91d3eaa 12 *
Kojto 93:e188a91d3eaa 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 93:e188a91d3eaa 14 * are permitted provided that the following conditions are met:
Kojto 93:e188a91d3eaa 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 93:e188a91d3eaa 16 * this list of conditions and the following disclaimer.
Kojto 93:e188a91d3eaa 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 93:e188a91d3eaa 18 * this list of conditions and the following disclaimer in the documentation
Kojto 93:e188a91d3eaa 19 * and/or other materials provided with the distribution.
Kojto 93:e188a91d3eaa 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 93:e188a91d3eaa 21 * may be used to endorse or promote products derived from this software
Kojto 93:e188a91d3eaa 22 * without specific prior written permission.
Kojto 93:e188a91d3eaa 23 *
Kojto 93:e188a91d3eaa 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 93:e188a91d3eaa 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 93:e188a91d3eaa 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 93:e188a91d3eaa 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 93:e188a91d3eaa 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 93:e188a91d3eaa 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 93:e188a91d3eaa 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 93:e188a91d3eaa 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 93:e188a91d3eaa 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 93:e188a91d3eaa 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 93:e188a91d3eaa 34 *
Kojto 93:e188a91d3eaa 35 ******************************************************************************
Kojto 93:e188a91d3eaa 36 */
Kojto 93:e188a91d3eaa 37
Kojto 93:e188a91d3eaa 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 93:e188a91d3eaa 39 #ifndef __STM32F4xx_HAL_DMA2D_H
Kojto 93:e188a91d3eaa 40 #define __STM32F4xx_HAL_DMA2D_H
Kojto 93:e188a91d3eaa 41
Kojto 93:e188a91d3eaa 42 #ifdef __cplusplus
Kojto 93:e188a91d3eaa 43 extern "C" {
Kojto 93:e188a91d3eaa 44 #endif
Kojto 93:e188a91d3eaa 45
Kojto 93:e188a91d3eaa 46 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
Kojto 93:e188a91d3eaa 47 /* Includes ------------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 48 #include "stm32f4xx_hal_def.h"
Kojto 93:e188a91d3eaa 49
Kojto 93:e188a91d3eaa 50 /** @addtogroup STM32F4xx_HAL_Driver
Kojto 93:e188a91d3eaa 51 * @{
Kojto 93:e188a91d3eaa 52 */
Kojto 93:e188a91d3eaa 53
Kojto 93:e188a91d3eaa 54 /** @addtogroup DMA2D
Kojto 93:e188a91d3eaa 55 * @{
Kojto 93:e188a91d3eaa 56 */
Kojto 93:e188a91d3eaa 57
Kojto 93:e188a91d3eaa 58 /* Exported types ------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 59
Kojto 93:e188a91d3eaa 60 #define MAX_DMA2D_LAYER 2
Kojto 93:e188a91d3eaa 61
Kojto 93:e188a91d3eaa 62 /**
Kojto 93:e188a91d3eaa 63 * @brief DMA2D color Structure definition
Kojto 93:e188a91d3eaa 64 */
Kojto 93:e188a91d3eaa 65 typedef struct
Kojto 93:e188a91d3eaa 66 {
Kojto 93:e188a91d3eaa 67 uint32_t Blue; /*!< Configures the blue value.
Kojto 93:e188a91d3eaa 68 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
Kojto 93:e188a91d3eaa 69
Kojto 93:e188a91d3eaa 70 uint32_t Green; /*!< Configures the green value.
Kojto 93:e188a91d3eaa 71 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
Kojto 93:e188a91d3eaa 72
Kojto 93:e188a91d3eaa 73 uint32_t Red; /*!< Configures the red value.
Kojto 93:e188a91d3eaa 74 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF. */
Kojto 93:e188a91d3eaa 75 } DMA2D_ColorTypeDef;
Kojto 93:e188a91d3eaa 76
Kojto 93:e188a91d3eaa 77 /**
Kojto 93:e188a91d3eaa 78 * @brief DMA2D CLUT Structure definition
Kojto 93:e188a91d3eaa 79 */
Kojto 93:e188a91d3eaa 80 typedef struct
Kojto 93:e188a91d3eaa 81 {
Kojto 93:e188a91d3eaa 82 uint32_t *pCLUT; /*!< Configures the DMA2D CLUT memory address.*/
Kojto 93:e188a91d3eaa 83
Kojto 93:e188a91d3eaa 84 uint32_t CLUTColorMode; /*!< configures the DMA2D CLUT color mode.
Kojto 93:e188a91d3eaa 85 This parameter can be one value of @ref DMA2D_CLUT_CM */
Kojto 93:e188a91d3eaa 86
Kojto 93:e188a91d3eaa 87 uint32_t Size; /*!< configures the DMA2D CLUT size.
Kojto 93:e188a91d3eaa 88 This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF.*/
Kojto 93:e188a91d3eaa 89 } DMA2D_CLUTCfgTypeDef;
Kojto 93:e188a91d3eaa 90
Kojto 93:e188a91d3eaa 91 /**
Kojto 93:e188a91d3eaa 92 * @brief DMA2D Init structure definition
Kojto 93:e188a91d3eaa 93 */
Kojto 93:e188a91d3eaa 94 typedef struct
Kojto 93:e188a91d3eaa 95 {
Kojto 93:e188a91d3eaa 96 uint32_t Mode; /*!< configures the DMA2D transfer mode.
Kojto 93:e188a91d3eaa 97 This parameter can be one value of @ref DMA2D_Mode */
Kojto 93:e188a91d3eaa 98
Kojto 93:e188a91d3eaa 99 uint32_t ColorMode; /*!< configures the color format of the output image.
Kojto 93:e188a91d3eaa 100 This parameter can be one value of @ref DMA2D_Color_Mode */
Kojto 93:e188a91d3eaa 101
Kojto 93:e188a91d3eaa 102 uint32_t OutputOffset; /*!< Specifies the Offset value.
Kojto 93:e188a91d3eaa 103 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */
Kojto 93:e188a91d3eaa 104 } DMA2D_InitTypeDef;
Kojto 93:e188a91d3eaa 105
Kojto 93:e188a91d3eaa 106 /**
Kojto 93:e188a91d3eaa 107 * @brief DMA2D Layer structure definition
Kojto 93:e188a91d3eaa 108 */
Kojto 93:e188a91d3eaa 109 typedef struct
Kojto 93:e188a91d3eaa 110 {
Kojto 93:e188a91d3eaa 111 uint32_t InputOffset; /*!< configures the DMA2D foreground offset.
Kojto 93:e188a91d3eaa 112 This parameter must be a number between Min_Data = 0x0000 and Max_Data = 0x3FFF. */
Kojto 93:e188a91d3eaa 113
Kojto 93:e188a91d3eaa 114 uint32_t InputColorMode; /*!< configures the DMA2D foreground color mode .
Kojto 93:e188a91d3eaa 115 This parameter can be one value of @ref DMA2D_Input_Color_Mode */
Kojto 93:e188a91d3eaa 116
Kojto 93:e188a91d3eaa 117 uint32_t AlphaMode; /*!< configures the DMA2D foreground alpha mode.
Kojto 93:e188a91d3eaa 118 This parameter can be one value of @ref DMA2D_ALPHA_MODE */
Kojto 93:e188a91d3eaa 119
Kojto 93:e188a91d3eaa 120 uint32_t InputAlpha; /*!< Specifies the DMA2D foreground alpha value and color value in case of A8 or A4 color mode.
Kojto 93:e188a91d3eaa 121 This parameter must be a number between Min_Data = 0x00000000 and Max_Data = 0xFFFFFFFF
Kojto 93:e188a91d3eaa 122 in case of A8 or A4 color mode (ARGB).
Kojto 93:e188a91d3eaa 123 Otherwise, This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF.*/
Kojto 93:e188a91d3eaa 124
Kojto 93:e188a91d3eaa 125 } DMA2D_LayerCfgTypeDef;
Kojto 93:e188a91d3eaa 126
Kojto 93:e188a91d3eaa 127 /**
Kojto 93:e188a91d3eaa 128 * @brief HAL DMA2D State structures definition
Kojto 93:e188a91d3eaa 129 */
Kojto 93:e188a91d3eaa 130 typedef enum
Kojto 93:e188a91d3eaa 131 {
Kojto 93:e188a91d3eaa 132 HAL_DMA2D_STATE_RESET = 0x00, /*!< DMA2D not yet initialized or disabled */
Kojto 93:e188a91d3eaa 133 HAL_DMA2D_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */
Kojto 93:e188a91d3eaa 134 HAL_DMA2D_STATE_BUSY = 0x02, /*!< an internal process is ongoing */
Kojto 93:e188a91d3eaa 135 HAL_DMA2D_STATE_TIMEOUT = 0x03, /*!< Timeout state */
Kojto 93:e188a91d3eaa 136 HAL_DMA2D_STATE_ERROR = 0x04, /*!< DMA2D state error */
Kojto 93:e188a91d3eaa 137 HAL_DMA2D_STATE_SUSPEND = 0x05 /*!< DMA2D process is suspended */
Kojto 93:e188a91d3eaa 138 }HAL_DMA2D_StateTypeDef;
Kojto 93:e188a91d3eaa 139
Kojto 93:e188a91d3eaa 140 /**
Kojto 93:e188a91d3eaa 141 * @brief DMA2D handle Structure definition
Kojto 93:e188a91d3eaa 142 */
Kojto 93:e188a91d3eaa 143 typedef struct __DMA2D_HandleTypeDef
Kojto 93:e188a91d3eaa 144 {
Kojto 93:e188a91d3eaa 145 DMA2D_TypeDef *Instance; /*!< DMA2D Register base address */
Kojto 93:e188a91d3eaa 146
Kojto 93:e188a91d3eaa 147 DMA2D_InitTypeDef Init; /*!< DMA2D communication parameters */
Kojto 93:e188a91d3eaa 148
Kojto 93:e188a91d3eaa 149 void (* XferCpltCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer complete callback */
Kojto 93:e188a91d3eaa 150
Kojto 93:e188a91d3eaa 151 void (* XferErrorCallback)(struct __DMA2D_HandleTypeDef * hdma2d); /*!< DMA2D transfer error callback */
Kojto 93:e188a91d3eaa 152
Kojto 93:e188a91d3eaa 153 DMA2D_LayerCfgTypeDef LayerCfg[MAX_DMA2D_LAYER]; /*!< DMA2D Layers parameters */
Kojto 93:e188a91d3eaa 154
Kojto 93:e188a91d3eaa 155 HAL_LockTypeDef Lock; /*!< DMA2D Lock */
Kojto 93:e188a91d3eaa 156
Kojto 93:e188a91d3eaa 157 __IO HAL_DMA2D_StateTypeDef State; /*!< DMA2D transfer state */
Kojto 93:e188a91d3eaa 158
Kojto 93:e188a91d3eaa 159 __IO uint32_t ErrorCode; /*!< DMA2D Error code */
Kojto 93:e188a91d3eaa 160 } DMA2D_HandleTypeDef;
Kojto 93:e188a91d3eaa 161
Kojto 93:e188a91d3eaa 162
Kojto 93:e188a91d3eaa 163 /* Exported constants --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 164
Kojto 93:e188a91d3eaa 165 /** @defgroup DMA2D_Exported_Constants
Kojto 93:e188a91d3eaa 166 * @{
Kojto 93:e188a91d3eaa 167 */
Kojto 93:e188a91d3eaa 168
Kojto 93:e188a91d3eaa 169 /** @defgroup DMA2D_Layer
Kojto 93:e188a91d3eaa 170 * @{
Kojto 93:e188a91d3eaa 171 */
Kojto 93:e188a91d3eaa 172 #define IS_DMA2D_LAYER(LAYER) ((LAYER) <= MAX_DMA2D_LAYER)
Kojto 93:e188a91d3eaa 173 /**
Kojto 93:e188a91d3eaa 174 * @}
Kojto 93:e188a91d3eaa 175 */
Kojto 93:e188a91d3eaa 176
Kojto 93:e188a91d3eaa 177 /** @defgroup DMA2D_Error_Code
Kojto 93:e188a91d3eaa 178 * @{
Kojto 93:e188a91d3eaa 179 */
Kojto 93:e188a91d3eaa 180 #define HAL_DMA2D_ERROR_NONE ((uint32_t)0x00000000) /*!< No error */
Kojto 93:e188a91d3eaa 181 #define HAL_DMA2D_ERROR_TE ((uint32_t)0x00000001) /*!< Transfer error */
Kojto 93:e188a91d3eaa 182 #define HAL_DMA2D_ERROR_CE ((uint32_t)0x00000002) /*!< Configuration error */
Kojto 93:e188a91d3eaa 183 #define HAL_DMA2D_ERROR_TIMEOUT ((uint32_t)0x00000020) /*!< Timeout error */
Kojto 93:e188a91d3eaa 184 /**
Kojto 93:e188a91d3eaa 185 * @}
Kojto 93:e188a91d3eaa 186 */
Kojto 93:e188a91d3eaa 187
Kojto 93:e188a91d3eaa 188 /** @defgroup DMA2D_Mode
Kojto 93:e188a91d3eaa 189 * @{
Kojto 93:e188a91d3eaa 190 */
Kojto 93:e188a91d3eaa 191 #define DMA2D_M2M ((uint32_t)0x00000000) /*!< DMA2D memory to memory transfer mode */
Kojto 93:e188a91d3eaa 192 #define DMA2D_M2M_PFC ((uint32_t)0x00010000) /*!< DMA2D memory to memory with pixel format conversion transfer mode */
Kojto 93:e188a91d3eaa 193 #define DMA2D_M2M_BLEND ((uint32_t)0x00020000) /*!< DMA2D memory to memory with blending transfer mode */
Kojto 93:e188a91d3eaa 194 #define DMA2D_R2M ((uint32_t)0x00030000) /*!< DMA2D register to memory transfer mode */
Kojto 93:e188a91d3eaa 195
Kojto 93:e188a91d3eaa 196 #define IS_DMA2D_MODE(MODE) (((MODE) == DMA2D_M2M) || ((MODE) == DMA2D_M2M_PFC) || \
Kojto 93:e188a91d3eaa 197 ((MODE) == DMA2D_M2M_BLEND) || ((MODE) == DMA2D_R2M))
Kojto 93:e188a91d3eaa 198 /**
Kojto 93:e188a91d3eaa 199 * @}
Kojto 93:e188a91d3eaa 200 */
Kojto 93:e188a91d3eaa 201
Kojto 93:e188a91d3eaa 202 /** @defgroup DMA2D_Color_Mode
Kojto 93:e188a91d3eaa 203 * @{
Kojto 93:e188a91d3eaa 204 */
Kojto 93:e188a91d3eaa 205 #define DMA2D_ARGB8888 ((uint32_t)0x00000000) /*!< ARGB8888 DMA2D color mode */
Kojto 93:e188a91d3eaa 206 #define DMA2D_RGB888 ((uint32_t)0x00000001) /*!< RGB888 DMA2D color mode */
Kojto 93:e188a91d3eaa 207 #define DMA2D_RGB565 ((uint32_t)0x00000002) /*!< RGB565 DMA2D color mode */
Kojto 93:e188a91d3eaa 208 #define DMA2D_ARGB1555 ((uint32_t)0x00000003) /*!< ARGB1555 DMA2D color mode */
Kojto 93:e188a91d3eaa 209 #define DMA2D_ARGB4444 ((uint32_t)0x00000004) /*!< ARGB4444 DMA2D color mode */
Kojto 93:e188a91d3eaa 210
Kojto 93:e188a91d3eaa 211 #define IS_DMA2D_CMODE(MODE_ARGB) (((MODE_ARGB) == DMA2D_ARGB8888) || ((MODE_ARGB) == DMA2D_RGB888) || \
Kojto 93:e188a91d3eaa 212 ((MODE_ARGB) == DMA2D_RGB565) || ((MODE_ARGB) == DMA2D_ARGB1555) || \
Kojto 93:e188a91d3eaa 213 ((MODE_ARGB) == DMA2D_ARGB4444))
Kojto 93:e188a91d3eaa 214 /**
Kojto 93:e188a91d3eaa 215 * @}
Kojto 93:e188a91d3eaa 216 */
Kojto 93:e188a91d3eaa 217
Kojto 93:e188a91d3eaa 218 /** @defgroup DMA2D_COLOR_VALUE
Kojto 93:e188a91d3eaa 219 * @{
Kojto 93:e188a91d3eaa 220 */
Kojto 93:e188a91d3eaa 221
Kojto 93:e188a91d3eaa 222 #define COLOR_VALUE ((uint32_t)0x000000FF) /*!< color value mask */
Kojto 93:e188a91d3eaa 223
Kojto 93:e188a91d3eaa 224 #define IS_DMA2D_COLOR(COLOR) ((COLOR) <= COLOR_VALUE)
Kojto 93:e188a91d3eaa 225 /**
Kojto 93:e188a91d3eaa 226 * @}
Kojto 93:e188a91d3eaa 227 */
Kojto 93:e188a91d3eaa 228
Kojto 93:e188a91d3eaa 229 /** @defgroup DMA2D_SIZE
Kojto 93:e188a91d3eaa 230 * @{
Kojto 93:e188a91d3eaa 231 */
Kojto 93:e188a91d3eaa 232 #define DMA2D_PIXEL (DMA2D_NLR_PL >> 16) /*!< DMA2D pixel per line */
Kojto 93:e188a91d3eaa 233 #define DMA2D_LINE DMA2D_NLR_NL /*!< DMA2D number of line */
Kojto 93:e188a91d3eaa 234
Kojto 93:e188a91d3eaa 235 #define IS_DMA2D_LINE(LINE) ((LINE) <= DMA2D_LINE)
Kojto 93:e188a91d3eaa 236 #define IS_DMA2D_PIXEL(PIXEL) ((PIXEL) <= DMA2D_PIXEL)
Kojto 93:e188a91d3eaa 237 /**
Kojto 93:e188a91d3eaa 238 * @}
Kojto 93:e188a91d3eaa 239 */
Kojto 93:e188a91d3eaa 240
Kojto 93:e188a91d3eaa 241 /** @defgroup DMA2D_Offset
Kojto 93:e188a91d3eaa 242 * @{
Kojto 93:e188a91d3eaa 243 */
Kojto 93:e188a91d3eaa 244 #define DMA2D_OFFSET DMA2D_FGOR_LO /*!< Line Offset */
Kojto 93:e188a91d3eaa 245
Kojto 93:e188a91d3eaa 246 #define IS_DMA2D_OFFSET(OOFFSET) ((OOFFSET) <= DMA2D_OFFSET)
Kojto 93:e188a91d3eaa 247 /**
Kojto 93:e188a91d3eaa 248 * @}
Kojto 93:e188a91d3eaa 249 */
Kojto 93:e188a91d3eaa 250
Kojto 93:e188a91d3eaa 251 /** @defgroup DMA2D_Input_Color_Mode
Kojto 93:e188a91d3eaa 252 * @{
Kojto 93:e188a91d3eaa 253 */
Kojto 93:e188a91d3eaa 254 #define CM_ARGB8888 ((uint32_t)0x00000000) /*!< ARGB8888 color mode */
Kojto 93:e188a91d3eaa 255 #define CM_RGB888 ((uint32_t)0x00000001) /*!< RGB888 color mode */
Kojto 93:e188a91d3eaa 256 #define CM_RGB565 ((uint32_t)0x00000002) /*!< RGB565 color mode */
Kojto 93:e188a91d3eaa 257 #define CM_ARGB1555 ((uint32_t)0x00000003) /*!< ARGB1555 color mode */
Kojto 93:e188a91d3eaa 258 #define CM_ARGB4444 ((uint32_t)0x00000004) /*!< ARGB4444 color mode */
Kojto 93:e188a91d3eaa 259 #define CM_L8 ((uint32_t)0x00000005) /*!< L8 color mode */
Kojto 93:e188a91d3eaa 260 #define CM_AL44 ((uint32_t)0x00000006) /*!< AL44 color mode */
Kojto 93:e188a91d3eaa 261 #define CM_AL88 ((uint32_t)0x00000007) /*!< AL88 color mode */
Kojto 93:e188a91d3eaa 262 #define CM_L4 ((uint32_t)0x00000008) /*!< L4 color mode */
Kojto 93:e188a91d3eaa 263 #define CM_A8 ((uint32_t)0x00000009) /*!< A8 color mode */
Kojto 93:e188a91d3eaa 264 #define CM_A4 ((uint32_t)0x0000000A) /*!< A4 color mode */
Kojto 93:e188a91d3eaa 265
Kojto 93:e188a91d3eaa 266 #define IS_DMA2D_INPUT_COLOR_MODE(INPUT_CM) (((INPUT_CM) == CM_ARGB8888) || ((INPUT_CM) == CM_RGB888) || \
Kojto 93:e188a91d3eaa 267 ((INPUT_CM) == CM_RGB565) || ((INPUT_CM) == CM_ARGB1555) || \
Kojto 93:e188a91d3eaa 268 ((INPUT_CM) == CM_ARGB4444) || ((INPUT_CM) == CM_L8) || \
Kojto 93:e188a91d3eaa 269 ((INPUT_CM) == CM_AL44) || ((INPUT_CM) == CM_AL88) || \
Kojto 93:e188a91d3eaa 270 ((INPUT_CM) == CM_L4) || ((INPUT_CM) == CM_A8) || \
Kojto 93:e188a91d3eaa 271 ((INPUT_CM) == CM_A4))
Kojto 93:e188a91d3eaa 272 /**
Kojto 93:e188a91d3eaa 273 * @}
Kojto 93:e188a91d3eaa 274 */
Kojto 93:e188a91d3eaa 275
Kojto 93:e188a91d3eaa 276 /** @defgroup DMA2D_ALPHA_MODE
Kojto 93:e188a91d3eaa 277 * @{
Kojto 93:e188a91d3eaa 278 */
Kojto 93:e188a91d3eaa 279 #define DMA2D_NO_MODIF_ALPHA ((uint32_t)0x00000000) /*!< No modification of the alpha channel value */
Kojto 93:e188a91d3eaa 280 #define DMA2D_REPLACE_ALPHA ((uint32_t)0x00000001) /*!< Replace original alpha channel value by programmed alpha value */
Kojto 93:e188a91d3eaa 281 #define DMA2D_COMBINE_ALPHA ((uint32_t)0x00000002) /*!< Replace original alpha channel value by programmed alpha value
Kojto 93:e188a91d3eaa 282 with original alpha channel value */
Kojto 93:e188a91d3eaa 283
Kojto 93:e188a91d3eaa 284 #define IS_DMA2D_ALPHA_MODE(AlphaMode) (((AlphaMode) == DMA2D_NO_MODIF_ALPHA) || \
Kojto 93:e188a91d3eaa 285 ((AlphaMode) == DMA2D_REPLACE_ALPHA) || \
Kojto 93:e188a91d3eaa 286 ((AlphaMode) == DMA2D_COMBINE_ALPHA))
Kojto 93:e188a91d3eaa 287 /**
Kojto 93:e188a91d3eaa 288 * @}
Kojto 93:e188a91d3eaa 289 */
Kojto 93:e188a91d3eaa 290
Kojto 93:e188a91d3eaa 291 /** @defgroup DMA2D_CLUT_CM
Kojto 93:e188a91d3eaa 292 * @{
Kojto 93:e188a91d3eaa 293 */
Kojto 93:e188a91d3eaa 294 #define DMA2D_CCM_ARGB8888 ((uint32_t)0x00000000) /*!< ARGB8888 DMA2D C-LUT color mode */
Kojto 93:e188a91d3eaa 295 #define DMA2D_CCM_RGB888 ((uint32_t)0x00000001) /*!< RGB888 DMA2D C-LUT color mode */
Kojto 93:e188a91d3eaa 296
Kojto 93:e188a91d3eaa 297 #define IS_DMA2D_CLUT_CM(CLUT_CM) (((CLUT_CM) == DMA2D_CCM_ARGB8888) || ((CLUT_CM) == DMA2D_CCM_RGB888))
Kojto 93:e188a91d3eaa 298 /**
Kojto 93:e188a91d3eaa 299 * @}
Kojto 93:e188a91d3eaa 300 */
Kojto 93:e188a91d3eaa 301
Kojto 93:e188a91d3eaa 302 /** @defgroup DMA2D_Size_Clut
Kojto 93:e188a91d3eaa 303 * @{
Kojto 93:e188a91d3eaa 304 */
Kojto 93:e188a91d3eaa 305 #define DMA2D_CLUT_SIZE (DMA2D_FGPFCCR_CS >> 8) /*!< DMA2D C-LUT size */
Kojto 93:e188a91d3eaa 306
Kojto 93:e188a91d3eaa 307 #define IS_DMA2D_CLUT_SIZE(CLUT_SIZE) ((CLUT_SIZE) <= DMA2D_CLUT_SIZE)
Kojto 93:e188a91d3eaa 308 /**
Kojto 93:e188a91d3eaa 309 * @}
Kojto 93:e188a91d3eaa 310 */
Kojto 93:e188a91d3eaa 311
Kojto 93:e188a91d3eaa 312 /** @defgroup DMA2D_DeadTime
Kojto 93:e188a91d3eaa 313 * @{
Kojto 93:e188a91d3eaa 314 */
Kojto 93:e188a91d3eaa 315 #define LINE_WATERMARK DMA2D_LWR_LW
Kojto 93:e188a91d3eaa 316
Kojto 93:e188a91d3eaa 317 #define IS_DMA2D_LineWatermark(LineWatermark) ((LineWatermark) <= LINE_WATERMARK)
Kojto 93:e188a91d3eaa 318 /**
Kojto 93:e188a91d3eaa 319 * @}
Kojto 93:e188a91d3eaa 320 */
Kojto 93:e188a91d3eaa 321
Kojto 93:e188a91d3eaa 322 /** @defgroup DMA2D_Interrupts
Kojto 93:e188a91d3eaa 323 * @{
Kojto 93:e188a91d3eaa 324 */
Kojto 93:e188a91d3eaa 325 #define DMA2D_IT_CE DMA2D_CR_CEIE /*!< Configuration Error Interrupt */
Kojto 93:e188a91d3eaa 326 #define DMA2D_IT_CTC DMA2D_CR_CTCIE /*!< C-LUT Transfer Complete Interrupt */
Kojto 93:e188a91d3eaa 327 #define DMA2D_IT_CAE DMA2D_CR_CAEIE /*!< C-LUT Access Error Interrupt */
Kojto 93:e188a91d3eaa 328 #define DMA2D_IT_TW DMA2D_CR_TWIE /*!< Transfer Watermark Interrupt */
Kojto 93:e188a91d3eaa 329 #define DMA2D_IT_TC DMA2D_CR_TCIE /*!< Transfer Complete Interrupt */
Kojto 93:e188a91d3eaa 330 #define DMA2D_IT_TE DMA2D_CR_TEIE /*!< Transfer Error Interrupt */
Kojto 93:e188a91d3eaa 331
Kojto 93:e188a91d3eaa 332 #define IS_DMA2D_IT(IT) (((IT) == DMA2D_IT_CTC) || ((IT) == DMA2D_IT_CAE) || \
Kojto 93:e188a91d3eaa 333 ((IT) == DMA2D_IT_TW) || ((IT) == DMA2D_IT_TC) || \
Kojto 93:e188a91d3eaa 334 ((IT) == DMA2D_IT_TE) || ((IT) == DMA2D_IT_CE))
Kojto 93:e188a91d3eaa 335 /**
Kojto 93:e188a91d3eaa 336 * @}
Kojto 93:e188a91d3eaa 337 */
Kojto 93:e188a91d3eaa 338
Kojto 93:e188a91d3eaa 339 /** @defgroup DMA2D_Flag
Kojto 93:e188a91d3eaa 340 * @{
Kojto 93:e188a91d3eaa 341 */
Kojto 93:e188a91d3eaa 342 #define DMA2D_FLAG_CE DMA2D_ISR_CEIF /*!< Configuration Error Interrupt Flag */
Kojto 93:e188a91d3eaa 343 #define DMA2D_FLAG_CTC DMA2D_ISR_CTCIF /*!< C-LUT Transfer Complete Interrupt Flag */
Kojto 93:e188a91d3eaa 344 #define DMA2D_FLAG_CAE DMA2D_ISR_CAEIF /*!< C-LUT Access Error Interrupt Flag */
Kojto 93:e188a91d3eaa 345 #define DMA2D_FLAG_TW DMA2D_ISR_TWIF /*!< Transfer Watermark Interrupt Flag */
Kojto 93:e188a91d3eaa 346 #define DMA2D_FLAG_TC DMA2D_ISR_TCIF /*!< Transfer Complete Interrupt Flag */
Kojto 93:e188a91d3eaa 347 #define DMA2D_FLAG_TE DMA2D_ISR_TEIF /*!< Transfer Error Interrupt Flag */
Kojto 93:e188a91d3eaa 348
Kojto 93:e188a91d3eaa 349 #define IS_DMA2D_GET_FLAG(FLAG) (((FLAG) == DMA2D_FLAG_CTC) || ((FLAG) == DMA2D_FLAG_CAE) || \
Kojto 93:e188a91d3eaa 350 ((FLAG) == DMA2D_FLAG_TW) || ((FLAG) == DMA2D_FLAG_TC) || \
Kojto 93:e188a91d3eaa 351 ((FLAG) == DMA2D_FLAG_TE) || ((FLAG) == DMA2D_FLAG_CE))
Kojto 93:e188a91d3eaa 352 /**
Kojto 93:e188a91d3eaa 353 * @}
Kojto 93:e188a91d3eaa 354 */
Kojto 93:e188a91d3eaa 355
Kojto 93:e188a91d3eaa 356 /**
Kojto 93:e188a91d3eaa 357 * @}
Kojto 93:e188a91d3eaa 358 */
Kojto 93:e188a91d3eaa 359 /* Exported macro ------------------------------------------------------------*/
Kojto 93:e188a91d3eaa 360
Kojto 93:e188a91d3eaa 361 /** @brief Reset DMA2D handle state
Kojto 93:e188a91d3eaa 362 * @param __HANDLE__: specifies the DMA2D handle.
Kojto 93:e188a91d3eaa 363 * @retval None
Kojto 93:e188a91d3eaa 364 */
Kojto 93:e188a91d3eaa 365 #define __HAL_DMA2D_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DMA2D_STATE_RESET)
Kojto 93:e188a91d3eaa 366
Kojto 93:e188a91d3eaa 367 /**
Kojto 93:e188a91d3eaa 368 * @brief Enable the DMA2D.
Kojto 93:e188a91d3eaa 369 * @param __HANDLE__: DMA2D handle
Kojto 93:e188a91d3eaa 370 * @retval None.
Kojto 93:e188a91d3eaa 371 */
Kojto 93:e188a91d3eaa 372 #define __HAL_DMA2D_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DMA2D_CR_START)
Kojto 93:e188a91d3eaa 373
Kojto 93:e188a91d3eaa 374 /**
Kojto 93:e188a91d3eaa 375 * @brief Disable the DMA2D.
Kojto 93:e188a91d3eaa 376 * @param __HANDLE__: DMA2D handle
Kojto 93:e188a91d3eaa 377 * @retval None.
Kojto 93:e188a91d3eaa 378 */
Kojto 93:e188a91d3eaa 379 #define __HAL_DMA2D_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~DMA2D_CR_START)
Kojto 93:e188a91d3eaa 380
Kojto 93:e188a91d3eaa 381 /* Interrupt & Flag management */
Kojto 93:e188a91d3eaa 382 /**
Kojto 93:e188a91d3eaa 383 * @brief Get the DMA2D pending flags.
Kojto 93:e188a91d3eaa 384 * @param __HANDLE__: DMA2D handle
Kojto 93:e188a91d3eaa 385 * @param __FLAG__: Get the specified flag.
Kojto 93:e188a91d3eaa 386 * This parameter can be any combination of the following values:
Kojto 93:e188a91d3eaa 387 * @arg DMA2D_FLAG_CE: Configuration error flag
Kojto 93:e188a91d3eaa 388 * @arg DMA2D_FLAG_CTC: C-LUT transfer complete flag
Kojto 93:e188a91d3eaa 389 * @arg DMA2D_FLAG_CAE: C-LUT access error flag
Kojto 93:e188a91d3eaa 390 * @arg DMA2D_FLAG_TW: Transfer Watermark flag
Kojto 93:e188a91d3eaa 391 * @arg DMA2D_FLAG_TC: Transfer complete flag
Kojto 93:e188a91d3eaa 392 * @arg DMA2D_FLAG_TE: Transfer error flag
Kojto 93:e188a91d3eaa 393 * @retval The state of FLAG.
Kojto 93:e188a91d3eaa 394 */
Kojto 93:e188a91d3eaa 395 #define __HAL_DMA2D_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__))
Kojto 93:e188a91d3eaa 396
Kojto 93:e188a91d3eaa 397 /**
Kojto 93:e188a91d3eaa 398 * @brief Clears the DMA2D pending flags.
Kojto 93:e188a91d3eaa 399 * @param __HANDLE__: DMA2D handle
Kojto 93:e188a91d3eaa 400 * @param __FLAG__: specifies the flag to clear.
Kojto 93:e188a91d3eaa 401 * This parameter can be any combination of the following values:
Kojto 93:e188a91d3eaa 402 * @arg DMA2D_FLAG_CE: Configuration error flag
Kojto 93:e188a91d3eaa 403 * @arg DMA2D_FLAG_CTC: C-LUT transfer complete flag
Kojto 93:e188a91d3eaa 404 * @arg DMA2D_FLAG_CAE: C-LUT access error flag
Kojto 93:e188a91d3eaa 405 * @arg DMA2D_FLAG_TW: Transfer Watermark flag
Kojto 93:e188a91d3eaa 406 * @arg DMA2D_FLAG_TC: Transfer complete flag
Kojto 93:e188a91d3eaa 407 * @arg DMA2D_FLAG_TE: Transfer error flag
Kojto 93:e188a91d3eaa 408 * @retval None
Kojto 93:e188a91d3eaa 409 */
Kojto 93:e188a91d3eaa 410 #define __HAL_DMA2D_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->IFCR = (__FLAG__))
Kojto 93:e188a91d3eaa 411
Kojto 93:e188a91d3eaa 412 /**
Kojto 93:e188a91d3eaa 413 * @brief Enables the specified DMA2D interrupts.
Kojto 93:e188a91d3eaa 414 * @param __HANDLE__: DMA2D handle
Kojto 93:e188a91d3eaa 415 * @param __INTERRUPT__: specifies the DMA2D interrupt sources to be enabled.
Kojto 93:e188a91d3eaa 416 * This parameter can be any combination of the following values:
Kojto 93:e188a91d3eaa 417 * @arg DMA2D_IT_CE: Configuration error interrupt mask
Kojto 93:e188a91d3eaa 418 * @arg DMA2D_IT_CTC: C-LUT transfer complete interrupt mask
Kojto 93:e188a91d3eaa 419 * @arg DMA2D_IT_CAE: C-LUT access error interrupt mask
Kojto 93:e188a91d3eaa 420 * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
Kojto 93:e188a91d3eaa 421 * @arg DMA2D_IT_TC: Transfer complete interrupt mask
Kojto 93:e188a91d3eaa 422 * @arg DMA2D_IT_TE: Transfer error interrupt mask
Kojto 93:e188a91d3eaa 423 * @retval None
Kojto 93:e188a91d3eaa 424 */
Kojto 93:e188a91d3eaa 425 #define __HAL_DMA2D_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
Kojto 93:e188a91d3eaa 426
Kojto 93:e188a91d3eaa 427 /**
Kojto 93:e188a91d3eaa 428 * @brief Disables the specified DMA2D interrupts.
Kojto 93:e188a91d3eaa 429 * @param __HANDLE__: DMA2D handle
Kojto 93:e188a91d3eaa 430 * @param __INTERRUPT__: specifies the DMA2D interrupt sources to be disabled.
Kojto 93:e188a91d3eaa 431 * This parameter can be any combination of the following values:
Kojto 93:e188a91d3eaa 432 * @arg DMA2D_IT_CE: Configuration error interrupt mask
Kojto 93:e188a91d3eaa 433 * @arg DMA2D_IT_CTC: C-LUT transfer complete interrupt mask
Kojto 93:e188a91d3eaa 434 * @arg DMA2D_IT_CAE: C-LUT access error interrupt mask
Kojto 93:e188a91d3eaa 435 * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
Kojto 93:e188a91d3eaa 436 * @arg DMA2D_IT_TC: Transfer complete interrupt mask
Kojto 93:e188a91d3eaa 437 * @arg DMA2D_IT_TE: Transfer error interrupt mask
Kojto 93:e188a91d3eaa 438 * @retval None
Kojto 93:e188a91d3eaa 439 */
Kojto 93:e188a91d3eaa 440 #define __HAL_DMA2D_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
Kojto 93:e188a91d3eaa 441
Kojto 93:e188a91d3eaa 442 /**
Kojto 93:e188a91d3eaa 443 * @brief Checks whether the specified DMA2D interrupt has occurred or not.
Kojto 93:e188a91d3eaa 444 * @param __HANDLE__: DMA2D handle
Kojto 93:e188a91d3eaa 445 * @param __INTERRUPT__: specifies the DMA2D interrupt source to check.
Kojto 93:e188a91d3eaa 446 * This parameter can be one of the following values:
Kojto 93:e188a91d3eaa 447 * @arg DMA2D_IT_CE: Configuration error interrupt mask
Kojto 93:e188a91d3eaa 448 * @arg DMA2D_IT_CTC: C-LUT transfer complete interrupt mask
Kojto 93:e188a91d3eaa 449 * @arg DMA2D_IT_CAE: C-LUT access error interrupt mask
Kojto 93:e188a91d3eaa 450 * @arg DMA2D_IT_TW: Transfer Watermark interrupt mask
Kojto 93:e188a91d3eaa 451 * @arg DMA2D_IT_TC: Transfer complete interrupt mask
Kojto 93:e188a91d3eaa 452 * @arg DMA2D_IT_TE: Transfer error interrupt mask
Kojto 93:e188a91d3eaa 453 * @retval The state of INTERRUPT.
Kojto 93:e188a91d3eaa 454 */
Kojto 93:e188a91d3eaa 455 #define __HAL_DMA2D_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR & (__INTERRUPT__))
Kojto 93:e188a91d3eaa 456
Kojto 93:e188a91d3eaa 457 /* Exported functions --------------------------------------------------------*/
Kojto 93:e188a91d3eaa 458
Kojto 93:e188a91d3eaa 459 /* Initialization and de-initialization functions *******************************/
Kojto 93:e188a91d3eaa 460 HAL_StatusTypeDef HAL_DMA2D_Init(DMA2D_HandleTypeDef *hdma2d);
Kojto 93:e188a91d3eaa 461 HAL_StatusTypeDef HAL_DMA2D_DeInit (DMA2D_HandleTypeDef *hdma2d);
Kojto 93:e188a91d3eaa 462 void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* hdma2d);
Kojto 93:e188a91d3eaa 463 void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef* hdma2d);
Kojto 93:e188a91d3eaa 464
Kojto 93:e188a91d3eaa 465 /* IO operation functions *******************************************************/
Kojto 93:e188a91d3eaa 466 HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Heigh);
Kojto 93:e188a91d3eaa 467 HAL_StatusTypeDef HAL_DMA2D_BlendingStart(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Heigh);
Kojto 93:e188a91d3eaa 468 HAL_StatusTypeDef HAL_DMA2D_Start_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Heigh);
Kojto 93:e188a91d3eaa 469 HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Heigh);
Kojto 93:e188a91d3eaa 470 HAL_StatusTypeDef HAL_DMA2D_Suspend(DMA2D_HandleTypeDef *hdma2d);
Kojto 93:e188a91d3eaa 471 HAL_StatusTypeDef HAL_DMA2D_Resume(DMA2D_HandleTypeDef *hdma2d);
Kojto 93:e188a91d3eaa 472 HAL_StatusTypeDef HAL_DMA2D_Abort(DMA2D_HandleTypeDef *hdma2d);
Kojto 93:e188a91d3eaa 473 HAL_StatusTypeDef HAL_DMA2D_PollForTransfer(DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout);
Kojto 93:e188a91d3eaa 474 void HAL_DMA2D_IRQHandler(DMA2D_HandleTypeDef *hdma2d);
Kojto 93:e188a91d3eaa 475
Kojto 93:e188a91d3eaa 476 /* Peripheral Control functions *************************************************/
Kojto 93:e188a91d3eaa 477 HAL_StatusTypeDef HAL_DMA2D_ConfigLayer(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
Kojto 93:e188a91d3eaa 478 HAL_StatusTypeDef HAL_DMA2D_ConfigCLUT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
Kojto 93:e188a91d3eaa 479 HAL_StatusTypeDef HAL_DMA2D_EnableCLUT(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
Kojto 93:e188a91d3eaa 480 HAL_StatusTypeDef HAL_DMA2D_DisableCLUT(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
Kojto 93:e188a91d3eaa 481 HAL_StatusTypeDef HAL_DMA2D_ProgramLineEvent(DMA2D_HandleTypeDef *hdma2d, uint32_t Line);
Kojto 93:e188a91d3eaa 482
Kojto 93:e188a91d3eaa 483 /* Peripheral State functions ***************************************************/
Kojto 93:e188a91d3eaa 484 HAL_DMA2D_StateTypeDef HAL_DMA2D_GetState(DMA2D_HandleTypeDef *hdma2d);
Kojto 93:e188a91d3eaa 485 uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d);
Kojto 93:e188a91d3eaa 486
Kojto 93:e188a91d3eaa 487 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
Kojto 93:e188a91d3eaa 488
Kojto 93:e188a91d3eaa 489 /**
Kojto 93:e188a91d3eaa 490 * @}
Kojto 93:e188a91d3eaa 491 */
Kojto 93:e188a91d3eaa 492
Kojto 93:e188a91d3eaa 493 /**
Kojto 93:e188a91d3eaa 494 * @}
Kojto 93:e188a91d3eaa 495 */
Kojto 93:e188a91d3eaa 496
Kojto 93:e188a91d3eaa 497 #ifdef __cplusplus
Kojto 93:e188a91d3eaa 498 }
Kojto 93:e188a91d3eaa 499 #endif
Kojto 93:e188a91d3eaa 500
Kojto 93:e188a91d3eaa 501 #endif /* __STM32F4xx_HAL_DMA2D_H */
Kojto 93:e188a91d3eaa 502
Kojto 93:e188a91d3eaa 503
Kojto 93:e188a91d3eaa 504 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/