Main Page   Class Hierarchy   Compound List   File List   Compound Members  

sis3300.h

00001 #ifndef __SIS3300_H
00002 #define __SIS3300_H
00003 
00004 #ifndef __SPECTRODAQ_H
00005 #include <spectrodaq.h>
00006 #define __SPECTRODAQ_H
00007 #endif
00008 
00009 
00010 #ifndef __STL_STRING
00011 #include <string>
00012 #define __STL_STRING
00013 #endif
00014 
00027 class CSIS3300 {
00028 public:
00029   typedef enum _ClockSource {
00030     Internal100Mhz = 0,
00031     Internal50Mhz  = 1,
00032     Internal25Mhz  = 2,
00033     Internal12_5Mhz= 3,
00034     Internal6_25Mhz= 4,
00035     Internal3_125Mhz=5,
00036     ExternalFp      =6,
00037     ExternalP2      =7 
00038   } ClockSource;                
00039   typedef enum _SampleSize {
00040     Sample128K     = 0,
00041     Sample16K      = 1,
00042     Sample4K       = 2,
00043     Sample2K       = 3,
00044     Sample1K       = 4,
00045     Sample512      = 5,
00046     Sample256      = 6,
00047     Sample128      = 7
00048   } SampleSize; 
00049 
00050 private:
00051   // Register pointers:
00052   volatile unsigned long* m_pModule;          
00053   volatile unsigned long* m_pModuleId;        
00054   volatile unsigned long* m_pCsr;             
00055   volatile unsigned long* m_pAcqReg;         
00056   volatile unsigned long* m_pResetKey;        
00057   volatile unsigned long* m_pStart;           
00058   volatile unsigned long* m_pEventConfig;    
00059   volatile unsigned long* m_pStartDelay;        
00060   volatile unsigned long* m_pStopDelay;       
00061   volatile unsigned long* m_pAddressReg; 
00062   volatile unsigned long* m_pEventDirectory;   
00063   volatile unsigned long* m_pBank1Buffers[4];   
00064   volatile unsigned long* m_pThresholds[4]; 
00065 
00066   // State which determines how the module is set up:
00067  
00068   int         m_nFd;            
00069   ClockSource m_eClock;             
00070   bool        m_fStartDelayEnabled; 
00071   unsigned int m_nStartDelayClocks; 
00072   bool        m_fStopDelayEnabled;  
00073   unsigned int m_nStopDelayClocks;
00074   bool       m_fGateMode;       
00075   bool       m_fStopTrigger;    
00076   SampleSize m_ePagesize;       
00077   unsigned int m_nPagesize;     
00078   bool       m_fPageWrap;       
00079   bool       m_fThresholdLt[8]; 
00080   unsigned int m_nThresholds[8];        
00081 public:
00082   // Constructors and other canonical member functions:
00083 
00084   CSIS3300(unsigned long nBaseAddress);
00085 private:
00086   CSIS3300(const CSIS3300& rhs);
00087   CSIS3300& operator=(const CSIS3300& rhs);
00088   int      operator==(const CSIS3300& rhs);
00089 public:
00090   ~CSIS3300();
00091 
00092   // Selectors:
00093 public:
00094   volatile unsigned long* getModuleBase() { 
00095     return m_pModule;
00096   }
00097   string getModuleId() const;
00098   volatile unsigned long* getCsr() {
00099     return m_pCsr;
00100   }
00101   volatile unsigned long* getAcquisitionRegister() {
00102     return m_pAcqReg;
00103   }
00104   volatile unsigned long* getResetKeyRegister() {
00105     return m_pResetKey;
00106   }
00107   volatile unsigned long* getStartKeyRegister() {
00108     return m_pStart;
00109   }
00110   volatile unsigned long* getEventConfigRegister() {
00111     return m_pEventConfig;
00112   }
00113   volatile unsigned long* getStartDelayRegister() {
00114     return m_pStartDelay;
00115   }
00116   volatile unsigned long* getStopDelayRegister() {
00117     return m_pStopDelay;
00118   }
00119   volatile unsigned long* getEventDirectory() {
00120     return m_pEventDirectory;
00121   }
00122   volatile unsigned long* getGroup1Pointer() {
00123     return m_pBank1Buffers[0];
00124   }
00125   volatile unsigned long* getGroup2Pointer() {
00126     return m_pBank1Buffers[1];
00127   }
00128   volatile unsigned long* getGroup3Pointer() {
00129     return m_pBank1Buffers[2];
00130   }
00131   volatile unsigned long* getGroup4Pointer() {
00132     return m_pBank1Buffers[3];
00133   }
00134 
00135   // Configuration functions:
00136  
00137   void SetClock(ClockSource eSource);
00138   void SetStartDelay(bool Enable = false, unsigned int nClocks = 0);
00139   void SetStopDelay(bool Enable  = false, unsigned int nClocks = 0);
00140   void GateMode(bool Enable = false);
00141   void TriggerOnStop(bool Enable=true);
00142   void SetSampleSize(SampleSize eSamples);
00143   void EnableWrap(bool Enable=true);
00144 
00145   void SetThresholds(bool* pLessThan,
00146                      unsigned int* pValues);
00147 
00148   // Configuration inquiry functions.
00149 
00150   enum CSIS3300::ClockSource  getCurrentClockSource();
00151   bool         isStartDelayEnabled();
00152   unsigned int getStartDelayClocks();
00153   bool         isStopDelayEnabled();
00154   unsigned int getStopDelayClocks();
00155   unsigned int getThresholdValue(unsigned int channel) const {
00156     return m_nThresholds[channel];
00157   }
00158   bool         isLtThreshold(unsigned int channel) const {
00159     return m_fThresholdLt[channel];
00160   }
00161 
00162 
00163   //  Data taking functions. 
00164 public:
00165   void InitDaq();
00166   void StartSampling();
00167   void WaitUntilDone();
00168   unsigned int ReadGroup1(DAQWordBufferPtr& pBuffer);
00169   unsigned int ReadGroup2(DAQWordBufferPtr& pBuffer);
00170   unsigned int ReadGroup3(DAQWordBufferPtr& pBuffer);
00171   unsigned int ReadGroup4(DAQWordBufferPtr& pBuffer);
00172   unsigned int ReadAllGroups(DAQWordBufferPtr& pBuffer);
00173   void ClearDaq();
00174 protected:
00175   unsigned int ReadAGroup(DAQWordBufferPtr& pBuffer,
00176                           volatile unsigned long* pAddressReg,
00177                           volatile unsigned long* pBase);
00178 
00179 };
00180 
00181 
00182 
00183 #endif

Generated at Fri Dec 7 12:46:10 2001 for SIS3300flashadc. by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001