}
}
}
break;
}
}
ocycleParmsLock.unlock();
olock.unlock();
if(!found)
err.set(ErrorParam, BString("There are no Cycle Parameters for cycle type: ") + cycleType);
if(!err && afterCycleStop){
if(oprocessingCycle){
err.set(ErrorCycleNumber, getName() + "The next cycle has already started");
}
}
dprintf(DBG_SETNEXTCYCLE, "Tick: %d\n", ocycleTick);
// Synchronise Module controllers if in simulation mode
if(osimulate)
ocycleTick = 10;
if(osimulateTiming & TimingSigCycleStart){
// Make sure timing simulation is in sync between multiple TmsPuServers when CYCLE_START is simulated
otimer.sync();
if(ocycleTick == 9){
otimer.tick();
}
else {
ocycleTick = 10;
}
}
te = getTime();
if((te - ts) > tmax){
tmax = te - ts;
}
dprintf(DBG_SETNEXTCYCLE, "Control::setNextCycle: Time: %f MaxTime: %f\n", te - ts, tmax);
dprintf(DBG_SETNEXTCYCLE, "%s: End\n", __PRETTY_FUNCTION__);
return err;
}
BError Control::getStatus(PuChannel puChannel, PuStatus& puStatus){
BError err;
BIter i;
dprintf(DBG_CMD, "%s\n", __PRETTY_FUNCTION__);
opupeEnginesLock.rdLock();
if(puChannel.pupeNum == 0){
for(opupeEngines.start(i); !opupeEngines.isEnd(i); opupeEngines.next(i)){
opupeEngines[i]->getStatus(puChannel, puStatus);
}
}
else {
if(puChannel.pupeNum > opupeEngines.number()){
err.set(ErrorParam, getName() + "No Pupe Engine Numbered: " + opupeEngines.number());
}
else {
opupeEngines[puChannel.pupeNum - 1]->getStatus(puChannel, puStatus);
}
}
opupeEnginesLock.unlock();
return err;
}
BError Control::getCycleInformation(UInt32 cycleNumber, CycleInformation& cycleInformation){
BError err;
dprintf(DBG_CMD, "%s\n", __PRETTY_FUNCTION__);
opupeEnginesLock.rdLock();
err = mergeError(opupeEngines[0]->getCycleInformation(cycleNumber, cycleInformation));
opupeEnginesLock.unlock();
return err;
}
BError Control::getData(PuChannel puChannel, DataInfo dataInfo, Data& data, UInt32& orbitNumber){
BError err;
dprintf(DBG_CMD, "%s\n", __PRETTY_FUNCTION__);
// Setup for error return
data.numValues = 0;
data.dataType = 0;
data.numBunches = 0;
data.numChannels = 0;
opupeEnginesLock.rdLock();
#if SINGLE_DMA
opupeLock.lock();
#endif
if((puChannel.pupeNum < 1) || (puChannel.pupeNum > opupeEngines.number())){
#if SINGLE_DMA
opupeLock.unlock();
#endif
opupeEnginesLock.unlock();
return err.set(ErrorParam, getName() + "PuChannel: PupeNum out of range");
}
err = mergeError(opupeEngines[puChannel.pupeNum - 1]->getData(puChannel, dataInfo, data, orbitNumber));
#if SINGLE_DMA
opupeLock.unlock();
#endif
opupeEnginesLock.unlock();
return err;
}
BError Control::requestData(PuChannel puChannel, DataInfo dataInfo){
BError err;
dprintf(DBG_CMD, "%s\n", __PRETTY_FUNCTION__);
return err;
}
BError Control::setTestMode(PuChannel puChannel, UInt32 testOutput, UInt32 timingDisableMask){
BError err;
dprintf(DBG_CMD, "%s\n", __PRETTY_FUNCTION__);
opupeEnginesLock.rdLock();
if((puChannel.pupeNum < 1) || (puChannel.pupeNum > opupeEngines.number())){
opupeEnginesLock.unlock();
return err.set(ErrorMisc, getName() + "PuChannel: PupeNum out of range");
}
err = mergeError(opupeEngines[puChannel.pupeNum - 1]->setTestMode(puChannel, testOutput, timingDisableMask));
opupeEnginesLock.unlock();
return err;
}
BError Control::setTimingSignals(PuChannel puChannel, UInt32 timingSignals){
BError err;
dprintf(DBG_CMD, "%s\n", __PRETTY_FUNCTION__);
opupeEnginesLock.rdLock();
if((puChannel.pupeNum < 1) || (puChannel.pupeNum > opupeEngines.number())){
opupeEnginesLock.unlock();
return err.set(ErrorMisc, getName() + "PuChannel: PupeNum out of range");
}
err = mergeError(opupeEngines[puChannel.pupeNum - 1]->setTimingSignals(puChannel, timingSignals));
opupeEnginesLock.unlock();
return err;
}
BError Control::captureDiagnostics(PuChannel puChannel, TestCaptureInfo captureInfo, BArray<UInt64>& data){
BError err;
dprintf(DBG_CMD, "%s\n", __PRETTY_FUNCTION__);
opupeEnginesLock.rdLock();
if((puChannel.pupeNum < 1) || (puChannel.pupeNum > opupeEngines.number())){
opupeEnginesLock.unlock();
return err.set(ErrorMisc, getName() + "PuChannel: PupeNum out of range");
}