Software APIs
Data Structures | Typedefs | Enumerations | Functions
dif_pwrmgr.h File Reference

(dcee03a)

Power Manager Device Interface Functions More...

#include <stdint.h>
#include "sw/device/lib/base/mmio.h"
#include "sw/device/lib/dif/dif_warn_unused_result.h"

Go to the source code of this file.

Data Structures

struct  dif_pwrmgr_params
 Hardware instantiation parameters for power manager. More...
 
struct  dif_pwrmgr
 A handle to power manager. More...
 
struct  dif_pwrmgr_wakeup_reason
 Wakeup types and requests from sources since the last time recording started. More...
 

Typedefs

typedef enum dif_pwrmgr_toggle dif_pwrmgr_toggle_t
 Enumeration for enabling/disabling various functionality.
 
typedef struct dif_pwrmgr_params dif_pwrmgr_params_t
 Hardware instantiation parameters for power manager. More...
 
typedef struct dif_pwrmgr dif_pwrmgr_t
 A handle to power manager. More...
 
typedef enum dif_pwrmgr_req_type dif_pwrmgr_req_type_t
 A request type, i.e. More...
 
typedef enum dif_pwrmgr_domain_option dif_pwrmgr_domain_option_t
 Options for enabling/disabling various clock and power domains in low and active power states. More...
 
typedef uint8_t dif_pwrmgr_domain_config_t
 A set of domain options. More...
 
typedef enum dif_pwrmgr_wakeup_request_source dif_pwrmgr_wakeup_request_source_t
 A wakeup request source. More...
 
typedef enum dif_pwrmgr_reset_request_source dif_pwrmgr_reset_request_source_t
 A reset request source. More...
 
typedef uint32_t dif_pwrmgr_request_sources_t
 A set of request sources. More...
 
typedef enum dif_pwrmgr_wakeup_type dif_pwrmgr_wakeup_type_t
 A wakeup type. More...
 
typedef uint8_t dif_pwrmgr_wakeup_types_t
 A set of wakeup types. More...
 
typedef struct dif_pwrmgr_wakeup_reason dif_pwrmgr_wakeup_reason_t
 Wakeup types and requests from sources since the last time recording started.
 
typedef enum dif_pwrmgr_result dif_pwrmgr_result_t
 Result of a power manager operation.
 
typedef enum dif_pwrmgr_config_result dif_pwrmgr_config_result_t
 Result of a power manager operation that writes to lockable configuration registers.
 
typedef enum dif_pwrmgr_irq dif_pwrmgr_irq_t
 Power manager interrupts.
 
typedef uint32_t dif_pwrmgr_irq_snapshot_t
 A snapshot of the enablement state of power manager interrupts. More...
 

Enumerations

enum  dif_pwrmgr_toggle {
  kDifPwrmgrToggleEnabled,
  kDifPwrmgrToggleDisabled
}
 Enumeration for enabling/disabling various functionality. More...
 
enum  dif_pwrmgr_req_type {
  kDifPwrmgrReqTypeWakeup,
  kDifPwrmgrReqTypeReset
}
 A request type, i.e. More...
 
enum  dif_pwrmgr_domain_option {
  kDifPwrmgrDomainOptionCoreClockInLowPower = (1u << 0),
  kDifPwrmgrDomainOptionIoClockInLowPower = (1u << 1),
  kDifPwrmgrDomainOptionUsbClockInLowPower = (1u << 2),
  kDifPwrmgrDomainOptionUsbClockInActivePower = (1u << 3),
  kDifPwrmgrDomainOptionMainPowerInLowPower = (1u << 4)
}
 Options for enabling/disabling various clock and power domains in low and active power states. More...
 
enum  dif_pwrmgr_wakeup_request_source {
  kDifPwrmgrWakeupRequestSourceOne = (1u << 0),
  kDifPwrmgrWakeupRequestSourceTwo = (1u << 1),
  kDifPwrmgrWakeupRequestSourceThree = (1u << 2),
  kDifPwrmgrWakeupRequestSourceFour = (1u << 3)
}
 A wakeup request source. More...
 
enum  dif_pwrmgr_reset_request_source { kDifPwrmgrResetRequestSourceOne = (1u << 0) }
 A reset request source. More...
 
enum  dif_pwrmgr_wakeup_type {
  kDifPwrmgrWakeupTypeRequest = (1u << 0),
  kDifPwrmgrWakeupTypeFallThrough = (1u << 1),
  kDifPwrmgrWakeupTypeAbort = (1u << 2)
}
 A wakeup type. More...
 
enum  dif_pwrmgr_result {
  kDifPwrmgrOk = 0,
  kDifPwrmgrError = 1,
  kDifPwrmgrBadArg = 2
}
 Result of a power manager operation. More...
 
enum  dif_pwrmgr_config_result {
  kDifPwrmgrConfigOk = kDifPwrmgrOk,
  kDifPwrmgrConfigError = kDifPwrmgrError,
  kDifPwrmgrConfigBadArg = kDifPwrmgrBadArg,
  kDifPwrMgrConfigLocked
}
 Result of a power manager operation that writes to lockable configuration registers. More...
 
enum  dif_pwrmgr_irq {
  kDifPwrmgrIrqWakeup = 0,
  kDifPwrmgrIrqLast = kDifPwrmgrIrqWakeup
}
 Power manager interrupts. More...
 

Functions

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_init (dif_pwrmgr_params_t params, dif_pwrmgr_t *pwrmgr)
 Creates a new handle for power manager. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_config_result_t dif_pwrmgr_low_power_set_enabled (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_toggle_t new_state)
 Enables or disables low power state. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_low_power_get_enabled (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_toggle_t *cur_state)
 Checks whether low power state is enabled. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_config_result_t dif_pwrmgr_set_domain_config (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_domain_config_t config)
 Configures power manager to enable/disable various clock and power domains in low and active power states. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_get_domain_config (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_domain_config_t *config)
 Gets current power manager configuration. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_config_result_t dif_pwrmgr_set_request_sources (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_req_type_t req_type, dif_pwrmgr_request_sources_t sources)
 Sets sources enabled for a request type. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_get_request_sources (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_req_type_t req_type, dif_pwrmgr_request_sources_t *sources)
 Gets sources enabled for a request type. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_get_current_request_sources (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_req_type_t req_type, dif_pwrmgr_request_sources_t *sources)
 Gets request sources that are currently active for a request type. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_request_sources_lock (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_req_type_t req_type)
 Locks sources of a request type. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_request_sources_is_locked (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_req_type_t req_type, bool *is_locked)
 Checks whether sources of a request type is locked. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_wakeup_request_recording_set_enabled (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_toggle_t new_state)
 Enables or disables recording of wakeup requests. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_wakeup_request_recording_get_enabled (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_toggle_t *cur_state)
 Checks whether wakeup requests are being recorded. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_wakeup_reason_get (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_wakeup_reason_t *reason)
 Gets wakeup reason and source requests since the last time recording started. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_wakeup_reason_clear (const dif_pwrmgr_t *pwrmgr)
 Clears wakeup reason(s) recorded since the last time recording started. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_is_pending (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_irq_t irq, bool *is_pending)
 Returns whether a particular interrupt is currently pending. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_acknowledge (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_irq_t irq)
 Acknowledges a particular interrupt, indicating to the hardware that it has been successfully serviced. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_get_enabled (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_irq_t irq, dif_pwrmgr_toggle_t *state)
 Checks whether a particular interrupt is currently enabled or disabled. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_set_enabled (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_irq_t irq, dif_pwrmgr_toggle_t state)
 Sets whether a particular interrupt is currently enabled or disabled. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_force (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_irq_t irq)
 Forces a particular interrupt, causing it to be serviced as if hardware had asserted it. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_disable_all (const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_irq_snapshot_t *snapshot)
 Disables all interrupts, optionally snapshotting all toggle state for later restoration. More...
 
DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_restore_all (const dif_pwrmgr_t *pwrmgr, const dif_pwrmgr_irq_snapshot_t *snapshot)
 Restores interrupts from the given snapshot. More...
 

Detailed Description

Power Manager Device Interface Functions

Definition in file dif_pwrmgr.h.


Data Structure Documentation

◆ dif_pwrmgr_params

struct dif_pwrmgr_params

Hardware instantiation parameters for power manager.

This struct describes information about the underlying hardware that is not determined until the hardware design is used as part of a top-level design.

Definition at line 44 of file dif_pwrmgr.h.

Data Fields
mmio_region_t base_addr Base address of power manager registers.

◆ dif_pwrmgr

struct dif_pwrmgr

A handle to power manager.

This type should be treated as opaque by users.

Definition at line 56 of file dif_pwrmgr.h.

Data Fields
dif_pwrmgr_params_t params Hardware instantiation parameters.

◆ dif_pwrmgr_wakeup_reason

struct dif_pwrmgr_wakeup_reason

Wakeup types and requests from sources since the last time recording started.

Definition at line 198 of file dif_pwrmgr.h.

Data Fields
dif_pwrmgr_request_sources_t request_sources Sources that requested wakeup since the last time recording started.
dif_pwrmgr_wakeup_types_t types Wakeup types since the last time recording started.

Typedef Documentation

◆ dif_pwrmgr_domain_config_t

typedef uint8_t dif_pwrmgr_domain_config_t

A set of domain options.

This type is used for specifying and querying which clock and power domains are enabled in low and active power states.

See also: dif_pwrmgr_domain_option_t.

Definition at line 116 of file dif_pwrmgr.h.

◆ dif_pwrmgr_domain_option_t

Options for enabling/disabling various clock and power domains in low and active power states.

Constants below are bitmasks that can be combined to define configurations.

See also: dif_pwrmgr_domain_config_t.

◆ dif_pwrmgr_irq_snapshot_t

typedef uint32_t dif_pwrmgr_irq_snapshot_t

A snapshot of the enablement state of power manager interrupts.

This is an opaque type, to be used with the dif_pwrmgr_irq_disable_all() and dif_pwrmgr_irq_restore_all() functions.

Definition at line 276 of file dif_pwrmgr.h.

◆ dif_pwrmgr_params_t

Hardware instantiation parameters for power manager.

This struct describes information about the underlying hardware that is not determined until the hardware design is used as part of a top-level design.

◆ dif_pwrmgr_req_type_t

A request type, i.e.

wakeup or reset.

◆ dif_pwrmgr_request_sources_t

typedef uint32_t dif_pwrmgr_request_sources_t

A set of request sources.

This type is used for specifying which request sources are enabled for a particular request type, i.e. wakeup or reset, as well querying wakeup reasons.

See also: dif_pwrmgr_wakeup_request_source_t, dif_pwrmgr_reset_request_source_t.

Definition at line 159 of file dif_pwrmgr.h.

◆ dif_pwrmgr_reset_request_source_t

A reset request source.

Constants below are bitmasks that can be used to define sets of reset request sources.

See also: dif_pwrmgr_request_sources_t.

Note: This needs to be updated once the HW is finalized.

◆ dif_pwrmgr_t

typedef struct dif_pwrmgr dif_pwrmgr_t

A handle to power manager.

This type should be treated as opaque by users.

◆ dif_pwrmgr_wakeup_request_source_t

A wakeup request source.

Constants below are bitmasks that can be used to define sets of wakeup request sources.

See also: dif_pwrmgr_request_sources_t.

Note: This needs to be updated once the HW is finalized.

◆ dif_pwrmgr_wakeup_type_t

A wakeup type.

Constants below are bitmasks that can be used to define sets of wakeup types.

See also: dif_pwrmgr_wakeup_types_t.

◆ dif_pwrmgr_wakeup_types_t

typedef uint8_t dif_pwrmgr_wakeup_types_t

A set of wakeup types.

See also: dif_pwrmgr_wakeup_type_t.

Definition at line 193 of file dif_pwrmgr.h.

Enumeration Type Documentation

◆ dif_pwrmgr_config_result

Result of a power manager operation that writes to lockable configuration registers.

Enumerator
kDifPwrmgrConfigOk 

The call succeeded.

kDifPwrmgrConfigError 

A non-specific error occurred and the hardware is in an invalid or irrecoverable state.

kDifPwrmgrConfigBadArg 

The caller supplied invalid arguments but the call did not cause any side-effects and the hardware is in a valid and recoverable state.

kDifPwrMgrConfigLocked 

The register that needs to be written to is locked.

Definition at line 233 of file dif_pwrmgr.h.

◆ dif_pwrmgr_domain_option

Options for enabling/disabling various clock and power domains in low and active power states.

Constants below are bitmasks that can be combined to define configurations.

See also: dif_pwrmgr_domain_config_t.

Enumerator
kDifPwrmgrDomainOptionCoreClockInLowPower 

Enable core clock in low power state.

kDifPwrmgrDomainOptionIoClockInLowPower 

Enable input/output (IO) clock in low power state.

kDifPwrmgrDomainOptionUsbClockInLowPower 

Enable USB clock in low power state.

kDifPwrmgrDomainOptionUsbClockInActivePower 

Enable USB clock in active power state.

kDifPwrmgrDomainOptionMainPowerInLowPower 

Enable main power domain in low power state.

Definition at line 85 of file dif_pwrmgr.h.

◆ dif_pwrmgr_irq

Power manager interrupts.

Enumerator
kDifPwrmgrIrqWakeup 

The device woke up from low power state.

Note: This interrupt is not triggered during power-on reset.

Definition at line 257 of file dif_pwrmgr.h.

◆ dif_pwrmgr_req_type

A request type, i.e.

wakeup or reset.

Enumerator
kDifPwrmgrReqTypeWakeup 

A wakeup request.

kDifPwrmgrReqTypeReset 

A reset request.

Definition at line 66 of file dif_pwrmgr.h.

◆ dif_pwrmgr_reset_request_source

A reset request source.

Constants below are bitmasks that can be used to define sets of reset request sources.

See also: dif_pwrmgr_request_sources_t.

Note: This needs to be updated once the HW is finalized.

Definition at line 145 of file dif_pwrmgr.h.

◆ dif_pwrmgr_result

Result of a power manager operation.

Enumerator
kDifPwrmgrOk 

The call succeeded.

kDifPwrmgrError 

A non-specific error occurred and the hardware is in an invalid or irrecoverable state.

kDifPwrmgrBadArg 

The caller supplied invalid arguments but the call did not cause any side-effects and the hardware is in a valid and recoverable state.

Definition at line 212 of file dif_pwrmgr.h.

◆ dif_pwrmgr_toggle

Enumeration for enabling/disabling various functionality.

Enumerator
kDifPwrmgrToggleEnabled 

Enabled state.

kDifPwrmgrToggleDisabled 

Disabled state.

Definition at line 26 of file dif_pwrmgr.h.

◆ dif_pwrmgr_wakeup_request_source

A wakeup request source.

Constants below are bitmasks that can be used to define sets of wakeup request sources.

See also: dif_pwrmgr_request_sources_t.

Note: This needs to be updated once the HW is finalized.

Definition at line 128 of file dif_pwrmgr.h.

◆ dif_pwrmgr_wakeup_type

A wakeup type.

Constants below are bitmasks that can be used to define sets of wakeup types.

See also: dif_pwrmgr_wakeup_types_t.

Enumerator
kDifPwrmgrWakeupTypeRequest 

Wakeup due to a peripheral request.

kDifPwrmgrWakeupTypeFallThrough 

Despite low power mode being enabled and executing a wait for interrupt (WFI) instruction, an interrupt arrived at just the right time to break the executing core out of WFI.

kDifPwrmgrWakeupTypeAbort 

Despite low power mode being enabled and executing a wait for interrupt (WFI) instruction, an active flash, life cycle, or OTP operation was in progress when the power controller attempted to initiate low power entry.

Definition at line 168 of file dif_pwrmgr.h.

Function Documentation

◆ dif_pwrmgr_get_current_request_sources()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_get_current_request_sources ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_req_type_t  req_type,
dif_pwrmgr_request_sources_t sources 
)

Gets request sources that are currently active for a request type.

Parameters
pwrmgrA power manager handle.
req_typeA request type.
[out]sourcesRequest sources that are currently active for the given request type.
Returns
The result of the operation.

Definition at line 370 of file dif_pwrmgr.c.

◆ dif_pwrmgr_get_domain_config()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_get_domain_config ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_domain_config_t config 
)

Gets current power manager configuration.

Parameters
pwrmgrA power manager handle.
[out]configCurrent configuration.
Returns
The result of the operation.

Definition at line 314 of file dif_pwrmgr.c.

◆ dif_pwrmgr_get_request_sources()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_get_request_sources ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_req_type_t  req_type,
dif_pwrmgr_request_sources_t sources 
)

Gets sources enabled for a request type.

A wakeup or reset request can be triggered by multiple sources, e.g. GPIO, watchdog timer, USB, etc. This function gets which sources are enabled for a particular request type.

Parameters
pwrmgrA power manager handle.
req_typeA request type.
[out]sourcesSources enabled for the given request type.
Returns
The result of the operation.

Definition at line 355 of file dif_pwrmgr.c.

◆ dif_pwrmgr_init()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_init ( dif_pwrmgr_params_t  params,
dif_pwrmgr_t pwrmgr 
)

Creates a new handle for power manager.

This function does not actuate the hardware.

Parameters
paramsHardware instantiation parameters.
[out]pwrmgrOut-param for the initialized handle.
Returns
The result of the operation.

Definition at line 239 of file dif_pwrmgr.c.

◆ dif_pwrmgr_irq_acknowledge()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_acknowledge ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_irq_t  irq 
)

Acknowledges a particular interrupt, indicating to the hardware that it has been successfully serviced.

Parameters
pwrmgrA power manager handle.
irqAn interrupt type.
Returns
The result of the operation.

Definition at line 504 of file dif_pwrmgr.c.

◆ dif_pwrmgr_irq_disable_all()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_disable_all ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_irq_snapshot_t snapshot 
)

Disables all interrupts, optionally snapshotting all toggle state for later restoration.

Parameters
pwrmgrA power manager handle.
[out]snapshotOut-param for the snapshot; may be NULL.
Returns
The result of the operation.

Definition at line 565 of file dif_pwrmgr.c.

◆ dif_pwrmgr_irq_force()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_force ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_irq_t  irq 
)

Forces a particular interrupt, causing it to be serviced as if hardware had asserted it.

Parameters
pwrmgrA power manager handle.
irqAn interrupt type.
Returns
The result of the operation.

Definition at line 552 of file dif_pwrmgr.c.

◆ dif_pwrmgr_irq_get_enabled()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_get_enabled ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_irq_t  irq,
dif_pwrmgr_toggle_t state 
)

Checks whether a particular interrupt is currently enabled or disabled.

Parameters
pwrmgrA power manager handle.
irqAn interrupt type.
[out]stateOut-param toggle state of the interrupt.
Returns
The result of the operation.

Definition at line 517 of file dif_pwrmgr.c.

◆ dif_pwrmgr_irq_is_pending()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_is_pending ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_irq_t  irq,
bool *  is_pending 
)

Returns whether a particular interrupt is currently pending.

Parameters
pwrmgrA power manager handle.
irqAn interrupt type.
[out]is_pendingOut-param for whether the interrupt is pending.
Returns
The result of the operation.

Definition at line 490 of file dif_pwrmgr.c.

◆ dif_pwrmgr_irq_restore_all()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_restore_all ( const dif_pwrmgr_t pwrmgr,
const dif_pwrmgr_irq_snapshot_t snapshot 
)

Restores interrupts from the given snapshot.

This function can be used with dif_pwrmgr_irq_disable_all() to temporary interrupt save-and-restore.

Parameters
pwrmgrA power manager handle.
snapshotA snapshot to restore from.
Returns
The result of the operation.

Definition at line 581 of file dif_pwrmgr.c.

◆ dif_pwrmgr_irq_set_enabled()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_irq_set_enabled ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_irq_t  irq,
dif_pwrmgr_toggle_t  state 
)

Sets whether a particular interrupt is currently enabled or disabled.

Parameters
pwrmgrA power manager handle.
irqAn interrupt type.
stateThe new toggle state for the interrupt.
Returns
The result of the operation.

Definition at line 531 of file dif_pwrmgr.c.

◆ dif_pwrmgr_low_power_get_enabled()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_low_power_get_enabled ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_toggle_t cur_state 
)

Checks whether low power state is enabled.

Parameters
pwrmgrA power manager handle.
[out]cur_stateWhether low power state is enabled.
Returns
The result of the operation.

Definition at line 278 of file dif_pwrmgr.c.

◆ dif_pwrmgr_low_power_set_enabled()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_config_result_t dif_pwrmgr_low_power_set_enabled ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_toggle_t  new_state 
)

Enables or disables low power state.

When enabled, the power manager transitions to low power state on the next wait for interrupt (WFI) instruction. Since the hardware clears the corresponding bit automatically, this function must be called before each transition to low power state.

Note: This function also syncs changes to the slow clock domain for them to take effect.

Parameters
pwrmgrA power manager handle.
new_stateWhether low power state is enabled.
Returns
The result of the operation.

Definition at line 250 of file dif_pwrmgr.c.

◆ dif_pwrmgr_request_sources_is_locked()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_request_sources_is_locked ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_req_type_t  req_type,
bool *  is_locked 
)

Checks whether sources of a request type is locked.

Parameters
pwrmgrA power manager handle.
req_typeA request type.
[out]is_lockedWhether sources of the given request type is locked.
Returns
The result of the operation.

Definition at line 399 of file dif_pwrmgr.c.

◆ dif_pwrmgr_request_sources_lock()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_request_sources_lock ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_req_type_t  req_type 
)

Locks sources of a request type.

Once the sources of a particular request type is locked, they cannot be changed until the hardware is reset.

Parameters
pwrmgrA power manager handle.
req_typeA request type.
Returns
The result of the operation.

Definition at line 385 of file dif_pwrmgr.c.

◆ dif_pwrmgr_set_domain_config()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_config_result_t dif_pwrmgr_set_domain_config ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_domain_config_t  config 
)

Configures power manager to enable/disable various clock and power domains in low and active power states.

Note: This function also syncs changes to the slow clock domain for them to take effect.

Parameters
pwrmgrA power manager handle.
configA domain configuration.
Returns
The result of the operation.

Definition at line 292 of file dif_pwrmgr.c.

◆ dif_pwrmgr_set_request_sources()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_config_result_t dif_pwrmgr_set_request_sources ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_req_type_t  req_type,
dif_pwrmgr_request_sources_t  sources 
)

Sets sources enabled for a request type.

A wakeup or reset request can be triggered by multiple sources, e.g. GPIO, watchdog timer, USB, etc. This function sets which sources are enabled for a particular request type.

Note: This function also syncs changes to the slow clock domain for them to take effect.

Parameters
pwrmgrA power manager handle.
req_typeA request type.
sourcesSources enabled for the given request type.
Returns
The result of the operation.

Definition at line 327 of file dif_pwrmgr.c.

◆ dif_pwrmgr_wakeup_reason_clear()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_wakeup_reason_clear ( const dif_pwrmgr_t pwrmgr)

Clears wakeup reason(s) recorded since the last time recording started.

Parameters
pwrmgrA power manager handle.
Returns
The result of the operation.

Definition at line 479 of file dif_pwrmgr.c.

◆ dif_pwrmgr_wakeup_reason_get()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_wakeup_reason_get ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_wakeup_reason_t reason 
)

Gets wakeup reason and source requests since the last time recording started.

Power manager automatically starts recording wakeup requests when it begins a valid low power entry. Recording continues until it is explicitly disabled by calling dif_pwrmgr_wakeup_request_recording_set_enabled. Thus, it is possible to record wakeup requests from multiple sources as well as multiple wakeup types.

Parameters
pwrmgrA power manager handle.
[out]reasonWakeup reasons.
Returns
The result of the operation.

Definition at line 448 of file dif_pwrmgr.c.

◆ dif_pwrmgr_wakeup_request_recording_get_enabled()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_wakeup_request_recording_get_enabled ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_toggle_t cur_state 
)

Checks whether wakeup requests are being recorded.

Parameters
pwrmgrA power manager handle.
[out]cur_stateWhether wakeup requests are being recorded.
Returns
The result of the operation.

Definition at line 433 of file dif_pwrmgr.c.

◆ dif_pwrmgr_wakeup_request_recording_set_enabled()

DIF_WARN_UNUSED_RESULT dif_pwrmgr_result_t dif_pwrmgr_wakeup_request_recording_set_enabled ( const dif_pwrmgr_t pwrmgr,
dif_pwrmgr_toggle_t  new_state 
)

Enables or disables recording of wakeup requests.

Power manager automatically starts recording wakeup requests when it begins a valid low power entry. Recording continues until it is explicitly disabled by calling this function.

Parameters
pwrmgrA power manager handle.
new_stateWhether wakeup requests should be recorded.
Returns
The result of the operation.

Definition at line 411 of file dif_pwrmgr.c.