Skip to content

PMU: Prevent sleep modes from corrupting type state #110

@hannobraun

Description

@hannobraun

When entering deep-sleep or power-down mode, the PDAWAKECFG register determines which peripherals will be enabled after the system wakes up. If this configuration doesn't match the enabled peripherals before entering the power-down mode, this will corrupt the type state. This means the type state on the peripheral APIs would no longer match the state of the actual peripherals. The respective methods are currently unsafe, for that reason.

I don't have a detailed design in mind, but the following should work:

  • Add type state somewhere to represent PDAWAKECFG.
  • When entering one of the affected low-power modes, have the method take ownership of the affected peripherals.
  • After the system wakes up, return the peripherals from the method again, with a state matching PDAWAKECFG.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions