Infineon MOTIX™ MCU TLE987x Device Family SDK
wdt1.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 ** TA Thomas Albersinger **
27 ** JO Julia Ott **
28 ** BG Blandine Guillot **
29 *******************************************************************************/
30 
31 /*******************************************************************************
32 ** Revision Control History **
33 ********************************************************************************
34 ** V0.1.0: 2012-11-12, DM: Initial version **
35 ** V0.2.0: 2013-10-18, DM: Reset of bSOWactive flag in WDT1_Service() **
36 ** V0.2.1: 2014-05-16, DM: Delay_us() function added **
37 ** WD_Trig_Time calculation done as #define **
38 ** V0.2.2: 2014-06-27, TA: Changed to types from Types.h **
39 ** V0.2.3: 2014-07-24, DM: Delay_us() SysTick overrun fixed **
40 ** V0.2.4: 2015-02-10, DM: Individual header file added **
41 ** V0.2.5: 2016-11-30, DM: macros One_us and SysTickRL are moved into header**
42 ** file **
43 ** V0.2.6: 2017-04-11, DM: Delay_us() function updated **
44 ** V0.2.7: 2017-10-20, DM: MISRA 2012 compliance, the following PC-Lint **
45 ** rules are globally deactivated: **
46 ** - Info 793: ANSI/ISO limit of 6 'significant **
47 ** characters in an external identifier **
48 ** - Info 835: A zero has been given as right **
49 ** argument to operator **
50 ** - Info 845: The left argument to operator '&' **
51 ** is certain to be 0 **
52 ** V0.2.8: 2018-11-27, JO: Doxygen update **
53 ** Moved revision history from wdt1.c to wdt1.h **
54 ** Split WDT1_Init to WDT1_Init and SysTick_Init **
55 ** Changed Delay_us so that delays>=1ms are possible**
56 ** Changed __STATIC_INLINE to INLINE **
57 ** V0.2.9: 2019-03-29, JO: Changed formula for SysTickRL to use uint32 **
58 ** instead of sint32 **
59 ** CPU->SYSTICK_RL.reg initialized with macro **
60 ** SysTickRL from wdt1.h **
61 ** Added function SysTick_ReloadValue_Get **
62 ** Adapted Delay_us to use SysTick_ReloadValue_Get **
63 ** instead of register access **
64 ** Renamed Systick_Value_Get() to SysTick_Value_Get **
65 ** V0.3.0: 2020-04-15, BG: Updated revision history format **
66 ** V0.3.1: 2020-07-21, BG: EP-439: Formatted .h/.c files **
67 ** V0.3.2: 2021-04-14, JO: EP-766: Corrected function Delay_us in case the **
68 ** current systick value is 0 or the reload value **
69 ** V0.3.3: 2022-02-28, JO: EP-936: Updated copyright and branding **
70 ** V0.3.4: 2025-01-02, JO: EP-1493: Updated license **
71 *******************************************************************************/
72 
73 #ifndef _WDT1_H
74 #define _WDT1_H
75 
76 /*******************************************************************************
77 ** Includes **
78 *******************************************************************************/
79 #include "types.h"
80 #include "tle987x.h"
81 
82 /*******************************************************************************
83 ** External Variable Declarations **
84 *******************************************************************************/
85 extern uint32 WD_Counter;
86 
87 /*******************************************************************************
88 ** Global Macro Definitions **
89 *******************************************************************************/
90 #define One_us ((uint32)SCU_FSYS / 1000000u)
91 #define SysTickRL ((uint32)SCU_FSYS / (uint32)SysTickFreq)
92 
93 /*******************************************************************************
94 ** Global Constant Declarations **
95 *******************************************************************************/
97 #define SysTickFreq 1000u
98 
99 /*******************************************************************************
100 ** Global Function Declarations **
101 *******************************************************************************/
107 void WDT1_Init(void);
108 
114 void SysTick_Init(void);
115 
131 void WDT1_Stop(void);
132 
148 bool WDT1_Service(void);
149 
164 void WDT1_SOW_Service(uint32 NoOfSOW);
165 
186 void Delay_us(uint32 delay_time_us);
187 
188 INLINE void WDT1_Window_Count(void);
191 
192 /*******************************************************************************
193 ** Global Inline Function Definitions **
194 *******************************************************************************/
195 
209 {
210  WD_Counter++;
211 }
212 
213 
231 {
232  return CPU->SYSTICK_CUR.reg;
233 }
234 
252 {
253  return (CPU->SYSTICK_RL.reg);
254 }
255 
271 {
272  CPU->SYSTICK_RL.reg = val;
273 }
274 
275 #endif
#define CPU
Definition: tle987x.h:6063
CMSIS register HeaderFile.
General type declarations.
#define INLINE
Definition: types.h:132
uint32_t uint32
32 bit unsigned value
Definition: types.h:139
void WDT1_Init(void)
Performs the initial service of the WDT1 (closes the long open window) based on the Config Wizard for...
void WDT1_SOW_Service(uint32 NoOfSOW)
Triggers a short-window (~30ms) of the WDT1.
INLINE void SysTick_ReloadValue_Set(uint32 val)
sets the SysTick Reload value
Definition: wdt1.h:270
void WDT1_Stop(void)
Stops the service of WDT1 by stopping the SysTick timer.
INLINE void WDT1_Window_Count(void)
increments the WDT1 Window Counter
Definition: wdt1.h:208
INLINE uint32 SysTick_Value_Get(void)
returns the current SysTick timer count value
Definition: wdt1.h:230
uint32 WD_Counter
void SysTick_Init(void)
Initializes the SysTick timer to 1ms interval.
INLINE uint32 SysTick_ReloadValue_Get(void)
returns the current SysTick reload value
Definition: wdt1.h:251
bool WDT1_Service(void)
Services the WDT1 in the open window.
void Delay_us(uint32 delay_time_us)
Delays the regular program execution by a given number of Microseconds.