SDL API Guide for J721E
esm.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 
42 #ifndef SDL_ESM_H
43 #define SDL_ESM_H
44 
45 /* ========================================================================== */
46 /* Include Files */
47 /* ========================================================================== */
48 #include <stdint.h>
49 #include <stdbool.h>
50 
51 
52 #include <include/soc.h>
53 #include <hw_types.h>
54 #include "sdl_common.h"
55 #include <src/ip/sdl_esm.h>
56 #include <src/ip/sdl_ip_esm.h>
57 
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
100 /* ========================================================================== */
101 /* Macros & Typedefs */
102 /* ========================================================================== */
103 
108 #define ESM_NUMBER_OF_GROUP_REGS (32u)
109 
112 typedef uint32_t esmOperationMode_t;
113 
117 #define ESM_OPERATION_MODE_NORMAL 0x0U
118 
119 #define ESM_OPERATION_MODE_ERROR_FORCE 0xAu
120 
125 typedef uint32_t esmIntrType_t;
126 
131 #define ESM_INTR_TYPE_CONFIG_ERROR (0x0u)
132 
133 #define ESM_INTR_TYPE_LOW_PRIO_ERROR (0x1u)
134 
135 #define ESM_INTR_TYPE_HIGH_PRIO_ERROR (0x2u)
136 
141 typedef uint32_t esmIntrPriorityLvl_t;
142 
147 #define ESM_INTR_PRIORITY_LEVEL_LOW (0x0u)
148 
149 #define ESM_INTR_PRIORITY_LEVEL_HIGH (0x1u)
150 
161 /* ========================================================================== */
162 /* Structures and Enums */
163 /* ========================================================================== */
164 
168 typedef struct esmRevisionId
169 {
170  uint32_t scheme;
172  uint32_t func;
174  uint32_t rtlRev;
176  uint32_t major;
178  uint32_t custom;
180  uint32_t minor;
183 
187 typedef struct esmInfo
188 {
189  uint32_t lastRstType;
194  uint32_t plsGrpNum;
196  uint32_t lvlGrpNum;
198 }esmInfo_t;
199 
204 typedef struct esmGroupIntrStatus
205 {
214  uint32_t grpIntrStatus;
221 
225 typedef struct {
226  volatile uint32_t RAW; /* Config Error Raw Status/Set Register */
227  volatile uint32_t INTR_EN_SET; /* Level Error Interrutp Enable Set Register */
228  volatile uint32_t INTR_EN_CLR; /* Level Error Interrupt Enabled Clear Register */
229  volatile uint32_t INT_PRIO; /* Level Error Interrupt Enabled Clear Register */
230  volatile uint32_t PIN_EN_SET; /* Level Error Interrupt Enabled Clear Register */
231  volatile uint32_t PIN_EN_CLR; /* Level Error Interrupt Enabled Clear Register */
233 
237 typedef struct {
239  volatile uint32_t PID; /* Revision Register */
240  volatile uint32_t INFO; /* Info Register */
241  volatile uint32_t EN; /* Global Enable Register */
242  volatile uint32_t ERR_EN_SET; /* Config Error Interrutp Enable Set Register */
243  volatile uint32_t ERR_EN_CLR; /* Config Error Interrupt Enabled Clear Register */
244  volatile uint32_t LOW_PRI; /* Low Priority Prioritized Register */
245  volatile uint32_t HI_PRI; /* High Priority Prioritized Register */
246  volatile uint32_t LOW; /* Low Priority Interrupt Status Register */
247  volatile uint32_t HI; /* High Priority Interrupt Status Register */
248  volatile uint32_t PIN_CTRL; /* Error Pin Control Register */
249  volatile uint32_t PIN_CNTR; /* Error Counter Value Register */
250  volatile uint32_t PIN_CNTR_PRE; /* Error Counter Value Pre-Load Register */
252 
255 /* ========================================================================== */
256 /* Global Variables */
257 /* ========================================================================== */
258 /* None */
259 
266 /* ========================================================================== */
267 /* Function Declarations */
268 /* ========================================================================== */
298 int32_t SDL_ESM_setMode(uint32_t baseAddr, esmOperationMode_t mode);
299 
329 int32_t SDL_ESM_getMode(uint32_t baseAddr, esmOperationMode_t *pMode);
330 
364 int32_t SDL_ESM_setInfluenceOnErrPin(uint32_t baseAddr, uint32_t intrSrc,
365  bool enable);
366 
403 int32_t SDL_ESM_getInfluenceOnErrPin(uint32_t baseAddr, uint32_t intrSrc,
404  uint32_t *pInfluence);
440 int32_t SDL_ESM_setErrPinLowTimePreload(uint32_t baseAddr, uint32_t lowTime);
441 
477 int32_t SDL_ESM_getErrPinLowTimePreload(uint32_t baseAddr, uint32_t *pLowTime);
478 
479 
507 int32_t SDL_ESM_getCurrErrPinLowTimeCnt(uint32_t baseAddr, uint32_t *pPinCntrPre);
508 
536 int32_t SDL_ESM_getErrPinStatus(uint32_t baseAddr, uint32_t *pStatus);
537 
564 int32_t SDL_ESM_resetErrPin(uint32_t baseAddr);
565 
600 int32_t SDL_ESM_isEnableCfgIntr(uint32_t baseAddr, uint32_t group, uint32_t *pEnStatus);
601 
636 int32_t SDL_ESM_isEnableIntr(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pEnStatus);
637 
666 int32_t SDL_ESM_disableCfgIntr(uint32_t baseAddr, uint32_t intrNum);
667 
696 int32_t SDL_ESM_enableCfgIntr(uint32_t baseAddr, uint32_t group);
697 
726 int32_t SDL_ESM_enableIntr(uint32_t baseAddr, uint32_t intrNum);
727 
756 int32_t SDL_ESM_disableIntr(uint32_t baseAddr, uint32_t intrNum);
757 
794 int32_t SDL_ESM_setIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc,
795  esmIntrPriorityLvl_t intrPriorityLvl);
796 
833 int32_t SDL_ESM_getIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc,
834  esmIntrPriorityLvl_t *pIntrPriorityLvl);
835 
870 int32_t SDL_ESM_getCfgIntrStatus(uint32_t baseAddr, uint32_t group, uint32_t *pStaus);
871 
906 int32_t SDL_ESM_getIntrStatus(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStaus);
907 
940 int32_t SDL_ESM_setCfgIntrStatusRAW(uint32_t baseAddr, uint32_t group);
941 
974 int32_t SDL_ESM_setIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc);
975 
1010 int32_t SDL_ESM_getIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStatus);
1011 
1047 int32_t SDL_ESM_getGroupIntrStatus(uint32_t baseAddr, esmIntrPriorityLvl_t intrPrioType,
1048  esmGroupIntrStatus_t *pIntrstatus);
1049 
1081 int32_t SDL_ESM_clearCfgIntrStatus(uint32_t baseAddr, uint32_t group);
1082 
1114 int32_t SDL_ESM_clearIntrStatus(uint32_t baseAddr, uint32_t intrSrc);
1115 
1144 int32_t SDL_ESM_writeEOI(uint32_t baseAddr, esmIntrType_t intrType);
1145 
1174 int32_t SDL_ESM_getRevisionId(uint32_t baseAddr, esmRevisionId_t *pRevId);
1175 
1205 int32_t SDL_ESM_getInfo(uint32_t baseAddr, esmInfo_t *pInfo);
1206 
1207 
1241 int32_t SDL_ESM_getGlobalIntrEnabledStatus(uint32_t baseAddr, uint32_t *pStatus);
1242 
1243 
1268 int32_t SDL_ESM_enableGlobalIntr(uint32_t baseAddr);
1269 
1294 int32_t SDL_ESM_disableGlobalIntr(uint32_t baseAddr);
1295 
1321 int32_t SDL_ESM_reset(uint32_t baseAddr);
1322 
1325 #ifdef __cplusplus
1326 }
1327 
1328 #endif /*extern "C" */
1329 
1330 #endif /*SDL_ESM_H*/
int32_t SDL_ESM_getCurrErrPinLowTimeCnt(uint32_t baseAddr, uint32_t *pPinCntrPre)
This API is used to get the current value of low time counter.
int32_t SDL_ESM_writeEOI(uint32_t baseAddr, esmIntrType_t intrType)
This API is used to write EOI.
volatile uint32_t PIN_CNTR
Definition: esm.h:249
ESM static registers list.
Definition: esm.h:237
uint32_t custom
Definition: esm.h:178
uint32_t func
Definition: esm.h:172
volatile uint32_t RAW
Definition: esm.h:226
int32_t SDL_ESM_getMode(uint32_t baseAddr, esmOperationMode_t *pMode)
This API is used to read operation mode of ESM module.
volatile uint32_t HI
Definition: esm.h:247
int32_t SDL_ESM_getGroupIntrStatus(uint32_t baseAddr, esmIntrPriorityLvl_t intrPrioType, esmGroupIntrStatus_t *pIntrstatus)
This API is used to get the interrupt/error status for a group. This will also return highest pending...
int32_t SDL_ESM_reset(uint32_t baseAddr)
This API is used to reset ESM module. Reset is used to reset all enables and raw status bits.
int32_t SDL_ESM_setIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc, esmIntrPriorityLvl_t intrPriorityLvl)
This API is used to set interrupt level.
int32_t SDL_ESM_disableIntr(uint32_t baseAddr, uint32_t intrNum)
This API is used to disable interrupt.
int32_t SDL_ESM_enableCfgIntr(uint32_t baseAddr, uint32_t group)
This API is used to enable the configuration interrupt.
uint32_t esmIntrPriorityLvl_t
ESM Interrupt Priority Levels.
Definition: esm.h:141
int32_t SDL_ESM_isEnableCfgIntr(uint32_t baseAddr, uint32_t group, uint32_t *pEnStatus)
This API is used check if the configuration interrupt for a group is enabled/disabled.
int32_t SDL_ESM_setCfgIntrStatusRAW(uint32_t baseAddr, uint32_t group)
This API is used to set the configuration interrupt RAW status for a group.
uint32_t minor
Definition: esm.h:180
volatile uint32_t INTR_EN_SET
Definition: esm.h:227
int32_t SDL_ESM_resetErrPin(uint32_t baseAddr)
This API is used to reset the nERROR pin.
volatile uint32_t PIN_CTRL
Definition: esm.h:248
volatile uint32_t PIN_EN_CLR
Definition: esm.h:231
uint32_t esmIntrType_t
ESM Interrupt Type to select level for interrupt.
Definition: esm.h:125
int32_t SDL_ESM_getInfluenceOnErrPin(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pInfluence)
This API is used to get the influence of interrupt on nERROR pin.
volatile uint32_t PID
Definition: esm.h:239
int32_t SDL_ESM_getErrPinLowTimePreload(uint32_t baseAddr, uint32_t *pLowTime)
This API is used to read the low time counter pre-load value.
volatile uint32_t LOW_PRI
Definition: esm.h:244
uint32_t rtlRev
Definition: esm.h:174
uint32_t highestPendPlsIntNum
Definition: esm.h:206
int32_t SDL_ESM_getIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStatus)
This API is used to get the interrupt RAW status.
uint32_t lastRstType
Definition: esm.h:189
int32_t SDL_ESM_disableCfgIntr(uint32_t baseAddr, uint32_t intrNum)
This API is used to disable the configuration interrupt.
Structure to access the status of interrupts belonging to a High or Low priority interrupt.
Definition: esm.h:204
int32_t SDL_ESM_setMode(uint32_t baseAddr, esmOperationMode_t mode)
This API is used to configure operation mode of ESM module.
Structure for accessing information register of ESM module.
Definition: esm.h:187
uint32_t plsGrpNum
Definition: esm.h:194
uint32_t highestPendLvlIntNum
Definition: esm.h:210
int32_t SDL_ESM_clearIntrStatus(uint32_t baseAddr, uint32_t intrSrc)
This API is used to clear the interrupt status.
#define ESM_NUMBER_OF_GROUP_REGS
ESM Operation Mode type.
Definition: esm.h:108
int32_t SDL_ESM_enableGlobalIntr(uint32_t baseAddr)
This API is used to enable Global control of interrupt.
int32_t SDL_ESM_getGlobalIntrEnabledStatus(uint32_t baseAddr, uint32_t *pStatus)
This API is used read the ESM information register.
volatile uint32_t ERR_EN_CLR
Definition: esm.h:243
ESM Error Group static registers list.
Definition: esm.h:225
int32_t SDL_ESM_isEnableIntr(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pEnStatus)
This API is used check if interrupt is enabled/disabled.
uint32_t grpIntrStatus
Definition: esm.h:214
uint32_t esmOperationMode_t
ESM Operation Mode type.
Definition: esm.h:112
Structure for accessing Revision ID of ESM module.
Definition: esm.h:168
uint32_t scheme
Definition: esm.h:170
int32_t SDL_ESM_setErrPinLowTimePreload(uint32_t baseAddr, uint32_t lowTime)
This API is used to configure the low time counter pre-load value.
int32_t SDL_ESM_disableGlobalIntr(uint32_t baseAddr)
This API is used to disable Global control of interrupt.
Header file contains enumerations, structure definitions and function declarations for SDL Error Sign...
volatile uint32_t INTR_EN_CLR
Definition: esm.h:228
volatile uint32_t LOW
Definition: esm.h:246
This file contains SOC specific defintions.
int32_t SDL_ESM_getCfgIntrStatus(uint32_t baseAddr, uint32_t group, uint32_t *pStaus)
This API is used to get the configuration interrupt status for a group.
volatile uint32_t PIN_CNTR_PRE
Definition: esm.h:250
volatile uint32_t INFO
Definition: esm.h:240
int32_t SDL_ESM_getIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc, esmIntrPriorityLvl_t *pIntrPriorityLvl)
This API is used to get interrupt level.
int32_t SDL_ESM_setInfluenceOnErrPin(uint32_t baseAddr, uint32_t intrSrc, bool enable)
This API is used to set the influence of interrupt on nERROR pin.
volatile uint32_t ERR_EN_SET
Definition: esm.h:242
volatile uint32_t INT_PRIO
Definition: esm.h:229
uint32_t lvlGrpNum
Definition: esm.h:196
int32_t SDL_ESM_enableIntr(uint32_t baseAddr, uint32_t intrNum)
This API is used to enable interrupt.
int32_t SDL_ESM_getInfo(uint32_t baseAddr, esmInfo_t *pInfo)
This API is used read the ESM information register.
int32_t SDL_ESM_getRevisionId(uint32_t baseAddr, esmRevisionId_t *pRevId)
This API is used get the ESM revision ID.
int32_t SDL_ESM_getErrPinStatus(uint32_t baseAddr, uint32_t *pStatus)
This API is used to get the current status of nERROR pin.
volatile uint32_t PIN_EN_SET
Definition: esm.h:230
int32_t SDL_ESM_clearCfgIntrStatus(uint32_t baseAddr, uint32_t group)
This API is used to clear the configuration interrupt status.
int32_t SDL_ESM_getIntrStatus(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStaus)
This API is used to get the interrupt status.
volatile uint32_t EN
Definition: esm.h:241
int32_t SDL_ESM_setIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc)
This API is used to set the interrupt RAW status.
uint32_t major
Definition: esm.h:176
volatile uint32_t HI_PRI
Definition: esm.h:245