AM261x MCU+ SDK: sdl_ip_rti.h Source File

| AM261x MCU+ SDK 26.00.00 |

sdl_ip_rti.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) Texas Instruments Incorporated 2022
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the
14 * distribution.
15 *
16 * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
34 #ifndef SDL_IP_RTI_H_
35 #define SDL_IP_RTI_H_
36
37 #include <sdl/include/sdl_types.h>
38 #include <sdl/rti/v0/soc/sdl_rti_soc.h>
39 #include <sdl/include/hw_types.h>
40
41 #ifdef __cplusplus
42 extern "C"
43 {
44 #endif
45
72 typedef struct
73 {
75 uint32_t RTI_DWDCTRL;
77 uint32_t RTI_DWDPRLD;
79 uint32_t RTI_WWDRXNCTRL;
81 uint32_t RTI_WWDSIZECTRL;
82 } SDL_RTI_staticRegs;
83
84
89 typedef struct{
90 /* Parameter to set preload value */
91 uint32_t SDL_RTI_dwwdPreloadVal;
92 /* Parameter to set window size */
93 uint32_t SDL_RTI_dwwdWindowSize;
94 /* Parameter to set Reaction */
95 uint32_t SDL_RTI_dwwdReaction;
96 }SDL_RTI_configParms;
97
99 /********************************************************************************************************
100 * Below are the Declarations of Low Level Functions
101 ********************************************************************************************************/
119 int32_t SDL_RTI_chkWindowSize(uint32_t dwwdWindowSize);
120
131 int32_t SDL_RTI_chkReaction(uint32_t dwwdReaction);
132
146 int32_t SDL_RTI_getWindowSize(uint32_t baseAddr, uint32_t *pWinSize);
147
161 int32_t SDL_RTI_setPreload(uint32_t baseAddr, uint32_t dwwdPreloadVal);
162
175 int32_t SDL_RTI_getPreload(uint32_t baseAddr, uint32_t *pPreloadVal);
176
184 #define RTI_DWWD_WINDOWSIZE_100_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_100_PERCENT)
185
186 #define RTI_DWWD_WINDOWSIZE_50_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_50_PERCENT)
187
188 #define RTI_DWWD_WINDOWSIZE_25_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_25_PERCENT)
189
190 #define RTI_DWWD_WINDOWSIZE_12_5_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_12_5_PERCENT)
191
192 #define RTI_DWWD_WINDOWSIZE_6_25_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_6_25_PERCENT)
193
194 #define RTI_DWWD_WINDOWSIZE_3_125_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_3_125_PERCENT)
195
205 typedef uint32_t RTI_WindowSize_t;
206
218 #define RTI_DWWD_REACTION_GENERATE_RESET (RTI_RTIDWWDRXNCTRL_DWWDRXN_RESET)
219
220 #define RTI_DWWD_REACTION_GENERATE_NMI (RTI_RTIDWWDRXNCTRL_DWWDRXN_INTERRUPT)
221
225 #define RTI_DWWD_REACTION_INVALID (0x46U)
226
232 #define RTI_DWWD_STATUS_KEY_SEQ_VIOLATION (RTI_RTIWDSTATUS_KEYST_MASK)
233
234 #define RTI_DWWD_STATUS_TIME_WINDOW_VIOLATION (RTI_RTIWDSTATUS_DWWD_ST_MASK)
235
236 #define RTI_DWWD_STATUS_ENDTIME_WINDOW_VIOLATION (RTI_RTIWDSTATUS_END_TIME_VIOL_MASK)
237
238 #define RTI_DWWD_STATUS_STARTTIME_WINDOW_VIOLATION (RTI_RTIWDSTATUS_START_TIME_VIOL_MASK)
239
240 #define RTI_DWWD_STATUS_LAST_RESET (RTI_RTIWDSTATUS_DWDST_MASK)
241
253 typedef uint32_t RTI_Status_t;
254
255 /****************************************************************************************************
256 * Register Definitions
257 ****************************************************************************************************/
258
259
260 #define RTI_RTIDWDCTRL (0x90U)
261 #define RTI_RTIDWDPRLD (0x94U)
262 #define RTI_RTIWDSTATUS (0x98U)
263 #define RTI_RTIWDKEY (0x9cU)
264
265 #define RTI_RTIDWWDRXNCTRL (0xa4U)
266 #define RTI_RTIDWWDSIZECTRL (0xa8U)
267 #define RTI_RTIDWDCNTR (0xa0U)
268 #define RTI_COMP0 (0x50U)
269
270 #define STATUS_VLD (1U)
271
272 /****************************************************************************************************
273 * Field Definition Macros
274 ****************************************************************************************************/
275
276
277
278 #define RTI_RTIDWDCTRL_DWDCTRL_ENABLE (0xA98559DAU)
279
280 #define RTI_DWWDPRLD_MULTIPLIER_SHIFT (13U)
281 #define RTI_DWD_MIN_PRELOAD_VAL (0x1FFFU)
282
283 #define RTI_RTIDWDPRLD_INVALID (0xFFFFFFU)
284 #define RTI_RTIDWDPRLD_DWDPRLD_SHIFT (0U)
285 #define RTI_RTIDWDPRLD_DWDPRLD_MASK (0x00000fffU)
286 #define RTI_RTIDWDPRLD_DWDPRLD_MAX (0x0FFFU)
287
288 #define RTI_RTIDWDCNTR_DWDCNTR_15_0_SHIFT (0U)
289 #define RTI_RTIDWDCNTR_DWDCNTR_15_0_MASK (0x0000ffffU)
290
291 #define RTI_RTIDWDCNTR_DWDCNTR_24_16_SHIFT (16U)
292 #define RTI_RTIDWDCNTR_DWDCNTR_24_16_MASK (0x01ff0000U)
293
294 #define RTI_RTIWDSTATUS_DWDST_SHIFT (1U)
295 #define RTI_RTIWDSTATUS_DWDST_MASK (0x00000002U)
296
297 #define RTI_RTIWDSTATUS_DWWD_ST_SHIFT (5U)
298 #define RTI_RTIWDSTATUS_DWWD_ST_MASK (0x00000020U)
299
300 #define RTI_RTIWDKEY_WDKEY_SHIFT (0U)
301 #define RTI_RTIWDKEY_WDKEY_MASK (0x0000ffffU)
302 #define RTI_RTIWDKEY_WDKEY_FIRST_WRITE (0x0000E51AU)
303 #define RTI_RTIWDKEY_WDKEY_SECOND_WRITE (0x0000A35CU)
304
305 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_SHIFT (0U)
306 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_MASK (0x0000000fU)
307 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_RESET (0x5U)
308 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_INTERRUPT (0xAU)
309
310 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_INVALID (0U)
311 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_SHIFT (0U)
312 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_MASK (0x00ffffffU)
313 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_100_PERCENT (0x00000005U)
314 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_100_PERCENT_SHIFT (0x0)
315 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_50_PERCENT (0x00000050U)
316 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_50_PERCENT_SHIFT (0x1)
317 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_25_PERCENT (0x00000500U)
318 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_25_PERCENT_SHIFT (0x2)
319 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_12_5_PERCENT (0x00005000U)
320 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_12_5_PERCENT_SHIFT (0x3)
321 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_6_25_PERCENT (0x00050000U)
322 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_6_25_PERCENT_SHIFT (0x4)
323 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_3_125_PERCENT (0x00500000U)
324 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_3_125_PERCENT_SHIFT (0x5)
325
330 static inline int32_t SDL_RTI_writeWinSz(uint32_t baseAddr, uint32_t dwwdWindowSize)
331 {
332 int32_t sdlResult;
333 /* Writing window size to RTI_WWDSIZECTRL Register (Offset = A8h) */
334 HW_WR_FIELD32( baseAddr + RTI_RTIDWWDSIZECTRL,
335 RTI_RTIDWWDSIZECTRL_DWWDSIZE,
336 dwwdWindowSize);
337 sdlResult = SDL_PASS;
338
339 return sdlResult;
340 }
341
346 static inline int32_t SDL_RTI_writeReaction(uint32_t baseAddr, uint32_t dwwdReaction)
347 {
348 int32_t sdlResult;
349
350 /* Writing reaction to RTI_WWDRXNCTRL Register (Offset = A4h) */
351 /* 5h = This is the default value
352 Ah = The windowed watchdog will generate a non-maskable interrupt */
353 (HW_WR_FIELD32(baseAddr + RTI_RTIDWWDRXNCTRL,
354 RTI_RTIDWWDRXNCTRL_DWWDRXN,
355 dwwdReaction));
356 sdlResult = SDL_PASS;
357
358 return sdlResult;
359 }
360
365 static inline uint32_t SDL_RTI_readReaction(uint32_t baseAddr)
366 {
367 uint32_t dwwdReaction;
368
369 /* Get Windowed Watchdog Reaction */
370 dwwdReaction = HW_RD_FIELD32(baseAddr + RTI_RTIDWWDRXNCTRL,
371 RTI_RTIDWWDRXNCTRL_DWWDRXN);
372
373 return dwwdReaction;
374 }
375
376
377 #ifdef __cplusplus
378 }
379 #endif
380 #endif /* HW_RTI_H_ */
RTI_RTIDWWDSIZECTRL
#define RTI_RTIDWWDSIZECTRL
Definition: sdl_ip_rti.h:266
SDL_RTI_configParms::SDL_RTI_dwwdReaction
uint32_t SDL_RTI_dwwdReaction
Definition: sdl_ip_rti.h:95
SDL_RTI_staticRegs::RTI_DWDCTRL
uint32_t RTI_DWDCTRL
Definition: sdl_ip_rti.h:75
SDL_RTI_configParms::SDL_RTI_dwwdPreloadVal
uint32_t SDL_RTI_dwwdPreloadVal
Definition: sdl_ip_rti.h:91
SDL_RTI_staticRegs::RTI_WWDSIZECTRL
uint32_t RTI_WWDSIZECTRL
Definition: sdl_ip_rti.h:81
SDL_RTI_writeWinSz
static int32_t SDL_RTI_writeWinSz(uint32_t baseAddr, uint32_t dwwdWindowSize)
Definition: sdl_ip_rti.h:330
SDL_RTI_configParms::SDL_RTI_dwwdWindowSize
uint32_t SDL_RTI_dwwdWindowSize
Definition: sdl_ip_rti.h:93
SDL_RTI_chkReaction
int32_t SDL_RTI_chkReaction(uint32_t dwwdReaction)
This API will check the reaction to perform when error is detected from DWWD.
SDL_RTI_getWindowSize
int32_t SDL_RTI_getWindowSize(uint32_t baseAddr, uint32_t *pWinSize)
This API will return current configured Window Size.
RTI_WindowSize_t
uint32_t RTI_WindowSize_t
type to select the DWWD window size.
Definition: sdl_ip_rti.h:205
SDL_RTI_staticRegs
List of Static Registers for RTI DWWD.
Definition: sdl_ip_rti.h:73
SDL_RTI_staticRegs::RTI_WWDRXNCTRL
uint32_t RTI_WWDRXNCTRL
Definition: sdl_ip_rti.h:79
SDL_RTI_readReaction
static uint32_t SDL_RTI_readReaction(uint32_t baseAddr)
Definition: sdl_ip_rti.h:365
RTI_RTIDWWDRXNCTRL
#define RTI_RTIDWWDRXNCTRL
Definition: sdl_ip_rti.h:265
SDL_RTI_chkWindowSize
int32_t SDL_RTI_chkWindowSize(uint32_t dwwdWindowSize)
This API will check the Window Size for DWWD.
SDL_RTI_writeReaction
static int32_t SDL_RTI_writeReaction(uint32_t baseAddr, uint32_t dwwdReaction)
Definition: sdl_ip_rti.h:346
SDL_RTI_getPreload
int32_t SDL_RTI_getPreload(uint32_t baseAddr, uint32_t *pPreloadVal)
This API will return current configured Preload value.
SDL_RTI_staticRegs::RTI_DWDPRLD
uint32_t RTI_DWDPRLD
Definition: sdl_ip_rti.h:77
SDL_RTI_setPreload
int32_t SDL_RTI_setPreload(uint32_t baseAddr, uint32_t dwwdPreloadVal)
Set DWWD preload value. From this value down counter starts down counting.
RTI_Status_t
uint32_t RTI_Status_t
type to report the DWWD status.
Definition: sdl_ip_rti.h:253
SDL_RTI_configParms
List of Config Parameters for RTI DWWD.
Definition: sdl_ip_rti.h:89