![]() |
MCUXpresso SDK API Reference Manual
Rev 2.12.1
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_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 | SMU_BOOT_REASON_WUC_ONLY (PCRM_SYS_BOOT1_STS_BOOT_WUC_MASK | (PCRM_SYS_BOOT3_STS_RST_STS_FSM_MASK << (PCRM_SYS_BOOT1_STS_BOOT_SPI_POS + 1))) |
| #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)) |
Typedefs | |
| typedef void(* | pmu_callback_t )(pmu_event_t event) |
| PMU callback. More... | |
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... | |
| enum | PN76xx_Gpreg_6_PosMask_t |
| Enum for the Storing the LPCD States during standby in GPREG6. | |
| enum | PN76xx_Gpreg_8_Pos_t { PHHAL_HW_PN76XX_GPREG_8_POS_WAKEUP_SOURCE = 0UL, PHHAL_HW_PN76XX_GPREG_8_POS_WAKEUP_COUNTER = 22UL } |
| Enum for the storing wakeup source during LPCD. More... | |
| enum | PN76xx_Gpreg_8_Mask_t { PHHAL_HW_PN76XX_GPREG_8_MASK_WAKEUP_SOURCE = 0x003FFFFFUL, PHHAL_HW_PN76XX_GPREG_8_MASK_WAKEUP_COUNTER = 0xFFC00000UL } |
| Enum for the storing wakeup source and interval during LPCD. More... | |
| enum | pmu_event_t { kPMU_EventOverCurrent, kPMU_EventOverTemp, kPMU_EventVddioOk } |
| PMU event. More... | |
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... | |
| status_t | POWER_CheckUsbPower (void) |
| This function checks the USB power. More... | |
| void | PMU_RegisterCallback (pmu_callback_t callback) |
| Register PMU callback called when PMU event happens. | |
| void | PCRM_IRQHandler (void) |
SMU APIs | |
| void | SMU_Init (void) |
| This function is used to Initialize the Smu. More... | |
| bool | PCRM_TestBitN (uint16_t wRegAddr, uint32_t dwBitPos) |
| This function is used to test a bit. 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_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_GPIO_POS (8U) |
Bit position for GPIO wakeup sourves
| #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_WAKEUP_SOURCE_VEN_LOW (0x00002000UL) |
Wake Up source is VEN LOW
| #define SMU_WAKEUP_SOURCE_CARD_DET (0x00004000UL) |
Wake Up source is Card detect
| #define SMU_WAKEUP_SOURCE_CURRENT (0x00008000UL) |
Wake Up source is OVER CURRENT
| #define SMU_WAKEUP_SOURCE_XTAL_TIMEOUT (0x00010000UL) |
Wake Up source is XTAL TIME OUT
| #define SMU_WAKEUP_SOURCE_CLKDET_ERROR (0x00020000UL) |
Wake Up source is clk detect error
| #define SMU_WAKEUP_SOURCE_VBAT_MIN (0x00040000UL) |
Wake Up source is VBat min
| #define SMU_PREVENTED_USER_ABORT (0x04000000UL) |
Prevention reason in case of User aborting standby
| #define SMU_BOOT_REASON_WUC_ONLY (PCRM_SYS_BOOT1_STS_BOOT_WUC_MASK | (PCRM_SYS_BOOT3_STS_RST_STS_FSM_MASK << (PCRM_SYS_BOOT1_STS_BOOT_SPI_POS + 1))) |
For WUC boot reason PCRM_SYS_BOOT1_STS_BOOT_WUC_MASK and PCRM_SYS_BOOT3_STS_RST_STS_FSM_MASK bits are set corresponding value is 0x04000010
| #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
| typedef void(* pmu_callback_t)(pmu_event_t event) |
| enum smu_hif_sel_t |
| enum PN76xx_Gpreg_8_Pos_t |
| enum pmu_event_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 |
| status_t POWER_CheckUsbPower | ( | void | ) |
| kStatus_Success | USB power is OK. |
| kStatus_Fail | USB power is not available. |
| void SMU_Init | ( | void | ) |
| bool PCRM_TestBitN | ( | uint16_t | wRegAddr, |
| uint32_t | dwBitPos | ||
| ) |
| wRegAddr | : Register Address |
| dwBitPos | : Bit position to test. |