![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
This driver covers the PMU functions and SMU functions in PCRM module. PMU functions include VBAT and USB VBUS. SMU functions include the lower power modes, such as standby mode, ULP standby mode, ULPCD mode, and so on.
Macros | |
| #define | FSL_PMU_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
| PMU driver version. More... | |
| #define | PMU_USB_VBUS_DEBOUNCE_TIMEOUT (0x0474) |
| #define | PMU_USB_VBUSOK_WAIT_TIME (5) |
| #define | PMU_USB_VBUS_FASTDISCHARGE_ENABLE (0) |
| #define | SMU_PREVENTED_USER_ABORT (0x04000000UL) |
| #define | PCRM_SETREG(RegAddr, RegVal) (void)PN76_Sys_WriteRegister((RegAddr), (RegVal)) |
| #define | PCRM_SETBITN(RegAddr, BitPos) (void)PN76_Sys_WriteRegisterOrMask((RegAddr), (1UL << (uint32_t)(BitPos))) |
| #define | PCRM_CLEARBITN(RegAddr, BitPos) (void)PN76_Sys_WriteRegisterAndMask((RegAddr), ~(1UL << (uint32_t)(BitPos))) |
| #define | PCRM_SETFIELD(RegAddr, BitMask, MaskVal) (void)PN76_Sys_WriteRegisterField((RegAddr), (uint32_t)(BitMask), (uint32_t)(MaskVal)) |
| #define | PCRM_SETFIELDSHIFT(RegAddr, BitMask, BitPos, Value) (void)PN76_Sys_WriteRegisterField((RegAddr), (uint32_t)(BitMask), ((uint32_t)(Value) << (uint32_t)(BitPos))) |
| #define | PCRM_TESTBITN(RegAddr, BitPos) PCRM_TestBitN((RegAddr), (BitPos)) |
Enumerations | |
| enum | smu_hif_sel_t { kSMU_HifNone = 0, kSMU_HifI2c = 1, kSMU_HifSpi = 2, kSMU_HifUart = 3, kSMU_HifI3c = 4 } |
| Host interface selection. More... | |
| enum | smu_standby_prev_reason_t { kSMU_Success = 0U, kSMU_UserAbort = SMU_PREVENTED_USER_ABORT, kSMU_HostCommOngoing = PCRM_SYS_BOOT2_STS_PREV_HOSTCOMM_MASK, kSMU_SpiSelected = PCRM_SYS_BOOT2_STS_PREV_SPI_MASK, kSMU_I2cAddressSelected = PCRM_SYS_BOOT2_STS_PREV_I2C_MASK, kSMU_I3cAddressSelected = PCRM_SYS_BOOT2_STS_PREV_I3C_MASK, kSMU_HsuSelected = PCRM_SYS_BOOT2_STS_PREV_HSU_MASK, kSMU_Gpio3Selected = PCRM_SYS_BOOT2_STS_PREV_GPIO3_MASK, kSMU_Gpio2Selected = PCRM_SYS_BOOT2_STS_PREV_GPIO2_MASK, kSMU_Gpio1Selected = PCRM_SYS_BOOT2_STS_PREV_GPIO1_MASK, kSMU_Gpio0Selected = PCRM_SYS_BOOT2_STS_PREV_GPIO0_MASK, kSMU_WucEqualZero = PCRM_SYS_BOOT2_STS_PREV_WUC_MASK, kSMU_LpdetEvent = PCRM_SYS_BOOT2_STS_PREV_LPDET_MASK, kSMU_UlpdetEvent = PCRM_SYS_BOOT2_STS_PREV_RX_ULPDET_MASK, kSMU_NoVddioOn = PCRM_SYS_BOOT2_STS_PREV_INT_NO_VDDIO_MASK, kSMU_TempErrorLow = PCRM_SYS_BOOT2_STS_PREV_TEMP_MASK, kSMU_InterfaceError = PCRM_SYS_BOOT2_STS_PREV_INTERFACE_MASK, kSMU_VddioLoss = PCRM_SYS_BOOT2_STS_PREV_VDDIO_LOSS_MASK, kSMU_NoWakeupEnabled = PCRM_SYS_BOOT2_STS_PREV_NOENABLE_MASK, kSMU_VupDetected = PCRM_SYS_BOOT2_STS_PREV_VUPDET_MASK, kSMU_RxProt = PCRM_SYS_BOOT2_STS_PREV_RXPROT_MASK } |
| Standby Prevention Reasons. More... | |
Standby wake-up sources | |
| #define | SMU_WAKEUP_SOURCE_TIMER (0x00000001UL) |
| #define | SMU_WAKEUP_SOURCE_HOST (0x00000002UL) |
| #define | SMU_WAKEUP_SOURCE_RFFIELD (0x00000004UL) |
| #define | SMU_WAKEUP_SOURCE_TEMPSENSOR (0x00000008UL) |
| #define | SMU_WAKEUP_SOURCE_VUP (0x00000010UL) |
| #define | SMU_WAKEUP_SOURCE_VDDIO_LOSS (0x00000020UL) |
| #define | SMU_WAKEUP_SOURCE_RX_PROT (0x00000040UL) |
| #define | SMU_WAKEUP_SOURCE_VDDIO_START (0x00000080UL) |
| #define | SMU_WAKEUP_SOURCE_GPIO_MASK (0x00000F00UL) |
| #define | SMU_WAKEUP_SOURCE_GPIO0 (0x00000100UL) |
| #define | SMU_WAKEUP_SOURCE_GPIO1 (0x00000200UL) |
| #define | SMU_WAKEUP_SOURCE_GPIO2 (0x00000400UL) |
| #define | SMU_WAKEUP_SOURCE_GPIO3 (0x00000800UL) |
| #define | SMU_WAKEUP_SOURCE_ULPDET (0x00001000UL) |
PMU APIs | |
| void | PMU_Init (void) |
| This Initializes the Power Management Unit. | |
| void | PMU_HandleIRQ (void) |
| This function is called when Pmu interrupt is triggered. | |
| void | PMU_VbatMonitorConfig (bool enableMonitor, bool setStandbyCfg) |
| This function configures the VBAT monitoring FSM. More... | |
| status_t | PMU_UsbVbusCheck (void) |
| This function enables USB VBUS Monitor and checks USB VBUS. More... | |
| void | PCRM_IRQHandler (void) |
SMU APIs | |
| void | SMU_Init (void) |
| This function is used to Initialize the Smu. More... | |
| void | SMU_ReEnterStandby (void) |
| This function is used to Re-enter into standby mode. More... | |
| void | SMU_EnterStandby (uint32_t dwWakeUpSource, uint32_t dwWakeUpCntValue, smu_standby_prev_reason_t *ptStandbyPrevReason) |
| This function is used to Switch into standby mode. More... | |
| void | SMU_Enter_UlpStandby (uint16_t wWakeupSource, uint16_t dwWakeUpCntValue) |
| This function is used to Switch into ULP Standby with wakeup counter time. More... | |
| void | SMU_EnterULPCD (uint16_t dwWakeUpCntValue, uint8_t bCalibrationEn, uint16_t wwakeupsrc) |
| This function is used to Switch into ULPCD mode. More... | |
| void | SMU_RestoreStandby (uint32_t dwWakeUpSource) |
| Function used to restore context if for some reason we fail going in standby. More... | |
| #define FSL_PMU_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
| #define PMU_USB_VBUS_DEBOUNCE_TIMEOUT (0x0474) |
USB VBUS debounce time, used for USB VBUS detection
| #define PMU_USB_VBUSOK_WAIT_TIME (5) |
Timeout for waiting for USB VBUS HI (Unit - us)
| #define PMU_USB_VBUS_FASTDISCHARGE_ENABLE (0) |
Enable/Disable Fast discharge for USB VBUS
| #define SMU_WAKEUP_SOURCE_TIMER (0x00000001UL) |
Wake Up source is Timer
| #define SMU_WAKEUP_SOURCE_HOST (0x00000002UL) |
Wake Up source is communication on Host Interface
| #define SMU_WAKEUP_SOURCE_RFFIELD (0x00000004UL) |
Wake Up source is Presence of External RF Field
| #define SMU_WAKEUP_SOURCE_TEMPSENSOR (0x00000008UL) |
Wake Up source is Temperature of the IC
| #define SMU_WAKEUP_SOURCE_VUP (0x00000010UL) |
Wake Up source is Voltage Monitor
| #define SMU_WAKEUP_SOURCE_VDDIO_LOSS (0x00000020UL) |
Wake Up due to VDDIO loss
| #define SMU_WAKEUP_SOURCE_RX_PROT (0x00000040UL) |
Wake Up in case of RX_PROT
| #define SMU_WAKEUP_SOURCE_VDDIO_START (0x00000080UL) |
Wake Up in case of VDDIO Start
| #define SMU_WAKEUP_SOURCE_GPIO_MASK (0x00000F00UL) |
Bit mask for GPIO wake up sources
| #define SMU_WAKEUP_SOURCE_GPIO0 (0x00000100UL) |
Wake Up source is GPIO0
| #define SMU_WAKEUP_SOURCE_GPIO1 (0x00000200UL) |
Wake Up source is GPIO1
| #define SMU_WAKEUP_SOURCE_GPIO2 (0x00000400UL) |
Wake Up source is GPIO2
| #define SMU_WAKEUP_SOURCE_GPIO3 (0x00000800UL) |
Wake Up source is GPIO3
| #define SMU_WAKEUP_SOURCE_ULPDET (0x00001000UL) |
Wake Up source is ULPDET
| #define SMU_PREVENTED_USER_ABORT (0x04000000UL) |
Prevention reason in case of User aborting standby
| #define PCRM_SETREG | ( | RegAddr, | |
| RegVal | |||
| ) | (void)PN76_Sys_WriteRegister((RegAddr), (RegVal)) |
Macro to write a register
| #define PCRM_SETBITN | ( | RegAddr, | |
| BitPos | |||
| ) | (void)PN76_Sys_WriteRegisterOrMask((RegAddr), (1UL << (uint32_t)(BitPos))) |
Macro to set a bit
| #define PCRM_CLEARBITN | ( | RegAddr, | |
| BitPos | |||
| ) | (void)PN76_Sys_WriteRegisterAndMask((RegAddr), ~(1UL << (uint32_t)(BitPos))) |
Macro to clear a bit
| #define PCRM_SETFIELD | ( | RegAddr, | |
| BitMask, | |||
| MaskVal | |||
| ) | (void)PN76_Sys_WriteRegisterField((RegAddr), (uint32_t)(BitMask), (uint32_t)(MaskVal)) |
Macro to write a specific field in a register
| #define PCRM_SETFIELDSHIFT | ( | RegAddr, | |
| BitMask, | |||
| BitPos, | |||
| Value | |||
| ) | (void)PN76_Sys_WriteRegisterField((RegAddr), (uint32_t)(BitMask), ((uint32_t)(Value) << (uint32_t)(BitPos))) |
Macro to write a specific field at specific position in a register
| #define PCRM_TESTBITN | ( | RegAddr, | |
| BitPos | |||
| ) | PCRM_TestBitN((RegAddr), (BitPos)) |
Macro to to test a bit
| enum smu_hif_sel_t |
| void PMU_VbatMonitorConfig | ( | bool | enableMonitor, |
| bool | setStandbyCfg | ||
| ) |
| enableMonitor | Enable/disable VBAT monitor |
| setStandbyCfg | Put the standby configuration if true |
| status_t PMU_UsbVbusCheck | ( | void | ) |
| kStatus_Success | Operation successful |
| kStatus_Timeout | Operation Timed out |
| void SMU_Init | ( | void | ) |
| void SMU_ReEnterStandby | ( | void | ) |
| void SMU_EnterStandby | ( | uint32_t | dwWakeUpSource, |
| uint32_t | dwWakeUpCntValue, | ||
| smu_standby_prev_reason_t * | ptStandbyPrevReason | ||
| ) |
| [in] | dwWakeUpSource | : Selection of wake-up source. |
| [in] | dwWakeUpCntValue | : 10 bit wake-up counter value: resolution=2, 63ms -> max time slot=2,57s |
| [out] | ptStandbyPrevReason | : Pointer to enum standby prevention reason |
| void SMU_Enter_UlpStandby | ( | uint16_t | wWakeupSource, |
| uint16_t | dwWakeUpCntValue | ||
| ) |
| wWakeupSource | : Selection of wake-up source |
| dwWakeUpCntValue | : 12 bit wake-up counter value. Max value = 4094msecs(Tulpcd_wkup_time = dwWakeUpCntValue * Tulfo) |
| void SMU_EnterULPCD | ( | uint16_t | dwWakeUpCntValue, |
| uint8_t | bCalibrationEn, | ||
| uint16_t | wwakeupsrc | ||
| ) |
| dwWakeUpCntValue | : 12 bit wake-up counter value. Max value = 4094msecs. |
| bCalibrationEn | : To enable or disable calibration. 1: Calibration enable. 0: Calibration disabled |
| wwakeupsrc | : Selection of wake-up source. SMU_WAKEUP_SOURCE_ULPDET(0x00001000UL) to enabled ULPDET, any other value ULPDET is disabled |
| void SMU_RestoreStandby | ( | uint32_t | dwWakeUpSource | ) |
| dwWakeUpSource | : Selection of wake-up source. |