diff options
Diffstat (limited to 'fw/fe310/eos/dev/pwr.c')
-rw-r--r-- | fw/fe310/eos/dev/pwr.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/fw/fe310/eos/dev/pwr.c b/fw/fe310/eos/dev/pwr.c new file mode 100644 index 0000000..06a76d8 --- /dev/null +++ b/fw/fe310/eos/dev/pwr.c @@ -0,0 +1,49 @@ +#include <stdlib.h> +#include <stdint.h> + +#include "eos.h" +#include "log.h" +#include "event.h" +#include "soc/pwr.h" +#include "eve/eve.h" +#include "eve/eve_touch_engine.h" + +#include "eve.h" +#include "lcd.h" +#include "ctp.h" +#include "net.h" +#include "flash.h" +#include "aon.h" + +#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 + 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(); + if (rv) EOS_LOG(EOS_LOG_ERR, "PWR SLEEP: LCD SLEEP ERR:%d\n", rv); + + rv = eos_ctp_sleep(); + if (rv) EOS_LOG(EOS_LOG_ERR, "PWR SLEEP: CTP SLEEP ERR:%d\n", rv); + + rv = eos_eve_sleep(); + if (rv) EOS_LOG(EOS_LOG_ERR, "PWR SLEEP: EVE SLEEP ERR:%d\n", rv); + + eos_evtq_set_loopf(pwr_sleep_rdy); + + rv = eos_net_sleep(); + if (rv) EOS_LOG(EOS_LOG_ERR, "PWR SLEEP: NET SLEEP REQ ERR:%d\n", rv); +} |