Newer
Older
// Libcommon
import from LibCommon_Sync all;
import from LibCommon_VerdictControl all;
// LibIts
import from LibItsDcc_Templates all;
import from LibItsDcc_Pixits all;
import from LibItsDcc_Pics all;
import from LibItsDcc_TestSystem all;
group dccConfigurationFunctions {
/**
* @desc Setups default configuration
*/
function f_cfUp(out UtComp p_utComp,
out ItsDcc p_itsDcc) runs on ServerSyncComp {
// Create
p_utComp := UtComp.create;
p_itsDcc := ItsDcc.create;
// Connect
connect(p_utComp:syncPort, self:syncPort);
connect(p_itsDcc:syncPort, self:syncPort);
//Map
map(p_utComp:utPort, system:utPort);
map(p_itsDcc:inPort, system:inPort);
} // end f_cfUp
/**
* @desc Deletes default configuration
*/
function f_cfDown(in UtComp p_utComp,
in ItsDcc p_itsDcc) runs on ServerSyncComp {
f_serverWaitForAllClientsToStop();
// Disconnect
disconnect(p_utComp:syncPort, self:syncPort);
disconnect(p_itsDcc:syncPort, self:syncPort);
// Unmap
unmap(p_utComp:utPort, system:utPort);
unmap(p_itsDcc:inPort, system:inPort);
} // end f_cfDown
} // end of dccConfigurationFunctions
/* @desc Implements synchronization of 2 clients from server side
* on one or more synchronization points.
* If problem occurs, then server sends STOP to all clients.
* Waits for PX_TSYNC_TIME_LIMIT to let clients
* finish executing their behavior until this
* synchronization point.
* @remark The use of this function requires prior connection of
* the server sync ports!
* @param p_syncPointIds list of synchronization point name/ids
* @return execution status
*/
function f_serverSync2Clients( in SyncPointList p_syncPointIds )
runs on ServerSyncComp {
var integer i, v_noOfSyncIds := sizeof(p_syncPointIds);
for ( i := 0; i < v_noOfSyncIds; i := i+1 ) {
f_serverSyncClientsTimed(2,p_syncPointIds[i], PX_TSYNC_TIME_LIMIT);
}
}
/**
* @desc Upper tester functions
*/
group utFuntions {
/**
* @desc Requests to bring the IUT in an initial state
* @param p_init The initialisation to trigger.
*/
function f_utInitializeIut(template (value) UtInitialize p_init) runs on UtComp {
utPort.send(p_init);
tc_wait.start;
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
log("*** f_utInitializeIut: INFO: IUT initialized ***");
}
[] utPort.receive {
tc_wait.stop;
log("*** f_utInitializeIut: INFO: IUT could not be initialized ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] tc_wait.timeout {
log("*** f_utInitializeIut: INFO: IUT could not be initialized in time ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[else] { // Shortcut defaults
repeat;
}
}
}
/**
* @desc Triggers event on the radio interface
* @param p_trigger The event to trigger.
*/
function f_utTriggerEvent(template (value) UtTrigger p_trigger) runs on UtComp {
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
utPort.send(p_trigger);
alt {
[] utPort.receive(UtResult:true) {
tc_wait.stop;
log("*** f_utTriggerEvent: INFO: Event sccessfully triggered ***");
}
[] utPort.receive {
tc_wait.stop;
log("*** f_utTriggerEvent: INFO: Event could not be triggered ***");
f_selfOrClientSyncAndVerdict("error", e_error);
}
[] tc_wait.timeout {
log("*** f_utTriggerEvent: INFO: Event could not be triggered in time ***");
f_selfOrClientSyncAndVerdict("error", e_timeout);
}
[else] { // Shortcut defaults
repeat;
}
}
}
/**
* @desc Capture the next event sent to the Upper Tester
* @param p_event Receive template of the expected event
* @param p_result Return the value of the received event if template matchs
*/
function f_utCommandIndication(
in template UtCommandIndication p_event,
out UtCommandIndication p_result
tc_wait.start;
alt {
// [] utPort.receive(p_event) -> value p_result {
// tc_wait.stop;
// }
[] utPort.receive {
tc_wait.stop;
log("*** f_utCommandIndication: INFO: Another event indicated at application layer, repeating check ***");
}
[] tc_wait.timeout {
log("*** f_utCommandIndication: ERROR: Timeout while waiting for event check result ***");
}
} // end of 'alt' statement
} // End of function f_utCommandIndication
} // End of group utFunctions
} // End of module LibItsDcc_Functions