Driver for the BPM (Backup Power Manager).
This driver provides access to the main features of the BPM controller. It provides functions for different power mode management.
|
void | bpm_sleep (Bpm *bpm, uint32_t sleep_mode) |
| Enter sleep mode. More...
|
|
void | bpm_power_scaling_cpu (Bpm *bpm, uint32_t ps_value) |
| Change Power Scaling mode. More...
|
|
bool | bpm_power_scaling_cpu_failsafe (Bpm *bpm, uint32_t ps_value, uint32_t timeout) |
| Change Power Scaling mode and check results. More...
|
|
static __always_inline bool | bpm_configure_power_scaling (Bpm *bpm, uint32_t ps_value, uint32_t no_halt) |
| Configure power scaling mode. More...
|
|
void | bpm_enable_fast_wakeup (Bpm *bpm) |
| Enable fast wakeup for analog modules. More...
|
|
void | bpm_disable_fast_wakeup (Bpm *bpm) |
| Disable fast wakeup for analog modules. More...
|
|
void | bpm_set_clk32_source (Bpm *bpm, uint32_t source) |
| Set clock source for 32KHz clock. More...
|
|
uint32_t | bpm_get_backup_wakeup_cause (Bpm *bpm) |
| Get wakeup cause from backup mode. More...
|
|
void | bpm_enable_wakeup_source (Bpm *bpm, uint32_t sources) |
| Enable wakeup source. More...
|
|
void | bpm_disable_wakeup_source (Bpm *bpm, uint32_t sources) |
| Disable wakeup source. More...
|
|
void | bpm_enable_backup_pin (Bpm *bpm, uint32_t backup_pins) |
| Enable backup pin for wakeup. More...
|
|
void | bpm_disable_backup_pin (Bpm *bpm, uint32_t backup_pins) |
| Disable backup pin for wakeup. More...
|
|
void | bpm_enable_io_retention (Bpm *bpm) |
| Enable IO retention for backup mode. More...
|
|
void | bpm_disable_io_retention (Bpm *bpm) |
| Disable IO retention for backup mode. More...
|
|
#define BPM_BKUP_PIN_PA04_EIC2 BPM_BKUPPMUX_BKUPPMUX(2) |
#define BPM_BKUP_PIN_PA05_EIC3 BPM_BKUPPMUX_BKUPPMUX(3) |
#define BPM_BKUP_PIN_PA06_EIC1 BPM_BKUPPMUX_BKUPPMUX(1) |
#define BPM_BKUP_PIN_PA07_EIC4 BPM_BKUPPMUX_BKUPPMUX(4) |
#define BPM_BKUP_PIN_PB01_EIC0 BPM_BKUPPMUX_BKUPPMUX(0) |
#define BPM_BKUP_PIN_PC03_EIC5 BPM_BKUPPMUX_BKUPPMUX(5) |
#define BPM_BKUP_PIN_PC04_EIC6 BPM_BKUPPMUX_BKUPPMUX(6) |
#define BPM_BKUP_PIN_PC05_EIC7 BPM_BKUPPMUX_BKUPPMUX(7) |
#define BPM_BKUP_PIN_PC06_EIC8 BPM_BKUPPMUX_BKUPPMUX(8) |
#define BPM_BKUP_WAKEUP_SRC_AST (1UL << BPM_BKUPWEN_AST) |
#define BPM_BKUP_WAKEUP_SRC_BOD18 (1UL << BPM_BKUPWEN_BOD18) |
#define BPM_BKUP_WAKEUP_SRC_BOD33 (1UL << BPM_BKUPWEN_BOD33) |
#define BPM_BKUP_WAKEUP_SRC_EIC (1UL << BPM_BKUPWEN_EIC) |
#define BPM_BKUP_WAKEUP_SRC_PICOUART (1UL << BPM_BKUPWEN_PICOUART) |
#define BPM_BKUP_WAKEUP_SRC_WDT (1UL << BPM_BKUPWEN_WDT) |
#define BPM_CLK32_SOURCE_OSC32K 0 |
#define BPM_CLK32_SOURCE_RC32K 1 |
RC32K : Internal Low frequency RC oscillator.
#define BPM_PSCM_CPU_HALT 0 |
Power scaling change mode: halting the CPU execution.
#define BPM_PSCM_CPU_NOT_HALT 1 |
Power scaling change mode: CPU execution not halted.
Referenced by sysclk_init().
#define BPM_UNLOCK |
( |
|
reg | ) |
|
void bpm_clear_interrupt |
( |
Bpm * |
bpm, |
|
|
uint32_t |
sources |
|
) |
| |
Clear BPM interrupt.
- Parameters
-
bpm | Base address of the BPM instance. |
sources | BPM interrupt source mask. |
static __always_inline bool bpm_configure_power_scaling |
( |
Bpm * |
bpm, |
|
|
uint32_t |
ps_value, |
|
|
uint32_t |
no_halt |
|
) |
| |
|
static |
void bpm_disable_backup_pin |
( |
Bpm * |
bpm, |
|
|
uint32_t |
backup_pins |
|
) |
| |
Disable backup pin for wakeup.
- Parameters
-
bpm | Base address of the BPM instance. |
backup_pins | Backup pin mask, see backup_pin_muxing. |
void bpm_disable_fast_wakeup |
( |
Bpm * |
bpm | ) |
|
Disable fast wakeup for analog modules.
- Parameters
-
bpm | Base address of the BPM instance. |
References BPM_UNLOCK.
void bpm_disable_interrupt |
( |
Bpm * |
bpm, |
|
|
uint32_t |
sources |
|
) |
| |
Disable interrupt with given sources mask.
- Parameters
-
bpm | Base address of the BPM instance. |
sources | BPM interrupt source mask. |
void bpm_disable_io_retention |
( |
Bpm * |
bpm | ) |
|
Disable IO retention for backup mode.
- Parameters
-
bpm | Base address of the BPM instance. |
void bpm_disable_wakeup_source |
( |
Bpm * |
bpm, |
|
|
uint32_t |
sources |
|
) |
| |
Disable wakeup source.
- Parameters
-
void bpm_enable_backup_pin |
( |
Bpm * |
bpm, |
|
|
uint32_t |
backup_pins |
|
) |
| |
Enable backup pin for wakeup.
- Parameters
-
bpm | Base address of the BPM instance. |
backup_pins | Backup pin mask, see backup_pin_muxing. |
void bpm_enable_fast_wakeup |
( |
Bpm * |
bpm | ) |
|
Enable fast wakeup for analog modules.
- Parameters
-
bpm | Base address of the BPM instance. |
References BPM_UNLOCK.
Referenced by sysclk_init().
void bpm_enable_interrupt |
( |
Bpm * |
bpm, |
|
|
uint32_t |
sources |
|
) |
| |
Enable interrupt with given sources mask.
- Parameters
-
bpm | Base address of the BPM instance. |
sources | BPM interrupt source mask. |
void bpm_enable_io_retention |
( |
Bpm * |
bpm | ) |
|
Enable IO retention for backup mode.
- Parameters
-
bpm | Base address of the BPM instance. |
void bpm_enable_wakeup_source |
( |
Bpm * |
bpm, |
|
|
uint32_t |
sources |
|
) |
| |
uint32_t bpm_get_backup_wakeup_cause |
( |
Bpm * |
bpm | ) |
|
Get wakeup cause from backup mode.
- Parameters
-
bpm | Base address of the BPM instance. |
uint32_t bpm_get_interrupt_mask |
( |
Bpm * |
bpm | ) |
|
Get BPM interrupt mask.
- Parameters
-
bpm | Base address of the BPM instance. |
- Returns
- BPM interrupt mask.
uint32_t bpm_get_interrupt_status |
( |
Bpm * |
bpm | ) |
|
Get BPM interrupt status.
- Parameters
-
bpm | Base address of the BPM instance. |
- Returns
- BPM interrupt status.
uint32_t bpm_get_status |
( |
Bpm * |
bpm | ) |
|
Get BPM status.
- Parameters
-
bpm | Base address of the BPM instance. |
- Returns
- BPM status.
Referenced by sysclk_init().
uint32_t bpm_get_version |
( |
Bpm * |
bpm | ) |
|
Get version of BPM module.
- Parameters
-
bpm | Base address of the BPM instance. |
- Returns
- Version of BPM module.
void bpm_power_scaling_cpu |
( |
Bpm * |
bpm, |
|
|
uint32_t |
ps_value |
|
) |
| |
bool bpm_power_scaling_cpu_failsafe |
( |
Bpm * |
bpm, |
|
|
uint32_t |
ps_value, |
|
|
uint32_t |
timeout |
|
) |
| |
void bpm_set_clk32_source |
( |
Bpm * |
bpm, |
|
|
uint32_t |
source |
|
) |
| |
void bpm_sleep |
( |
Bpm * |
bpm, |
|
|
uint32_t |
sleep_mode |
|
) |
| |
Enter sleep mode.
- Parameters
-
bpm | Base address of the BPM instance. |
sleep_mode | Expected sleep mode (active case not included). |
References BPM_SM_BACKUP, BPM_SM_RET, BPM_SM_SLEEP_0, BPM_SM_SLEEP_1, BPM_SM_SLEEP_2, BPM_SM_SLEEP_3, BPM_SM_WAIT, BPM_UNLOCK, and cpu_irq_enable.
Referenced by run_alarm_test(), run_periodic_test(), and sleepmgr_sleep().