pit_driver_opticalLink.h

Go to the documentation of this file.
00001 #ifndef  PIT_DRIVER_OPTICALLINK_H
00002 #define  PIT_DRIVER_OPTICALLINK_H
00003 
00004 #include <dis.hxx>                      // dim server definition file
00005 #include <exception>
00006 
00007 #include "pit_def.h"
00008 #include "pit_comm.h"
00009 #include "pit_driver_optinBoard.h"
00010 #include "pit_driver_foChannel.h"
00011 
00012 using namespace std;
00013 
00014 //****************************************************
00015 // Offsets of the several registers
00016 #define LINK_SETTING_OFFSET                             0x21 
00017 #define LINK_STATUS_OFFSET                                      0x15 
00018 #define LINK_TIMESTAMP_OFFSET                           0x2D 
00019 #define LINK_ERROR_COUNTER_OFFSET                       0x54 
00020 #define LINK_MIN_FASTOR_COUNTS_INNER_OFFSET     0x60 
00021 #define LINK_MAX_FASTOR_COUNTS_INNER_OFFSET     0x6A 
00022 #define LINK_MIN_FASTOR_COUNTS_OUTER_OFFSET     0x74 
00023 #define LINK_MAX_FASTOR_COUNTS_OUTER_OFFSET     0x60 
00024 #define LINK_ENNABLE_UDF_POS                            21       
00025 
00026 #define NUMBER_HSTAVE_INNER 2
00027 
00028 const int NumberTimeStamps=3;
00029 
00030 
00031 
00032 class pit_driver_optinBoard;
00033 class pit_driver_foChannel;
00034 
00036 class pit_driver_opticalLink 
00037 {
00038 
00039   unsigned int linkNumber; 
00040   pit_driver_optinBoard *motherOptinBoard;
00041   
00042   
00043   t_sideCoord side; 
00044   unsigned int sector; 
00045   unsigned int half_stave; 
00046 
00048 
00051   pit_driver_foChannel *foChannel[NUMBER_FO_CHANNELS];
00052   
00054 
00058   pit_comm *commFEE;     
00059 
00061   log4cpp::Category *logDriverOpticalLink;      
00062   
00063 
00064   //********************************************
00065   // Private data members representing HARDWARE status
00066   // Some of them correspond to DIM Services. These services are registered
00067   // by the constructor of this object
00068   //*******************************************
00069 
00071 
00072   int linkRequired;
00073         
00074   DimService *serviceLinkRequired;
00075 
00077 
00078   int linkActive;
00079           
00081 
00082   DimService *serviceLinkActive;
00083   
00085 
00086   int linkLocked; 
00087         
00089   DimService * serviceLinkLocked;
00090   
00092 
00097   int linkPhase;
00098 
00100 
00101   int linkDelay;
00102   
00103 
00105 
00106   int foMask;
00107   
00108 
00110 
00111   int udfFoPattern;
00112   
00113 
00115 
00116   //int selfMaskingEnable;
00118   bool udfEnable;
00119   
00120   // Private methods section
00121 
00122 
00123 
00124           
00126   void decodeLinkSetting(UInt32 linkSetting);
00127   
00129   void decodeLinkStatus(UInt32 linkStatus);
00130         
00132   void refreshStatusServices(void);
00133   
00134 
00135 
00137 
00143   UInt32 readLinkStatus(void) throw(exception)  ;
00144 
00145  public:
00146         
00147         // constructor
00148     pit_driver_opticalLink(unsigned int linkNumber, pit_comm *commFEE, pit_driver_optinBoard *OptinBoard);
00149         // destructor
00150     ~pit_driver_opticalLink(void);
00151     
00153 
00159          UInt32 readLinkSetting(void) throw(exception)  ;
00160          
00162 
00170         int writeLinkSetting(UInt32 p_linkSetting) throw(exception)  ;
00171         
00173     unsigned int getLinkNumber() const {return linkNumber;}  
00175     unsigned int getBoardNumber() const;// {return motherOptinBoard->getBoardNumber();}
00176 
00178     t_sideCoord getSide() const {return side;}  
00179  
00181     unsigned int getSector() const {return sector;}
00182     
00184     unsigned int getHalfStave() const {return half_stave;}
00185 
00186         // getters for the link status members 
00187     //bool getLinkActive(){return linkActive;}//!< Getter of linkActive, not accessing PIT hardware. 
00188     //bool getLinkLocked(){return linkLocked;}//!< Getter of linkLocked, not accessing PIT hardware.
00189     //int getLinkPhase(){return linkPhase;}//!< Getter of linkPhase, not accessing PIT hardware.
00190     //int getLinkDelay(){return linkDelay;}//!< Getter of linkDelay, not accessing PIT hardware.
00191     
00192         // linik settings that can be read also
00193     int getFoMask(){return foMask;}
00194     int getUdfFoPattern(){return udfFoPattern;}
00195   //  int getSelfMaskingEnable(){return selfMaskingEnable;}//!< method without acessing the hardware just returning the internal member
00196     
00198     pit_driver_foChannel& getFoChannel(unsigned int channelNum);
00199 
00200 
00202 
00203     void refreshDetectorCoordinates();
00204 
00206     UInt32 refreshLinkSetting();
00207     
00209     UInt32 refreshLinkStatus();
00210     
00212 
00218   bool refreshLinkRequired(void);
00219 
00220 
00221 
00223 
00228   bool readLinkActive(void) throw(exception)  ;
00229 
00230   
00231 
00233 
00238   bool readLinkLocked(void) throw(exception) ;
00239 
00240   
00241  
00242 
00244 
00250   int readLinkPhase(void) throw(exception) ;
00251 
00253 
00259   int readLinkDelay(void) throw(exception) ;
00260 
00262 
00270   int writeLinkDelay(int p_linkDelay) throw(exception) ;
00271 
00273 
00280   int readFoMask(void) throw(exception) ;
00281 
00283 
00291   int writeFoMask(int p_foMask) throw(exception) ;
00292 
00294 
00301   int readUdfFoPattern(void) throw(exception) ;
00302 
00304 
00312   int writeUdfFoPattern(int p_udfFoPattern) throw(exception) ;
00313 
00314 
00316 
00324   int readSelfMaskingEnable(void) throw(exception) ;
00325 
00326 
00328 
00336   int writeSelfMaskingEnable(int p_selfMaskingEnable) throw(exception) ;
00337 
00338 
00340 
00347   int readTimeStamp(int p_timeStampNumber) throw(exception) ;
00348 
00350 
00356   int readErrorCounter(void) throw(exception) ;
00357 
00359 
00360   UInt28 getBoardBaseAdress(void)const;
00361   
00363   bool isInnerLayer(void)const;
00364   
00366   int refresh();
00367   
00369   int writeEnUdFastors(bool enable);
00370   bool readEnUdFastors();
00371 
00372 };
00373 
00374 #endif

Generated on Sat Mar 29 22:55:55 2008 for pixelTrigger by  doxygen 1.5.0