Infineon MOTIX™ MCU TLE987x Device Family SDK
timer3.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) Infineon Technologies AG
5  * All rights reserved.
6  *
7  * The applicable license agreement can be found at this pack's installation directory in the file
8  * license/IFX_SW_Licence_MOTIX_LITIX.txt
9  *
10  **********************************************************************************************************************/
20 /*******************************************************************************
21 ** Author(s) Identity **
22 ********************************************************************************
23 ** Initials Name **
24 ** ---------------------------------------------------------------------------**
25 ** DM Daniel Mysliwitz **
26 ** DCM Dragos C. Molocea **
27 ** BG Blandine Guillot **
28 ** JO Julia Ott **
29 ** VO Vanessa Ongaro **
30 *******************************************************************************/
31 
32 /*******************************************************************************
33 ** Revision Control History **
34 ********************************************************************************
35 ** V0.1.0: 2014-05-12, DM: Initial version **
36 ** V0.1.1: 2015-02-10, DM: Individual header file added **
37 ** V0.1.2: 2017-02-22, DM: Macros/functions for bit access added **
38 ** V0.1.3: 2017-10-20, DM: MISRA 2012 compliance, the following PC-Lint **
39 ** rules are globally deactivated: **
40 ** - Info 793: ANSI/ISO limit of 6 'significant **
41 ** characters in an external identifier **
42 ** - Info 835: A zero has been given as right **
43 ** argument to operator **
44 ** - Info 845: The left argument to operator '&' **
45 ** is certain to be 0 **
46 ** V0.1.4: 2017-07-09, BG: TIMER3_ReadRequest_En, TIMER3_ReadRequest_Dis, **
47 ** TIMER3_CountReady_Sts, TIMER3_HighByte_Ovf_Sts, **
48 ** TIMER3_LowByte_Ovf_Sts, TIMER3_T3L_Start, **
49 ** TIMER3_T3L_Stop, TIMER3_T3HL_Start, **
50 ** TIMER3_T3HL_Stop and **
51 ** TIMER3_Mode3b_Trigger_Select(TIMER3_TRIGG_IN_SEL)**
52 ** rewritten for unit tests **
53 ** V0.1.5: 2018-11-27, JO: Doxygen update **
54 ** Moved revision history from timer3.c to timer3.h **
55 ** V0.1.6: 2020-04-15, BG: Updated revision history format **
56 ** V0.1.7: 2020-07-21, BG: EP-439: Formatted .h/.c files **
57 ** V0.1.8: 2022-02-25, JO: EP-1040: Corrected usage of CMSIS_Irq_Dis() **
58 ** V0.1.9: 2022-02-28, JO: EP-936: Updated copyright and branding **
59 ** V0.2.0: 2022-10-18, VO: EP-1252: Updated enum definitions **
60 ** V0.2.1: 2025-01-02, JO: EP-1493: Updated license **
61 *******************************************************************************/
62 
63 #ifndef TIMER3_H
64 #define TIMER3_H
65 
66 /*******************************************************************************
67 ** Includes **
68 *******************************************************************************/
69 #include "tle987x.h"
70 #include "types.h"
71 #include "sfr_access.h"
72 
73 /*******************************************************************************
74 ** Global Type Definitions **
75 *******************************************************************************/
77 #define TIMER3_MODE0 (0u)
79 #define TIMER3_MODE1 (1u)
81 #define TIMER3_MODE2 (2u)
83 #define TIMER3_MODE3 (3u)
84 
88 typedef enum TIMER3_TRIGG_IN_SEL
89 {
97  TIMER3_CCU6_COUT62 = 7u
99 
103 typedef enum TIMER3_Clk_Source
104 {
106  TIMER3_MI_CLK = 1u
108 
113 {
117  TIMER3_Div_8 = 3u
119 
120 /******************************************************************************
121 ** Global Function Definitions **
122 *******************************************************************************/
136 {
138 }
139 
153 {
155 }
156 
172 {
174 }
175 
190 {
192 }
193 
208 {
210 }
211 
227 {
229 }
230 
250 {
252 }
253 
277 {
279 }
280 
304 {
306 }
307 
328 {
330 }
331 
346 {
348 }
349 
373 {
375 }
376 
391 {
393 }
394 
409 {
411 }
412 
427 {
429 }
430 
445 {
447 }
448 
463 {
465 }
466 
481 {
482  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 4u, 0x10u, 1u);
483 }
484 
499 {
500  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 4u, 0x10u, 0u);
501 }
502 
517 {
518  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 5u, 0x20u, 1u);
519 }
520 
535 {
536  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 5u, 0x20u, 0u);
537 }
538 
554 {
555  Field_Wrt32(&TIMER3->CNT.reg, 0u, 0xFFFFu, t3);
556 }
557 
578 {
580 }
581 
603 {
605 }
606 
627 {
629 }
630 
652 {
654 }
655 
676 {
678 }
679 
700 {
702 }
703 
704 /*******************************************************************************
705 ** Global Function Declarations **
706 *******************************************************************************/
711 void TIMER3_Init(void);
712 
725 void TIMER3_Start(void);
726 
739 void TIMER3_Stop(void);
740 
755 void TIMER3_Set_Cnt_Value(uint16 Cnt_Value);
756 
771 void TIMER3_Set_Cmp_Value(uint16 Cmp_Value);
772 
790 
808 
824 
840 
841 
842 /*******************************************************************************
843 ** Global Inline Function Declarations **
844 *******************************************************************************/
845 
847 INLINE bool TIMER3_isCountReady(void);
850 
851 /*******************************************************************************
852 ** Global Inline Function Definitions **
853 *******************************************************************************/
854 
870 {
872 }
873 
893 {
894  bool res = false;
895 
896  if (TIMER3_CountReady_Sts() == (uint8)1)
897  {
898  res = true;
899  }
900 
901  return (res);
902 }
903 
927 {
928  bool res = false;
929 
930  if (TIMER3_HighByte_Ovf_Sts() == (uint8)1)
931  {
932  res = true;
933  }
934 
935  return (res);
936 }
937 
961 {
962  bool res = false;
963 
964  if (TIMER3_LowByte_Ovf_Sts() == (uint8)1)
965  {
966  res = true;
967  }
968 
969  return (res);
970 }
971 
972 #endif
#define TIMER3
Definition: tle987x.h:6077
#define TIMER3_CTRL_T3L_OVF_IE_Pos
Definition: tle987x.h:10033
#define TIMER3_T3_TRIGG_CTRL_T3_TRIGG_INP_SEL_Pos
Definition: tle987x.h:10066
#define TIMER3_CTRL_T3H_OVF_IE_Msk
Definition: tle987x.h:10032
#define TIMER3_ISRCLR_T3H_OVF_ICLR_Msk
Definition: tle987x.h:10055
#define TIMER3_CTRL_CNT_RDY_Msk
Definition: tle987x.h:10044
#define TIMER3_CTRL_T3_RD_REQ_CONF_Pos
Definition: tle987x.h:10045
#define TIMER3_T3_TRIGG_CTRL_T3_TRIGG_INP_SEL_Msk
Definition: tle987x.h:10067
#define TIMER3_T3_TRIGG_CTRL_RETRIG_Pos
Definition: tle987x.h:10062
#define TIMER3_CTRL_TR3H_Msk
Definition: tle987x.h:10042
#define TIMER3_CTRL_TR3L_Msk
Definition: tle987x.h:10038
#define TIMER3_CTRL_T3_RD_REQ_Pos
Definition: tle987x.h:10047
#define TIMER3_CTRL_CNT_RDY_Pos
Definition: tle987x.h:10043
#define TIMER3_CTRL_TR3H_Pos
Definition: tle987x.h:10041
#define TIMER3_CTRL_T3H_OVF_STS_Pos
Definition: tle987x.h:10039
#define TIMER3_CTRL_T3_RD_REQ_Msk
Definition: tle987x.h:10048
#define TIMER3_CTRL_T3_PD_N_Pos
Definition: tle987x.h:10049
#define TIMER3_ISRCLR_T3L_OVF_ICLR_Pos
Definition: tle987x.h:10052
#define TIMER3_ISRCLR_T3H_OVF_ICLR_Pos
Definition: tle987x.h:10054
#define TIMER3_CTRL_T3H_OVF_STS_Msk
Definition: tle987x.h:10040
#define TIMER3_T3_TRIGG_CTRL_RETRIG_Msk
Definition: tle987x.h:10063
#define TIMER3_CTRL_T3H_OVF_IE_Pos
Definition: tle987x.h:10031
#define TIMER3_CTRL_T3_RD_REQ_CONF_Msk
Definition: tle987x.h:10046
#define TIMER3_CTRL_T3_PD_N_Msk
Definition: tle987x.h:10050
#define TIMER3_CTRL_T3L_OVF_STS_Msk
Definition: tle987x.h:10036
#define TIMER3_CTRL_T3L_OVF_IE_Msk
Definition: tle987x.h:10034
#define TIMER3_ISRCLR_T3L_OVF_ICLR_Msk
Definition: tle987x.h:10053
#define TIMER3_CTRL_T3L_OVF_STS_Pos
Definition: tle987x.h:10035
#define TIMER3_CTRL_TR3L_Pos
Definition: tle987x.h:10037
SFR low level access library.
INLINE void Field_Mod32(volatile uint32 *reg, uint32 pos, uint32 msk, uint32 val)
This function writes a bit field in a 32-bit register.
Definition: sfr_access.h:347
INLINE uint8 u1_Field_Rd32(const volatile uint32 *reg, uint32 pos, uint32 msk)
This function reads a 1-bit field of a 32-bit register.
Definition: sfr_access.h:392
INLINE void Field_Wrt32(volatile uint32 *reg, uint32 pos, uint32 msk, uint32 val)
This function writes a bit field in a 32-bit register.
Definition: sfr_access.h:332
INLINE void TIMER3_T3HL_Start(void)
starts running Timer3 (High and Low Byte Timer)
Definition: timer3.h:408
enum TIMER3_Clk_Source TTIMER3_Clk_Source
void TIMER3_Set_Cmp_Value(uint16 Cmp_Value)
Set the Timer3 compare value.
TIMER3_TRIGG_IN_SEL
Definition: timer3.h:89
@ TIMER3_CCU6_CC61
Definition: timer3.h:91
@ TIMER3_CCU6_CC60
Definition: timer3.h:90
@ TIMER3_CCU6_PM
Definition: timer3.h:94
@ TIMER3_CCU6_COUT60
Definition: timer3.h:95
@ TIMER3_CCU6_ZM
Definition: timer3.h:93
@ TIMER3_CCU6_CC62
Definition: timer3.h:92
@ TIMER3_CCU6_COUT61
Definition: timer3.h:96
@ TIMER3_CCU6_COUT62
Definition: timer3.h:97
uint16 TIMER3_Get_Cnt_Value(void)
Get the Timer3 counter value.
INLINE void TIMER3_ReadRequest_Hw_Set(void)
enables triggering Timer3 Read Request by Hardware.
Definition: timer3.h:207
INLINE void TIMER3_Value_Set(uint32 t3)
Sets TIMER3 Value.
Definition: timer3.h:553
INLINE uint8 TIMER3_CountReady_Sts(void)
Reads the Timer3 Count Ready Status.
Definition: timer3.h:249
INLINE void TIMER3_HB_OF_Int_Dis(void)
disables Timer 3 Overflow Interrupt (High Byte Timer).
Definition: timer3.h:602
INLINE void TIMER3_ReadRequest_Sw_Set(void)
enables triggering Timer3 Read Request by Software.
Definition: timer3.h:226
INLINE void TIMER3_ReadRequest_En(void)
enables reading from Timer3.
Definition: timer3.h:171
INLINE bool TIMER3_isCountReady(void)
checks Timer3 count ready (Mode 1b, 3b)
Definition: timer3.h:892
INLINE void TIMER3_Retrigger_En(void)
enables re-trigging for CCU6-T12 ZM and CCU6-T12 PM.
Definition: timer3.h:444
uint16 TIMER3_Value_Get(void)
Get the Timer3 counter value.
enum TIMER3_Clk_Prescaler TTIMER3_Clk_Prescaler
INLINE void TIMER3_ReadRequest_Dis(void)
disables reading from Timer3.
Definition: timer3.h:189
INLINE void TIMER3_LB_OF_Int_Dis(void)
disables Timer 3 Overflow Interrupt (Low Byte Timer).
Definition: timer3.h:651
INLINE void TIMER3_T3HL_Stop(void)
stops running Timer3 (High and Low Byte Timer)
Definition: timer3.h:426
INLINE void TIMER3_Mode1b_Reset_On_Rising_Edge_En(void)
enables Timer 3 Trigger Reset On Rising Edge for Mode 1b.
Definition: timer3.h:480
INLINE uint8 TIMER3_LowByte_Ovf_Sts(void)
Reads the Timer3 Overflow Flag (Low Byte Timer).
Definition: timer3.h:303
INLINE void TIMER3_LB_OF_Int_En(void)
enables Timer 3 Overflow Interrupt (Low Byte Timer).
Definition: timer3.h:626
INLINE void TIMER3_HB_OF_Int_Clr(void)
clears Timer 3 Overflow Interrupt flag (High Byte Timer).
Definition: timer3.h:675
INLINE void TIMER3_Power_Off(void)
Disables the Timer3 module.
Definition: timer3.h:152
INLINE void TIMER3_Retrigger_Dis(void)
disables re-trigging for CCU6-T12 ZM and CCU6-T12 PM.
Definition: timer3.h:462
INLINE uint8 TIMER3_HighByte_Ovf_Sts(void)
Reads the Timer3 Overflow Flag (High Byte Timer).
Definition: timer3.h:276
INLINE void TIMER3_T3L_Start(void)
starts running Timer3 (Low Byte Timer)
Definition: timer3.h:372
INLINE bool TIMER3_isLowByteOverflow(void)
checks Timer3 Low Byte overflow status
Definition: timer3.h:960
INLINE void TIMER3_Mode1b_Reset_On_Rising_Edge_Dis(void)
disables Timer 3 Trigger Reset On Rising Edge for Mode 1b.
Definition: timer3.h:498
void TIMER3_Init(void)
Initializes the Timer3 module based on the Config Wizard for MOTIX MCU configuration.
INLINE void TIMER3_HB_OF_Int_En(void)
enables Timer 3 Overflow Interrupt (High Byte Timer).
Definition: timer3.h:577
INLINE bool TIMER3_isHighByteOverflow(void)
checks Timer3 High Byte overflow status
Definition: timer3.h:926
void TIMER3_Clk_Source_Sel(TTIMER3_Clk_Source t3c)
Set the Timer3 clock source.
INLINE void TIMER3_T3H_Start(void)
starts running Timer3 (High Byte Timer)
Definition: timer3.h:327
void TIMER3_Clk_Prescaler_Sel(TTIMER3_Clk_Prescaler t3div)
Set the Timer3 clock prescaler.
INLINE void TIMER3_LB_OF_Int_Clr(void)
clears Timer 3 Overflow Interrupt flag (Low Byte Timer).
Definition: timer3.h:699
INLINE void TIMER3_Mode1b_Reset_On_Falling_Edge_Dis(void)
disables Timer 3 Trigger Reset On Falling Edge for Mode 1b.
Definition: timer3.h:534
void TIMER3_Set_Cnt_Value(uint16 Cnt_Value)
Set the Timer3 counter value.
INLINE void TIMER3_Mode1b_Reset_On_Falling_Edge_En(void)
enables Timer 3 Trigger Reset On Falling Edge for Mode 1b.
Definition: timer3.h:516
INLINE void TIMER3_Mode3b_Trigger_Select(TTIMER3_TRIGG_IN_SEL insel)
sets TIMER3 Trigger Input Selection
Definition: timer3.h:869
TIMER3_Clk_Source
Definition: timer3.h:104
@ TIMER3_MI_CLK
Definition: timer3.h:106
@ TIMER3_LP_CLK
Definition: timer3.h:105
INLINE void TIMER3_Power_On(void)
Enables the Timer3 module.
Definition: timer3.h:135
enum TIMER3_TRIGG_IN_SEL TTIMER3_TRIGG_IN_SEL
INLINE void TIMER3_T3H_Stop(void)
stops running Timer3 (High Byte Timer)
Definition: timer3.h:345
INLINE void TIMER3_T3L_Stop(void)
stops running Timer3 (Low Byte Timer)
Definition: timer3.h:390
TIMER3_Clk_Prescaler
Definition: timer3.h:113
@ TIMER3_Div_2
Definition: timer3.h:115
@ TIMER3_Div_1
Definition: timer3.h:114
@ TIMER3_Div_4
Definition: timer3.h:116
@ TIMER3_Div_8
Definition: timer3.h:117
void TIMER3_Start(void)
Starts the Timer3 module.
void TIMER3_Stop(void)
Stops the Timer3 module.
CMSIS register HeaderFile.
General type declarations.
#define INLINE
Definition: types.h:132
uint8_t uint8
8 bit unsigned value
Definition: types.h:137
uint16_t uint16
16 bit unsigned value
Definition: types.h:138
uint32_t uint32
32 bit unsigned value
Definition: types.h:139