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