}
-extern uint32_t mcu_os_sys_reset(uint8_t *para, uint32_t para_len);
-extern void uapi_sys_shipmode(uint32_t arg);
-extern void cm_sync_all_config_to_disk(void);
+#include "pm_control.h"
+#include "non_os_reboot.h"
+#define PM_SHIPMODE_DELAY_SLEEP_MS 100
+
+void mcu_reset(void)
+{
+ set_cpu_utils_reset_cause(REBOOT_CAUSE_APPLICATION_SYSRESETREQ);
+ hal_reboot_chip();
+}
+static void poweroff_bt_dsp_display(void)
+{
+ uapi_pm_control(PM_BT_POWER_OFF);
+ uapi_pm_control(PM_DSP_POWER_OFF);
+ uapi_pm_control(PM_DISPLAY_POWER_OFF);
+
+}
+void mcu_poweroff(void)
+{
+ /* clr ulp int and event */
+ writel(0x5702C1E4, 0x3F);
+ writel(0x5702C1EC, 0x3F);
+ osDelay(PM_SHIPMODE_DELAY_SLEEP_MS);
+
+ reg16_clrbit(0x5702c508, POS_14);
+ writew(0x5700450c, 0x100);
+
+ // gpio
+ writew(0x5702C200, 0x0);
+ writew(0x5702C204, 0x0);
+ writew(0x5702C208, 0x0);
+ writew(0x5702C20c, 0x0);
+ writew(0x5702C210, 0x0);
+
+ writew(0x5702c200, 0x7);
+ writew(0x57030004, 0x0);
+ writew(0x57030038, 0x1);
+ writew(0x5703003c, 0x1);
+ writew(0x57030034, 0x0);
+ writew(0x57030030, 0x1);
+
+ writew(0x570040d8, 0xc000);
+ writew(0x5702c028, 0x0);
+ writew(0x5702c024, 0x3);
+ writew(0x5702c1d0, 0x1);
+ writew(0x5702C038, 0x0);
+ writew(0x5702C1F0, 0x1C);
+ writew(0x5702C110, 0x101);
+ writew(0x570040d0, 0x1);
+ writew(0x570040e0, 0x1);
+}
+
//关机
void uapi_poweroff_device(void)
{
//关机保存
start_report_log();
osDelay(50);
+ //同步nand文件系统,重启mount速度快
reset_deal_with_fs();
osDelay(50);
- uapi_sys_shipmode(0);
+// uapi_sys_shipmode(0);
+ uint32_t irq = osal_irq_lock();
+ poweroff_bt_dsp_display();
+ mcu_poweroff();
+ osal_irq_restore(irq);
+
}
+
+
+
//重启
void uapi_reboot_device(void)
{
//重启前要保存时间
uapi_calendar_store_date();
-
//重启保存
stop_report_log();
+// mcu_os_sys_reset(NULL,NULL);
+ osDelay(50);
+ //同步nand文件系统,重启mount速度快
+ reset_deal_with_fs();
+ osDelay(50);
- mcu_os_sys_reset(NULL,NULL);
+ mcu_reset();
}