AM273x MCU+ SDK  08.05.00
sdl_esm.h
Go to the documentation of this file.
1 /*
2  * SDL ESM
3  *
4  * Software Diagnostics Reference module for Error Signaling Module
5  *
6  * Copyright (c) Texas Instruments Incorporated 2022
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the
18  * distribution.
19  *
20  * Neither the name of Texas Instruments Incorporated nor the names of
21  * its contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
51 #ifndef ESM_H_
52 #define ESM_H_
53 
54 /* ========================================================================== */
55 /* Include Files */
56 /* ========================================================================== */
57 #include <stdint.h>
58 #include <sdl/include/sdl_types.h>
59 #include <sdl/include/hw_types.h>
60 #include <sdl/esm/sdlr_esm.h>
62 #include <sdl/esm/v1/esm.h>
63 #include <sdl/dpl/sdl_dpl.h>
64 #include <sdl/esm/soc/sdl_esm_soc.h>
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 /* ========================================================================== */
71 /* Macros & Typedefs */
72 /* ========================================================================== */
73 
75 #define SDL_ESM_ERRNO_BASE (-3000)
76 
78 #define SDL_ESM_INTNUMBER_INVALID (0xffffffffu)
79 
81 #define SDL_ESM_INST_INVALID (0xfffffffeu)
82 
84 #define SDL_ESM_ERRORADDR_INVALID (0xffffffffu)
85 
87 #define SDL_ESM_ERRORRAMID_INVALID (0xffffffffu)
88 
90 #define SDL_ESM_ERRORBITOFFSET_INVALID (0xffffffffffffffffu)
91 
93 #define SDL_ESM_ERRORBITGROUP_INVALID (0xffffffffu)
94 
96 #define SDL_ESM_MAX_EVENT_MAP_NUM_WORDS (32u)
97 
104 #define SDL_ESM_EINVAL (SDL_ESM_ERRNO_BASE-1)
105 
106 #define SDL_ESM_ENOINIT (SDL_ESM_ERRNO_BASE-2)
107 
108 #define SDL_ESM_EREINIT (SDL_ESM_ERRNO_BASE-3)
109 
110 #define SDL_ESM_ENOMEM (SDL_ESM_ERRNO_BASE-4)
111 
114 #define SDL_ESM_MAX_NOTIFIERS (256U)
115 
116 #define SDL_ESM_MAX_ISR_COUNT (256U)
117 
118  #define CONFIG_ESM0 (0U)
119 
120 typedef int32_t SDL_Result;
121 
130 typedef uint32_t sdlEsmEccErrorSource_t;
131 
133 #define SDL_ESM_ECC_PARAM_MCU_CPU0_SEC_ERROR (1u)
134 
135 #define SDL_ESM_ECC_PARAM_MCU_CPU0_DED_ERROR (2u)
136 
137 #define SDL_ESM_ECC_PARAM_MCU_CPU1_SEC_ERROR (3u)
138 
139 #define SDL_ESM_ECC_PARAM_MCU_CPU1_DED_ERROR (4u)
140 
141 #define SDL_ESM_ECC_PARAM_MCU_CBASS_SEC_ERROR (5u)
142 
143 #define SDL_ESM_ECC_PARAM_MCU_CBASS_DED_ERROR (6u)
144 
146 /* ========================================================================== */
147 /* Structure Declarations */
148 /* ========================================================================== */
149 
163  typedef int32_t (* SDL_ESM_CallBack) (SDL_ESM_Inst instance, int32_t grpChannel, int32_t vecNum, void *arg);
164 
166 typedef struct
167 {
168  uint32_t grpIntrStatus[SDL_ESM_NUM_INTR_PER_GROUP / BITS_PER_WORD];
171 
178 typedef struct SDL_ESM_Errorconfig_s
179 {
180  uint32_t groupNumber;
182  uint32_t eventNumber;
185 
192 typedef struct
193 {
194  uint32_t groupNumber;
196  uint32_t errorNumber;
202  void *arg;
209 
220 typedef struct
221 {
232 
242 typedef struct {
247  SDL_mss_ctrlRegs *ptrCtrlRegs;
249  uint32_t numGroup1Err;
251  uint32_t highPrioIntNum;
253  uint32_t lowPrioIntNum;
260 
268 typedef struct
269 {
270  volatile bool selfTestFlag;
272  uint32_t esmBaseAddr;
280  uint32_t numGroup1Err;
282  void *eccCallBackFunctionArg[SDL_ESM_MAX_ISR_COUNT];
286  uint32_t eccenableEventBitmap[SDL_ESM_MAX_ISR_COUNT];
288  uint32_t debugEsmISRCount[SDL_ESM_MAX_ISR_COUNT];
291 
298 typedef struct {
304 
305 /*
306  * ESM
307  */
308 /* ESM attributes */
309 static SDL_ESM_Params gEsmParams[SDL_ESM_INST_DSS_ESM] =
310 {
311  {
312  .ptrESMRegs = (SDL_esmRegs *)SDL_MSS_ESM_U_BASE,
313  .ptrCtrlRegs = (SDL_mss_ctrlRegs *)SDL_MSS_CTRL_U_BASE,
314  .numGroup1Err = SDL_ESM_NUM_INTR_PER_GROUP,
315  .highPrioIntNum = SDL_MSS_ESM_HI_INTNO,
316  .lowPrioIntNum = SDL_MSS_ESM_LOW_INTNO,
317  .intrHighPriority = SDL_ESM_EN_KEY_ENBALE_VAL,
318  .intrLowPriority = 8U,
319  },
320 
321  {
322  .ptrESMRegs = (SDL_esmRegs *)SDL_DSS_ESM_U_BASE,
323  .ptrCtrlRegs = (SDL_mss_ctrlRegs *)SDL_DSS_CTRL_U_BASE,
324  .numGroup1Err = SDL_ESM_NUM_INTR_PER_GROUP,
325  .highPrioIntNum = SDL_DSS_ESM_HI_INTNO,
326  .lowPrioIntNum = SDL_DSS_ESM_LOW_INTNO,
327  .intrHighPriority = SDL_ESM_EN_KEY_ENBALE_VAL,
328  .intrLowPriority = 1U,
329  },
330 };
331 
332 /* ESM objects - initialized by the Module */
334 
335 /* ESM Module handles */
337 
338 /* ESM Module configuration */
339 static SDL_ESM_Config gEsmConfig[SDL_ESM_INST_DSS_ESM] =
340 {
341  {
342  &gEsmParams[SDL_ESM_INST_MSS_ESM -1U],
344  },
345  {
346  &gEsmParams[SDL_ESM_INST_DSS_ESM -1U],
348  },
349 };
350 
351 /* ========================================================================== */
352 /* enums */
353 /* ========================================================================== */
359 typedef enum {
369 
370 /* ========================================================================== */
371 /* Function Declarations */
372 /* ========================================================================== */
373 
388 int32_t SDL_ESM_getNErrorStatus(SDL_ESM_Inst instance, uint32_t *pStatus);
389 
404 int32_t SDL_ESM_getStaticRegisters(SDL_ESM_Inst instance, SDL_ESM_staticRegs *pStaticRegs);
405 
415 int32_t SDL_ESM_clrNError(SDL_ESM_Inst instance);
416 
426 int32_t SDL_ESM_setNError(SDL_ESM_Inst instance);
427 
449 SDL_Result SDL_ESM_init (const SDL_ESM_Inst esmInstType,
450  SDL_ESM_NotifyParams* params,
451  SDL_ESM_OpenParams *esmOpenParams,
452  void *arg);
453 
475 int32_t SDL_ESM_registerECCCallback(SDL_ESM_Inst esmInstType,uint32_t eccEvent,
476  SDL_ESM_CallBack callBack,
477  void *callbackArg);
491 int32_t SDL_ESM_verifyConfig(SDL_ESM_Inst instance, SDL_ESM_NotifyParams* params);
492 
493 /* ========================================================================== */
494 /* Static Function Definitions */
495 /* ========================================================================== */
496 static inline void SDL_ESM_Params_init(SDL_ESM_OpenParams *openPrms)
497 {
498  if (openPrms != NULL)
499  {
500  openPrms->bClearErrors = FALSE;
501  }
502 }
503 
504 #ifdef __cplusplus
505 }
506 #endif
507 
508 #endif /* #ifndef ESM_H_ */
509 
SDL_ESM_NotifyParams
Parameters used to register the ESM notify function to handle Group1 and Group2 errors....
Definition: sdl_esm.h:193
SDL_ESM_Handle
void * SDL_ESM_Handle
A handle that is returned from a ESM_Init() call.
Definition: sdl/esm/v1/esm.h:193
SDL_ESM_ErrorConfig_t
ESM error configuration.
Definition: sdl_esm.h:179
SDL_ESM_ErrorConfig_t::eventNumber
uint32_t eventNumber
Definition: sdl_esm.h:182
SDL_ESM_IntType
SDL_ESM_IntType
Definition: sdl_esm.h:359
SDL_ESM_NotifyParams::groupNumber
uint32_t groupNumber
Definition: sdl_esm.h:194
SDL_ESM_init
SDL_Result SDL_ESM_init(const SDL_ESM_Inst esmInstType, SDL_ESM_NotifyParams *params, SDL_ESM_OpenParams *esmOpenParams, void *arg)
SDL ESM API to initialize an ESM instance. The API initializes the specified ESM instance with the pr...
SDL_ESM_OpenParams::bClearErrors
bool bClearErrors
Definition: sdl_esm.h:222
SDL_ESM_NotifyParams::esmErrorConfig
SDL_ESM_ErrorConfig_t esmErrorConfig
Definition: sdl_esm.h:206
sdlr_esm.h
SDL_ESM_OpenParams
ESM Open Parameters.
Definition: sdl_esm.h:221
SDL_ESM_Params::ptrCtrlRegs
SDL_mss_ctrlRegs * ptrCtrlRegs
Definition: sdl_esm.h:247
SDL_ESM_Params_init
static void SDL_ESM_Params_init(SDL_ESM_OpenParams *openPrms)
Definition: sdl_esm.h:496
sdlEsmEccErrorSource_t
uint32_t sdlEsmEccErrorSource_t
Source of the ECC error which maps to the ESM interrupt source.
Definition: sdl_esm.h:130
SDL_ESM_NotifyParams::setIntrPriorityLvl
uint32_t setIntrPriorityLvl
Definition: sdl_esm.h:198
SDL_ESM_MAX_ISR_COUNT
#define SDL_ESM_MAX_ISR_COUNT
Maximum ISR supported.
Definition: sdl_esm.h:116
SDL_ESM_INT_TYPE_CFG
@ SDL_ESM_INT_TYPE_CFG
Definition: sdl_esm.h:364
SDL_ESM_staticRegs
ESM static registers list.
Definition: sdl/esm/v1/esm.h:212
SDL_ESM_Params::esmErrorConfig
SDL_ESM_ErrorConfig_t esmErrorConfig
Definition: sdl_esm.h:243
SDL_ESM_Config::object
SDL_ESM_Object * object
Definition: sdl_esm.h:301
gEsmConfig
static SDL_ESM_Config gEsmConfig[SDL_ESM_INST_DSS_ESM]
Definition: sdl_esm.h:339
SDL_ESM_INT_TYPE_LO
@ SDL_ESM_INT_TYPE_LO
Definition: sdl_esm.h:362
SDL_Result
int32_t SDL_Result
Definition: sdl_esm.h:120
SDL_ESM_Params::intrHighPriority
uint8_t intrHighPriority
Definition: sdl_esm.h:255
SDL_ESM_clrNError
int32_t SDL_ESM_clrNError(SDL_ESM_Inst instance)
SDL ESM API to clear the nError pin for the specified ESM instance.
SDL_ESM_registerECCCallback
int32_t SDL_ESM_registerECCCallback(SDL_ESM_Inst esmInstType, uint32_t eccEvent, SDL_ESM_CallBack callBack, void *callbackArg)
There are modules within SDL which will generate ESM errors intentionally in the course of running se...
SDL_ESM_NotifyParams::errorNumber
uint32_t errorNumber
Definition: sdl_esm.h:196
SDL_ESM_NUM_INTR_PER_GROUP
#define SDL_ESM_NUM_INTR_PER_GROUP
Definition: sdl/esm/v1/esm.h:145
SDL_ESM_getNErrorStatus
int32_t SDL_ESM_getNErrorStatus(SDL_ESM_Inst instance, uint32_t *pStatus)
SDL ESM API to get the status of the nError pin for the specified ESM instance.
SDL_ESM_Object::numGroup1Err
uint32_t numGroup1Err
Definition: sdl_esm.h:280
SDL_ESM_Object::esmHandle
SDL_ESM_Handle esmHandle
Definition: sdl_esm.h:276
SDL_esmRegs
Definition: sdlr_esm.h:51
SDL_ESM_Params::ptrESMRegs
SDL_esmRegs * ptrESMRegs
Definition: sdl_esm.h:245
gEsmHandle
SDL_ESM_Handle gEsmHandle
SDL_ESM_NotifyParams::enableInfluenceOnErrPin
bool enableInfluenceOnErrPin
Definition: sdl_esm.h:200
SDL_ESM_Object
ESM Module Object.
Definition: sdl_esm.h:269
sdl_dpl.h
This file contains the SDL DPL API's.
SDL_ESM_getStaticRegisters
int32_t SDL_ESM_getStaticRegisters(SDL_ESM_Inst instance, SDL_ESM_staticRegs *pStaticRegs)
SDL ESM API to read the static registers. The API reads and returns the static register configuration...
SDL_ESM_EN_KEY_ENBALE_VAL
#define SDL_ESM_EN_KEY_ENBALE_VAL
Definition: sdl/esm/v1/esm.h:85
SDL_ESM_Params::numGroup1Err
uint32_t numGroup1Err
Definition: sdl_esm.h:249
SDL_ESM_Params::intrLowPriority
uint8_t intrLowPriority
Definition: sdl_esm.h:257
SDL_ESM_verifyConfig
int32_t SDL_ESM_verifyConfig(SDL_ESM_Inst instance, SDL_ESM_NotifyParams *params)
SDL ESM API to verify the written configuration of the ESM module. The API verifies the written confi...
SDL_ESM_setNError
int32_t SDL_ESM_setNError(SDL_ESM_Inst instance)
SDL ESM API to set the nError pin for the specified ESM instance.
SDL_ESM_NotifyParams::callBackFunction
SDL_ESM_CallBack callBackFunction
Definition: sdl_esm.h:204
SDL_ESM_NotifyParams::arg
void * arg
Definition: sdl_esm.h:202
gEsmObjects
static SDL_ESM_Object gEsmObjects[CONFIG_ESM0]
Definition: sdl_esm.h:333
SDL_ESM_Object::selfTestFlag
volatile bool selfTestFlag
Definition: sdl_esm.h:270
SDL_ESM_CallBack
int32_t(* SDL_ESM_CallBack)(SDL_ESM_Inst instance, int32_t grpChannel, int32_t vecNum, void *arg)
Callback function which is invoked by the ESM module if a notify function is registered using the SDL...
Definition: sdl_esm.h:163
SDL_ESM_INT_TYPE_HI
@ SDL_ESM_INT_TYPE_HI
Definition: sdl_esm.h:360
SDL_ESM_INT_TYPE_MAX
@ SDL_ESM_INT_TYPE_MAX
Definition: sdl_esm.h:366
CONFIG_ESM0
#define CONFIG_ESM0
Definition: sdl_esm.h:118
ESM_GroupIntrStatus
Structure to access the status of interrupts belonging to a group.
Definition: drivers/esm/v0/esm.h:133
SDL_ESM_Config::esmConfig
SDL_ESM_Params * esmConfig
Definition: sdl_esm.h:299
BITS_PER_WORD
#define BITS_PER_WORD
Definition: sdl/esm/v1/esm.h:133
SDL_ESM_Config
ESM Instance configuration.
Definition: sdl_esm.h:298
SDL_ESM_Params::highPrioIntNum
uint32_t highPrioIntNum
Definition: sdl_esm.h:251
gEsmParams
static SDL_ESM_Params gEsmParams[SDL_ESM_INST_DSS_ESM]
Definition: sdl_esm.h:309
esm.h
This file contains the prototypes of the APIs present in the device abstraction layer file of ESM....
SDL_ESM_ErrorConfig_t::groupNumber
uint32_t groupNumber
Definition: sdl_esm.h:180
SDL_ESM_Params::lowPrioIntNum
uint32_t lowPrioIntNum
Definition: sdl_esm.h:253
SDL_ESM_Object::params
SDL_ESM_OpenParams params
Definition: sdl_esm.h:274
SDL_ESM_MAX_NOTIFIERS
#define SDL_ESM_MAX_NOTIFIERS
Maximum number of notify callbacks supported.
Definition: sdl_esm.h:114
SDL_ESM_Object::esmBaseAddr
uint32_t esmBaseAddr
Definition: sdl_esm.h:272
SDL_ESM_Params
ESM Hardware Attributes.
Definition: sdl_esm.h:242