#ifndef POWER_INTERFACE_H #define POWER_INTERFACE_H // #include "asm/hwi.h" // #include "generic/typedef.h" #define NEW_BASEBAND_COMPENSATION 0 #define AT_VOLATILE_RAM AT(.volatile_ram) #define AT_VOLATILE_RAM_CODE AT(.volatile_ram_code) #define AT_NON_VOLATILE_RAM AT(.non_volatile_ram) #define AT_NON_VOLATILE_RAM_CODE AT(.non_volatile_ram_code) extern u32 nvbss_begin; extern u32 nvbss_length; extern u32 nvdata_begin; extern u32 nvdata_size; extern u32 nvdata_addr; #define NV_RAM_START &nvbss_begin #define NV_RAM_SIZE &nvbss_length #define NV_RAM_END (NV_RAM_START + NV_RAM_SIZE) enum { MAGIC_ADDR = 2, ENTRY_ADDR = 3, }; #define RAM1_MAGIC_ADDR (NV_RAM_END - MAGIC_ADDR*4) #define RAM1_ENTRY_ADDR (NV_RAM_END - ENTRY_ADDR*4) #define SLEEP_EN BIT(2) #define SLEEP_SAVE_TIME_US 1L #define BT_SLEEP_RECOVER_TIME_US 1500L #define LRC_SLEEP_RECOVER_TIME_US 3500L #define DEEP_SLEEP_EN BIT(1) #define DSLEEP_SAVE_BEFORE_ENTER_MS 1 #define DSLEEP_RECOVER_AFTER_EXIT_MS 10 #define DEEP_SLEEP_TIMEOUT_MIN_US (60*625L) //间隔至少要60slot以上才进入power off #define SLEEP_TICKS_UNIT (10*1000L) // #define DEEP_SLEEP_TICKS_UNIT (20*1000L) // enum { OSC_TYPE_LRC = 0, OSC_TYPE_RTC, OSC_TYPE_BT_OSC, }; enum { PWR_NO_CHANGE = 0, PWR_LDO33, PWR_LDO15, PWR_DCDC15, }; enum { LONG_4S_RESET = 0, LONG_8S_RESET, }; //Macro for VDDIOM_VOL_SEL enum { VDDIOM_VOL_22V = 0, VDDIOM_VOL_24V, VDDIOM_VOL_26V, VDDIOM_VOL_28V, VDDIOM_VOL_30V, VDDIOM_VOL_32V, VDDIOM_VOL_34V, VDDIOM_VOL_36V, }; //Macro for VDDIOW_VOL_SEL enum { VDDIOW_VOL_21V = 0, VDDIOW_VOL_24V, VDDIOW_VOL_28V, VDDIOW_VOL_32V, }; struct low_power_param { u8 osc_type; u32 btosc_hz; u8 delay_us; u8 config; u8 btosc_disable; u8 dcdc_port; u8 vddiom_lev; u8 vddiow_lev; u8 pd_wdvdd_lev; u8 vddio_keep; u8 vdc13_keep; //如果进入低功耗时哒哒声,可以将该标志置1。该位置1时,会同时keep住vddio,单耳功耗会大100ua左右,对耳会大200ua左右。(哒哒声是由于电容的效应导致的) u32 osc_delay_us; u8 virtual_rtc; u32 vir_rtc_trim_time; u8 user_nv_timer_en; u16 nv_timer_interval; u8 rtc_clk; }; #define BLUETOOTH_RESUME BIT(1) #define RISING_EDGE 0 #define FALLING_EDGE 1 typedef enum { PORT_FLT_NULL = 0, PORT_FLT_32us, PORT_FLT_64us, PORT_FLT_128us, PORT_FLT_256us, PORT_FLT_512us, PORT_FLT_1ms, PORT_FLT_2ms, } PORT_FLT; struct port_wakeup { u8 pullup_down_enable; // u8 edge; //[0]: Rising / [1]: Falling u8 attribute; //Relate operation bitmap OS_RESUME | BLUETOOTH_RESUME u8 iomap; //Port Group-Port Index u8 filter_enable; }; struct charge_wakeup { u8 attribute; //Relate operation bitmap OS_RESUME | BLUETOOTH_RESUME }; struct alarm_wakeup { u8 attribute; //Relate operation bitmap OS_RESUME | BLUETOOTH_RESUME }; struct lvd_wakeup { u8 attribute; //Relate operation bitmap OS_RESUME | BLUETOOTH_RESUME }; struct sub_wakeup { u8 attribute; //Relate operation bitmap OS_RESUME | BLUETOOTH_RESUME }; //