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

include/nxyter/NxContext.h (r4864/r2088)

Go to the documentation of this file.
00001 //============================================================================
00005 //============================================================================
00006 
00007 #ifndef NXYTER_NXCONTEXT_H
00008 #define NXYTER_NXCONTEXT_H
00009 
00010 #include <stdint.h>
00011 #include <stdio.h>
00012 #include <iostream>
00013 
00014 namespace nxyter {
00015 
00016    // Note: the following defs are in nxyter namespace because rootcint
00017    //       does apparently not support static const defs in class scope.
00018    //
00019    static const int kDoMask = 1<<0; 
00020    static const int kDoCore = 1<<1; 
00021    static const int kDoTrim = 1<<2; 
00022    static const int kDoAll  = kDoMask|kDoCore|kDoTrim; //<! handle all
00023 
00024    class NxContext {
00025       public:
00026 
00027       static const int dimRegMain =  46;    
00028       static const int dimRegTrim = 129;    
00029 
00030       protected:
00031         uint8_t   fRegMain[dimRegMain];     
00032         uint8_t   fRegTrim[dimRegTrim];         
00033 
00034       public:
00035 
00036          NxContext();
00037          virtual ~NxContext();
00038 
00039          void setRegister(int reg, uint8_t val);
00040          uint8_t getRegister(int reg) const;
00041          void setTrimRegister(int channel, uint8_t val);
00042          uint8_t getTrimRegister(int channel) const;
00043 
00044          void setChannelMaskBit(int channel, bool isoff);
00045          void setChannelMaskBit(int chbeg, int chend, bool isoff, 
00046                                 int chstep=1);
00047          bool getChannelMaskBit(int channel) const;
00048 
00049          void setThresholdTrim(int channel, uint8_t val);
00050          void setThresholdTrim(int chbeg, int chend, uint8_t val,
00051                                int chstep=1);
00052          uint8_t getThresholdTrim(int channel) const;
00053 
00054          void setPowerOffMaskBit(int channel, bool isoff);
00055          void setPowerOffMaskBit(int chbeg, int chend, bool isoff,
00056                                  int chstep=1);
00057          bool getPowerOffMaskBit(int channel) const;
00058 
00059          void setToDefault(bool ispos=false, 
00060                            int maskon=128, int poweron=128);
00061 
00062          bool getConfigurationBit(int n);
00063          void setConfigurationBit(int n, bool on);
00064 
00065          bool equal(const NxContext& rhs, int domask=kDoAll) const;
00066 
00067          void print(std::ostream& os, int domask=kDoAll) const;
00068 
00070          uint8_t* dataRegisterMain()
00071            { return fRegMain; }
00073          uint8_t* dataRegisterTrim()
00074            { return fRegTrim; }
00075 
00076 
00077          bool fillCmdFile(FILE* f, int nx);
00078 
00080          bool operator==(const NxContext& rhs) const
00081            { return equal(rhs); }
00083          bool operator!=(const NxContext& rhs) const
00084            { return !equal(rhs); }
00085    };
00086 
00087 }
00088 
00090 
00094 inline std::ostream& operator<<(std::ostream& os, const nxyter::NxContext& obj)
00095   { obj.print(os); return os; }
00096 
00097 #endif

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