MCUXpresso SDK API Reference Manual  Rev 2.16.000
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Power Driver

Overview

Power driver provides APIs to control system power and power mode.

Files

file  fsl_power.h
 

Data Structures

struct  power_init_config_t
 Init configuration. More...
 
struct  power_sleep_config_t
 Sleep configuration. More...
 
struct  power_gdet_data_t
 Glitch detector configuration. More...
 

Typedefs

typedef void(* capt_pulse_timer_callback_t )(void *param)
 Capture timer callback function. More...
 
typedef void(* power_switch_callback_t )(uint32_t mode, void *param)
 Power mode switch callback function. More...
 
typedef bool(* power_load_gdet_cfg )(power_gdet_data_t *data)
 Glitch detector configuration load function.
 

Enumerations

enum  power_wakeup_edge_t {
  kPOWER_WakeupEdgeLow = 0U,
  kPOWER_WakeupEdgeHigh = 1U
}
 Pin edge for wakeup. More...
 
enum  power_wakeup_pin_t {
  kPOWER_WakeupPin0 = 0U,
  kPOWER_WakeupPin1 = 1U
}
 Wakeup pin. More...
 
enum  power_reset_cause_t {
  kPOWER_ResetCauseSysResetReq = 1U << 0U,
  kPOWER_ResetCauseLockup = 1U << 1U,
  kPOWER_ResetCauseWdt = 1U << 2U,
  kPOWER_ResetCauseApResetReq = 1U << 3U,
  kPOWER_ResetCauseCodeWdt = 1U << 4U,
  kPOWER_ResetCauseItrc = 1U << 5U,
  kPOWER_ResetCauseResetB = 1U << 6U,
  kPOWER_ResetCauseAll = 0x7FU
}
 Reset cause. More...
 
enum  power_reset_source_t {
  kPOWER_ResetSourceSysResetReq = 1U << 0U,
  kPOWER_ResetSourceLockup = 1U << 1U,
  kPOWER_ResetSourceWdt = 1U << 2U,
  kPOWER_ResetSourceApResetReq = 1U << 3U,
  kPOWER_ResetSourceCodeWdt = 1U << 4U,
  kPOWER_ResetSourceItrc = 1U << 5U,
  kPOWER_ResetSourceAll = 0x3FU
}
 Reset source. More...
 
enum  _pm2_mem_pu_bits
 PM2 mem power up bits definition.
 
enum  _pm2_ana_pu_bits
 PM2 ana power up bits definition.
 
enum  _clk_gate_bits
 clock gate bits definition
 
enum  _clk_pm3_buck_bits {
  kPOWER_Pm3Buck18 = (1UL << 7),
  kPOWER_Pm3Buck11 = (1UL << 6)
}
 PM3 buck control bits definition. More...
 
enum  capt_slow_pulse_width_t
 Capture slow pulse width.
 
enum  capt_slow_pulse_edge_t
 Capture slow pulse edge.
 

Functions

__STATIC_INLINE void POWER_EnableResetSource (uint32_t source)
 Enable system reset source. More...
 
__STATIC_INLINE void POWER_DisableResetSource (uint32_t source)
 Disable system reset source. More...
 
__STATIC_INLINE uint32_t POWER_GetResetCause (void)
 Get last reset cause. More...
 
__STATIC_INLINE void POWER_ClearResetCause (uint32_t cause)
 Clear last reset cause. More...
 
__STATIC_INLINE void POWER_ConfigWakeupPin (power_wakeup_pin_t pin, power_wakeup_edge_t edge)
 Configure pin edge for wakeup. More...
 
bool POWER_GetWakeupStatus (IRQn_Type irq)
 Check if IRQ is the wakeup source. More...
 
void POWER_ClearWakeupStatus (IRQn_Type irq)
 Clear wakeup status. More...
 
void POWER_EnableWakeup (IRQn_Type irq)
 Enable the Wakeup interrupt. More...
 
void POWER_DisableWakeup (IRQn_Type irq)
 Disable the Wakeup interrupts. More...
 
 AT_QUICKACCESS_SECTION_CODE (void POWER_SetSleepMode(uint32_t mode))
 Set power mode on idle. More...
 
__STATIC_INLINE uint32_t POWER_GetWakenMode (void)
 Get power mode waken up from. More...
 
void POWER_GetCurrentSleepConfig (power_sleep_config_t *config)
 Get current sleep configuration. More...
 
void POWER_InitPowerConfig (const power_init_config_t *config)
 Initialize power configuration. More...
 
void POWER_ConfigCauInSleep (bool pdCau)
 Configure CAU_SOC_SLP_REF_GEN_CLK on/off status in SoC sleep mode. More...
 
void POWER_SetPowerSwitchCallback (power_switch_callback_t pre, void *preParam, power_switch_callback_t post, void *postParam)
 Set power mode switch callback. The callbacks are called with interrupt disabled. More...
 
 AT_QUICKACCESS_SECTION_CODE (bool POWER_EnterPowerMode(uint32_t mode, const power_sleep_config_t *config))
 Switch system into certain power mode. More...
 
void POWER_PowerOnWlan (void)
 Power on WLAN.
 
void POWER_PowerOffWlan (void)
 Power off WLAN.
 
__STATIC_INLINE void PMU_EnableWlanWakeup (uint8_t wlWakeup)
 Enable MCI wakeup WLAN. More...
 
__STATIC_INLINE void PMU_DisableWlanWakeup (uint8_t wlWakeup)
 Disable MCI wakeup WLAN. More...
 
void POWER_PowerOnBle (void)
 Power on BLE.
 
void POWER_PowerOffBle (void)
 Power off BLE.
 
__STATIC_INLINE void PMU_EnableBleWakeup (uint8_t bleWakeup)
 Enable MCI wakeup BLE. More...
 
__STATIC_INLINE void PMU_DisableBleWakeup (uint8_t bleWakeup)
 Disable MCI wakeup BLE. More...
 
void POWER_PowerOnGau (void)
 Power on GAU.
 
void POWER_PowerOffGau (void)
 Power off GAU.
 
void POWER_EnableCaptSlowPulseTimer (capt_slow_pulse_width_t width, capt_slow_pulse_edge_t edge, uint32_t timeout, capt_pulse_timer_callback_t cb, void *param)
 Enable capture slow pulse timer with 32768Hz clock source. More...
 
void POWER_EnableCaptFastPulseTimer (uint32_t timeout, capt_pulse_timer_callback_t cb, void *param)
 Enable capture fast pulse timer with 3.84/4MHz clock source. More...
 
void POWER_DisableCaptPulseTimer (void)
 Disable capture pulse timer.
 
void POWER_InitVoltage (uint32_t dro, uint32_t pack)
 Configure power rail voltage and LVD/HVD threshold. More...
 
void Power_InitLoadGdetCfg (power_load_gdet_cfg loadFunc, const power_gdet_data_t *data, uint32_t pack)
 Initialize glitch detector configuration. More...
 
 AT_QUICKACCESS_SECTION_CODE (void POWER_DisableGDetVSensors(void))
 Disable GDET and VSensors.
 
 AT_QUICKACCESS_SECTION_CODE (bool POWER_EnableGDetVSensors(void))
 Enable GDET and VSensors. More...
 
uint32_t POWER_TrimSvc (uint32_t gdetTrim, uint32_t pack)
 Apply SVC GDC equation and get the SVC trim configuration. More...
 

Driver version

#define FSL_POWER_DRIVER_VERSION   (MAKE_VERSION(2, 5, 0))
 POWER driver version 2.5.0. More...
 

Data Structure Documentation

struct power_init_config_t

Data Fields

bool iBuck
 true: VCORE and AVDD18 supplied from iBuck; false: supplied from external DCDC. More...
 
bool gateCauRefClk
 true: CAU_SOC_SLP_REF_GEN_CLK gated; false: CAU_SOC_SLP_REF_GEN_CLK on. More...
 

Field Documentation

bool power_init_config_t::iBuck
bool power_init_config_t::gateCauRefClk
struct power_sleep_config_t

Data Fields

uint32_t pm2MemPuCfg
 Modules to keep powered on in PM2 mode. More...
 
uint32_t pm2AnaPuCfg
 Ana to keep powered on in PM2 mode. More...
 
uint32_t clkGate
 Source clock gate control. More...
 
uint32_t memPdCfg
 PMU MEM_CFG: Power Down memory configuration. More...
 
uint32_t pm3BuckCfg
 PMIP BUCK control in PM3 mode. More...
 

Field Documentation

uint32_t power_sleep_config_t::pm2MemPuCfg

Logical OR of the enums in _pm2_mem_pu_bits.

uint32_t power_sleep_config_t::pm2AnaPuCfg

Logical OR of the enums in _pm2_ana_pu_bits.

uint32_t power_sleep_config_t::clkGate

Logical OR of the enums in _clk_gate_bits.

uint32_t power_sleep_config_t::memPdCfg

Bit0-5 for PM3, bit8 for PM4. bit0: ram0-5 384KB bit1: ram6 64KB bit2: ram7 64KB bit3: ram8-9 128KB bit4: ram10-13 256KB bit5: ram14-18 320KB. bit8: aon mem higher 8KB

uint32_t power_sleep_config_t::pm3BuckCfg

Logical OR of the enums in _clk_pm3_buck_bits.

struct power_gdet_data_t

Macro Definition Documentation

#define FSL_POWER_DRIVER_VERSION   (MAKE_VERSION(2, 5, 0))

Typedef Documentation

typedef void(* capt_pulse_timer_callback_t)(void *param)
Parameters
param: User parameter for callback.
typedef void(* power_switch_callback_t)(uint32_t mode, void *param)
Parameters
mode: Power mode to switch.
param: User parameter for callback.

Enumeration Type Documentation

Enumerator
kPOWER_WakeupEdgeLow 

Wakeup on pin low level.

kPOWER_WakeupEdgeHigh 

Wakeup on pin high level.

Enumerator
kPOWER_WakeupPin0 

Wakeup0 pin.

kPOWER_WakeupPin1 

Wakeup1 pin.

Enumerator
kPOWER_ResetCauseSysResetReq 

CM33 system soft reset request.

kPOWER_ResetCauseLockup 

CM33 locked up.

kPOWER_ResetCauseWdt 

Watchdog timer.

kPOWER_ResetCauseApResetReq 

Debug mailbox reset.

kPOWER_ResetCauseCodeWdt 

Code watchdog timer.

kPOWER_ResetCauseItrc 

ITRC_CHIP reset.

kPOWER_ResetCauseResetB 

sw_resetb_scantest reset.

kPOWER_ResetCauseAll 

All reset causes.

Used in POWER_ClearResetCause().

Enumerator
kPOWER_ResetSourceSysResetReq 

CM33 system soft reset request.

kPOWER_ResetSourceLockup 

CM33 locked up.

kPOWER_ResetSourceWdt 

Watchdog timer.

kPOWER_ResetSourceApResetReq 

Debug mailbox reset.

kPOWER_ResetSourceCodeWdt 

Code watchdog timer.

kPOWER_ResetSourceItrc 

ITRC_CHIP reset.

kPOWER_ResetSourceAll 

All reset sources.

Enumerator
kPOWER_Pm3Buck18 

1: Use normal buck18 level in PM3.

0: Use sleep buck18 level in PM3

kPOWER_Pm3Buck11 

1: Use normal buck11 level in PM3.

0: Use sleep buck11 level in PM3

Function Documentation

__STATIC_INLINE void POWER_EnableResetSource ( uint32_t  source)
Parameters
source: A bitmask of of power_reset_source_t
__STATIC_INLINE void POWER_DisableResetSource ( uint32_t  source)
Parameters
source: A bitmask of of power_reset_source_t
__STATIC_INLINE uint32_t POWER_GetResetCause ( void  )
Returns
Or'ed cause of power_reset_cause_t
__STATIC_INLINE void POWER_ClearResetCause ( uint32_t  cause)
Parameters
cause: A bitmask of of power_reset_cause_t
__STATIC_INLINE void POWER_ConfigWakeupPin ( power_wakeup_pin_t  pin,
power_wakeup_edge_t  edge 
)
Parameters
pin: Wakeup pin
edge: Pin level for wakeup
bool POWER_GetWakeupStatus ( IRQn_Type  irq)
Parameters
irq: IRQ number
Returns
true if IRQ is the wakeup source, false otherwise.
void POWER_ClearWakeupStatus ( IRQn_Type  irq)
Parameters
irq: IRQ number
void POWER_EnableWakeup ( IRQn_Type  irq)
Parameters
irq: IRQ number
void POWER_DisableWakeup ( IRQn_Type  irq)
Parameters
irq: IRQ number
AT_QUICKACCESS_SECTION_CODE ( void   POWER_SetSleepModeuint32_t mode)
Parameters
mode: 0 ~ 4 stands for PM0 ~ PM4.
__STATIC_INLINE uint32_t POWER_GetWakenMode ( void  )
Returns
Power mode.
void POWER_GetCurrentSleepConfig ( power_sleep_config_t config)
Parameters
config: Pointer to config structure to save current config.
void POWER_InitPowerConfig ( const power_init_config_t config)
Parameters
config: Pointer to init config structure.
void POWER_ConfigCauInSleep ( bool  pdCau)
Parameters
pdCau: true for clock off; false for clock on.
void POWER_SetPowerSwitchCallback ( power_switch_callback_t  pre,
void *  preParam,
power_switch_callback_t  post,
void *  postParam 
)
Parameters
pre: Function called before power mode switch
preParam: User parameter for pre callback
post: Function called after power mode switch
postParam: User parameter for post callback
AT_QUICKACCESS_SECTION_CODE ( bool   POWER_EnterPowerModeuint32_t mode, const power_sleep_config_t *config)
Parameters
mode: 0 ~ 4 stands for PM0 ~ PM4.
config: Sleep configuration on PM2-PM4.
Returns
True for success, else failure.
__STATIC_INLINE void PMU_EnableWlanWakeup ( uint8_t  wlWakeup)
Parameters
wlWakeup: 8 bits wakeup mask
__STATIC_INLINE void PMU_DisableWlanWakeup ( uint8_t  wlWakeup)
Parameters
wlWakeup: 8 bits wakeup mask
__STATIC_INLINE void PMU_EnableBleWakeup ( uint8_t  bleWakeup)
Parameters
bleWakeup: 8 bits wakeup mask
__STATIC_INLINE void PMU_DisableBleWakeup ( uint8_t  bleWakeup)
Parameters
bleWakeup: 8 bits wakeup mask
void POWER_EnableCaptSlowPulseTimer ( capt_slow_pulse_width_t  width,
capt_slow_pulse_edge_t  edge,
uint32_t  timeout,
capt_pulse_timer_callback_t  cb,
void *  param 
)
Parameters
width: input capture filter width in cycles
edge: trigger condition of counter
timeout: timer expire counter which will trigger callback
callback: callback function on timer expire
param: callback parameter
void POWER_EnableCaptFastPulseTimer ( uint32_t  timeout,
capt_pulse_timer_callback_t  cb,
void *  param 
)
Parameters
timeout: timer expire counter which will trigger callback
callback: callback function on timer expire
param: callback parameter
void POWER_InitVoltage ( uint32_t  dro,
uint32_t  pack 
)
Parameters
dro: trim value from fuse.
pack: Device package type: 0 - QFN, 1 - CSP, 2 - BGA
void Power_InitLoadGdetCfg ( power_load_gdet_cfg  loadFunc,
const power_gdet_data_t data,
uint32_t  pack 
)
Parameters
loadFunc: function pointer to the GDET load configuration.
data: GDET config data loaded from fuse.
pack: Device package type: 0 - QFN, 1 - CSP, 2 - BGA
AT_QUICKACCESS_SECTION_CODE ( bool   POWER_EnableGDetVSensorsvoid)
Returns
True for success, else failure.
uint32_t POWER_TrimSvc ( uint32_t  gdetTrim,
uint32_t  pack 
)
Parameters
gdetTrim: GDET trim value from fuse.
pack: Device package type: 0 - QFN, 1 - CSP, 2 - BGA