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

include/nxyter/NxI2c.h (r4864/r4060)

Go to the documentation of this file.
00001 //============================================================================
00005 //============================================================================
00006 
00007 #ifndef NXYTER_NXI2C_H
00008 #define NXYTER_NXI2C_H
00009 
00010 #include "roc/I2cDevice.h"
00011 #include "nxyter/NxContext.h"
00012 
00013 namespace nxyter {
00014 
00016    // they are directly in nxyter name space for ease of usage !!
00017    enum nxRegs {
00018       kNxRegMask00  =  0,
00019       kNxRegMask01  =  1,
00020       kNxRegMask02  =  2,
00021       kNxRegMask03  =  3,
00022       kNxRegMask04  =  4,
00023       kNxRegMask05  =  5,
00024       kNxRegMask06  =  6,
00025       kNxRegMask07  =  7,
00026       kNxRegMask08  =  8,
00027       kNxRegMask09  =  9,
00028       kNxRegMask10  = 10,
00029       kNxRegMask11  = 11,
00030       kNxRegMask12  = 12,
00031       kNxRegMask13  = 13,
00032       kNxRegMask14  = 14,
00033       kNxRegMask15  = 15,
00034       kNxRegVcg     = 16,
00035       kNxRegIcgfoll = 17,
00036       kNxRegVth     = 18,
00037       kNxRegVbfb    = 19,
00038       kNxRegVbiasF  = 20,
00039       kNxRegVbiasS  = 21,
00040       kNxRegVbiasS2 = 22,
00041       kNxRegVcm     = 23,
00042       kNxRegcal     = 24,
00043       kNxRegiCOMP   = 25,
00044       kNxRegiDUR    = 26,
00045       kNxRegiINV    = 27,
00046       kNxRegiPDH    = 28,
00047       kNxRegiTWC    = 29,
00048       kNxRegSpare30 = 30,
00049       kNxRegSpare31 = 31,
00050       kNxRegConfig0 = 32,
00051       kNxRegConfig1 = 33,
00052       kNxRegOverflowLSB   = 34,
00053       kNxRegOverflowMSB   = 35,
00054       kNxRegMissTokenLSB  = 36,
00055       kNxRegMissTokenMSB  = 37,
00056       kNxRegdelayTestPuls = 38,
00057       kNxRegdelayTestTrig = 39,
00058       kNxRegSpare40 = 40,
00059       kNxRegSpare41 = 41,
00060       kNxRegTrimDAQPower  = 42,
00061       kNxRegdelayClock1   = 43,
00062       kNxRegdelayClock2   = 44,
00063       kNxRegdelayClock3   = 45
00064    };
00065 
00066    static const uint8_t kNxC0TestPulsEnable    = 1<<0;
00067    static const uint8_t kNxC0TestPulsSync      = 1<<1;
00068    static const uint8_t kNxC0TestPulsPolarity  = 1<<2;
00069    static const uint8_t kNxC0TestTrigEnable    = 1<<3;
00070    static const uint8_t kNxC0TestTrigSync      = 1<<4;
00071    static const uint8_t kNxC0Disable32MHz      = 1<<5;
00072    static const uint8_t kNxC0Disable128MHz     = 1<<6;
00073    static const uint8_t kNxC0TsLsbClockSelect  = 1<<7;
00074    static const uint8_t kNxC1CalibSelectMask   = 0x3;
00075    static const uint8_t kNxC1FrontEndPolarity  = 1<<2;
00076    static const uint8_t kNxC1ReadClockSelect   = 1<<3;
00077 
00078    class NxI2c : public roc::I2cDevice {
00079       public:
00080 
00081          explicit NxI2c(base::Board* board, int port=0, uint8_t addr=0);
00082          virtual ~NxI2c();
00083 
00084          int setContext(NxContext& cntx, int domask=nxyter::kDoAll,
00085                         bool veri=true);
00086          int getContext(NxContext& cntx, int domask=nxyter::kDoAll);
00087 
00088          int getCounters(uint16_t& overflow, uint16_t& tokenmiss);
00089          int setTestModes(bool testpuls, bool testtrig, int calselect); 
00090 
00091          int probe();
00092          int setToDefault(bool ispos=false, 
00093                           int maskon=128, int poweron=128);
00094          void printRegisters(std::ostream& os, int domask=nxyter::kDoAll);
00095 
00096          int setRegMask(const uint8_t *val);
00097          int setRegCore(const uint8_t *val);
00098          int setRegTrim(const uint8_t *val);
00099          int getRegMask(uint8_t *val);
00100          int getRegCore(uint8_t *val);
00101          int getRegTrim(uint8_t *val);
00102 
00103          static const char* registerName(int reg);
00104          static const char* configurationBitName(int bit);
00105 
00106          static uint8_t delayToSetting(uint8_t delay);
00107          static uint8_t settingToDelay(uint8_t val);
00108 
00109    };
00110 
00111 }
00112 
00114 
00118 inline std::ostream& operator<<(std::ostream& os, nxyter::NxI2c& obj)
00119   { obj.printRegisters(os); return os; }
00120 
00121 #endif

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