PDK API Guide for J721E
PMIC ESM Driver API

Introduction

This Module explains about PMIC ESM driver parameters and APIs usage. PMIC ESM Driver module covers all ESM feature APIs which includes Start/stop ESM, Enable/Disable ESM mode, set/get ESM configurations, enable/diable ESM interrupts and reading current ESM error count.

Supported PMIC devices for ESM Module:

  1. TPS6594x (Leo PMIC Device)
  2. LP8764x (Hera PMIC Device)

Files

file  pmic_esm.h
 PMIC Low Level Driver API/interface file for ESM API.
 

Data Structures

struct  Pmic_EsmCfg_t
 PMIC ESM Configuration structure Note: validParams is input param for all Set and Get APIs. other params except validParams is input param for Set APIs and output param for Get APIs. More...
 
struct  Pmic_EsmIntrCfg_t
 PMIC ESM Interrupt Configuration Structure. More...
 

Functions

int32_t Pmic_esmStart (Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, const bool esmState)
 API to start PMIC ESM. More...
 
int32_t Pmic_esmGetStatus (Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, bool *pEsmState)
 API to read status of PMIC ESM is started or not. More...
 
int32_t Pmic_esmEnable (Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, const bool esmToggle)
 API to Enable/Disable PMIC ESM. More...
 
int32_t Pmic_esmGetEnableState (Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, bool *pEsmState)
 API to Read PMIC ESM Enable/Disable state. More...
 
int32_t Pmic_esmSetConfiguration (Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, const Pmic_EsmCfg_t esmCfg)
 API to Set PMIC ESM Configuration. More...
 
int32_t Pmic_esmGetConfiguration (Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, Pmic_EsmCfg_t *pEsmCfg)
 API to Get the PMIC ESM Configuration. More...
 
int32_t Pmic_esmSetInterrupt (Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, const Pmic_EsmIntrCfg_t esmIntrCfg)
 API to Set PMIC ESM Interrupts. More...
 
int32_t Pmic_esmGetErrCnt (Pmic_CoreHandle_t *pPmicCoreHandle, const bool esmType, uint8_t *pEsmErrCnt)
 API to Get the current ESM Error Count. More...
 

PMIC ESM types

#define PMIC_ESM_MODE_MCU   (bool)false
 
#define PMIC_ESM_MODE_SOC   (bool)true
 

PMIC ESM Start/Stop state

#define PMIC_ESM_STOP   (bool)false
 
#define PMIC_ESM_START   (bool)true
 

PMIC ESM Enable/Disable

#define PMIC_ESM_DISABLE   (bool)false
 
#define PMIC_ESM_ENABLE   (bool)true
 

PMIC ESM Modes

#define PMIC_ESM_LEVEL_MODE   (bool)false
 
#define PMIC_ESM_PWM_MODE   (bool)true
 

PMIC ESM EN DRV Clear CFG

#define PMIC_ESM_ERR_EN_DRV_CLEAR_DISABLE   (bool)false
 
#define PMIC_ESM_ERR_EN_DRV_CLEAR_ENABLE   (bool)true
 

PMIC ESM Interrupt enable/disable

#define PMIC_ESM_INTERRUPT_DISABLE   (bool)false
 
#define PMIC_ESM_INTERRUPT_ENABLE   (bool)true
 

PMIC Pmic_EsmCfg_s member configuration type

#define PMIC_ESM_CFG_DELAY1_VALID   (0x00U)
 validParams value used to set/get ESM delay-1 time interval More...
 
#define PMIC_ESM_CFG_DELAY2_VALID   (0x01U)
 validParams value used to set/get ESM delay-2 time interval More...
 
#define PMIC_ESM_CFG_ERR_CNT_THR_VALID   (0x02U)
 validParams value used to set/get ESM Error count Threshold value More...
 
#define PMIC_ESM_CFG_HMAX_VALID   (0x03U)
 validParams value used to set/get ESM Maximum high-pulse time-threshold value More...
 
#define PMIC_ESM_CFG_HMIN_VALID   (0x04U)
 validParams value used to set/get ESM Minimum high-pulse time-threshold value More...
 
#define PMIC_ESM_CFG_LMAX_VALID   (0x05U)
 validParams value used to set/get ESM Maximum low-pulse time-threshold value More...
 
#define PMIC_ESM_CFG_LMIN_VALID   (0x06U)
 validParams value used to set/get ESM Minimum low-pulse time-threshold value More...
 
#define PMIC_ESM_CFG_EN_DRV_VALID   (0x07U)
 validParams value used to set/get ESM ENABLE_DRV clear configuration More...
 
#define PMIC_ESM_CFG_MODE_VALID   (0x08U)
 validParams value used to set/get ESM mode More...
 

PMIC ESM Configuration Structure Param Bit shift values

Application can use the below shifted values to set the validParams struct member defined in Pmic_EsmCfg_t structure.

#define PMIC_ESM_CFG_DELAY1_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_DELAY1_VALID)
 
#define PMIC_ESM_CFG_DELAY2_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_DELAY2_VALID)
 
#define PMIC_ESM_CFG_ERR_CNT_THR_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_ERR_CNT_THR_VALID)
 
#define PMIC_ESM_CFG_HMAX_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_HMAX_VALID)
 
#define PMIC_ESM_CFG_HMIN_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_HMIN_VALID)
 
#define PMIC_ESM_CFG_LMAX_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_LMAX_VALID)
 
#define PMIC_ESM_CFG_LMIN_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_LMIN_VALID)
 
#define PMIC_ESM_CFG_EN_DRV_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_EN_DRV_VALID)
 
#define PMIC_ESM_CFG_MODE_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_MODE_VALID)
 

Macro Definition Documentation

◆ PMIC_ESM_MODE_MCU

#define PMIC_ESM_MODE_MCU   (bool)false

◆ PMIC_ESM_MODE_SOC

#define PMIC_ESM_MODE_SOC   (bool)true

◆ PMIC_ESM_STOP

#define PMIC_ESM_STOP   (bool)false

◆ PMIC_ESM_START

#define PMIC_ESM_START   (bool)true

◆ PMIC_ESM_DISABLE

#define PMIC_ESM_DISABLE   (bool)false

◆ PMIC_ESM_ENABLE

#define PMIC_ESM_ENABLE   (bool)true

◆ PMIC_ESM_LEVEL_MODE

#define PMIC_ESM_LEVEL_MODE   (bool)false

◆ PMIC_ESM_PWM_MODE

#define PMIC_ESM_PWM_MODE   (bool)true

◆ PMIC_ESM_ERR_EN_DRV_CLEAR_DISABLE

#define PMIC_ESM_ERR_EN_DRV_CLEAR_DISABLE   (bool)false

◆ PMIC_ESM_ERR_EN_DRV_CLEAR_ENABLE

#define PMIC_ESM_ERR_EN_DRV_CLEAR_ENABLE   (bool)true

◆ PMIC_ESM_INTERRUPT_DISABLE

#define PMIC_ESM_INTERRUPT_DISABLE   (bool)false

◆ PMIC_ESM_INTERRUPT_ENABLE

#define PMIC_ESM_INTERRUPT_ENABLE   (bool)true

◆ PMIC_ESM_CFG_DELAY1_VALID

#define PMIC_ESM_CFG_DELAY1_VALID   (0x00U)

validParams value used to set/get ESM delay-1 time interval

◆ PMIC_ESM_CFG_DELAY2_VALID

#define PMIC_ESM_CFG_DELAY2_VALID   (0x01U)

validParams value used to set/get ESM delay-2 time interval

◆ PMIC_ESM_CFG_ERR_CNT_THR_VALID

#define PMIC_ESM_CFG_ERR_CNT_THR_VALID   (0x02U)

validParams value used to set/get ESM Error count Threshold value

◆ PMIC_ESM_CFG_HMAX_VALID

#define PMIC_ESM_CFG_HMAX_VALID   (0x03U)

validParams value used to set/get ESM Maximum high-pulse time-threshold value

◆ PMIC_ESM_CFG_HMIN_VALID

#define PMIC_ESM_CFG_HMIN_VALID   (0x04U)

validParams value used to set/get ESM Minimum high-pulse time-threshold value

◆ PMIC_ESM_CFG_LMAX_VALID

#define PMIC_ESM_CFG_LMAX_VALID   (0x05U)

validParams value used to set/get ESM Maximum low-pulse time-threshold value

◆ PMIC_ESM_CFG_LMIN_VALID

#define PMIC_ESM_CFG_LMIN_VALID   (0x06U)

validParams value used to set/get ESM Minimum low-pulse time-threshold value

◆ PMIC_ESM_CFG_EN_DRV_VALID

#define PMIC_ESM_CFG_EN_DRV_VALID   (0x07U)

validParams value used to set/get ESM ENABLE_DRV clear configuration

◆ PMIC_ESM_CFG_MODE_VALID

#define PMIC_ESM_CFG_MODE_VALID   (0x08U)

validParams value used to set/get ESM mode

◆ PMIC_ESM_CFG_DELAY1_VALID_SHIFT

#define PMIC_ESM_CFG_DELAY1_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_DELAY1_VALID)

◆ PMIC_ESM_CFG_DELAY2_VALID_SHIFT

#define PMIC_ESM_CFG_DELAY2_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_DELAY2_VALID)

◆ PMIC_ESM_CFG_ERR_CNT_THR_VALID_SHIFT

#define PMIC_ESM_CFG_ERR_CNT_THR_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_ERR_CNT_THR_VALID)

◆ PMIC_ESM_CFG_HMAX_VALID_SHIFT

#define PMIC_ESM_CFG_HMAX_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_HMAX_VALID)

◆ PMIC_ESM_CFG_HMIN_VALID_SHIFT

#define PMIC_ESM_CFG_HMIN_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_HMIN_VALID)

◆ PMIC_ESM_CFG_LMAX_VALID_SHIFT

#define PMIC_ESM_CFG_LMAX_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_LMAX_VALID)

◆ PMIC_ESM_CFG_LMIN_VALID_SHIFT

#define PMIC_ESM_CFG_LMIN_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_LMIN_VALID)

◆ PMIC_ESM_CFG_EN_DRV_VALID_SHIFT

#define PMIC_ESM_CFG_EN_DRV_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_EN_DRV_VALID)

◆ PMIC_ESM_CFG_MODE_VALID_SHIFT

#define PMIC_ESM_CFG_MODE_VALID_SHIFT   (0x01U << PMIC_ESM_CFG_MODE_VALID)

Function Documentation

◆ Pmic_esmStart()

int32_t Pmic_esmStart ( Pmic_CoreHandle_t pPmicCoreHandle,
const bool  esmType,
const bool  esmState 
)

API to start PMIC ESM.

Requirement: REQ_TAG(PDK-5833) Design: did_pmic_esm_cfg_readback Architecture: aid_pmic_esm_cfg

     This function is used to Start/Stop the PMIC ESM_MCU/ESM_SOC
     Note: Application has to ensure to do proper configuration of ESM
           time intervals of Level or PWM  mode.If not configured
           properly then ESM will trigger the warm reset to the PMIC
           device. This may cause system reset if PMIC is connected to
           SOC/MCU
Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
esmType[IN] PMIC ESM Type For valid values: Pmic_EsmTypes
esmState[IN] To start or stop PMIC ESM For valid values: Pmic_EsmStates
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code For valid values Pmic_ErrorCodes

◆ Pmic_esmGetStatus()

int32_t Pmic_esmGetStatus ( Pmic_CoreHandle_t pPmicCoreHandle,
const bool  esmType,
bool *  pEsmState 
)

API to read status of PMIC ESM is started or not.

Requirement: REQ_TAG(PDK-9150) Design: did_pmic_esm_cfg_readback Architecture: aid_pmic_esm_cfg

     This function is used to read status of PMIC ESM_MCU/ESM_SOC is
     started or not
Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
esmType[IN] PMIC ESM Type For valid values: Pmic_EsmTypes
pEsmState[IN] Pointer to store the status of PMIC ESM is started or not For valid values: Pmic_EsmStates
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code For valid values Pmic_ErrorCodes

◆ Pmic_esmEnable()

int32_t Pmic_esmEnable ( Pmic_CoreHandle_t pPmicCoreHandle,
const bool  esmType,
const bool  esmToggle 
)

API to Enable/Disable PMIC ESM.

Requirement: REQ_TAG(PDK-5833) Design: did_pmic_esm_cfg_readback Architecture: aid_pmic_esm_cfg

     This function is used to Enable/Disable the PMIC ESM_MCU/ESM_SOC
     This API must be called only when ESM is in STOP state.
Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
esmType[IN] PMIC ESM Type For valid values: Pmic_EsmTypes
esmToggle[IN] To Enable/Disable PMIC ESM_MCU/ESM_SOC For valid values: Pmic_EsmToggle
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code For valid values Pmic_ErrorCodes

◆ Pmic_esmGetEnableState()

int32_t Pmic_esmGetEnableState ( Pmic_CoreHandle_t pPmicCoreHandle,
const bool  esmType,
bool *  pEsmState 
)

API to Read PMIC ESM Enable/Disable state.

Requirement: REQ_TAG(PDK-5833) Design: did_pmic_esm_cfg_readback Architecture: aid_pmic_esm_cfg

     This function is used to read the Enable/Disable state of
     PMIC ESM_MCU/ESM_SOC.
Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
esmType[IN] PMIC ESM Type For valid values: Pmic_EsmTypes
pEsmState[OUT] Pointer to store ESM Enable State.
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code For valid values Pmic_ErrorCodes

◆ Pmic_esmSetConfiguration()

int32_t Pmic_esmSetConfiguration ( Pmic_CoreHandle_t pPmicCoreHandle,
const bool  esmType,
const Pmic_EsmCfg_t  esmCfg 
)

API to Set PMIC ESM Configuration.

Requirement: REQ_TAG(PDK-5833) Design: did_pmic_esm_cfg_readback Architecture: aid_pmic_esm_cfg

     This function is used to set the ESM mode, delay-1 and delay-2 time
     time intervals, Error Count Threshold value, HMAX, HMIN, LMAX,
     LMIN and select EN DRV clear for ESM_MCU and ESM_SOC.
Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
esmType[IN] PMIC ESM Type For valid values: Pmic_EsmTypes
esmCfg[IN] PMIC ESM Configuration
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code For valid values Pmic_ErrorCodes

◆ Pmic_esmGetConfiguration()

int32_t Pmic_esmGetConfiguration ( Pmic_CoreHandle_t pPmicCoreHandle,
const bool  esmType,
Pmic_EsmCfg_t pEsmCfg 
)

API to Get the PMIC ESM Configuration.

Requirement: REQ_TAG(PDK-5833) Design: did_pmic_esm_cfg_readback Architecture: aid_pmic_esm_cfg

     This function is used to get the configured ESM mode, delay-1 and
     delay-2 time time intervals, Error Count Threshold value, HMAX,
     HMIN, LMAX, LMIN and select EN DRV clear for ESM_MCU and ESM_SOC
     when corresponding validParam bit fields are set in Pmic_EsmCfg_t
     structure
Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
esmType[IN] PMIC ESM Type. For valid values: Pmic_EsmTypes.
pEsmCfg[IN/OUT] Pointer to store the specified ESM configuration.
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code For valid values: Pmic_ErrorCodes

◆ Pmic_esmSetInterrupt()

int32_t Pmic_esmSetInterrupt ( Pmic_CoreHandle_t pPmicCoreHandle,
const bool  esmType,
const Pmic_EsmIntrCfg_t  esmIntrCfg 
)

API to Set PMIC ESM Interrupts.

Requirement: REQ_TAG(PDK-5833) Design: did_pmic_esm_cfg_readback Architecture: aid_pmic_esm_cfg

     This function is used to mask/unmask the ESM RST, FAIL and
     PIN Interrupts for both ESM MCU and ESM SOC.
Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
esmType[IN] PMIC ESM Type For valid values: Pmic_EsmTypes
esmIntrCfg[IN] PMIC ESM interrupts mask/un-mask.
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code For valid values Pmic_ErrorCodes

◆ Pmic_esmGetErrCnt()

int32_t Pmic_esmGetErrCnt ( Pmic_CoreHandle_t pPmicCoreHandle,
const bool  esmType,
uint8_t *  pEsmErrCnt 
)

API to Get the current ESM Error Count.

Requirement: REQ_TAG(PDK-5833) Design: did_pmic_esm_cfg_readback Architecture: aid_pmic_esm_cfg

     This function is used to get the current Error count for ESM MCU
     ESM SOC.
Parameters
pPmicCoreHandle[IN] PMIC Interface Handle.
esmType[IN] PMIC ESM Type. For valid values: Pmic_EsmTypes.
pEsmErrCnt[OUT] Pointer to store the Error Count.
Return values
PMIC_ST_SUCCESSin case of success or appropriate error code. For valid values: Pmic_ErrorCodes