Non-Confidential | ![]() | ARM 100963_0200_00_en | ||
| ||||
Home > Target Connection Mechanism > Getting existing CADI simulations |
If the caller connects to a running CADI simulation, it must retrieve information on this simulation by calling the GetSimulationInfos()
method of the CADI broker. This call returns an internal list of available simulations that the broker maintains.
The number of elements that are retrieved depends on:
The list of simulations that the broker holds can change dynamically. Consider updating this list regularly to detect the creation or destruction of CADI simulations.
Based on the acquired information, the caller uses SelectSimulation()
to
select a simulation to attach to. To specify a simulation, its ID (as part of the simulation
info) must be used.
SelectSimulation()
can receive pointers to
a CADIErrorCallback
object and a CADISimulationCallback
object. These objects are automatically registered to the
requested simulation. The caller must provide these objects.
The result of SelectSimulation()
is a CADISimulation
pointer to the requested simulation. The ObtainInterface()
method and the
static_cast
scheme must be applied to check validity.
// Having already obtained a pointer to the CADIBroker before // which is called cadi_broker. MyCADIErrorCallback errorCallbackObject; MyCADISimulationCallback simulationCallbackObject; char simulationCallbacksEnable[eslapi::CADI_SIM_CB_Count]; memset(simulationCallbacksEnable, 1, eslapi::CADI_SIM_CB_Count * sizeof(char)); // Enable all callbacks. uint32_t desiredNumberOfSimulations = 10; uint32_t startSimulationInfoIndex = 0; uint32_t actualNumberOfSimulations = 0; eslapi::CADISimulationInfo_t* simulationList = new eslapi::CADISimulationInfo_t[desiredNumberOfSimulations](); eslapi::CADIReturn_t status; status = cadi_broker->GetSimulationInfos(startSimulationInfoIndex, desiredNumberOfSimulations, simulationList, &actualNumberOfSimulations); if (status != eslapi::CADI_STATUS_OK) { // GetSimulationInfos() failed. } // ... // decide which simulation to connect to, // for this example using the second one (index '\1'!!) // ... CADISimulation* cadi_simulation = cadi_broker->SelectSimulation(simulationList[1].id, &errorCallbackObject, &simulationCallbackObject, simulationCallbacksEnable); if (cadi_simulation == NULL) { // Connection to simulation failed. } // Check compatibility. eslapi::if_name_t ifNameSimulation = "eslapi.CADISimulation2"; eslapi::if_rev_t minRevSimulation = 0; eslapi::if_rev_t actualRevSimulation = 0; if (cadi_simulation->ObtainInterface(ifNameSimulation, minRevSimulation, &actualRevSimulation) == NULL)
eslapi::CADISimulationInfo_t
is 8kB. When allocating arrays of this object on
the stack, do not to exceed the stack allocation limits.