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

TCamacModule.hh

解説を見る。
00001 // =====================================================================
00021 // =====================================================================
00022 #ifndef __TCAMACMODULE_HH
00023 #define __TCAMACMODULE_HH
00024 
00025 #include "Tglobals.h"
00026 #include "TModule.hh"
00027 
00028 // interface to use only yasu driver
00029 typedef struct CamacDriverInterface
00030 {
00031   TUint _naf;
00032   Tshort _q;
00033   Tshort _x;
00034   union DataPartOfCamacData
00035   {
00036     TUshort _d16;
00037     TUint _d24;
00038   } _data;
00039 };
00040 
00041 enum Tdata_t { 
00042   t16bitModule = 16, 
00043   t24bitModule = 24, 
00044   tNumberOfDataType
00045 };
00046 
00047 class TCamacCrateController;
00048 
00049 
00069 class TCamacModule
00070   : public TModule
00071 {
00072 
00073   protected:
00074     enum {
00075       tCamacRead = 0,
00076       tCamacWrite = 16,
00077       tCamacClear = 9,
00078       tCamacTestInterrupt = 8,
00079       tCamacClearInterrupt = 10,
00080       tCamacEnableInterrupt = 26,
00081       tCamacDisableInterrupt = 24
00082     };
00083 
00084   protected:
00085     TCamacCrateController* theCrateController;
00086     Tdata_t theDataLength;
00087     Tint theSlotNumber;
00088     Tint theQ;
00089     Tint theX;
00090     TUint theCamacData;
00091 
00092   public:
00093     TCamacModule( TCamacCrateController* cc7x00, Tint slot, Tint nch, Tdata_t datalen );
00094     TCamacModule( const TCamacModule& right );
00095 
00096   protected:
00097     virtual ~TCamacModule();
00098 
00099   public:
00100     virtual const TCamacModule& operator=( const TCamacModule& right );
00101     virtual Tbool operator==( const TCamacModule& right ) const;
00102     virtual Tbool operator!=( const TCamacModule& right ) const;
00103 
00104   public:
00105     virtual Tint WaitInterrupt( Tint msec );
00106     virtual Tint ReadInterrupt();
00107     virtual Tint Clear();
00108     virtual Tint Update();
00109     virtual Tint Initialize();
00110 
00111   public:
00112     // generic CAMAC functions
00113     virtual Tint TestInterrupt();
00114     virtual Tint ClearInterrupt();
00115     virtual Tint EnableInterrupt();
00116     virtual Tint DisableInterrupt();
00117     virtual Tint Read();
00118     virtual Tint Read( Tint subaddress );
00119     virtual Tint Write( Tint data );
00120 
00121   public:
00122     TCamacCrateController* GetCrateController() const;
00123     Tdata_t GetDataLength() const;
00124     Tint GetSlotNumber() const;
00125     Tint GetQ() const;
00126     Tint GetX() const;
00127     TUint GetCamacData() const;
00128     Tvoid SetDataLength( Tdata_t datalen );
00129     Tvoid SetSlotNumber( Tint slot );
00130     Tvoid SetQ( Tint q );
00131     Tvoid SetX( Tint x );
00132     Tvoid SetCamacData( TUint data );
00133 
00134   protected:
00135     Tint execute( Tint subaddress, Tint function );
00136 
00137   private:
00138     TUint generateNAF( Tint n, Tint a, Tint f );
00139     Tint execute16bit( TUint naf );
00140     Tint execute24bit( TUint naf );
00141 
00142 };
00143 
00144 inline TCamacCrateController* TCamacModule::GetCrateController() const
00145 {
00146   return theCrateController;
00147 }
00148 
00149 inline Tdata_t TCamacModule::GetDataLength() const
00150 {
00151   return theDataLength;
00152 }
00153 
00154 inline Tint TCamacModule::GetSlotNumber() const
00155 {
00156   return theSlotNumber;
00157 }
00158 
00159 inline Tint TCamacModule::GetQ() const
00160 {
00161   return theQ;
00162 }
00163 
00164 inline Tint TCamacModule::GetX() const
00165 {
00166   return theX;
00167 }
00168 
00169 inline TUint TCamacModule::GetCamacData() const
00170 {
00171   return theCamacData;
00172 }
00173 
00174 inline Tvoid TCamacModule::SetDataLength( Tdata_t datalen )
00175 {
00176   theDataLength = datalen;
00177   return;
00178 }
00179 
00180 inline Tvoid TCamacModule::SetSlotNumber( Tint slot )
00181 {
00182   theSlotNumber = slot;
00183   return;
00184 }
00185 
00186 inline Tvoid TCamacModule::SetQ( Tint q )
00187 {
00188   theQ = q;
00189   return;
00190 }
00191 
00192 inline Tvoid TCamacModule::SetX( Tint x )
00193 {
00194   theX = x;
00195   return;
00196 }
00197 
00198 inline Tvoid TCamacModule::SetCamacData( TUint data )
00199 {
00200   theCamacData = data;
00201   return;
00202 }
00203 
00204 #endif

CLDAQ - a Class Library for Data AcQuisition (Version 1.10.0)
Go IWAI <goiwai@users.sourceforge.jp>