fdhwlib  2.0.25
/home/kopmann/git-mirror/fdhwlib/fdhwlib/Hw/Slt.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     Slt.h  -  description
00003 
00004     begin                : Thu Jun 29 2000
00005     copyright            : (C) 2000 by Andreas Kopmann
00006     email                : kopmann@hpe.fzk.de
00007  ***************************************************************************/
00008 
00009 
00010 
00011 #if defined (_MSC_VER) && (_MSC_VER >= 1000)
00012 #pragma once
00013 #endif
00014 
00015 #ifndef _INC_SLT_38563E480220_INCLUDED
00016 #define _INC_SLT_38563E480220_INCLUDED
00017 
00018 
00019 #include <Hw/SltDef.h>
00020 #include <Hw/SltRegister.h>
00021 #include <Hw/SltRegisterVector.h>
00022 
00023 #include <Hw/SltMemory.h>
00024 #include <Hw/sltmultiplicity.h>
00025 #include <Hw/SltControlReg.h>
00026 #include <Hw/SltStatusReg.h>
00027 #include <Hw/SltInterruptMask.h>
00028 #include <Hw/SltTimeStamp.h>
00029 #include <Hw/sltirvector.h>
00030 #include <Hw/SltPageStatusReg.h>
00031 #include <Hw/sltsetsecondcounter.h>
00032 #include <Hw/sltmultiplicityparameter.h>
00033 
00034 #include <Hw/Subrack.h>
00035 #include <Hw/subrackboard.h>
00036 
00037 
00038 #define SLT_REGS 50
00039 #define SLT_VREGS 10
00040 
00041 
00042 class Subrack;
00043 
00074 class Slt : public SubrackBoard {
00075 public:
00076   Slt(int ID, const char *inifile = "FE.ini");
00077 
00078   virtual ~Slt();
00079 
00080   int getVersion(int unit =0);
00081 
00084   bool checkPresence();
00085 
00093    int getHardwareModelVersion(); 
00094 
00098    void checkHardwareModelVersion(FILE *fout = stdout, const char *indent="");
00099 
00100 
00107   void getActualTime(SltTime *time);
00108 
00109 
00125   unsigned long setActualTime();
00126 
00127 
00145   //int checkActualTime(long int *tDiff);
00146 
00177   int checkActualTime(long int *tDiff, long int *tDiffEye, int * tMeas, int *tPhase,
00178                       long int *tDiffGps=0, int id=0, int n=1,
00179                       const char *gpsserver = "localhost", int gpsport = 0);
00180 
00181 
00195   int checkTime(double *tDiff=0, int *tSecErr=0, int *tPhase=0, procDuration *tPC = 0);
00196 
00197 
00210    enum RunMode {
00211         RUN,
00212         CAL,
00213         WAIT,
00214         STOP,
00215         CERR,
00216         UNKNOWN};
00217 
00218 
00223   RunMode getRunMode();
00224 
00226   std::string getRunModeText();
00227   std::string getRunModeText(RunMode mode);
00228 
00236   void getActivePages(int time, int *pages, int *continous);
00237 
00245   void convertToUTC(time_t *t_utc, unsigned long time);
00246 
00247   void convertToUTC(time_t *t_utc, SltTime& time);
00248 
00250   void convertToGPS(SltTime *time, time_t t_utc);
00251 
00252 
00254   void checkDeadTime(unsigned long long *tDead, unsigned long long *tVeto,
00255                 double *tRecord, double *tPageFull, procDuration *tMeas = 0);
00256 
00258   void readDeadTime(unsigned long *high, unsigned long *low);
00259 
00261   void readVetoTime(unsigned long *high, unsigned long *low);
00262 
00263 
00265   void readDeadTime(unsigned long long *time);
00266 
00268   void readVetoTime(unsigned long long *time);
00269 
00274   int readDeadTime (unsigned long long *tDead, unsigned long long *tVeto, 
00275                     unsigned long long *tInhibit);
00276 
00277 
00279   std::string convertTimeToText(unsigned long long time, int showSubSecs = 0);
00280 
00281 public: // members
00282 
00283   //##ModelId=39914F0000E0
00284   int nRegs;
00285 
00286   //##ModelId=39914F000054
00287   int nVRegs;
00288 
00289   //##ModelId=39914F000040
00290   Subrack* theSubrack;
00291 
00293   //##ModelId=39914F00000E
00294   SltRegister ** theRegister;
00295 
00296   //##ModelId=39914EFF03C3
00297   SltControlReg * controlReg;
00298   //##ModelId=39914EFF0391
00299   SltStatusReg * statusReg;
00300   //##ModelId=39914EFF035F
00301 
00307   SltRegister * IRstatus;
00308 
00312   SltInterruptMask * IRmask;
00313 
00314 
00315   SltIRvector * IRvector;
00316   //##ModelId=39914EFF02D3
00317 
00327   SltRegister * IRinput;  // Changed 4.12.00 ak
00328 
00334   SltRegister * Version; // Changed 4.12.00 ak
00335 
00339   SltRegister * SwNextPage;
00340 
00341 
00342 #if defined (SLT_VER) && (SLT_VER >= 300)
00343   // not available any more in version 3
00344 
00345 #else
00346 
00354   SltRegister * PageMaintenance; // New 20.12.00 ak
00355 
00364   SltRegister * RelPageFullInhibit;
00365 #endif
00366 
00376   SltRegister * SwSltTrigger;
00377 
00381   SltRegister * SwSetInhibit;
00382 
00387   SltRegister * SwRelInhibit;
00388 
00389 
00390   //##ModelId=39914EFF021F
00391   SltRegister * SwTestpulsTrigger;
00392 
00394   SltRegister * SwReadADC;
00395   //##ModelId=39914EFF01C5
00396   SltRegister * SwSecondStrobe;
00397   //##ModelId=39914EFF019D
00398   SltRegister * ConfSltFPGAs;
00399   //##ModelId=39914EFF0175
00400   SltRegister * ConfFltFPGAs;
00401   //##ModelId=39914EFF014D
00402   SltRegister * ActResetFlt;
00403   //##ModelId=39914EFF0124
00404   SltRegister * RelResetFlt;
00405   //##ModelId=39914EFF00FC
00406 
00407 #if defined (SLT_VER) && (SLT_VER >= 300)
00408   // not available any more in version 3
00409 #else
00410   SltRegister * ActStandbyFlt;
00411   //##ModelId=39914EFF00DE
00412   SltRegister * RelStandbyFlt;
00413 #endif
00414 
00415   //##ModelId=39914EFF00B6
00416   SltRegister * ActResetSlt;
00417   //##ModelId=39914EFF008E
00418   SltRegister * RelResetSlt;
00419 
00424 //#if defined (SLT_VER) && (SLT_VER >= 300)
00425   SltPageStatusReg * PageStatus;
00426 //#else
00427 //  SltRegister * PageStatus;
00428 //#endif
00429 
00435   SltRegister * ActualPage;
00436 
00443   SltRegister * NextPage;
00444 
00445   SltRegister * SetPageFree;
00446   //##ModelId=39914EFE03D6
00447   SltRegister * SetPageNoUse;
00448 
00449   //##ModelId=39914EFE03B8
00450   SltRegister * TestpulsAmpl;
00451   //##ModelId=39914EFE039A
00452   SltRegister * TestpulsStartSec;
00453   //##ModelId=39914EFE037C
00454   SltRegister * TestpulsStartSubSec;
00455 
00456   //##ModelId=39914EFE0368
00457   SltSetSecondCounter * SetSecCounter;
00458   //##ModelId=39914EFE034A
00459   SltRegister * SecCounter;
00460   //##ModelId=39914EFE032C
00461   SltRegister * SubSecCounter;
00462 
00468   SltRegister * T1;
00469 
00470 #if defined (SLT_VER) && (SLT_VER >= 110)
00471 
00480   SltRegister *sensorMask;
00481 
00487   SltRegister *sensorStatus;
00488 #endif
00489 
00490 
00491   //##ModelId=39914EFE02FC
00492   SltRegisterVector ** theRegisterVector;
00493 
00494   //##ModelId=39914EFE02E8
00495   SltTimeStamp * pageTimeStamp;
00496   //##ModelId=39914EFE02DC
00497   SltTimeStamp * lastTriggerTimeStamp;
00498   //##ModelId=39914EFE02C0
00499   SltRegisterVector * testpulsTiming;
00500   //##ModelId=39914EFE02AC
00501   SltRegisterVector * sensorData;
00502   //##ModelId=39914EFE0298
00503   SltRegisterVector * sensorConfig;
00504   //##ModelId=39914EFE0284
00505   SltRegisterVector * sensorUpperThresh;
00506   //##ModelId=39914EFE0278
00507   SltRegisterVector * sensorLowerThresh;
00508 
00509 
00514   SltMultiplicityParameter *multiplicityParameter;
00515 
00516 
00517   //##ModelId=39914EFE0266
00518   SltMemory * theMemory;
00519 
00520   SltMultiplicity *multiplicity;
00521 
00522 
00523 #if defined (SLT_VER) && (SLT_VER >= 300)
00524 
00528   SltRegister *vetoTimeHigh;
00529 
00530   SltRegister *vetoTimeLow;
00531 
00536   SltRegister *deadTimeHigh;
00537 
00538   SltRegister *deadTimeLow;
00539 
00541   SltRegister *resetDeadTime;
00542 
00544   procDuration deadCheckTime[24];
00545 
00547   unsigned long long deadStart[24];
00548 
00550   unsigned long long vetoStart[24];
00551 
00552 #endif
00553 
00554 
00555 private:
00557   //int ID;
00558 
00562 //  unsigned long gpsDelay;
00563 
00567 //  int leapSeconds;
00568 
00572 //  unsigned long nextLeapSecond;
00573 
00574 
00575    
00576 };
00577 
00578 #endif /* _INC_SLT_38563E480220_INCLUDED */
00579