Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

TApi.h

00001 // File: TApi.h
00002 
00003 #ifndef SCTAPI_TAPI_H
00004 #define SCTAPI_TAPI_H
00005 
00006 #include <list>
00007 #include <string>
00008 #include <TArrayD.h>
00009 #include <TArrayI.h>
00010 #include <TArrayL.h>
00011 #include <TArrayS.h>
00012 
00013 // Declare classes used + define RodLabel
00014 #include "SctApiFwd.h"
00015 
00016 #ifndef __CINT__
00017 #include "TApiWrappers.h"
00018 #endif
00019 
00020 #include "processor.h"
00021 
00022 #include <TObject.h>
00023 
00024 // using namespace SctPixelRod;
00025 
00026 class TriggerWrapper;
00027 class ScanDefWrapper;
00028 
00032 class TTrigger : private TriggerWrapper {
00033   TTrigger &operator=(const TTrigger &);
00034 
00035  public:
00037   TTrigger();
00038 
00039   TTrigger(const TTrigger &);
00040 
00042   virtual ~TTrigger();
00043 
00044   void singleL1A();
00045   void doubleL1A(int delay);
00046   void delayedL1A(int delay);
00047   void calL1A(int delay);
00048   void pulseL1A(int delay);
00049   void softL1A(int delay);
00050   void softCalL1A(int delay, int delay2);
00051   void softPulseL1A(int delay, int delay2);
00052   void bcL1A(int delay);
00053   void bcCalL1A(int delay, int delay2);
00054   void bcPulseL1A(int delay, int delay2);
00055 
00057   int incCmd;
00058 
00060   int incData;
00061 
00062  private:
00063   void update();
00064 
00065   friend class TApi;
00066   friend class TScanDef;
00067 
00068   // For CINT and ROOT
00069   ClassDef(TTrigger,1)
00070 };
00071 
00077 class TScanDef : private ScanDefWrapper {
00078   TScanDef &operator=(const TScanDef &);
00079 
00080  public:
00082   TScanDef();
00083 
00084   TScanDef(const TScanDef &);
00085 
00087   virtual ~TScanDef();
00088 
00090   void print();
00091 
00093   void configure(UINT16 type, FLOAT32 start, FLOAT32 stop, FLOAT32 step);
00094 
00096   void configure2(UINT16 type, FLOAT32 start, FLOAT32 stop, FLOAT32 step);
00097 
00099   void setScanPoint(int index, FLOAT32 value);
00100 
00102   void setScanPoint2(int index, FLOAT32 value);
00103 
00105   void setTriggersPoint(int index, UINT32 ntrigs);
00106 
00108   long trigsPerBurst;
00109 
00111   int scanVariable;
00112 
00114   int scanVariable2;
00115 
00117   TTrigger trigSequence;
00118 
00120   TTrigger trigSequence2;
00121 
00123   int full;
00124 
00126   int bits32;
00127 
00129   int loopCalLine;
00130 
00132   int distSlave;
00133 
00135   int debug;
00136 
00138   int tim;
00139 
00141   int nth;
00142 
00144   int nth_rem;
00145 
00147   int enableDataMode;
00148 
00149  private:
00151   void update();
00152 
00153   friend class TApi;
00154 
00155   // For CINT and ROOT
00156   ClassDef(TScanDef,1)
00157 };
00158 
00174 class TApi : public TObject {
00175   public:
00177     TApi();
00178 
00180     ~TApi();
00181 
00183 
00186     void initialiseAll(int runNumber);
00187 
00189     void shutdownAll();
00190 
00192     void setRunNumber(int newRun);
00193 
00195     void setScanNumber(int newScan);
00196 
00197     /*************** ROD Diagnostics ********************/
00198 
00200 
00204     void echo(unsigned int partition, unsigned int crate, unsigned int rod,
00205               unsigned int length, unsigned long *data);
00206 
00208 
00212     void echoAll(unsigned int length, unsigned long *data);
00213 
00215 
00219     void echoSlave(unsigned int partition, unsigned int crate, unsigned int rod,
00220                    unsigned int slave, unsigned int length, unsigned long *data);
00221 
00223     void loadConfiguration();
00224 
00226     void loadModuleConfigurations();
00227 
00229     void configureBOC(unsigned int partition, unsigned int crate, unsigned int rod);
00230 
00232     void awaitResponse(unsigned int partition, unsigned int crate, unsigned int rod, int timeout = 5);
00233 
00235     unsigned long *getResponse(unsigned int partition, unsigned int crate, unsigned int rod);
00236 
00238     unsigned long *getResponse(unsigned int partition, unsigned int crate, unsigned int rod, 
00239                                unsigned long *length);
00240 
00242 
00246     bool getRodMessage(unsigned int partition, unsigned int crate, unsigned int rod,
00247                        char *buffer, unsigned long &length);
00248 
00250 
00256     void flashLED(unsigned int partition, unsigned int crate, unsigned int rod,
00257                   long slaveNumber, long period = 1000, long flashes = 10);
00258 
00259 
00260     void status();
00261 
00262     /***************** Direct ROD access (Debug only) ********************/
00265 
00266 
00269     Int_t dspBlockDump(unsigned int partition, unsigned int crate, unsigned int rod,
00270                        long dspStart, long numWords, long dspNumber, bool usePrimitive = true);
00271 
00273 
00276     Int_t dspBlockDumpFile(unsigned int partition, unsigned int crate, unsigned int rod,
00277                            long dspStart, long numWords, long dspNumber, const char *filename, bool usePrimitive = true);
00278 
00280 
00283     unsigned long *dspBlockRead(unsigned int partition, unsigned int crate, unsigned int rod,
00284                                 long dspStart, long numWords, long dspNumber, 
00285                                 unsigned long *length, bool usePrimitive = true);
00286 
00288     int dspBlockWrite(unsigned int partition, unsigned int crate, unsigned int rod,
00289                       unsigned long *buffer, unsigned long dspAddress, long numWords, 
00290                       long dspNumber, bool usePrimitive = true);
00291 
00293     unsigned long readRodStatusReg(unsigned int partition, unsigned int crate, unsigned int rod,
00294                                    long regNumber);
00295 
00297     unsigned long readRodCommandReg(unsigned int partition, unsigned int crate, unsigned int rod,
00298                                     long regNumber);
00299 
00301     unsigned long dspSingleRead(unsigned int partition, unsigned int crate, unsigned int rod,
00302                                 const unsigned long dspAddr, long dspNumber);
00303 
00305     void dspSingleWrite(unsigned int partition, unsigned int crate, unsigned int rod,
00306                         unsigned long dspAddr, unsigned long value, long dspNumber);
00307 
00309     void createDebugPrimList();
00310 
00312     void addDebugPrimList(unsigned long length, long index, long id, long version,
00313                           unsigned long * body);
00314 
00316     void sendDebugPrimList(unsigned int partition, unsigned int crate, unsigned int rod);
00317 
00319     void sendDebugPrimListAll();
00320 
00322     void sendDebugSlavePrimList(unsigned int partition, unsigned int crate, unsigned int rod,
00323                                 unsigned int slave, bool await, bool response);
00324 
00325     void debugPrimListFromFile(const char *fileName);
00326 
00327     void dumpDebugPrimList();
00328 
00329     std::list<SctApi::RodLabel> listRods();
00330 
00332     unsigned long *retrieveModule(UINT32 mid);
00333 
00334     /**** Official SCTAPI bit (majority unimplemented) ******/
00335 
00337 
00341     UINT32 findModule(const char *sn);
00342 
00344     UINT32 findModule(INT32 mur, INT32 module);
00345 
00347     UINT32 findBarrelModule(INT32 barrel, INT32 row, INT32 number);
00348 
00350     UINT32 findEndcapModule(INT32 disk, INT32 ring, INT32 number);
00351 
00353     void getABCDModules(UINT32 bank);
00354 
00356     void getABCDModule(UINT32 mid, UINT32 bank);
00357 
00359     void setABCDModules(UINT32 bank);
00360 
00362     void setABCDModule(UINT32 mid, UINT32 bank);
00363 
00365 
00370     void sendABCDModule(UINT32 mid, UINT32 bank, UINT32 type=2);
00371 
00373 
00377     void sendABCDModules(UINT32 bank, UINT32 type=2);
00378 
00380     void modifyABCDMask(UINT32 mid, UINT32* mask);
00381 
00383     void modifyABCDTrims(UINT32 mid, UINT8* trims);
00384 
00386     void modifyABCDVar(UINT32 typ, FLOAT32 var);
00387 
00389     void modifyABCDVar(UINT32 mid, UINT32 typ, FLOAT32 var);
00390 
00392     void modifyABCDVar(UINT32 mid, UINT32 c, UINT32 typ, FLOAT32 var);
00393 
00395     void modifyABCDVarROD(UINT32 mid, UINT32 chip, UINT32 typ, FLOAT32 var, UINT32 bank);
00396 
00398     void modifyABCDVarROD(UINT32 typ, FLOAT32 var, UINT32 bank);
00399 
00401     void modifyBOCParam(unsigned int partition, unsigned int crate, unsigned int rod,
00402                         unsigned int channel, unsigned int type, unsigned int val);
00403 
00405     void modifyBOCParam(unsigned int type, unsigned int val);
00406 
00408     void defaultScan(int type);
00409 
00411     void tidyHistogramming();
00412 
00414     void doScan(TScanDef scan);
00415 
00416     void awaitScan();
00417 
00419     void doRawScan(TScanDef scan, int delay, int width, bool configure = true, bool clkBy2 = false);
00420 
00422     void sendTrigger(unsigned int partition, unsigned int crate, unsigned int rod, TTrigger trig);
00423 
00425 
00428     void printABCDModule(int mid);
00429 
00431 
00434     void printABCDRodModule(int mid, int bank);
00435 
00437     void printBOCSetup(unsigned int partition, unsigned int crate, unsigned int rod);
00438 
00439     void currentBOCSetup(unsigned int partition, unsigned int crate, unsigned int rod);
00440 
00442     void printBOCRegisters(unsigned int partition, unsigned int crate, unsigned int rod);
00443 
00444 /*     void currentBOCRegisters(unsigned int partition, unsigned int crate, unsigned int rod); */
00445 
00447     void saveBOCSetup(unsigned int partition, unsigned int crate, unsigned int rod, UINT32 bank);
00448 
00450     void saveBOCRegisters(unsigned int partition, unsigned int crate, unsigned int rod, UINT32 bank);
00451 
00453     void restoreBOCSetup(unsigned int partition, unsigned int crate, unsigned int rod, UINT32 bank);
00454 
00456     void restoreBOCRegisters(unsigned int partition, unsigned int crate, unsigned int rod, UINT32 bank);
00457 
00459     void rawData(unsigned int partition, unsigned int crate, unsigned int rod, int delay, int units, bool setMask = true, TTrigger trig = TTrigger());
00460 
00462     char *probe(unsigned int partition, unsigned int crate, unsigned int rod, signed int harness = -1);
00463 
00465     char *probeWithTrigger(unsigned int partition, unsigned int crate, unsigned int rod, TTrigger trig, signed int harness = -1);
00466 
00468     void probeScan(unsigned int partition, unsigned int crate, unsigned int rod, 
00469                    TScanDef scan, signed int harness = -1);
00470 
00472     bool checkAllModulesProbe(const char *value);
00473 
00475     void autoConfigure();
00476 
00478     void bocHistogram(unsigned int partition, unsigned int crate, unsigned int rod, 
00479                       unsigned int samples, unsigned int numLoops);
00480 
00482     void rodMode(unsigned int partition, unsigned int crate, unsigned int rod,
00483                  int mode, int flag, int fifoSetup, int nBins, int delay, int message);
00484 
00485     void standardRegisterDump(unsigned int partition, unsigned int crate, unsigned int rod);
00486 
00488 
00491     void lasersOff();
00492 
00494     void scanEvents(unsigned int partition, unsigned int crate, unsigned int rod, int sl = -1, 
00495                     bool extFlag = false, bool errorType = false);
00496 
00498     void decodeEvent(unsigned int partition, unsigned int crate, unsigned int rod, 
00499                      int sl, int index, bool extFlag = false, bool errorType = false);
00500 
00504     void decodeConfig(unsigned int partition, unsigned int crate, unsigned int rod, 
00505                       bool skipTrim = false, bool bypass = false);
00506 
00507     void testLinkOutSelect(unsigned int partition, unsigned int crate, unsigned int rod,
00508                            unsigned int link);
00509 
00510     void setDebugOption(const char *opt);
00511 
00512     void unsetDebugOption(const char *opt);
00513 
00514     void listEnabledDebugOptions();
00515 
00516     void listDebugOptions();
00517 
00518     void debugStepHistogram();
00519 
00520     void debugContinueHistogram();
00521 
00522     void debugAbortHistogram();
00523 
00524     /* *************  TIM functs **************/
00525 
00527 
00530     void timSetFrequency(unsigned int partition, unsigned int crate, 
00531                          double trigFreq, double rstFreq);
00532 
00534 
00537     void freeTriggers(unsigned int partition, unsigned int crate);
00538 
00540     void stopTriggers(unsigned int partition, unsigned int crate);
00541 
00543     void timL1A(unsigned int partition, unsigned int crate);
00544 
00546     void timCalL1A(unsigned int partition, unsigned int crate, int delay);
00547 
00549     void timSoftReset(unsigned int partition, unsigned int crate);
00550 
00552     void timBCReset(unsigned int partition, unsigned int crate);
00553 
00555     void sendTimBurst(unsigned int partition, unsigned int crate, int count);
00556 
00558     void timVerbose(unsigned int partition, unsigned int crate);
00559 
00560     void timRegLoad(unsigned int partition, unsigned int crate, int reg, UINT16 val);
00561 
00562     UINT16 timReadRegister(unsigned int partition, unsigned int crate, int reg);
00563 
00564     void requestHardReset(UINT32 mid);
00565 
00566     void resumePolling();
00567 
00568     void stopPolling();
00569  private:
00570     TApi(const TApi&);
00571     TApi &operator=(const TApi &);
00572 
00574     SctApi::SctApi *worker;
00575 
00576     // For CINT and ROOT
00577     ClassDef(TApi,1)
00578 };
00579 
00580 /*  /// The name tapi is defined in the shared library (it still needs initialising) */
00581 /*  //extern TApi *tapi; */
00582 #endif

Generated on Fri Sep 16 18:01:59 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5