Infineon MOTIX™ MCU TLE985x Device Family SDK
wdt1.h
Go to the documentation of this file.
1 /*
2  ***********************************************************************************************************************
3  *
4  * Copyright (c) 2018-2023, 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  **********************************************************************************************************************/
39 /*******************************************************************************
40 ** Author(s) Identity **
41 ********************************************************************************
42 ** Initials Name **
43 ** ---------------------------------------------------------------------------**
44 ** TS T&S **
45 ** BG Blandine Guillot **
46 ** JO Julia Ott **
47 ** VO Vanessa Ongaro **
48 *******************************************************************************/
49 
50 /*******************************************************************************
51 ** Revision Control History **
52 ********************************************************************************
53 ** V0.2.0: 2018-02-13, TS: Initial version of revision history **
54 ** V0.2.1: 2019-01-28, TS: __STATIC_INLINE changed to INLINE **
55 ** Doxygen update **
56 ** Revision history moved from wdt1.c to wdt1.h **
57 ** Systick_Value_Get, Systick_ReloadValue_Get, **
58 ** SysTick_ReloadValue_Set functions added **
59 ** WDT1_Init splitted to WDT1_Init and SysTick_Init **
60 ** Delay_us updated to allow delays >=1000us **
61 ** V0.2.2: 2020-03-02, BG: Updated revision history format **
62 ** V0.2.3: 2020-03-02, JO: EP-435: Removed ARMCC v6 compiler warnings **
63 ** V0.2.4: 2022-01-21, JO: EP-934: Updated copyright and branding **
64 ** V0.2.5: 2023-07-31, VO: EP-768: Corrected function Delay_us in case the **
65 ** current systick value is 0 or the reload value **
66 *******************************************************************************/
67 
68 #ifndef _WDT1_H
69 #define _WDT1_H
70 
71 /*******************************************************************************
72 ** Includes **
73 *******************************************************************************/
74 #include "tle985x.h"
75 #include "types.h"
76 #include "sfr_access.h"
77 
78 /*******************************************************************************
79 ** External Variable Declarations **
80 *******************************************************************************/
81 extern uint32 WD_Counter;
82 
83 /*******************************************************************************
84 ** Global Macro Definitions **
85 *******************************************************************************/
86 #define One_us ((uint32)SCU_FSYS / 1000000u)
87 #define SysTickRL ((sint32)SCU_FSYS / (sint32)SysTickFreq)
88 
89 /*******************************************************************************
90 ** Global Constant Declarations **
91 *******************************************************************************/
93 #define SysTickFreq 1000u
94 
95 /*******************************************************************************
96 ** Global Function Declarations **
97 *******************************************************************************/
103 void WDT1_Init(void);
104 
110 void SysTick_Init(void);
111 
127 void WDT1_Stop(void);
128 
144 bool WDT1_Service(void);
145 
160 void WDT1_SOW_Service(uint32 NoOfSOW);
161 
182 void Delay_us(uint32 delay_time_us);
183 
184 /*******************************************************************************
185 ** Inline Function Declarations **
186 *******************************************************************************/
199 INLINE void WDT1_Window_Count(void);
200 
218 
236 
252 
253 /*******************************************************************************
254 ** Inline Function Definitions **
255 *******************************************************************************/
257 {
258  WD_Counter++;
259 }
260 
262 {
264 }
265 
267 {
269 }
270 
272 {
274 }
275 
276 #endif
#define CPU
Definition: tle985x.h:6269
#define CPU_SYSTICK_RVR_RELOAD_Pos
Definition: tle985x.h:8776
#define CPU_SYSTICK_RVR_RELOAD_Msk
Definition: tle985x.h:8777
#define CPU_SYSTICK_CVR_CURRENT_Msk
Definition: tle985x.h:8774
#define CPU_SYSTICK_CVR_CURRENT_Pos
Definition: tle985x.h:8773
SFR low level access library.
INLINE void Field_Wrt32(volatile uint32 *reg, uint8 pos, uint32 msk, uint32 val)
This function writes a bit field in a 32-bit register.
Definition: sfr_access.h:358
INLINE uint32 u32_Field_Rd32(const volatile uint32 *reg, uint8 pos, uint32 msk)
This function reads a 32-bit field of a 32-bit register.
Definition: sfr_access.h:453
CMSIS register HeaderFile.
General type declarations.
#define INLINE
Definition: types.h:145
uint8_t uint8
8 bit unsigned value
Definition: types.h:153
uint32_t uint32
32 bit unsigned value
Definition: types.h:155
void WDT1_Init(void)
Performs the initial service of the WDT1 (closes the long open window).
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:271
INLINE uint32 Systick_ReloadValue_Get(void)
returns the current SysTick reload value
Definition: wdt1.h:266
INLINE uint32 Systick_Value_Get(void)
returns the current SysTick timer count value
Definition: wdt1.h:261
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:256
uint32 WD_Counter
void SysTick_Init(void)
Initializes the SysTick timer to 1ms interval.
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.