00001
00002
00003 #include <iostream>
00004 #include <list>
00005
00006 #include "TApi.h"
00007 #include "autoConfig.h"
00008
00009 #include "SctApiImpl.h"
00010
00011 #include "sctConf/configuration.h"
00012
00013 #include <boost/bind.hpp>
00014
00015
00016
00017
00018 template <class Call> typename Call::result_type checkCall(const Call &call) {
00019 try {
00020 return call();
00021 } catch(SctApi::SctApiException &e) {
00022 std::cout << "SctApiException " << e.what() << " thrown\n";
00023 }
00024 }
00025
00026 ClassImp(TApi)
00027 ClassImp(TScanDef)
00028 ClassImp(TTrigger)
00029
00030
00031
00032
00033 TApi::TApi(){
00034 worker = new SctApi::SctApi();
00035 }
00036
00037
00038
00039
00040
00041 TApi::~TApi(){
00042 delete worker;
00043 }
00044
00045
00046
00047 void TApi::initialiseAll(int scanNumber) {
00048 worker->initialiseAll(scanNumber);
00049 }
00050
00051 void TApi::shutdownAll() {
00052 worker->shutdownAll();
00053 }
00054
00055 void TApi::setRunNumber(int newRun) {
00056 worker->setRunNumber(newRun);
00057 }
00058
00059 void TApi::setScanNumber(int newScan) {
00060 worker->setScanNumber(newScan);
00061 }
00062
00063 void TApi::flashLED(unsigned int partition, unsigned int crate, unsigned int rod,
00064 long slaveNumber, long period, long flashes) {
00065 worker->flashLED(partition, crate, rod, slaveNumber, period, flashes);
00066 }
00067
00068 void TApi::echo(unsigned int partition, unsigned int crate, unsigned int rod,
00069 unsigned int length, unsigned long *data) {
00070 worker->echo(partition, crate, rod, length, data);
00071 }
00072
00073 void TApi::echoAll(unsigned int length, unsigned long *data) {
00074 worker->echoAll(length, data);
00075 }
00076
00077 void TApi::echoSlave(unsigned int partition, unsigned int crate, unsigned int rod,
00078 unsigned int slave, unsigned int length, unsigned long *data) {
00079 worker->echoSlave(partition, crate, rod, slave, length, data);
00080 }
00081
00082 void TApi::awaitResponse(unsigned int partition, unsigned int crate, unsigned int rod, int timeout) {
00083 worker->awaitResponse(partition, crate, rod, timeout);
00084 }
00085
00086 unsigned long *TApi::getResponse(unsigned int partition, unsigned int crate, unsigned int rod) {
00087 unsigned long length;
00088 unsigned long *result = worker->getResponse(partition, crate, rod, length);
00089 if(length < 2) result = 0;
00090 else {
00091 if(result[0] != length) {
00092 std::cout << "Result length mismatch!\n";
00093 }
00094 }
00095 return result;
00096 }
00097
00098 unsigned long *TApi::getResponse(unsigned int partition, unsigned int crate, unsigned int rod,
00099 unsigned long *length) {
00100 unsigned long myLength;
00101 unsigned long *result = worker->getResponse(partition, crate, rod, myLength);
00102 *length = myLength;
00103 return result;
00104 }
00105
00106
00107 bool TApi::getRodMessage(unsigned int partition, unsigned int crate, unsigned int rod,
00108 char *buffer, unsigned long &length) {
00109 return worker->getRodMessage(partition, crate, rod, buffer, length);
00110 }
00111
00112 UINT32 TApi::findModule(const char *sn) {
00113 return worker->findModule(sn);
00114 }
00115
00116 UINT32 TApi::findModule(INT32 mur, INT32 module) {
00117 return worker->findModule(mur, module);
00118 }
00119
00120 void TApi::sendABCDModules(UINT32 bank, UINT32 type) {
00121 try {
00122 worker->sendAllABCDModules(SctApi::BankType(bank), SctApi::ConfigType(type));
00123 } catch(SctApi::SctApiException &e) {
00124 std::cout << "Got exception: " << e.what() << std::endl;
00125 }
00126 }
00127
00128 void TApi::sendABCDModule(UINT32 mid, UINT32 bank, UINT32 type) {
00129 try {
00130 worker->sendABCDModule(mid, SctApi::BankType(bank), SctApi::ConfigType(type));
00131 } catch(SctApi::SctApiException &e) {
00132 std::cout << "Got exception: " << e.what() << std::endl;
00133 }
00134 }
00135
00136 void TApi::getABCDModules(UINT32 bank) {
00137 worker->getABCDModules(SctApi::BankType(bank));
00138 }
00139
00140 void TApi::getABCDModule(UINT32 mid, UINT32 bank) {
00141 worker->getABCDModule(mid, SctApi::BankType(bank));
00142 }
00143
00144 void TApi::modifyABCDMask(UINT32 mid, UINT32* mask) {
00145 worker->modifyABCDMask(mid, mask);
00146 }
00147
00148 void TApi::modifyABCDTrims(UINT32 mid, UINT8* trims) {
00149 worker->modifyABCDTrims(mid, trims);
00150 }
00151
00152 void TApi::modifyABCDVar(UINT32 typ, FLOAT32 var) {
00153 worker->modifyABCDVar(typ, var);
00154 }
00155
00156 void TApi::modifyABCDVar(UINT32 mid, UINT32 typ, FLOAT32 var) {
00157 worker->modifyABCDVar(mid, typ, var);
00158 }
00159
00160 void TApi::modifyABCDVar(UINT32 mid, UINT32 c, UINT32 typ, FLOAT32 var) {
00161 worker->modifyABCDVar(mid, c, typ, var);
00162 }
00163
00164 void TApi::modifyABCDVarROD(UINT32 mid, UINT32 chip, UINT32 typ, FLOAT32 var, UINT32 bank) {
00165 worker->modifyABCDVarROD(mid, chip, typ, var, SctApi::BankType(bank));
00166 }
00167
00168 void TApi::modifyABCDVarROD(UINT32 typ, FLOAT32 var, UINT32 bank) {
00169 worker->modifyABCDVarROD(typ, var, SctApi::BankType(bank));
00170 }
00171
00172 void TApi::modifyBOCParam(unsigned int partition, unsigned int crate, unsigned int rod,
00173 unsigned int channel, unsigned int type, unsigned int val) {
00174 checkCall(boost::bind(&SctApi::SctApi::modifyBOCParam, worker,
00175 partition, crate, rod, channel, type, val));
00176 }
00177
00178 void TApi::modifyBOCParam(unsigned int type, unsigned int val) {
00179 checkCall(boost::bind(&SctApi::SctApi::modifyBOCParam, worker, type, val));
00180 }
00181
00182 void TApi::loadConfiguration() {
00183 worker->loadConfiguration();
00184 }
00185
00186 void TApi::loadModuleConfigurations() {
00187 worker->loadModuleConfigurations();
00188 }
00189
00190 void TApi::configureBOC(unsigned int partition, unsigned int crate, unsigned int rod) {
00191 worker->configureBOC(partition, crate, rod);
00192 }
00193
00194 UINT32 TApi::findBarrelModule(INT32 barrel, INT32 row, INT32 number) {
00195 return worker->findBarrelModule(barrel, row, number);
00196 }
00197
00198 UINT32 TApi::findEndcapModule(INT32 disk, INT32 ring, INT32 number) {
00199 return worker->findEndcapModule(disk, ring, number);
00200 }
00201
00202 void TApi::addDebugPrimList(unsigned long length, long index, long id, long version,
00203 unsigned long * body) {
00204 worker->addDebugPrimList(length, index, id, version, body);
00205 }
00206
00207 void TApi::sendDebugPrimList(unsigned int partition, unsigned int crate, unsigned int rod) {
00208 worker->sendDebugPrimList(partition, crate, rod);
00209 }
00210
00211 void TApi::sendDebugPrimListAll() {
00212 worker->sendDebugPrimListAll();
00213 }
00214
00215 void TApi::sendDebugSlavePrimList(unsigned int partition, unsigned int crate, unsigned int rod,
00216 unsigned int slave, bool await, bool response) {
00217 worker->sendDebugSlavePrimList(partition, crate, rod, slave, await, response);
00218 }
00219
00220 void TApi::createDebugPrimList() {
00221 worker->createDebugPrimList();
00222 }
00223
00224 void TApi::debugPrimListFromFile(const char *fileName) {
00225 worker->debugPrimListFromFile(fileName);
00226 }
00227
00228 void TApi::dumpDebugPrimList() {
00229 worker->dumpDebugPrimList();
00230 }
00231
00232 std::list<SctApi::RodLabel> TApi::listRods() {
00233 return worker->listRods();
00234 }
00235
00236
00237
00238
00239 int TApi::dspBlockDump(unsigned int partition, unsigned int crate, unsigned int rod,
00240 long dspStart, long numWords, long dspNumber, bool usePrimitive){
00241 return worker->dspBlockDump(partition, crate, rod, dspStart, numWords, dspNumber, usePrimitive);
00242 }
00243
00244 int TApi::dspBlockDumpFile(unsigned int partition, unsigned int crate, unsigned int rod,
00245 long dspStart, long numWords, long dspNumber, const char *filename, bool usePrimitive)
00246 {
00247 return worker->dspBlockDumpFile(partition, crate, rod, dspStart, numWords, dspNumber, filename, usePrimitive);
00248 }
00249
00250
00251
00252
00253 unsigned long *TApi::dspBlockRead(unsigned int partition, unsigned int crate, unsigned int rod,
00254 long dspStart, long numWords, long dspNumber,
00255 unsigned long *length, bool usePrimitive) {
00256 unsigned long thing;
00257 unsigned long *result = worker->dspBlockRead(partition, crate, rod, dspStart, numWords,
00258 dspNumber, thing, usePrimitive);
00259 *length = thing;
00260 return result;
00261 }
00262
00263 int TApi::dspBlockWrite(unsigned int partition, unsigned int crate, unsigned int rod,
00264 unsigned long *buffer, unsigned long dspAddress, long numWords,
00265 long dspNumber, bool usePrimitive) {
00266 return worker->dspBlockWrite(partition, crate, rod,
00267 buffer, dspAddress, numWords, dspNumber, usePrimitive);
00268 }
00269
00270 unsigned long TApi::dspSingleRead(unsigned int partition, unsigned int crate, unsigned int rod,
00271 const unsigned long dspAddr, long dspNumber) {
00272 return worker->dspSingleRead(partition, crate, rod, dspAddr, dspNumber);
00273 }
00274
00276 void TApi::dspSingleWrite(unsigned int partition, unsigned int crate, unsigned int rod,
00277 unsigned long dspAddr, unsigned long value, long dspNumber) {
00278 worker->dspSingleWrite(partition, crate, rod, dspAddr, value, dspNumber);
00279 }
00280
00281 void TApi::defaultScan(int type) {
00282 worker->defaultScan(type);
00283 }
00284
00285 void TApi::tidyHistogramming() {
00286 worker->tidyHistogramming();
00287 }
00288
00289
00290 void TApi::doScan(TScanDef tScan) {
00291 tScan.update();
00292 boost::shared_ptr<SctApi::Scan> scan = tScan.getScan();
00293
00294 try {
00295 if(scan)
00296 worker->doScan(scan);
00297 else
00298 std::cout << "Bad scan at Root interface level\n";
00299 } catch(SctApi::SctApiException &s) {
00300 std::cout << "Exception thrown by doScan:\n";
00301 std::cout << s.what() << std::endl;
00302 }
00303 }
00304
00305 void TApi::awaitScan() {
00306 worker->awaitScan();
00307 }
00308
00309 void TApi::doRawScan(TScanDef tScan, int delay, int width, bool configure, bool clkBy2) {
00310 tScan.update();
00311 boost::shared_ptr<SctApi::Scan> scan = tScan.getScan();
00312
00313 try {
00314 if(scan)
00315 worker->doRawScan(scan, delay, width, configure, clkBy2);
00316 else
00317 std::cout << "Bad scan at Root interface level\n";
00318 } catch(SctApi::SctApiException &s) {
00319 std::cout << "SctApi Exception thrown by doRawScan:\n";
00320 std::cout << s.what() << std::endl;
00321 } catch(...) {
00322 std::cout << "Unknown Exception thrown by doRawScan:\n";
00323 }
00324 }
00325
00326 void TApi::sendTrigger(unsigned int partition, unsigned int crate, unsigned int rod, TTrigger tTrig) {
00327 tTrig.update();
00328
00329 boost::shared_ptr<SctApi::Trigger> trig = tTrig.getTrigger();
00330
00331 if(trig)
00332 worker->sendTrigger(partition, crate, rod, trig.get());
00333 else
00334 std::cout << "Bad trigger at Root interface level\n";
00335 }
00336
00337 void TApi::status() {
00338 worker->status();
00339 }
00340
00341 unsigned long TApi::readRodCommandReg(unsigned int partition, unsigned int crate, unsigned int rod,
00342 long regNumber) {
00343 return worker->readRodCommandReg(partition, crate, rod, regNumber);
00344 }
00345
00346 unsigned long TApi::readRodStatusReg(unsigned int partition, unsigned int crate, unsigned int rod,
00347 long regNumber) {
00348 return worker->readRodStatusReg(partition, crate, rod, regNumber);
00349 }
00350
00351 void TApi::setABCDModule(UINT32 mid, UINT32 bank) {
00352 try {
00353 worker->setABCDModule(mid, SctApi::BankType(bank));
00354 } catch(SctApi::SctApiException &s) {
00355 std::cout << "Exception thrown by setABCDModule:\n";
00356 std::cout << s.what() << std::endl;
00357 }
00358 }
00359
00360 void TApi::setABCDModules(UINT32 bank) {
00361 try {
00362 worker->setABCDModules(SctApi::BankType(bank));
00363 } catch(SctApi::SctApiException &s) {
00364 std::cout << "Exception thrown by setABCDModules:\n";
00365 std::cout << s.what() << std::endl;
00366 }
00367 }
00368
00369 unsigned long *TApi::retrieveModule(UINT32 mid) {
00370 return (unsigned long*)worker->retrieveModule(mid);
00371 }
00372
00373 void TApi::printABCDModule(int mid) {
00374 worker->printABCDModule(mid);
00375 }
00376
00377 void TApi::printABCDRodModule(int mid, int bank) {
00378 checkCall(boost::bind(&SctApi::SctApi::printABCDRodModule, worker,
00379 mid, SctApi::BankType(bank)));
00380 }
00381
00382 void TApi::printBOCSetup(unsigned int partition, unsigned int crate, unsigned int rod) {
00383 checkCall(boost::bind(&SctApi::SctApi::printBOCSetup, worker,
00384 partition, crate, rod));
00385 }
00386
00387 void TApi::currentBOCSetup(unsigned int partition, unsigned int crate, unsigned int rod) {
00388 try {
00389 std::vector<SctConfiguration::BOCChannelConfig> setup = worker->currentBOCSetup(partition, crate, rod);
00390
00391 std::cout << "Got setup length " << setup.size() << std::endl;
00392
00393 for(unsigned int i=0; i<setup.size(); i++) {
00394 SctConfiguration::BOCChannelConfig conf = setup[i];
00395
00396 std::cout << conf.current << " " << conf.delay << " " << conf.markSpace << std::endl;
00397 std::cout << conf.threshold0 << " " << conf.delay0 << std::endl;
00398 std::cout << conf.threshold1 << " " << conf.delay1 << std::endl;
00399 }
00400 } catch(SctApi::SctApiException &s) {
00401 std::cout << "Exception in currentBOCSetup " << s.what() << std::endl;
00402 }
00403 }
00404
00405 void TApi::printBOCRegisters(unsigned int partition, unsigned int crate, unsigned int rod) {
00406 checkCall(boost::bind(&SctApi::SctApi::printBOCRegisters, worker, partition, crate, rod));
00407 }
00408
00409
00410
00411
00412
00413 void TApi::saveBOCSetup(unsigned int partition, unsigned int crate, unsigned int rod, UINT32 bank) {
00414 worker->saveBOCSetup(partition, crate, rod, SctApi::BankType(bank));
00415 }
00416
00417 void TApi::saveBOCRegisters(unsigned int partition, unsigned int crate, unsigned int rod, UINT32 bank) {
00418 worker->saveBOCRegisters(partition, crate, rod, SctApi::BankType(bank));
00419 }
00420
00421 void TApi::restoreBOCSetup(unsigned int partition, unsigned int crate, unsigned int rod, UINT32 bank) {
00422 worker->restoreBOCSetup(partition, crate, rod, SctApi::BankType(bank));
00423 }
00424
00425 void TApi::restoreBOCRegisters(unsigned int partition, unsigned int crate, unsigned int rod, UINT32 bank) {
00426 worker->restoreBOCRegisters(partition, crate, rod, SctApi::BankType(bank));
00427 }
00428
00429 void TApi::rawData(unsigned int partition, unsigned int crate, unsigned int rod,
00430 int delay, int units, bool setMask, TTrigger tTrig) {
00431 tTrig.update();
00432
00433 boost::shared_ptr<SctApi::Trigger> trig = tTrig.getTrigger();
00434
00435 if(trig)
00436 worker->rawData(partition, crate, rod, delay, units, setMask, trig.get());
00437 else
00438 std::cout << "Bad trigger to raw data at Root interface level\n";
00439 }
00440
00441 char *TApi::probe(unsigned int partition, unsigned int crate, unsigned int rod, signed int harness) {
00442 std::vector<char> result = worker->probe(partition, crate, rod, harness);
00443 int length = result.size();
00444 char *buffer = new char[length + 1];
00445
00446 for (int i=0; i<length; i++) {
00447 buffer[i] = result[i];
00448 }
00449
00450 buffer[length] = 0;
00451
00452 return buffer;
00453 }
00454
00455 char *TApi::probeWithTrigger(unsigned int partition, unsigned int crate, unsigned int rod,
00456 TTrigger tTrig, signed int harness) {
00457 tTrig.update();
00458
00459 boost::shared_ptr<SctApi::Trigger> trig = tTrig.getTrigger();
00460
00461 if(trig) {
00462 std::vector<char> result = worker->probeWithTrigger(partition, crate, rod, trig.get(), harness);
00463 int length = result.size();
00464 char *buffer = new char[length + 1];
00465
00466 for (int i=0; i<length; i++) {
00467 buffer[i] = result[i];
00468 }
00469
00470 buffer[length] = 0;
00471
00472 return buffer;
00473 } else {
00474 std::cout << "Bad trigger to raw data at Root interface level\n";
00475 return 0;
00476 }
00477 }
00478
00479 void TApi::probeScan(unsigned int partition, unsigned int crate, unsigned int rod,
00480 TScanDef tScan, signed int harness) {
00481 tScan.update();
00482 boost::shared_ptr<SctApi::Scan> scan = tScan.getScan();
00483
00484 if(!scan) {
00485 std::cout << "Bad scan at Root interface level\n";
00486 return;
00487 }
00488
00489 std::cout << "Summary\n";
00490 std::vector< std::vector <char> > result = worker->probeScan(partition, crate, rod, scan, harness);
00491 int outerLength = result.size();
00492 int innerLength = 0;
00493 if(outerLength > 0) {
00494 innerLength = result[0].size();
00495 }
00496 for(int i=0; i<innerLength; i++) {
00497 for(int j=0; j<outerLength; j++) {
00498 std::cout << result[j][i];
00499 }
00500 std::cout << std::endl;
00501 }
00502 }
00503
00504 bool TApi::checkAllModulesProbe(const char *value) {
00505 return worker->checkAllModulesProbe(value);
00506 }
00507
00508 void TApi::autoConfigure() {
00509 ::SctApi::AutoConf::AutoConfigurer configurer(*worker);
00510 configurer.run();
00511
00512 std::list< ::SctApi::AutoConf::AutoResult> results = configurer.getResults();
00513
00514 std::cout << results.size() << " auto-configure results:\n";
00515
00516 for(std::list< ::SctApi::AutoConf::AutoResult>::const_iterator autoIter = results.begin();
00517 autoIter != results.end(); autoIter ++) {
00518 const ::SctApi::AutoConf::AutoResult &autoResult = *autoIter;
00519
00520 std::cout << "r: " << autoResult.rod << " tx: " << autoResult.tx << " rx: " << autoResult.rx << std::endl;
00521 }
00522 }
00523
00524 void TApi::rodMode(unsigned int partition, unsigned int crate, unsigned int rod,
00525 int mode, int flag, int fifoSetup, int nBins, int delay, int message) {
00526 worker->rodMode(partition, crate, rod,
00527 mode, flag, fifoSetup, nBins, delay, message);
00528 }
00529
00530 void TApi::bocHistogram(unsigned int partition, unsigned int crate, unsigned int rod,
00531 unsigned int samples, unsigned int numLoops)
00532 {
00533 worker->bocHistogram(partition, crate, rod, samples, numLoops);
00534 }
00535
00536 void TApi::testLinkOutSelect(unsigned int partition, unsigned int crate, unsigned int rod,
00537 unsigned int link) {
00538 worker->testLinkOutSelect(partition, crate, rod, link);
00539 }
00540
00541 void TApi::setDebugOption(const char *opt) {
00542 worker->setDebugOption(opt);
00543 }
00544
00545 void TApi::unsetDebugOption(const char *opt) {
00546 worker->unsetDebugOption(opt);
00547 }
00548
00549 void TApi::listEnabledDebugOptions() {
00550 std::list<std::string> theList = worker->listEnabledDebugOptions();
00551 for(std::list<std::string>::const_iterator i = theList.begin();
00552 i != theList.end();
00553 i++) {
00554 std::cout << *i << std::endl;
00555 }
00556 }
00557
00558 void TApi::listDebugOptions() {
00559 std::vector<std::string> theList = worker->listDebugOptions();
00560 for(std::vector<std::string>::const_iterator i = theList.begin();
00561 i != theList.end();
00562 i++) {
00563 std::cout << *i << std::endl;
00564 }
00565 }
00566
00567 void TApi::debugStepHistogram()
00568 {
00569 worker->debugStepHistogram();
00570 }
00571
00572 void TApi::debugContinueHistogram()
00573 {
00574 worker->debugContinueHistogram();
00575 }
00576
00577 void TApi::debugAbortHistogram()
00578 {
00579 worker->debugAbortHistogram();
00580 }
00581
00582 void TApi::standardRegisterDump(unsigned int partition, unsigned int crate, unsigned int rod)
00583 {
00584 worker->standardRegisterDump(partition, crate, rod);
00585 }
00586
00587 void TApi::lasersOff() {
00588 worker->lasersOff();
00589 }
00590
00591 void TApi::scanEvents(unsigned int partition, unsigned int crate, unsigned int rod, int sl,
00592 bool extFlag, bool errorType) {
00593 worker->scanEvents(partition, crate, rod, sl, extFlag, errorType);
00594 }
00595
00596 void TApi::decodeEvent(unsigned int partition, unsigned int crate, unsigned int rod,
00597 int sl, int index, bool extFlag, bool errorType) {
00598 worker->decodeEvent(partition, crate, rod, sl, index, extFlag, errorType);
00599 }
00600
00601 void TApi::decodeConfig(unsigned int partition, unsigned int crate, unsigned int rod,
00602 bool skipTrim, bool bypass) {
00603 worker->decodeConfig(partition, crate, rod, skipTrim, bypass);
00604 }
00605
00606 void TApi::timSetFrequency(unsigned int partition, unsigned int crate,
00607 double trigFreq, double rstFreq) {
00608 worker->timSetFrequency(partition, crate, trigFreq, rstFreq);
00609 }
00610
00611 void TApi::freeTriggers(unsigned int partition, unsigned int crate) {
00612 worker->freeTriggers(partition, crate);
00613 }
00614
00615 void TApi::stopTriggers(unsigned int partition, unsigned int crate) {
00616 worker->stopTriggers(partition, crate);
00617 }
00618
00619 void TApi::timL1A(unsigned int partition, unsigned int crate) {
00620 worker->timL1A(partition, crate);
00621 }
00622
00623 void TApi::timCalL1A(unsigned int partition, unsigned int crate, int delay) {
00624 worker->timCalL1A(partition, crate, delay);
00625 }
00626
00627 void TApi::timSoftReset(unsigned int partition, unsigned int crate) {
00628 worker->timSoftReset(partition, crate);
00629 }
00630
00631 void TApi::timBCReset(unsigned int partition, unsigned int crate) {
00632 worker->timBCReset(partition, crate);
00633 }
00634
00635 void TApi::sendTimBurst(unsigned int partition, unsigned int crate, int count) {
00636 checkCall(boost::bind(&SctApi::SctApi::sendTimBurst, worker, partition, crate, count));
00637 }
00638
00639 void TApi::timVerbose(unsigned int partition, unsigned int crate) {
00640 worker->timVerbose(partition, crate);
00641 }
00642
00643 void TApi::timRegLoad(unsigned int partition, unsigned int crate, int reg, UINT16 val) {
00644 worker->timWriteRegister(partition, crate, reg, val);
00645 }
00646
00647 UINT16 TApi::timReadRegister(unsigned int partition, unsigned int crate, int reg) {
00648 return worker->timReadRegister(partition, crate, reg);
00649 }
00650
00651 void TApi::requestHardReset(UINT32 mid) {
00652 worker->requestHardReset(mid);
00653 }
00654
00655 void TApi::resumePolling() {
00656 worker->resumePolling();
00657 }
00658
00659 void TApi::stopPolling() {
00660 worker->stopPolling();
00661 }
00662
00663
00664 TScanDef::TScanDef() :
00665 trigsPerBurst(200),
00666 scanVariable(1), scanVariable2(1),
00667 full(0), bits32(0), loopCalLine(0),
00668 distSlave(0), debug(0), tim(0), nth(0), nth_rem(0),
00669 enableDataMode(true)
00670 {
00671 worker.reset(new SctApi::ScanDefImpl);
00672
00673 configure(1, 0.0, 400.0, 5.0);
00674
00675
00676 trigSequence.singleL1A();
00677
00678
00679 update();
00680 }
00681
00682 TScanDef::~TScanDef() {
00683
00684 }
00685
00686 TScanDef::TScanDef(const TScanDef &other) :
00687 trigsPerBurst(other.trigsPerBurst),
00688
00689 scanVariable(other.scanVariable),
00690 scanVariable2(other.scanVariable2),
00691
00692 trigSequence(other.trigSequence),
00693 trigSequence2(other.trigSequence2),
00694
00695 full(other.full),
00696 bits32(other.bits32),
00697 loopCalLine(other.loopCalLine),
00698
00699 distSlave(other.distSlave),
00700 debug(other.debug),
00701 tim(other.tim),
00702 nth(other.nth),
00703 nth_rem(other.nth_rem),
00704 enableDataMode(other.enableDataMode)
00705 {
00706 worker.reset(new SctApi::ScanDefImpl(*other.worker));
00707 }
00708
00709 void TScanDef::update() {
00710
00711
00712 if(trigsPerBurst != -1)
00713 worker->setNTrigs(trigsPerBurst);
00714
00715 worker->setScanVariable1(scanVariable);
00716 worker->setScanVariable2(scanVariable2);
00717
00718
00719 trigSequence.update();
00720 worker->setTrigger1(trigSequence.getTrigger());
00721 trigSequence2.update();
00722 worker->setTrigger2(trigSequence2.getTrigger());
00723
00724
00725 worker->setOption(SctApi::Scan::FULL, full);
00726 worker->setOption(SctApi::Scan::BITS32, bits32);
00727 worker->setOption(SctApi::Scan::LOOPCALLINE, loopCalLine);
00728 worker->setOption(SctApi::Scan::DISTSLAVE, distSlave);
00729 worker->setOption(SctApi::Scan::DEBUG, debug);
00730 worker->setOption(SctApi::Scan::TIM, tim);
00731 worker->setOption(SctApi::Scan::NTH, nth);
00732 worker->setOption(SctApi::Scan::NTH_REM, nth_rem);
00733 worker->setOption(SctApi::Scan::ENABLE_DATA_MODE, enableDataMode);
00734 }
00735
00736 void TScanDef::print() {
00737 update();
00738 worker->print();
00739 }
00740
00741 void TScanDef::configure(UINT16 type, FLOAT32 start, FLOAT32 stop, FLOAT32 step) {
00742 scanVariable = type;
00743 worker->configure(type, start, stop, step);
00744 }
00745
00746 void TScanDef::configure2(UINT16 type, FLOAT32 start, FLOAT32 stop, FLOAT32 step) {
00747 scanVariable2 = type;
00748 worker->configure2(type, start, stop, step);
00749 }
00750
00751 void TScanDef::setScanPoint(int index, FLOAT32 value) {
00752 worker->scanPoints[index] = value;
00753 }
00754
00755 void TScanDef::setScanPoint2(int index, FLOAT32 value) {
00756 worker->scanPoints2[index] = value;
00757 }
00758
00759 void TScanDef::setTriggersPoint(int index, UINT32 nTrigs) {
00760 if(trigsPerBurst != -1) {
00761 worker->setNTrigs(trigsPerBurst);
00762 }
00763 trigsPerBurst = -1;
00764 worker->allTrigsSame = false;
00765 worker->trigPoints[index] = nTrigs;
00766 }
00767
00768
00769 TTrigger::TTrigger() {
00770 worker.reset(new SctApi::TriggerImpl);
00771 incCmd = 0;
00772 incData = 0;
00773
00774 update();
00775 }
00776
00777 TTrigger::TTrigger(const TTrigger &other) {
00778 worker.reset(new SctApi::TriggerImpl(*other.worker));
00779 incCmd = other.incCmd;
00780 incData = other.incData;
00781 }
00782
00783 TTrigger::~TTrigger() {
00784
00785
00786 }
00787
00788 void TTrigger::singleL1A() {
00789 worker->singleL1A();
00790 }
00791
00792 void TTrigger::doubleL1A(int delay) {
00793 worker->doubleL1A(delay);
00794 }
00795
00796 void TTrigger::delayedL1A(int delay) {
00797 worker->delayedL1A(delay);
00798 }
00799
00800 void TTrigger::calL1A(int delay) {
00801 worker->calL1A(delay);
00802 }
00803
00804 void TTrigger::pulseL1A(int delay) {
00805 worker->pulseL1A(delay);
00806 }
00807
00808 void TTrigger::softL1A(int delay) {
00809 worker->softL1A(delay);
00810 }
00811
00812 void TTrigger::softCalL1A(int delay, int delay2) {
00813 worker->softCalL1A(delay, delay2);
00814 }
00815
00816 void TTrigger::softPulseL1A(int delay, int delay2) {
00817 worker->softPulseL1A(delay, delay2);
00818 }
00819
00820 void TTrigger::bcL1A(int delay) {
00821 worker->bcL1A(delay);
00822 }
00823
00824 void TTrigger::bcCalL1A(int delay, int delay2) {
00825 worker->bcCalL1A(delay, delay2);
00826 }
00827
00828 void TTrigger::bcPulseL1A(int delay, int delay2) {
00829 worker->bcPulseL1A(delay, delay2);
00830 }
00831
00832 void TTrigger::update() {
00833 worker->setCommIncr(incCmd, incData);
00834 }
00835
00836 boost::shared_ptr<SctApi::Trigger> TriggerWrapper::getTrigger() {
00837 return worker;
00838 }
00839
00840
00841
00842 boost::shared_ptr<SctApi::Scan> ScanDefWrapper::getScan() {
00843
00844
00845
00846
00847
00848
00849
00850
00851 return worker;
00852 }