MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
GPC: General Power Controller Driver

Overview

The MCUXpresso SDK provides a peripheral driver for the General Power Controller (GPC) module of MCUXpresso SDK devices.

API functions are provided to configure the system about working in dedicated power mode. There are mainly about enabling the power for memory, enabling the wakeup sources for Partial Sleep mode and power up/down operations.

Typical use case

  1. Enable the wakeup source for Partial Sleep (PSLEEP) mode. In PSLEEP mode, HP domain is powered down, while LP domain remains powered on. So, peripherals in LP domain can wakeup the system from PSLEEP mode via interrupts. In PSLEEP mode, system clocks are stopped and peripheral clocks of LP domain can be optionally on. LP domain peripherals can generate interrupt either asynchronously or need its peripheral clock on, depending on what kind of wakeup event is expected. Using the API of "GPC_EnablePartialSleepWakeupSource()" can enable the corresponding module as a wakeup source of PSLEEP mode. When the MCU exits from the PSLEEP mode, the API of "GPC_GetPartialSleepWakeupFlag()" can be used to check if the expected event occurs. However, to clear the wakeup flags, user have to clear the interrupt status of the corresponding wakeup module.
  2. Power up/down sequence. After the power up/down request, the power of HP domain would not be ready immediately, it would wait for a few delay so that the voltage is stable. Then switch the power of HP domain by hardware. To set the delay time, the driver privodes the API of "GPC_ConfigPowerUpSequence()" and "GPC_ConfigPowerDownSequence()".

Enumerations

enum  _gpc_memory_power_gate {
  kGPC_MemoryPowerGateL2Cache = GPC_MPCTR_L2_PGE_MASK,
  kGPC_MemoryPowerGateITCM = GPC_MPCTR_ITCM_PGE_MASK,
  kGPC_MemoryPowerGateDTCM = GPC_MPCTR_DTCM_PGE_MASK
}
 Enumeration of the memory power gate control. More...
 
enum  _gpc_status_flags { kGPC_PoweredDownFlag = GPC_PGS_PS_MASK }
 GPC flags. More...
 

Driver version

#define FSL_GPC_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 GPC driver version 2.0.0. More...
 

Memory power Control

static void GPC_EnableMemoryGate (GPC_Type *base, uint32_t modules, bool enable)
 Control power for memory. More...
 

Partial sleep source

void GPC_EnablePartialSleepWakeupSource (GPC_Type *base, gpc_wakeup_source_t source, bool enable)
 Enable the modules as wakeup sources of PSLEEP (Partial Sleep) mode. More...
 
bool GPC_GetPartialSleepWakeupFlag (GPC_Type *base, gpc_wakeup_source_t source)
 Get if indicated wakeup module just caused the wakeup event to exit PSLEEP mode. More...
 
static void GPC_EnablePartialSleepMode (GPC_Type *base, bool enable)
 Switch to the Partial Sleep mode. More...
 

Power gate control

static void GPC_ConfigPowerUpSequence (GPC_Type *base, uint32_t sw, uint32_t sw2iso)
 Configure the power up sequence. More...
 
static void GPC_ConfigPowerDownSequence (GPC_Type *base, uint32_t iso, uint32_t iso2w)
 Configure the power down sequence. More...
 
static uint32_t GPC_GetStatusFlags (GPC_Type *base)
 Get the status flags of GPC. More...
 
static void GPC_ClearStatusFlags (GPC_Type *base, uint32_t flags)
 Clear the status flags of GPC. More...
 

Macro Definition Documentation

#define FSL_GPC_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))

Enumeration Type Documentation

Once the clock gate is enabled, the responding part would be powered off and contents are not retained in Partial SLEEP mode.

Enumerator
kGPC_MemoryPowerGateL2Cache 

L2 Cache Power Gate.

kGPC_MemoryPowerGateITCM 

ITCM Power Gate Enable.

kGPC_MemoryPowerGateDTCM 

DTCM Power Gate Enable.

Enumerator
kGPC_PoweredDownFlag 

Power status.

HP domain was powered down for the previous power down request.

Function Documentation

static void GPC_EnableMemoryGate ( GPC_Type *  base,
uint32_t  modules,
bool  enable 
)
inlinestatic
Parameters
baseGPC peripheral base address.
modulesMask value for Modules to be operated, see to _gpc_memory_power_gate.
enableEnable the power or not.
void GPC_EnablePartialSleepWakeupSource ( GPC_Type *  base,
gpc_wakeup_source_t  source,
bool  enable 
)

In PSLEEP mode, HP domain is powered down, while LP domain remains powered on so peripherals in LP domain can wakeup the system from PSLEEP mode via interrupts. In PSLEEP mode, system clocks are stopped and peripheral clocks of LP domain can be optionally on. LP domain peripherals can generate interrupt either asynchronously or need its peripheral clock on, depending on what kind of wakeup event is expected. Refer to the corresponding module description about what kind of interrupts are supported by the module.

Parameters
baseGPC peripheral base address.
sourceWakeup source for responding module, see to #gpc_wakeup_source_t.
enableEnable the wakeup source or not.
bool GPC_GetPartialSleepWakeupFlag ( GPC_Type *  base,
gpc_wakeup_source_t  source 
)

This function returns if the responding wakeup module just caused the MCU to exit PSLEEP mode. In hardware level, the flags of wakeup source are read only and will be cleared by cleaning the interrupt status of the corresponding wakeup module.

Parameters
baseGPC peripheral base address.
sourceWakeup source for responding module, see to #gpc_wakeup_source_t.
Return values
true- Indicated wakeup flag is asserted.
false- Indicated wakeup flag is not asserted.
static void GPC_EnablePartialSleepMode ( GPC_Type *  base,
bool  enable 
)
inlinestatic

This function controls if the system will enter Partial SLEEP mode or remain in STOP mode.

Parameters
baseGPC peripheral base address.
enableEnable the gate or not.
static void GPC_ConfigPowerUpSequence ( GPC_Type *  base,
uint32_t  sw,
uint32_t  sw2iso 
)
inlinestatic

There will be two steps for power up sequence:

  • After a power up request, GPC waits for a number of IP BUS clocks equal to the value of SW before turning on the power of HP domain. SW must not be programmed to zero.
  • After GPC turnning on the power of HP domain, it waits for a number of IP BUS clocks equal to the value of SW2ISO before disable the isolation of HP domain. SW2ISO must not be programmed to zero.
Parameters
baseGPC peripheral base address.
swCount of IP BUS clocks before disabling the isolation of HP domain.
sw2isoCount of IP BUS clocks before turning on the power of HP domain.
static void GPC_ConfigPowerDownSequence ( GPC_Type *  base,
uint32_t  iso,
uint32_t  iso2w 
)
inlinestatic

There will be two steps for power down sequence:

  • After a power down request, the GPC waits for a number of IP BUS clocks equal to the value of ISO before it enables the isolation of HP domain. ISO must not be programmed to zero.
  • After HP domain is isolated, GPC waits for a number of IPG BUS clocks equal to the value of ISO2SW before it turning off the power of HP domain. ISO2SW must not be programmed to zero.
Parameters
baseGPC peripheral base address.
isoCount of IP BUS clocks before it enables the isolation of HP domain.
iso2wCount of IP BUS clocks before it turning off the power of HP domain.
static uint32_t GPC_GetStatusFlags ( GPC_Type *  base)
inlinestatic
Parameters
baseGPC peripheral base address.
Returns
Mask value of flags, see to _gpc_status_flags.
static void GPC_ClearStatusFlags ( GPC_Type *  base,
uint32_t  flags 
)
inlinestatic
Parameters
baseGPC peripheral base address.
flagsMask value of flags to be cleared, see to _gpc_status_flags.