00001
00024
00025 #ifndef CLDAQ__TVMEMPX201AMODULE_HH
00026 #define CLDAQ__TVMEMPX201AMODULE_HH
00027
00028 #include "Tglobals.h"
00029 #include "TVmeModule.hh"
00030
00031 class TDataElement;
00032
00033
00053 class TVmeMpx201aModule
00054 : public TVmeModule
00055 {
00056
00057 private:
00058 enum {
00059 ID = 0x00,
00060 DEVICE_TYPE = 0x02,
00061 CONTROL_STATUS = 0x04,
00062 VME_OFFSET_ADDRESS = 0x06,
00063 PAGE_SET = 0x08,
00064 RESERVED = 0x0a,
00065 TEST_MODE = 0x0c,
00066 TEST_DATA = 0x0e,
00067 INTERRUPT = 0x10,
00068 BLOCK_COUNT = 0x12,
00069 DAQ_POINTER = 0x14,
00070 SAMPLE_RATE = 0x16,
00071 FRONT_PORCH = 0x18,
00072 FRAME_LENGTH = 0x1a,
00073 ROW_LENGTH = 0x1c
00074 };
00075
00076 public:
00077 enum {
00078 tIdRegister,
00079 tDeviceTypeRegister,
00080 tControlStatusRegister,
00081 tVmeOffsetAddressRegister,
00082 tPageSetAddressRegister,
00083 tReserved,
00084 tTestModeRegister,
00085 tTestDataRegister,
00086 tInterruptConfigurationRegister,
00087 tBlockCounterRegister,
00088 tAcquisitionPointerRegister,
00089 tSampleRateRegister,
00090 tFrontPorchRegister,
00091 tFrameLengthRegister,
00092 tRowLengthRegister,
00093 tNumberOfChannels
00094 };
00095
00096 public:
00097 enum Tsync_t {
00098 tScannerMode,
00099 tInternalSynchronisationMode,
00100 tExternalSynchronisationMode,
00101 tModeUnknown = -1
00102 };
00103
00104 enum TdataCapture_t {
00105 tTransientMode,
00106 tContinuousMode
00107 };
00108
00109 enum { tBlock = 2048 };
00110
00111 public:
00112 TVmeMpx201aModule( Toff_t offset, Tint mapsize = 0x1000, Tint nch = tNumberOfChannels );
00113 TVmeMpx201aModule( const TVmeMpx201aModule& right );
00114 ~TVmeMpx201aModule();
00115
00116 public:
00117 const TVmeMpx201aModule& operator=( const TVmeMpx201aModule& right );
00118 Tbool operator==( const TVmeMpx201aModule& right ) const;
00119 Tbool operator!=( const TVmeMpx201aModule& right ) const;
00120
00121 public:
00122 Tint Clear();
00123 Tint Update();
00124 Tint Initialize();
00125 Tvoid FillData( TDataElement& element, Tint channel );
00126
00127 public:
00128 Tshort GetProductID() const;
00129 Tshort GetDeviceType() const;
00130 Tbool IsMemoryBlockFull() const;
00131 Tbool IsDataOverFlow() const;
00132 Tsync_t GetEventSynchronisationMode() const;
00133 Toff_t GetOffsetAddressForDaughterBoard() const;
00134 Tint GetPage() const;
00135 Tint GetNumberOfBlock() const;
00136 Tvoid EnableAccessToDaughterBoard();
00137 Tvoid DisableAccessToDaughterBoard();
00138 Tvoid SetBufferOrientation( Tbit bit );
00139 Tvoid SetScanCompleteFlag( Tbit bit );
00140 Tvoid SetMemoryBlockFullFlag( Tbit bit );
00141 Tvoid SetDataOverFlowFlag( Tbit bit );
00142 Tvoid SetEventSynchronisationMode( Tsync_t mode );
00143 Tvoid SetDataCaptureMode( TdataCapture_t mode );
00144 Tvoid EnableAcquisition();
00145 Tvoid DisableAcquisition();
00146 Tvoid EnableSystemFailure();
00147 Tvoid DisableSystemFailure();
00148 Tvoid Reset();
00149 Tvoid SetOffsetAddressForDaughterBoard( Toff_t offset );
00150 Tvoid SetPage( Tint id );
00151 Tvoid SetSamplingRate( Tint nsample );
00152 Tvoid SetNumberOfBlock( Tint nblock );
00153 Tvoid SetupCCDmeasurement( Tint rate, Tint nblock, Toff_t offset );
00154 Tint GetMappingSizeOfDaughterBoard() const;
00155 Tvoid NextEventProcedure();
00156 TUshort Read( Tint ch );
00157
00158 };
00159
00160 inline Tint TVmeMpx201aModule::GetNumberOfBlock() const
00161 {
00162
00163 Tshort retval = *( (Tshort*)( theBaseAddress + BLOCK_COUNT ) );
00164 retval &= 0x7fff;
00165 return (Tint)retval;
00166 }
00167
00168 inline Tshort TVmeMpx201aModule::GetProductID() const
00169 {
00170 return *( (Tshort*)( theBaseAddress + ID ) );
00171 }
00172
00173 inline Tshort TVmeMpx201aModule::GetDeviceType() const
00174 {
00175 return *( (Tshort*)( theBaseAddress + DEVICE_TYPE ) );
00176 }
00177
00178 inline Tbool TVmeMpx201aModule::IsMemoryBlockFull() const
00179 {
00180 return getBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 9 );
00181 }
00182
00183 inline Tbool TVmeMpx201aModule::IsDataOverFlow() const
00184 {
00185 return getBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 8 );
00186 }
00187
00188 inline Tint TVmeMpx201aModule::GetPage() const
00189 {
00190 Tshort regval = *( (Tshort*)( theBaseAddress + PAGE_SET ) );
00191 regval &= 0x0007;
00192 return (Tint)regval;
00193 }
00194
00195 inline Tvoid TVmeMpx201aModule::EnableAccessToDaughterBoard()
00196 {
00197 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 15, 1 );
00198 return;
00199 }
00200
00201 inline Tvoid TVmeMpx201aModule::DisableAccessToDaughterBoard()
00202 {
00203 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 15, 0 );
00204 return;
00205 }
00206
00207 inline Tvoid TVmeMpx201aModule::SetBufferOrientation( Tbit bit )
00208 {
00209 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 11, bit );
00210 return;
00211 }
00212
00213 inline Tvoid TVmeMpx201aModule::SetScanCompleteFlag( Tbit bit )
00214 {
00215 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 10, bit );
00216 return;
00217 }
00218
00219 inline Tvoid TVmeMpx201aModule::SetMemoryBlockFullFlag( Tbit bit )
00220 {
00221 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 9, bit );
00222 return;
00223 }
00224
00225 inline Tvoid TVmeMpx201aModule::SetDataOverFlowFlag( Tbit bit )
00226 {
00227 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 8, bit );
00228 return;
00229 }
00230
00231 inline Tvoid TVmeMpx201aModule::EnableAcquisition()
00232 {
00233 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 4, 0 );
00234 return;
00235 }
00236
00237 inline Tvoid TVmeMpx201aModule::DisableAcquisition()
00238 {
00239 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 4, 1 );
00240 return;
00241 }
00242
00243 inline Tvoid TVmeMpx201aModule::EnableSystemFailure()
00244 {
00245 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 1, 0 );
00246 return;
00247 }
00248
00249 inline Tvoid TVmeMpx201aModule::DisableSystemFailure()
00250 {
00251 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 1, 1 );
00252 return;
00253 }
00254
00255 inline Tvoid TVmeMpx201aModule::Reset()
00256 {
00257 setBit( (TUshort*)( theBaseAddress + CONTROL_STATUS ), 0, 1 );
00258 return;
00259 }
00260
00261 #endif