AM62Ax MCU+ SDK  10.01.00
esm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023-2024 Texas Instruments Incorporated
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  */
60 #ifndef SDL_ESM_H
61 #define SDL_ESM_H
62 
63 /* ========================================================================== */
64 /* Include Files */
65 /* ========================================================================== */
66 #include <stdint.h>
67 #include <stdbool.h>
68 
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
74 /* ========================================================================== */
75 /* Macros & Typedefs */
76 /* ========================================================================== */
77 
82 #define ESM_NUMBER_OF_GROUP_REGS (32u)
83 
93 typedef uint32_t esmOperationMode_t;
94 
95 #define ESM_OPERATION_MODE_NORMAL 0x0U
96 
97 #define ESM_OPERATION_MODE_ERROR_FORCE 0xAu
98 
110 typedef uint32_t esmErrOutMode_t;
111 
112 #define SDL_ESM_LVL_PINOUT 0x0U
113 
114 #define SDL_ESM_PWM_PINOUT 0xFu
115 
125 typedef uint32_t esmIntrType_t;
126 
127 #define ESM_INTR_TYPE_CONFIG_ERROR (0x0u)
128 
129 #define ESM_INTR_TYPE_LOW_PRIO_ERROR (0x1u)
130 
131 #define ESM_INTR_TYPE_HIGH_PRIO_ERROR (0x2u)
132 
141 typedef uint32_t esmIntrPriorityLvl_t;
142 
143 #define ESM_INTR_PRIORITY_LEVEL_LOW (0x0u)
144 
145 #define ESM_INTR_PRIORITY_LEVEL_HIGH (0x1u)
146 
150 /* ========================================================================== */
151 /* Structures and Enums */
152 /* ========================================================================== */
153 
157 typedef struct esmRevisionId
158 {
159  uint32_t scheme;
161  uint32_t func;
163  uint32_t rtlRev;
165  uint32_t major;
167  uint32_t custom;
169  uint32_t minor;
172 
176 typedef struct esmInfo
177 {
178  uint32_t lastRstType;
183  uint32_t plsGrpNum;
185  uint32_t lvlGrpNum;
187 }esmInfo_t;
188 
193 typedef struct esmGroupIntrStatus
194 {
203  uint32_t grpIntrStatus;
210 
214 typedef struct {
215  volatile uint32_t RAW; /* Config Error Raw Status/Set Register */
216  volatile uint32_t INTR_EN_SET; /* Level Error Interrutp Enable Set Register */
217  volatile uint32_t INTR_EN_CLR; /* Level Error Interrupt Enabled Clear Register */
218  volatile uint32_t INT_PRIO; /* Level Error Interrupt Enabled Clear Register */
219  volatile uint32_t PIN_EN_SET; /* Level Error Interrupt Enabled Clear Register */
220  volatile uint32_t PIN_EN_CLR; /* Level Error Interrupt Enabled Clear Register */
222 
226 typedef struct {
228  volatile uint32_t PID; /* Revision Register */
229  volatile uint32_t INFO; /* Info Register */
230  volatile uint32_t EN; /* Global Enable Register */
231  volatile uint32_t ERR_EN_SET; /* Config Error Interrutp Enable Set Register */
232  volatile uint32_t ERR_EN_CLR; /* Config Error Interrupt Enabled Clear Register */
233  volatile uint32_t LOW_PRI; /* Low Priority Prioritized Register */
234  volatile uint32_t HI_PRI; /* High Priority Prioritized Register */
235  volatile uint32_t LOW; /* Low Priority Interrupt Status Register */
236  volatile uint32_t HI; /* High Priority Interrupt Status Register */
237  volatile uint32_t PIN_CTRL; /* Error Pin Control Register */
238  volatile uint32_t PIN_CNTR_PRE; /* Error Counter Value Pre-Load Register */
239  volatile uint32_t PWMH_PIN_CNTR_PRE; /* Error PWM High Counter Value Pre-Load Register */
240  volatile uint32_t PWML_PIN_CNTR_PRE; /* Error PWM Low Counter Value Pre-Load Register */
241 
243 
244 
245 /* ========================================================================== */
246 /* Global Variables */
247 /* ========================================================================== */
248 /* None */
249 
250 /* ========================================================================== */
251 /* Function Declarations */
252 /* ========================================================================== */
282 int32_t SDL_ESM_setMode(uint32_t baseAddr, esmOperationMode_t mode);
283 
313 int32_t SDL_ESM_getPinMode(uint32_t baseAddr, esmOperationMode_t *pMode);
314 
315 
345 int32_t SDL_ESM_getErrorOutMode(uint32_t baseAddr, esmOperationMode_t *pMode);
346 
380 int32_t SDL_ESM_setInfluenceOnErrPin(uint32_t baseAddr, uint32_t intrSrc,
381  bool enable);
382 
419 int32_t SDL_ESM_getInfluenceOnErrPin(uint32_t baseAddr, uint32_t intrSrc,
420  uint32_t *pInfluence);
456 int32_t SDL_ESM_setErrPinLowTimePreload(uint32_t baseAddr, uint32_t lowTime);
457 
489 int32_t SDL_ESM_PWML_setErrPinLowTimePreload(uint32_t baseAddr, uint32_t lowTime);
490 
522 int32_t SDL_ESM_PWMH_setErrPinHighTimePreload(uint32_t baseAddr, uint32_t highTime);
523 
559 int32_t SDL_ESM_getErrPinLowTimePreload(uint32_t baseAddr, uint32_t *pLowTime);
560 
592 int32_t SDL_ESM_PWML_getErrPinLowTimePreload(uint32_t baseAddr, uint32_t *pPinPWMLCntrPre);
593 
625 int32_t SDL_ESM_PWMH_getErrPinHighTimePreload(uint32_t baseAddr, uint32_t *pPinPWMHCntrPre);
626 
627 
655 int32_t SDL_ESM_getCurrErrPinLowTimeCnt(uint32_t baseAddr, uint32_t *pPinCntrPre);
656 
684 int32_t SDL_ESM_PWML_getCurrErrPinLowTimeCnt(uint32_t baseAddr, uint32_t *pLowPWMLTime);
685 
713 int32_t SDL_ESM_PWMH_getCurrErrPinHighTimeCnt(uint32_t baseAddr, uint32_t *pHighPWMHTime);
714 
742 int32_t SDL_ESM_getErrPinStatus(uint32_t baseAddr, uint32_t *pStatus);
743 
770 int32_t SDL_ESM_resetErrPin(uint32_t baseAddr);
771 
806 int32_t SDL_ESM_isEnableCfgIntr(uint32_t baseAddr, uint32_t group, uint32_t *pEnStatus);
807 
842 int32_t SDL_ESM_isEnableIntr(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pEnStatus);
843 
872 int32_t SDL_ESM_disableCfgIntr(uint32_t baseAddr, uint32_t intrNum);
873 
902 int32_t SDL_ESM_enableCfgIntr(uint32_t baseAddr, uint32_t group);
903 
932 int32_t SDL_ESM_enableIntr(uint32_t baseAddr, uint32_t intrNum);
933 
962 int32_t SDL_ESM_disableIntr(uint32_t baseAddr, uint32_t intrNum);
963 
1000 int32_t SDL_ESM_setIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc,
1001  esmIntrPriorityLvl_t intrPriorityLvl);
1002 
1039 int32_t SDL_ESM_getIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc,
1040  esmIntrPriorityLvl_t *pIntrPriorityLvl);
1041 
1076 int32_t SDL_ESM_getCfgIntrStatus(uint32_t baseAddr, uint32_t group, uint32_t *pStaus);
1077 
1112 int32_t SDL_ESM_getIntrStatus(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStaus);
1113 
1146 int32_t SDL_ESM_setCfgIntrStatusRAW(uint32_t baseAddr, uint32_t group);
1147 
1180 int32_t SDL_ESM_setIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc);
1181 
1216 int32_t SDL_ESM_getIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStatus);
1217 
1253 int32_t SDL_ESM_getGroupIntrStatus(uint32_t baseAddr, esmIntrPriorityLvl_t intrPrioType,
1254  esmGroupIntrStatus_t *pIntrstatus);
1255 
1287 int32_t SDL_ESM_clearCfgIntrStatus(uint32_t baseAddr, uint32_t group);
1288 
1320 int32_t SDL_ESM_clearIntrStatus(uint32_t baseAddr, uint32_t intrSrc);
1321 
1350 int32_t SDL_ESM_writeEOI(uint32_t baseAddr, esmIntrType_t intrType);
1351 
1380 int32_t SDL_ESM_getRevisionId(uint32_t baseAddr, esmRevisionId_t *pRevId);
1381 
1411 int32_t SDL_ESM_getInfo(uint32_t baseAddr, esmInfo_t *pInfo);
1412 
1413 
1447 int32_t SDL_ESM_getGlobalIntrEnabledStatus(uint32_t baseAddr, uint32_t *pStatus);
1448 
1449 
1474 int32_t SDL_ESM_enableGlobalIntr(uint32_t baseAddr);
1475 
1500 int32_t SDL_ESM_disableGlobalIntr(uint32_t baseAddr);
1501 
1527 int32_t SDL_ESM_reset(uint32_t baseAddr);
1528 
1531 #ifdef __cplusplus
1532 }
1533 
1534 #endif /*extern "C" */
1535 
1536 #endif /*SDL_ESM_H*/
SDL_ESM_staticRegs::PWMH_PIN_CNTR_PRE
volatile uint32_t PWMH_PIN_CNTR_PRE
Definition: esm.h:239
SDL_ESM_setInfluenceOnErrPin
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.
SDL_ESM_setIntrPriorityLvl
int32_t SDL_ESM_setIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc, esmIntrPriorityLvl_t intrPriorityLvl)
This API is used to set interrupt level.
SDL_ESM_getGroupIntrStatus
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...
SDL_ESM_setIntrStatusRAW
int32_t SDL_ESM_setIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc)
This API is used to set the interrupt RAW status.
SDL_ESM_getInfo
int32_t SDL_ESM_getInfo(uint32_t baseAddr, esmInfo_t *pInfo)
This API is used read the ESM information register.
esmGroupIntrStatus_t
Structure to access the status of interrupts belonging to a High or Low priority interrupt.
Definition: esm.h:194
SDL_ESM_getErrorOutMode
int32_t SDL_ESM_getErrorOutMode(uint32_t baseAddr, esmOperationMode_t *pMode)
This API is used to read Error Out mode (LVL or PWM) of ESM module.
ESM_NUMBER_OF_GROUP_REGS
#define ESM_NUMBER_OF_GROUP_REGS
ESM Operation Mode type.
Definition: esm.h:82
mode
uint8_t mode
Definition: tisci_lpm.h:1
SDL_ESM_PWML_setErrPinLowTimePreload
int32_t SDL_ESM_PWML_setErrPinLowTimePreload(uint32_t baseAddr, uint32_t lowTime)
This API is used to configure the low time counter pre-load value for PWM error.
esmRevisionId_t::minor
uint32_t minor
Definition: esm.h:169
SDL_esmRegs_ERR_GRP_STATIC::INTR_EN_CLR
volatile uint32_t INTR_EN_CLR
Definition: esm.h:217
esmGroupIntrStatus_t::highestPendLvlIntNum
uint32_t highestPendLvlIntNum
Definition: esm.h:199
SDL_ESM_getErrPinLowTimePreload
int32_t SDL_ESM_getErrPinLowTimePreload(uint32_t baseAddr, uint32_t *pLowTime)
This API is used to read the low time counter pre-load value.
SDL_ESM_getInfluenceOnErrPin
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.
SDL_ESM_setCfgIntrStatusRAW
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.
SDL_ESM_PWML_getCurrErrPinLowTimeCnt
int32_t SDL_ESM_PWML_getCurrErrPinLowTimeCnt(uint32_t baseAddr, uint32_t *pLowPWMLTime)
This API is used to get the current value of low time counter for PWM error.
esmRevisionId_t::custom
uint32_t custom
Definition: esm.h:167
SDL_ESM_staticRegs
ESM static registers list.
Definition: esm.h:226
SDL_ESM_enableGlobalIntr
int32_t SDL_ESM_enableGlobalIntr(uint32_t baseAddr)
This API is used to enable Global control of interrupt.
SDL_ESM_PWMH_setErrPinHighTimePreload
int32_t SDL_ESM_PWMH_setErrPinHighTimePreload(uint32_t baseAddr, uint32_t highTime)
This API is used to configure the high time counter pre-load value for PWM error.
esmRevisionId_t::func
uint32_t func
Definition: esm.h:161
SDL_esmRegs_ERR_GRP_STATIC::PIN_EN_SET
volatile uint32_t PIN_EN_SET
Definition: esm.h:219
SDL_ESM_disableCfgIntr
int32_t SDL_ESM_disableCfgIntr(uint32_t baseAddr, uint32_t intrNum)
This API is used to disable the configuration interrupt.
SDL_ESM_getIntrStatus
int32_t SDL_ESM_getIntrStatus(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStaus)
This API is used to get the interrupt status.
esmOperationMode_t
uint32_t esmOperationMode_t
ESM Operation Mode type.
Definition: esm.h:93
esmInfo_t
Structure for accessing information register of ESM module.
Definition: esm.h:177
esmRevisionId_t
Structure for accessing Revision ID of ESM module.
Definition: esm.h:158
SDL_ESM_getPinMode
int32_t SDL_ESM_getPinMode(uint32_t baseAddr, esmOperationMode_t *pMode)
This API is used to read operation mode of ESM module.
esmRevisionId_t::rtlRev
uint32_t rtlRev
Definition: esm.h:163
SDL_esmRegs_ERR_GRP_STATIC::PIN_EN_CLR
volatile uint32_t PIN_EN_CLR
Definition: esm.h:220
SDL_ESM_getCfgIntrStatus
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.
SDL_ESM_staticRegs::INFO
volatile uint32_t INFO
Definition: esm.h:229
SDL_ESM_getGlobalIntrEnabledStatus
int32_t SDL_ESM_getGlobalIntrEnabledStatus(uint32_t baseAddr, uint32_t *pStatus)
This API is used read the ESM information register.
SDL_ESM_staticRegs::PIN_CNTR_PRE
volatile uint32_t PIN_CNTR_PRE
Definition: esm.h:238
esmInfo_t::lastRstType
uint32_t lastRstType
Definition: esm.h:178
esmIntrType_t
uint32_t esmIntrType_t
Definition: esm.h:125
SDL_ESM_staticRegs::LOW
volatile uint32_t LOW
Definition: esm.h:235
SDL_ESM_PWMH_getErrPinHighTimePreload
int32_t SDL_ESM_PWMH_getErrPinHighTimePreload(uint32_t baseAddr, uint32_t *pPinPWMHCntrPre)
This API is used to read the High time counter pre-load value for PWM error.
SDL_ESM_getErrPinStatus
int32_t SDL_ESM_getErrPinStatus(uint32_t baseAddr, uint32_t *pStatus)
This API is used to get the current status of nERROR pin.
SDL_ESM_staticRegs::PIN_CTRL
volatile uint32_t PIN_CTRL
Definition: esm.h:237
SDL_ESM_getIntrPriorityLvl
int32_t SDL_ESM_getIntrPriorityLvl(uint32_t baseAddr, uint32_t intrSrc, esmIntrPriorityLvl_t *pIntrPriorityLvl)
This API is used to get interrupt level.
SDL_ESM_reset
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.
SDL_ESM_staticRegs::ERR_EN_SET
volatile uint32_t ERR_EN_SET
Definition: esm.h:231
SDL_ESM_isEnableIntr
int32_t SDL_ESM_isEnableIntr(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pEnStatus)
This API is used check if interrupt is enabled/disabled.
SDL_ESM_disableGlobalIntr
int32_t SDL_ESM_disableGlobalIntr(uint32_t baseAddr)
This API is used to disable Global control of interrupt.
esmRevisionId_t::scheme
uint32_t scheme
Definition: esm.h:159
SDL_ESM_setErrPinLowTimePreload
int32_t SDL_ESM_setErrPinLowTimePreload(uint32_t baseAddr, uint32_t lowTime)
This API is used to configure the low time counter pre-load value.
SDL_ESM_staticRegs::EN
volatile uint32_t EN
Definition: esm.h:230
esmInfo_t::plsGrpNum
uint32_t plsGrpNum
Definition: esm.h:183
SDL_esmRegs_ERR_GRP_STATIC::RAW
volatile uint32_t RAW
Definition: esm.h:215
esmErrOutMode_t
uint32_t esmErrOutMode_t
ESM Error Output Mode type.
Definition: esm.h:110
SDL_ESM_getCurrErrPinLowTimeCnt
int32_t SDL_ESM_getCurrErrPinLowTimeCnt(uint32_t baseAddr, uint32_t *pPinCntrPre)
This API is used to get the current value of low time counter.
SDL_esmRegs_ERR_GRP_STATIC::INT_PRIO
volatile uint32_t INT_PRIO
Definition: esm.h:218
esmIntrPriorityLvl_t
uint32_t esmIntrPriorityLvl_t
Definition: esm.h:141
SDL_ESM_writeEOI
int32_t SDL_ESM_writeEOI(uint32_t baseAddr, esmIntrType_t intrType)
This API is used to write EOI.
SDL_ESM_disableIntr
int32_t SDL_ESM_disableIntr(uint32_t baseAddr, uint32_t intrNum)
This API is used to disable interrupt.
SDL_ESM_getIntrStatusRAW
int32_t SDL_ESM_getIntrStatusRAW(uint32_t baseAddr, uint32_t intrSrc, uint32_t *pStatus)
This API is used to get the interrupt RAW status.
SDL_ESM_enableCfgIntr
int32_t SDL_ESM_enableCfgIntr(uint32_t baseAddr, uint32_t group)
This API is used to enable the configuration interrupt.
SDL_ESM_staticRegs::HI
volatile uint32_t HI
Definition: esm.h:236
SDL_ESM_isEnableCfgIntr
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.
esmGroupIntrStatus_t::highestPendPlsIntNum
uint32_t highestPendPlsIntNum
Definition: esm.h:195
SDL_ESM_enableIntr
int32_t SDL_ESM_enableIntr(uint32_t baseAddr, uint32_t intrNum)
This API is used to enable interrupt.
SDL_ESM_staticRegs::LOW_PRI
volatile uint32_t LOW_PRI
Definition: esm.h:233
SDL_ESM_PWMH_getCurrErrPinHighTimeCnt
int32_t SDL_ESM_PWMH_getCurrErrPinHighTimeCnt(uint32_t baseAddr, uint32_t *pHighPWMHTime)
This API is used to get the current value of high time counter for PWM error.
esmRevisionId_t::major
uint32_t major
Definition: esm.h:165
SDL_ESM_staticRegs::PID
volatile uint32_t PID
Definition: esm.h:228
SDL_ESM_setMode
int32_t SDL_ESM_setMode(uint32_t baseAddr, esmOperationMode_t mode)
This API is used to configure operation mode of ESM module.
SDL_ESM_clearIntrStatus
int32_t SDL_ESM_clearIntrStatus(uint32_t baseAddr, uint32_t intrSrc)
This API is used to clear the interrupt status.
SDL_ESM_staticRegs::HI_PRI
volatile uint32_t HI_PRI
Definition: esm.h:234
SDL_ESM_staticRegs::PWML_PIN_CNTR_PRE
volatile uint32_t PWML_PIN_CNTR_PRE
Definition: esm.h:240
SDL_ESM_resetErrPin
int32_t SDL_ESM_resetErrPin(uint32_t baseAddr)
This API is used to reset the nERROR pin.
SDL_ESM_staticRegs::ERR_EN_CLR
volatile uint32_t ERR_EN_CLR
Definition: esm.h:232
SDL_ESM_clearCfgIntrStatus
int32_t SDL_ESM_clearCfgIntrStatus(uint32_t baseAddr, uint32_t group)
This API is used to clear the configuration interrupt status.
esmInfo_t::lvlGrpNum
uint32_t lvlGrpNum
Definition: esm.h:185
SDL_ESM_getRevisionId
int32_t SDL_ESM_getRevisionId(uint32_t baseAddr, esmRevisionId_t *pRevId)
This API is used get the ESM revision ID.
esmGroupIntrStatus_t::grpIntrStatus
uint32_t grpIntrStatus
Definition: esm.h:203
SDL_esmRegs_ERR_GRP_STATIC::INTR_EN_SET
volatile uint32_t INTR_EN_SET
Definition: esm.h:216
SDL_ESM_PWML_getErrPinLowTimePreload
int32_t SDL_ESM_PWML_getErrPinLowTimePreload(uint32_t baseAddr, uint32_t *pPinPWMLCntrPre)
This API is used to read the low time counter pre-load value for PWM error.
SDL_esmRegs_ERR_GRP_STATIC
ESM Error Group static registers list.
Definition: esm.h:214