BPM driver.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include "compiler.h"
Macros | |
#define | BPM_UNLOCK(reg) |
BPM unlock macro. More... | |
Sleep mode definitions | |
#define | BPM_SM_ACTIVE 0 |
Active mode. More... | |
#define | BPM_SM_SLEEP_0 1 |
Sleep mode 0. More... | |
#define | BPM_SM_SLEEP_1 2 |
Sleep mode 1. More... | |
#define | BPM_SM_SLEEP_2 3 |
Sleep mode 2. More... | |
#define | BPM_SM_SLEEP_3 4 |
Sleep mode 3. More... | |
#define | BPM_SM_WAIT 5 |
Wait mode. More... | |
#define | BPM_SM_RET 6 |
Retention mode. More... | |
#define | BPM_SM_BACKUP 7 |
Backup mode. More... | |
Power scaling change mode | |
#define | BPM_PSCM_CPU_HALT 0 |
Power scaling change mode: halting the CPU execution. More... | |
#define | BPM_PSCM_CPU_NOT_HALT 1 |
Power scaling change mode: CPU execution not halted. More... | |
Power scaling mode value | |
#define | BPM_PS_0 0 |
Power scaling mode 0. More... | |
#define | BPM_PS_1 1 |
Power scaling mode 1. More... | |
#define | BPM_PS_2 2 |
Power scaling mode 2. More... | |
CLK32 32Khz-1Khz clock source selection | |
#define | BPM_CLK32_SOURCE_OSC32K 0 |
OSC32K : Low frequency crystal oscillator. More... | |
#define | BPM_CLK32_SOURCE_RC32K 1 |
RC32K : Internal Low frequency RC oscillator. More... | |
Backup wake up sources | |
#define | BPM_BKUP_WAKEUP_SRC_EIC (1UL << BPM_BKUPWEN_EIC) |
EIC wake up. More... | |
#define | BPM_BKUP_WAKEUP_SRC_AST (1UL << BPM_BKUPWEN_AST) |
AST wake up. More... | |
#define | BPM_BKUP_WAKEUP_SRC_WDT (1UL << BPM_BKUPWEN_WDT) |
WDT wake up. More... | |
#define | BPM_BKUP_WAKEUP_SRC_BOD33 (1UL << BPM_BKUPWEN_BOD33) |
BOD33 wake up. More... | |
#define | BPM_BKUP_WAKEUP_SRC_BOD18 (1UL << BPM_BKUPWEN_BOD18) |
BOD18 wake up. More... | |
#define | BPM_BKUP_WAKEUP_SRC_PICOUART (1UL << BPM_BKUPWEN_PICOUART) |
PICOUART wake up. More... | |
Backup pin muxing | |
#define | BPM_BKUP_PIN_PB01_EIC0 BPM_BKUPPMUX_BKUPPMUX(0) |
#define | BPM_BKUP_PIN_PA06_EIC1 BPM_BKUPPMUX_BKUPPMUX(1) |
#define | BPM_BKUP_PIN_PA04_EIC2 BPM_BKUPPMUX_BKUPPMUX(2) |
#define | BPM_BKUP_PIN_PA05_EIC3 BPM_BKUPPMUX_BKUPPMUX(3) |
#define | BPM_BKUP_PIN_PA07_EIC4 BPM_BKUPPMUX_BKUPPMUX(4) |
#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) |
Functions | |
Power 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... | |
Interrupt and status management | |
void | bpm_enable_interrupt (Bpm *bpm, uint32_t sources) |
Enable interrupt with given sources mask. More... | |
void | bpm_disable_interrupt (Bpm *bpm, uint32_t sources) |
Disable interrupt with given sources mask. More... | |
uint32_t | bpm_get_interrupt_mask (Bpm *bpm) |
Get BPM interrupt mask. More... | |
uint32_t | bpm_get_interrupt_status (Bpm *bpm) |
Get BPM interrupt status. More... | |
void | bpm_clear_interrupt (Bpm *bpm, uint32_t sources) |
Clear BPM interrupt. More... | |
uint32_t | bpm_get_status (Bpm *bpm) |
Get BPM status. More... | |
uint32_t | bpm_get_version (Bpm *bpm) |
Get version of BPM module. More... | |