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