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  * Redistribution and use in source and binary forms, with or without modification,are permitted provided that the
8  * following conditions are met:
9  *
10  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following
11  * disclaimer.
12  *
13  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
14  * following disclaimer in the documentation and/or other materials provided with the distribution.
15  *
16  * Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote
17  * products derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY,OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
25  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  **********************************************************************************************************************/
37 /*******************************************************************************
38 ** Author(s) Identity **
39 ********************************************************************************
40 ** Initials Name **
41 ** ---------------------------------------------------------------------------**
42 ** DM Daniel Mysliwitz **
43 ** DCM Dragos C. Molocea **
44 ** BG Blandine Guillot **
45 ** JO Julia Ott **
46 ** VO Vanessa Ongaro **
47 *******************************************************************************/
48 
49 /*******************************************************************************
50 ** Revision Control History **
51 ********************************************************************************
52 ** V0.1.0: 2014-05-12, DM: Initial version **
53 ** V0.1.1: 2015-02-10, DM: Individual header file added **
54 ** V0.1.2: 2017-02-22, DM: Macros/functions for bit access added **
55 ** V0.1.3: 2017-10-20, DM: MISRA 2012 compliance, the following PC-Lint **
56 ** rules are globally deactivated: **
57 ** - Info 793: ANSI/ISO limit of 6 'significant **
58 ** characters in an external identifier **
59 ** - Info 835: A zero has been given as right **
60 ** argument to operator **
61 ** - Info 845: The left argument to operator '&' **
62 ** is certain to be 0 **
63 ** V0.1.4: 2017-07-09, BG: TIMER3_ReadRequest_En, TIMER3_ReadRequest_Dis, **
64 ** TIMER3_CountReady_Sts, TIMER3_HighByte_Ovf_Sts, **
65 ** TIMER3_LowByte_Ovf_Sts, TIMER3_T3L_Start, **
66 ** TIMER3_T3L_Stop, TIMER3_T3HL_Start, **
67 ** TIMER3_T3HL_Stop and **
68 ** TIMER3_Mode3b_Trigger_Select(TIMER3_TRIGG_IN_SEL)**
69 ** rewritten for unit tests **
70 ** V0.1.5: 2018-11-27, JO: Doxygen update **
71 ** Moved revision history from timer3.c to timer3.h **
72 ** V0.1.6: 2020-04-15, BG: Updated revision history format **
73 ** V0.1.7: 2020-07-21, BG: EP-439: Formatted .h/.c files **
74 ** V0.1.8: 2022-02-25, JO: EP-1040: Corrected usage of CMSIS_Irq_Dis() **
75 ** V0.1.9: 2022-02-28, JO: EP-936: Updated copyright and branding **
76 ** V0.2.0: 2022-10-18, VO: EP-1252: Updated enum definitions **
77 *******************************************************************************/
78 
79 #ifndef TIMER3_H
80 #define TIMER3_H
81 
82 /*******************************************************************************
83 ** Includes **
84 *******************************************************************************/
85 #include "tle987x.h"
86 #include "types.h"
87 #include "sfr_access.h"
88 
89 /*******************************************************************************
90 ** Global Type Definitions **
91 *******************************************************************************/
93 #define TIMER3_MODE0 (0u)
95 #define TIMER3_MODE1 (1u)
97 #define TIMER3_MODE2 (2u)
99 #define TIMER3_MODE3 (3u)
100 
105 {
113  TIMER3_CCU6_COUT62 = 7u
115 
119 typedef enum TIMER3_Clk_Source
120 {
122  TIMER3_MI_CLK = 1u
124 
129 {
133  TIMER3_Div_8 = 3u
135 
136 /******************************************************************************
137 ** Global Function Definitions **
138 *******************************************************************************/
152 {
154 }
155 
169 {
171 }
172 
188 {
190 }
191 
206 {
208 }
209 
224 {
226 }
227 
243 {
245 }
246 
266 {
268 }
269 
293 {
295 }
296 
320 {
322 }
323 
344 {
346 }
347 
362 {
364 }
365 
389 {
391 }
392 
407 {
409 }
410 
425 {
427 }
428 
443 {
445 }
446 
461 {
463 }
464 
479 {
481 }
482 
497 {
498  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 4u, 0x10u, 1u);
499 }
500 
515 {
516  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 4u, 0x10u, 0u);
517 }
518 
533 {
534  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 5u, 0x20u, 1u);
535 }
536 
551 {
552  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 5u, 0x20u, 0u);
553 }
554 
570 {
571  Field_Wrt32(&TIMER3->CNT.reg, 0u, 0xFFFFu, t3);
572 }
573 
594 {
596 }
597 
619 {
621 }
622 
643 {
645 }
646 
668 {
670 }
671 
692 {
694 }
695 
716 {
718 }
719 
720 /*******************************************************************************
721 ** Global Function Declarations **
722 *******************************************************************************/
727 void TIMER3_Init(void);
728 
741 void TIMER3_Start(void);
742 
755 void TIMER3_Stop(void);
756 
771 void TIMER3_Set_Cnt_Value(uint16 Cnt_Value);
772 
787 void TIMER3_Set_Cmp_Value(uint16 Cmp_Value);
788 
806 
824 
840 
856 
857 
858 /*******************************************************************************
859 ** Global Inline Function Declarations **
860 *******************************************************************************/
861 
863 INLINE bool TIMER3_isCountReady(void);
866 
867 /*******************************************************************************
868 ** Global Inline Function Definitions **
869 *******************************************************************************/
870 
886 {
888 }
889 
909 {
910  bool res = false;
911 
912  if (TIMER3_CountReady_Sts() == (uint8)1)
913  {
914  res = true;
915  }
916 
917  return (res);
918 }
919 
943 {
944  bool res = false;
945 
946  if (TIMER3_HighByte_Ovf_Sts() == (uint8)1)
947  {
948  res = true;
949  }
950 
951  return (res);
952 }
953 
977 {
978  bool res = false;
979 
980  if (TIMER3_LowByte_Ovf_Sts() == (uint8)1)
981  {
982  res = true;
983  }
984 
985  return (res);
986 }
987 
988 #endif
#define TIMER3
Definition: tle987x.h:6103
#define TIMER3_CTRL_T3L_OVF_IE_Pos
Definition: tle987x.h:10059
#define TIMER3_T3_TRIGG_CTRL_T3_TRIGG_INP_SEL_Pos
Definition: tle987x.h:10092
#define TIMER3_CTRL_T3H_OVF_IE_Msk
Definition: tle987x.h:10058
#define TIMER3_ISRCLR_T3H_OVF_ICLR_Msk
Definition: tle987x.h:10081
#define TIMER3_CTRL_CNT_RDY_Msk
Definition: tle987x.h:10070
#define TIMER3_CTRL_T3_RD_REQ_CONF_Pos
Definition: tle987x.h:10071
#define TIMER3_T3_TRIGG_CTRL_T3_TRIGG_INP_SEL_Msk
Definition: tle987x.h:10093
#define TIMER3_T3_TRIGG_CTRL_RETRIG_Pos
Definition: tle987x.h:10088
#define TIMER3_CTRL_TR3H_Msk
Definition: tle987x.h:10068
#define TIMER3_CTRL_TR3L_Msk
Definition: tle987x.h:10064
#define TIMER3_CTRL_T3_RD_REQ_Pos
Definition: tle987x.h:10073
#define TIMER3_CTRL_CNT_RDY_Pos
Definition: tle987x.h:10069
#define TIMER3_CTRL_TR3H_Pos
Definition: tle987x.h:10067
#define TIMER3_CTRL_T3H_OVF_STS_Pos
Definition: tle987x.h:10065
#define TIMER3_CTRL_T3_RD_REQ_Msk
Definition: tle987x.h:10074
#define TIMER3_CTRL_T3_PD_N_Pos
Definition: tle987x.h:10075
#define TIMER3_ISRCLR_T3L_OVF_ICLR_Pos
Definition: tle987x.h:10078
#define TIMER3_ISRCLR_T3H_OVF_ICLR_Pos
Definition: tle987x.h:10080
#define TIMER3_CTRL_T3H_OVF_STS_Msk
Definition: tle987x.h:10066
#define TIMER3_T3_TRIGG_CTRL_RETRIG_Msk
Definition: tle987x.h:10089
#define TIMER3_CTRL_T3H_OVF_IE_Pos
Definition: tle987x.h:10057
#define TIMER3_CTRL_T3_RD_REQ_CONF_Msk
Definition: tle987x.h:10072
#define TIMER3_CTRL_T3_PD_N_Msk
Definition: tle987x.h:10076
#define TIMER3_CTRL_T3L_OVF_STS_Msk
Definition: tle987x.h:10062
#define TIMER3_CTRL_T3L_OVF_IE_Msk
Definition: tle987x.h:10060
#define TIMER3_ISRCLR_T3L_OVF_ICLR_Msk
Definition: tle987x.h:10079
#define TIMER3_CTRL_T3L_OVF_STS_Pos
Definition: tle987x.h:10061
#define TIMER3_CTRL_TR3L_Pos
Definition: tle987x.h:10063
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:362
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:407
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:347
INLINE void TIMER3_T3HL_Start(void)
starts running Timer3 (High and Low Byte Timer)
Definition: timer3.h:424
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:105
@ TIMER3_CCU6_CC61
Definition: timer3.h:107
@ TIMER3_CCU6_CC60
Definition: timer3.h:106
@ TIMER3_CCU6_PM
Definition: timer3.h:110
@ TIMER3_CCU6_COUT60
Definition: timer3.h:111
@ TIMER3_CCU6_ZM
Definition: timer3.h:109
@ TIMER3_CCU6_CC62
Definition: timer3.h:108
@ TIMER3_CCU6_COUT61
Definition: timer3.h:112
@ TIMER3_CCU6_COUT62
Definition: timer3.h:113
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:223
INLINE void TIMER3_Value_Set(uint32 t3)
Sets TIMER3 Value.
Definition: timer3.h:569
INLINE uint8 TIMER3_CountReady_Sts(void)
Reads the Timer3 Count Ready Status.
Definition: timer3.h:265
INLINE void TIMER3_HB_OF_Int_Dis(void)
disables Timer 3 Overflow Interrupt (High Byte Timer).
Definition: timer3.h:618
INLINE void TIMER3_ReadRequest_Sw_Set(void)
enables triggering Timer3 Read Request by Software.
Definition: timer3.h:242
INLINE void TIMER3_ReadRequest_En(void)
enables reading from Timer3.
Definition: timer3.h:187
INLINE bool TIMER3_isCountReady(void)
checks Timer3 count ready (Mode 1b, 3b)
Definition: timer3.h:908
INLINE void TIMER3_Retrigger_En(void)
enables re-trigging for CCU6-T12 ZM and CCU6-T12 PM.
Definition: timer3.h:460
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:205
INLINE void TIMER3_LB_OF_Int_Dis(void)
disables Timer 3 Overflow Interrupt (Low Byte Timer).
Definition: timer3.h:667
INLINE void TIMER3_T3HL_Stop(void)
stops running Timer3 (High and Low Byte Timer)
Definition: timer3.h:442
INLINE void TIMER3_Mode1b_Reset_On_Rising_Edge_En(void)
enables Timer 3 Trigger Reset On Rising Edge for Mode 1b.
Definition: timer3.h:496
INLINE uint8 TIMER3_LowByte_Ovf_Sts(void)
Reads the Timer3 Overflow Flag (Low Byte Timer).
Definition: timer3.h:319
INLINE void TIMER3_LB_OF_Int_En(void)
enables Timer 3 Overflow Interrupt (Low Byte Timer).
Definition: timer3.h:642
INLINE void TIMER3_HB_OF_Int_Clr(void)
clears Timer 3 Overflow Interrupt flag (High Byte Timer).
Definition: timer3.h:691
INLINE void TIMER3_Power_Off(void)
Disables the Timer3 module.
Definition: timer3.h:168
INLINE void TIMER3_Retrigger_Dis(void)
disables re-trigging for CCU6-T12 ZM and CCU6-T12 PM.
Definition: timer3.h:478
INLINE uint8 TIMER3_HighByte_Ovf_Sts(void)
Reads the Timer3 Overflow Flag (High Byte Timer).
Definition: timer3.h:292
INLINE void TIMER3_T3L_Start(void)
starts running Timer3 (Low Byte Timer)
Definition: timer3.h:388
INLINE bool TIMER3_isLowByteOverflow(void)
checks Timer3 Low Byte overflow status
Definition: timer3.h:976
INLINE void TIMER3_Mode1b_Reset_On_Rising_Edge_Dis(void)
disables Timer 3 Trigger Reset On Rising Edge for Mode 1b.
Definition: timer3.h:514
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:593
INLINE bool TIMER3_isHighByteOverflow(void)
checks Timer3 High Byte overflow status
Definition: timer3.h:942
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:343
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:715
INLINE void TIMER3_Mode1b_Reset_On_Falling_Edge_Dis(void)
disables Timer 3 Trigger Reset On Falling Edge for Mode 1b.
Definition: timer3.h:550
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:532
INLINE void TIMER3_Mode3b_Trigger_Select(TTIMER3_TRIGG_IN_SEL insel)
sets TIMER3 Trigger Input Selection
Definition: timer3.h:885
TIMER3_Clk_Source
Definition: timer3.h:120
@ TIMER3_MI_CLK
Definition: timer3.h:122
@ TIMER3_LP_CLK
Definition: timer3.h:121
INLINE void TIMER3_Power_On(void)
Enables the Timer3 module.
Definition: timer3.h:151
enum TIMER3_TRIGG_IN_SEL TTIMER3_TRIGG_IN_SEL
INLINE void TIMER3_T3H_Stop(void)
stops running Timer3 (High Byte Timer)
Definition: timer3.h:361
INLINE void TIMER3_T3L_Stop(void)
stops running Timer3 (Low Byte Timer)
Definition: timer3.h:406
TIMER3_Clk_Prescaler
Definition: timer3.h:129
@ TIMER3_Div_2
Definition: timer3.h:131
@ TIMER3_Div_1
Definition: timer3.h:130
@ TIMER3_Div_4
Definition: timer3.h:132
@ TIMER3_Div_8
Definition: timer3.h:133
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:148
uint8_t uint8
8 bit unsigned value
Definition: types.h:153
uint16_t uint16
16 bit unsigned value
Definition: types.h:154
uint32_t uint32
32 bit unsigned value
Definition: types.h:155