test: add watchdog stall task
This commit is contained in:
@@ -30,6 +30,8 @@
|
|||||||
#include "hal_api.h"
|
#include "hal_api.h"
|
||||||
#include "nfc.h"
|
#include "nfc.h"
|
||||||
|
|
||||||
|
#define WATCHDOG_STALL_TEST_ENABLE
|
||||||
|
|
||||||
|
|
||||||
#define APP_ENABLE_SLEEP
|
#define APP_ENABLE_SLEEP
|
||||||
|
|
||||||
@@ -39,6 +41,21 @@ static unsigned char app_operation = 0;
|
|||||||
extern int fota_start;
|
extern int fota_start;
|
||||||
int fisrt_net_start = 1;
|
int fisrt_net_start = 1;
|
||||||
|
|
||||||
|
#ifdef WATCHDOG_STALL_TEST_ENABLE
|
||||||
|
static volatile unsigned char g_watchdog_stall_test;
|
||||||
|
|
||||||
|
static void watchdog_stall_test_task(void *argv)
|
||||||
|
{
|
||||||
|
(void)argv;
|
||||||
|
ql_rtos_task_sleep_s(30);
|
||||||
|
printf("WATCHDOG TEST: stop feeding and enter dead loop\r\n");
|
||||||
|
g_watchdog_stall_test = 1;
|
||||||
|
while (1) {
|
||||||
|
/* Deliberately block this task until the hardware watchdog resets us. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// 安全修复:添加互斥锁保护全局共享变量
|
// 安全修复:添加互斥锁保护全局共享变量
|
||||||
static ql_mutex_t g_app_op_mutex = NULL;
|
static ql_mutex_t g_app_op_mutex = NULL;
|
||||||
#define APP_OP_LOCK() do{ if(g_app_op_mutex) ql_rtos_mutex_lock(g_app_op_mutex, QL_WAIT_FOREVER); }while(0)
|
#define APP_OP_LOCK() do{ if(g_app_op_mutex) ql_rtos_mutex_lock(g_app_op_mutex, QL_WAIT_FOREVER); }while(0)
|
||||||
@@ -245,6 +262,11 @@ jump_not_sleep:
|
|||||||
battery_check();
|
battery_check();
|
||||||
// printf("custom_app_task running\n");
|
// printf("custom_app_task running\n");
|
||||||
ql_rtos_task_sleep_s(5);
|
ql_rtos_task_sleep_s(5);
|
||||||
|
#ifdef WATCHDOG_STALL_TEST_ENABLE
|
||||||
|
if (g_watchdog_stall_test) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
ql_wtd_feed();
|
ql_wtd_feed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,4 +274,8 @@ jump_not_sleep:
|
|||||||
|
|
||||||
application_init(custom_app_task, "custom_app", 10, 0);
|
application_init(custom_app_task, "custom_app", 10, 0);
|
||||||
|
|
||||||
|
#ifdef WATCHDOG_STALL_TEST_ENABLE
|
||||||
|
application_init(watchdog_stall_test_task, "wdt_stall_test", 2, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user