diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2020-12-02 18:05:29 -0800 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2020-12-08 10:52:25 -0800 |
| commit | 40118bcf57f026fd6a58733501c759a9ba87e835 (patch) | |
| tree | c3f00ed7deaa7dcb6effde8afb97413b5e6fcbde /supervisor/port.h | |
| parent | 1df033465a366724fbbab5ff48082593722f7c41 (diff) | |
Add `board_deinit` for use with sleep
This changes lots of files to unify `board.h` across ports. It adds
`board_deinit` when CIRCUITPY_ALARM is set. `main.c` uses it to
deinit the board before deep sleeping (even when pretending.)
Deep sleep is now a two step process for the port. First, the
port should prepare to deep sleep based on the given alarms. It
should set alarms for both deep and pretend sleep. In particular,
the pretend versions should be set immediately so that we don't
miss an alarm as we shutdown. These alarms should also wake from
`port_idle_until_interrupt` which is used when pretending to deep
sleep.
Second, when real deep sleeping, `alarm_enter_deep_sleep` is called.
The port should set any alarms it didn't during prepare based on
data it saved internally during prepare.
ESP32-S2 sleep is a bit reorganized to locate more logic with
TimeAlarm. This will help it scale to more alarm types.
Fixes #3786
Diffstat (limited to 'supervisor/port.h')
| -rw-r--r-- | supervisor/port.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/supervisor/port.h b/supervisor/port.h index 5bc06bc4e..862400986 100644 --- a/supervisor/port.h +++ b/supervisor/port.h @@ -49,9 +49,6 @@ void reset_cpu(void) NORETURN; // Reset the microcontroller state. void reset_port(void); -// Reset the rest of the board. -void reset_board(void); - // Reset to the bootloader void reset_to_bootloader(void) NORETURN; @@ -89,8 +86,9 @@ void port_disable_tick(void); // Only the common sleep routine should use it. void port_interrupt_after_ticks(uint32_t ticks); -// Sleep the CPU until an interrupt is received. -void port_sleep_until_interrupt(void); +// Sleep the CPU until an interrupt is received. We call this idle because it +// may not be a system level sleep. +void port_idle_until_interrupt(void); // Execute port specific actions during background tasks. void port_background_task(void); @@ -100,4 +98,5 @@ void port_background_task(void); // work" should be done in port_background_task() instead. void port_start_background_task(void); void port_finish_background_task(void); + #endif // MICROPY_INCLUDED_SUPERVISOR_PORT_H |
