![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a driver for the common module of MCUXpresso SDK devices.
Files | |
file | fsl_power.h |
Macros | |
#define | MAKE_STATUS(group, code) ((((group)*100) + (code))) |
Construct a status code value from a group and code number. More... | |
#define | MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix)) |
Construct the version number for drivers. More... | |
#define | DEBUG_CONSOLE_DEVICE_TYPE_NONE 0U |
No debug console. More... | |
#define | DEBUG_CONSOLE_DEVICE_TYPE_UART 1U |
Debug console base on UART. More... | |
#define | DEBUG_CONSOLE_DEVICE_TYPE_LPUART 2U |
Debug console base on LPUART. More... | |
#define | DEBUG_CONSOLE_DEVICE_TYPE_LPSCI 3U |
Debug console base on LPSCI. More... | |
#define | DEBUG_CONSOLE_DEVICE_TYPE_USBCDC 4U |
Debug console base on USBCDC. More... | |
#define | DEBUG_CONSOLE_DEVICE_TYPE_FLEXCOMM 5U |
Debug console base on USBCDC. More... | |
#define | DEBUG_CONSOLE_DEVICE_TYPE_IUART 6U |
Debug console base on i.MX UART. More... | |
#define | DEBUG_CONSOLE_DEVICE_TYPE_VUSART 7U |
Debug console base on LPC_USART. More... | |
#define | ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
Computes the number of elements in an array. More... | |
#define | SWDIO_GPIO_PIN 23U |
SWDIO pin is used as wakeup source, in order to provide better debug experience. | |
#define | MAKE_PD_BITS(reg, slot) ((reg << 8) | slot) |
Power name used for POWER_EnablePD/POWER_DisablePD. More... | |
Typedefs | |
typedef int32_t | status_t |
Type used for all status and error return values. More... | |
typedef void(* | p_POWER_RegisterWakeupEntry )(uint32_t ram_addr) |
Register address to bootloader. More... | |
Functions | |
static status_t | EnableIRQ (IRQn_Type interrupt) |
Enable specific interrupt. More... | |
static status_t | DisableIRQ (IRQn_Type interrupt) |
Disable specific interrupt. More... | |
static uint32_t | DisableGlobalIRQ (void) |
Disable the global IRQ. More... | |
static void | EnableGlobalIRQ (uint32_t primask) |
Enaable the global IRQ. More... | |
uint32_t | InstallIRQHandler (IRQn_Type irq, uint32_t irqHandler) |
install IRQ handler More... | |
void | EnableDeepSleepIRQ (IRQn_Type interrupt) |
Enable specific interrupt for wake-up from deep-sleep mode. More... | |
void | DisableDeepSleepIRQ (IRQn_Type interrupt) |
Disable specific interrupt for wake-up from deep-sleep mode. More... | |
void | POWER_WritePmuCtrl1 (SYSCON_Type *base, uint32_t mask, uint32_t value) |
Work around for PMU_CTRL1's hardware issue. More... | |
void | POWER_EnablePD (pd_bit_t en) |
Enable power down. More... | |
void | POWER_DisablePD (pd_bit_t en) |
Disable power down. More... | |
void | POWER_EnableDCDC (bool flag) |
Enable or disable DC-DC. More... | |
void | POWER_EnableADC (bool flag) |
Enable or disable ADC power. More... | |
void | POWER_LatchIO (void) |
Latch the output status and level of GPIO during power down. More... | |
void | POWER_RestoreIO (void) |
Restore the gpio output control registers and take over controll of gpio pads. More... | |
void | POWER_EnableSwdWakeup (void) |
Configure the SWDIO to gpio and as wakeup source before power down. More... | |
void | POWER_RestoreSwd (void) |
Recover swdio's pin-mux configuration that swd access is availale after waking up from power down. | |
bool | POWER_GpioActiveRequest (void) |
Check if any wake io is active. | |
void | POWER_PreEnterLowPower (void) |
Prepares to enter stop modes. More... | |
void | POWER_PostExitLowPower (void) |
Recovers after wake up from stop modes. More... | |
void | POWER_EnterSleep (void) |
Make the chip enter sleep mode. | |
void | POWER_EnterPowerDown (uint32_t exclude_from_pd) |
Make the chip enter power down mode. More... | |
void | POWER_Init (void) |
@ brief Init of power management unit. | |
static void | RESET_SetPeripheralReset (reset_ip_name_t peripheral) |
Assert reset to peripheral. More... | |
static void | RESET_ClearPeripheralReset (reset_ip_name_t peripheral) |
Clear reset to peripheral. More... | |
static void | RESET_PeripheralReset (reset_ip_name_t peripheral) |
Reset peripheral module. More... | |
static void | RESET_SetDmaPintImputMuxReset (void) |
Reset DMA, PINT and InputMux module. | |
reset_source_t | RESET_GetResetSource (void) |
This function is used to get the CPU start up source. More... | |
static void | RESET_ClearResetSource (void) |
Clear the reset source. | |
Min/max macros | |
#define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
#define | MAX(a, b) ((a) > (b) ? (a) : (b)) |
UINT16_MAX/UINT32_MAX value | |
#define | UINT16_MAX ((uint16_t)-1) |
#define | UINT32_MAX ((uint32_t)-1) |
Timer utilities | |
#define | USEC_TO_COUNT(us, clockFreqInHz) (uint64_t)((uint64_t)us * clockFreqInHz / 1000000U) |
Macro to convert a microsecond period to raw count value. | |
#define | COUNT_TO_USEC(count, clockFreqInHz) (uint64_t)((uint64_t)count * 1000000U / clockFreqInHz) |
Macro to convert a raw count value to microsecond. | |
#define | MSEC_TO_COUNT(ms, clockFreqInHz) (uint64_t)((uint64_t)ms * clockFreqInHz / 1000U) |
Macro to convert a millisecond period to raw count value. | |
#define | COUNT_TO_MSEC(count, clockFreqInHz) (uint64_t)((uint64_t)count * 1000U / clockFreqInHz) |
Macro to convert a raw count value to millisecond. | |
Alignment variable definition macros | |
#define | SDK_ALIGN(var, alignbytes) var |
#define | SDK_SIZEALIGN(var, alignbytes) ((unsigned int)((var) + ((alignbytes)-1)) & (unsigned int)(~(unsigned int)((alignbytes)-1))) |
Macro to change a value to a given size aligned value. | |
Non-cacheable region definition macros | |
#define | AT_NONCACHEABLE_SECTION(var) var |
#define | AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) var |
Driver version | |
#define | FSL_QN9080_POWER_VERSION (MAKE_VERSION(2, 0, 0)) |
QN9080 power version 2.0.0. More... | |
#define MAKE_STATUS | ( | group, | |
code | |||
) | ((((group)*100) + (code))) |
#define MAKE_VERSION | ( | major, | |
minor, | |||
bugfix | |||
) | (((major) << 16) | ((minor) << 8) | (bugfix)) |
#define DEBUG_CONSOLE_DEVICE_TYPE_NONE 0U |
#define DEBUG_CONSOLE_DEVICE_TYPE_UART 1U |
#define DEBUG_CONSOLE_DEVICE_TYPE_LPUART 2U |
#define DEBUG_CONSOLE_DEVICE_TYPE_LPSCI 3U |
#define DEBUG_CONSOLE_DEVICE_TYPE_USBCDC 4U |
#define DEBUG_CONSOLE_DEVICE_TYPE_FLEXCOMM 5U |
#define DEBUG_CONSOLE_DEVICE_TYPE_IUART 6U |
#define DEBUG_CONSOLE_DEVICE_TYPE_VUSART 7U |
#define ARRAY_SIZE | ( | x | ) | (sizeof(x) / sizeof((x)[0])) |
#define FSL_QN9080_POWER_VERSION (MAKE_VERSION(2, 0, 0)) |
#define MAKE_PD_BITS | ( | reg, | |
slot | |||
) | ((reg << 8) | slot) |
typedef int32_t status_t |
typedef void(* p_POWER_RegisterWakeupEntry)(uint32_t ram_addr) |
This is an ROM API. The ram function address registered will be stored in a global variable in the reserved ram area for bootloader. After waking up from power down, bootloader will jump to the function registered.
ram_addr | a function address in ram area. |
enum _status_groups |
enum _generic_status |
enum power_mode_t |
enum SYSCON_RSTn_t |
Defines the enumeration for peripheral reset control bits in PRESETCTRL/ASYNCPRESETCTRL registers
enum reset_source_t |
|
inlinestatic |
Enable LEVEL1 interrupt. For some devices, there might be multiple interrupt levels. For example, there are NVIC and intmux. Here the interrupts connected to NVIC are the LEVEL1 interrupts, because they are routed to the core directly. The interrupts connected to intmux are the LEVEL2 interrupts, they are routed to NVIC first then routed to core.
This function only enables the LEVEL1 interrupts. The number of LEVEL1 interrupts is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
interrupt | The IRQ number. |
kStatus_Success | Interrupt enabled successfully |
kStatus_Fail | Failed to enable the interrupt |
|
inlinestatic |
Disable LEVEL1 interrupt. For some devices, there might be multiple interrupt levels. For example, there are NVIC and intmux. Here the interrupts connected to NVIC are the LEVEL1 interrupts, because they are routed to the core directly. The interrupts connected to intmux are the LEVEL2 interrupts, they are routed to NVIC first then routed to core.
This function only disables the LEVEL1 interrupts. The number of LEVEL1 interrupts is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
interrupt | The IRQ number. |
kStatus_Success | Interrupt disabled successfully |
kStatus_Fail | Failed to disable the interrupt |
|
inlinestatic |
Disable the global interrupt and return the current primask register. User is required to provided the primask register for the EnableGlobalIRQ().
|
inlinestatic |
Set the primask register with the provided primask value but not just enable the primask. The idea is for the convinience of integration of RTOS. some RTOS get its own management mechanism of primask. User is required to use the EnableGlobalIRQ() and DisableGlobalIRQ() in pair.
primask | value of primask register to be restored. The primask value is supposed to be provided by the DisableGlobalIRQ(). |
uint32_t InstallIRQHandler | ( | IRQn_Type | irq, |
uint32_t | irqHandler | ||
) |
irq | IRQ number |
irqHandler | IRQ handler address |
void EnableDeepSleepIRQ | ( | IRQn_Type | interrupt | ) |
Enable the interrupt for wake-up from deep sleep mode. Some interrupts are typically used in sleep mode only and will not occur during deep-sleep mode because relevant clocks are stopped. However, it is possible to enable those clocks (significantly increasing power consumption in the reduced power mode), making these wake-ups possible.
interrupt | The IRQ number. |
void DisableDeepSleepIRQ | ( | IRQn_Type | interrupt | ) |
Disable the interrupt for wake-up from deep sleep mode. Some interrupts are typically used in sleep mode only and will not occur during deep-sleep mode because relevant clocks are stopped. However, it is possible to enable those clocks (significantly increasing power consumption in the reduced power mode), making these wake-ups possible.
interrupt | The IRQ number. |
void POWER_WritePmuCtrl1 | ( | SYSCON_Type * | base, |
uint32_t | mask, | ||
uint32_t | value | ||
) |
Refer to Errata PMU.1.
void POWER_EnablePD | ( | pd_bit_t | en | ) |
Note that enabling the bit powers down the peripheral
en | any value defined by enum |
void POWER_DisablePD | ( | pd_bit_t | en | ) |
Note that disabling the bit powers up the peripheral
en | any value defined by enum |
void POWER_EnableDCDC | ( | bool | flag | ) |
flag | true to enable the DC-DC, false to disable. |
void POWER_EnableADC | ( | bool | flag | ) |
flag | true to enable the ADC power, false to disable. |
void POWER_LatchIO | ( | void | ) |
During power down, GPIO registers at GPIOA_BASE and GPIOB_BASE will get lost, and GPIO controller loses control of the pads. This result in uncetain level on pads during power down. Use this function to capture the current GPIO output status and level to always-on registers, SYSCON->PIO_CAP_OUT0/1 and SYSCON->PIO_CAP_OE0/1, and hand over control of pads to these always-on registers.
void POWER_RestoreIO | ( | void | ) |
Should be called in pair with POWER_LatchIO().
void POWER_EnableSwdWakeup | ( | void | ) |
By using this, the chip can be waked up by swd debugger from power down.
void POWER_PreEnterLowPower | ( | void | ) |
This function should be called before entering low power modes.
void POWER_PostExitLowPower | ( | void | ) |
This function should be called after wake up from low power modes. It is used with POWER_PreEnterLowPower.
void POWER_EnterPowerDown | ( | uint32_t | exclude_from_pd | ) |
If 32k clock source is on before calling this, the chip will go to power down 0. If 32k clock source is turned off before this, the chip will go to power down 1.
exclude_from_pd | when entering power down, leave the modules indicated by exclude_from_pd on. |
|
inlinestatic |
Asserts reset signal to specified peripheral module.
peripheral | Assert reset to this peripheral. The enum argument contains encoding of reset register and reset bit position in the reset register. |
|
inlinestatic |
Clears reset signal to specified peripheral module, allows it to operate.
peripheral | Clear reset to this peripheral. The enum argument contains encoding of reset register and reset bit position in the reset register. |
|
inlinestatic |
Reset peripheral module.
peripheral | Peripheral to reset. The enum argument contains encoding of reset register and reset bit position in the reset register. |
reset_source_t RESET_GetResetSource | ( | void | ) |