Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMU: Prevent sleep modes from corrupting type state #110

Open
hannobraun opened this issue Jun 15, 2018 · 0 comments
Open

PMU: Prevent sleep modes from corrupting type state #110

hannobraun opened this issue Jun 15, 2018 · 0 comments

Comments

@hannobraun
Copy link
Member

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant