1 /**
2   ******************************************************************************
3   * @file    stm32u5xx_hal_gfxtim.h
4   * @author  MCD Application Team
5   * @brief   Header file of GFXTIM HAL module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2021 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32U5xx_HAL_GFXTIM_H
21 #define STM32U5xx_HAL_GFXTIM_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32u5xx_hal_def.h"
29 
30 #if defined (GFXTIM)
31 
32 /** @addtogroup STM32U5xx_HAL_Driver
33   * @{
34   */
35 
36 /** @addtogroup GFXTIM
37   * @{
38   */
39 
40 /* Exported types ------------------------------------------------------------*/
41 /** @defgroup GFXTIM_Exported_Types  GFXTIM Exported Types
42   * @{
43   */
44 
45 /**
46   * @brief  HAL GFXTIM states definition
47   */
48 typedef enum
49 {
50   HAL_GFXTIM_STATE_RESET       = 0x00U,      /*!< GFXTIM not initialized */
51   HAL_GFXTIM_STATE_READY       = 0x01U,      /*!< GFXTIM initialized and ready for use */
52   HAL_GFXTIM_STATE_ERROR       = 0xFFU       /*!< GFXTIM state error */
53 } HAL_GFXTIM_StateTypeDef;
54 
55 /**
56   * @brief  GFXTIM initialization structure definition
57   */
58 typedef struct
59 {
60   uint32_t SynchroSrc;               /*!< Synchronization signals (HSYNC and VSYNC) sources.
61                                      This parameter can be a value of @ref GFXTIM_SynchroSrc */
62   uint32_t TearingEffectSrc;         /*!< Tearing effect source
63                                      This parameter can be a value of @ref GFXTIM_TearingEffectSrc */
64   uint32_t TearingEffectPolarity;    /*!< Tearing effect source
65                                      This parameter can be a value of @ref GFXTIM_TearingEffectPolarity */
66   uint32_t TearingEffectInterrupt;   /*!< Tearing effect interrupt Enable or Disable
67                                      This parameter can be a value of @ref GFXTIM_Interrupt */
68 } GFXTIM_InitTypeDef;
69 
70 /**
71   * @brief  GFXTIM handle structure definition
72   */
73 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1)
74 typedef struct __GFXTIM_HandleTypeDef
75 #else
76 typedef struct
77 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
78 {
79   GFXTIM_TypeDef                    *Instance;             /*!< GFXTIM instance */
80   __IO HAL_GFXTIM_StateTypeDef      State;                 /*!< GFXTIM state */
81   __IO uint32_t                     ErrorCode;             /*!< GFXTIM error code */
82   GFXTIM_InitTypeDef                Init;                  /*!< GFXTIM initialization */
83 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1)
84   void (*HAL_GFXTIM_AbsoluteTimer_AFCC1Callback)(struct __GFXTIM_HandleTypeDef *hgfxtim);    /*!< GFXTIM Absolute frame counter compare 1 callback */
85   void (*HAL_GFXTIM_AbsoluteTimer_AFCOFCallback)(struct __GFXTIM_HandleTypeDef *hgfxtim);    /*!< GFXTIM Absolute frame counter overflow callback */
86   void (*HAL_GFXTIM_AbsoluteTimer_ALCC1Callback)(struct __GFXTIM_HandleTypeDef *hgfxtim);    /*!< GFXTIM Absolute line counter compare 1 callback */
87   void (*HAL_GFXTIM_AbsoluteTimer_ALCC2Callback)(struct __GFXTIM_HandleTypeDef *hgfxtim);    /*!< GFXTIM Absolute line counter compare 2 callback */
88   void (*HAL_GFXTIM_AbsoluteTimer_ALCOFCallback)(struct __GFXTIM_HandleTypeDef *hgfxtim);    /*!< GFXTIM Absolute line counter overflow callback */
89   void (*HAL_GFXTIM_RelativeTimer_RFC1RCallback)(struct __GFXTIM_HandleTypeDef *hgfxtim);    /*!< GFXTIM Relative frame counter 1 reload callback */
90   void (*HAL_GFXTIM_RelativeTimer_RFC2RCallback)(struct __GFXTIM_HandleTypeDef *hgfxtim);    /*!< GFXTIM Relative frame counter 2 reload callback */
91   void (*HAL_GFXTIM_TECallback)(struct __GFXTIM_HandleTypeDef *hgfxtim);                     /*!< GFXTIM Tearing effect callback */
92   void (*HAL_GFXTIM_EventGenerator_EV1Callback)(struct __GFXTIM_HandleTypeDef *hgfxtim);     /*!< GFXTIM Event events 1 callback */
93   void (*HAL_GFXTIM_EventGenerator_EV2Callback)(struct __GFXTIM_HandleTypeDef *hgfxtim);     /*!< GFXTIM Event events 2 callback */
94   void (*HAL_GFXTIM_EventGenerator_EV3Callback)(struct __GFXTIM_HandleTypeDef *hgfxtim);     /*!< GFXTIM Event events 3 callback */
95   void (*HAL_GFXTIM_EventGenerator_EV4Callback)(struct __GFXTIM_HandleTypeDef *hgfxtim);     /*!< GFXTIM Event events 4 callback */
96   void (*HAL_GFXTIM_WatchdogTimer_AlarmCallback)(struct __GFXTIM_HandleTypeDef *hgfxtim);    /*!< GFXTIM Watchdog alarm callback */
97   void (*HAL_GFXTIM_WatchdogTimer_PreAlarmCallback)(struct __GFXTIM_HandleTypeDef *hgfxtim); /*!< GFXTIM Watchdog pre alarm callback */
98   void (*ErrorCallback)(struct __GFXTIM_HandleTypeDef *hgfxtim);                             /*!< GFXTIM error callback */
99   void (*MspInitCallback)(struct __GFXTIM_HandleTypeDef *hgfxtim);                           /*!< GFXTIM MSP initialization user callback */
100   void (*MspDeInitCallback)(struct __GFXTIM_HandleTypeDef *hgfxtim);                         /*!< GFXTIM MSP de-initialization user callback */
101 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
102 } GFXTIM_HandleTypeDef;
103 
104 
105 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1)
106 /**
107   * @brief  GFXTIM callback ID enumeration definition
108   */
109 typedef enum
110 {
111   HAL_GFXTIM_AFC_COMPARE1_CB_ID   =  1U,    /*!< GFXTIM Absolute frame counter compare 1 callback ID */
112   HAL_GFXTIM_AFC_OVERFLOW_CB_ID   =  2U,    /*!< GFXTIM Absolute frame counter overflow callback ID */
113   HAL_GFXTIM_ALC_COMPARE1_CB_ID   =  3U,    /*!< GFXTIM Absolute line counter compare 1 callback ID */
114   HAL_GFXTIM_ALC_COMPARE2_CB_ID   =  4U,    /*!< GFXTIM Absolute line counter compare 2 callback ID */
115   HAL_GFXTIM_ALC_OVERFLOW_CB_ID   =  5U,    /*!< GFXTIM Absolute line counter overflow callback ID */
116   HAL_GFXTIM_RFC1_RELOAD_CB_ID    =  6U,    /*!< GFXTIM Relative frame counter 1 reload callback ID */
117   HAL_GFXTIM_RFC2_RELOAD_CB_ID    =  7U,    /*!< GFXTIM Relative frame counter 2 reload callback ID */
118   HAL_GFXTIM_TE_CB_ID             =  8U,    /*!< GFXTIM External tearing effect callback ID */
119   HAL_GFXTIM_EVENT1_CB_ID         =  9U,    /*!< GFXTIM Event events 1 callback ID */
120   HAL_GFXTIM_EVENT2_CB_ID         = 10U,    /*!< GFXTIM Event events 2 callback ID */
121   HAL_GFXTIM_EVENT3_CB_ID         = 11U,    /*!< GFXTIM Event events 3 callback ID */
122   HAL_GFXTIM_EVENT4_CB_ID         = 12U,    /*!< GFXTIM Event events 4 callback ID */
123   HAL_GFXTIM_WDG_ALARM_CB_ID      = 13U,    /*!< GFXTIM Watchdog alarm callback ID */
124   HAL_GFXTIM_WDG_PREALARM_CB_ID   = 14U,    /*!< GFXTIM Watchdog pre alarm callback ID */
125   HAL_GFXTIM_ERROR_CB_ID          = 15U,    /*!< GFXTIM error callback ID */
126   HAL_GFXTIM_MSP_INIT_CB_ID       = 16U,    /*!< GFXTIM MSP initialization user callback ID */
127   HAL_GFXTIM_MSP_DEINIT_CB_ID     = 17U,    /*!< GFXTIM MSP de-initialization user callback ID */
128 } HAL_GFXTIM_CallbackIDTypeDef;
129 
130 /**
131   * @brief  GFXTIM callback pointers definition
132   */
133 typedef void (*pGFXTIM_CallbackTypeDef)(GFXTIM_HandleTypeDef *hgfxtim);
134 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
135 
136 
137 
138 
139 /**
140   * @brief  GFXTIM clock generator structure definition
141   */
142 typedef struct
143 {
144   uint32_t LCCHwReloadSrc;      /*!< Line Clock Counter hardware reload source
145                                 This parameter can be a value of @ref GFXTIM_LCCHwReloadSrc */
146 
147   uint32_t LCCReloadValue;      /*!< Line Clock Counter reload value (22 bits)
148                                 This parameter must be a number between Min_Data = 1 and Max_Data = 4194303 */
149 
150   uint32_t LCCClockSrc;         /*!< Line Clock Counter Clock Source
151                                 This parameter can be a value of @ref GFXTIM_LCCClockSrc */
152 
153   uint32_t LineClockSrc;        /*!< Line Clock Source
154                                 This parameter can be a value of @ref GFXTIM_LineClockSrc */
155 
156   uint32_t FCCHwReloadSrc;      /*!< Frame Clock Counter hardware reload source
157                                 This parameter can be a value of @ref GFXTIM_FCCHwReloadSrc */
158 
159   uint32_t FCCReloadValue;      /*!< Frame Clock Counter reload value (12 bits)
160                                 This parameter must be a number between Min_Data = 1 and Max_Data = 4095 */
161 
162   uint32_t FCCClockSrc;         /*!< Frame Clock Counter Clock Source
163                                 This parameter can be a value of @ref GFXTIM_FCCClockSrc */
164 
165   uint32_t FrameClockSrc;       /*!< Frame Clock Source
166                                 This parameter can be a value of @ref GFXTIM_FrameClockSrc */
167 
168   uint32_t LineClockCalib;      /*!< Debug purpose
169                                 This parameter can be a value of @ref GFXTIM_LineClockCalib */
170 
171   uint32_t FrameClockCalib;     /*!< Debug purpose
172                                 This parameter can be a value of @ref GFXTIM_FrameClockCalib */
173 } GFXTIM_ClockGeneratorConfigTypeDef;
174 
175 /**
176   * @brief  GFXTIM absolute timer configuration structure
177   */
178 typedef struct
179 {
180   uint32_t FrameCompare1Value;      /*!< Absolute Frame Compare 1 value (20 bits)
181                                     This parameter must be a number between 1 and 1048575 */
182 
183   uint32_t FrameCounterValue;       /*!< Absolute Frame Counter initial value (20 bits)
184                                     This parameter must be a number between 1 and 1048575 */
185 
186   uint32_t FrameOverflowInterrupt;  /*!< Absolute Frame Counter Overflow Interrupt Enable or Disable
187                                     This parameter can be a value of @ref GFXTIM_Interrupt */
188 
189   uint32_t FrameCompare1Interrupt;  /*!< Absolute Frame Compare 1 Interrupt Enable or Disable
190                                     This parameter can be a value of @ref GFXTIM_Interrupt */
191 
192   uint32_t LineCompare1Value;       /*!< Absolute Line Compare 1 value (12 bits)
193                                     This parameter must be a number between 1 and 4095 */
194 
195   uint32_t LineCompare2Value;       /*!< Absolute Line Compare 2 value (12 bits)
196                                     This parameter must be a number between 1 and 4095 */
197 
198   uint32_t LineCounterValue;        /*!< Absolute Line Counter value (12 bits)
199                                     This parameter must be a number between 1 and 4095 */
200 
201   uint32_t LineOverflowInterrupt;   /*!< Absolute Line Counter Overflow Interrupt Enable or Disable
202                                     This parameter can be a value of @ref GFXTIM_Interrupt */
203 
204   uint32_t LineCompare1Interrupt;   /*!< Absolute Line Compare 1 Interrupt Enable or Disable
205                                     This parameter can be a value of @ref GFXTIM_Interrupt */
206 
207   uint32_t LineCompare2Interrupt;   /*!< Absolute Line Compare 2 Interrupt Enable or Disable
208                                     This parameter can be a value of @ref GFXTIM_Interrupt */
209 } GFXTIM_AbsoluteTimerConfigTypeDef;
210 
211 
212 /**
213   * @brief  GFXTIM relative timer configuration structure
214   */
215 typedef struct
216 {
217   uint32_t AutoReloadValue;      /*!< Auto reload value (12 bits)
218                                  This parameter must be a number between 1 and 4095 */
219 
220   uint32_t CounterMode;          /*!< Counter Mode
221                                  This parameter can be a value of GFXTIM_RelativeCounterMode */
222   uint32_t ReloadInterrupt;      /*!< Relative Frame Counter Reload Interrupt Enable or Disable
223                                  This parameter can be a value of @ref GFXTIM_Interrupt */
224 } GFXTIM_RelativeTimerConfigTypeDef;
225 
226 
227 /**
228   * @brief  GFXTIM event generator configuration structure
229   */
230 typedef struct
231 {
232   uint32_t LineEvent;          /*!< Line event selection
233                                This parameter can be a value of GFXTIM_EventLine */
234 
235   uint32_t FrameEvent;         /*!< Frmae event selection
236                                This parameter can be a value of GFXTIM_EventFrame */
237 
238   uint32_t EventInterrupt;     /*!< Event interrupt Enable or Disable
239                                This parameter can be a value of @ref GFXTIM_Interrupt */
240 } GFXTIM_EventGeneratorConfigTypeDef;
241 
242 /**
243   * @brief  GFXTIM watchdog configuration structure
244   */
245 typedef struct
246 {
247   uint32_t ClockSrc;          /*!< Clock source
248                               This parameter can be a value of GFXTIM_WatchdogClockSrc */
249 
250   uint32_t AutoReloadValue;   /*!< Reload value (16 bits)
251                               This parameter must be a number between 1 and 65535 */
252 
253   uint32_t HwReloadConfig;    /*!< Hardware reload configuration
254                               This parameter can be a value of GFXTIM_WatchdogHwReloadConfig */
255 
256   uint32_t PreAlarmValue;     /*!< Pre-alarm value (16 bits)
257                               This parameter must be a number between 1 and 65535 */
258 
259   uint32_t AlarmInterrupt;    /*!< Interrupt Enable or Disable when watchdog counter reaches 0
260                               This parameter can be a value of @ref GFXTIM_Interrupt */
261 
262   uint32_t PreAlarmInterrupt; /*!< Interrupt Enable or Disable when watchdog counter reaches pre-alarm value
263                                This parameter can be a value of @ref GFXTIM_Interrupt */
264 } GFXTIM_WatchdogConfigTypeDef;
265 
266 /**
267   * @}
268   */
269 
270 /* Exported constants --------------------------------------------------------*/
271 /** @defgroup GFXTIM_Exported_Constants GFXTIM Exported Constants
272   * @{
273   */
274 
275 /** @defgroup GFXTIM_ErrorCode GFXTIM Error Code
276   * @{
277   */
278 #define GFXTIM_ERROR_NONE                      0U /*!< No error */
279 #define GFXTIM_ERROR_STATE                     1U /*!< State error */
280 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1)
281 #define GFXTIM_ERROR_INVALID_CALLBACK          2U /*!< Invalid callback error occurs */
282 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
283 /**
284   * @}
285   */
286 
287 /** @defgroup GFXTIM_Interrupt GFXTIM Interrupt
288   * @{
289   */
290 #define GFXTIM_IT_DISABLE                   0U    /*!< gfxtim_interrupt disable */
291 #define GFXTIM_IT_ENABLE                    1U    /*!< gfxtim_interrupt enable */
292 
293 /**
294   * @}
295   */
296 
297 /** @defgroup GFXTIM_SynchroSrc GFXTIM Synchronization Source
298   * @{
299   */
300 #define GFXTIM_SYNC_SRC_HSYNC_VSYNC_0    0U                                       /*!< gfxtim_hsync[0] and gfxtim_vsync[0] are used as synchronization source */
301 #define GFXTIM_SYNC_SRC_HSYNC_VSYNC_1    GFXTIM_CR_SYNCS_0                        /*!< gfxtim_hsync[1] and gfxtim_vsync[1] are used as synchronization source */
302 #define GFXTIM_SYNC_SRC_HSYNC_VSYNC_2    GFXTIM_CR_SYNCS_1                        /*!< gfxtim_hsync[2] and gfxtim_vsync[2] are used as synchronization source */
303 #define GFXTIM_SYNC_SRC_HSYNC_VSYNC_3    (GFXTIM_CR_SYNCS_0 | GFXTIM_CR_SYNCS_1)  /*!< gfxtim_hsync[3] and gfxtim_vsync[3] are used as synchronization source */
304 /**
305   * @}
306   */
307 
308 /** @defgroup GFXTIM_TearingEffectSrc GFXTIM Tearing Effect Source
309   * @{
310   */
311 #define GFXTIM_TE_SRC_GPIO         0U                                                    /*!< Input pad rising */
312 #define GFXTIM_TE_SRC_ITE          GFXTIM_CR_TES_0                                       /*!< gfxtim_ite rising */
313 #define GFXTIM_TE_SRC_HSYNC        GFXTIM_CR_TES_1                                       /*!< HSYNC (see SynchroSrc) rising */
314 #define GFXTIM_TE_SRC_VSYNC        (GFXTIM_CR_TES_0 | GFXTIM_CR_TES_1)                   /*!< VSYNC (see SynchroSrc) rising  */
315 /**
316   * @}
317   */
318 
319 /** @defgroup GFXTIM_TearingEffectPolarity GFXTIM Tearing Effect Polarity
320   * @{
321   */
322 #define GFXTIM_TE_RISING_EDGE           0U                  /*!< Tearing Effect active on rizing edge */
323 #define GFXTIM_TE_FALLING_EDGE          GFXTIM_CR_TEPOL     /*!< Tearing Effect active on falling edge */
324 /**
325   * @}
326   */
327 
328 /** @defgroup GFXTIM_LCCHwReloadSrc GFXTIM Line Clock Counter Hardware Reload Source
329   * @{
330   */
331 #define GFXTIM_LCC_HW_RELOAD_SRC_NONE           0U                                                                    /*!< No hardware reload */
332 #define GFXTIM_LCC_HW_RELOAD_SRC_FCC_UNDERFLOW  GFXTIM_CGCR_LCCHRS_0                                                  /*!< FCC underflow */
333 #define GFXTIM_LCC_HW_RELOAD_SRC_HSYNC_RISING   GFXTIM_CGCR_LCCHRS_1                                                  /*!< HSYNC rising */
334 #define GFXTIM_LCC_HW_RELOAD_SRC_HSYNC_FALLING  (GFXTIM_CGCR_LCCHRS_0 | GFXTIM_CGCR_LCCHRS_1)                         /*!< HSYNC falling */
335 #define GFXTIM_LCC_HW_RELOAD_SRC_VSYNC_RISING   GFXTIM_CGCR_LCCHRS_2                                                  /*!< VSYNC rising */
336 #define GFXTIM_LCC_HW_RELOAD_SRC_VSYNC_FALLING  (GFXTIM_CGCR_LCCHRS_2 | GFXTIM_CGCR_LCCHRS_0)                         /*!< VSYNC falling */
337 #define GFXTIM_LCC_HW_RELOAD_SRC_TE_RISING      (GFXTIM_CGCR_LCCHRS_2 | GFXTIM_CGCR_LCCHRS_1)                         /*!< TE rising */
338 #define GFXTIM_LCC_HW_RELOAD_SRC_TE_FALLING     (GFXTIM_CGCR_LCCHRS_2 | GFXTIM_CGCR_LCCHRS_1 | GFXTIM_CGCR_LCCHRS_0)  /*!< TE falling */
339 /**
340   * @}
341   */
342 
343 /** @defgroup GFXTIM_LCCClockSrc GFXTIM Line Clock Counter Clock Source
344   * @{
345   */
346 #define GFXTIM_LCC_CLK_SRC_DISABLE    0U                 /*!< Disable line clock counter */
347 #define GFXTIM_LCC_CLK_SRC_SYSCLOCK   GFXTIM_CGCR_LCCCS  /*!< System clock as line clock counter source*/
348 /**
349   * @}
350   */
351 
352 /** @defgroup GFXTIM_LineClockSrc GFXTIM Line Clock Source
353   * @{
354   */
355 #define GFXTIM_LINE_CLK_SRC_LCC_UNDERFLOW   0U                                                          /*!< Line Clock Counter underflow */
356 #define GFXTIM_LINE_CLK_SRC_FCC_UNDERFLOW   GFXTIM_CGCR_LCS_0                                           /*!< Frame Clock Counter underflow */
357 #define GFXTIM_LINE_CLK_SRC_HSYNC_RISING    GFXTIM_CGCR_LCS_1                                           /*!< HSYNC rising edge */
358 #define GFXTIM_LINE_CLK_SRC_HSYNC_FALLING   (GFXTIM_CGCR_LCS_0 | GFXTIM_CGCR_LCS_1)                     /*!< HSYNC falling edge*/
359 #define GFXTIM_LINE_CLK_SRC_VSYNC_RISING    GFXTIM_CGCR_LCS_2                                           /*!< VSYNC rising edge*/
360 #define GFXTIM_LINE_CLK_SRC_VSYNC_FALLING   (GFXTIM_CGCR_LCS_2 | GFXTIM_CGCR_LCS_0)                     /*!< VSYNC falling edge*/
361 #define GFXTIM_LINE_CLK_SRC_TE_RISING       (GFXTIM_CGCR_LCS_2 | GFXTIM_CGCR_LCS_1)                     /*!< TE rising edge*/
362 #define GFXTIM_LINE_CLK_SRC_TE_FALLING      (GFXTIM_CGCR_LCS_2 | GFXTIM_CGCR_LCS_1 | GFXTIM_CGCR_LCS_0) /*!< TE falling edge*/
363 /**
364   * @}
365   */
366 
367 /** @defgroup GFXTIM_FCCHwReloadSrc GFXTIM Frame Clock Counter Hardware Reload source
368   * @{
369   */
370 #define GFXTIM_FCC_HW_RELOAD_SRC_NONE           0U                                                                   /*!< No hardware reload */
371 #define GFXTIM_FCC_HW_RELOAD_SRC_LCC_UNDERFLOW  GFXTIM_CGCR_FCCHRS_0                                                 /*!< Line Clock Counter underflow */
372 #define GFXTIM_FCC_HW_RELOAD_SRC_HSYNC_RISING   GFXTIM_CGCR_FCCHRS_1                                                 /*!< HSYNC rising edge */
373 #define GFXTIM_FCC_HW_RELOAD_SRC_HSYNC_FALLING  (GFXTIM_CGCR_FCCHRS_0 | GFXTIM_CGCR_FCCHRS_1)                        /*!< HSYNC falling edge */
374 #define GFXTIM_FCC_HW_RELOAD_SRC_VSYNC_RISING   GFXTIM_CGCR_FCCHRS_2                                                 /*!< VSYNC rising edge */
375 #define GFXTIM_FCC_HW_RELOAD_SRC_VSYNC_FALLING  (GFXTIM_CGCR_FCCHRS_2 | GFXTIM_CGCR_FCCHRS_0)                        /*!< VSYNC falling edge */
376 #define GFXTIM_FCC_HW_RELOAD_SRC_TE_RISING      (GFXTIM_CGCR_FCCHRS_2 | GFXTIM_CGCR_FCCHRS_1)                        /*!< TE rising edge */
377 #define GFXTIM_FCC_HW_RELOAD_SRC_TE_FALLING     (GFXTIM_CGCR_FCCHRS_2 | GFXTIM_CGCR_FCCHRS_1 | GFXTIM_CGCR_FCCHRS_0) /*!< TE falling edge */
378 /**
379   * @}
380   */
381 
382 /** @defgroup GFXTIM_FCCClockSrc GFXTIM Frame CLock Counter Clock Source
383   * @{
384   */
385 #define GFXTIM_FCC_CLK_SRC_DISABLE         0U                                                                /*!< Disable */
386 #define GFXTIM_FCC_CLK_SRC_LCC_UNDERFLOW   GFXTIM_CGCR_FCCCS_0                                               /*!< Line Clock Counter underflow */
387 #define GFXTIM_FCC_CLK_SRC_HSYNC_RISING    GFXTIM_CGCR_FCCCS_1                                               /*!< HSYNC rising edge */
388 #define GFXTIM_FCC_CLK_SRC_HSYNC_FALLING   (GFXTIM_CGCR_FCCCS_0 | GFXTIM_CGCR_FCCCS_1)                       /*!< HSYNC falling edge */
389 #define GFXTIM_FCC_CLK_SRC_VSYNC_RISING    GFXTIM_CGCR_FCCCS_2                                               /*!< VSYNC rising edge */
390 #define GFXTIM_FCC_CLK_SRC_VSYNC_FALLING   (GFXTIM_CGCR_FCCCS_2 | GFXTIM_CGCR_FCCCS_0)                       /*!< VSYNC falling edge */
391 #define GFXTIM_FCC_CLK_SRC_TE_RISING       (GFXTIM_CGCR_FCCCS_2 | GFXTIM_CGCR_FCCCS_1)                       /*!< TE rising edge */
392 #define GFXTIM_FCC_CLK_SRC_TE_FALLING      (GFXTIM_CGCR_FCCCS_2 | GFXTIM_CGCR_FCCCS_1 | GFXTIM_CGCR_FCCCS_0) /*!< TE falling edge */
393 /**
394   * @}
395   */
396 
397 /** @defgroup GFXTIM_FrameClockSrc GFXTIM GFXTIM  Frame Clock Source
398   * @{
399   */
400 #define GFXTIM_FRAME_CLK_SRC_LCC_UNDERFLOW   0U                                                          /*!< Line Clock Counter underflow */
401 #define GFXTIM_FRAME_CLK_SRC_FCC_UNDERFLOW   GFXTIM_CGCR_FCS_0                                           /*!< Frame Clock Counter underflow */
402 #define GFXTIM_FRAME_CLK_SRC_HSYNC_RISING    GFXTIM_CGCR_FCS_1                                           /*!< HSYNC rising edge */
403 #define GFXTIM_FRAME_CLK_SRC_HSYNC_FALLING   (GFXTIM_CGCR_FCS_0 | GFXTIM_CGCR_FCS_1)                     /*!< HSYNC falling edge */
404 #define GFXTIM_FRAME_CLK_SRC_VSYNC_RISING    GFXTIM_CGCR_FCS_2                                           /*!< VSYNC rising edge */
405 #define GFXTIM_FRAME_CLK_SRC_VSYNC_FALLING   (GFXTIM_CGCR_FCS_2 | GFXTIM_CGCR_FCS_0)                     /*!< VSYNC falling edge */
406 #define GFXTIM_FRAME_CLK_SRC_TE_RISING       (GFXTIM_CGCR_FCS_2 | GFXTIM_CGCR_FCS_1)                     /*!< TE rising edge */
407 #define GFXTIM_FRAME_CLK_SRC_TE_FALLING      (GFXTIM_CGCR_FCS_2 | GFXTIM_CGCR_FCS_1 | GFXTIM_CGCR_FCS_0) /*!< TE falling edge */
408 /**
409   * @}
410   */
411 
412 /** @defgroup GFXTIM_LineClockCalib GFXTIM Line Clock Calibration Output
413   * @{
414   */
415 #define GFXTIM_LINE_CLK_CALIB_DISABLE   0U               /*!< Disable Line clock calibration */
416 #define GFXTIM_LINE_CLK_CALIB_ENABLE    GFXTIM_CR_LCCOE  /*!< Enable Line clock calibration */
417 /**
418   * @}
419   */
420 
421 /** @defgroup GFXTIM_FrameClockCalib GFXTIM Frame Clock Calibration Output (for debug purpose)
422   * @{
423   */
424 #define GFXTIM_FRAME_CLK_CALIB_DISABLE   0U               /*!< Frame clock output calibration Disable */
425 #define GFXTIM_FRAME_CLK_CALIB_ENABLE    GFXTIM_CR_FCCOE  /*!< Frame clock output calibration Enable */
426 /**
427   * @}
428   */
429 
430 /** @defgroup GFXTIM_ClockGeneratorCounter GFXTIM  Clock Generator Counter
431   * @{
432   */
433 #define GFXTIM_LINE_CLK_COUNTER     GFXTIM_CGCR_LCCFR      /*!< Line clock counter */
434 #define GFXTIM_FRAME_CLK_COUNTER    GFXTIM_CGCR_FCCFR      /*!< Frame clock counter */
435 /**
436   * @}
437   */
438 
439 /** @defgroup GFXTIM_AbsoluteTime GFXTIM Absolute Time
440   * @{
441   */
442 #define GFXTIM_ABSOLUTE_GLOBAL_TIME   0x00000014U  /*!< Absolute global time (frame and line) counters ATR*/
443 #define GFXTIM_ABSOLUTE_FRAME_TIME    0x00000015U  /*!< Absolute frame counter AFCR */
444 #define GFXTIM_ABSOLUTE_LINE_TIME     0x00000016U  /*!< Absolute line counter ALCR */
445 /**
446   * @}
447   */
448 
449 /** @defgroup GFXTIM_AbsoluteLineComparator GFXTIM Absolute Line Comparator
450   * @{
451   */
452 #define GFXTIM_ABSOLUTE_LINE_COMPARE1   0x1CU  /*!< Absolute line compare 1 */
453 #define GFXTIM_ABSOLUTE_LINE_COMPARE2   0x1DU  /*!< Absolute line compare 2 */
454 /**
455   * @}
456   */
457 
458 
459 /** @defgroup GFXTIM_RelativeCounterMode GFXTIM Relative Frame Counter Mode
460   * @{
461   */
462 #define GFXTIM_MODE_ONE_SHOT          0U  /*!< Relative Frame Counter One Shot Mode*/
463 #define GFXTIM_MODE_CONTINUOUS        1U  /*!< Relative Frame Counter Continuous Mode */
464 /**
465   * @}
466   */
467 
468 /** @defgroup GFXTIM_RelativeTimer GFXTIM Relative Timer
469   * @{
470   */
471 #define GFXTIM_RELATIVE_TIMER1          0U  /*!< Relative Timer 1*/
472 #define GFXTIM_RELATIVE_TIMER2          1U  /*!< Relative Timer 2 */
473 /**
474   * @}
475   */
476 
477 /** @defgroup GFXTIM_EventLineSrc GFXTIM Event generator Line source selection
478   * @{
479   */
480 #define GFXTIM_LINE_EVENT_NONE            (0U << GFXTIM_EVSR_LES1_Pos)  /*!< None */
481 #define GFXTIM_LINE_EVENT_ALC_OVERFLOW    (1U << GFXTIM_EVSR_LES1_Pos)  /*!< Absolute line counter overflow */
482 #define GFXTIM_LINE_EVENT_TE              (2U << GFXTIM_EVSR_LES1_Pos)  /*!< Tearing effect */
483 #define GFXTIM_LINE_EVENT_ALC1_COMPARE    (4U << GFXTIM_EVSR_LES1_Pos)  /*!< Absolute line counter 1 compare */
484 #define GFXTIM_LINE_EVENT_ALC2_COMPARE    (5U << GFXTIM_EVSR_LES1_Pos)  /*!< Absolute line counter 2 compare */
485 /**
486   * @}
487   */
488 
489 /** @defgroup GFXTIM_EventFrameSrc GFXTIM Event generator Frame Source selection
490   * @{
491   */
492 #define GFXTIM_FRAME_EVENT_NONE            (0U << GFXTIM_EVSR_FES1_Pos ) /*!< None */
493 #define GFXTIM_FRAME_EVENT_AFC_OVERFLOW    (1U << GFXTIM_EVSR_FES1_Pos ) /*!< Absolute frame counter overflow */
494 #define GFXTIM_FRAME_EVENT_AFC_COMPARE     (2U << GFXTIM_EVSR_FES1_Pos ) /*!< Absolute frame counter compare */
495 #define GFXTIM_FRAME_EVENT_RFC1_RELOAD     (4U << GFXTIM_EVSR_FES1_Pos ) /*!< Relative frame counter 1 reload */
496 #define GFXTIM_FRAME_EVENT_RFC2_RELOAD     (5U << GFXTIM_EVSR_FES1_Pos ) /*!< Relative frame counter 1 reload */
497 /**
498   * @}
499   */
500 
501 /** @defgroup GFXTIM_EventGenerator GFXTIM Event Generator ID
502   * @{
503   */
504 #define GFXTIM_EVENT_GENERATOR_1      0U  /*!< Event Generator 1 */
505 #define GFXTIM_EVENT_GENERATOR_2      1U  /*!< Event Generator 2 */
506 #define GFXTIM_EVENT_GENERATOR_3      2U  /*!< Event Generator 3 */
507 #define GFXTIM_EVENT_GENERATOR_4      3U  /*!< Event Generator 4 */
508 /**
509   * @}
510   */
511 
512 
513 /** @defgroup GFXTIM_WatchdogHwReloadConfig GFXTIM Watchdog hardware reload configuration
514   * @{
515   */
516 #define GFXTIM_WATCHDOG_HW_RELOAD_DISABLE           (0U  <<  GFXTIM_WDGTCR_WDGHRC_Pos) /*!< Watchdog hardware reload is disable */
517 #define GFXTIM_WATCHDOG_HW_RELOAD_RISING_EDGE       (1U  <<  GFXTIM_WDGTCR_WDGHRC_Pos) /*!< Watchdog is reload on rising edge of gfxtim_wrld */
518 #define GFXTIM_WATCHDOG_HW_RELOAD_FALLING_EDGE      (2U  <<  GFXTIM_WDGTCR_WDGHRC_Pos) /*!< Watchdog is reload on falling edge of gfxtim_wrld */
519 /**
520   * @}
521   */
522 
523 /** @defgroup GFXTIM_WatchdogClockSrc GFXTIM Watchdog clock source
524   * @{
525   */
526 #define GFXTIM_WATCHDOG_CLK_SRC_LINE_CLK       (0U  <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< Line Clock */
527 #define GFXTIM_WATCHDOG_CLK_SRC_FRAME_CLK      (1U  <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< Frame Clock */
528 #define GFXTIM_WATCHDOG_CLK_SRC_HSYNC_RISING   (2U  <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< HSYNC rising edge */
529 #define GFXTIM_WATCHDOG_CLK_SRC_HSYNC_FALLING  (3U  <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< HSYNC falling edge */
530 #define GFXTIM_WATCHDOG_CLK_SRC_VSYNC_RISING   (4U  <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< VSYNC rising edge */
531 #define GFXTIM_WATCHDOG_CLK_SRC_VSYNC_FALLING  (5U  <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< VSYNC falling edge */
532 #define GFXTIM_WATCHDOG_CLK_SRC_TE_RISING      (6U  <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< Tearing Effect rising edge */
533 #define GFXTIM_WATCHDOG_CLK_SRC_TE_FALLING     (7U  <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< Tearing Effect falling edge */
534 #define GFXTIM_WATCHDOG_CLK_SRC_EVENT_1        (8U  <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< Event Generator 1 output */
535 #define GFXTIM_WATCHDOG_CLK_SRC_EVENT_2        (9U  <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< Event Generator 2 output */
536 #define GFXTIM_WATCHDOG_CLK_SRC_EVENT_3        (10U <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< Event Generator 3 output */
537 #define GFXTIM_WATCHDOG_CLK_SRC_EVENT_4        (11U <<  GFXTIM_WDGTCR_WDGCS_Pos) /*!< Event Generator 4 output */
538 /**
539   * @}
540   */
541 
542 /** @defgroup GFXTIM_Flag GFXTIM flags
543   * @{
544   */
545 #define GFXTIM_FLAG_AFCO  GFXTIM_ISR_AFCOF     /* Absolute Frame Counter Overflow Flag */
546 #define GFXTIM_FLAG_ALCO  GFXTIM_ISR_ALCOF     /* Absolute Line Counter Overflow Flag */
547 #define GFXTIM_FLAG_TE    GFXTIM_ISR_TEF       /* Tearing Effect Flag */
548 #define GFXTIM_FLAG_AFCC1 GFXTIM_ISR_AFCC1F    /* Absolute Frame Counter Compare 1 Flag */
549 #define GFXTIM_FLAG_ALCC1 GFXTIM_ISR_ALCC1F    /* Absolute Line Counter Compare 1 Flag */
550 #define GFXTIM_FLAG_ALCC2 GFXTIM_ISR_ALCC2F    /* Absolute Line Counter Compare 2 Flag */
551 #define GFXTIM_FLAG_RFC1R GFXTIM_ISR_RFC1RF    /* Relative Frame Counter 1 Reload Flag */
552 #define GFXTIM_FLAG_RFC2R GFXTIM_ISR_RFC2RF    /* Relative Frame Counter 2 Reload Flag */
553 #define GFXTIM_FLAG_EV1   GFXTIM_ISR_EV1F      /* Event 1 Flag */
554 #define GFXTIM_FLAG_EV2   GFXTIM_ISR_EV2F      /* Event 2 Flag */
555 #define GFXTIM_FLAG_EV3   GFXTIM_ISR_EV3F      /* Event 3 Flag */
556 #define GFXTIM_FLAG_EV4   GFXTIM_ISR_EV4F      /* Event 4 Flag */
557 #define GFXTIM_FLAG_WDGA  GFXTIM_ISR_WDGAF     /* Watchdog Alarm Flag */
558 #define GFXTIM_FLAG_WDGP  GFXTIM_ISR_WDGPF     /* Watchdog Pre-alarm Flag */
559 /**
560   * @}
561   */
562 
563 /**
564   * @}
565   */
566 
567 
568 /* Private macros ------------------------------------------------------------*/
569 /** @defgroup GFXTIM_Private_Macros  GFXTIM Private Macros
570   * @{
571   */
572 #define IS_GFXTIM_INTERRUPT(PARAM) (((PARAM) == GFXTIM_IT_ENABLE  ) || \
573                                     ((PARAM) == GFXTIM_IT_DISABLE ))
574 
575 #define IS_GFXTIM_SYNC_SRC(PARAM) (((PARAM) == GFXTIM_SYNC_SRC_HSYNC_VSYNC_0) || \
576                                    ((PARAM) == GFXTIM_SYNC_SRC_HSYNC_VSYNC_1) || \
577                                    ((PARAM) == GFXTIM_SYNC_SRC_HSYNC_VSYNC_2) || \
578                                    ((PARAM) == GFXTIM_SYNC_SRC_HSYNC_VSYNC_3))
579 
580 #define IS_GFXTIM_TE_SRC(PARAM) (((PARAM) == GFXTIM_TE_SRC_GPIO ) || \
581                                  ((PARAM) == GFXTIM_TE_SRC_ITE       ) || \
582                                  ((PARAM) == GFXTIM_TE_SRC_HSYNC     ) || \
583                                  ((PARAM) == GFXTIM_TE_SRC_VSYNC     ))
584 
585 #define IS_GFXTIM_TE_POLARITY(PARAM) (((PARAM) == GFXTIM_TE_RISING_EDGE  ) || \
586                                       ((PARAM) == GFXTIM_TE_FALLING_EDGE ))
587 
588 #define IS_GFXTIM_LCC_HW_RELOAD_SRC(PARAM) (((PARAM) == GFXTIM_LCC_HW_RELOAD_SRC_NONE         ) || \
589                                             ((PARAM) == GFXTIM_LCC_HW_RELOAD_SRC_FCC_UNDERFLOW) || \
590                                             ((PARAM) == GFXTIM_LCC_HW_RELOAD_SRC_HSYNC_RISING ) || \
591                                             ((PARAM) == GFXTIM_LCC_HW_RELOAD_SRC_HSYNC_FALLING) || \
592                                             ((PARAM) == GFXTIM_LCC_HW_RELOAD_SRC_VSYNC_RISING ) || \
593                                             ((PARAM) == GFXTIM_LCC_HW_RELOAD_SRC_VSYNC_FALLING) || \
594                                             ((PARAM) == GFXTIM_LCC_HW_RELOAD_SRC_TE_RISING    ) || \
595                                             ((PARAM) == GFXTIM_LCC_HW_RELOAD_SRC_TE_FALLING    ))
596 
597 #define IS_GFXTIM_LCC_CLK_SRC(PARAM) (((PARAM) == GFXTIM_LCC_CLK_SRC_DISABLE) || \
598                                       ((PARAM) == GFXTIM_LCC_CLK_SRC_SYSCLOCK))
599 
600 #define IS_GFXTIM_LINE_CLK_SRC(PARAM)      (((PARAM) == GFXTIM_LINE_CLK_SRC_LCC_UNDERFLOW) || \
601                                             ((PARAM) == GFXTIM_LINE_CLK_SRC_FCC_UNDERFLOW) || \
602                                             ((PARAM) == GFXTIM_LINE_CLK_SRC_HSYNC_RISING ) || \
603                                             ((PARAM) == GFXTIM_LINE_CLK_SRC_HSYNC_FALLING) || \
604                                             ((PARAM) == GFXTIM_LINE_CLK_SRC_VSYNC_RISING ) || \
605                                             ((PARAM) == GFXTIM_LINE_CLK_SRC_VSYNC_FALLING) || \
606                                             ((PARAM) == GFXTIM_LINE_CLK_SRC_TE_RISING) || \
607                                             ((PARAM) == GFXTIM_LINE_CLK_SRC_TE_FALLING))
608 
609 #define IS_GFXTIM_FCC_HW_RELOAD_SRC(PARAM) (((PARAM) == GFXTIM_FCC_HW_RELOAD_SRC_NONE) || \
610                                             ((PARAM) == GFXTIM_FCC_HW_RELOAD_SRC_LCC_UNDERFLOW) || \
611                                             ((PARAM) == GFXTIM_FCC_HW_RELOAD_SRC_HSYNC_RISING ) || \
612                                             ((PARAM) == GFXTIM_FCC_HW_RELOAD_SRC_HSYNC_FALLING) || \
613                                             ((PARAM) == GFXTIM_FCC_HW_RELOAD_SRC_VSYNC_RISING ) || \
614                                             ((PARAM) == GFXTIM_FCC_HW_RELOAD_SRC_VSYNC_FALLING) || \
615                                             ((PARAM) == GFXTIM_FCC_HW_RELOAD_SRC_TE_RISING) || \
616                                             ((PARAM) == GFXTIM_FCC_HW_RELOAD_SRC_TE_FALLING))
617 
618 #define IS_GFXTIM_FCC_CLK_SRC(PARAM) (((PARAM) == GFXTIM_FCC_CLK_SRC_DISABLE) || \
619                                       ((PARAM) == GFXTIM_FCC_CLK_SRC_LCC_UNDERFLOW) || \
620                                       ((PARAM) == GFXTIM_FCC_CLK_SRC_HSYNC_RISING ) || \
621                                       ((PARAM) == GFXTIM_FCC_CLK_SRC_HSYNC_FALLING) || \
622                                       ((PARAM) == GFXTIM_FCC_CLK_SRC_VSYNC_RISING ) || \
623                                       ((PARAM) == GFXTIM_FCC_CLK_SRC_VSYNC_FALLING) || \
624                                       ((PARAM) == GFXTIM_FCC_CLK_SRC_TE_RISING) || \
625                                       ((PARAM) == GFXTIM_FCC_CLK_SRC_TE_FALLING))
626 
627 #define IS_GFXTIM_FRAME_CLK_SRC(PARAM) (((PARAM) == GFXTIM_FRAME_CLK_SRC_LCC_UNDERFLOW) || \
628                                         ((PARAM) == GFXTIM_FRAME_CLK_SRC_FCC_UNDERFLOW) || \
629                                         ((PARAM) == GFXTIM_FRAME_CLK_SRC_HSYNC_RISING ) || \
630                                         ((PARAM) == GFXTIM_FRAME_CLK_SRC_HSYNC_FALLING) || \
631                                         ((PARAM) == GFXTIM_FRAME_CLK_SRC_VSYNC_RISING ) || \
632                                         ((PARAM) == GFXTIM_FRAME_CLK_SRC_VSYNC_FALLING) || \
633                                         ((PARAM) == GFXTIM_FRAME_CLK_SRC_TE_RISING) || \
634                                         ((PARAM) == GFXTIM_FRAME_CLK_SRC_TE_FALLING))
635 
636 #define IS_GFXTIM_LINE_CLK_CALIB(PARAM) (((PARAM) == GFXTIM_LINE_CLK_CALIB_DISABLE) || \
637                                          ((PARAM) == GFXTIM_LINE_CLK_CALIB_ENABLE))
638 
639 #define IS_GFXTIM_FRAME_CLK_CALIB(PARAM) (((PARAM) == GFXTIM_FRAME_CLK_CALIB_DISABLE) || \
640                                           ((PARAM) == GFXTIM_FRAME_CLK_CALIB_ENABLE))
641 
642 #define IS_GFXTIM_CLOCK_GENERATOR_COUNTER(PARAM) (((PARAM) == GFXTIM_LINE_CLK_COUNTER) || \
643                                                   ((PARAM) == GFXTIM_FRAME_CLK_COUNTER) || \
644                                                   ((PARAM) == (GFXTIM_LINE_CLK_COUNTER | \
645                                                                GFXTIM_FRAME_CLK_COUNTER)))
646 
647 #define IS_GFXTIM_ABSOLUTE_TIME(PARAM) (((PARAM) == GFXTIM_ABSOLUTE_GLOBAL_TIME) || \
648                                         ((PARAM) == GFXTIM_ABSOLUTE_FRAME_TIME) || \
649                                         ((PARAM) == GFXTIM_ABSOLUTE_LINE_TIME))
650 
651 #define IS_GFXTIM_ABSOLUTE_LINE_COMPARATOR(PARAM) (((PARAM) == GFXTIM_ABSOLUTE_LINE_COMPARE1) || \
652                                                    ((PARAM) == GFXTIM_ABSOLUTE_LINE_COMPARE2))
653 
654 #define IS_GFXTIM_RELATIVE_TIMER(PARAM) (((PARAM) == GFXTIM_RELATIVE_TIMER1) || \
655                                          ((PARAM) == GFXTIM_RELATIVE_TIMER2))
656 
657 #define IS_GFXTIM_RELATIVE_COUNTER_MODE(PARAM) (((PARAM) == GFXTIM_MODE_ONE_SHOT) || \
658                                                 ((PARAM) == GFXTIM_MODE_CONTINUOUS))
659 
660 #define IS_GFXTIM_EVENT_LINE(PARAM) (((PARAM) == GFXTIM_LINE_EVENT_NONE) || \
661                                      ((PARAM) == GFXTIM_LINE_EVENT_ALC_OVERFLOW) || \
662                                      ((PARAM) == GFXTIM_LINE_EVENT_TE) || \
663                                      ((PARAM) == GFXTIM_LINE_EVENT_ALC1_COMPARE) || \
664                                      ((PARAM) == GFXTIM_LINE_EVENT_ALC2_COMPARE))
665 
666 #define IS_GFXTIM_EVENT_FRAME(PARAM) (((PARAM) == GFXTIM_FRAME_EVENT_NONE) || \
667                                       ((PARAM) == GFXTIM_FRAME_EVENT_AFC_OVERFLOW) || \
668                                       ((PARAM) == GFXTIM_FRAME_EVENT_AFC_COMPARE) || \
669                                       ((PARAM) == GFXTIM_FRAME_EVENT_RFC1_RELOAD) || \
670                                       ((PARAM) == GFXTIM_FRAME_EVENT_RFC2_RELOAD))
671 
672 #define IS_GFXTIM_EVENT_GENERATOR(PARAM) (((PARAM) == GFXTIM_EVENT_GENERATOR_1) || \
673                                           ((PARAM) == GFXTIM_EVENT_GENERATOR_2) || \
674                                           ((PARAM) == GFXTIM_EVENT_GENERATOR_3) || \
675                                           ((PARAM) == GFXTIM_EVENT_GENERATOR_4))
676 
677 
678 #define IS_GFXTIM_CLOCK_GENERATOR_COUNTER_FORCE_RELOAD(PARAM) (((PARAM) == GFXTIM_LINE_CLK_COUNTER) || \
679                                                                ((PARAM) == GFXTIM_FRAME_CLK_COUNTER) || \
680                                                                ((PARAM) == (GFXTIM_LINE_CLK_COUNTER | \
681                                                                             GFXTIM_FRAME_CLK_COUNTER)))
682 
683 
684 #define IS_GFXTIM_WATCHDOG_HW_RELOAD_CONFIG(PARAM) (((PARAM) == GFXTIM_WATCHDOG_HW_RELOAD_DISABLE) || \
685                                                     ((PARAM) == GFXTIM_WATCHDOG_HW_RELOAD_RISING_EDGE) || \
686                                                     ((PARAM) == GFXTIM_WATCHDOG_HW_RELOAD_FALLING_EDGE))
687 
688 #define IS_GFXTIM_WATCHDOG_CLOCK_SRC(PARAM) (((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_LINE_CLK) || \
689                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_FRAME_CLK) || \
690                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_HSYNC_RISING) || \
691                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_HSYNC_FALLING) || \
692                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_VSYNC_RISING) || \
693                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_VSYNC_FALLING) || \
694                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_TE_RISING) || \
695                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_TE_FALLING) || \
696                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_EVENT_1) || \
697                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_EVENT_2) || \
698                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_EVENT_3) || \
699                                              ((PARAM) == GFXTIM_WATCHDOG_CLK_SRC_EVENT_4))
700 #define IS_GFXTIM_WATCHDOG_VALUE(PARAM) ((PARAM) <= 65535U)
701 #define IS_GFXTIM_RELATIVE_FRAME_VALUE(PARAM) ((PARAM) <= 4095U)
702 #define IS_GFXTIM_ABSOLUTE_FRAME_VALUE(PARAM) ((PARAM) <= 1048575U)
703 #define IS_GFXTIM_ABSOLUTE_LINE_VALUE(PARAM) ((PARAM) <= 4095U)
704 #define IS_GFXTIM_LCC_RELOAD_VALUE(PARAM) ((PARAM) <= 4194303U)
705 #define IS_GFXTIM_FCC_RELOAD_VALUE(PARAM) ((PARAM) <= 4095U)
706 
707 
708 /**
709   * @}
710   */
711 
712 
713 /* Exported macro ------------------------------------------------------------*/
714 /** @defgroup GFXTIM_Exported_Macros  GFXTIM Exported Macros
715   * @{
716   */
717 
718 /** @brief  Reset GFXTIM handle state.
719   * @param  __HANDLE__ GFXTIM handle.
720   * @retval None
721   */
722 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1)
723 #define __HAL_GFXTIM_RESET_HANDLE_STATE(__HANDLE__) do{                                             \
724                                                         (__HANDLE__)->State = HAL_GFXTIM_STATE_RESET; \
725                                                         (__HANDLE__)->MspInitCallback = NULL;      \
726                                                         (__HANDLE__)->MspDeInitCallback = NULL;    \
727                                                       } while(0)
728 #else /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
729 #define __HAL_GFXTIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_GFXTIM_STATE_RESET)
730 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
731 
732 
733 
734 /**
735   * @brief Check whether the specified GFXTIM flag is set or not.
736   * @param __HANDLE__ GFXTIM handle
737   * @param __FLAG__ GFXTIM flag
738   *        This parameter can be one or a combination of the following values:
739   *            @arg @ref GFXTIM_FLAG_AFCO   Absolute Frame Counter Overflow Flag
740   *            @arg @ref GFXTIM_FLAG_ALCO   Absolute Line Counter Overflow Flag
741   *            @arg @ref GFXTIM_FLAG_TE     Tearing Effect Flag
742   *            @arg @ref GFXTIM_FLAG_AFCC1  Absolute Frame Counter Compare 1 Flag
743   *            @arg @ref GFXTIM_FLAG_ALCC1  Absolute Line Counter Compare 1 Flag
744   *            @arg @ref GFXTIM_FLAG_ALCC2  Absolute Line Counter Compare 2 Flag
745   *            @arg @ref GFXTIM_FLAG_RFC1R  Relative Frame Counter 1 Reload Flag
746   *            @arg @ref GFXTIM_FLAG_RFC2R  Relative Frame Counter 2 Reload Flag
747   *            @arg @ref GFXTIM_FLAG_EV1    Event 1 Flag
748   *            @arg @ref GFXTIM_FLAG_EV2    Event 2 Flag
749   *            @arg @ref GFXTIM_FLAG_EV3    Event 3 Flag
750   *            @arg @ref GFXTIM_FLAG_EV4    Event 4 Flag
751   *            @arg @ref GFXTIM_FLAG_WDGA   Watchdog Alarm Flag
752   *            @arg @ref GFXTIM_FLAG_WDGP   Watchdog Pre-alarm Flag
753   * @retval State of flag (TRUE or FALSE).
754   */
755 #define __HAL_GFXTIM_GET_FLAG(__HANDLE__, __FLAG__)\
756   ((((__HANDLE__)->Instance->ISR) & (__FLAG__)) == (__FLAG__))
757 
758 /**
759   * @brief Clear the specified GFXTIM flag.
760   * @param __HANDLE__ GFXTIM handle
761   * @param __FLAG__ GFXTIM flag
762   *        This parameter can be one or a combination of the following values:
763   *            @arg @ref GFXTIM_FLAG_AFCO   Absolute Frame Counter Overflow Flag
764   *            @arg @ref GFXTIM_FLAG_ALCO   Absolute Line Counter Overflow Flag
765   *            @arg @ref GFXTIM_FLAG_TE     Tearing Effect Flag
766   *            @arg @ref GFXTIM_FLAG_AFCC1  Absolute Frame Counter Compare 1 Flag
767   *            @arg @ref GFXTIM_FLAG_ALCC1  Absolute Line Counter Compare 1 Flag
768   *            @arg @ref GFXTIM_FLAG_ALCC2  Absolute Line Counter Compare 2 Flag
769   *            @arg @ref GFXTIM_FLAG_RFC1R  Relative Frame Counter 1 Reload Flag
770   *            @arg @ref GFXTIM_FLAG_RFC2R  Relative Frame Counter 2 Reload Flag
771   *            @arg @ref GFXTIM_FLAG_EV1    Event 1 Flag
772   *            @arg @ref GFXTIM_FLAG_EV2    Event 2 Flag
773   *            @arg @ref GFXTIM_FLAG_EV3    Event 3 Flag
774   *            @arg @ref GFXTIM_FLAG_EV4    Event 4 Flag
775   *            @arg @ref GFXTIM_FLAG_WDGA   Watchdog Alarm Flag
776   *            @arg @ref GFXTIM_FLAG_WDGP   Watchdog Pre-alarm Flag
777   * @retval None
778   */
779 #define __HAL_GFXTIM_CLEAR_FLAG(__HANDLE__, __FLAG__)\
780   (((__HANDLE__)->Instance->ICR) = (__FLAG__))
781 
782 /**
783   * @}
784   */
785 
786 
787 /* Exported functions --------------------------------------------------------*/
788 /** @addtogroup GFXTIM_Exported_Functions
789   * @{
790   */
791 
792 /* Initialization and de-initialization functions  ****************************/
793 /** @addtogroup GFXTIM_Exported_Functions_Group1
794   * @{
795   */
796 HAL_StatusTypeDef HAL_GFXTIM_Init(GFXTIM_HandleTypeDef *hgfxtim);
797 HAL_StatusTypeDef HAL_GFXTIM_DeInit(GFXTIM_HandleTypeDef *hgfxtim);
798 void              HAL_GFXTIM_MspInit(GFXTIM_HandleTypeDef *hgfxtim);
799 void              HAL_GFXTIM_MspDeInit(GFXTIM_HandleTypeDef *hgfxtim);
800 #if (USE_HAL_GFXTIM_REGISTER_CALLBACKS == 1)
801 HAL_StatusTypeDef HAL_GFXTIM_RegisterCallback(GFXTIM_HandleTypeDef *hgfxtim,
802                                               HAL_GFXTIM_CallbackIDTypeDef CallbackID,
803                                               pGFXTIM_CallbackTypeDef pCallback);
804 HAL_StatusTypeDef HAL_GFXTIM_UnRegisterCallback(GFXTIM_HandleTypeDef *hgfxtim,
805                                                 HAL_GFXTIM_CallbackIDTypeDef CallbackID);
806 #endif /* USE_HAL_GFXTIM_REGISTER_CALLBACKS */
807 void HAL_GFXTIM_TECallback(GFXTIM_HandleTypeDef *hgfxtim);
808 /**
809   * @}
810   */
811 
812 /* Clock Generator functions  *****************************************************/
813 /** @addtogroup GFXTIM_Exported_Functions_Group2
814   * @{
815   */
816 HAL_StatusTypeDef HAL_GFXTIM_ClockGenerator_Config(GFXTIM_HandleTypeDef *hgfxtim,
817                                                    const GFXTIM_ClockGeneratorConfigTypeDef *pClockGeneratorConfig);
818 HAL_StatusTypeDef HAL_GFXTIM_ClockGenerator_Reload(GFXTIM_HandleTypeDef *hgfxtim, uint32_t ClockGeneratorCounter);
819 /**
820   * @}
821   */
822 
823 /* Absolute Timer functions  *****************************************/
824 /** @addtogroup GFXTIM_Exported_Functions_Group3
825   * @{
826   */
827 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Config(GFXTIM_HandleTypeDef *hgfxtim,
828                                                   const GFXTIM_AbsoluteTimerConfigTypeDef *pAbsoluteTimerConfig);
829 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Start(GFXTIM_HandleTypeDef *hgfxtim);
830 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Stop(GFXTIM_HandleTypeDef *hgfxtim);
831 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_Reset(GFXTIM_HandleTypeDef *hgfxtim);
832 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_GetCounter(GFXTIM_HandleTypeDef *hgfxtim, uint32_t AbsoluteTime,
833                                                       uint32_t *pValue);
834 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_SetFrameCompare(GFXTIM_HandleTypeDef *hgfxtim, uint32_t Value);
835 HAL_StatusTypeDef HAL_GFXTIM_AbsoluteTimer_SetLineCompare(GFXTIM_HandleTypeDef *hgfxtim,
836                                                           uint32_t AbsoluteLineComparator,
837                                                           uint32_t Value);
838 void HAL_GFXTIM_AbsoluteTimer_AFCC1Callback(GFXTIM_HandleTypeDef *hgfxtim);
839 void HAL_GFXTIM_AbsoluteTimer_AFCOFCallback(GFXTIM_HandleTypeDef *hgfxtim);
840 void HAL_GFXTIM_AbsoluteTimer_ALCC1Callback(GFXTIM_HandleTypeDef *hgfxtim);
841 void HAL_GFXTIM_AbsoluteTimer_ALCC2Callback(GFXTIM_HandleTypeDef *hgfxtim);
842 void HAL_GFXTIM_AbsoluteTimer_ALCOFCallback(GFXTIM_HandleTypeDef *hgfxtim);
843 /**
844   * @}
845   */
846 
847 /* Relative Timer functions  *****************************************/
848 /** @addtogroup GFXTIM_Exported_Functions_Group4
849   * @{
850   */
851 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_Config(GFXTIM_HandleTypeDef *hgfxtim,
852                                                   const GFXTIM_RelativeTimerConfigTypeDef *pRelativeTimerConfig,
853                                                   uint32_t RelativeTimer);
854 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_Start(GFXTIM_HandleTypeDef *hgfxtim, uint32_t RelativeTimer);
855 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_Stop(GFXTIM_HandleTypeDef *hgfxtim, uint32_t RelativeTimer);
856 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_ForceReload(GFXTIM_HandleTypeDef *hgfxtim, uint32_t RelativeTimer);
857 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_SetReload(GFXTIM_HandleTypeDef *hgfxtim, uint32_t RelativeTimer,
858                                                      uint32_t Value);
859 HAL_StatusTypeDef HAL_GFXTIM_RelativeTimer_GetCounter(GFXTIM_HandleTypeDef *hgfxtim, uint32_t RelativeTimer,
860                                                       uint32_t *pValue);
861 void HAL_GFXTIM_RelativeTimer_RFC1RCallback(GFXTIM_HandleTypeDef *hgfxtim);
862 void HAL_GFXTIM_RelativeTimer_RFC2RCallback(GFXTIM_HandleTypeDef *hgfxtim);
863 /**
864   * @}
865   */
866 
867 /* Event Generator functions  *****************************************/
868 /** @addtogroup GFXTIM_Exported_Functions_Group5
869   * @{
870   */
871 HAL_StatusTypeDef HAL_GFXTIM_EventGenerator_Config(GFXTIM_HandleTypeDef *hgfxtim, uint32_t EventGenerator,
872                                                    const GFXTIM_EventGeneratorConfigTypeDef *pEventGeneratorConfig);
873 HAL_StatusTypeDef HAL_GFXTIM_EventGenerator_Enable(GFXTIM_HandleTypeDef *hgfxtim, uint32_t EventGenerator);
874 HAL_StatusTypeDef HAL_GFXTIM_EventGenerator_Disable(GFXTIM_HandleTypeDef *hgfxtim, uint32_t EventGenerator);
875 void HAL_GFXTIM_EventGenerator_EV1Callback(GFXTIM_HandleTypeDef *hgfxtim);
876 void HAL_GFXTIM_EventGenerator_EV2Callback(GFXTIM_HandleTypeDef *hgfxtim);
877 void HAL_GFXTIM_EventGenerator_EV3Callback(GFXTIM_HandleTypeDef *hgfxtim);
878 void HAL_GFXTIM_EventGenerator_EV4Callback(GFXTIM_HandleTypeDef *hgfxtim);
879 /**
880   * @}
881   */
882 
883 /* Watchdog functions  *****************************************/
884 /** @addtogroup GFXTIM_Exported_Functions_Group6
885   * @{
886   */
887 HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Config(GFXTIM_HandleTypeDef *hgfxtim,
888                                                   const GFXTIM_WatchdogConfigTypeDef *pWatchdogConfig);
889 HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Enable(GFXTIM_HandleTypeDef *hgfxtim);
890 HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Disable(GFXTIM_HandleTypeDef *hgfxtim);
891 HAL_StatusTypeDef HAL_GFXTIM_WatchdogTimer_Refresh(GFXTIM_HandleTypeDef *hgfxtim);
892 void HAL_GFXTIM_WatchdogTimer_AlarmCallback(GFXTIM_HandleTypeDef *hgfxtim);
893 void HAL_GFXTIM_WatchdogTimer_PreAlarmCallback(GFXTIM_HandleTypeDef *hgfxtim);
894 /**
895   * @}
896   */
897 
898 /* Generic functions  *********************************************************/
899 /** @addtogroup GFXTIM_Exported_Functions_Group7
900   * @{
901   */
902 void                    HAL_GFXTIM_IRQHandler(GFXTIM_HandleTypeDef *hgfxtim);
903 void                    HAL_GFXTIM_ErrorCallback(GFXTIM_HandleTypeDef *hgfxtim);
904 uint32_t                HAL_GFXTIM_GetError(const GFXTIM_HandleTypeDef *hgfxtim);
905 HAL_GFXTIM_StateTypeDef HAL_GFXTIM_GetState(const GFXTIM_HandleTypeDef *hgfxtim);
906 
907 /**
908   * @}
909   */
910 
911 /**
912   * @}
913   */
914 
915 /**
916   * @}
917   */
918 
919 /**
920   * @}
921   */
922 
923 #endif /* GFXTIM */
924 
925 #ifdef __cplusplus
926 }
927 #endif
928 
929 #endif /* STM32U5xx_HAL_GFXTIM_H */
930