RTEMS 6.1-rc2
Loading...
Searching...
No Matches
stm32h7xx_hal_ltdc.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_LTDC_H
21#define STM32H7xx_HAL_LTDC_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
30#if defined (LTDC)
31
42/* Exported types ------------------------------------------------------------*/
47#define MAX_LAYER 2U
48
52typedef struct
53{
54 uint8_t Blue;
57 uint8_t Green;
60 uint8_t Red;
63 uint8_t Reserved;
64} LTDC_ColorTypeDef;
65
69typedef struct
70{
71 uint32_t HSPolarity;
74 uint32_t VSPolarity;
77 uint32_t DEPolarity;
80 uint32_t PCPolarity;
83 uint32_t HorizontalSync;
87 uint32_t VerticalSync;
91 uint32_t AccumulatedHBP;
95 uint32_t AccumulatedVBP;
99 uint32_t AccumulatedActiveW;
103 uint32_t AccumulatedActiveH;
107 uint32_t TotalWidth;
111 uint32_t TotalHeigh;
115 LTDC_ColorTypeDef Backcolor;
116} LTDC_InitTypeDef;
117
121typedef struct
122{
123 uint32_t WindowX0;
127 uint32_t WindowX1;
131 uint32_t WindowY0;
135 uint32_t WindowY1;
139 uint32_t PixelFormat;
142 uint32_t Alpha;
146 uint32_t Alpha0;
150 uint32_t BlendingFactor1;
153 uint32_t BlendingFactor2;
156 uint32_t FBStartAdress;
158 uint32_t ImageWidth;
162 uint32_t ImageHeight;
166 LTDC_ColorTypeDef Backcolor;
167} LTDC_LayerCfgTypeDef;
168
172typedef enum
173{
174 HAL_LTDC_STATE_RESET = 0x00U,
175 HAL_LTDC_STATE_READY = 0x01U,
176 HAL_LTDC_STATE_BUSY = 0x02U,
177 HAL_LTDC_STATE_TIMEOUT = 0x03U,
178 HAL_LTDC_STATE_ERROR = 0x04U
179} HAL_LTDC_StateTypeDef;
180
184#if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
185typedef struct __LTDC_HandleTypeDef
186#else
187typedef struct
188#endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */
189{
190 LTDC_TypeDef *Instance;
192 LTDC_InitTypeDef Init;
194 LTDC_LayerCfgTypeDef LayerCfg[MAX_LAYER];
196 HAL_LockTypeDef Lock;
198 __IO HAL_LTDC_StateTypeDef State;
200 __IO uint32_t ErrorCode;
202#if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
203 void (* LineEventCallback)(struct __LTDC_HandleTypeDef *hltdc);
204 void (* ReloadEventCallback)(struct __LTDC_HandleTypeDef *hltdc);
205 void (* ErrorCallback)(struct __LTDC_HandleTypeDef *hltdc);
207 void (* MspInitCallback)(struct __LTDC_HandleTypeDef *hltdc);
208 void (* MspDeInitCallback)(struct __LTDC_HandleTypeDef *hltdc);
210#endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */
211
212
213} LTDC_HandleTypeDef;
214
215#if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
219typedef enum
220{
221 HAL_LTDC_MSPINIT_CB_ID = 0x00U,
222 HAL_LTDC_MSPDEINIT_CB_ID = 0x01U,
224 HAL_LTDC_LINE_EVENT_CB_ID = 0x02U,
225 HAL_LTDC_RELOAD_EVENT_CB_ID = 0x03U,
226 HAL_LTDC_ERROR_CB_ID = 0x04U
228} HAL_LTDC_CallbackIDTypeDef;
229
233typedef void (*pLTDC_CallbackTypeDef)(LTDC_HandleTypeDef *hltdc);
235#endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */
236
241/* Exported constants --------------------------------------------------------*/
251#define HAL_LTDC_ERROR_NONE 0x00000000U
252#define HAL_LTDC_ERROR_TE 0x00000001U
253#define HAL_LTDC_ERROR_FU 0x00000002U
254#define HAL_LTDC_ERROR_TIMEOUT 0x00000020U
255#if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
256#define HAL_LTDC_ERROR_INVALID_CALLBACK 0x00000040U
257#endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */
266#define LTDC_LAYER_1 0x00000000U
267#define LTDC_LAYER_2 0x00000001U
276#define LTDC_HSPOLARITY_AL 0x00000000U
277#define LTDC_HSPOLARITY_AH LTDC_GCR_HSPOL
286#define LTDC_VSPOLARITY_AL 0x00000000U
287#define LTDC_VSPOLARITY_AH LTDC_GCR_VSPOL
296#define LTDC_DEPOLARITY_AL 0x00000000U
297#define LTDC_DEPOLARITY_AH LTDC_GCR_DEPOL
306#define LTDC_PCPOLARITY_IPC 0x00000000U
307#define LTDC_PCPOLARITY_IIPC LTDC_GCR_PCPOL
316#define LTDC_HORIZONTALSYNC (LTDC_SSCR_HSW >> 16U)
317#define LTDC_VERTICALSYNC LTDC_SSCR_VSH
326#define LTDC_COLOR 0x000000FFU
335#define LTDC_BLENDING_FACTOR1_CA 0x00000400U
336#define LTDC_BLENDING_FACTOR1_PAxCA 0x00000600U
345#define LTDC_BLENDING_FACTOR2_CA 0x00000005U
346#define LTDC_BLENDING_FACTOR2_PAxCA 0x00000007U
355#define LTDC_PIXEL_FORMAT_ARGB8888 0x00000000U
356#define LTDC_PIXEL_FORMAT_RGB888 0x00000001U
357#define LTDC_PIXEL_FORMAT_RGB565 0x00000002U
358#define LTDC_PIXEL_FORMAT_ARGB1555 0x00000003U
359#define LTDC_PIXEL_FORMAT_ARGB4444 0x00000004U
360#define LTDC_PIXEL_FORMAT_L8 0x00000005U
361#define LTDC_PIXEL_FORMAT_AL44 0x00000006U
362#define LTDC_PIXEL_FORMAT_AL88 0x00000007U
371#define LTDC_ALPHA LTDC_LxCACR_CONSTA
380#define LTDC_STOPPOSITION (LTDC_LxWHPCR_WHSPPOS >> 16U)
381#define LTDC_STARTPOSITION LTDC_LxWHPCR_WHSTPOS
383#define LTDC_COLOR_FRAME_BUFFER LTDC_LxCFBLR_CFBLL
384#define LTDC_LINE_NUMBER LTDC_LxCFBLNR_CFBLNBR
393#define LTDC_IT_LI LTDC_IER_LIE
394#define LTDC_IT_FU LTDC_IER_FUIE
395#define LTDC_IT_TE LTDC_IER_TERRIE
396#define LTDC_IT_RR LTDC_IER_RRIE
405#define LTDC_FLAG_LI LTDC_ISR_LIF
406#define LTDC_FLAG_FU LTDC_ISR_FUIF
407#define LTDC_FLAG_TE LTDC_ISR_TERRIF
408#define LTDC_FLAG_RR LTDC_ISR_RRIF
417#define LTDC_RELOAD_IMMEDIATE LTDC_SRCR_IMR
418#define LTDC_RELOAD_VERTICAL_BLANKING LTDC_SRCR_VBR
427/* Exported macro ------------------------------------------------------------*/
437#if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
438#define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) do{ \
439 (__HANDLE__)->State = HAL_LTDC_STATE_RESET; \
440 (__HANDLE__)->MspInitCallback = NULL; \
441 (__HANDLE__)->MspDeInitCallback = NULL; \
442 } while(0)
443#else
444#define __HAL_LTDC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LTDC_STATE_RESET)
445#endif /*USE_HAL_LTDC_REGISTER_CALLBACKS */
446
452#define __HAL_LTDC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR |= LTDC_GCR_LTDCEN)
453
459#define __HAL_LTDC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->GCR &= ~(LTDC_GCR_LTDCEN))
460
468#define __HAL_LTDC_LAYER_ENABLE(__HANDLE__, __LAYER__) ((LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR\
469 |= (uint32_t)LTDC_LxCR_LEN)
470
478#define __HAL_LTDC_LAYER_DISABLE(__HANDLE__, __LAYER__) ((LTDC_LAYER((__HANDLE__), (__LAYER__)))->CR\
479 &= ~(uint32_t)LTDC_LxCR_LEN)
480
486#define __HAL_LTDC_RELOAD_IMMEDIATE_CONFIG(__HANDLE__) ((__HANDLE__)->Instance->SRCR |= LTDC_SRCR_IMR)
487
493#define __HAL_LTDC_VERTICAL_BLANKING_RELOAD_CONFIG(__HANDLE__) ((__HANDLE__)->Instance->SRCR |= LTDC_SRCR_VBR)
494
495/* Interrupt & Flag management */
507#define __HAL_LTDC_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ISR & (__FLAG__))
508
520#define __HAL_LTDC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
521
533#define __HAL_LTDC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
534
546#define __HAL_LTDC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
547
559#define __HAL_LTDC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__))
564/* Include LTDC HAL Extension module */
566
567/* Exported functions --------------------------------------------------------*/
574/* Initialization and de-initialization functions *****************************/
575HAL_StatusTypeDef HAL_LTDC_Init(LTDC_HandleTypeDef *hltdc);
576HAL_StatusTypeDef HAL_LTDC_DeInit(LTDC_HandleTypeDef *hltdc);
577void HAL_LTDC_MspInit(LTDC_HandleTypeDef *hltdc);
578void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc);
579void HAL_LTDC_ErrorCallback(LTDC_HandleTypeDef *hltdc);
580void HAL_LTDC_LineEventCallback(LTDC_HandleTypeDef *hltdc);
581void HAL_LTDC_ReloadEventCallback(LTDC_HandleTypeDef *hltdc);
582
583/* Callbacks Register/UnRegister functions ***********************************/
584#if (USE_HAL_LTDC_REGISTER_CALLBACKS == 1)
585HAL_StatusTypeDef HAL_LTDC_RegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID,
586 pLTDC_CallbackTypeDef pCallback);
587HAL_StatusTypeDef HAL_LTDC_UnRegisterCallback(LTDC_HandleTypeDef *hltdc, HAL_LTDC_CallbackIDTypeDef CallbackID);
588#endif /* USE_HAL_LTDC_REGISTER_CALLBACKS */
589
597/* IO operation functions *****************************************************/
598void HAL_LTDC_IRQHandler(LTDC_HandleTypeDef *hltdc);
606/* Peripheral Control functions ***********************************************/
607HAL_StatusTypeDef HAL_LTDC_ConfigLayer(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg, uint32_t LayerIdx);
608HAL_StatusTypeDef HAL_LTDC_SetWindowSize(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize, uint32_t LayerIdx);
609HAL_StatusTypeDef HAL_LTDC_SetWindowPosition(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0, uint32_t LayerIdx);
610HAL_StatusTypeDef HAL_LTDC_SetPixelFormat(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx);
611HAL_StatusTypeDef HAL_LTDC_SetAlpha(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx);
612HAL_StatusTypeDef HAL_LTDC_SetAddress(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx);
613HAL_StatusTypeDef HAL_LTDC_SetPitch(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx);
614HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx);
615HAL_StatusTypeDef HAL_LTDC_ConfigCLUT(LTDC_HandleTypeDef *hltdc, uint32_t *pCLUT, uint32_t CLUTSize, uint32_t LayerIdx);
616HAL_StatusTypeDef HAL_LTDC_EnableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
617HAL_StatusTypeDef HAL_LTDC_DisableColorKeying(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
618HAL_StatusTypeDef HAL_LTDC_EnableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
619HAL_StatusTypeDef HAL_LTDC_DisableCLUT(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
620HAL_StatusTypeDef HAL_LTDC_ProgramLineEvent(LTDC_HandleTypeDef *hltdc, uint32_t Line);
621HAL_StatusTypeDef HAL_LTDC_EnableDither(LTDC_HandleTypeDef *hltdc);
622HAL_StatusTypeDef HAL_LTDC_DisableDither(LTDC_HandleTypeDef *hltdc);
623HAL_StatusTypeDef HAL_LTDC_Reload(LTDC_HandleTypeDef *hltdc, uint32_t ReloadType);
624HAL_StatusTypeDef HAL_LTDC_ConfigLayer_NoReload(LTDC_HandleTypeDef *hltdc, LTDC_LayerCfgTypeDef *pLayerCfg,
625 uint32_t LayerIdx);
626HAL_StatusTypeDef HAL_LTDC_SetWindowSize_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t XSize, uint32_t YSize,
627 uint32_t LayerIdx);
628HAL_StatusTypeDef HAL_LTDC_SetWindowPosition_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t X0, uint32_t Y0,
629 uint32_t LayerIdx);
630HAL_StatusTypeDef HAL_LTDC_SetPixelFormat_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Pixelformat, uint32_t LayerIdx);
631HAL_StatusTypeDef HAL_LTDC_SetAlpha_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Alpha, uint32_t LayerIdx);
632HAL_StatusTypeDef HAL_LTDC_SetAddress_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t Address, uint32_t LayerIdx);
633HAL_StatusTypeDef HAL_LTDC_SetPitch_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LinePitchInPixels, uint32_t LayerIdx);
634HAL_StatusTypeDef HAL_LTDC_ConfigColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t RGBValue, uint32_t LayerIdx);
635HAL_StatusTypeDef HAL_LTDC_EnableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
636HAL_StatusTypeDef HAL_LTDC_DisableColorKeying_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
637HAL_StatusTypeDef HAL_LTDC_EnableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
638HAL_StatusTypeDef HAL_LTDC_DisableCLUT_NoReload(LTDC_HandleTypeDef *hltdc, uint32_t LayerIdx);
639
647/* Peripheral State functions *************************************************/
648HAL_LTDC_StateTypeDef HAL_LTDC_GetState(LTDC_HandleTypeDef *hltdc);
649uint32_t HAL_LTDC_GetError(LTDC_HandleTypeDef *hltdc);
658/* Private types -------------------------------------------------------------*/
659/* Private variables ---------------------------------------------------------*/
660/* Private constants ---------------------------------------------------------*/
661/* Private macros ------------------------------------------------------------*/
666#define LTDC_LAYER(__HANDLE__, __LAYER__) ((LTDC_Layer_TypeDef *)((uint32_t)(\
667 ((uint32_t)((__HANDLE__)->Instance))\
668 + 0x84U + (0x80U*(__LAYER__)))))
669#define IS_LTDC_LAYER(__LAYER__) ((__LAYER__) < MAX_LAYER)
670#define IS_LTDC_HSPOL(__HSPOL__) (((__HSPOL__) == LTDC_HSPOLARITY_AL)\
671 || ((__HSPOL__) == LTDC_HSPOLARITY_AH))
672#define IS_LTDC_VSPOL(__VSPOL__) (((__VSPOL__) == LTDC_VSPOLARITY_AL)\
673 || ((__VSPOL__) == LTDC_VSPOLARITY_AH))
674#define IS_LTDC_DEPOL(__DEPOL__) (((__DEPOL__) == LTDC_DEPOLARITY_AL)\
675 || ((__DEPOL__) == LTDC_DEPOLARITY_AH))
676#define IS_LTDC_PCPOL(__PCPOL__) (((__PCPOL__) == LTDC_PCPOLARITY_IPC)\
677 || ((__PCPOL__) == LTDC_PCPOLARITY_IIPC))
678#define IS_LTDC_HSYNC(__HSYNC__) ((__HSYNC__) <= LTDC_HORIZONTALSYNC)
679#define IS_LTDC_VSYNC(__VSYNC__) ((__VSYNC__) <= LTDC_VERTICALSYNC)
680#define IS_LTDC_AHBP(__AHBP__) ((__AHBP__) <= LTDC_HORIZONTALSYNC)
681#define IS_LTDC_AVBP(__AVBP__) ((__AVBP__) <= LTDC_VERTICALSYNC)
682#define IS_LTDC_AAW(__AAW__) ((__AAW__) <= LTDC_HORIZONTALSYNC)
683#define IS_LTDC_AAH(__AAH__) ((__AAH__) <= LTDC_VERTICALSYNC)
684#define IS_LTDC_TOTALW(__TOTALW__) ((__TOTALW__) <= LTDC_HORIZONTALSYNC)
685#define IS_LTDC_TOTALH(__TOTALH__) ((__TOTALH__) <= LTDC_VERTICALSYNC)
686#define IS_LTDC_BLUEVALUE(__BBLUE__) ((__BBLUE__) <= LTDC_COLOR)
687#define IS_LTDC_GREENVALUE(__BGREEN__) ((__BGREEN__) <= LTDC_COLOR)
688#define IS_LTDC_REDVALUE(__BRED__) ((__BRED__) <= LTDC_COLOR)
689#define IS_LTDC_BLENDING_FACTOR1(__BLENDING_FACTOR1__) (((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR1_CA) || \
690 ((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR1_PAxCA))
691#define IS_LTDC_BLENDING_FACTOR2(__BLENDING_FACTOR1__) (((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR2_CA) || \
692 ((__BLENDING_FACTOR1__) == LTDC_BLENDING_FACTOR2_PAxCA))
693#define IS_LTDC_PIXEL_FORMAT(__PIXEL_FORMAT__) (((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB8888) || \
694 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_RGB888) || \
695 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_RGB565) || \
696 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB1555) || \
697 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_ARGB4444) || \
698 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_L8) || \
699 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_AL44) || \
700 ((__PIXEL_FORMAT__) == LTDC_PIXEL_FORMAT_AL88))
701#define IS_LTDC_ALPHA(__ALPHA__) ((__ALPHA__) <= LTDC_ALPHA)
702#define IS_LTDC_HCONFIGST(__HCONFIGST__) ((__HCONFIGST__) <= LTDC_STARTPOSITION)
703#define IS_LTDC_HCONFIGSP(__HCONFIGSP__) ((__HCONFIGSP__) <= LTDC_STOPPOSITION)
704#define IS_LTDC_VCONFIGST(__VCONFIGST__) ((__VCONFIGST__) <= LTDC_STARTPOSITION)
705#define IS_LTDC_VCONFIGSP(__VCONFIGSP__) ((__VCONFIGSP__) <= LTDC_STOPPOSITION)
706#define IS_LTDC_CFBP(__CFBP__) ((__CFBP__) <= LTDC_COLOR_FRAME_BUFFER)
707#define IS_LTDC_CFBLL(__CFBLL__) ((__CFBLL__) <= LTDC_COLOR_FRAME_BUFFER)
708#define IS_LTDC_CFBLNBR(__CFBLNBR__) ((__CFBLNBR__) <= LTDC_LINE_NUMBER)
709#define IS_LTDC_LIPOS(__LIPOS__) ((__LIPOS__) <= 0x7FFU)
710#define IS_LTDC_RELOAD(__RELOADTYPE__) (((__RELOADTYPE__) == LTDC_RELOAD_IMMEDIATE) || \
711 ((__RELOADTYPE__) == LTDC_RELOAD_VERTICAL_BLANKING))
716/* Private functions ---------------------------------------------------------*/
734#endif /* LTDC */
735
736#ifdef __cplusplus
737}
738#endif
739
740#endif /* STM32H7xx_HAL_LTDC_H */
741
#define __IO
Definition: core_cm4.h:239
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
Header file of LTDC HAL Extension module.
LCD-TFT Display Controller.
Definition: stm32h723xx.h:1166