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