//**********************************************************************************************************
// Function name : NM_WakeupIDRangeCheck
// --------------------------------------------------------------------------------------------------------
// Description : Check NM message'id that can wakeup the DUT.
// --------------------------------------------------------------------------------------------------------
// Parameter wakeupID_min
// wakeupID_max
//
//**********************************************************************************************************
export testfunction NM_WakeupIDRange( long wakeupID_min , long wakeupID_max , long NMID_DUT )
{
long Attempt_ID;
long Counter_WakeupID=0;
long res;
CheckDUTtoSleep();
for(Attempt_ID=wakeupID_min;Attempt_ID < wakeupID_max;Attempt_ID++)
{
OutputAttempID(Attempt_ID);
res=testWaitForMessage(NMID_DUT);
if(res==1)
{
Counter_WakeupID++;
testStep(0,"","DUT is awakened , Current Attempt_ID = 0x%X Counter_WakeupID = %d ",Attempt_ID,Counter_WakeupID);
testWaitForTimeout(8000);
}
else
{
testStep(0,"","DUT keep sleep , Current Attempt_ID = 0x%X",Attempt_ID);
testWaitForTimeout(3000);
}
//运行结果判断
if(Attempt_ID==wakeupID_max)
{
if(Counter_WakeupID==128)
{
testStepPass(0,"","PASS");
}
else
{
testStepFail(0,"","Fail");
}
}
}
}
//*************************************************************************************************
// Function name : WakeupBusAttemp
// -----------------------------------------------------------------------------------------------
// Description : Send Messages and try to wake up Network
// -----------------------------------------------------------------------------------------------
// Parameter :
//*************************************************************************************************
export long OutputAttempID(long msgId) //Modify the code according to the project.
{
long ret;
message * wakeupAttempMsg;
wakeupAttempMsg.Id=msgId;
wakeupAttempMsg.dlc=8;
// wakeupAttempMsg.CAN=1;
//output Msg try to wakeup DUT.
output(wakeupAttempMsg);
ret=testWaitForMessage(wakeupAttempMsg.id,500);
testWaitForTimeout(50);
output(wakeupAttempMsg);
ret=testWaitForMessage(wakeupAttempMsg.id,500);
return ret;
}