PDK API Guide for J721E
pmic_esm.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) 2020 Texas Instruments Incorporated - http://www.ti.com
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  *****************************************************************************/
54 #ifndef PMIC_ESM_H_
55 #define PMIC_ESM_H_
56 
57 /* ========================================================================== */
58 /* Include Files */
59 /* ========================================================================== */
60 #include <pmic_core.h>
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 /* ========================================================================== */
67 /* Macros & Typedefs */
68 /* ========================================================================== */
75 #define PMIC_ESM_MODE_MCU (bool)false
76 #define PMIC_ESM_MODE_SOC (bool)true
77 /* @} */
78 
85 #define PMIC_ESM_STOP (bool)false
86 #define PMIC_ESM_START (bool)true
87 /* @} */
88 
95 #define PMIC_ESM_DISABLE (bool)false
96 #define PMIC_ESM_ENABLE (bool)true
97 /* @} */
98 
105 #define PMIC_ESM_LEVEL_MODE (bool)false
106 #define PMIC_ESM_PWM_MODE (bool)true
107 /* @} */
108 
115 #define PMIC_ESM_ERR_EN_DRV_CLEAR_DISABLE (bool)false
116 #define PMIC_ESM_ERR_EN_DRV_CLEAR_ENABLE (bool)true
117 /* @} */
118 
125 #define PMIC_ESM_INTERRUPT_DISABLE (bool)false
126 #define PMIC_ESM_INTERRUPT_ENABLE (bool)true
127 /* @} */
128 
136 #define PMIC_ESM_CFG_DELAY1_VALID (0x00U)
137 
138 #define PMIC_ESM_CFG_DELAY2_VALID (0x01U)
139 
140 #define PMIC_ESM_CFG_ERR_CNT_THR_VALID (0x02U)
141 
143 #define PMIC_ESM_CFG_HMAX_VALID (0x03U)
144 
146 #define PMIC_ESM_CFG_HMIN_VALID (0x04U)
147 
149 #define PMIC_ESM_CFG_LMAX_VALID (0x05U)
150 
152 #define PMIC_ESM_CFG_LMIN_VALID (0x06U)
153 
155 #define PMIC_ESM_CFG_EN_DRV_VALID (0x07U)
156 
157 #define PMIC_ESM_CFG_MODE_VALID (0x08U)
158 /* @} */
159 
169 #define PMIC_ESM_CFG_DELAY1_VALID_SHIFT \
170  (0x01U << PMIC_ESM_CFG_DELAY1_VALID)
171 #define PMIC_ESM_CFG_DELAY2_VALID_SHIFT \
172  (0x01U << PMIC_ESM_CFG_DELAY2_VALID)
173 #define PMIC_ESM_CFG_ERR_CNT_THR_VALID_SHIFT \
174  (0x01U << PMIC_ESM_CFG_ERR_CNT_THR_VALID)
175 #define PMIC_ESM_CFG_HMAX_VALID_SHIFT \
176  (0x01U << PMIC_ESM_CFG_HMAX_VALID)
177 #define PMIC_ESM_CFG_HMIN_VALID_SHIFT \
178  (0x01U << PMIC_ESM_CFG_HMIN_VALID)
179 #define PMIC_ESM_CFG_LMAX_VALID_SHIFT \
180  (0x01U << PMIC_ESM_CFG_LMAX_VALID)
181 #define PMIC_ESM_CFG_LMIN_VALID_SHIFT \
182  (0x01U << PMIC_ESM_CFG_LMIN_VALID)
183 #define PMIC_ESM_CFG_EN_DRV_VALID_SHIFT \
184  (0x01U << PMIC_ESM_CFG_EN_DRV_VALID)
185 #define PMIC_ESM_CFG_MODE_VALID_SHIFT \
186  (0x01U << PMIC_ESM_CFG_MODE_VALID)
187 /* @} */
188 
189 /*==========================================================================*/
190 /* Structures and Enums */
191 /*==========================================================================*/
192 
261 typedef struct Pmic_EsmCfg_s
262 {
263  uint32_t validParams;
264  uint32_t esmDelay1_us;
265  uint32_t esmDelay2_us;
266  uint16_t esmHmax_us;
267  uint16_t esmHmin_us;
268  uint16_t esmLmax_us;
269  uint16_t esmLmin_us;
270  uint8_t esmErrCntThr;
271  bool esmEnDrv;
272  bool esmMode;
273 } Pmic_EsmCfg_t;
274 
285 typedef struct Pmic_EsmIntrCfg_s
286 {
291 
292 /*==========================================================================*/
293 /* Function Declarations */
294 /*==========================================================================*/
320 int32_t Pmic_esmStart(Pmic_CoreHandle_t *pPmicCoreHandle,
321  const bool esmType,
322  const bool esmState);
323 
346 int32_t Pmic_esmGetStatus(Pmic_CoreHandle_t *pPmicCoreHandle,
347  const bool esmType,
348  bool *pEsmState);
349 
371 int32_t Pmic_esmEnable(Pmic_CoreHandle_t *pPmicCoreHandle,
372  const bool esmType,
373  const bool esmToggle);
374 
394 int32_t Pmic_esmGetEnableState(Pmic_CoreHandle_t *pPmicCoreHandle,
395  const bool esmType,
396  bool *pEsmState);
397 
418 int32_t Pmic_esmSetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle,
419  const bool esmType,
420  const Pmic_EsmCfg_t esmCfg);
421 
445 int32_t Pmic_esmGetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle,
446  const bool esmType,
447  Pmic_EsmCfg_t *pEsmCfg);
448 
468 int32_t Pmic_esmSetInterrupt(Pmic_CoreHandle_t *pPmicCoreHandle,
469  const bool esmType,
470  const Pmic_EsmIntrCfg_t esmIntrCfg);
471 
491 int32_t Pmic_esmGetErrCnt(Pmic_CoreHandle_t *pPmicCoreHandle,
492  const bool esmType,
493  uint8_t *pEsmErrCnt);
494 
495 #ifdef __cplusplus
496 }
497 #endif /* __cplusplus */
498 
499 #endif /* PMIC_ESM_H_ */
500 
501 /* @} */
uint32_t validParams
Definition: pmic_esm.h:263
uint32_t esmDelay2_us
Definition: pmic_esm.h:265
int32_t Pmic_esmStart(Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, const bool esmState)
API to start PMIC ESM.
int32_t Pmic_esmGetErrCnt(Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, uint8_t *pEsmErrCnt)
API to Get the current ESM Error Count.
int32_t Pmic_esmGetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, Pmic_EsmCfg_t *pEsmCfg)
API to Get the PMIC ESM Configuration.
bool esmMode
Definition: pmic_esm.h:272
int32_t Pmic_esmSetInterrupt(Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, const Pmic_EsmIntrCfg_t esmIntrCfg)
API to Set PMIC ESM Interrupts.
uint16_t esmHmin_us
Definition: pmic_esm.h:267
uint16_t esmLmin_us
Definition: pmic_esm.h:269
PMIC ESM Interrupt Configuration Structure.
Definition: pmic_esm.h:285
bool esmPinIntr
Definition: pmic_esm.h:287
int32_t Pmic_esmEnable(Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, const bool esmToggle)
API to Enable/Disable PMIC ESM.
uint32_t esmDelay1_us
Definition: pmic_esm.h:264
PMIC Interface Handle. Contains various PMIC driver instance specific information....
Definition: pmic_types.h:148
PMIC ESM Configuration structure Note: validParams is input param for all Set and Get APIs....
Definition: pmic_esm.h:261
int32_t Pmic_esmGetEnableState(Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, bool *pEsmState)
API to Read PMIC ESM Enable/Disable state.
uint8_t esmErrCntThr
Definition: pmic_esm.h:270
PMIC Driver Common API/interface file.
uint16_t esmLmax_us
Definition: pmic_esm.h:268
bool esmRstIntr
Definition: pmic_esm.h:289
uint16_t esmHmax_us
Definition: pmic_esm.h:266
int32_t Pmic_esmGetStatus(Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, bool *pEsmState)
API to read status of PMIC ESM is started or not.
int32_t Pmic_esmSetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, const Pmic_EsmCfg_t esmCfg)
API to Set PMIC ESM Configuration.
bool esmFailIntr
Definition: pmic_esm.h:288
bool esmEnDrv
Definition: pmic_esm.h:271