TLE986x Device Family SDK
wdt1.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 ** TA Thomas Albersinger **
45 ** BG Blandine Guillot **
46 *******************************************************************************/
47 
48 /*******************************************************************************
49 ** Revision Control History **
50 ********************************************************************************
51 ** V0.1.0: 2012-11-12, DM: Initial version **
52 ** V0.2.0: 2013-10-18, DM: Reset of bSOWactive flag in WDT1_Service() **
53 ** V0.2.1: 2014-05-16, DM: Delay_us() function added **
54 ** WD_Trig_Time calculation done as #define **
55 ** V0.2.2: 2014-06-27, TA: Changed to types from Types.h **
56 ** V0.2.3: 2014-07-24, DM: Delay_us() SysTick overrun fixed **
57 ** V0.2.4: 2015-02-10, DM: Individual header file added **
58 ** V0.2.5: 2016-11-30, DM: Macros One_us and SysTickRL are moved into header**
59 ** file **
60 ** V0.2.6: 2017-04-11, DM: Delay_us() function updated **
61 ** V0.2.7: 2017-10-20, DM: MISRA 2012 compliance, the following PC-Lint **
62 ** rules are globally deactivated: **
63 ** - Info 793: ANSI/ISO limit of 6 'significant **
64 ** characters in an external identifier **
65 ** - Info 835: A zero has been given as right **
66 ** argument to operator **
67 ** - Info 845: The left argument to operator '&' **
68 ** is certain to be 0 **
69 ** V0.2.8: 2018-11-27, JO: Doxygen update, moved revision history from **
70 ** wdt1.c to wdt1.h **
71 ** Splitted WDT1_Init to WDT1_Init and SysTick_Init **
72 ** Changed Delay_us so that delays >=1000us work **
73 ** Changed __STATIC_INLINE to INLINE **
74 ** V0.2.9: 2019-06-06, JO: Changed formula for SysTickRL to use uint32 **
75 ** instead of sint32 **
76 ** CPU->SYSTICK_RL.reg initialized with macro **
77 ** SysTickRL from wdt1.h **
78 ** Added function SysTick_ReloadValue_Get **
79 ** Adapted Delay_us to use SysTick_ReloadValue_Get **
80 ** instead of register access **
81 ** Renamed Systick_Value_Get to SysTick_Value_Get **
82 ** V0.3.0: 2020-02-28, BG: Updated revision history format **
83 ** V0.3.1: 2020-10-12, JO: EP-506: remove ARMCC v6 Compiler warnings **
84 ** - added 'static' to variabel bSOWactive **
85 *******************************************************************************/
86 
87 #ifndef _WDT1_H
88 #define _WDT1_H
89 
90 /*******************************************************************************
91 ** Includes **
92 *******************************************************************************/
93 #include "types.h"
94 #include "tle986x.h"
95 
96 /*******************************************************************************
97 ** External Variable Declarations **
98 *******************************************************************************/
100 
101 /*******************************************************************************
102 ** Global Macro Definitions **
103 *******************************************************************************/
104 #define One_us ((uint32)SCU_FSYS / 1000000u)
105 #define SysTickRL ((uint32)SCU_FSYS / (uint32)SysTickFreq)
106 
107 /*******************************************************************************
108 ** Global Constant Declarations **
109 *******************************************************************************/
111 #define SysTickFreq 1000u
112 
113 /*******************************************************************************
114 ** Global Function Declarations **
115 *******************************************************************************/
121 void WDT1_Init(void);
122 
128 void SysTick_Init(void);
129 
145 void WDT1_Stop(void);
146 
162 bool WDT1_Service(void);
163 
178 void WDT1_SOW_Service(uint32 NoOfSOW);
179 
200 void Delay_us(uint32 delay_time_us);
201 
202 INLINE void WDT1_Window_Count(void);
205 /*******************************************************************************
206 ** Global Inline Function Definitions **
207 *******************************************************************************/
208 
221 INLINE void WDT1_Window_Count(void)
222 {
223  WD_Counter++;
224 }
225 
226 
244 {
245  return CPU->SYSTICK_CUR.reg;
246 }
247 
265 {
266  return (CPU->SYSTICK_RL.reg);
267 }
268 
284 {
285  CPU->SYSTICK_RL.reg = val;
286 }
287 
288 #endif
types.h
General type declarations.
WDT1_Init
void WDT1_Init(void)
Performs the initial service of the WDT1 (closes the long open window).
WDT1_Service
bool WDT1_Service(void)
Services the WDT1 in the open window.
SysTick_Value_Get
INLINE uint32 SysTick_Value_Get(void)
returns the current SysTick timer count value
Definition: wdt1.h:235
WD_Counter
uint32 WD_Counter
SysTick_Init
void SysTick_Init(void)
Initializes the SysTick timer to 1ms interval.
WDT1_Stop
void WDT1_Stop(void)
Stops the service of WDT1 by stopping the SysTick timer.
INLINE
#define INLINE
Definition: types.h:134
WDT1_Window_Count
INLINE void WDT1_Window_Count(void)
increments the WDT1 Window Counter
Definition: wdt1.h:213
SysTick_ReloadValue_Get
INLINE uint32 SysTick_ReloadValue_Get(void)
returns the current SysTick reload value
Definition: wdt1.h:256
uint32
unsigned int uint32
32 bit unsigned value
Definition: types.h:141
SysTick_ReloadValue_Set
INLINE void SysTick_ReloadValue_Set(uint32 val)
sets the SysTick Reload value
Definition: wdt1.h:275
Delay_us
void Delay_us(uint32 delay_time_us)
Delays the regular program execution by a given number of Microseconds.
CPU
#define CPU
Definition: tle986x.h:5996
tle986x.h
CMSIS register HeaderFile.
WDT1_SOW_Service
void WDT1_SOW_Service(uint32 NoOfSOW)
Triggers a short-window (~30ms) of the WDT1.