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