添加扩展任务 用于小板端执行异常判定
ew程序下载批量验证成功
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "interface/JQChecker.h"
|
||||
#include "interface/XTChecker.h"
|
||||
#include "interface/EWChecker.h"
|
||||
#include "interface/CheckerExt.h"
|
||||
|
||||
|
||||
#define PLAN_MAX_TASK 64
|
||||
@@ -31,13 +32,22 @@
|
||||
|
||||
typedef struct{
|
||||
CheckerTask_Info_st* task_info_array[PLAN_MAX_TASK];//方案参数结构体指针
|
||||
const uint8_t* taskid_table;
|
||||
CheckerTask *tasks_fun_table[3];
|
||||
CheckerTask_Info_st *task_par;
|
||||
CheckerTask task_fun;
|
||||
uint8_t chip_type;
|
||||
int task_index;
|
||||
int task_num;
|
||||
int scheme_inited;
|
||||
array_def *data;
|
||||
}self_def;
|
||||
|
||||
|
||||
static self_def g_self;
|
||||
static self_def g_self={
|
||||
.taskid_table=(uint8_t*)(APP_TEST_PLAN_ADDR+4),
|
||||
.tasks_fun_table={jqtaskArray,xttaskArray,ewtaskArray},
|
||||
};
|
||||
|
||||
|
||||
static int elec_check_scheme(void);
|
||||
@@ -378,16 +388,22 @@ static int elec_code_load_param(array_def *uid_psw)
|
||||
}
|
||||
|
||||
// 检测 准备参数
|
||||
static int elec_check_load_task_param(uint8_t taskid,
|
||||
CheckerTask_Info_st *task_par,CheckerTask task_fun)
|
||||
CheckerTask elec_get_task_fun(CheckerTask *tasks_fun_table[],uint8_t chip_type,uint8_t taskid);
|
||||
int elec_check_load_task_param(uint8_t task_index)
|
||||
{
|
||||
self_def *s=&g_self;
|
||||
uint8_t taskid;
|
||||
CheckerTask_Info_st *task_par;
|
||||
taskid=s->taskid_table[task_index];
|
||||
s->task_fun=elec_get_task_fun(s->tasks_fun_table,s->chip_type,taskid);
|
||||
task_par= s->task_info_array[task_index];
|
||||
memset(&checker_runcfg.task_info,0,sizeof(CheckerTask_Info_st));
|
||||
memset(checker_runcfg.params,0,20);
|
||||
checker_runcfg.param_count = 0;//参数个数
|
||||
checker_runcfg.rtv_count = 0;//返回值个数
|
||||
checker_runcfg.excue_rtv = 0;
|
||||
checker_runcfg.task_info.retry_time = 0;
|
||||
if(taskid>=CHECKER_MAXID_COUNT){
|
||||
if(taskid>=(CHECKER_MAXID_COUNT+CHECKER_EXTID_COUNT)){
|
||||
DBG_WARN("taskid=%d out of bound.",taskid);
|
||||
return 1;
|
||||
}
|
||||
@@ -395,7 +411,7 @@ static int elec_check_load_task_param(uint8_t taskid,
|
||||
DBG_WARN("can not find task params.");
|
||||
return 2;
|
||||
}
|
||||
if(task_fun==0){
|
||||
if(s->task_fun==0){
|
||||
DBG_WARN("can not find task fun.");
|
||||
return 3;
|
||||
}
|
||||
@@ -407,6 +423,40 @@ static int elec_check_load_task_param(uint8_t taskid,
|
||||
memcpy(checker_runcfg.params,checker_runcfg.task_info.params,checker_runcfg.param_count*2);
|
||||
return 0;
|
||||
}
|
||||
// 根据任务id获取检测函数
|
||||
CheckerTask elec_get_task_fun(CheckerTask *tasks_fun_table[],uint8_t chip_type,uint8_t taskid)
|
||||
{
|
||||
CheckerTask task_fun=0;
|
||||
if(taskid<CHECKER_MAXID_COUNT){
|
||||
task_fun=tasks_fun_table[chip_type][taskid];
|
||||
}else if((taskid>=CHECKER_MAXID_COUNT)&&
|
||||
(taskid<(CHECKER_MAXID_COUNT+CHECKER_EXTID_COUNT)))
|
||||
{
|
||||
task_fun=exttaskArray[taskid-CHECKER_MAXID_COUNT];
|
||||
}
|
||||
return task_fun;
|
||||
}
|
||||
|
||||
// 执行任务
|
||||
void elec_exe_task(void)
|
||||
{
|
||||
self_def *s=&g_self;
|
||||
if(s->task_fun==0){
|
||||
return;
|
||||
}
|
||||
for(int i=0;i<1+s->task_par->retry_time;i++)
|
||||
{
|
||||
checker_runcfg.excue_rtv=1;
|
||||
s->task_fun();
|
||||
Checker_Excueindex(s->task_index);
|
||||
checker_runcfg.rtv_index-=checker_runcfg.rtv_count;
|
||||
if(checker_runcfg.excue_rtv==0)
|
||||
break;
|
||||
}
|
||||
checker_runcfg.rtv_index+=checker_runcfg.rtv_count;
|
||||
DBG_LOG("task_index:%d,taskid:%d,ret=%d,rtv_index=%d.",s->task_index,taskid,checker_runcfg.excue_rtv,
|
||||
checker_runcfg.rtv_index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -414,13 +464,11 @@ static int elec_check_load_task_param(uint8_t taskid,
|
||||
array_def *elec_check_with_scheme(array_def *uid_psw)
|
||||
{
|
||||
self_def *s=&g_self;
|
||||
const uint8_t* taskid_table = (uint8_t*)(APP_TEST_PLAN_ADDR+4);
|
||||
CheckerTask *tasks_fun_table[]={jqtaskArray,xttaskArray,ewtaskArray};
|
||||
CheckerTask_Info_st *task_par=0;
|
||||
uint8_t chip_type=0;
|
||||
s->task_par=0;
|
||||
s->chip_type=0;
|
||||
uint8_t taskid=0;
|
||||
CheckerTask task_fun=0;
|
||||
uint8_t res=0;
|
||||
s->task_index=0;
|
||||
array_def *r=arr_creat();
|
||||
if(s->scheme_inited==0){
|
||||
DBG_WARN("scheme not init.");
|
||||
@@ -430,50 +478,33 @@ array_def *elec_check_with_scheme(array_def *uid_psw)
|
||||
res=checker_runcfg.power_prapare_exe;
|
||||
memset(&checker_runcfg,0,sizeof(Checker_RunCfg_st));
|
||||
checker_runcfg.power_prapare_exe=res;
|
||||
chip_type=(board_st.plan_id >> 12 ) & 0x0F;
|
||||
s->chip_type=(board_st.plan_id >> 12 ) & 0x0F;
|
||||
if(elec_code_param_check(uid_psw)==1){
|
||||
elec_code_load_param(uid_psw);
|
||||
}
|
||||
|
||||
if(chip_type>=LENGTH(tasks_fun_table)){
|
||||
if(s->chip_type>=LENGTH(s->tasks_fun_table)){
|
||||
DBG_WARN("unknown chip type.");
|
||||
arr_append(r,2);
|
||||
return arr_temp(r);
|
||||
}
|
||||
int task_index=0;
|
||||
LED1_Out_Off;
|
||||
while(task_index<s->task_num){
|
||||
taskid=taskid_table[task_index];
|
||||
task_fun=tasks_fun_table[chip_type][taskid];
|
||||
task_par= s->task_info_array[task_index];
|
||||
if(elec_check_load_task_param(taskid,task_par,task_fun)){
|
||||
while(s->task_index<s->task_num){
|
||||
if(elec_check_load_task_param(s->task_index)){
|
||||
break;
|
||||
}
|
||||
|
||||
// 执行任务
|
||||
for(int i=0;i<1+task_par->retry_time;i++)
|
||||
{
|
||||
checker_runcfg.excue_rtv=1;
|
||||
task_fun();
|
||||
Checker_Excueindex(task_index);
|
||||
checker_runcfg.rtv_index-=checker_runcfg.rtv_count;
|
||||
if(checker_runcfg.excue_rtv==0)
|
||||
break;
|
||||
}
|
||||
checker_runcfg.rtv_index+=checker_runcfg.rtv_count;
|
||||
DBG_LOG("task_index:%d,taskid:%d,ret=%d,rtv_index=%d.",task_index,taskid,checker_runcfg.excue_rtv,
|
||||
checker_runcfg.rtv_index);
|
||||
elec_exe_task();
|
||||
|
||||
// 找寻下一个任务
|
||||
task_index++;
|
||||
s->task_index++;
|
||||
if(checker_runcfg.excue_rtv != 0){
|
||||
uint8_t err_to=checker_runcfg.task_info.error_jumpto;
|
||||
uint8_t temp;
|
||||
if(err_to==0xff) continue;
|
||||
if(err_to>s->task_num-1) err_to=s->task_num-1;
|
||||
for(;task_index<err_to;task_index++){
|
||||
Checker_MaskResult(1,task_index);
|
||||
temp=(s->task_info_array[task_index]->param_rtv_count >> 4) & 0x0F;
|
||||
for(;s->task_index<err_to;s->task_index++){
|
||||
Checker_MaskResult(1,s->task_index);
|
||||
temp=(s->task_info_array[s->task_index]->param_rtv_count >> 4) & 0x0F;
|
||||
checker_runcfg.rtv_index+=temp;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user