メインページ   モジュール   名前空間一覧   クラス階層   アルファベット順一覧   構成   ファイル一覧   構成メンバ   ファイルメンバ   関連ページ    

TVmeRpv130Module.cc

解説を見る。
00001 // =====================================================================
00002 //  $Id: TVmeRpv130Module.cc,v 1.4 2004/03/07 10:30:31 goiwai Exp $
00003 //  $Name: CLDAQ-1-14-03 $
00004 //  $Log: TVmeRpv130Module.cc,v $
00005 //  Revision 1.4  2004/03/07 10:30:31  goiwai
00006 //  ROOTに組みこむためのおまじないマクロを埋めこみました。
00007 //  全てにおいて完全に動作するわけではありません。
00008 //
00009 //  Revision 1.3  2003/10/06 17:02:40  goiwai
00010 //  *** empty log message ***
00011 //
00012 //  Revision 1.2  2003/07/30 16:19:12  goiwai
00013 //  ファイルにコミットログをつけることにしました.
00014 //
00015 // =====================================================================
00016 #include "TVmeRpv130Module.hh"
00017 #include "TDataSegment.hh"
00018 #include "TDataElement.hh"
00019 
00020 TVmeRpv130Module::TVmeRpv130Module( Toff_t offset, Tint mapsize, Tint nch )
00021   : TVmeModule( nch, offset, mapsize, tA16D16 ),
00022     theReadoutMode( tReadoutWithThrough ), theLevelStatus( 0x0000 )
00023 {
00024   LevelDown();
00025 }
00026 
00027 TVmeRpv130Module::TVmeRpv130Module( const TVmeRpv130Module& right )
00028   : TVmeModule( right ), 
00029     theReadoutMode( right.theReadoutMode ),
00030     theLevelStatus( right.theLevelStatus )
00031 {;}
00032 
00033 TVmeRpv130Module::~TVmeRpv130Module()
00034 {;}
00035 
00036 const TVmeRpv130Module& TVmeRpv130Module::operator=( const TVmeRpv130Module& right )
00037 {
00038   *( (TVmeModule*)this ) = *( (TVmeModule*)(&right) );
00039   theReadoutMode = right.theReadoutMode;
00040   theLevelStatus = right.theLevelStatus;
00041   return *this;
00042 }
00043 
00044 Tbool TVmeRpv130Module::operator==( const TVmeRpv130Module& right ) const
00045 {
00046   Tbool ret = Ttrue;
00047   ret &= ( *( (TVmeModule*)this ) == *( (TVmeModule*)(&right) ) );
00048   ret &= ( theReadoutMode == right.theReadoutMode );
00049   ret &= ( theLevelStatus == right.theLevelStatus );
00050   return ret;
00051 }
00052 
00053 Tbool TVmeRpv130Module::operator!=( const TVmeRpv130Module& right ) const
00054 {
00055   Tbool ret = Tfalse;
00056   ret |= ( *( (TVmeModule*)this ) != *( (TVmeModule*)(&right) ) );
00057   ret |= ( theReadoutMode != right.theReadoutMode );
00058   ret |= ( theLevelStatus != right.theLevelStatus );
00059   return ret;
00060 }
00061 
00062 Tint TVmeRpv130Module::Clear()
00063 {
00064   setBit( (TUshort*)( theBaseAddress + CSR1 ), 0, 1 );
00065   setBit( (TUshort*)( theBaseAddress + CSR1 ), 1, 1 );
00066 
00067   setBit( (TUshort*)( theBaseAddress + CSR2 ), 0, 1 );
00068   setBit( (TUshort*)( theBaseAddress + CSR2 ), 1, 1 );
00069   return theStatus = tStatusSuccess;
00070 }
00071 
00072 Tint TVmeRpv130Module::Update()
00073 {
00074   return Clear();
00075 }
00076 
00077 Tint TVmeRpv130Module::Initialize()
00078 {
00079   Clear();
00080   Disable();
00081   return theStatus = tStatusSuccess;
00082 }
00083 
00084 Tvoid TVmeRpv130Module::FillData( TDataElement& element, Tint channel )
00085 {
00086   if ( channel < 0 || channel >= theNumberOfChannels ) {
00087     Tcerr << "TVmeRpv130Module::FillData: invalid ID " << channel << Tendl;
00088     theStatus = -EFAULT;
00089     element.FillData( &theStatus, tTypeInt, 1 );
00090   } else {
00091     TUshort data = Read();
00092     element.FillData( &data, tTypeUnsignedShort, 1 );
00093   }
00094   return;
00095 }
00096 
00097 Tvoid TVmeRpv130Module::Pulse()
00098 {
00099   *( (TUshort*)( theBaseAddress + PULSE ) ) = 0x000ff;
00100   return;
00101 }
00102 
00103 Tvoid TVmeRpv130Module::Pulse( Tint pattern )
00104 {
00105   *( (TUshort*)( theBaseAddress + PULSE ) ) = (TUshort)pattern;
00106   return;
00107 }
00108 
00109 Tvoid TVmeRpv130Module::Level()
00110 {
00111   *( (TUshort*)( theBaseAddress + LEVEL ) ) = 0x000ff;
00112   theLevelStatus = 0x00ff;
00113   return;
00114 }
00115 
00116 Tvoid TVmeRpv130Module::Level( Tint pattern )
00117 {
00118   *( (TUshort*)( theBaseAddress + LEVEL ) ) = (TUshort)pattern;
00119   theLevelStatus = pattern & 0x00ff;
00120   return;
00121 }
00122 
00123 Tvoid TVmeRpv130Module::LevelDown()
00124 {
00125   *( (TUshort*)( theBaseAddress + LEVEL ) ) = 0x00000;
00126   theLevelStatus = 0x0000;
00127   return;
00128 }
00129 
00130 Tvoid TVmeRpv130Module::LevelDown( Tint channel )
00131 {
00132   setBit( (TUshort*)(&theLevelStatus), channel, 0 );
00133   *( (TUshort*)( theBaseAddress + LEVEL ) ) = theLevelStatus;
00134 
00135   return;
00136 }
00137 
00138 Tvoid TVmeRpv130Module::LevelUp()
00139 {
00140   *( (TUshort*)( theBaseAddress + LEVEL ) ) = 0x000ff;
00141   theLevelStatus = 0x00ff;
00142   return;
00143 }
00144 
00145 Tvoid TVmeRpv130Module::LevelUp( int channel )
00146 {
00147   setBit( (TUshort*)(&theLevelStatus), channel, 1 );
00148   *( (TUshort*)( theBaseAddress + LEVEL ) ) = theLevelStatus;
00149   return;
00150 }
00151 
00152 Tvoid TVmeRpv130Module::Enable()
00153 {
00154   setBit( (TUshort*)( theBaseAddress + CSR1 ), 4, 1 );
00155   setBit( (TUshort*)( theBaseAddress + CSR1 ), 6, 1 );
00156 
00157   setBit( (TUshort*)( theBaseAddress + CSR2 ), 4, 1 );
00158   setBit( (TUshort*)( theBaseAddress + CSR2 ), 6, 1 );
00159   return;
00160 }
00161 
00162 Tvoid TVmeRpv130Module::Disable()
00163 {
00164   setBit( (TUshort*)( theBaseAddress + CSR1 ), 4, 0 );
00165   setBit( (TUshort*)( theBaseAddress + CSR1 ), 6, 0 );
00166 
00167   setBit( (TUshort*)( theBaseAddress + CSR2 ), 4, 0 );
00168   setBit( (TUshort*)( theBaseAddress + CSR2 ), 6, 0 );
00169   return;
00170 }
00171 
00172 TUshort TVmeRpv130Module::Read()
00173 {
00174   TUshort data;
00175   switch ( theReadoutMode ) {
00176     case tReadoutWithLatch1:
00177       data = *( (TUshort*)( theBaseAddress + LATCH1 ) );
00178     case tReadoutWithLatch2:
00179       data = *( (TUshort*)( theBaseAddress + LATCH2 ) );
00180     case tReadoutWithRSFF:
00181       data = *( (TUshort*)( theBaseAddress + RSFF ) );
00182     case tReadoutWithThrough:
00183       data = *( (TUshort*)( theBaseAddress + THROUGH ) );
00184     default:
00185       data = *( (TUshort*)( theBaseAddress + RSFF ) );
00186   }
00187   data &= 0x00ff;
00188   return data;
00189 }
00190 
00191 #ifdef __CLDAQ_ROOT_DLL
00192     ClassImp(TVmeRpv130Module)
00193 #endif


CLDAQ - a Class Library for DataAcQuisition (Version 1.14.3)
Go IWAI -- goiwai at users.sourceforge.jp