• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  ****************************************************************************************
3  *
4  * @file    gr55xx_ll_dual_tim.h
5  * @author  BLE Driver Team
6  * @brief   Header file containing functions prototypes of DUAL TIMER LL library.
7  *
8  ****************************************************************************************
9  * @attention
10   #####Copyright (c) 2019 GOODIX
11   All rights reserved.
12 
13     Redistribution and use in source and binary forms, with or without
14     modification, are permitted provided that the following conditions are met:
15   * Redistributions of source code must retain the above copyright
16     notice, this list of conditions and the following disclaimer.
17   * Redistributions in binary form must reproduce the above copyright
18     notice, this list of conditions and the following disclaimer in the
19     documentation and/or other materials provided with the distribution.
20   * Neither the name of GOODIX nor the names of its contributors may be used
21     to endorse or promote products derived from this software without
22     specific prior written permission.
23 
24   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34   POSSIBILITY OF SUCH DAMAGE.
35  ****************************************************************************************
36  */
37 
38 /** @addtogroup PERIPHERAL Peripheral Driver
39   * @{
40   */
41 
42 /** @addtogroup LL_DRIVER LL Driver
43   * @{
44   */
45 
46 /** @defgroup LL_DUAL_TIMER DUAL_TIMER
47   * @brief DUAL TIM LL module driver.
48   * @{
49   */
50 
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR55XX_LL_DUAL_TIMER_H__
53 #define __GR55XX_LL_DUAL_TIMER_H__
54 
55 /* Includes ------------------------------------------------------------------*/
56 #include "gr55xx.h"
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 #if defined (DUAL_TIMER0) || defined (DUAL_TIMER1)
63 
64 /** @defgroup DUAL_TIMER_LL_STRUCTURES Structures
65   * @{
66   */
67 
68 /* Exported types ------------------------------------------------------------*/
69 /** @defgroup DUAL_TIMER_LL_ES_INIT DUAL_TIM Exported init structures
70   * @{
71   */
72 
73 /**
74   * @brief LL DUAL TIMER init Structure definition
75   */
76 typedef struct _ll_dual_timer_init {
77     uint32_t prescaler;         /**< Specifies the prescaler value used to divide the TIMER clock.
78                                    This parameter can be a value of @ref DUAL_TIMER_EC_LL_PRESCALER.
79                                    This feature can be modified afterwards using unitary function
80                                    @ref ll_dual_timer_set_prescaler(). */
81 
82     uint32_t counter_size;       /**< Specifies the prescaler value used to divide the DUAL_TIMER clock.
83                                    This parameter can be a value of @ref DUAL_TIMER_EC_LL_COUNTERSIZE.
84                                    This feature can be modified afterwards using unitary function
85                                    @ref ll_dual_timer_set_counter_size(). */
86 
87     uint32_t counter_mode;       /**< Specifies the counter mode.
88                                    This parameter can be a value of @ref DUAL_TIMER_LL_EC_COUNTERMODE.
89                                    This feature can be modified afterwards using unitary function
90                                    @ref ll_dual_timer_set_counter_mode(). */
91 
92     uint32_t auto_reload;        /**< Specifies the auto reload value to be loaded into the active
93                                    Auto-Reload Register at the next update event.
94                                    This parameter must be a number
95                                    between Min_Data=0x00000000 and
96                                    Max_Data=0xFFFFFFFF.
97                                    Some timer instances may support 16
98                                    bits counters. In that case this
99                                    parameter must
100                                    be a number between 0x0000 and 0xFFFF.
101                                    This feature can be modified afterwards using unitary function
102                                    @ref ll_dual_timer_set_auto_reload(). */
103 } ll_dual_timer_init_t;
104 
105 /** @} */
106 
107 /** @} */
108 
109 /**
110   * @defgroup  DUAL_TIMER_LL_MACRO Defines
111   * @{
112   */
113 
114 /* Exported constants --------------------------------------------------------*/
115 /** @defgroup DUAL_TIMER_LL_Exported_Constants DUAL_TIM Exported Constants
116   * @{
117   */
118 
119 /** @defgroup DUAL_TIMER_LL_EC_COUNTERMODE DUAL_TIM counter mode
120   * @{
121   */
122 #define LL_DUAL_TIMER_FREERUNNING_MODE        0x00000000U             /**< Free running mode */
123 #define LL_DUAL_TIMER_PERIODIC_MODE           DUAL_TIMER_CTRL_MODE    /**< Periodic mode     */
124 /** @} */
125 
126 /** @defgroup DUAL_TIMER_EC_LL_PRESCALER DUAL_TIM prescaler
127   * @{
128   */
129 #define LL_DUAL_TIMER_PRESCALER_DIV0          0x00000000U                       /**< 0 stage  of prescale,
130                                                                                      clock is divided by 1. */
131 #define LL_DUAL_TIMER_PRESCALER_DIV16         (1UL << DUAL_TIMER_CTRL_PRE_Pos)  /**< 4 stages of prescale,
132                                                                                      clock is divided by 16. */
133 #define LL_DUAL_TIMER_PRESCALER_DIV256        (2UL << DUAL_TIMER_CTRL_PRE_Pos)  /**< 8 stages of prescale,
134                                                                                      clock is divided by 256. */
135 /** @} */
136 
137 /** @defgroup DUAL_TIMER_EC_LL_COUNTERSIZE DUAL_TIM counter size
138   * @{
139   */
140 #define LL_DUAL_TIMER_COUNTERSIZE_16          0x00000000U           /**< Counter size 16 bits */
141 #define LL_DUAL_TIMER_COUNTERSIZE_32          DUAL_TIMER_CTRL_SIZE  /**< Counter size 32 bits */
142 /** @} */
143 
144 /** @defgroup DUAL_TIMER_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion
145   * @{
146   */
147 
148 /**
149   * @brief LL DUAL_TIMER InitStrcut default configuartion
150   */
151 #define DUAL_TIMER_DEFAULT_CONFIG                      \
152 {                                                      \
153     .prescaler   = LL_DUAL_TIMER_PRESCALER_DIV0,       \
154     .counter_size = LL_DUAL_TIMER_COUNTERSIZE_32,      \
155     .counter_mode = LL_DUAL_TIMER_PERIODIC_MODE,       \
156     .auto_reload  = SystemCoreClock - 1,               \
157 }
158 /** @} */
159 
160 /** @} */
161 
162 /* Exported macro ------------------------------------------------------------*/
163 /** @defgroup DUAL_TIMER_LL_Exported_Macros DUAL_TIM Exported Macros
164   * @{
165   */
166 
167 /** @defgroup DUAL_TIMER_LL_EM_WRITE_READ Common Write and read registers Macros
168   * @{
169   */
170 
171 /**
172   * @brief  Write a value in DUAL_TIMER register
173   * @param  __instance__ DUAL_TIMER instance
174   * @param  __REG__ Register to be written
175   * @param  __VALUE__ Value to be written in the register
176   * @retval None
177   */
178 #define LL_DUAL_TIMER_WriteReg(__instance__, __REG__, __VALUE__)  WRITE_REG(__instance__->__REG__, (__VALUE__))
179 
180 /**
181   * @brief  Read a value in DUAL_TIMER register
182   * @param  __instance__ DUAL_TIMER instance
183   * @param  __REG__ Register to be read
184   * @retval Register value
185   */
186 #define LL_DUAL_TIMER_ReadReg(__instance__, __REG__)              READ_REG(__instance__->__REG__)
187 
188 /** @} */
189 
190 /** @} */
191 
192 /** @} */
193 
194 /* Exported functions --------------------------------------------------------*/
195 /** @defgroup DUAL_TIMER_LL_DRIVER_FUNCTIONS Functions
196   * @{
197   */
198 
199 /** @defgroup DUAL_TIMER_LL_EF_Configuration Configuration functions
200   * @{
201   */
202 
203 
204 /**
205   * @brief  Enable dual_timer counter.
206   *
207   *  Register|BitsName
208   *  --------|--------
209   *  CTRL | EN
210   *
211   * @param  DUAL_TIMERx Timer instance
212   * @retval None
213   */
ll_dual_timer_enable_counter(dual_timer_regs_t * DUAL_TIMERx)214 __STATIC_INLINE void ll_dual_timer_enable_counter(dual_timer_regs_t *DUAL_TIMERx)
215 {
216     SET_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_EN);
217 }
218 
219 /**
220   * @brief  Disable dual_timer counter.
221   *
222   *  Register|BitsName
223   *  --------|--------
224   *  CTRL | EN
225   *
226   * @param  DUAL_TIMERx Timer instance
227   * @retval None
228   */
ll_dual_timer_disable_counter(dual_timer_regs_t * DUAL_TIMERx)229 __STATIC_INLINE void ll_dual_timer_disable_counter(dual_timer_regs_t *DUAL_TIMERx)
230 {
231     CLEAR_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_EN);
232 }
233 
234 /**
235   * @brief  Indicate whether the dual_timer counter is enabled.
236   *
237   *  Register|BitsName
238   *  --------|--------
239   *  CTRL | EN
240   *
241   * @param  DUAL_TIMERx Timer instance
242   * @retval State of bit (1 or 0).
243   */
ll_dual_timer_is_enabled_counter(dual_timer_regs_t * DUAL_TIMERx)244 __STATIC_INLINE uint32_t ll_dual_timer_is_enabled_counter(dual_timer_regs_t *DUAL_TIMERx)
245 {
246     return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_EN) == (DUAL_TIMER_CTRL_EN));
247 }
248 
249 /**
250   * @brief  Set the counter mode.
251   *
252   *  Register|BitsName
253   *  --------|--------
254   *  CTRL | MODE
255   *
256   * @param  DUAL_TIMERx Timer instance
257   * @param  counter_mode This parameter can be one of the following values:
258   *         @arg @ref LL_DUAL_TIMER_FREERUNNING_MODE
259   *         @arg @ref LL_DUAL_TIMER_PERIODIC_MODE
260   * @retval None
261   */
ll_dual_timer_set_counter_mode(dual_timer_regs_t * DUAL_TIMERx,uint32_t counter_mode)262 __STATIC_INLINE void ll_dual_timer_set_counter_mode(dual_timer_regs_t *DUAL_TIMERx, uint32_t counter_mode)
263 {
264     MODIFY_REG(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_MODE, counter_mode);
265 }
266 
267 /**
268   * @brief  Get the counter mode.
269   *
270   *  Register|BitsName
271   *  --------|--------
272   *  CTRL | MODE
273   *
274   * @param  DUAL_TIMERx Timer instance
275   * @retval Return value can be one of the following values:
276   *         @arg @ref LL_DUAL_TIMER_FREERUNNING_MODE
277   *         @arg @ref LL_DUAL_TIMER_PERIODIC_MODE
278   */
ll_dual_timer_get_counter_mode(dual_timer_regs_t * DUAL_TIMERx)279 __STATIC_INLINE uint32_t ll_dual_timer_get_counter_mode(dual_timer_regs_t *DUAL_TIMERx)
280 {
281     return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_MODE));
282 }
283 
284 /**
285   * @brief  Set the prescaler.
286   *
287   *  Register|BitsName
288   *  --------|--------
289   *  CTRL | PRE
290   *
291   * @param  DUAL_TIMERx Timer instance
292   * @param  prescaler This parameter can be one of the following values:
293   *         @arg @ref LL_DUAL_TIMER_PRESCALER_DIV0
294   *         @arg @ref LL_DUAL_TIMER_PRESCALER_DIV16
295   *         @arg @ref LL_DUAL_TIMER_PRESCALER_DIV256
296   * @retval None
297   */
ll_dual_timer_set_prescaler(dual_timer_regs_t * DUAL_TIMERx,uint32_t prescaler)298 __STATIC_INLINE void ll_dual_timer_set_prescaler(dual_timer_regs_t *DUAL_TIMERx, uint32_t prescaler)
299 {
300     MODIFY_REG(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_PRE, prescaler);
301 }
302 
303 /**
304   * @brief  Get the prescaler.
305   *
306   *  Register|BitsName
307   *  --------|--------
308   *  CTRL | PRE
309   *
310   * @param  DUAL_TIMERx Timer instance
311   * @retval Return value can be one of the following values:
312   *         @arg @ref LL_DUAL_TIMER_PRESCALER_DIV0
313   *         @arg @ref LL_DUAL_TIMER_PRESCALER_DIV16
314   *         @arg @ref LL_DUAL_TIMER_PRESCALER_DIV256
315   */
ll_dual_timer_get_prescaler(dual_timer_regs_t * DUAL_TIMERx)316 __STATIC_INLINE uint32_t ll_dual_timer_get_prescaler(dual_timer_regs_t *DUAL_TIMERx)
317 {
318     return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_PRE));
319 }
320 
321 /**
322   * @brief  Set the counter size.
323   *
324   *  Register|BitsName
325   *  --------|--------
326   *  CTRL | SIZE
327   *
328   * @param  DUAL_TIMERx Timer instance
329   * @param  counter_size This parameter can be one of the following values:
330   *         @arg @ref LL_DUAL_TIMER_COUNTERSIZE_16
331   *         @arg @ref LL_DUAL_TIMER_COUNTERSIZE_32
332   * @retval None
333   */
ll_dual_timer_set_counter_size(dual_timer_regs_t * DUAL_TIMERx,uint32_t counter_size)334 __STATIC_INLINE void ll_dual_timer_set_counter_size(dual_timer_regs_t *DUAL_TIMERx, uint32_t counter_size)
335 {
336     MODIFY_REG(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_SIZE, counter_size);
337 }
338 
339 /**
340   * @brief  Get the counter size.
341   *
342   *  Register|BitsName
343   *  --------|--------
344   *  CTRL | SIZE
345   *
346   * @param  DUAL_TIMERx Timer instance
347   * @retval Return value can be one of the following values:
348   *         @arg @ref LL_DUAL_TIMER_COUNTERSIZE_16
349   *         @arg @ref LL_DUAL_TIMER_COUNTERSIZE_32
350   */
ll_dual_timer_get_counter_size(dual_timer_regs_t * DUAL_TIMERx)351 __STATIC_INLINE uint32_t ll_dual_timer_get_counter_size(dual_timer_regs_t *DUAL_TIMERx)
352 {
353     return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_SIZE));
354 }
355 
356 /**
357   * @brief  Enable one-shot mode.
358   *
359   *  Register|BitsName
360   *  --------|--------
361   *  CTRL | ONESHOT
362   *
363   * @param  DUAL_TIMERx Timer instance
364   * @retval None
365   */
ll_dual_timer_enable_oneshot(dual_timer_regs_t * DUAL_TIMERx)366 __STATIC_INLINE void ll_dual_timer_enable_oneshot(dual_timer_regs_t *DUAL_TIMERx)
367 {
368     SET_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_ONESHOT);
369 }
370 
371 /**
372   * @brief  Disable one-shot mode.
373   *
374   *  Register|BitsName
375   *  --------|--------
376   *  CTRL | ONESHOT
377   *
378   * @param  DUAL_TIMERx Timer instance
379   * @retval None
380   */
ll_dual_timer_disable_oneshot(dual_timer_regs_t * DUAL_TIMERx)381 __STATIC_INLINE void ll_dual_timer_disable_oneshot(dual_timer_regs_t *DUAL_TIMERx)
382 {
383     CLEAR_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_ONESHOT);
384 }
385 
386 /**
387   * @brief  Indicate whether the one-shot mode is enabled.
388   *
389   *  Register|BitsName
390   *  --------|--------
391   *  CTRL | ONESHOT
392   *
393   * @param  DUAL_TIMERx Timer instance
394   * @retval State of bit (1 or 0).
395   */
ll_dual_timer_is_enabled_oneshot(dual_timer_regs_t * DUAL_TIMERx)396 __STATIC_INLINE uint32_t ll_dual_timer_is_enabled_oneshot(dual_timer_regs_t *DUAL_TIMERx)
397 {
398     return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_ONESHOT) == (DUAL_TIMER_CTRL_ONESHOT));
399 }
400 
401 /**
402   * @brief  Get the counter value.
403   *
404   *  Register|BitsName
405   *  --------|--------
406   *  VALUE | VALUE
407   *
408   * @param  DUAL_TIMERx Timer instance
409   * @retval Counter value (between Min_Data=0 and Max_Data=0xFFFFFFFF)
410   */
ll_dual_timer_get_counter(dual_timer_regs_t * DUAL_TIMERx)411 __STATIC_INLINE uint32_t ll_dual_timer_get_counter(dual_timer_regs_t *DUAL_TIMERx)
412 {
413     return (uint32_t)(READ_REG(DUAL_TIMERx->VALUE));
414 }
415 
416 /**
417   * @brief  Set the auto-reload value.
418   * @note   The counter is blocked while the auto-reload value is null.
419   *
420   *  Register|BitsName
421   *  --------|--------
422   *  RELOAD | RELOAD
423   *
424   * @param  DUAL_TIMERx Timer instance
425   * @param  auto_reload between Min_Data=0 and Max_Data=0xFFFFFFFF
426   * @retval None
427   */
ll_dual_timer_set_auto_reload(dual_timer_regs_t * DUAL_TIMERx,uint32_t auto_reload)428 __STATIC_INLINE void ll_dual_timer_set_auto_reload(dual_timer_regs_t *DUAL_TIMERx, uint32_t auto_reload)
429 {
430     WRITE_REG(DUAL_TIMERx->RELOAD, auto_reload);
431 }
432 
433 /**
434   * @brief  Get the auto-reload value.
435   *
436   *  Register|BitsName
437   *  --------|--------
438   *  RELOAD | RELOAD
439   *
440   * @param  DUAL_TIMERx Timer instance
441   * @retval Auto-reload value
442   */
ll_dual_timer_get_auto_reload(dual_timer_regs_t * DUAL_TIMERx)443 __STATIC_INLINE uint32_t ll_dual_timer_get_auto_reload(dual_timer_regs_t *DUAL_TIMERx)
444 {
445     return (uint32_t)(READ_REG(DUAL_TIMERx->RELOAD));
446 }
447 
448 /**
449   * @brief  Set the backgroud-reload value.
450   *
451   *  Register|BitsName
452   *  --------|--------
453   *  BG_LOAD | BG_LOAD
454   *
455   * @param  DUAL_TIMERx Timer instance
456   * @param  background_reload between Min_Data=0 and Max_Data=0xFFFFFFFF
457   * @retval None
458   */
ll_dual_timer_set_background_reload(dual_timer_regs_t * DUAL_TIMERx,uint32_t background_reload)459 __STATIC_INLINE void ll_dual_timer_set_background_reload(dual_timer_regs_t *DUAL_TIMERx, uint32_t background_reload)
460 {
461     WRITE_REG(DUAL_TIMERx->BG_LOAD, background_reload);
462 }
463 
464 /**
465   * @brief  Get the backgroud-reload value.
466   *
467   *  Register|BitsName
468   *  --------|--------
469   *  BG_LOAD | BG_LOAD
470   *
471   * @param  DUAL_TIMERx Timer instance
472   * @retval Return value between Min_Data=0 and Max_Data=0xFFFFFFFF
473   */
ll_dual_timer_get_background_reload(dual_timer_regs_t * DUAL_TIMERx)474 __STATIC_INLINE uint32_t ll_dual_timer_get_background_reload(dual_timer_regs_t *DUAL_TIMERx)
475 {
476     return (uint32_t)(READ_REG(DUAL_TIMERx->BG_LOAD));
477 }
478 
479 /** @} */
480 
481 /** @defgroup DUAL_TIM_LL_EF_IT_Management IT_Management
482   * @{
483   */
484 
485 /**
486   * @brief  Enable dual_timer interrupt.
487   *
488   *  Register|BitsName
489   *  --------|--------
490   *  CTRL | INTEN
491   *
492   * @param  DUAL_TIMERx Timer instance
493   * @retval None
494   */
ll_dual_timer_enable_it(dual_timer_regs_t * DUAL_TIMERx)495 __STATIC_INLINE void ll_dual_timer_enable_it(dual_timer_regs_t *DUAL_TIMERx)
496 {
497     SET_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_INTEN);
498 }
499 
500 /**
501   * @brief  Disable dual_timer interrput.
502   *
503   *  Register|BitsName
504   *  --------|--------
505   *  CTRL | INTEN
506   *
507   * @param  DUAL_TIMERx Timer instance
508   * @retval None
509   */
ll_dual_timer_disable_it(dual_timer_regs_t * DUAL_TIMERx)510 __STATIC_INLINE void ll_dual_timer_disable_it(dual_timer_regs_t *DUAL_TIMERx)
511 {
512     CLEAR_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_INTEN);
513 }
514 
515 /**
516   * @brief  Indicate whether the dual_timer interrput is enabled.
517   *
518   *  Register|BitsName
519   *  --------|--------
520   *  CTRL | INTEN
521   *
522   * @param  DUAL_TIMERx Timer instance
523   * @retval State of bit (1 or 0).
524   */
ll_dual_timer_is_enabled_it(dual_timer_regs_t * DUAL_TIMERx)525 __STATIC_INLINE uint32_t ll_dual_timer_is_enabled_it(dual_timer_regs_t *DUAL_TIMERx)
526 {
527     return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_INTEN) == (DUAL_TIMER_CTRL_INTEN));
528 }
529 
530 /** @} */
531 
532 /** @defgroup DUAL_TIMER_LL_EF_FLAG_Management FLAG_Management
533   * @{
534   */
535 
536 /**
537   * @brief  Clear the interrupt flag (INTSTAT).
538   *
539 
540   *  Register|BitsName
541   *  --------|--------
542   *  INTCLR | INTCLR
543   *
544   * @param  DUAL_TIMERx Timer instance
545   * @retval None
546   */
ll_dual_timer_clear_flag_it(dual_timer_regs_t * DUAL_TIMERx)547 __STATIC_INLINE void ll_dual_timer_clear_flag_it(dual_timer_regs_t *DUAL_TIMERx)
548 {
549     WRITE_REG(DUAL_TIMERx->INTCLR, DUAL_TIMER_INT_CLR);
550 }
551 
552 /**
553   * @brief  Indicate whether interrupt flag (INTSTAT) is set (interrupt is pending).
554   *
555   *  Register|BitsName
556   *  --------|--------
557   *  INTSTAT | INTSTAT
558   *
559   * @param  DUAL_TIMERx Timer instance
560   * @retval State of bit (1 or 0).
561   */
ll_dual_timer_is_active_flag_it(dual_timer_regs_t * DUAL_TIMERx)562 __STATIC_INLINE uint32_t ll_dual_timer_is_active_flag_it(dual_timer_regs_t *DUAL_TIMERx)
563 {
564     return (READ_BITS(DUAL_TIMERx->INTSTAT, DUAL_TIMER_ISR_TI) == (DUAL_TIMER_ISR_TI));
565 }
566 
567 /**
568   * @brief  Get Dual_timer raw interrupt flags
569   *
570   *  Register|BitsName
571   *  --------|--------
572   *  RAW_INTSTAT | RAW_INTSTAT
573   *
574   * @param  DUAL_TIMERx Timer instance
575   * @retval State of bit (1 or 0).
576   */
ll_dual_timer_get_raw_it_flag(dual_timer_regs_t * DUAL_TIMERx)577 __STATIC_INLINE uint32_t ll_dual_timer_get_raw_it_flag(dual_timer_regs_t *DUAL_TIMERx)
578 {
579     return (READ_REG(DUAL_TIMERx->RAW_INTSTAT));
580 }
581 
582 /** @} */
583 
584 /** @defgroup DUAL_TIMER_LL_EF_Init Initialization and de-initialization functions
585   * @{
586   */
587 
588 /**
589   * @brief  De-initialize DUAL_TIMER registers (Registers restored to their default values).
590   * @param  DUAL_TIMERx DUAL_TIM instance
591   * @retval An error_status_t enumeration value:
592   *          - SUCCESS: DUAL_TIMER registers are de-initialized
593   *          - ERROR: DUAL_TIMER registers are not de-initialized
594   */
595 error_status_t ll_dual_timer_deinit(dual_timer_regs_t *DUAL_TIMERx);
596 
597 /**
598   * @brief  Initialize DUAL_TIMER registers according to the specified
599   *         parameters in p_dual_timer_init.
600   * @param  DUAL_TIMERx DUAL_TIMER instance
601   * @param  p_dual_timer_init Pointer to a ll_dual_timer_init_t structure that contains the configuration
602   *                         information for the specified DUAL_TIMER peripheral.
603   * @retval An error_status_t enumeration value:
604   *          - SUCCESS: DUAL_TIMER registers are initialized according to p_dual_timer_init content
605   *          - ERROR: Problem occurred during DUAL_TIM Registers initialization
606   */
607 error_status_t ll_dual_timer_init(dual_timer_regs_t *DUAL_TIMERx, ll_dual_timer_init_t *p_dual_timer_init);
608 
609 /**
610   * @brief Set each field of a @ref ll_dual_timer_init_t type structure to default value.
611   * @param p_dual_timer_init  Pointer to a @ref ll_dual_timer_init_t structure
612   *                         whose fields will be set to default values.
613   * @retval None
614   */
615 void ll_dual_timer_struct_init(ll_dual_timer_init_t *p_dual_timer_init);
616 
617 /** @} */
618 
619 /** @} */
620 
621 #endif /* DUAL_TIMER0 || DUAL_TIMER1 */
622 
623 #ifdef __cplusplus
624 }
625 #endif
626 
627 #endif /* __GR55XX_LL_DUAL_TIMER_H__ */
628 
629 /** @} */
630 
631 /** @} */
632 
633 /** @} */
634