Loading...
Searching...
No Matches
powman.h File Reference
#include "pico.h"
#include "hardware/structs/powman.h"
#include "pico/util/fixed_bitset.h"

Go to the source code of this file.

Macros

#define PARAM_ASSERTIONS_ENABLED_HARDWARE_POWMAN   0
#define PICO_POWMAN_CALIBRATE_LPOSC_FROM_OTP   1
#define pstate_bitset_none()
#define pstate_bitset_all()
#define POWMAN_POWER_STATE_NONE   0

Typedefs

typedef enum powman_power_domains powman_power_domain_t
typedef uint32_t powman_power_state

Enumerations

enum  powman_power_domains {
  POWMAN_POWER_DOMAIN_SRAM_BANK1 = 0 , POWMAN_POWER_DOMAIN_SRAM_BANK0 = 1 , POWMAN_POWER_DOMAIN_XIP_CACHE = 2 , POWMAN_POWER_DOMAIN_SWITCHED_CORE = 3 ,
  POWMAN_POWER_DOMAIN_COUNT = 4
}
 Power domains of powman. More...

Functions

uint32_t powman_timer_get_lposc_calib_freq (void)
 Get the calibrated frequency of the low power oscillator.
void powman_timer_set_1khz_tick_source_lposc (void)
 Use the ~32KHz low power oscillator as the powman timer source.
void powman_timer_set_1khz_tick_source_lposc_with_hz (uint32_t lposc_freq_hz)
 Use the low power oscillator (specifying frequency) as the powman timer source.
void powman_timer_set_1khz_tick_source_xosc (void)
 Use the crystal oscillator as the powman timer source.
void powman_timer_set_1khz_tick_source_xosc_with_hz (uint32_t xosc_freq_hz)
 Use the crystal oscillator (specifying frequency) as the powman timer source.
void powman_timer_set_1khz_tick_source_gpio (uint32_t gpio)
 Use a 1KHz external tick as the powman timer source.
void powman_timer_enable_gpio_1hz_sync (uint32_t gpio)
 Use a 1Hz external signal as the powman timer source for seconds only.
void powman_timer_disable_gpio_1hz_sync (void)
 Stop using 1Hz external signal as the powman timer source for seconds.
uint64_t powman_timer_get_ms (void)
 Returns current time in ms.
void powman_timer_set_ms (uint64_t time_ms)
 Set current time in ms.
void powman_timer_enable_alarm_at_ms (uint64_t alarm_time_ms)
 Set an alarm at an absolute time in ms.
void powman_timer_disable_alarm (void)
 Disable the alarm.
static void powman_set_bits (volatile uint32_t *reg, uint32_t bits)
 hw_set_bits helper function
static void powman_clear_bits (volatile uint32_t *reg, uint32_t bits)
 hw_clear_bits helper function
static bool powman_timer_is_running (void)
 Determine if the powman timer is running.
static void powman_timer_stop (void)
 Stop the powman timer.
static void powman_timer_pause (void)
 Pause the powman timer.
static void powman_timer_start (void)
 Start the powman timer.
static void powman_clear_alarm (void)
 Clears the powman alarm.
typedef fixed_bitset_type (POWMAN_POWER_DOMAIN_COUNT) pstate_bitset_t
static pstate_bitset_t * pstate_bitset_remove_all (pstate_bitset_t *domains)
static pstate_bitset_t * pstate_bitset_add_all (pstate_bitset_t *domains)
static pstate_bitset_t * pstate_bitset_add (pstate_bitset_t *domains, powman_power_domain_t domain)
static pstate_bitset_t * pstate_bitset_remove (pstate_bitset_t *domains, powman_power_domain_t domain)
static bool pstate_bitset_is_set (pstate_bitset_t *domains, powman_power_domain_t domain)
static bool pstate_bitset_none_set (pstate_bitset_t *domains)
static pstate_bitset_t * pstate_bitset_from_powman_power_state (pstate_bitset_t *domains, powman_power_state pstate)
static powman_power_state pstate_bitset_to_powman_power_state (pstate_bitset_t *domains)
powman_power_state powman_get_power_state (void)
 Get the current power state.
int powman_set_power_state (powman_power_state state)
 Set the power state.
static powman_power_state powman_power_state_with_domain_on (powman_power_state orig, enum powman_power_domains domain)
 Helper function modify a powman_power_state to turn a domain on.
static powman_power_state powman_power_state_with_domain_off (powman_power_state orig, enum powman_power_domains domain)
 Helper function modify a powman_power_state to turn a domain off.
static bool powman_power_state_is_domain_on (powman_power_state state, enum powman_power_domains domain)
 Helper function to check if a domain is on in a given powman_power_state.
void powman_enable_alarm_wakeup_at_ms (uint64_t alarm_time_ms)
 Wake up from an alarm at a given time.
void powman_enable_gpio_wakeup (uint gpio_wakeup_num, uint32_t gpio, bool edge, bool high)
 Wake up from a gpio.
void powman_disable_alarm_wakeup (void)
 Disable waking up from alarm.
void powman_disable_gpio_wakeup (uint gpio_wakeup_num)
 Disable wake up from a gpio.
void powman_disable_all_wakeups (void)
 Disable all wakeup sources.
bool powman_configure_wakeup_state (powman_power_state sleep_state, powman_power_state wakeup_state)
 Configure sleep state and wakeup state.
static void powman_set_debug_power_request_ignored (bool ignored)
 Ignore wake up when the debugger is attached.

Macro Definition Documentation

◆ pstate_bitset_all

#define pstate_bitset_all ( )
Value:
fixed_bitset_with_fill(pstate_bitset_t, POWMAN_POWER_DOMAIN_COUNT, 1)
#define fixed_bitset_with_fill(type, N, fill)
Macro used to create a bitset with all bits set to a value.
Definition fixed_bitset.h:65

◆ pstate_bitset_none

#define pstate_bitset_none ( )
Value:
fixed_bitset_with_fill(pstate_bitset_t, POWMAN_POWER_DOMAIN_COUNT, 0)