产测中添加关闭蓝牙cat1进行睡眠电流测试的按钮
authorSnickerSun <snickersun@163.com>
Sat, 27 Apr 2024 11:54:14 +0000 (19:54 +0800)
committerSnickerSun <snickersun@163.com>
Sat, 27 Apr 2024 11:54:14 +0000 (19:54 +0800)
code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp
code/sdk/drivers/peripheral/utils/custom_utils.c
code/sdk/drivers/peripheral/utils/custom_utils.h

index f9d538c..c79d6a1 100644 (file)
@@ -35,6 +35,7 @@ namespace OHOS
         HRSENSON,\r
         GSENSON,\r
         OLDTEST,\r
+        DEEPSLEEP,\r
         shutdown,\r
         TEST_1,\r
         \r
index b71341d..65ea32f 100644 (file)
@@ -52,6 +52,7 @@ namespace OHOS
         {HRSENSON,"hrsensonbutton", "gsensonbutton_next",true},\r
         {GSENSON,"gsensonbutton","xxxx" ,true},\r
         {OLDTEST,"oldtestbutton","oldtestexit",true},\r
+        {DEEPSLEEP,"deepsleep","xxxxxxxxx",true},\r
         {shutdown,"shutdown","xxxxxxxxx",true},\r
         };\r
         // {FACTORYRESETVIEW,"FactoryResetButton",true},\r
@@ -199,7 +200,16 @@ namespace OHOS
         {\r
             uapi_poweroff_device();\r
         }\r
-\r
+        if(strcmp(view.GetViewId(),"deepsleep") == 0)\r
+        {\r
+            //TODO: close bt and cat1 , then deepsleep\r
+            stop_custom_ble_service();\r
+            LOS_Msleep(50);\r
+            uapi_set4GCapability(false);\r
+            LOS_Msleep(50);\r
+            mcu_pm_lcd_off(NULL,NULL);\r
+            return true;\r
+        }\r
         for(int i=0;i<len;i++)\r
         {\r
             if(strcmp(view.GetViewId(),ViewMapper_t[i].viewid_str) == 0)\r
index a192e59..2f67db8 100644 (file)
@@ -32,6 +32,7 @@ namespace OHOS
         {HRSENSON,"hrsensonbutton","hrsensor" ,&testView::ChangeHRTESTView},\r
         {GSENSON,"gsensonbutton","gsensor" ,&testView::ChangeGTESTView},\r
         {OLDTEST,"oldtestbutton","aging" ,&testView::ChangeoldTESTView},\r
+        {DEEPSLEEP,"deepsleep","CloseBTCat1&Sleep" ,&testView::ChangeoldTESTView},\r
         {shutdown,"shutdown","shutdown" ,&testView::ChangeoldTESTView},\r
         // {FACTORYRESETVIEW,"FactoryResetButton","恢复出厂", &testView::ChangeSystemAboutView},\r
         // {SYSTEMLUPGRADE,"systemupgread","系统升级",&testView::ChangeSystemAboutView},\r
index 2adffb2..6131630 100644 (file)
@@ -132,7 +132,27 @@ void uapi_reboot_device(void)
 {
     mcu_os_sys_reset(NULL,NULL);
 }
-
+#include "non_os_reboot.h"
+#include "chip_io.h"
+#define BT_RESET_DELAY  500
+#define PM_MCU_SEND_IPC_WKUP_BT_VAL        0x2
+#if MASTER_BY_BRANDY_ONLY
+#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG 0x57000014
+#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL 0xb66
+#define PM_MCU_SEND_IPC_WKUP_BT_REG        0x52000034
+#define PM_MCU_SEND_IPC_WKUP_BT_BIT        0x1
+#endif
+void uapi_force_reboot(void)
+{
+    // when bt at sleep, need wkup bt before soft reset
+    writew(PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG, PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL);
+    writew(PM_MCU_SEND_IPC_WKUP_BT_REG, PM_MCU_SEND_IPC_WKUP_BT_VAL);
+    uapi_tcxo_delay_ms(BT_RESET_DELAY);
+    set_cpu_utils_reset_cause(REBOOT_CAUSE_APPLICATION_SYSRESETREQ);
+    writew(0x5702C010, 0x5A5A);
+    hal_reboot_chip();
+  
+}
 void shutdown_reboot_prejobs_task(void)
 {
     addressbookTowrite();
index 9333748..b158a2d 100644 (file)
@@ -28,8 +28,12 @@ extern "C" {
 
 uint32_t zh_get_sn(uint8_t *buf_sn, uint32_t *len_sn);
 uint32_t zh_set_sn(uint8_t *buf_sn, uint32_t len_sn);
+
 void uapi_poweroff_device(void);
 void uapi_reboot_device(void);
+void uapi_force_reboot(void);
+extern uint32_t mcu_pm_lcd_off(uint8_t *para, uint32_t para_len);
+
 errcode_t uaip_cmd_update_request(void);
 
 /**获取单位ms的时间戳*/
@@ -74,7 +78,7 @@ errcode_t uapi_get_nv_btname(uint8_t *buf_btname, uint32_t *len_btname);
 
 
 errcode_t init_btaddr_btname(void);
-errcode_t disable_bt_service(void);
+
 
 errcode_t uapi_create_osThread_custom(app_task_definition_t *task_cfg);
 errcode_t uapi_terminate_thread(void* thread_id);