00001
00002
00003 #ifndef SCTPIXELROD_TIMMODULE_H
00004 #define SCTPIXELROD_TIMMODULE_H
00005
00030 #include "TimDefine.h"
00031 #include "processor.h"
00032 #include "VmeInterface.h"
00033 #include "VmePort.h"
00034 #include "VmeModule.h"
00035
00036 namespace SctPixelRod {
00037
00038
00039
00041
00047 class TimException {
00048
00049 public:
00050
00051 TimException( std::string descriptor, int data1, int data2 );
00052 std::string getDescriptor() { return m_descriptor; };
00053 int getData1() { return m_data1; };
00054 int getData2() { return m_data2; };
00055
00056 private:
00057
00058 std::string m_descriptor;
00059 int m_data1;
00060 int m_data2;
00061 };
00062
00063
00064
00066
00073 class TimModule : public VmeModule {
00074
00075 public:
00076
00077
00078
00079
00080 TimModule( UINT32 baseAddr, UINT32 mapSize, VmeInterface & ourInterface );
00081
00082 virtual ~TimModule();
00083
00084
00085
00086 UINT32 getFirmware() { return m_firmware; };
00087 UINT32 getSerialNumber() { return m_serialNumber; };
00088 VmePort* getVmePort() { return m_vmePort; };
00089
00090
00091
00092 void initialize();
00093 void reset();
00094 void status ();
00095
00096 UINT32 fetchL1ID();
00097 UINT16 fetchTimID();
00098
00099 void intTrigStart( const TimMaskFrequency frequency );
00100 void intTrigStop();
00101
00102 void issueCommand( const TimBitCommand mask );
00103 void issueVCAL( const UINT8 pipelineDelay );
00104
00105 void loadBitClear( const TimRegister addr, const UINT16 mask );
00106 void loadBitSet( const TimRegister addr, const UINT16 mask );
00107 void loadByteHi( const TimRegister addr, const UINT8 byte );
00108 void loadByteLo( const TimRegister addr, const UINT8 byte );
00109
00110 UINT16 regFetch( const TimRegister addr );
00112
00113 void regLoad( const TimRegister addr, const UINT16 data );
00115
00116 void seqFetch( const UINT16 size, UINT16 buffer[] );
00117 void seqLoad( const UINT16 size, const UINT16 buffer[] );
00118 void seqRun( const UINT16 size );
00119
00120 UINT16 vmeFetch( const UINT32 addr )
00121 throw (VmeException &);
00122
00123 void vmeLoad( const UINT32 addr, const UINT16 data )
00124 throw (VmeException &);
00125
00126 private:
00127
00128 UINT32 m_firmware;
00129 UINT32 m_serialNumber;
00130 VmePort* m_vmePort;
00131
00132 };
00133
00134 }
00135
00136
00137
00139
00140 namespace std {
00141
00142 ostream& operator<<( ostream& os, SctPixelRod::TimModule& tim );
00143
00144 }
00145
00146 #endif // SCTPIXELROD_TIMMODULE_H