From 1f3d69d87c6d708ccf574af61a434b77637c900b Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Sun, 20 Jun 2021 17:57:51 -0400 Subject: [PATCH] Clean up sleep memory, mark as not-implemented --- locale/circuitpython.pot | 1 + .../common-hal/alarm/SleepMemory.c | 24 ++++--------------- .../common-hal/alarm/SleepMemory.h | 15 ------------ 3 files changed, 5 insertions(+), 35 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index d1c27c180a..a0096b35b9 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2026,6 +2026,7 @@ msgstr "" msgid "Size not supported" msgstr "" +#: ports/raspberrypi/common-hal/alarm/SleepMemory.c #: ports/stm/common-hal/alarm/SleepMemory.c msgid "Sleep Memory not available" msgstr "" diff --git a/ports/raspberrypi/common-hal/alarm/SleepMemory.c b/ports/raspberrypi/common-hal/alarm/SleepMemory.c index a444cbf207..b8fcdfbccf 100644 --- a/ports/raspberrypi/common-hal/alarm/SleepMemory.c +++ b/ports/raspberrypi/common-hal/alarm/SleepMemory.c @@ -29,35 +29,19 @@ #include "py/runtime.h" #include "common-hal/alarm/SleepMemory.h" -// Data storage for singleton instance of SleepMemory. -// Might be RTC_SLOW_MEM or RTC_FAST_MEM, depending on setting of CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM. -// static RTC_DATA_ATTR uint8_t _sleep_mem[SLEEP_MEMORY_LENGTH]; - void alarm_sleep_memory_reset(void) { - // ESP-IDF build system takes care of doing esp_sleep_pd_config() or the equivalentwith - // the correct settings, depending on which RTC mem we are using. - // https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/system/sleep_modes.html#power-down-of-rtc-peripherals-and-memories } uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) { - return 0;// sizeof(_sleep_mem); + mp_raise_NotImplementedError(translate("Sleep Memory not available")); + return 0; } bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, const uint8_t *values, uint32_t len) { - - // if (start_index + len > sizeof(_sleep_mem)) { - // return false; - // } - - // memcpy((uint8_t *)(_sleep_mem + start_index), values, len); - // return true; + mp_raise_NotImplementedError(translate("Sleep Memory not available")); return false; } void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, uint8_t *values, uint32_t len) { - - // if (start_index + len > sizeof(_sleep_mem)) { - // return; - // } - // memcpy(values, (uint8_t *)(_sleep_mem + start_index), len); + mp_raise_NotImplementedError(translate("Sleep Memory not available")); } diff --git a/ports/raspberrypi/common-hal/alarm/SleepMemory.h b/ports/raspberrypi/common-hal/alarm/SleepMemory.h index 427fe30a8c..59d0429c3b 100644 --- a/ports/raspberrypi/common-hal/alarm/SleepMemory.h +++ b/ports/raspberrypi/common-hal/alarm/SleepMemory.h @@ -29,21 +29,6 @@ #include "py/obj.h" -// There are several places we could store persistent data for SleepMemory: -// -// RTC registers: There are a few 32-bit registers maintained during deep sleep. -// We are already using one for saving sleep information during deep sleep. -// -// RTC Fast Memory: 8kB, also used for deep-sleep power-on stub. -// RTC Slow Memory: 8kB, also used for the ULP (tiny co-processor available during sleep). -// -// The ESP-IDF build system takes care of the power management of these regions. -// RTC_DATA_ATTR will allocate storage in RTC_SLOW_MEM unless CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM -// is set. Any memory not allocated by us can be used by the ESP-IDF for heap or other purposes. - -// Use half of RTC_SLOW_MEM or RTC_FAST_MEM. -#define SLEEP_MEMORY_LENGTH (4096) - typedef struct { mp_obj_base_t base; } alarm_sleep_memory_obj_t;