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