Main Page   Modules   Namespace List   Class Hierarchy   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 <string>
00007 #include <TArrayD.h>
00008 #include <TArrayI.h>
00009 #include <TArrayL.h>
00010 #include <TArrayS.h>
00011 
00012 // Declare classes for purposes of CINT interface
00013 namespace SctApi {
00014 class SctApi;
00015 class Trigger;
00016 class Scan; 
00017 
00018 class TriggerImpl;
00019 class ScanDefImpl;
00020 }
00021 
00022 #include "processor.h"
00023 
00024 #include <TObject.h>
00025 
00026 using std::string;
00027 
00028 // using namespace SctPixelRod;
00029 
00033 class TTrigger {
00034   TTrigger &operator=(const TTrigger &);
00035 
00036  public:
00038   TTrigger();
00039 
00040   TTrigger(const TTrigger &);
00041 
00043   virtual ~TTrigger();
00044 
00045   void singleL1A();
00046   void calL1A(int delay);
00047   void pulseL1A(int delay);
00048   void softL1A(int delay);
00049   void softCalL1A(int delay, int delay2);
00050   void softPulseL1A(int delay, int delay2);
00051   void bcL1A(int delay);
00052   void bcCalL1A(int delay, int delay2);
00053   void bcPulseL1A(int delay, int delay2);
00054 
00055   SctApi::Trigger *getTrigger();
00056 
00058   int incCmd;
00059 
00061   int incData;
00062 
00063  private:
00064   void update();
00065 
00066   SctApi::TriggerImpl *worker;
00067 
00068   // For CINT and ROOT
00069   ClassDef(TTrigger,1)
00070 };
00071 
00077 class TScanDef {
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 
00098   SctApi::Scan *getScan();
00099 
00101   long trigsPerBurst;
00102 
00104   int scanVariable;
00105 
00107   int scanVariable2;
00108 
00110   TTrigger trigSequence;
00111 
00113   TTrigger trigSequence2;
00114 
00116   int format;
00117 
00119   int full;
00120 
00122   int bits32;
00123 
00125   int loopCalLine;
00126 
00128   int distSlave;
00129 
00131   int debug;
00132  private:
00134   void update();
00135 
00136   SctApi::ScanDefImpl *worker;
00137 
00138   // For CINT and ROOT
00139   ClassDef(TScanDef,1)
00140 };
00141 
00157 class TApi : public TObject {
00158   public:
00160     TApi(int initDebug = 0);
00161 
00163     ~TApi();
00164 
00166 
00169     void initialiseAll(int runNumber);
00170 
00172     void shutdownAll();
00173 
00175     void setRunNumber(int newRun);
00176 
00178     void setScanNumber(int newScan);
00179 
00180     /*************** ROD Diagnostics ********************/
00181 
00183 
00187     void echo(unsigned int partition, unsigned int crate, unsigned int rod,
00188               unsigned int length, long *data);
00189 
00191     void loadConfiguration();
00192 
00194     void configureBOC(unsigned int partition, unsigned int crate, unsigned int rod);
00195 
00197     void awaitResponse(unsigned int partition, unsigned int crate, unsigned int rod, int timeout = 5);
00198 
00200     unsigned long *getResponse(unsigned int partition, unsigned int crate, unsigned int rod);
00201 
00203     unsigned long *getResponse(unsigned int partition, unsigned int crate, unsigned int rod, 
00204                                unsigned long *length);
00205 
00207 
00211     bool getRodMessage(unsigned int partition, unsigned int crate, unsigned int rod,
00212                char *buffer, int &length);
00213 
00215 
00221     void flashLED(unsigned int partition, unsigned int crate, unsigned int rod,
00222           unsigned long slaveNumber, long period = 1000, long flashes = 10);
00223 
00224 
00225     void status();
00226 
00227     /***************** Direct ROD access (Debug only) ********************/
00230 
00231 
00234     Int_t dspBlockDump(unsigned int partition, unsigned int crate, unsigned int rod,
00235                        long dspStart, long numWords, long dspNumber);
00236 
00238 
00241     Int_t dspBlockDumpFile(unsigned int partition, unsigned int crate, unsigned int rod,
00242                            long dspStart, long numWords, long dspNumber, string filename);
00243 
00245 
00248     unsigned long *dspBlockRead(unsigned int partition, unsigned int crate, unsigned int rod,
00249                        long dspStart, long numWords, long dspNumber, long *length);
00250 
00252     int dspBlockWrite(unsigned int partition, unsigned int crate, unsigned int rod,
00253                       unsigned long *buffer, unsigned long dspAddress, long numWords, long dspNumber);
00254 
00256     unsigned long readRodStatusReg(unsigned int partition, unsigned int crate, unsigned int rod,
00257                    long regNumber);
00258 
00260     unsigned long readRodCommandReg(unsigned int partition, unsigned int crate, unsigned int rod,
00261                     long regNumber);
00262 
00264     unsigned long dspSingleRead(unsigned int partition, unsigned int crate, unsigned int rod,
00265                 const unsigned long dspAddr, long dspNumber);
00266 
00268     void dspSingleWrite(unsigned int partition, unsigned int crate, unsigned int rod,
00269                         unsigned long dspAddr, unsigned long value, long dspNumber);
00270 
00272     void createDebugPrimList();
00273 
00275     void addDebugPrimList(unsigned long length, long index, long id, long version,
00276               unsigned long * body);
00278     void sendDebugPrimList(unsigned int partition, unsigned int crate, unsigned int rod);
00279 
00281     void sendDebugSlavePrimList(unsigned int partition, unsigned int crate, unsigned int rod,
00282                                 unsigned int slave, bool await, bool response);
00283 
00285     unsigned long *retrieveModule(UINT32 mid);
00286 
00287     /**** Official SCTAPI bit (majority unimplemented) ******/
00288 
00290 
00294     UINT32 findModule(string sn);
00295 
00297     UINT32 findModule(INT32 mur, INT32 module);
00298 
00300     UINT32 findBarrelModule(INT32 barrel, INT32 row, INT32 number);
00301 
00303     UINT32 findEndcapModule(INT32 disk, INT32 ring, INT32 number);
00304 
00306     void getABCDModule(UINT32 bank);
00307 
00309     void getABCDModule(UINT32 mid, UINT32 bank);
00310 
00312     void setABCDModule(UINT32 mid, UINT32 bank);
00313 
00315 
00320     void sendABCDModule(UINT32 mid, UINT32 bank, UINT32 type=2);
00321 
00323     void modifyABCDMask(UINT32 mid, UINT32* mask);
00324 
00326     void modifyABCDTrims(UINT32 mid, UINT8* trims);
00327 
00329     void modifyABCDVar(UINT32 typ, FLOAT32 var);
00330 
00332     void modifyABCDVar(UINT32 mid, UINT32 typ, FLOAT32 var);
00333 
00335     void modifyABCDVar(UINT32 mid, UINT32 c, UINT32 typ, FLOAT32 var);
00336 
00338     void modifyBOCParam(unsigned int partition, unsigned int crate, unsigned int rod,
00339                         unsigned int channel, unsigned int type, unsigned int val);
00340 
00342     void defaultScan(int type);
00343 
00345     void tidyHistogramming();
00346 
00348     void doScan(TScanDef scan);
00349 
00351     void doRawScan(TScanDef scan, int delay, bool clkBy2);
00352 
00354     void sendTrigger(unsigned int partition, unsigned int crate, unsigned int rod, TTrigger trig);
00355 
00357 
00360     void printABCDModule(int mid);
00361 
00363 
00366     void printABCDRodModule(int mid, int bank);
00367 
00369     void printBOCSetup(unsigned int partition, unsigned int crate, unsigned int rod);
00370 
00372     void printBOCRegisters(unsigned int partition, unsigned int crate, unsigned int rod);
00373 
00375     void rawData(unsigned int partition, unsigned int crate, unsigned int rod, int delay, int units, bool setMask = true);
00376 
00378     char *probe(unsigned int partition, unsigned int crate, unsigned int rod, int *length, signed int harness = -1);
00379 
00381 
00384     void lasersOff();
00385 
00387     void decodeEvent(unsigned int partition, unsigned int crate, unsigned int rod, 
00388                      int sl, int index, bool extFlag = false, bool errorType = false);
00389 
00391 
00394     void setDebugLevel(unsigned int level);
00395 
00397     unsigned int getDebugLevel();
00398 
00399     /* *************  TIM functs **************/
00400 
00402 
00405     void freeTriggers(unsigned int partition, unsigned int crate,
00406               double freq);
00407 
00409     void stopTriggers(unsigned int partition, unsigned int crate);
00410 
00412     void timL1A(unsigned int partition, unsigned int crate);
00413 
00415     void timCalL1A(unsigned int partition, unsigned int crate, int delay);
00416 
00417     void requestHardReset(UINT32 mid);
00418 
00420     void printHex(UINT32 num, int width);
00421  private:
00422     /********** Should these be part of the API? **************/
00423 
00425 
00430     int initialiseRod(unsigned int partition, unsigned int crate, unsigned int rod);
00431 
00433 
00439     int initialiseModule(string module);
00440 
00441  private:
00443     SctApi::SctApi *worker;
00444 
00445     // For CINT and ROOT
00446     ClassDef(TApi,1)
00447 };
00448 
00449 /*  
00450 /*  //extern TApi *tapi; */
00451 #endif

Generated on Mon Dec 8 18:04:04 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3