SDL API Guide for J721E
sdl_ip_rti.h
Go to the documentation of this file.
1 /* =============================================================================
2  * Copyright (c) Texas Instruments Incorporated 2021
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 <tistdtypes.h>
38 #include <sdl_types.h>
39 
40 #if defined (SOC_J721E)
41 #include <include/soc/j721e/sdlr_soc_baseaddress.h>
43 #endif
44 
45 #if defined (SOC_J7200)
46 #include <include/soc/j7200/sdlr_soc_baseaddress.h>
47 #include <src/sdl/rti/soc/j7200/sdl_soc_rti.h>
48 #endif
49 
50 #if defined (SOC_J721S2)
51 #include <include/soc/j721s2/sdlr_soc_baseaddress.h>
52 #include <src/sdl/rti/soc/j721s2/sdl_soc_rti.h>
53 #endif
54 
55 #if defined (SOC_J784S4)
56 #include <include/soc/j784s4/sdlr_soc_baseaddress.h>
57 #include <src/sdl/rti/soc/j784s4/sdl_soc_rti.h>
58 #endif
59 
60 
61 
62 
63 #include <hw_types.h>
64 
65 #ifdef __cplusplus
66 extern "C"
67 {
68 #endif
69 
112 typedef struct
113 {
115  uint32_t RTI_DWDCTRL;
117  uint32_t RTI_DWDPRLD;
119  uint32_t RTI_WWDRXNCTRL;
121  uint32_t RTI_WWDSIZECTRL;
123 
124 
129 typedef struct{
130  /* Parameter to set preload value */
132  /* Parameter to set window size */
134  /* Parameter to set Reaction */
137 
140 /********************************************************************************************************
141 * Below are the Declarations of Low Level Functions
142 ********************************************************************************************************/
143 
160 int32_t SDL_RTI_chkWindowSize(uint32_t dwwdWindowSize);
161 
172 int32_t SDL_RTI_chkReaction(uint32_t dwwdReaction);
173 
187 int32_t SDL_RTI_getWindowSize(uint32_t baseAddr, uint32_t *pWinSize);
188 
202 int32_t SDL_RTI_setPreload(uint32_t baseAddr, uint32_t dwwdPreloadVal);
203 
216 int32_t SDL_RTI_getPreload(uint32_t baseAddr, uint32_t *pPreloadVal);
217 
231 #define RTI_DWWD_WINDOWSIZE_100_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_100_PERCENT)
232 
233 #define RTI_DWWD_WINDOWSIZE_50_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_50_PERCENT)
234 
235 #define RTI_DWWD_WINDOWSIZE_25_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_25_PERCENT)
236 
237 #define RTI_DWWD_WINDOWSIZE_12_5_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_12_5_PERCENT)
238 
239 #define RTI_DWWD_WINDOWSIZE_6_25_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_6_25_PERCENT)
240 
241 #define RTI_DWWD_WINDOWSIZE_3_125_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_3_125_PERCENT)
242 
252 typedef uint32_t RTI_WindowSize_t;
253 
265 #define RTI_DWWD_REACTION_GENERATE_RESET (RTI_RTIDWWDRXNCTRL_DWWDRXN_RESET)
266 
267 #define RTI_DWWD_REACTION_GENERATE_NMI (RTI_RTIDWWDRXNCTRL_DWWDRXN_INTERRUPT)
268 
272 #define RTI_DWWD_REACTION_INVALID (0x46U)
273 
279 #define RTI_DWWD_STATUS_KEY_SEQ_VIOLATION (RTI_RTIWDSTATUS_KEYST_MASK)
280 
281 #define RTI_DWWD_STATUS_TIME_WINDOW_VIOLATION (RTI_RTIWDSTATUS_DWWD_ST_MASK)
282 
283 #define RTI_DWWD_STATUS_ENDTIME_WINDOW_VIOLATION (RTI_RTIWDSTATUS_END_TIME_VIOL_MASK)
284 
285 #define RTI_DWWD_STATUS_STARTTIME_WINDOW_VIOLATION (RTI_RTIWDSTATUS_START_TIME_VIOL_MASK)
286 
287 #define RTI_DWWD_STATUS_LAST_RESET (RTI_RTIWDSTATUS_DWDST_MASK)
288 
300 typedef uint32_t RTI_Status_t;
301 
306 /****************************************************************************************************
307 * Register Definitions
308 ****************************************************************************************************/
309 
310 
311 #define RTI_RTIDWDCTRL (0x90U)
312 #define RTI_RTIDWDPRLD (0x94U)
313 #define RTI_RTIWDSTATUS (0x98U)
314 #define RTI_RTIWDKEY (0x9cU)
315 
316 #define RTI_RTIDWWDRXNCTRL (0xa4U)
317 #define RTI_RTIDWWDSIZECTRL (0xa8U)
318 #define RTI_RTIDWDCNTR (0xa0U)
319 #define RTI_COMP0 (0x50U)
320 
321 #define STATUS_VLD (1U)
322 
323 /****************************************************************************************************
324 * Field Definition Macros
325 ****************************************************************************************************/
326 
327 
328 
329 #define RTI_RTIDWDCTRL_DWDCTRL_ENABLE (0xA98559DAU)
330 
331 #define RTI_DWWDPRLD_MULTIPLIER_SHIFT (13U)
332 
333 #define RTI_RTIDWDPRLD_INVALID (0xFFFFFFU)
334 #define RTI_RTIDWDPRLD_DWDPRLD_SHIFT (0U)
335 #define RTI_RTIDWDPRLD_DWDPRLD_MASK (0x00000fffU)
336 #define RTI_RTIDWDPRLD_DWDPRLD_MAX (0x0FFFU)
337 
338 #define RTI_RTIDWDCNTR_DWDCNTR_15_0_SHIFT (0U)
339 #define RTI_RTIDWDCNTR_DWDCNTR_15_0_MASK (0x0000ffffU)
340 
341 #define RTI_RTIDWDCNTR_DWDCNTR_24_16_SHIFT (16U)
342 #define RTI_RTIDWDCNTR_DWDCNTR_24_16_MASK (0x01ff0000U)
343 
344 #define RTI_RTIWDSTATUS_DWDST_SHIFT (1U)
345 #define RTI_RTIWDSTATUS_DWDST_MASK (0x00000002U)
346 
347 #define RTI_RTIWDSTATUS_DWWD_ST_SHIFT (5U)
348 #define RTI_RTIWDSTATUS_DWWD_ST_MASK (0x00000020U)
349 
350 #define RTI_RTIWDKEY_WDKEY_SHIFT (0U)
351 #define RTI_RTIWDKEY_WDKEY_MASK (0x0000ffffU)
352 #define RTI_RTIWDKEY_WDKEY_FIRST_WRITE (0x0000E51AU)
353 #define RTI_RTIWDKEY_WDKEY_SECOND_WRITE (0x0000A35CU)
354 
355 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_SHIFT (0U)
356 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_MASK (0x0000000fU)
357 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_RESET (0x5U)
358 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_INTERRUPT (0xAU)
359 
360 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_INVALID (0U)
361 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_SHIFT (0U)
362 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_MASK (0x00ffffffU)
363 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_100_PERCENT (0x00000005U)
364 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_100_PERCENT_SHIFT (0x0)
365 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_50_PERCENT (0x00000050U)
366 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_50_PERCENT_SHIFT (0x1)
367 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_25_PERCENT (0x00000500U)
368 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_25_PERCENT_SHIFT (0x2)
369 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_12_5_PERCENT (0x00005000U)
370 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_12_5_PERCENT_SHIFT (0x3)
371 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_6_25_PERCENT (0x00050000U)
372 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_6_25_PERCENT_SHIFT (0x4)
373 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_3_125_PERCENT (0x00500000U)
374 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_3_125_PERCENT_SHIFT (0x5)
375 
380 static inline int32_t SDL_RTI_writeWinSz(uint32_t baseAddr, uint32_t dwwdWindowSize)
381 {
382  int32_t sdlResult;
383  /* Writing window size to RTI_WWDSIZECTRL Register (Offset = A8h) */
384  HW_WR_FIELD32( baseAddr + RTI_RTIDWWDSIZECTRL,
385  RTI_RTIDWWDSIZECTRL_DWWDSIZE,
386  dwwdWindowSize);
387  sdlResult = SDL_PASS;
388 
389  return sdlResult;
390 }
391 
396 static inline int32_t SDL_RTI_writeReaction(uint32_t baseAddr, uint32_t dwwdReaction)
397 {
398  int32_t sdlResult;
399 
400  /* Writing reaction to RTI_WWDRXNCTRL Register (Offset = A4h) */
401  /* 5h = This is the default value
402  Ah = The windowed watchdog will generate a non-maskable interrupt */
403  (HW_WR_FIELD32(baseAddr + RTI_RTIDWWDRXNCTRL,
404  RTI_RTIDWWDRXNCTRL_DWWDRXN,
405  dwwdReaction));
406  sdlResult = SDL_PASS;
407 
408  return sdlResult;
409 }
410 
415 static inline uint32_t SDL_RTI_readReaction(uint32_t baseAddr)
416 {
417  uint32_t dwwdReaction;
418 
419  /* Get Windowed Watchdog Reaction */
420  dwwdReaction = HW_RD_FIELD32(baseAddr + RTI_RTIDWWDRXNCTRL,
421  RTI_RTIDWWDRXNCTRL_DWWDRXN);
422 
423  return dwwdReaction;
424 }
425 
426 
427 #ifdef __cplusplus
428 }
429 #endif
430 #endif /* HW_RTI_H_ */
431 
static uint32_t SDL_RTI_readReaction(uint32_t baseAddr)
Definition: sdl_ip_rti.h:415
List of Config Parameters for RTI DWWD.
Definition: sdl_ip_rti.h:129
uint32_t RTI_Status_t
type to report the DWWD status.
Definition: sdl_ip_rti.h:300
uint32_t SDL_RTI_dwwdWindowSize
Definition: sdl_ip_rti.h:133
int32_t SDL_RTI_chkWindowSize(uint32_t dwwdWindowSize)
This API will check the Window Size for DWWD.
int32_t SDL_RTI_setPreload(uint32_t baseAddr, uint32_t dwwdPreloadVal)
Set DWWD preload value. From this value down counter starts down counting.
static int32_t SDL_RTI_writeWinSz(uint32_t baseAddr, uint32_t dwwdWindowSize)
Definition: sdl_ip_rti.h:380
uint32_t SDL_RTI_dwwdReaction
Definition: sdl_ip_rti.h:135
#define RTI_RTIDWWDRXNCTRL
Definition: sdl_ip_rti.h:316
uint32_t RTI_WindowSize_t
type to select the DWWD window size.
Definition: sdl_ip_rti.h:252
uint32_t SDL_RTI_dwwdPreloadVal
Definition: sdl_ip_rti.h:131
static int32_t SDL_RTI_writeReaction(uint32_t baseAddr, uint32_t dwwdReaction)
Definition: sdl_ip_rti.h:396
uint32_t RTI_DWDCTRL
Definition: sdl_ip_rti.h:115
uint32_t RTI_DWDPRLD
Definition: sdl_ip_rti.h:117
uint32_t RTI_WWDSIZECTRL
Definition: sdl_ip_rti.h:121
int32_t SDL_RTI_getWindowSize(uint32_t baseAddr, uint32_t *pWinSize)
This API will return current configured Window Size.
uint32_t RTI_WWDRXNCTRL
Definition: sdl_ip_rti.h:119
#define RTI_RTIDWWDSIZECTRL
Definition: sdl_ip_rti.h:317
List of Static Registers for RTI DWWD.
Definition: sdl_ip_rti.h:112
int32_t SDL_RTI_getPreload(uint32_t baseAddr, uint32_t *pPreloadVal)
This API will return current configured Preload value.
int32_t SDL_RTI_chkReaction(uint32_t dwwdReaction)
This API will check the reaction to perform when error is detected from DWWD.