From 58f41971b1e801ad2fbcea08e5152afa2b18ca73 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Mon, 28 Jul 2025 23:27:12 +0200 Subject: sys logging added; power management reimplemented; bugfixes; --- fw/fe310/eos/dev/pwr.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'fw/fe310/eos/dev/pwr.c') diff --git a/fw/fe310/eos/dev/pwr.c b/fw/fe310/eos/dev/pwr.c index c6537cb..06a76d8 100644 --- a/fw/fe310/eos/dev/pwr.c +++ b/fw/fe310/eos/dev/pwr.c @@ -2,6 +2,8 @@ #include #include "eos.h" +#include "log.h" +#include "event.h" #include "soc/pwr.h" #include "eve/eve.h" #include "eve/eve_touch_engine.h" @@ -15,34 +17,33 @@ #include "pwr.h" +static void pwr_sleep_rdy(void) { + if ((eos_evtq_len() == 0) && eos_net_sleep_rdy()) { + eos_eve_save2aon(); + eos_net_save2aon(); + eos_flash_norm(); #ifdef EOS_DEBUG -#include + EOS_LOG(EOS_LOG_INFO, "PWR SLEEP\n"); + eos_sleep(100); #endif + eos_pwr_sleep(); + } +} void eos_pwr_sys_sleep(void) { int rv; rv = eos_lcd_sleep(); -#ifdef EOS_DEBUG - if (rv) printf("PWR SLEEP: LCD SLEEP ERR:%d\n", rv); -#endif + if (rv) EOS_LOG(EOS_LOG_ERR, "PWR SLEEP: LCD SLEEP ERR:%d\n", rv); rv = eos_ctp_sleep(); -#ifdef EOS_DEBUG - if (rv) printf("PWR SLEEP: CTP SLEEP ERR:%d\n", rv); -#endif + if (rv) EOS_LOG(EOS_LOG_ERR, "PWR SLEEP: CTP SLEEP ERR:%d\n", rv); rv = eos_eve_sleep(); -#ifdef EOS_DEBUG - if (rv) printf("PWR SLEEP: EVE SLEEP ERR:%d\n", rv); -#endif - - rv = eos_net_sleep(1000); -#ifdef EOS_DEBUG - if (rv) printf("PWR SLEEP: NET SLEEP ERR:%d\n", rv); -#endif + if (rv) EOS_LOG(EOS_LOG_ERR, "PWR SLEEP: EVE SLEEP ERR:%d\n", rv); - eos_flash_norm(); + eos_evtq_set_loopf(pwr_sleep_rdy); - eos_pwr_sleep(); + rv = eos_net_sleep(); + if (rv) EOS_LOG(EOS_LOG_ERR, "PWR SLEEP: NET SLEEP REQ ERR:%d\n", rv); } -- cgit v1.2.3