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
- 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.
- 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()".
#define FSL_GPC_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
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.
|
static void GPC_EnableMemoryGate |
( |
GPC_Type * |
base, |
|
|
uint32_t |
modules, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
- Parameters
-
base | GPC peripheral base address. |
modules | Mask value for Modules to be operated, see to _gpc_memory_power_gate. |
enable | Enable 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
-
base | GPC peripheral base address. |
source | Wakeup source for responding module, see to #gpc_wakeup_source_t. |
enable | Enable 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
-
base | GPC peripheral base address. |
source | Wakeup 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
-
base | GPC peripheral base address. |
enable | Enable 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
-
base | GPC peripheral base address. |
sw | Count of IP BUS clocks before disabling the isolation of HP domain. |
sw2iso | Count 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
-
base | GPC peripheral base address. |
iso | Count of IP BUS clocks before it enables the isolation of HP domain. |
iso2w | Count of IP BUS clocks before it turning off the power of HP domain. |
static uint32_t GPC_GetStatusFlags |
( |
GPC_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | GPC 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
-
base | GPC peripheral base address. |
flags | Mask value of flags to be cleared, see to _gpc_status_flags. |