Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / STM32F4 / Drivers / STM32F4xx_StdPeriph_Driver / inc / stm32f4xx_dma2d.h
blob519389dc37c613a77b68709b7142f6dbc3d50779
1 /**
2 ******************************************************************************
3 * @file stm32f4xx_dma2d.h
4 * @author MCD Application Team
5 * @version V1.7.1
6 * @date 20-May-2016
7 * @brief This file contains all the functions prototypes for the DMA2D firmware
8 * library.
9 ******************************************************************************
10 * @attention
12 * <h2><center>&copy; COPYRIGHT 2016 STMicroelectronics</center></h2>
14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 * You may not use this file except in compliance with the License.
16 * You may obtain a copy of the License at:
18 * http://www.st.com/software_license_agreement_liberty_v2
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
26 ******************************************************************************
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F4xx_DMA2D_H
31 #define __STM32F4xx_DMA2D_H
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f4xx.h"
40 /** @addtogroup STM32F4xx_StdPeriph_Driver
41 * @{
44 /** @addtogroup DMA2D
45 * @{
46 */
48 /* Exported types ------------------------------------------------------------*/
50 /**
51 * @brief DMA2D Init structure definition
54 typedef struct
56 uint32_t DMA2D_Mode; /*!< configures the DMA2D transfer mode.
57 This parameter can be one value of @ref DMA2D_MODE */
59 uint32_t DMA2D_CMode; /*!< configures the color format of the output image.
60 This parameter can be one value of @ref DMA2D_CMODE */
62 uint32_t DMA2D_OutputBlue; /*!< configures the blue value of the output image.
63 This parameter must range:
64 - from 0x00 to 0xFF if ARGB8888 color mode is slected
65 - from 0x00 to 0xFF if RGB888 color mode is slected
66 - from 0x00 to 0x1F if RGB565 color mode is slected
67 - from 0x00 to 0x1F if ARGB1555 color mode is slected
68 - from 0x00 to 0x0F if ARGB4444 color mode is slected */
70 uint32_t DMA2D_OutputGreen; /*!< configures the green value of the output image.
71 This parameter must range:
72 - from 0x00 to 0xFF if ARGB8888 color mode is selected
73 - from 0x00 to 0xFF if RGB888 color mode is selected
74 - from 0x00 to 0x2F if RGB565 color mode is selected
75 - from 0x00 to 0x1F if ARGB1555 color mode is selected
76 - from 0x00 to 0x0F if ARGB4444 color mode is selected */
78 uint32_t DMA2D_OutputRed; /*!< configures the red value of the output image.
79 This parameter must range:
80 - from 0x00 to 0xFF if ARGB8888 color mode is slected
81 - from 0x00 to 0xFF if RGB888 color mode is slected
82 - from 0x00 to 0x1F if RGB565 color mode is slected
83 - from 0x00 to 0x1F if ARGB1555 color mode is slected
84 - from 0x00 to 0x0F if ARGB4444 color mode is slected */
86 uint32_t DMA2D_OutputAlpha; /*!< configures the alpha channel of the output color.
87 This parameter must range:
88 - from 0x00 to 0xFF if ARGB8888 color mode is selected
89 - from 0x00 to 0x01 if ARGB1555 color mode is selected
90 - from 0x00 to 0x0F if ARGB4444 color mode is selected */
92 uint32_t DMA2D_OutputMemoryAdd; /*!< Specifies the memory address. This parameter
93 must be range from 0x00000000 to 0xFFFFFFFF. */
95 uint32_t DMA2D_OutputOffset; /*!< Specifies the Offset value. This parameter must be range from
96 0x0000 to 0x3FFF. */
98 uint32_t DMA2D_NumberOfLine; /*!< Configures the number of line of the area to be transfered.
99 This parameter must range from 0x0000 to 0xFFFF */
101 uint32_t DMA2D_PixelPerLine; /*!< Configures the number pixel per line of the area to be transferred.
102 This parameter must range from 0x0000 to 0x3FFF */
103 } DMA2D_InitTypeDef;
107 typedef struct
109 uint32_t DMA2D_FGMA; /*!< configures the DMA2D foreground memory address.
110 This parameter must be range from 0x00000000 to 0xFFFFFFFF. */
112 uint32_t DMA2D_FGO; /*!< configures the DMA2D foreground offset.
113 This parameter must be range from 0x0000 to 0x3FFF. */
115 uint32_t DMA2D_FGCM; /*!< configures the DMA2D foreground color mode .
116 This parameter can be one value of @ref DMA2D_FGCM */
118 uint32_t DMA2D_FG_CLUT_CM; /*!< configures the DMA2D foreground CLUT color mode.
119 This parameter can be one value of @ref DMA2D_FG_CLUT_CM */
121 uint32_t DMA2D_FG_CLUT_SIZE; /*!< configures the DMA2D foreground CLUT size.
122 This parameter must range from 0x00 to 0xFF. */
124 uint32_t DMA2D_FGPFC_ALPHA_MODE; /*!< configures the DMA2D foreground alpha mode.
125 This parameter can be one value of @ref DMA2D_FGPFC_ALPHA_MODE */
127 uint32_t DMA2D_FGPFC_ALPHA_VALUE; /*!< Specifies the DMA2D foreground alpha value
128 must be range from 0x00 to 0xFF. */
130 uint32_t DMA2D_FGC_BLUE; /*!< Specifies the DMA2D foreground blue value
131 must be range from 0x00 to 0xFF. */
133 uint32_t DMA2D_FGC_GREEN; /*!< Specifies the DMA2D foreground green value
134 must be range from 0x00 to 0xFF. */
136 uint32_t DMA2D_FGC_RED; /*!< Specifies the DMA2D foreground red value
137 must be range from 0x00 to 0xFF. */
139 uint32_t DMA2D_FGCMAR; /*!< Configures the DMA2D foreground CLUT memory address.
140 This parameter must range from 0x00000000 to 0xFFFFFFFF. */
141 } DMA2D_FG_InitTypeDef;
144 typedef struct
146 uint32_t DMA2D_BGMA; /*!< configures the DMA2D background memory address.
147 This parameter must be range from 0x00000000 to 0xFFFFFFFF. */
149 uint32_t DMA2D_BGO; /*!< configures the DMA2D background offset.
150 This parameter must be range from 0x0000 to 0x3FFF. */
152 uint32_t DMA2D_BGCM; /*!< configures the DMA2D background color mode .
153 This parameter can be one value of @ref DMA2D_FGCM */
155 uint32_t DMA2D_BG_CLUT_CM; /*!< configures the DMA2D background CLUT color mode.
156 This parameter can be one value of @ref DMA2D_FG_CLUT_CM */
158 uint32_t DMA2D_BG_CLUT_SIZE; /*!< configures the DMA2D background CLUT size.
159 This parameter must range from 0x00 to 0xFF. */
161 uint32_t DMA2D_BGPFC_ALPHA_MODE; /*!< configures the DMA2D background alpha mode.
162 This parameter can be one value of @ref DMA2D_FGPFC_ALPHA_MODE */
164 uint32_t DMA2D_BGPFC_ALPHA_VALUE; /*!< Specifies the DMA2D background alpha value
165 must be range from 0x00 to 0xFF. */
167 uint32_t DMA2D_BGC_BLUE; /*!< Specifies the DMA2D background blue value
168 must be range from 0x00 to 0xFF. */
170 uint32_t DMA2D_BGC_GREEN; /*!< Specifies the DMA2D background green value
171 must be range from 0x00 to 0xFF. */
173 uint32_t DMA2D_BGC_RED; /*!< Specifies the DMA2D background red value
174 must be range from 0x00 to 0xFF. */
176 uint32_t DMA2D_BGCMAR; /*!< Configures the DMA2D background CLUT memory address.
177 This parameter must range from 0x00000000 to 0xFFFFFFFF. */
178 } DMA2D_BG_InitTypeDef;
182 /* Exported constants --------------------------------------------------------*/
184 /** @defgroup DMA2D_Exported_Constants
185 * @{
188 /** @defgroup DMA2D_MODE
189 * @{
193 #define DMA2D_M2M ((uint32_t)0x00000000)
194 #define DMA2D_M2M_PFC ((uint32_t)0x00010000)
195 #define DMA2D_M2M_BLEND ((uint32_t)0x00020000)
196 #define DMA2D_R2M ((uint32_t)0x00030000)
198 #define IS_DMA2D_MODE(MODE) (((MODE) == DMA2D_M2M) || ((MODE) == DMA2D_M2M_PFC) || \
199 ((MODE) == DMA2D_M2M_BLEND) || ((MODE) == DMA2D_R2M))
203 * @}
206 /** @defgroup DMA2D_CMODE
207 * @{
209 #define DMA2D_ARGB8888 ((uint32_t)0x00000000)
210 #define DMA2D_RGB888 ((uint32_t)0x00000001)
211 #define DMA2D_RGB565 ((uint32_t)0x00000002)
212 #define DMA2D_ARGB1555 ((uint32_t)0x00000003)
213 #define DMA2D_ARGB4444 ((uint32_t)0x00000004)
215 #define IS_DMA2D_CMODE(MODE_ARGB) (((MODE_ARGB) == DMA2D_ARGB8888) || ((MODE_ARGB) == DMA2D_RGB888) || \
216 ((MODE_ARGB) == DMA2D_RGB565) || ((MODE_ARGB) == DMA2D_ARGB1555) || \
217 ((MODE_ARGB) == DMA2D_ARGB4444))
221 * @}
224 /** @defgroup DMA2D_OUTPUT_COLOR
225 * @{
227 #define DMA2D_Output_Color ((uint32_t)0x000000FF)
229 #define IS_DMA2D_OGREEN(OGREEN) ((OGREEN) <= DMA2D_Output_Color)
230 #define IS_DMA2D_ORED(ORED) ((ORED) <= DMA2D_Output_Color)
231 #define IS_DMA2D_OBLUE(OBLUE) ((OBLUE) <= DMA2D_Output_Color)
232 #define IS_DMA2D_OALPHA(OALPHA) ((OALPHA) <= DMA2D_Output_Color)
235 * @}
238 /** @defgroup DMA2D_OUTPUT_OFFSET
239 * @{
241 #define DMA2D_OUTPUT_OFFSET ((uint32_t)0x00003FFF)
243 #define IS_DMA2D_OUTPUT_OFFSET(OOFFSET) ((OOFFSET) <= DMA2D_OUTPUT_OFFSET)
247 * @}
250 /** @defgroup DMA2D_SIZE
251 * @{
254 #define DMA2D_pixel ((uint32_t)0x00003FFF)
255 #define DMA2D_Line ((uint32_t)0x0000FFFF)
257 #define IS_DMA2D_LINE(LINE) ((LINE) <= DMA2D_Line)
258 #define IS_DMA2D_PIXEL(PIXEL) ((PIXEL) <= DMA2D_pixel)
262 * @}
265 /** @defgroup DMA2D_OFFSET
266 * @{
268 #define OFFSET ((uint32_t)0x00003FFF)
270 #define IS_DMA2D_FGO(FGO) ((FGO) <= OFFSET)
272 #define IS_DMA2D_BGO(BGO) ((BGO) <= OFFSET)
275 * @}
279 /** @defgroup DMA2D_FGCM
280 * @{
283 #define CM_ARGB8888 ((uint32_t)0x00000000)
284 #define CM_RGB888 ((uint32_t)0x00000001)
285 #define CM_RGB565 ((uint32_t)0x00000002)
286 #define CM_ARGB1555 ((uint32_t)0x00000003)
287 #define CM_ARGB4444 ((uint32_t)0x00000004)
288 #define CM_L8 ((uint32_t)0x00000005)
289 #define CM_AL44 ((uint32_t)0x00000006)
290 #define CM_AL88 ((uint32_t)0x00000007)
291 #define CM_L4 ((uint32_t)0x00000008)
292 #define CM_A8 ((uint32_t)0x00000009)
293 #define CM_A4 ((uint32_t)0x0000000A)
295 #define IS_DMA2D_FGCM(FGCM) (((FGCM) == CM_ARGB8888) || ((FGCM) == CM_RGB888) || \
296 ((FGCM) == CM_RGB565) || ((FGCM) == CM_ARGB1555) || \
297 ((FGCM) == CM_ARGB4444) || ((FGCM) == CM_L8) || \
298 ((FGCM) == CM_AL44) || ((FGCM) == CM_AL88) || \
299 ((FGCM) == CM_L4) || ((FGCM) == CM_A8) || \
300 ((FGCM) == CM_A4))
302 #define IS_DMA2D_BGCM(BGCM) (((BGCM) == CM_ARGB8888) || ((BGCM) == CM_RGB888) || \
303 ((BGCM) == CM_RGB565) || ((BGCM) == CM_ARGB1555) || \
304 ((BGCM) == CM_ARGB4444) || ((BGCM) == CM_L8) || \
305 ((BGCM) == CM_AL44) || ((BGCM) == CM_AL88) || \
306 ((BGCM) == CM_L4) || ((BGCM) == CM_A8) || \
307 ((BGCM) == CM_A4))
310 * @}
313 /** @defgroup DMA2D_FG_CLUT_CM
314 * @{
317 #define CLUT_CM_ARGB8888 ((uint32_t)0x00000000)
318 #define CLUT_CM_RGB888 ((uint32_t)0x00000001)
320 #define IS_DMA2D_FG_CLUT_CM(FG_CLUT_CM) (((FG_CLUT_CM) == CLUT_CM_ARGB8888) || ((FG_CLUT_CM) == CLUT_CM_RGB888))
322 #define IS_DMA2D_BG_CLUT_CM(BG_CLUT_CM) (((BG_CLUT_CM) == CLUT_CM_ARGB8888) || ((BG_CLUT_CM) == CLUT_CM_RGB888))
325 * @}
328 /** @defgroup DMA2D_FG_COLOR_VALUE
329 * @{
332 #define COLOR_VALUE ((uint32_t)0x000000FF)
334 #define IS_DMA2D_FG_CLUT_SIZE(FG_CLUT_SIZE) ((FG_CLUT_SIZE) <= COLOR_VALUE)
336 #define IS_DMA2D_FG_ALPHA_VALUE(FG_ALPHA_VALUE) ((FG_ALPHA_VALUE) <= COLOR_VALUE)
337 #define IS_DMA2D_FGC_BLUE(FGC_BLUE) ((FGC_BLUE) <= COLOR_VALUE)
338 #define IS_DMA2D_FGC_GREEN(FGC_GREEN) ((FGC_GREEN) <= COLOR_VALUE)
339 #define IS_DMA2D_FGC_RED(FGC_RED) ((FGC_RED) <= COLOR_VALUE)
341 #define IS_DMA2D_BG_CLUT_SIZE(BG_CLUT_SIZE) ((BG_CLUT_SIZE) <= COLOR_VALUE)
343 #define IS_DMA2D_BG_ALPHA_VALUE(BG_ALPHA_VALUE) ((BG_ALPHA_VALUE) <= COLOR_VALUE)
344 #define IS_DMA2D_BGC_BLUE(BGC_BLUE) ((BGC_BLUE) <= COLOR_VALUE)
345 #define IS_DMA2D_BGC_GREEN(BGC_GREEN) ((BGC_GREEN) <= COLOR_VALUE)
346 #define IS_DMA2D_BGC_RED(BGC_RED) ((BGC_RED) <= COLOR_VALUE)
349 * @}
352 /** DMA2D_FGPFC_ALPHA_MODE
353 * @{
356 #define NO_MODIF_ALPHA_VALUE ((uint32_t)0x00000000)
357 #define REPLACE_ALPHA_VALUE ((uint32_t)0x00000001)
358 #define COMBINE_ALPHA_VALUE ((uint32_t)0x00000002)
360 #define IS_DMA2D_FG_ALPHA_MODE(FG_ALPHA_MODE) (((FG_ALPHA_MODE) == NO_MODIF_ALPHA_VALUE) || \
361 ((FG_ALPHA_MODE) == REPLACE_ALPHA_VALUE) || \
362 ((FG_ALPHA_MODE) == COMBINE_ALPHA_VALUE))
364 #define IS_DMA2D_BG_ALPHA_MODE(BG_ALPHA_MODE) (((BG_ALPHA_MODE) == NO_MODIF_ALPHA_VALUE) || \
365 ((BG_ALPHA_MODE) == REPLACE_ALPHA_VALUE) || \
366 ((BG_ALPHA_MODE) == COMBINE_ALPHA_VALUE))
369 * @}
372 /** @defgroup DMA2D_Interrupts
373 * @{
376 #define DMA2D_IT_CE DMA2D_CR_CEIE
377 #define DMA2D_IT_CTC DMA2D_CR_CTCIE
378 #define DMA2D_IT_CAE DMA2D_CR_CAEIE
379 #define DMA2D_IT_TW DMA2D_CR_TWIE
380 #define DMA2D_IT_TC DMA2D_CR_TCIE
381 #define DMA2D_IT_TE DMA2D_CR_TEIE
383 #define IS_DMA2D_IT(IT) (((IT) == DMA2D_IT_CTC) || ((IT) == DMA2D_IT_CAE) || \
384 ((IT) == DMA2D_IT_TW) || ((IT) == DMA2D_IT_TC) || \
385 ((IT) == DMA2D_IT_TE) || ((IT) == DMA2D_IT_CE))
388 * @}
391 /** @defgroup DMA2D_Flag
392 * @{
395 #define DMA2D_FLAG_CE DMA2D_ISR_CEIF
396 #define DMA2D_FLAG_CTC DMA2D_ISR_CTCIF
397 #define DMA2D_FLAG_CAE DMA2D_ISR_CAEIF
398 #define DMA2D_FLAG_TW DMA2D_ISR_TWIF
399 #define DMA2D_FLAG_TC DMA2D_ISR_TCIF
400 #define DMA2D_FLAG_TE DMA2D_ISR_TEIF
403 #define IS_DMA2D_GET_FLAG(FLAG) (((FLAG) == DMA2D_FLAG_CTC) || ((FLAG) == DMA2D_FLAG_CAE) || \
404 ((FLAG) == DMA2D_FLAG_TW) || ((FLAG) == DMA2D_FLAG_TC) || \
405 ((FLAG) == DMA2D_FLAG_TE) || ((FLAG) == DMA2D_FLAG_CE))
409 * @}
412 /** @defgroup DMA2D_DeadTime
413 * @{
416 #define DEADTIME ((uint32_t)0x000000FF)
418 #define IS_DMA2D_DEAD_TIME(DEAD_TIME) ((DEAD_TIME) <= DEADTIME)
421 #define LINE_WATERMARK DMA2D_LWR_LW
423 #define IS_DMA2D_LineWatermark(LineWatermark) ((LineWatermark) <= LINE_WATERMARK)
426 * @}
430 * @}
433 /* Exported macro ------------------------------------------------------------*/
434 /* Exported functions ------------------------------------------------------- */
436 /* Function used to set the DMA2D configuration to the default reset state *****/
437 void DMA2D_DeInit(void);
439 /* Initialization and Configuration functions *********************************/
440 void DMA2D_Init(DMA2D_InitTypeDef* DMA2D_InitStruct);
441 void DMA2D_StructInit(DMA2D_InitTypeDef* DMA2D_InitStruct);
442 void DMA2D_StartTransfer(void);
443 void DMA2D_AbortTransfer(void);
444 void DMA2D_Suspend(FunctionalState NewState);
445 void DMA2D_FGConfig(DMA2D_FG_InitTypeDef* DMA2D_FG_InitStruct);
446 void DMA2D_FG_StructInit(DMA2D_FG_InitTypeDef* DMA2D_FG_InitStruct);
447 void DMA2D_BGConfig(DMA2D_BG_InitTypeDef* DMA2D_BG_InitStruct);
448 void DMA2D_BG_StructInit(DMA2D_BG_InitTypeDef* DMA2D_BG_InitStruct);
449 void DMA2D_FGStart(FunctionalState NewState);
450 void DMA2D_BGStart(FunctionalState NewState);
451 void DMA2D_DeadTimeConfig(uint32_t DMA2D_DeadTime, FunctionalState NewState);
452 void DMA2D_LineWatermarkConfig(uint32_t DMA2D_LWatermarkConfig);
454 /* Interrupts and flags management functions **********************************/
455 void DMA2D_ITConfig(uint32_t DMA2D_IT, FunctionalState NewState);
456 FlagStatus DMA2D_GetFlagStatus(uint32_t DMA2D_FLAG);
457 void DMA2D_ClearFlag(uint32_t DMA2D_FLAG);
458 ITStatus DMA2D_GetITStatus(uint32_t DMA2D_IT);
459 void DMA2D_ClearITPendingBit(uint32_t DMA2D_IT);
461 #ifdef __cplusplus
463 #endif
465 #endif /* __STM32F4xx_DMA2D_H */
468 * @}
472 * @}
475 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/