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 #include <include/soc/j721e/sdlr_soc_baseaddress.h>
41 
42 #include <hw_types.h>
43 
44 #ifdef __cplusplus
45 extern "C"
46 {
47 #endif
48 
91 typedef struct
92 {
94  uint32_t RTI_DWDCTRL;
96  uint32_t RTI_DWDPRLD;
98  uint32_t RTI_WWDRXNCTRL;
100  uint32_t RTI_WWDSIZECTRL;
102 
103 
108 typedef struct{
109  /* Parameter to set preload value */
111  /* Parameter to set window size */
113  /* Parameter to set Reaction */
116 
119 /********************************************************************************************************
120 * Below are the Declarations of Low Level Functions
121 ********************************************************************************************************/
122 
139 int32_t SDL_RTI_chkWindowSize(uint32_t dwwdWindowSize);
140 
151 int32_t SDL_RTI_chkReaction(uint32_t dwwdReaction);
152 
166 int32_t SDL_RTI_getWindowSize(uint32_t baseAddr, uint32_t *pWinSize);
167 
181 int32_t SDL_RTI_setPreload(uint32_t baseAddr, uint32_t dwwdPreloadVal);
182 
195 int32_t SDL_RTI_getPreload(uint32_t baseAddr, uint32_t *pPreloadVal);
196 
210 #define RTI_DWWD_WINDOWSIZE_100_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_100_PERCENT)
211 
212 #define RTI_DWWD_WINDOWSIZE_50_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_50_PERCENT)
213 
214 #define RTI_DWWD_WINDOWSIZE_25_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_25_PERCENT)
215 
216 #define RTI_DWWD_WINDOWSIZE_12_5_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_12_5_PERCENT)
217 
218 #define RTI_DWWD_WINDOWSIZE_6_25_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_6_25_PERCENT)
219 
220 #define RTI_DWWD_WINDOWSIZE_3_125_PERCENT (RTI_RTIDWWDSIZECTRL_DWWDSIZE_3_125_PERCENT)
221 
231 typedef uint32_t RTI_WindowSize_t;
232 
244 #define RTI_DWWD_REACTION_GENERATE_RESET (RTI_RTIDWWDRXNCTRL_DWWDRXN_RESET)
245 
246 #define RTI_DWWD_REACTION_GENERATE_NMI (RTI_RTIDWWDRXNCTRL_DWWDRXN_INTERRUPT)
247 
251 #define RTI_DWWD_REACTION_INVALID (0x46U)
252 
258 #define RTI_DWWD_STATUS_KEY_SEQ_VIOLATION (RTI_RTIWDSTATUS_KEYST_MASK)
259 
260 #define RTI_DWWD_STATUS_TIME_WINDOW_VIOLATION (RTI_RTIWDSTATUS_DWWD_ST_MASK)
261 
262 #define RTI_DWWD_STATUS_ENDTIME_WINDOW_VIOLATION (RTI_RTIWDSTATUS_END_TIME_VIOL_MASK)
263 
264 #define RTI_DWWD_STATUS_STARTTIME_WINDOW_VIOLATION (RTI_RTIWDSTATUS_START_TIME_VIOL_MASK)
265 
266 #define RTI_DWWD_STATUS_LAST_RESET (RTI_RTIWDSTATUS_DWDST_MASK)
267 
279 typedef uint32_t RTI_Status_t;
280 
285 /****************************************************************************************************
286 * Register Definitions
287 ****************************************************************************************************/
288 
289 
290 #define RTI_RTIDWDCTRL (0x90U)
291 #define RTI_RTIDWDPRLD (0x94U)
292 #define RTI_RTIWDSTATUS (0x98U)
293 #define RTI_RTIWDKEY (0x9cU)
294 
295 #define RTI_RTIDWWDRXNCTRL (0xa4U)
296 #define RTI_RTIDWWDSIZECTRL (0xa8U)
297 #define RTI_RTIDWDCNTR (0xa0U)
298 #define RTI_COMP0 (0x50U)
299 
300 #define STATUS_VLD (1U)
301 
302 /****************************************************************************************************
303 * Field Definition Macros
304 ****************************************************************************************************/
305 
306 
307 
308 #define RTI_RTIDWDCTRL_DWDCTRL_ENABLE (0xA98559DAU)
309 
310 #define RTI_DWWDPRLD_MULTIPLIER_SHIFT (13U)
311 
312 #define RTI_RTIDWDPRLD_INVALID (0xFFFFFFU)
313 #define RTI_RTIDWDPRLD_DWDPRLD_SHIFT (0U)
314 #define RTI_RTIDWDPRLD_DWDPRLD_MASK (0x00000fffU)
315 #define RTI_RTIDWDPRLD_DWDPRLD_MAX (0x0FFFU)
316 
317 #define RTI_RTIDWDCNTR_DWDCNTR_15_0_SHIFT (0U)
318 #define RTI_RTIDWDCNTR_DWDCNTR_15_0_MASK (0x0000ffffU)
319 
320 #define RTI_RTIDWDCNTR_DWDCNTR_24_16_SHIFT (16U)
321 #define RTI_RTIDWDCNTR_DWDCNTR_24_16_MASK (0x01ff0000U)
322 
323 #define RTI_RTIWDSTATUS_DWDST_SHIFT (1U)
324 #define RTI_RTIWDSTATUS_DWDST_MASK (0x00000002U)
325 
326 #define RTI_RTIWDSTATUS_DWWD_ST_SHIFT (5U)
327 #define RTI_RTIWDSTATUS_DWWD_ST_MASK (0x00000020U)
328 
329 #define RTI_RTIWDKEY_WDKEY_SHIFT (0U)
330 #define RTI_RTIWDKEY_WDKEY_MASK (0x0000ffffU)
331 #define RTI_RTIWDKEY_WDKEY_FIRST_WRITE (0x0000E51AU)
332 #define RTI_RTIWDKEY_WDKEY_SECOND_WRITE (0x0000A35CU)
333 
334 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_SHIFT (0U)
335 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_MASK (0x0000000fU)
336 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_RESET (0x5U)
337 #define RTI_RTIDWWDRXNCTRL_DWWDRXN_INTERRUPT (0xAU)
338 
339 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_INVALID (0U)
340 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_SHIFT (0U)
341 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_MASK (0x00ffffffU)
342 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_100_PERCENT (0x00000005U)
343 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_100_PERCENT_SHIFT (0x0)
344 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_50_PERCENT (0x00000050U)
345 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_50_PERCENT_SHIFT (0x1)
346 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_25_PERCENT (0x00000500U)
347 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_25_PERCENT_SHIFT (0x2)
348 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_12_5_PERCENT (0x00005000U)
349 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_12_5_PERCENT_SHIFT (0x3)
350 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_6_25_PERCENT (0x00050000U)
351 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_6_25_PERCENT_SHIFT (0x4)
352 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_3_125_PERCENT (0x00500000U)
353 #define RTI_RTIDWWDSIZECTRL_DWWDSIZE_3_125_PERCENT_SHIFT (0x5)
354 
359 static inline int32_t SDL_RTI_writeWinSz(uint32_t baseAddr, uint32_t dwwdWindowSize)
360 {
361  int32_t sdlResult;
362  /* Writing window size to RTI_WWDSIZECTRL Register (Offset = A8h) */
363  HW_WR_FIELD32( baseAddr + RTI_RTIDWWDSIZECTRL,
364  RTI_RTIDWWDSIZECTRL_DWWDSIZE,
365  dwwdWindowSize);
366  sdlResult = SDL_PASS;
367 
368  return sdlResult;
369 }
370 
375 static inline int32_t SDL_RTI_writeReaction(uint32_t baseAddr, uint32_t dwwdReaction)
376 {
377  int32_t sdlResult;
378 
379  /* Writing reaction to RTI_WWDRXNCTRL Register (Offset = A4h) */
380  /* 5h = This is the default value
381  Ah = The windowed watchdog will generate a non-maskable interrupt */
382  (HW_WR_FIELD32(baseAddr + RTI_RTIDWWDRXNCTRL,
383  RTI_RTIDWWDRXNCTRL_DWWDRXN,
384  dwwdReaction));
385  sdlResult = SDL_PASS;
386 
387  return sdlResult;
388 }
389 
394 static inline uint32_t SDL_RTI_readReaction(uint32_t baseAddr)
395 {
396  uint32_t dwwdReaction;
397 
398  /* Get Windowed Watchdog Reaction */
399  dwwdReaction = HW_RD_FIELD32(baseAddr + RTI_RTIDWWDRXNCTRL,
400  RTI_RTIDWWDRXNCTRL_DWWDRXN);
401 
402  return dwwdReaction;
403 }
404 
405 
406 #ifdef __cplusplus
407 }
408 #endif
409 #endif /* HW_RTI_H_ */
410 
static uint32_t SDL_RTI_readReaction(uint32_t baseAddr)
Definition: sdl_ip_rti.h:394
List of Config Parameters for RTI DWWD.
Definition: sdl_ip_rti.h:108
uint32_t RTI_Status_t
type to report the DWWD status.
Definition: sdl_ip_rti.h:279
uint32_t SDL_RTI_dwwdWindowSize
Definition: sdl_ip_rti.h:112
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:359
uint32_t SDL_RTI_dwwdReaction
Definition: sdl_ip_rti.h:114
#define RTI_RTIDWWDRXNCTRL
Definition: sdl_ip_rti.h:295
uint32_t RTI_WindowSize_t
type to select the DWWD window size.
Definition: sdl_ip_rti.h:231
uint32_t SDL_RTI_dwwdPreloadVal
Definition: sdl_ip_rti.h:110
static int32_t SDL_RTI_writeReaction(uint32_t baseAddr, uint32_t dwwdReaction)
Definition: sdl_ip_rti.h:375
uint32_t RTI_DWDCTRL
Definition: sdl_ip_rti.h:94
uint32_t RTI_DWDPRLD
Definition: sdl_ip_rti.h:96
uint32_t RTI_WWDSIZECTRL
Definition: sdl_ip_rti.h:100
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:98
#define RTI_RTIDWWDSIZECTRL
Definition: sdl_ip_rti.h:296
List of Static Registers for RTI DWWD.
Definition: sdl_ip_rti.h:91
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.