AM64x MCU+ SDK  09.02.01
drivers/esm/v1/esm.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 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  */
32 
49 #ifndef ESM_H_
50 #define ESM_H_
51 
52 /* ========================================================================== */
53 /* Include Files */
54 /* ========================================================================== */
55 #include <stdint.h>
56 #include <kernel/dpl/HwiP.h>
57 #include <drivers/hw_include/cslr_soc.h>
58 #include <drivers/hw_include/cslr_esm.h>
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 /* ========================================================================== */
65 /* Macros & Typedefs */
66 /* ========================================================================== */
67 
69 typedef void *ESM_Handle;
70 
72 #define ESM_MAX_NOTIFIERS (4U)
73 
74 #define ESM_MAX_ISR_COUNT (4U)
75 
79 #define ESM_OPERATION_MODE_NORMAL 0x0U
80 
81 #define ESM_OPERATION_MODE_ERROR_FORCE 0xAU
82 
87 #define ESM_INTRE_CONFIG_ERROR (0x0u)
88 
89 #define ESM_INTR_PRIORITY_LEVEL_LOW (0x1u)
90 
91 #define ESM_INTR_PRIORITY_LEVEL_HIGH (0x2u)
92 
94 /* ========================================================================== */
95 /* Structures and Enums */
96 /* ========================================================================== */
97 
107 typedef void (*ESM_CallBack)(void* arg);
108 
114 typedef struct
115 {
116  uint32_t errorNumber;
122  void *arg;
127 
138 typedef struct
139 {
147 
155 typedef struct
156 {
159  uint32_t esmBaseAddr;
163  void *hwiHandleHi;
167  void *hwiHandleLo;
173 } ESM_Object;
174 
179 typedef struct
180 {
189  uint32_t grpIntrStatus;
196 
206 typedef struct {
207  CSL_esmRegs *ptrESMRegs;
209  uint32_t highPrioIntNum;
211  uint32_t lowPrioIntNum;
217 } ESM_Attrs;
218 
225 typedef struct {
230 } ESM_Config;
231 
233 extern ESM_Config gEsmConfig[];
235 extern uint32_t gEsmConfigNum;
236 
237 
238 /* ========================================================================== */
239 /* Global Variables */
240 /* ========================================================================== */
241 /* None */
242 
243 /* ========================================================================== */
244 /* Function Declarations */
245 /* ========================================================================== */
246 
251 void ESM_init (void);
252 
257 void ESM_deinit (void);
258 
273 
283 void ESM_close (ESM_Handle handle);
284 
297 
309 int32_t ESM_deregisterNotifier (ESM_Handle handle, int32_t notifyIndex);
310 
321 int32_t ESM_setMode (uint32_t baseAddr, uint32_t mode);
322 
332 int32_t ESM_setErrPinLowTimePreload(uint32_t baseAddr, uint32_t lowTime);
333 
341 uint32_t ESM_getCurrErrPinLowTimeCnt (uint32_t baseAddr);
342 
350 uint32_t ESM_getErrPinStatus (uint32_t baseAddr);
351 
357 void ESM_resetErrPin(uint32_t baseAddr);
358 
368 uint32_t ESM_getIntrStatus (uint32_t baseAddr, uint32_t intrSrc);
369 
383 int32_t ESM_getGroupIntrStatus(uint32_t baseAddr, uint32_t intrPrioType,
384  ESM_GroupIntrStatus *pIntrstatus);
385 
386 /* ========================================================================== */
387 /* Static Function Definitions */
388 /* ========================================================================== */
389 static inline void ESM_Params_init(ESM_OpenParams *openPrms)
390 {
391  if (openPrms != NULL)
392  {
393  openPrms->bClearErrors = FALSE;
394  }
395 }
396 
397 #ifdef __cplusplus
398 }
399 
400 #endif
401 
402 #endif /* #ifndef ESM_H_ */
403 
ESM_NotifyParams::arg
void * arg
Definition: drivers/esm/v1/esm.h:122
ESM_getIntrStatus
uint32_t ESM_getIntrStatus(uint32_t baseAddr, uint32_t intrSrc)
This API is used to get the interrupt status.
ESM_Attrs::highPrioIntNum
uint32_t highPrioIntNum
Definition: drivers/esm/v1/esm.h:209
gEsmConfigNum
uint32_t gEsmConfigNum
Externally defined driver configuration array size.
ESM_Object::esmBaseAddr
uint32_t esmBaseAddr
Definition: drivers/esm/v1/esm.h:159
ESM_NotifyParams::errorNumber
uint32_t errorNumber
Definition: drivers/esm/v1/esm.h:116
ESM_Object::esmHandle
ESM_Handle esmHandle
Definition: drivers/esm/v1/esm.h:157
index
uint16_t index
Definition: tisci_rm_proxy.h:3
ESM_getGroupIntrStatus
int32_t ESM_getGroupIntrStatus(uint32_t baseAddr, uint32_t intrPrioType, ESM_GroupIntrStatus *pIntrstatus)
This API is used to get the interrupt/error status for a group. This will also return highest pending...
ESM_CallBack
void(* ESM_CallBack)(void *arg)
Callback function which is invoked by the ESM module if a notify function is registered using the ESM...
Definition: drivers/esm/v1/esm.h:107
ESM_OpenParams
ESM Open Parameters.
Definition: drivers/esm/v1/esm.h:139
ESM_NotifyParams::setIntrPriorityLvl
uint32_t setIntrPriorityLvl
Definition: drivers/esm/v1/esm.h:118
ESM_registerNotifier
int32_t ESM_registerNotifier(ESM_Handle handle, ESM_NotifyParams *params)
Register the notifers. The ESM module will call back if error interrupt is detected.
ESM_GroupIntrStatus::grpIntrStatus
uint32_t grpIntrStatus
Definition: drivers/esm/v1/esm.h:189
ESM_close
void ESM_close(ESM_Handle handle)
The function closes a ESM peripheral specified by the ESM handle.
ESM_deinit
void ESM_deinit(void)
The functions de-initializes the ESM module.
ESM_NotifyParams::notify
ESM_CallBack notify
Definition: drivers/esm/v1/esm.h:124
ESM_Object::params
ESM_OpenParams params
Definition: drivers/esm/v1/esm.h:161
ESM_GroupIntrStatus::highestPendPlsIntNum
uint32_t highestPendPlsIntNum
Definition: drivers/esm/v1/esm.h:181
ESM_Config
ESM Instance configuration.
Definition: drivers/esm/v1/esm.h:225
ESM_setErrPinLowTimePreload
int32_t ESM_setErrPinLowTimePreload(uint32_t baseAddr, uint32_t lowTime)
This API is used to configure the low time counter pre-load value.
gEsmConfig
ESM_Config gEsmConfig[]
Externally defined driver configuration array.
ESM_deregisterNotifier
int32_t ESM_deregisterNotifier(ESM_Handle handle, int32_t notifyIndex)
Deregister the ESM notifers.
ESM_Attrs::intrLowPriority
uint8_t intrLowPriority
Definition: drivers/esm/v1/esm.h:215
ESM_Attrs::lowPrioIntNum
uint32_t lowPrioIntNum
Definition: drivers/esm/v1/esm.h:211
ESM_resetErrPin
void ESM_resetErrPin(uint32_t baseAddr)
This API is used to reset the nERROR pin.
HwiP.h
ESM_Object
ESM Driver Object.
Definition: drivers/esm/v1/esm.h:156
ESM_getErrPinStatus
uint32_t ESM_getErrPinStatus(uint32_t baseAddr)
This API is used to get the current status of nERROR pin.
ESM_getCurrErrPinLowTimeCnt
uint32_t ESM_getCurrErrPinLowTimeCnt(uint32_t baseAddr)
This API is used to read the low time counter pre-load value.
ESM_setMode
int32_t ESM_setMode(uint32_t baseAddr, uint32_t mode)
This API is used to configure operation mode of ESM module.
ESM_MAX_NOTIFIERS
#define ESM_MAX_NOTIFIERS
Maximum number of notify callbacks supported.
Definition: drivers/esm/v1/esm.h:72
ESM_NotifyParams::enableInfluenceOnErrPin
Bool enableInfluenceOnErrPin
Definition: drivers/esm/v1/esm.h:120
ESM_Object::hwiHandleLo
void * hwiHandleLo
Definition: drivers/esm/v1/esm.h:167
ESM_Attrs
ESM Hardware Atrributes.
Definition: drivers/esm/v1/esm.h:206
mode
char mode[32]
Definition: tisci_pm_core.h:1
ESM_Config::object
ESM_Object * object
Definition: drivers/esm/v1/esm.h:228
HwiP_Object
Opaque Hwi object used with the Hwi APIs.
Definition: HwiP.h:93
ESM_NotifyParams
Parameters used to register the ESM notify function to handle errors. The function will the invoked f...
Definition: drivers/esm/v1/esm.h:115
ESM_init
void ESM_init(void)
The functions initializes the ESM module.
ESM_Attrs::ptrESMRegs
CSL_esmRegs * ptrESMRegs
Definition: drivers/esm/v1/esm.h:207
ESM_GroupIntrStatus
Structure to access the status of interrupts belonging to a High or Low priority interrupt.
Definition: drivers/esm/v1/esm.h:180
ESM_Attrs::intrHighPriority
uint8_t intrHighPriority
Definition: drivers/esm/v1/esm.h:213
ESM_Object::hwiHandleHi
void * hwiHandleHi
Definition: drivers/esm/v1/esm.h:163
ESM_OpenParams::bClearErrors
Bool bClearErrors
Definition: drivers/esm/v1/esm.h:140
ESM_Config::hwAttrs
const ESM_Attrs * hwAttrs
Definition: drivers/esm/v1/esm.h:226
ESM_Params_init
static void ESM_Params_init(ESM_OpenParams *openPrms)
Definition: drivers/esm/v1/esm.h:389
ESM_Object::hwiHiObj
HwiP_Object hwiHiObj
Definition: drivers/esm/v1/esm.h:165
ESM_Object::hwiLoObj
HwiP_Object hwiLoObj
Definition: drivers/esm/v1/esm.h:169
ESM_open
ESM_Handle ESM_open(uint32_t index, ESM_OpenParams *params)
Opens a ESM object with the index and parameters specified, and returns a ESM_Handle.
ESM_GroupIntrStatus::highestPendLvlIntNum
uint32_t highestPendLvlIntNum
Definition: drivers/esm/v1/esm.h:185
ESM_Handle
void * ESM_Handle
A handle that is returned from a ESM_open() call.
Definition: drivers/esm/v1/esm.h:69