PDK API Guide for J721E
pmic_fsm.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  *****************************************************************************/
33 
55 #ifndef PMIC_FSM_H_
56 #define PMIC_FSM_H_
57 
58 /* ========================================================================== */
59 /* Include Files */
60 /* ========================================================================== */
61 #include <pmic_core.h>
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
67 /* ========================================================================== */
68 /* Macros & Typedefs */
69 /* ========================================================================== */
70 
77 #define PMIC_FSM_I2C_TRIGGER0_TYPE (0U)
78 #define PMIC_FSM_ENABLE_PIN_TYPE (1U)
79 #define PMIC_FSM_NPWRON_PIN_TYPE (2U)
80 /* @} */
81 
88 #define PMIC_FSM_STANBY_STATE (0U)
89 #define PMIC_FSM_LP_STANBY_STATE (1U)
90 #define PMIC_FSM_ACTIVE_STATE (2U)
91 #define PMIC_FSM_MCU_ONLY_STATE (3U)
92 #define PMIC_FSM_S2R_STATE (4U)
93 /* @} */
94 
101 #define PMIC_NSLEEP1_SIGNAL (bool)false
102 #define PMIC_NSLEEP2_SIGNAL (bool)true
103 /* @} */
104 
111 #define PMIC_NSLEEPX_MASK 1U
112 #define PMIC_NSLEEPX_UNMASK 0U
113 /* @} */
114 
127 #define PMIC_FSM_FAST_BIST_ENABLE 1U
128 
129 #define PMIC_FSM_FAST_BIST_DISABLE 0U
130 /* @} */
131 
138 #define PMIC_NSLEEP1B_FSM_UNMASK (0U)
139 #define PMIC_NSLEEP1B_FSM_MASK (1U)
140 #define PMIC_NSLEEP2B_FSM_UNMASK (0U)
141 #define PMIC_NSLEEP2B_FSM_MASK (1U)
142 /* @} */
143 
152 #define PMIC_FSM_STARTUPDEST_STANDBY_LPSTANDBY (0U)
153 
154 #define PMIC_FSM_STARTUPDEST_MCUONLY (2U)
155 
156 #define PMIC_FSM_STARTUPDEST_ACTIVE (3U)
157 /* @} */
158 
165 #define PMIC_FSM_SELECT_LPSTANDBY_STATE 1U
166 #define PMIC_FSM_SELECT_STANDBY_STATE 0U
167 /* @} */
168 
176 #define PMIC_FSM_ILIM_INT_FSMCTRL_ENABLE 1U
177 #define PMIC_FSM_ILIM_INT_FSMCTRL_DISABLE 0U
178 /* @} */
179 
186 #define PMIC_PFSM_DELAY1 (0U)
187 #define PMIC_PFSM_DELAY2 (1U)
188 #define PMIC_PFSM_DELAY3 (2U)
189 #define PMIC_PFSM_DELAY4 (3U)
190 /* @} */
191 
203 #define PMIC_FSM_CFG_FAST_BIST_EN_VALID (0U)
204 
206 #define PMIC_FSM_CFG_LP_STANDBYSEL_VALID (1U)
207 
209 #define PMIC_FSM_CFG_ILIM_INT_FSMCTRL_EN_VALID (2U)
210 
212 #define PMIC_FSM_CFG_FSM_STARTUP_DEST_SEL_VALID (3U)
213 /* @} */
214 
224 #define PMIC_FSM_CFG_FAST_BIST_EN_VALID_SHIFT \
225  (1U << PMIC_FSM_CFG_FAST_BIST_EN_VALID)
226 #define PMIC_FSM_CFG_LP_STANDBYSEL_VALID_SHIFT \
227  (1U << PMIC_FSM_CFG_LP_STANDBYSEL_VALID)
228 #define PMIC_FSM_CFG_ILIM_INT_FSMCTRL_EN_VALID_SHIFT \
229  (1U << PMIC_FSM_CFG_ILIM_INT_FSMCTRL_EN_VALID)
230 #define PMIC_FSM_CFG_FSM_STARTUP_DEST_SEL_VALID_SHIFT \
231  (1U << PMIC_FSM_CFG_FSM_STARTUP_DEST_SEL_VALID)
232 /* @} */
233 
240 #define PMIC_NSLEEP_LOW (0U)
241 #define PMIC_NSLEEP_HIGH (1U)
242 /* @} */
243 
250 #define PMIC_FSM_I2C_TRIGGER0 (0x0U)
251 
252 #define PMIC_FSM_I2C_TRIGGER1 (0x1U)
253 
254 #define PMIC_FSM_I2C_TRIGGER2 (0x2U)
255 
257 #define PMIC_FSM_I2C_TRIGGER3 (0x3U)
258 #define PMIC_FSM_I2C_TRIGGER4 (0x4U)
259 #define PMIC_FSM_I2C_TRIGGER5 (0x5U)
260 #define PMIC_FSM_I2C_TRIGGER6 (0x6U)
261 #define PMIC_FSM_I2C_TRIGGER7 (0x7U)
262 /* @} */
263 
271 #define PMIC_FSM_I2C_TRIGGER_VAL_0 (0x0U)
272 #define PMIC_FSM_I2C_TRIGGER_VAL_1 (0x1U)
273 /* @} */
274 
281 #define PMIC_FSM_DDR_RETENTION_MODE (0x0U)
282 
283 #define PMIC_FSM_GPIO_RETENTION_MODE (0x1U)
284 /* @} */
285 
286 /*==========================================================================*/
287 /* Structures and Enums */
288 /*==========================================================================*/
289 
321 typedef struct Pmic_FsmCfg_s
322 {
323  uint8_t validParams;
328 } Pmic_FsmCfg_t;
329 
330 /*==========================================================================*/
331 /* Function Declarations */
332 /*==========================================================================*/
355 int32_t Pmic_fsmDeviceOffRequestCfg(Pmic_CoreHandle_t *pPmicCoreHandle,
356  uint8_t eventType,
357  uint8_t fsmState);
358 
377 int32_t Pmic_fsmDeviceOnRequest(Pmic_CoreHandle_t *pPmicCoreHandle);
378 
409 int32_t Pmic_fsmSetMissionState(Pmic_CoreHandle_t *pPmicCoreHandle,
410  const uint8_t pmicState);
411 
430 int32_t Pmic_fsmSetNsleepSignalMask(Pmic_CoreHandle_t *pPmicCoreHandle,
431  const bool nsleepType,
432  const bool maskEnable);
433 
453 int32_t Pmic_fsmGetNsleepSignalMaskStat(Pmic_CoreHandle_t *pPmicCoreHandle,
454  const bool nsleepType,
455  bool *pNsleepStat);
456 
473 int32_t Pmic_fsmRequestRuntimeBist(Pmic_CoreHandle_t *pPmicCoreHandle);
474 
491 int32_t Pmic_fsmSetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle,
492  const Pmic_FsmCfg_t fsmCfg);
493 
511 int32_t Pmic_fsmGetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle,
512  Pmic_FsmCfg_t *pFsmCfg);
513 
539 int32_t Pmic_fsmSetPfsmDelay(Pmic_CoreHandle_t *pPmicCoreHandle,
540  const uint8_t pFsmDelayType,
541  const uint8_t pfsmDelay);
542 
564 int32_t Pmic_fsmGetPfsmDelay(Pmic_CoreHandle_t *pPmicCoreHandle,
565  uint8_t pFsmDelayType,
566  uint8_t *pPfsmDelay);
567 
587 int32_t Pmic_fsmSetNsleepSignalVal(Pmic_CoreHandle_t *pPmicCoreHandle,
588  const bool nsleepType,
589  const uint8_t nsleepVal);
590 
611 int32_t Pmic_fsmGetNsleepSignalVal(Pmic_CoreHandle_t *pPmicCoreHandle,
612  const bool nsleepType,
613  uint8_t *pNsleepVal);
614 
642 int32_t Pmic_fsmRecoverSocPwrErr(Pmic_CoreHandle_t *pPmicCoreHandle,
643  const uint8_t nsleepVal);
644 
668 int32_t Pmic_fsmEnableI2cTrigger(Pmic_CoreHandle_t *pPmicCoreHandle,
669  const uint8_t i2cTriggerType,
670  const uint8_t i2cTriggerVal);
671 
691 int32_t Pmic_fsmGetI2cTriggerVal(Pmic_CoreHandle_t *pPmicCoreHandle,
692  const uint8_t i2cTriggerType,
693  uint8_t *pI2cTriggerVal);
694 
735  Pmic_CoreHandle_t *pPmicCoreHandle,
736  const uint8_t retentionMode,
737  const uint8_t i2cTriggerVal);
738 
739 #ifdef __cplusplus
740 }
741 #endif /* __cplusplus */
742 
743 #endif /* PMIC_FSM_H_ */
744 
745 /* @} */
int32_t Pmic_fsmEnableI2cTrigger(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t i2cTriggerType, const uint8_t i2cTriggerVal)
API to initiate FSM I2C trigger for given FSM I2C trigger type.
int32_t Pmic_fsmSetMissionState(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t pmicState)
API to Set FSM mission States.
uint8_t validParams
Definition: pmic_fsm.h:323
int32_t Pmic_fsmRequestDdrGpioRetentionMode(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t retentionMode, const uint8_t i2cTriggerVal)
API to initiate DDR/GPIO Retention Mode.
bool lpStandbySel
Definition: pmic_fsm.h:325
int32_t Pmic_fsmGetPfsmDelay(Pmic_CoreHandle_t *pPmicCoreHandle, uint8_t pFsmDelayType, uint8_t *pPfsmDelay)
API to read PFSM Delay.
int32_t Pmic_fsmGetNsleepSignalMaskStat(Pmic_CoreHandle_t *pPmicCoreHandle, const bool nsleepType, bool *pNsleepStat)
API to read the status of the NSLEEP1B/2B Signal is masked or not.
int32_t Pmic_fsmSetPfsmDelay(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t pFsmDelayType, const uint8_t pfsmDelay)
API to configure PFSM Delay.
PMIC Interface Handle. Contains various PMIC driver instance specific information....
Definition: pmic_types.h:148
PMIC FSM configuration structure. Note: validParams is input param for all Set and Get APIs....
Definition: pmic_fsm.h:321
bool ilimIntfsmCtrlEn
Definition: pmic_fsm.h:326
PMIC Driver Common API/interface file.
uint8_t fsmStarupDestSel
Definition: pmic_fsm.h:327
int32_t Pmic_fsmSetNsleepSignalMask(Pmic_CoreHandle_t *pPmicCoreHandle, const bool nsleepType, const bool maskEnable)
API to MASK/UNMASK NSLEEP1B or 2B Signal.
int32_t Pmic_fsmGetNsleepSignalVal(Pmic_CoreHandle_t *pPmicCoreHandle, const bool nsleepType, uint8_t *pNsleepVal)
API to get PMIC Nsleep1B/2B Signal value.
int32_t Pmic_fsmSetNsleepSignalVal(Pmic_CoreHandle_t *pPmicCoreHandle, const bool nsleepType, const uint8_t nsleepVal)
API to set PMIC Nsleep1B/2B Signal value.
int32_t Pmic_fsmGetI2cTriggerVal(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t i2cTriggerType, uint8_t *pI2cTriggerVal)
API to get FSM I2C trigger Value for given FSM I2C trigger type.
bool fastBistEn
Definition: pmic_fsm.h:324
int32_t Pmic_fsmDeviceOnRequest(Pmic_CoreHandle_t *pPmicCoreHandle)
API to initiate ON Request FSM transition.
int32_t Pmic_fsmDeviceOffRequestCfg(Pmic_CoreHandle_t *pPmicCoreHandle, uint8_t eventType, uint8_t fsmState)
API to initiate OFF Request FSM transition.
int32_t Pmic_fsmRecoverSocPwrErr(Pmic_CoreHandle_t *pPmicCoreHandle, const uint8_t nsleepVal)
API to recover from SOC Power Error using Nsleep1B and Nsleep2B signal.
int32_t Pmic_fsmGetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle, Pmic_FsmCfg_t *pFsmCfg)
API to get PMIC FSM configuration.
int32_t Pmic_fsmSetConfiguration(Pmic_CoreHandle_t *pPmicCoreHandle, const Pmic_FsmCfg_t fsmCfg)
API to set PMIC FSM configuration.
int32_t Pmic_fsmRequestRuntimeBist(Pmic_CoreHandle_t *pPmicCoreHandle)
API to initiate Runtime BIST.