• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

include/nxyter/FebBase.h (r4864/r4162)

Go to the documentation of this file.
00001 //============================================================================
00006 //============================================================================
00007 
00008 #ifndef NXYTER_FEBBASE_H
00009 #define NXYTER_FEBBASE_H
00010 
00011 #include <vector>
00012 
00013 #include "roc/I2cDevice.h"
00014 #include "base/Peripheral.h"
00015 #include "nxyter/NxChip.h"
00016 #include "nxyter/MainAdc.h"
00017 
00018 namespace nxyter {
00019 
00020    class FebBase : public base::Peripheral {
00021       protected:
00022          int        fPort;                  
00023          int        fType;                  
00024          std::vector<nxyter::NxChip*>  fNxChip;  
00025          std::vector<bool>             fNxOffline;
00026          nxyter::MainAdc fMainAdc;          
00027          bool       fMode4nx;               
00028          std::vector<int> fAdcChannel;      
00029          roc::I2cDevice   fMonAdcDevice;    
00030          roc::I2cDevice   fEepromDevice;    
00031   
00032       public:
00033          enum FebType { kFeb1nx  = 100,     
00034                         kFeb1nxGenB,        
00035                         kFeb1nxGenC,        
00036                         kFeb1nxGenD,        
00037                         kFeb2nx  = 200,     
00038                         kFeb2nxGas,         
00039                         kFeb4nx  = 400,     
00040                         kFeb4nxBT           
00041          };
00042 
00043       protected:
00044          FebBase();
00045          FebBase(base::Board* board, int port, int type);
00046       public:
00047          virtual ~FebBase();
00048 
00050          int getPortNumber() const
00051            { return fPort; }
00052 
00054          int getFebClass() const
00055          { return 100*(fType/100); }
00056 
00058          int getFebType() const
00059            { return fType; }
00060 
00062          int numNx() const
00063            { return (int) fNxChip.size(); }
00064 
00065          nxyter::NxChip&   nx(int nxind);
00066 
00068          nxyter::MainAdc&  adc()
00069            { return fMainAdc; }
00070 
00071          virtual int getFebState();
00072          virtual int initRoc();
00073 
00074          virtual int probe();
00075          virtual int setToDefault(bool ispos0=false, bool ispos1=false);
00076          virtual void printNxHeadLine(std::ostream& os, int nxind);
00077          virtual void printRegisters(std::ostream& os, 
00078                                      int domask=nxyter::kDoAll);
00079 
00080          void resetNxI2cBus();
00081          void resetNxI2cRegister();
00082 
00084 
00095          void setNxOffline(int nxind, bool isoff)
00096            { fNxOffline.at(nxind) = isoff; }
00097 
00099 
00104          bool getNxOffline(int nxind)
00105            { return fNxOffline.at(nxind); }
00106 
00107          int setNxTestModes(bool testpuls, bool testtrig, int calselect); 
00108          int setNxRegisterAll(uint8_t reg, uint8_t val, bool veri=true); 
00109 
00111 
00114          bool monAdcSupport()
00115            { return fMonAdcDevice.getSlaveAddr() != 0; }
00116 
00118 
00121          bool eepromSupport()
00122            { return fEepromDevice.getSlaveAddr() != 0; }
00123            
00124          // ! return number of monitored ADC channels, 0 if not supported
00125          int getNumMonAdc();
00126 
00127          int getMonAdc(int ch, uint16_t &val);
00128 
00129       protected:
00130          void addNxChip(int addr, int nxnum, int adcmux);
00131 
00132       public:
00133          static const char* typeToString(int type);
00134          static int stringToType(const char* str);
00135 
00136          static void discoverFebs(base::Board* board,
00137                                   int& typeport0, int& typeport1, 
00138                                   bool liberal=false);
00139 
00140          static nxyter::FebBase* newFeb(base::Board* board, int port, int type);
00141    };
00142 
00143 }
00144 
00146 
00150 inline std::ostream& operator<<(std::ostream& os, nxyter::FebBase& obj)
00151   { obj.printRegisters(os); return os; }
00152 
00153 #endif

Generated on Tue Dec 10 2013 04:52:22 for ROCsoft by  doxygen 1.7.1