PDK API Guide for J721E
esm.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Texas Instruments Incorporated 2017-2019
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 
49 #ifndef CSL_ESM_H
50 #define CSL_ESM_H
51 
52 /* ========================================================================== */
53 /* Include Files */
54 /* ========================================================================== */
55 #include <stdint.h>
56 #include <stdbool.h>
57 
58 #include <ti/csl/soc.h>
59 #include <ti/csl/cslr_esm.h>
60 
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
102 /* ========================================================================== */
103 /* Macros & Typedefs */
104 /* ========================================================================== */
105 
110 #define ESM_NUMBER_OF_GROUP_REGS (32u)
111 
114 typedef uint32_t esmOperationMode_t;
115 
119 #define ESM_OPERATION_MODE_NORMAL 0x0U
120 
121 #define ESM_OPERATION_MODE_ERROR_FORCE 0xAu
122 
127 typedef uint32_t esmIntrType_t;
128 
133 #define ESM_INTR_TYPE_CONFIG_ERROR (0x0u)
134 
135 #define ESM_INTR_TYPE_LOW_PRIO_ERROR (0x1u)
136 
137 #define ESM_INTR_TYPE_HIGH_PRIO_ERROR (0x2u)
138 
143 typedef uint32_t esmIntrPriorityLvl_t;
144 
149 #define ESM_INTR_PRIORITY_LEVEL_LOW (0x0u)
150 
151 #define ESM_INTR_PRIORITY_LEVEL_HIGH (0x1u)
152 
163 /* ========================================================================== */
164 /* Structures and Enums */
165 /* ========================================================================== */
166 
170 typedef struct esmRevisionId
171 {
172  uint32_t scheme;
174  uint32_t func;
176  uint32_t rtlRev;
178  uint32_t major;
180  uint32_t custom;
182  uint32_t minor;
185 
189 typedef struct esmInfo
190 {
191  uint32_t lastRstType;
196  uint32_t plsGrpNum;
198  uint32_t lvlGrpNum;
200 }esmInfo_t;
201 
206 typedef struct esmGroupIntrStatus
207 {
216  uint32_t grpIntrStatus;
223 
227 typedef struct {
228  volatile uint32_t RAW; /* Config Error Raw Status/Set Register */
229  volatile uint32_t INTR_EN_SET; /* Level Error Interrutp Enable Set Register */
230  volatile uint32_t INTR_EN_CLR; /* Level Error Interrupt Enabled Clear Register */
231  volatile uint32_t INT_PRIO; /* Level Error Interrupt Enabled Clear Register */
232  volatile uint32_t PIN_EN_SET; /* Level Error Interrupt Enabled Clear Register */
233  volatile uint32_t PIN_EN_CLR; /* Level Error Interrupt Enabled Clear Register */
235 
239 typedef struct {
241  volatile uint32_t PID; /* Revision Register */
242  volatile uint32_t INFO; /* Info Register */
243  volatile uint32_t EN; /* Global Enable Register */
244  volatile uint32_t ERR_EN_SET; /* Config Error Interrutp Enable Set Register */
245  volatile uint32_t ERR_EN_CLR; /* Config Error Interrupt Enabled Clear Register */
246  volatile uint32_t LOW_PRI; /* Low Priority Prioritized Register */
247  volatile uint32_t HI_PRI; /* High Priority Prioritized Register */
248  volatile uint32_t LOW; /* Low Priority Interrupt Status Register */
249  volatile uint32_t HI; /* High Priority Interrupt Status Register */
250  volatile uint32_t PIN_CTRL; /* Error Pin Control Register */
251  volatile uint32_t PIN_CNTR; /* Error Counter Value Register */
252  volatile uint32_t PIN_CNTR_PRE; /* Error Counter Value Pre-Load Register */
254 
257 /* ========================================================================== */
258 /* Global Variables */
259 /* ========================================================================== */
260 /* None */
261 
268 /* ========================================================================== */
269 /* Function Declarations */
270 /* ========================================================================== */
300 int32_t ESMSetMode(uint32_t baseAddr, esmOperationMode_t mode);
301 
331 int32_t ESMGetMode(uint32_t baseAddr, esmOperationMode_t *pMode);
332 
366 int32_t ESMSetInfluenceOnErrPin(uint32_t baseAddr, uint32_t intrSrc,
367  bool enable);
368 
405 int32_t ESMGetInfluenceOnErrPin(uint32_t baseAddr, uint32_t intrSrc,
406  uint32_t *pInfluence);
442 int32_t ESMSetErrPinLowTimePreload(uint32_t baseAddr, uint32_t lowTime);
443 
479 int32_t ESMGetErrPinLowTimePreload(uint32_t baseAddr, uint32_t *pLowTime);
480 
481 
509 int32_t ESMGetCurrErrPinLowTimeCnt(uint32_t baseAddr, uint32_t *pPinCntrPre);
510 
538 int32_t ESMGetErrPinStatus(uint32_t baseAddr, uint32_t *pStatus);
539 
566 int32_t ESMResetErrPin(uint32_t baseAddr);
567 
602 int32_t ESMIsEnableIntr(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pEnStatus);
603 
604 
633 int32_t ESMEnableIntr(uint32_t baseAddr, uint32_t intrNum);
634 
663 int32_t ESMDisableIntr(uint32_t baseAddr, uint32_t intrNum);
664 
701 int32_t ESMSetIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc,
702  esmIntrPriorityLvl_t intrPriorityLvl);
703 
740 int32_t ESMGetIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc,
741  esmIntrPriorityLvl_t *pIntrPriorityLvl);
742 
777 int32_t ESMGetIntrStatus(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStaus);
778 
811 int32_t ESMSetIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc);
812 
847 int32_t ESMGetIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStatus);
848 
884 int32_t ESMGetGroupIntrStatus(uint32_t baseAddr, esmIntrPriorityLvl_t intrPrioType,
885  esmGroupIntrStatus_t *pIntrstatus);
886 
887 
919 int32_t ESMClearIntrStatus(uint32_t baseAddr, uint32_t intrSrc);
920 
949 int32_t ESMWriteEOI(uint32_t baseAddr, esmIntrType_t intrType);
950 
979 int32_t ESMGetRevisionId(uint32_t baseAddr, esmRevisionId_t *pRevId);
980 
1010 int32_t ESMGetInfo(uint32_t baseAddr, esmInfo_t *pInfo);
1011 
1012 
1046 int32_t ESMGetGlobalIntrEnabledStatus(uint32_t baseAddr, uint32_t *pStatus);
1047 
1048 
1073 int32_t ESMEnableGlobalIntr(uint32_t baseAddr);
1074 
1099 int32_t ESMDisableGlobalIntr(uint32_t baseAddr);
1100 
1126 int32_t ESMReset(uint32_t baseAddr);
1127 
1128 
1158 int32_t ESMReadStaticRegs (uint32_t baseAddr, CSL_esmStaticRegs *pStaticRegs);
1159 
1162 #ifdef __cplusplus
1163 }
1164 
1165 #endif /*extern "C" */
1166 
1167 #endif
1168 
int32_t ESMEnableGlobalIntr(uint32_t baseAddr)
This API is used to enable Global control of interrupt.
int32_t ESMGetMode(uint32_t baseAddr, esmOperationMode_t *pMode)
This API is used to read operation mode of ESM module.
uint32_t custom
Definition: esm.h:180
uint32_t func
Definition: esm.h:174
uint32_t esmIntrType_t
ESM Interrupt Type to select level for interrupt.
Definition: esm.h:127
volatile uint32_t EN
Definition: esm.h:243
ESM static registers list.
Definition: esm.h:239
int32_t ESMGetCurrErrPinLowTimeCnt(uint32_t baseAddr, uint32_t *pPinCntrPre)
This API is used to get the current value of low time counter.
#define ESM_NUMBER_OF_GROUP_REGS
ESM Operation Mode type.
Definition: esm.h:110
volatile uint32_t LOW
Definition: esm.h:248
int32_t ESMSetErrPinLowTimePreload(uint32_t baseAddr, uint32_t lowTime)
This API is used to configure the low time counter pre-load value.
volatile uint32_t ERR_EN_SET
Definition: esm.h:244
volatile uint32_t INTR_EN_CLR
Definition: esm.h:230
uint32_t minor
Definition: esm.h:182
int32_t ESMGetIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStatus)
This API is used to get the interrupt RAW status.
uint32_t esmIntrPriorityLvl_t
ESM Interrupt Priority Levels.
Definition: esm.h:143
volatile uint32_t PIN_EN_CLR
Definition: esm.h:233
volatile uint32_t PIN_CNTR_PRE
Definition: esm.h:252
int32_t ESMGetIntrStatus(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStaus)
This API is used to get the interrupt status.
int32_t ESMSetIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc, esmIntrPriorityLvl_t intrPriorityLvl)
This API is used to set interrupt level.
int32_t ESMReadStaticRegs(uint32_t baseAddr, CSL_esmStaticRegs *pStaticRegs)
This API is used to read static registers of ESM module. This API needs to be called after the initia...
uint32_t rtlRev
Definition: esm.h:176
int32_t ESMGetGroupIntrStatus(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 ESMClearIntrStatus(uint32_t baseAddr, uint32_t intrSrc)
This API is used to clear the interrupt status.
volatile uint32_t ERR_EN_CLR
Definition: esm.h:245
int32_t ESMSetMode(uint32_t baseAddr, esmOperationMode_t mode)
This API is used to configure operation mode of ESM module.
uint32_t highestPendPlsIntNum
Definition: esm.h:208
volatile uint32_t HI
Definition: esm.h:249
ESM Error Group static registers list.
Definition: esm.h:227
uint32_t lastRstType
Definition: esm.h:191
int32_t ESMGetInfluenceOnErrPin(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pInfluence)
This API is used to get the influence of interrupt on nERROR pin.
int32_t ESMIsEnableIntr(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pEnStatus)
This API is used check if interrupt is enabled/disabled.
Structure to access the status of interrupts belonging to a High or Low priority interrupt.
Definition: esm.h:206
Structure for accessing information register of ESM module.
Definition: esm.h:189
uint32_t plsGrpNum
Definition: esm.h:196
uint32_t highestPendLvlIntNum
Definition: esm.h:212
int32_t ESMDisableIntr(uint32_t baseAddr, uint32_t intrNum)
This API is used to disable interrupt.
char mode[32]
Definition: tisci_pm_core.h:130
volatile uint32_t INTR_EN_SET
Definition: esm.h:229
int32_t ESMGetErrPinStatus(uint32_t baseAddr, uint32_t *pStatus)
This API is used to get the current status of nERROR pin.
volatile uint32_t LOW_PRI
Definition: esm.h:246
int32_t ESMWriteEOI(uint32_t baseAddr, esmIntrType_t intrType)
This API is used to write EOI.
uint32_t grpIntrStatus
Definition: esm.h:216
int32_t ESMGetInfo(uint32_t baseAddr, esmInfo_t *pInfo)
This API is used read the ESM information register.
volatile uint32_t PID
Definition: esm.h:241
volatile uint32_t INFO
Definition: esm.h:242
int32_t ESMGetIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc, esmIntrPriorityLvl_t *pIntrPriorityLvl)
This API is used to get interrupt level.
int32_t ESMGetGlobalIntrEnabledStatus(uint32_t baseAddr, uint32_t *pStatus)
This API is used read the ESM information register.
Structure for accessing Revision ID of ESM module.
Definition: esm.h:170
uint32_t scheme
Definition: esm.h:172
int32_t ESMSetInfluenceOnErrPin(uint32_t baseAddr, uint32_t intrSrc, bool enable)
This API is used to set the influence of interrupt on nERROR pin.
volatile uint32_t HI_PRI
Definition: esm.h:247
int32_t ESMDisableGlobalIntr(uint32_t baseAddr)
This API is used to disable Global control of interrupt.
uint32_t lvlGrpNum
Definition: esm.h:198
volatile uint32_t PIN_EN_SET
Definition: esm.h:232
int32_t ESMGetErrPinLowTimePreload(uint32_t baseAddr, uint32_t *pLowTime)
This API is used to read the low time counter pre-load value.
uint32_t esmOperationMode_t
ESM Operation Mode type.
Definition: esm.h:114
int32_t ESMEnableIntr(uint32_t baseAddr, uint32_t intrNum)
This API is used to enable interrupt.
int32_t ESMResetErrPin(uint32_t baseAddr)
This API is used to reset the nERROR pin.
int32_t ESMReset(uint32_t baseAddr)
This API is used to reset ESM module. Reset is used to reset all enables and raw status bits.
int32_t ESMSetIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc)
This API is used to set the interrupt RAW status.
volatile uint32_t INT_PRIO
Definition: esm.h:231
volatile uint32_t PIN_CNTR
Definition: esm.h:251
volatile uint32_t RAW
Definition: esm.h:228
uint32_t major
Definition: esm.h:178
volatile uint32_t PIN_CTRL
Definition: esm.h:250
int32_t ESMGetRevisionId(uint32_t baseAddr, esmRevisionId_t *pRevId)
This API is used get the ESM revision ID.