From be3c644d23d2c3829ac073093e36cf3d0389f7fc Mon Sep 17 00:00:00 2001 From: ranchuan Date: Sat, 18 Nov 2023 15:48:24 +0800 Subject: [PATCH] =?UTF-8?q?=20=20=20=20=E6=B7=BB=E5=8A=A0=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E4=BB=BB=E5=8A=A1=20=E7=94=A8=E4=BA=8E=E5=B0=8F?= =?UTF-8?q?=E6=9D=BF=E7=AB=AF=E6=89=A7=E8=A1=8C=E5=BC=82=E5=B8=B8=E5=88=A4?= =?UTF-8?q?=E5=AE=9A=20=20=20=20=20ew=E7=A8=8B=E5=BA=8F=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E9=AA=8C=E8=AF=81=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- checher_slave.uvoptx | 120 ++++++++++++++----------- checher_slave.uvprojx | 15 ++++ source/ReadMe.txt | 4 + source/elec_det/elec_det.c | 103 +++++++++++++-------- source/elec_det/elec_det.h | 2 + source/elec_det/elec_judge.c | 6 +- source/elec_det/interface/CheckerExt.c | 78 ++++++++++++++++ source/elec_det/interface/CheckerExt.h | 29 ++++++ source/elec_det/interface/EWChecker.c | 3 +- source/elec_det/interface/EWUpdata.c | 8 +- source/elec_det/interface/JQChecker.c | 27 ++++++ source/main/compiler_info.h | 2 +- 12 files changed, 300 insertions(+), 97 deletions(-) create mode 100644 source/elec_det/interface/CheckerExt.c create mode 100644 source/elec_det/interface/CheckerExt.h diff --git a/checher_slave.uvoptx b/checher_slave.uvoptx index 0f354f2..5266f3a 100644 --- a/checher_slave.uvoptx +++ b/checher_slave.uvoptx @@ -1411,6 +1411,18 @@ 0 0 0 + .\source\elec_det\interface\CheckerExt.c + CheckerExt.c + 0 + 0 + + + 6 + 56 + 1 + 0 + 0 + 0 .\source\elec_det\test\EW_TestUsartApp.c EW_TestUsartApp.c 0 @@ -1418,7 +1430,7 @@ 6 - 56 + 57 1 0 0 @@ -1430,7 +1442,7 @@ 6 - 57 + 58 1 0 0 @@ -1442,7 +1454,7 @@ 6 - 58 + 59 1 0 0 @@ -1454,7 +1466,7 @@ 6 - 59 + 60 1 0 0 @@ -1466,7 +1478,7 @@ 6 - 60 + 61 1 0 0 @@ -1478,7 +1490,7 @@ 6 - 61 + 62 1 0 0 @@ -1490,7 +1502,7 @@ 6 - 62 + 63 1 0 0 @@ -1510,7 +1522,7 @@ 0 7 - 63 + 64 1 0 0 @@ -1522,7 +1534,7 @@ 7 - 64 + 65 1 0 0 @@ -1542,7 +1554,7 @@ 0 8 - 65 + 66 1 0 0 @@ -1554,7 +1566,7 @@ 8 - 66 + 67 1 0 0 @@ -1566,7 +1578,7 @@ 8 - 67 + 68 1 0 0 @@ -1578,7 +1590,7 @@ 8 - 68 + 69 1 0 0 @@ -1590,7 +1602,7 @@ 8 - 69 + 70 1 0 0 @@ -1602,7 +1614,7 @@ 8 - 70 + 71 1 0 0 @@ -1614,7 +1626,7 @@ 8 - 71 + 72 1 0 0 @@ -1626,7 +1638,7 @@ 8 - 72 + 73 1 0 0 @@ -1638,7 +1650,7 @@ 8 - 73 + 74 1 0 0 @@ -1650,7 +1662,7 @@ 8 - 74 + 75 1 0 0 @@ -1662,7 +1674,7 @@ 8 - 75 + 76 1 0 0 @@ -1674,7 +1686,7 @@ 8 - 76 + 77 1 0 0 @@ -1686,7 +1698,7 @@ 8 - 77 + 78 1 0 0 @@ -1698,7 +1710,7 @@ 8 - 78 + 79 1 0 0 @@ -1710,7 +1722,7 @@ 8 - 79 + 80 1 0 0 @@ -1722,7 +1734,7 @@ 8 - 80 + 81 1 0 0 @@ -1734,7 +1746,7 @@ 8 - 81 + 82 1 0 0 @@ -1746,7 +1758,7 @@ 8 - 82 + 83 1 0 0 @@ -1758,7 +1770,7 @@ 8 - 83 + 84 2 0 0 @@ -1778,7 +1790,7 @@ 0 9 - 84 + 85 1 0 0 @@ -1790,7 +1802,7 @@ 9 - 85 + 86 1 0 0 @@ -1802,7 +1814,7 @@ 9 - 86 + 87 1 0 0 @@ -1814,7 +1826,7 @@ 9 - 87 + 88 1 0 0 @@ -1826,7 +1838,7 @@ 9 - 88 + 89 1 0 0 @@ -1838,7 +1850,7 @@ 9 - 89 + 90 1 0 0 @@ -1850,7 +1862,7 @@ 9 - 90 + 91 1 0 0 @@ -1862,7 +1874,7 @@ 9 - 91 + 92 1 0 0 @@ -1874,7 +1886,7 @@ 9 - 92 + 93 1 0 0 @@ -1886,7 +1898,7 @@ 9 - 93 + 94 1 0 0 @@ -1898,7 +1910,7 @@ 9 - 94 + 95 1 0 0 @@ -1918,7 +1930,7 @@ 0 10 - 95 + 96 1 0 0 @@ -1930,7 +1942,7 @@ 10 - 96 + 97 1 0 0 @@ -1942,7 +1954,7 @@ 10 - 97 + 98 1 0 0 @@ -1954,7 +1966,7 @@ 10 - 98 + 99 1 0 0 @@ -1966,7 +1978,7 @@ 10 - 99 + 100 1 0 0 @@ -1986,7 +1998,7 @@ 0 11 - 100 + 101 1 0 0 @@ -2006,7 +2018,7 @@ 0 12 - 101 + 102 1 0 0 @@ -2018,7 +2030,7 @@ 12 - 102 + 103 1 0 0 @@ -2030,7 +2042,7 @@ 12 - 103 + 104 1 0 0 @@ -2042,7 +2054,7 @@ 12 - 104 + 105 1 0 0 @@ -2054,7 +2066,7 @@ 12 - 105 + 106 1 0 0 @@ -2066,7 +2078,7 @@ 12 - 106 + 107 1 0 0 @@ -2086,7 +2098,7 @@ 0 13 - 107 + 108 5 0 0 @@ -2106,7 +2118,7 @@ 0 14 - 108 + 109 5 0 0 @@ -2118,7 +2130,7 @@ 14 - 109 + 110 5 0 0 diff --git a/checher_slave.uvprojx b/checher_slave.uvprojx index 94d9064..a56fb36 100644 --- a/checher_slave.uvprojx +++ b/checher_slave.uvprojx @@ -899,6 +899,11 @@ 1 .\source\elec_det\interface\EWUpdata.c + + CheckerExt.c + 1 + .\source\elec_det\interface\CheckerExt.c + EW_TestUsartApp.c 1 @@ -3460,6 +3465,11 @@ 1 .\source\elec_det\interface\EWUpdata.c + + CheckerExt.c + 1 + .\source\elec_det\interface\CheckerExt.c + EW_TestUsartApp.c 1 @@ -4909,6 +4919,11 @@ 1 .\source\elec_det\interface\EWUpdata.c + + CheckerExt.c + 1 + .\source\elec_det\interface\CheckerExt.c + EW_TestUsartApp.c 1 diff --git a/source/ReadMe.txt b/source/ReadMe.txt index 6f38059..5fc2827 100644 --- a/source/ReadMe.txt +++ b/source/ReadMe.txt @@ -266,3 +266,7 @@ 2023.11.16 完成方案中updata调试,支持不处于bootloader中时自动跳转至bootloader 单块板验证成功,批量验证失败 +2023.11.17 + 添加扩展任务 用于小板端执行异常判定 + ew程序下载批量验证成功 + diff --git a/source/elec_det/elec_det.c b/source/elec_det/elec_det.c index 56a2ec0..fe045a8 100644 --- a/source/elec_det/elec_det.c +++ b/source/elec_det/elec_det.c @@ -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)&& + (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_indextask_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_indextask_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_indextask_info_array[task_index]->param_rtv_count >> 4) & 0x0F; + for(;s->task_indextask_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; } } diff --git a/source/elec_det/elec_det.h b/source/elec_det/elec_det.h index 15c33eb..e6f14ed 100644 --- a/source/elec_det/elec_det.h +++ b/source/elec_det/elec_det.h @@ -40,7 +40,9 @@ array_def *elec_code(array_def *uid_psw); +int elec_check_load_task_param(uint8_t task_index); +void elec_exe_task(void); #endif diff --git a/source/elec_det/elec_judge.c b/source/elec_det/elec_judge.c index 435dc94..0404488 100644 --- a/source/elec_det/elec_judge.c +++ b/source/elec_det/elec_judge.c @@ -5,7 +5,7 @@ #include "debug.h" #include "mystring.h" #include "elec_judge.h" - +#include "interface/CheckerExt.h" // 通用异常判定逻辑 @@ -381,6 +381,10 @@ void elec_judge(elec_judge_def *e,int task_num,uint8_t *exe_ack, task=&e->scheme->task[i]; if(task->taskidjudge_fun_num){ e->judge_fun_table[task->taskid](e,i,data); + }else if((task->taskid>=CHECKER_MAXID_COUNT)&& + (task->taskid<(CHECKER_MAXID_COUNT+CHECKER_EXTID_COUNT))) + { + // 忽略扩展任务 }else{ elec_add_errcode(e,6); } diff --git a/source/elec_det/interface/CheckerExt.c b/source/elec_det/interface/CheckerExt.c new file mode 100644 index 0000000..c8d9f7d --- /dev/null +++ b/source/elec_det/interface/CheckerExt.c @@ -0,0 +1,78 @@ + +#include "stdlib.h" +#include "dev_flash.h" +#include "elec_judge.h" +#include "CheckerExt.h" +#include "basechecker.h" + + + + + +// 扩展的检测任务,这个文件下的任务是所有模块通用的 + + + + + + + + +/*rc{ +计算异常 +par0:忽略的异常代码1 +par1:忽略的异常代码2 +par2~par9:同上 +return:无 +exe:如果计算的异常代码为不被忽略的异常,则此任务失败 +}*/ +static int calc_contain(uint16_t *arr,int arr_len,uint16_t item); +void CheckerExt_CalcErr(void) +{ + const scheme_def *sch=check_scheme(); + elec_judge_def *e=0; + uint8_t marerr=0,suberr=0; + if(sch->plan_id==0xffffffff){ + // 判定任务不存在,返回失败 + marerr=6; + goto end; + } + e=malloc(sizeof(elec_judge_def)); + elec_judge(e,sch->task_num,checker_runcfg.Task_Result, + checker_runcfg.Task_Excute, + (uint8_t *)checker_runcfg.Test_Rtv,&marerr,&suberr); + free(e); + + end: + if((marerr!=0)&&(calc_contain(checker_runcfg.params,checker_runcfg.param_count,marerr)==0)){ + Checker_MaskResult(1,checker_runcfg.task_info.runindex); + }else{ + Checker_MaskResult(0,checker_runcfg.task_info.runindex); + } +} +static int calc_contain(uint16_t *arr,int arr_len,uint16_t item) +{ + for(int i=0;i> 8) & 0x0FF)==ul_temp[0])&& + (((us_delaytime) & 0x0FF)==ul_temp[1])) + { + + }else{ + uc_rtv=3;goto end; + } + end: + Checker_MaskResult(uc_rtv,checker_runcfg.task_info.runindex); +} + + CheckerTask jqtaskArray[CHECKER_MAXID_COUNT] ={ Checker_PowerPrapare, //0 电源准备 JQ_Test_PowerOn, //1 上电充能 @@ -1198,6 +1224,7 @@ JQ_Test_WriteVersion ,//33 写模块版本 JQ_Test_ReadVersion ,//34 读取版本号 JQ_Test_WriteFacBuff ,//35 写缓存数据 JQ_Test_VerifyFacBuff ,//36 验证缓存数据 +JQ_Test_VerifyDelay ,//37 读取延时值和otp数据相比 (void*)0 //数组结束 }; diff --git a/source/main/compiler_info.h b/source/main/compiler_info.h index d209367..a746d2b 100644 --- a/source/main/compiler_info.h +++ b/source/main/compiler_info.h @@ -6,7 +6,7 @@ -#define BUILD_DATE "2023-11-16 17:26:38" +#define BUILD_DATE "2023-11-18 14:06:40" #define SOFT_VERSION "2.06"