From 3f913efda03fd840cd526ef72e6f397c7da61bd7 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Tue, 9 Aug 2022 22:23:08 +0200 Subject: code layout --- fw/fe310/eos/soc/pwr.c | 65 +------------------------------------------------- 1 file changed, 1 insertion(+), 64 deletions(-) (limited to 'fw/fe310/eos/soc/pwr.c') diff --git a/fw/fe310/eos/soc/pwr.c b/fw/fe310/eos/soc/pwr.c index 802e593..a2adfd4 100644 --- a/fw/fe310/eos/soc/pwr.c +++ b/fw/fe310/eos/soc/pwr.c @@ -5,22 +5,14 @@ #include "platform.h" #include "eos.h" -#include "event.h" #include "timer.h" -#include "spi.h" -#include "spi_dev.h" -#include "net.h" -#include "lcd.h" -#include "eve/eve.h" +#include "dev/net.h" #include "pwr.h" #define PWR_RTC_SCALE 15 #define PWR_RTC_SFREQ (EOS_TIMER_RTC_FREQ >> PWR_RTC_SCALE) -static eos_evt_handler_t evt_handler[EOS_PWR_MAX_MTYPE]; -static unsigned char power_btn_down; - int eos_pwr_init(uint8_t wakeup_cause) { AON_REG(AON_PMUKEY) = 0x51F15E; AON_REG(AON_PMUIE) = 0x5; @@ -44,13 +36,6 @@ uint8_t eos_pwr_reset_cause(void) { int eos_pwr_sleep(void) { int rv; - rv = eos_lcd_sleep(); - if (rv) return rv; - - eos_spi_select(EOS_SPI_DEV_EVE); - eve_pwr_sleep(); - eos_spi_deselect(); - rv = eos_net_sleep(1000); if (rv) return rv; @@ -83,51 +68,3 @@ void eos_pwr_wake_disable(void) { AON_REG(AON_PMUKEY) = 0x51F15E; AON_REG(AON_PMUIE) = pmuie; } - -static void pwr_handle_msg(unsigned char type, unsigned char *buffer, uint16_t len) { - unsigned char mtype; - - if ((buffer == NULL) || (len < 1)) { - eos_net_bad_handler(type, buffer, len); - return; - } - - mtype = buffer[0]; - if ((mtype < EOS_PWR_MAX_MTYPE) && evt_handler[mtype]) { - evt_handler[mtype](mtype, buffer, len); - } else { - eos_net_bad_handler(type, buffer, len); - } -} - -static void pwr_handle_btn(unsigned char type, unsigned char *buffer, uint16_t len) { - unsigned char level = buffer[1]; - - eos_net_free(buffer, 0); - if (!level) { - power_btn_down = 1; - return; - } - if (!power_btn_down) return; - - eos_pwr_sleep(); -} - -void eos_pwr_netinit(void) { - int i; - - for (i=0; i