00001 #ifndef PIT_COMM_H 00002 #define PIT_COMM_H 00003 00004 #include <log4cpp/BasicConfigurator.hh> 00005 #include <log4cpp/Category.hh> 00006 #include "pit_def.h" 00007 //#include "pit_comm_exception.h" 00008 00009 #include <dis.hxx> // dim server definition file 00010 00011 // the fe2rorc library has to be declared as a C type linkage 00012 // without decorations and things like that 00013 extern "C" { 00014 #include <fec2rorc_lib.h> 00015 } 00016 00017 00018 00026 class pit_comm 00027 { 00028 00029 private: 00030 00031 00033 log4cpp::Category *logCom; 00034 00035 chan_key *rorc; 00036 int rorcStatus; 00037 00039 00041 bool DDLLinkStatus; 00042 00044 00046 int controlFPGAAnswers; 00047 00049 DimService *serviceCommunicationStatus; 00050 00051 00053 void PITDecodeRORCError(int rorcError,const char *extraInfo ); // new member method proposed by gianluca 00054 00056 void PITDecodeComError(int comError,const char * extraInfo); 00057 00059 int PITSetWrA(UInt28); 00060 00062 int PITSetRdA(UInt28); 00063 00065 int PITSetLen(UInt19); 00066 00068 int PITGetRdA(); 00069 00071 int PITGetWrA(); 00072 00074 int PITGetLen(); 00075 00077 int PITGetRdLen(); 00078 00080 int PITGetWrLen(); 00081 00082 00083 00084 00085 public: 00086 pit_comm(void); 00087 ~pit_comm(void); 00088 00089 int PITGetControl0(); 00090 00092 00100 int PITGetBusStatus(); 00101 int PITGetControl1(); 00102 int PITGetVersion(); 00103 int PITSetControl0(UInt8 value); 00104 int PITSetControl1(UInt8 value); 00105 00108 inline bool PITGetDDLLinkStatus() { return DDLLinkStatus; }; 00109 00114 bool PITCheckCommStatus(); 00115 00116 00123 int PITReadBlock(UInt28 address, UInt19 datalength, UInt32* data); 00124 00131 int PITWriteBlock(UInt28 address, UInt19 datalength, UInt32* data); 00132 00133 00139 int PITReadWord(UInt28 address, UInt32* data); 00140 00147 int PITWriteWord(UInt28 address, const UInt32 & data); 00148 00150 00152 int PITrorcReset(void); 00153 00154 }; 00155 00156 #endif