|
@@ -4,7 +4,7 @@
|
|
* File name: MainTask.c
|
|
* File name: MainTask.c
|
|
* Description: APP任务调取和异常处理
|
|
* Description: APP任务调取和异常处理
|
|
* History: 2021-03-05
|
|
* History: 2021-03-05
|
|
- *
|
|
|
|
|
|
+ * PS:主线程里面关闭了网络为了测试睡眠和唤醒
|
|
****************************************************************************/
|
|
****************************************************************************/
|
|
#include "bsp.h"
|
|
#include "bsp.h"
|
|
#include "bsp_custom.h"
|
|
#include "bsp_custom.h"
|
|
@@ -29,10 +29,13 @@
|
|
#include "app.h"
|
|
#include "app.h"
|
|
#include "MainTask.h"
|
|
#include "MainTask.h"
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
//全局变量
|
|
//全局变量
|
|
-static uint32_t Timer_count = 0;//每100ms加1
|
|
|
|
|
|
+uint32_t Timer_count;//每100ms加1
|
|
volatile bool Sleep_flag = false;//睡眠标志位
|
|
volatile bool Sleep_flag = false;//睡眠标志位
|
|
|
|
|
|
|
|
+
|
|
//主线程堆栈声明区
|
|
//主线程堆栈声明区
|
|
static StaticTask_t gProcess_Main_Task_t;
|
|
static StaticTask_t gProcess_Main_Task_t;
|
|
static UINT8 gProcess_Main_TaskStack[PROC_MAIN_TASK_STACK_SIZE];
|
|
static UINT8 gProcess_Main_TaskStack[PROC_MAIN_TASK_STACK_SIZE];
|
|
@@ -66,7 +69,7 @@ static void MainTask(void* arg)
|
|
int32_t inParam = 0xAABBCCDD;
|
|
int32_t inParam = 0xAABBCCDD;
|
|
slpManSetPmuSleepMode(true,SLP_HIB_STATE,false);
|
|
slpManSetPmuSleepMode(true,SLP_HIB_STATE,false);
|
|
slpManApplyPlatVoteHandle("MainSlp",&MainSlpHandler);
|
|
slpManApplyPlatVoteHandle("MainSlp",&MainSlpHandler);
|
|
- slpManPlatVoteDisableSleep(MainSlpHandler, SLP_SLP2_STATE);
|
|
|
|
|
|
+ slpManPlatVoteDisableSleep(MainSlpHandler, SLP_SLP1_STATE);
|
|
slpManRegisterUsrdefinedBackupCb(appBeforeHib,&inParam,SLPMAN_HIBERNATE_STATE);
|
|
slpManRegisterUsrdefinedBackupCb(appBeforeHib,&inParam,SLPMAN_HIBERNATE_STATE);
|
|
slpManRegisterUsrdefinedRestoreCb(appAfterHib,NULL,SLPMAN_HIBERNATE_STATE);
|
|
slpManRegisterUsrdefinedRestoreCb(appAfterHib,NULL,SLPMAN_HIBERNATE_STATE);
|
|
slpManRegisterUsrdefinedBackupCb(appBeforeSlp1,NULL,SLPMAN_SLEEP1_STATE);
|
|
slpManRegisterUsrdefinedBackupCb(appBeforeSlp1,NULL,SLPMAN_SLEEP1_STATE);
|
|
@@ -93,6 +96,7 @@ static void MainTask(void* arg)
|
|
{
|
|
{
|
|
case PROCESS_STATE_IDLE:
|
|
case PROCESS_STATE_IDLE:
|
|
{
|
|
{
|
|
|
|
+ Timer_count = 0;
|
|
xTimerStart(montior_timer, 0);
|
|
xTimerStart(montior_timer, 0);
|
|
xTimerStart(work_timer, 0);
|
|
xTimerStart(work_timer, 0);
|
|
Sleep_flag = false;
|
|
Sleep_flag = false;
|
|
@@ -121,7 +125,7 @@ static void MainTask(void* arg)
|
|
printf("[%d]We Can Check Vote Main State, state=%d, cnt=%d\r\n",__LINE__,State,cnt);
|
|
printf("[%d]We Can Check Vote Main State, state=%d, cnt=%d\r\n",__LINE__,State,cnt);
|
|
#endif
|
|
#endif
|
|
}
|
|
}
|
|
- slpManPlatVoteForceEnableSleep(MainSlpHandler, SLP_SLP2_STATE);
|
|
|
|
|
|
+ slpManPlatVoteForceEnableSleep(MainSlpHandler, SLP_SLP1_STATE);
|
|
if(slpManCheckVoteState(MainSlpHandler, &State, &cnt)==RET_TRUE)
|
|
if(slpManCheckVoteState(MainSlpHandler, &State, &cnt)==RET_TRUE)
|
|
{
|
|
{
|
|
#ifdef USING_PRINTF
|
|
#ifdef USING_PRINTF
|
|
@@ -187,7 +191,7 @@ void montior_timer_callback(TimerHandle_t xTimer)
|
|
#ifdef USING_PRINTF
|
|
#ifdef USING_PRINTF
|
|
if (Timer_count%50==0)
|
|
if (Timer_count%50==0)
|
|
{
|
|
{
|
|
- printf("Hello 5s montior Timer,SwVersion:%x!\n",SwVersion);
|
|
|
|
|
|
+ printf("Main Task,Batt_Cell_Num:%d,%d!\n",BATT_CELL_VOL_NUM,Timer_count);
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
Timer_count++;
|
|
Timer_count++;
|