TLE986x Device Family SDK
timer3.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) 2015, 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 ** JO Julia Ott **
44 ** BG Blandine Guillot **
45 *******************************************************************************/
46 
47 /*******************************************************************************
48 ** Revision Control History **
49 ********************************************************************************
50 ** V0.1.0: 2014-05-12, DM: Initial version **
51 ** V0.1.1: 2015-02-10, DM: Individual header file added **
52 ** V0.1.2: 2017-02-22, DM: Macros/functions for bit access added **
53 ** V0.1.3: 2017-10-20, DM: MISRA 2012 compliance, the following PC-Lint **
54 ** rules are globally deactivated: **
55 ** - Info 793: ANSI/ISO limit of 6 'significant **
56 ** characters in an external identifier **
57 ** - Info 835: A zero has been given as right **
58 ** argument to operator **
59 ** - Info 845: The left argument to operator '&' **
60 ** is certain to be 0 **
61 ** V0.1.4: 2017-07-09, BG: TIMER3_ReadRequest_En(),TIMER3_ReadRequest_Dis(),**
62 ** TIMER3_CountReady_Sts(),TIMER3_HighByte_Ovf_Sts()**
63 ** TIMER3_LowByte_Ovf_Sts(),TIMER3_T3L_Start(), **
64 ** TIMER3_T3L_Stop(), TIMER3_T3HL_Start(), **
65 ** TIMER3_T3HL_Stop() and TIMER3_Mode3b_Trigger... **
66 ** ..._Select(TTIMER3_TRIGG_IN_SEL) rewritten for **
67 ** unit tests **
68 ** V0.1.5: 2018-11-27, JO: Doxygen update, moved revision history from **
69 ** timer3.c to timer3.h **
70 ** V0.1.6: 2020-02-28, BG: Updated revision history format **
71 *******************************************************************************/
72 
73 #ifndef TIMER3_H
74 #define TIMER3_H
75 
76 /*******************************************************************************
77 ** Includes **
78 *******************************************************************************/
79 #include "tle986x.h"
80 #include "types.h"
81 #include "sfr_access.h"
82 
83 /*******************************************************************************
84 ** Global Type Definitions **
85 *******************************************************************************/
87 #define TIMER3_MODE0 (0u)
88 
89 #define TIMER3_MODE1 (1u)
90 
91 #define TIMER3_MODE2 (2u)
92 
93 #define TIMER3_MODE3 (3u)
94 
98 typedef enum
99 {
104  TIMER3_CCU6_PM = 4u,
105  TIMER3_CCU6_COUT60 = 5u,
106  TIMER3_CCU6_COUT61 = 6u,
107  TIMER3_CCU6_COUT62 = 7u
109 
113 typedef enum
114 {
115  TIMER3_LP_CLK = 0u,
116  TIMER3_MI_CLK = 1u
118 
122 typedef enum
123 {
124  TIMER3_Div_1 = 0u,
125  TIMER3_Div_2 = 1u,
126  TIMER3_Div_4 = 2u,
127  TIMER3_Div_8 = 3u
129 
130 /*******************************************************************************
131 ** Global Function Definitions **
132 *******************************************************************************/
145 INLINE void TIMER3_Power_On(void)
146 {
148 }
149 
162 INLINE void TIMER3_Power_Off(void)
163 {
165 }
166 
181 INLINE void TIMER3_ReadRequest_En(void)
182 {
184 }
185 
200 {
202 }
203 
218 {
220 }
221 
237 {
239 }
240 
260 {
262 }
263 
287 {
289 }
290 
314 {
316 }
317 
337 INLINE void TIMER3_T3H_Start(void)
338 {
340 }
341 
355 INLINE void TIMER3_T3H_Stop(void)
356 {
358 }
359 
382 INLINE void TIMER3_T3L_Start(void)
383 {
385 }
386 
400 INLINE void TIMER3_T3L_Stop(void)
401 {
403 }
404 
418 INLINE void TIMER3_T3HL_Start(void)
419 {
421 }
422 
436 INLINE void TIMER3_T3HL_Stop(void)
437 {
439 }
440 
454 INLINE void TIMER3_Retrigger_En(void)
455 {
457 }
458 
472 INLINE void TIMER3_Retrigger_Dis(void)
473 {
475 }
476 
491 {
492  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 4u, 0x10u, 1u);
493 }
494 
509 {
510  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 4u, 0x10u, 0u);
511 }
512 
527 {
528  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 5u, 0x20u, 1u);
529 }
530 
545 {
546  Field_Mod32(&TIMER3->T3_TRIGG_CTRL.reg, 5u, 0x20u, 0u);
547 }
548 
564 {
565  Field_Wrt32(&TIMER3->CNT.reg, 0u, 0xFFFFu, t3);
566 }
567 
587 INLINE void TIMER3_HB_OF_Int_En(void)
588 {
590 }
591 
612 INLINE void TIMER3_HB_OF_Int_Dis(void)
613 {
615 }
616 
636 INLINE void TIMER3_LB_OF_Int_En(void)
637 {
639 }
640 
661 INLINE void TIMER3_LB_OF_Int_Dis(void)
662 {
664 }
665 
685 INLINE void TIMER3_HB_OF_Int_Clr(void)
686 {
688 }
689 
709 INLINE void TIMER3_LB_OF_Int_Clr(void)
710 {
712 }
713 
714 /*******************************************************************************
715 ** Global Function Declarations **
716 *******************************************************************************/
721 void TIMER3_Init(void);
722 
735 void TIMER3_Start(void);
736 
749 void TIMER3_Stop(void);
750 
765 void TIMER3_Set_Cnt_Value(uint16 Cnt_Value);
766 
781 void TIMER3_Set_Cmp_Value(uint16 Cmp_Value);
782 
800 
818 
834 
850 
851 
852 /*******************************************************************************
853 ** Global Inline Function Declarations **
854 *******************************************************************************/
856 INLINE bool TIMER3_isCountReady(void);
859 /*******************************************************************************
860 ** Global Inline Function Definitions **
861 *******************************************************************************/
862 
878 {
880 }
881 
900 INLINE bool TIMER3_isCountReady(void)
901 {
902  bool res = false;
903 
904  if (TIMER3_CountReady_Sts() == (uint8)1)
905  {
906  res = true;
907  }
908 
909  return (res);
910 }
911 
935 {
936  bool res = false;
937 
938  if (TIMER3_HighByte_Ovf_Sts() == (uint8)1)
939  {
940  res = true;
941  }
942 
943  return (res);
944 }
945 
969 {
970  bool res = false;
971 
972  if (TIMER3_LowByte_Ovf_Sts() == (uint8)1)
973  {
974  res = true;
975  }
976 
977  return (res);
978 }
979 
980 #endif
TIMER3_T3HL_Start
INLINE void TIMER3_T3HL_Start(void)
starts running Timer3 (High and Low Byte Timer)
Definition: timer3.h:413
TIMER3_MI_CLK
Definition: timer3.h:112
TIMER3_T3HL_Stop
INLINE void TIMER3_T3HL_Stop(void)
stops running Timer3 (High and Low Byte Timer)
Definition: timer3.h:431
TIMER3_Set_Cmp_Value
void TIMER3_Set_Cmp_Value(uint16 Cmp_Value)
Set the Timer3 compare value.
TIMER3_LowByte_Ovf_Sts
INLINE uint8 TIMER3_LowByte_Ovf_Sts(void)
Reads the Timer3 Overflow Flag (Low Byte Timer).
Definition: timer3.h:308
TIMER3_HB_OF_Int_Clr
INLINE void TIMER3_HB_OF_Int_Clr(void)
clears Timer 3 Overflow Interrupt flag (High Byte Timer).
Definition: timer3.h:680
TIMER3_Mode3b_Trigger_Select
INLINE void TIMER3_Mode3b_Trigger_Select(TTIMER3_TRIGG_IN_SEL insel)
sets TIMER3 Trigger Input Selection
Definition: timer3.h:869
TIMER3_T3_TRIGG_CTRL_T3_TRIGG_INP_SEL_Pos
#define TIMER3_T3_TRIGG_CTRL_T3_TRIGG_INP_SEL_Pos
Definition: tle986x.h:9853
TIMER3_isCountReady
INLINE bool TIMER3_isCountReady(void)
checks Timer3 count ready (Mode 1b, 3b)
Definition: timer3.h:892
TIMER3_CTRL_TR3L_Msk
#define TIMER3_CTRL_TR3L_Msk
Definition: tle986x.h:9825
TTIMER3_TRIGG_IN_SEL
TTIMER3_TRIGG_IN_SEL
This enum lists TIMER3 Trigger Source Configuration.
Definition: timer3.h:94
TIMER3_T3_TRIGG_CTRL_T3_TRIGG_INP_SEL_Msk
#define TIMER3_T3_TRIGG_CTRL_T3_TRIGG_INP_SEL_Msk
Definition: tle986x.h:9854
TIMER3_CTRL_T3H_OVF_STS_Pos
#define TIMER3_CTRL_T3H_OVF_STS_Pos
Definition: tle986x.h:9826
types.h
General type declarations.
TIMER3_CTRL_T3_RD_REQ_Pos
#define TIMER3_CTRL_T3_RD_REQ_Pos
Definition: tle986x.h:9834
TIMER3_CTRL_CNT_RDY_Msk
#define TIMER3_CTRL_CNT_RDY_Msk
Definition: tle986x.h:9831
TIMER3_Power_On
INLINE void TIMER3_Power_On(void)
Enables the Timer3 module.
Definition: timer3.h:140
TIMER3_Div_4
Definition: timer3.h:122
TIMER3
#define TIMER3
Definition: tle986x.h:6010
TIMER3_Mode1b_Reset_On_Falling_Edge_Dis
INLINE void TIMER3_Mode1b_Reset_On_Falling_Edge_Dis(void)
disables Timer 3 Trigger Reset On Falling Edge for Mode 1b.
Definition: timer3.h:539
TIMER3_CTRL_T3_RD_REQ_Msk
#define TIMER3_CTRL_T3_RD_REQ_Msk
Definition: tle986x.h:9835
TIMER3_CTRL_CNT_RDY_Pos
#define TIMER3_CTRL_CNT_RDY_Pos
Definition: tle986x.h:9830
TIMER3_CTRL_T3L_OVF_STS_Msk
#define TIMER3_CTRL_T3L_OVF_STS_Msk
Definition: tle986x.h:9823
TIMER3_Div_1
Definition: timer3.h:120
TIMER3_CTRL_T3L_OVF_IE_Msk
#define TIMER3_CTRL_T3L_OVF_IE_Msk
Definition: tle986x.h:9821
TIMER3_CTRL_T3_PD_N_Msk
#define TIMER3_CTRL_T3_PD_N_Msk
Definition: tle986x.h:9837
sfr_access.h
SFR low level access library.
TIMER3_Mode1b_Reset_On_Rising_Edge_Dis
INLINE void TIMER3_Mode1b_Reset_On_Rising_Edge_Dis(void)
disables Timer 3 Trigger Reset On Rising Edge for Mode 1b.
Definition: timer3.h:503
TIMER3_CCU6_COUT61
Definition: timer3.h:102
TIMER3_ReadRequest_En
INLINE void TIMER3_ReadRequest_En(void)
enables reading from Timer3.
Definition: timer3.h:176
TIMER3_ISRCLR_T3L_OVF_ICLR_Pos
#define TIMER3_ISRCLR_T3L_OVF_ICLR_Pos
Definition: tle986x.h:9839
INLINE
#define INLINE
Definition: types.h:134
TIMER3_Clk_Prescaler_Sel
void TIMER3_Clk_Prescaler_Sel(TTIMER3_Clk_Prescaler t3div)
Set the Timer3 clock prescaler.
TIMER3_Div_8
Definition: timer3.h:123
TIMER3_CTRL_T3_PD_N_Pos
#define TIMER3_CTRL_T3_PD_N_Pos
Definition: tle986x.h:9836
TIMER3_Retrigger_Dis
INLINE void TIMER3_Retrigger_Dis(void)
disables re-trigging for CCU6-T12 ZM and CCU6-T12 PM.
Definition: timer3.h:467
TIMER3_T3L_Start
INLINE void TIMER3_T3L_Start(void)
starts running Timer3 (Low Byte Timer)
Definition: timer3.h:377
Field_Mod32
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:356
TIMER3_ReadRequest_Sw_Set
INLINE void TIMER3_ReadRequest_Sw_Set(void)
enables triggering Timer3 Read Request by Software.
Definition: timer3.h:231
u1_Field_Rd32
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:401
TIMER3_CCU6_CC60
Definition: timer3.h:96
uint16
unsigned short uint16
16 bit unsigned value
Definition: types.h:140
TIMER3_ISRCLR_T3H_OVF_ICLR_Pos
#define TIMER3_ISRCLR_T3H_OVF_ICLR_Pos
Definition: tle986x.h:9841
TIMER3_LB_OF_Int_Clr
INLINE void TIMER3_LB_OF_Int_Clr(void)
clears Timer 3 Overflow Interrupt flag (Low Byte Timer).
Definition: timer3.h:704
TIMER3_CTRL_T3H_OVF_IE_Msk
#define TIMER3_CTRL_T3H_OVF_IE_Msk
Definition: tle986x.h:9819
TIMER3_T3L_Stop
INLINE void TIMER3_T3L_Stop(void)
stops running Timer3 (Low Byte Timer)
Definition: timer3.h:395
TIMER3_CountReady_Sts
INLINE uint8 TIMER3_CountReady_Sts(void)
Reads the Timer3 Count Ready Status.
Definition: timer3.h:254
TIMER3_ISRCLR_T3L_OVF_ICLR_Msk
#define TIMER3_ISRCLR_T3L_OVF_ICLR_Msk
Definition: tle986x.h:9840
TIMER3_LP_CLK
Definition: timer3.h:111
TIMER3_HighByte_Ovf_Sts
INLINE uint8 TIMER3_HighByte_Ovf_Sts(void)
Reads the Timer3 Overflow Flag (High Byte Timer).
Definition: timer3.h:281
TIMER3_CTRL_T3H_OVF_IE_Pos
#define TIMER3_CTRL_T3H_OVF_IE_Pos
Definition: tle986x.h:9818
TIMER3_CCU6_ZM
Definition: timer3.h:99
TIMER3_T3H_Start
INLINE void TIMER3_T3H_Start(void)
starts running Timer3 (High Byte Timer)
Definition: timer3.h:332
TIMER3_CTRL_T3_RD_REQ_CONF_Pos
#define TIMER3_CTRL_T3_RD_REQ_CONF_Pos
Definition: tle986x.h:9832
TIMER3_Mode1b_Reset_On_Falling_Edge_En
INLINE void TIMER3_Mode1b_Reset_On_Falling_Edge_En(void)
enables Timer 3 Trigger Reset On Falling Edge for Mode 1b.
Definition: timer3.h:521
TIMER3_ReadRequest_Dis
INLINE void TIMER3_ReadRequest_Dis(void)
disables reading from Timer3.
Definition: timer3.h:194
TIMER3_isHighByteOverflow
INLINE bool TIMER3_isHighByteOverflow(void)
checks Timer3 High Byte overflow status
Definition: timer3.h:926
TIMER3_CTRL_TR3H_Msk
#define TIMER3_CTRL_TR3H_Msk
Definition: tle986x.h:9829
TIMER3_Retrigger_En
INLINE void TIMER3_Retrigger_En(void)
enables re-trigging for CCU6-T12 ZM and CCU6-T12 PM.
Definition: timer3.h:449
TIMER3_ReadRequest_Hw_Set
INLINE void TIMER3_ReadRequest_Hw_Set(void)
enables triggering Timer3 Read Request by Hardware.
Definition: timer3.h:212
uint8
unsigned char uint8
8 bit unsigned value
Definition: types.h:139
Field_Wrt32
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:341
TIMER3_CTRL_T3L_OVF_STS_Pos
#define TIMER3_CTRL_T3L_OVF_STS_Pos
Definition: tle986x.h:9822
TIMER3_T3_TRIGG_CTRL_RETRIG_Msk
#define TIMER3_T3_TRIGG_CTRL_RETRIG_Msk
Definition: tle986x.h:9850
TIMER3_CCU6_COUT62
Definition: timer3.h:103
TIMER3_CCU6_CC62
Definition: timer3.h:98
uint32
unsigned int uint32
32 bit unsigned value
Definition: types.h:141
TIMER3_T3_TRIGG_CTRL_RETRIG_Pos
#define TIMER3_T3_TRIGG_CTRL_RETRIG_Pos
Definition: tle986x.h:9849
TIMER3_ISRCLR_T3H_OVF_ICLR_Msk
#define TIMER3_ISRCLR_T3H_OVF_ICLR_Msk
Definition: tle986x.h:9842
TIMER3_LB_OF_Int_Dis
INLINE void TIMER3_LB_OF_Int_Dis(void)
disables Timer 3 Overflow Interrupt (Low Byte Timer).
Definition: timer3.h:656
TIMER3_Value_Get
uint16 TIMER3_Value_Get(void)
Get the Timer3 counter value.
TIMER3_Value_Set
INLINE void TIMER3_Value_Set(uint32 t3)
Sets TIMER3 Value.
Definition: timer3.h:558
TIMER3_Init
void TIMER3_Init(void)
Initializes the Timer3 module.
TIMER3_HB_OF_Int_En
INLINE void TIMER3_HB_OF_Int_En(void)
enables Timer 3 Overflow Interrupt (High Byte Timer).
Definition: timer3.h:582
tle986x.h
CMSIS register HeaderFile.
TIMER3_CTRL_TR3L_Pos
#define TIMER3_CTRL_TR3L_Pos
Definition: tle986x.h:9824
TIMER3_Start
void TIMER3_Start(void)
Starts the Timer3 module.
TIMER3_Div_2
Definition: timer3.h:121
TIMER3_LB_OF_Int_En
INLINE void TIMER3_LB_OF_Int_En(void)
enables Timer 3 Overflow Interrupt (Low Byte Timer).
Definition: timer3.h:631
TIMER3_isLowByteOverflow
INLINE bool TIMER3_isLowByteOverflow(void)
checks Timer3 Low Byte overflow status
Definition: timer3.h:960
TIMER3_Get_Cnt_Value
uint16 TIMER3_Get_Cnt_Value(void)
Get the Timer3 counter value.
TIMER3_CTRL_TR3H_Pos
#define TIMER3_CTRL_TR3H_Pos
Definition: tle986x.h:9828
TIMER3_CTRL_T3_RD_REQ_CONF_Msk
#define TIMER3_CTRL_T3_RD_REQ_CONF_Msk
Definition: tle986x.h:9833
TIMER3_Set_Cnt_Value
void TIMER3_Set_Cnt_Value(uint16 Cnt_Value)
Set the Timer3 counter value.
TTIMER3_Clk_Source
TTIMER3_Clk_Source
This enum lists TIMER3 Clock Source Configuration.
Definition: timer3.h:109
TTIMER3_Clk_Prescaler
TTIMER3_Clk_Prescaler
This enum lists TIMER3 Clock Prescaler Configuration.
Definition: timer3.h:118
TIMER3_Power_Off
INLINE void TIMER3_Power_Off(void)
Disables the Timer3 module.
Definition: timer3.h:157
TIMER3_CTRL_T3L_OVF_IE_Pos
#define TIMER3_CTRL_T3L_OVF_IE_Pos
Definition: tle986x.h:9820
TIMER3_Mode1b_Reset_On_Rising_Edge_En
INLINE void TIMER3_Mode1b_Reset_On_Rising_Edge_En(void)
enables Timer 3 Trigger Reset On Rising Edge for Mode 1b.
Definition: timer3.h:485
TIMER3_Clk_Source_Sel
void TIMER3_Clk_Source_Sel(TTIMER3_Clk_Source t3c)
Set the Timer3 clock source.
TIMER3_CTRL_T3H_OVF_STS_Msk
#define TIMER3_CTRL_T3H_OVF_STS_Msk
Definition: tle986x.h:9827
TIMER3_CCU6_CC61
Definition: timer3.h:97
TIMER3_Stop
void TIMER3_Stop(void)
Stops the Timer3 module.
TIMER3_T3H_Stop
INLINE void TIMER3_T3H_Stop(void)
stops running Timer3 (High Byte Timer)
Definition: timer3.h:350
TIMER3_HB_OF_Int_Dis
INLINE void TIMER3_HB_OF_Int_Dis(void)
disables Timer 3 Overflow Interrupt (High Byte Timer).
Definition: timer3.h:607
TIMER3_CCU6_COUT60
Definition: timer3.h:101
TIMER3_CCU6_PM
Definition: timer3.h:100