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

TCamacModule.hh

解説を見る。
00001 // =====================================================================
00002 //  $Id: TCamacModule.hh,v 1.1.1.1 2003/06/27 02:56:41 goiwai Exp $
00003 //  $Name: CLDAQ-1-06-00 $
00004 // =====================================================================
00005 #ifndef __TCAMACMODULE_HH
00006 #define __TCAMACMODULE_HH
00007 
00008 #include "Tglobals.h"
00009 #include "TModule.hh"
00010 
00011 // interface to use only yasu driver
00012 typedef struct CamacDriverInterface
00013 {
00014   TUint _naf;
00015   Tshort _q;
00016   Tshort _x;
00017   union DataPartOfCamacData
00018   {
00019     TUshort _d16;
00020     TUint _d24;
00021   } _data;
00022 };
00023 
00024 enum Tdata_t { 
00025   t16bitModule = 16, 
00026   t24bitModule = 24, 
00027   tNumberOfDataType
00028 };
00029 
00030 class TCamacCrateController;
00031 
00032 class TCamacModule
00033   : public TModule
00034 {
00035 
00036   protected:
00037     enum {
00038       tCamacRead = 0,
00039       tCamacWrite = 16,
00040       tCamacClear = 9,
00041       tCamacTestInterrupt = 8,
00042       tCamacClearInterrupt = 10,
00043       tCamacEnableInterrupt = 26,
00044       tCamacDisableInterrupt = 24
00045     };
00046 
00047   protected:
00048     TCamacCrateController* theCrateController;
00049     Tdata_t theDataLength;
00050     Tint theSlotNumber;
00051     Tint theQ;
00052     Tint theX;
00053     TUint theCamacData;
00054 
00055   public:
00056     TCamacModule( TCamacCrateController* cc7x00, Tint slot, Tint nch, Tdata_t datalen );
00057     TCamacModule( const TCamacModule& right );
00058 
00059   protected:
00060     virtual ~TCamacModule();
00061 
00062   public:
00063     virtual const TCamacModule& operator=( const TCamacModule& right );
00064     virtual Tbool operator==( const TCamacModule& right ) const;
00065     virtual Tbool operator!=( const TCamacModule& right ) const;
00066 
00067   public:
00068     virtual Tint WaitInterrupt( Tint msec );
00069     virtual Tint ReadInterrupt();
00070     virtual Tint Clear();
00071     virtual Tint Update();
00072     virtual Tint Initialize();
00073 
00074   public:
00075     // generic CAMAC functions
00076     virtual Tint TestInterrupt();
00077     virtual Tint ClearInterrupt();
00078     virtual Tint EnableInterrupt();
00079     virtual Tint DisableInterrupt();
00080     virtual Tint Read();
00081     virtual Tint Read( Tint subaddress );
00082     virtual Tint Write( Tint data );
00083 
00084   public:
00085     TCamacCrateController* GetCrateController() const;
00086     Tdata_t GetDataLength() const;
00087     Tint GetSlotNumber() const;
00088     Tint GetQ() const;
00089     Tint GetX() const;
00090     TUint GetCamacData() const;
00091     Tvoid SetDataLength( Tdata_t datalen );
00092     Tvoid SetSlotNumber( Tint slot );
00093     Tvoid SetQ( Tint q );
00094     Tvoid SetX( Tint x );
00095     Tvoid SetCamacData( TUint data );
00096 
00097   protected:
00098     Tint execute( Tint subaddress, Tint function );
00099 
00100   private:
00101     TUint generateNAF( Tint n, Tint a, Tint f );
00102     Tint execute16bit( TUint naf );
00103     Tint execute24bit( TUint naf );
00104 
00105 };
00106 
00107 inline TCamacCrateController* TCamacModule::GetCrateController() const
00108 {
00109   return( theCrateController );
00110 }
00111 
00112 inline Tdata_t TCamacModule::GetDataLength() const
00113 {
00114   return( theDataLength );
00115 }
00116 
00117 inline Tint TCamacModule::GetSlotNumber() const
00118 {
00119   return( theSlotNumber );
00120 }
00121 
00122 inline Tint TCamacModule::GetQ() const
00123 {
00124   return( theQ );
00125 }
00126 
00127 inline Tint TCamacModule::GetX() const
00128 {
00129   return( theX );
00130 }
00131 
00132 inline TUint TCamacModule::GetCamacData() const
00133 {
00134   return( theCamacData );
00135 }
00136 
00137 inline Tvoid TCamacModule::SetDataLength( Tdata_t datalen )
00138 {
00139   theDataLength = datalen;
00140   return;
00141 }
00142 
00143 inline Tvoid TCamacModule::SetSlotNumber( Tint slot )
00144 {
00145   theSlotNumber = slot;
00146   return;
00147 }
00148 
00149 inline Tvoid TCamacModule::SetQ( Tint q )
00150 {
00151   theQ = q;
00152   return;
00153 }
00154 
00155 inline Tvoid TCamacModule::SetX( Tint x )
00156 {
00157   theX = x;
00158   return;
00159 }
00160 
00161 inline Tvoid TCamacModule::SetCamacData( TUint data )
00162 {
00163   theCamacData = data;
00164   return;
00165 }
00166 
00167 #endif

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