Cat
Public Member Functions | Private Member Functions | Private Attributes | List of all members
LSDelayChipV1 Class Reference

#include <LSDelayChipV1.h>

Inheritance diagram for LSDelayChipV1:
Element Hierarchy Object Attrib

Public Member Functions

 LSDelayChipV1 ()
 
void configRegBulkRead (U8 confRegAddr)
 
void configRegBulkWrite (U8 confRegAddr, U16 confRegData)
 
void getConfigReg (U8 confRegAddr)
 
void setConfigReg (U8 confRegAddr, confRegData d)
 
void setConfigRegPhaseADC (U8 confRegAddr, U8 phaseADC)
 
void setConfigRegPhaseTH (U8 confRegAddr, U8 phaseTH)
 
void setConfigRegPhaseINT (U8 confRegAddr, U8 phaseINT)
 
void setConfigRegLVDSOutEn (U8 confRegAddr, bool en)
 
void setConfigRegDebugMode (U8 confRegAddr, bool en)
 
void setConfigRegVControlOutEn (U8 confRegAddr, bool en)
 
void setConfigRegLOCUS (U8 confRegAddr, U8 locus)
 
void resetPumps ()
 
void bypassMisoMosi (U16 writeData)
 
void spiBERTest (U8 confRegAddr, long nFrames)
 
void showConfig ()
 
 ~LSDelayChipV1 ()
 
void help ()
 
StatusCode init ()
 
void reset ()
 
void update ()
 
void setAddress (U8 address)
 
- Public Member Functions inherited from Element
 Element ()
 Standard constructor. More...
 
virtual ~Element ()
 Destructor. More...
 
void recursiveInitElement ()
 
void recursiveInitCommunications ()
 
StatusCode setConnection (Hierarchy *)
 
Hierarchyconnection ()
 
- Public Member Functions inherited from Hierarchy
 Hierarchy ()
 Standard constructor. More...
 
virtual ~Hierarchy ()
 Destructor. More...
 
void clear ()
 
void setParent (Hierarchy *parent)
 
Hierarchyparent ()
 
Hierarchyparent (std::string)
 
Hierarchyorigin ()
 
virtual void addChild (Hierarchy *element)
 
std::vector< Hierarchy * > children ()
 
Hierarchychild (std::string)
 
HierarchychildTyped (std::string)
 
unsigned long numberOfChildren ()
 
bool hasChildren ()
 
void delChild (Hierarchy *)
 
void delChild (std::string)
 
std::string path (std::string=std::string(""))
 
std::string pathTyped (std::string=std::string(""))
 
void tree (std::string indent=std::string(""))
 
void tree ()
 
- Public Member Functions inherited from Object
 Object ()
 Standard constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
std::string name () const
 
std::string type ()
 
unsigned char id ()
 
std::string title ()
 
void msgSvc (int level, std::string msg, std::string name)
 
void msg (std::string mymsg)
 
void verbose (std::string mymsg)
 
void debug (std::string mymsg)
 
void info (std::string mymsg)
 
void warning (std::string mymsg)
 
void error (std::string mymsg)
 
void fatal (std::string mymsg)
 
void msg (std::string mymsg, std::string name)
 
void verbose (std::string mymsg, std::string name)
 
void debug (std::string mymsg, std::string name)
 
void info (std::string mymsg, std::string name)
 
void warning (std::string mymsg, std::string name)
 
void error (std::string mymsg, std::string name)
 
void fatal (std::string mymsg, std::string name)
 
void setName (std::string name)
 
void setType (std::string type)
 
void setId (unsigned char id)
 
void setTitle (std::string title)
 
void setDllName (std::string dllName)
 
std::string dllName ()
 
- Public Member Functions inherited from Attrib
 Attrib ()
 Standard constructor. More...
 
virtual ~Attrib ()
 Destructor. More...
 
bool is (int attribut)
 
void add (int attribut)
 
void remove (int attribut)
 
std::string attributs ()
 

Private Member Functions

bool checkConfigAddr (U8 addr)
 
bool checkStatusAddr (U8 addr)
 
std::string itohs (U16 value)
 

Private Attributes

Registerm_regConfig
 
Registerm_regStatus
 
U8 m_address
 
U16 m_rxConfigBits
 
confRegData m_rxConfig
 
U8 m_configAddr
 
long m_nBad
 
double m_fer
 

Additional Inherited Members

- Public Types inherited from Attrib
enum  Attribut {
  UNDEFINED, PASSIVE, ACTIVE, INTERFACE,
  IO, IODATA, ELEMENT, HARDWARE,
  PROCESSUS, SOFTWARE
}
 
- Protected Attributes inherited from Element
Hierarchym_connection
 
- Protected Attributes inherited from Attrib
std::string m_attribString [10]
 

Detailed Description

Definition at line 68 of file LSDelayChipV1.h.

Constructor & Destructor Documentation

◆ LSDelayChipV1()

LSDelayChipV1::LSDelayChipV1 ( )
inline

Definition at line 71 of file LSDelayChipV1.h.

References IOdata::Byte, Attrib::ELEMENT, Attrib::HARDWARE, and confRegData::locus.

71  {
72  setType("LSDelayChipV1");
73  setId(0);
74 
76  debug("LSDelayChipV1 built.","LSDelayChipV1::LSDelayChipV1");
77 
78  m_regConfig=new Register();
79  m_regStatus=new Register();
80 
81  m_regConfig->setName("ConfigRegister");
82  m_regStatus->setName("StatusRegister");
83 
86 
87  m_regConfig->io()->defDataU8(3);
88  m_regStatus->io()->defDataU8(2);
89 
92 
95  m_configAddr = 0xEE;
96  }
Register * m_regConfig
void add(int attribut)
Definition: Attrib.h:67
void setName(std::string name)
Definition: Object.h:51
void setType(std::string type)
Definition: Object.h:52
void setId(unsigned char id)
Definition: Object.h:53
void debug(std::string mymsg)
Definition: Object.h:37
Register * m_regStatus
StatusCode setSubAddress(U32 subAddress)
Definition: IOdata.h:81
virtual void addChild(Hierarchy *element)
Definition: Hierarchy.cpp:83
StatusCode setWordSize(IOdata::WordSize wordSize)
Definition: IOdata.h:126
void defDataU8(unsigned long size)
Definition: IOdata.h:179
IOdata * io()
Definition: IOobject.h:66

◆ ~LSDelayChipV1()

LSDelayChipV1::~LSDelayChipV1 ( )
inline

Definition at line 125 of file LSDelayChipV1.h.

125  {
126  }

Member Function Documentation

◆ bypassMisoMosi()

void LSDelayChipV1::bypassMisoMosi ( U16  writeData)

Definition at line 144 of file LSDelayChipV1.cpp.

References configRegBulkWrite(), and SC_MOSI_MISO_BYPASS.

Referenced by BOOST_PYTHON_MODULE().

145 {
147 }
void configRegBulkWrite(U8 confRegAddr, U16 confRegData)
#define SC_MOSI_MISO_BYPASS
Definition: ICECALv3.h:33

◆ checkConfigAddr()

bool LSDelayChipV1::checkConfigAddr ( U8  addr)
inlineprivate

Definition at line 177 of file LSDelayChipV1.h.

References ADC_0_CONFREG_ADDR, ADC_1_CONFREG_ADDR, ADC_2_CONFREG_ADDR, ADC_3_CONFREG_ADDR, INT_TH_0_CONFREG_ADDR, INT_TH_1_CONFREG_ADDR, INT_TH_2_CONFREG_ADDR, INT_TH_3_CONFREG_ADDR, and itos().

Referenced by getConfigReg(), and setConfigReg().

178  {
179  bool ok = false;
180  ok |= (addr == INT_TH_0_CONFREG_ADDR);
181  ok |= (addr == INT_TH_1_CONFREG_ADDR);
182  ok |= (addr == INT_TH_2_CONFREG_ADDR);
183  ok |= (addr == INT_TH_3_CONFREG_ADDR);
184  ok |= (addr == ADC_0_CONFREG_ADDR);
185  ok |= (addr == ADC_1_CONFREG_ADDR);
186  ok |= (addr == ADC_2_CONFREG_ADDR);
187  ok |= (addr == ADC_3_CONFREG_ADDR);
188  if(ok) debug("The address @" + itos(addr) + " is valid.");
189  else debug("The address @" + itos(addr) + " is not valid.");
190  return ok;
191  }
#define ADC_3_CONFREG_ADDR
Definition: LSDelayChipV1.h:30
std::string itos(int)
Definition: Tools.cpp:46
#define INT_TH_2_CONFREG_ADDR
Definition: LSDelayChipV1.h:24
#define INT_TH_0_CONFREG_ADDR
Definition: LSDelayChipV1.h:22
#define ADC_0_CONFREG_ADDR
Definition: LSDelayChipV1.h:27
#define INT_TH_1_CONFREG_ADDR
Definition: LSDelayChipV1.h:23
void debug(std::string mymsg)
Definition: Object.h:37
#define INT_TH_3_CONFREG_ADDR
Definition: LSDelayChipV1.h:25
#define ADC_2_CONFREG_ADDR
Definition: LSDelayChipV1.h:29
#define ADC_1_CONFREG_ADDR
Definition: LSDelayChipV1.h:28

◆ checkStatusAddr()

bool LSDelayChipV1::checkStatusAddr ( U8  addr)
inlineprivate

Definition at line 193 of file LSDelayChipV1.h.

References DLL_0_STATREG_ADDR, DLL_1_STATREG_ADDR, DLL_2_STATREG_ADDR, DLL_3_STATREG_ADDR, and itos().

194  {
195  bool ok = false;
196  ok |= (addr == DLL_0_STATREG_ADDR);
197  ok |= (addr == DLL_1_STATREG_ADDR);
198  ok |= (addr == DLL_2_STATREG_ADDR);
199  ok |= (addr == DLL_3_STATREG_ADDR);
200  if(ok) debug("The address @" + itos(addr) + " is valid.");
201  else debug("The address @" + itos(addr) + " is not valid.");
202  return ok;
203  }
std::string itos(int)
Definition: Tools.cpp:46
#define DLL_0_STATREG_ADDR
Definition: LSDelayChipV1.h:32
#define DLL_3_STATREG_ADDR
Definition: LSDelayChipV1.h:35
void debug(std::string mymsg)
Definition: Object.h:37
#define DLL_1_STATREG_ADDR
Definition: LSDelayChipV1.h:33
#define DLL_2_STATREG_ADDR
Definition: LSDelayChipV1.h:34

◆ configRegBulkRead()

void LSDelayChipV1::configRegBulkRead ( U8  confRegAddr)

Definition at line 17 of file LSDelayChipV1.cpp.

References IOdata::dataU8(), Object::debug(), IOobject::io(), StatusCode::isFailure(), itohs(), m_regConfig, m_rxConfigBits, IOobject::read(), and Object::warning().

Referenced by BOOST_PYTHON_MODULE(), getConfigReg(), and spiBERTest().

18 {
19  //m_regConfig->io()->setAddress(confRegAddr + 128); //+128 = read
20  U8* buffer = m_regConfig->io()->dataU8();
21  buffer[2] = confRegAddr + 128;
22  if (m_regConfig->read().isFailure()) warning("LSDelayChipV1 configuration register read failure.");
23  else
24  {
25  m_rxConfigBits = ((U16)buffer[1] * 256) + (U16)buffer[0];
26  debug("Config. Register phase (@"+ itohs(confRegAddr) + ") = 0x" + itohs(m_rxConfigBits),"LSDCv1::configRegBulkRead");
27  }
28 
29  //return m_rxConfigBits;
30 }
bool isFailure() const
Definition: StatusCode.h:68
Register * m_regConfig
virtual StatusCode read()
Definition: IOobject.h:73
unsigned char U8
Definition: ICECALv3.h:55
void debug(std::string mymsg)
Definition: Object.h:37
U8 * dataU8()
Definition: IOdata.h:214
std::string itohs(U16 value)
unsigned short U16
Definition: ICECALv3.h:54
void warning(std::string mymsg)
Definition: Object.h:39
IOdata * io()
Definition: IOobject.h:66

◆ configRegBulkWrite()

void LSDelayChipV1::configRegBulkWrite ( U8  confRegAddr,
U16  confRegData 
)

Definition at line 57 of file LSDelayChipV1.cpp.

References IOdata::dataU8(), Object::debug(), IOobject::io(), StatusCode::isFailure(), itohs(), m_regConfig, Object::warning(), and IOobject::write().

Referenced by BOOST_PYTHON_MODULE(), bypassMisoMosi(), resetPumps(), setConfigReg(), and spiBERTest().

58 {
59  U8* buffer = m_regConfig->io()->dataU8();
60  buffer[2] = confRegAddr;
61  buffer[1] = (confRegData >> 8) & 0xFF;
62  buffer[0] = confRegData & 0xFF;
63  if(m_regConfig->write().isFailure()) warning("LSDelayChipV1 configuration register write failure.");
64  else debug("Config. Register phase (@"+ itohs(confRegAddr) + ") = 0x" + itohs(confRegData),"LSDCv1::configRegBulkWrite");
65 }
bool isFailure() const
Definition: StatusCode.h:68
Register * m_regConfig
virtual StatusCode write()
Definition: IOobject.h:80
unsigned char U8
Definition: ICECALv3.h:55
void debug(std::string mymsg)
Definition: Object.h:37
U8 * dataU8()
Definition: IOdata.h:214
std::string itohs(U16 value)
void warning(std::string mymsg)
Definition: Object.h:39
IOdata * io()
Definition: IOobject.h:66

◆ getConfigReg()

void LSDelayChipV1::getConfigReg ( U8  confRegAddr)

Definition at line 35 of file LSDelayChipV1.cpp.

References checkConfigAddr(), configRegBulkRead(), itos(), confRegData::locus, confRegData::lvdsOutEn, m_configAddr, m_rxConfig, m_rxConfigBits, confRegData::nVControlEn, confRegData::padDebug, confRegData::phaseInt, confRegData::phaseTaHAdc, and Object::warning().

Referenced by BOOST_PYTHON_MODULE(), setConfigRegDebugMode(), setConfigRegLOCUS(), setConfigRegLVDSOutEn(), setConfigRegPhaseADC(), setConfigRegPhaseINT(), setConfigRegPhaseTH(), and setConfigRegVControlOutEn().

36 {
37  bool ok = checkConfigAddr(confRegAddr);
38  if(ok)
39  {
40  configRegBulkRead(confRegAddr);
41  m_rxConfig.lvdsOutEn = (m_rxConfigBits >> 15) & 0x01;
42  m_rxConfig.phaseTaHAdc = (m_rxConfigBits >> 9) & 0x1F;
43  m_rxConfig.phaseInt = (m_rxConfigBits >> 4) & 0x1F;
44  m_rxConfig.nVControlEn = (m_rxConfigBits >> 3) & 0x01;
45  m_rxConfig.padDebug = (m_rxConfigBits >> 2) & 0x01;
47  m_configAddr = confRegAddr;
48 confRegData tmp = m_rxConfig;
49 configRegBulkRead(confRegAddr);
50 m_rxConfig = tmp;
51  }
52  else
53  warning("@" + itos(confRegAddr) + " is not a valid Configuration Register address.","LSDCv1::getConfigReg");
54 }
std::string itos(int)
Definition: Tools.cpp:46
confRegData m_rxConfig
void configRegBulkRead(U8 confRegAddr)
bool nVControlEn
Definition: LSDelayChipV1.h:47
void warning(std::string mymsg)
Definition: Object.h:39
bool checkConfigAddr(U8 addr)

◆ help()

void LSDelayChipV1::help ( )
inlinevirtual

printout help for the element

Implements Element.

Definition at line 131 of file LSDelayChipV1.h.

131 { info("LSDelayChipV1 "+name()+". No help.","LSDelayChipV1::help"); };
void info(std::string mymsg)
Definition: Object.h:38
std::string name() const
Definition: Object.h:28

◆ init()

StatusCode LSDelayChipV1::init ( )
inlinevirtual

init the component

Returns
void

Implements Element.

Definition at line 138 of file LSDelayChipV1.h.

References shell::reset(), and StatusCode::SUCCESS.

138  {
139  return StatusCode::SUCCESS;
140  };

◆ itohs()

std::string LSDelayChipV1::itohs ( U16  value)
inlineprivate

Definition at line 205 of file LSDelayChipV1.h.

Referenced by configRegBulkRead(), configRegBulkWrite(), showConfig(), and spiBERTest().

206  {
207  char buff[32];
208  sprintf(buff,"%04X",value);
209  return std::string(buff);
210  }

◆ reset()

void LSDelayChipV1::reset ( )
virtual

Resets the Element so that is is in a standard and safe situation. Different from Element::init which configure the Element. Element::reset() is more an Emergency pull. It is often/usually called by the recursiveInitElement method at the start of the program.

Implements Element.

Definition at line 220 of file LSDelayChipV1.cpp.

Referenced by BOOST_PYTHON_MODULE().

220  {
221 /*
222  U8* buffer=m_regConfig->io()->dataU8();
223  buffer[2]=64;
224  buffer[1]=0;
225  buffer[0]=0;
226  if (m_regConfig->write().isFailure()){
227  warning("LSDelayChipV1 configuration register write failure. Cannot reset LSDelayChipV1",
228  "LSDCv1::write");
229  }
230  */
231 }

◆ resetPumps()

void LSDelayChipV1::resetPumps ( )

Definition at line 139 of file LSDelayChipV1.cpp.

References CHARGEPUMP_SOFT_RST, and configRegBulkWrite().

140 {
142 }
#define CHARGEPUMP_SOFT_RST
Definition: LSDelayChipV1.h:38
void configRegBulkWrite(U8 confRegAddr, U16 confRegData)

◆ setAddress()

void LSDelayChipV1::setAddress ( U8  address)
inline

Definition at line 158 of file LSDelayChipV1.h.

Referenced by BOOST_PYTHON_MODULE().

158  {
159  m_address=address;
162  }
Register * m_regConfig
Register * m_regStatus
void setAddress(U32 address)
Definition: IOobject.h:84

◆ setConfigReg()

void LSDelayChipV1::setConfigReg ( U8  confRegAddr,
confRegData  d 
)

Definition at line 70 of file LSDelayChipV1.cpp.

References checkConfigAddr(), configRegBulkWrite(), shell::data(), itos(), confRegData::locus, confRegData::lvdsOutEn, confRegData::nVControlEn, confRegData::padDebug, confRegData::phaseInt, confRegData::phaseTaHAdc, and Object::warning().

Referenced by BOOST_PYTHON_MODULE(), setConfigRegDebugMode(), setConfigRegLOCUS(), setConfigRegLVDSOutEn(), setConfigRegPhaseADC(), setConfigRegPhaseINT(), setConfigRegPhaseTH(), and setConfigRegVControlOutEn().

71 {
72  U16 data;
73  bool ok = checkConfigAddr(confRegAddr);
74  if(ok)
75  {
76  data = ((d.lvdsOutEn & 0x01) << 15) | ((d.phaseTaHAdc & 0x1F) << 9) | ((d.phaseInt & 0x1F) << 4) | ((d.nVControlEn & 0x01) << 3) | ((d.padDebug & 0x01) << 2) | (d.locus & 0x03);
77  configRegBulkWrite(confRegAddr,data);
78 configRegBulkWrite(confRegAddr,data);
79  }
80  else
81  warning("@" + itos(confRegAddr) + " is not a valid Configuration Register address.","LSDCv1::setConfigReg");
82 }
std::string itos(int)
Definition: Tools.cpp:46
bool nVControlEn
Definition: LSDelayChipV1.h:47
void configRegBulkWrite(U8 confRegAddr, U16 confRegData)
def data(object, stream=None)
Definition: shell.py:150
unsigned short U16
Definition: ICECALv3.h:54
void warning(std::string mymsg)
Definition: Object.h:39
bool checkConfigAddr(U8 addr)

◆ setConfigRegDebugMode()

void LSDelayChipV1::setConfigRegDebugMode ( U8  confRegAddr,
bool  en 
)

Definition at line 115 of file LSDelayChipV1.cpp.

References getConfigReg(), m_rxConfig, confRegData::padDebug, and setConfigReg().

Referenced by BOOST_PYTHON_MODULE().

116 {
117  getConfigReg(confRegAddr);
118  m_rxConfig.padDebug = en;
119  setConfigReg(confRegAddr,m_rxConfig);
120 }
confRegData m_rxConfig
void getConfigReg(U8 confRegAddr)
void setConfigReg(U8 confRegAddr, confRegData d)

◆ setConfigRegLOCUS()

void LSDelayChipV1::setConfigRegLOCUS ( U8  confRegAddr,
U8  locus 
)

Definition at line 129 of file LSDelayChipV1.cpp.

References getConfigReg(), confRegData::locus, m_rxConfig, and setConfigReg().

Referenced by BOOST_PYTHON_MODULE().

130 {
131  getConfigReg(confRegAddr);
132  m_rxConfig.locus = locus;
133  setConfigReg(confRegAddr,m_rxConfig);
134 }
confRegData m_rxConfig
void getConfigReg(U8 confRegAddr)
void setConfigReg(U8 confRegAddr, confRegData d)

◆ setConfigRegLVDSOutEn()

void LSDelayChipV1::setConfigRegLVDSOutEn ( U8  confRegAddr,
bool  en 
)

Definition at line 108 of file LSDelayChipV1.cpp.

References getConfigReg(), confRegData::lvdsOutEn, m_rxConfig, and setConfigReg().

Referenced by BOOST_PYTHON_MODULE().

109 {
110  getConfigReg(confRegAddr);
111  m_rxConfig.lvdsOutEn = en;
112  setConfigReg(confRegAddr,m_rxConfig);
113 }
confRegData m_rxConfig
void getConfigReg(U8 confRegAddr)
void setConfigReg(U8 confRegAddr, confRegData d)

◆ setConfigRegPhaseADC()

void LSDelayChipV1::setConfigRegPhaseADC ( U8  confRegAddr,
U8  phaseADC 
)

Definition at line 87 of file LSDelayChipV1.cpp.

References getConfigReg(), m_rxConfig, confRegData::phaseTaHAdc, and setConfigReg().

Referenced by BOOST_PYTHON_MODULE().

88 {
89  getConfigReg(confRegAddr);
90  m_rxConfig.phaseTaHAdc = phaseADC;
91  setConfigReg(confRegAddr,m_rxConfig);
92 }
confRegData m_rxConfig
void getConfigReg(U8 confRegAddr)
void setConfigReg(U8 confRegAddr, confRegData d)

◆ setConfigRegPhaseINT()

void LSDelayChipV1::setConfigRegPhaseINT ( U8  confRegAddr,
U8  phaseINT 
)

Definition at line 101 of file LSDelayChipV1.cpp.

References getConfigReg(), m_rxConfig, confRegData::phaseInt, and setConfigReg().

Referenced by BOOST_PYTHON_MODULE().

102 {
103  getConfigReg(confRegAddr);
104  m_rxConfig.phaseInt = phaseINT;
105  setConfigReg(confRegAddr,m_rxConfig);
106 }
confRegData m_rxConfig
void getConfigReg(U8 confRegAddr)
void setConfigReg(U8 confRegAddr, confRegData d)

◆ setConfigRegPhaseTH()

void LSDelayChipV1::setConfigRegPhaseTH ( U8  confRegAddr,
U8  phaseTH 
)

Definition at line 94 of file LSDelayChipV1.cpp.

References getConfigReg(), m_rxConfig, confRegData::phaseTaHAdc, and setConfigReg().

Referenced by BOOST_PYTHON_MODULE().

95 {
96  getConfigReg(confRegAddr);
97  m_rxConfig.phaseTaHAdc = phaseTH;
98  setConfigReg(confRegAddr,m_rxConfig);
99 }
confRegData m_rxConfig
void getConfigReg(U8 confRegAddr)
void setConfigReg(U8 confRegAddr, confRegData d)

◆ setConfigRegVControlOutEn()

void LSDelayChipV1::setConfigRegVControlOutEn ( U8  confRegAddr,
bool  en 
)

Definition at line 122 of file LSDelayChipV1.cpp.

References getConfigReg(), m_rxConfig, confRegData::nVControlEn, and setConfigReg().

Referenced by BOOST_PYTHON_MODULE().

123 {
124  getConfigReg(confRegAddr);
125  m_rxConfig.nVControlEn = !en;
126  setConfigReg(confRegAddr,m_rxConfig);
127 }
confRegData m_rxConfig
bool nVControlEn
Definition: LSDelayChipV1.h:47
void getConfigReg(U8 confRegAddr)
void setConfigReg(U8 confRegAddr, confRegData d)

◆ showConfig()

void LSDelayChipV1::showConfig ( )

Definition at line 150 of file LSDelayChipV1.cpp.

References Object::info(), itohs(), itos(), confRegData::locus, LOCUS_0350_UA, LOCUS_1400_UA, LOCUS_2300_UA, LOCUS_3000_UA, confRegData::lvdsOutEn, m_configAddr, m_rxConfig, confRegData::nVControlEn, confRegData::padDebug, confRegData::phaseInt, and confRegData::phaseTaHAdc.

Referenced by BOOST_PYTHON_MODULE().

151 {
152  std::string lvdsCurrent;
154  {
155  if(m_rxConfig.locus == LOCUS_3000_UA) lvdsCurrent = "3.00";
156  if(m_rxConfig.locus == LOCUS_2300_UA) lvdsCurrent = "2.30";
157  if(m_rxConfig.locus == LOCUS_1400_UA) lvdsCurrent = "1.40";
158  if(m_rxConfig.locus == LOCUS_0350_UA) lvdsCurrent = "0.35";
159  }
160  else lvdsCurrent = "0.00";
161 
162  info("Configuration register @SPI = 0x" + itohs(m_configAddr) ,"LSDCv1::showConfig");
163  info("Integrator clock phase (ns) = " + itos(m_rxConfig.phaseInt) ,"LSDCv1::showConfig");
164  info("T&H // ADC clock phase (ns) = " + itos(m_rxConfig.phaseTaHAdc) ,"LSDCv1::showConfig");
165  info("LVDS Clock Output enable = " + itos((int)m_rxConfig.lvdsOutEn) ,"LSDCv1::showConfig");
166  info("LVDS Output Current (mA) = " + lvdsCurrent ,"LSDCv1::showConfig");
167  info("VControl Output enable = " + itos((int)!m_rxConfig.nVControlEn) ,"LSDCv1::showConfig");
168  info("CMOS Pads debug = " + itos((int)m_rxConfig.padDebug) ,"LSDCv1::showConfig");
169 }
void info(std::string mymsg)
Definition: Object.h:38
std::string itos(int)
Definition: Tools.cpp:46
confRegData m_rxConfig
bool nVControlEn
Definition: LSDelayChipV1.h:47
std::string itohs(U16 value)

◆ spiBERTest()

void LSDelayChipV1::spiBERTest ( U8  confRegAddr,
long  nFrames 
)

Definition at line 175 of file LSDelayChipV1.cpp.

References configRegBulkRead(), configRegBulkWrite(), Object::debug(), itohs(), itos(), m_fer, m_nBad, m_rxConfigBits, and Object::warning().

Referenced by BOOST_PYTHON_MODULE().

176 {
177  int i;
178  U16 writeData = 0x0000;
179  U16 readData, retry1, retry2, retry3;
180 
181  warning("Starting SPI BER test...");
182  m_nBad = 0;
183  for(i=0;i<nFrames;i++)
184  {
185  //I read and write the same register and I check if read data is OK.
186  writeData = rand() + rand();
187  configRegBulkWrite(confRegAddr,writeData);
188 configRegBulkWrite(255,writeData);
189  configRegBulkRead(confRegAddr);
190 configRegBulkWrite(255,writeData);
191  readData = m_rxConfigBits;
192  if(writeData != readData)
193  {
194  //If data is not OK I check how many bits are wrong.
195  m_nBad++;
196  warning("Mismatch: W = 0x" + itohs(writeData) + ", R = 0x" + itohs(readData) + ".","LSDCv1::spiBERTest");
197  debug("Retry...","LSDCv1::spiBERTest");
198  configRegBulkRead(confRegAddr);
199 configRegBulkWrite(255,writeData);
200  retry1 = m_rxConfigBits;
201  configRegBulkRead(confRegAddr);
202 configRegBulkWrite(255,writeData);
203  retry2 = m_rxConfigBits;
204  configRegBulkRead(confRegAddr);
205 configRegBulkWrite(255,writeData);
206  retry3 = m_rxConfigBits;
207  if(retry1 == retry2 && retry1 == retry3 && retry2 == retry3)
208  {
209  if(retry1 == readData) warning("It was a Write error!","LSDCv1::spiBERTest");
210  if(retry1 == writeData) warning("It was a Read error!","LSDCv1::spiBERTest");
211  }
212  }
213  }
214  m_fer = (double) m_nBad / nFrames;
215  warning("SPI BER test finished!!!");
216  warning("Bad frames = " + itos(m_nBad) + "/" + itos(nFrames) + ".");
217 }
std::string itos(int)
Definition: Tools.cpp:46
void configRegBulkRead(U8 confRegAddr)
void configRegBulkWrite(U8 confRegAddr, U16 confRegData)
void debug(std::string mymsg)
Definition: Object.h:37
std::string itohs(U16 value)
unsigned short U16
Definition: ICECALv3.h:54
void warning(std::string mymsg)
Definition: Object.h:39

◆ update()

void LSDelayChipV1::update ( )
inlinevirtual

Member Data Documentation

◆ m_address

U8 LSDelayChipV1::m_address
private

Definition at line 168 of file LSDelayChipV1.h.

◆ m_configAddr

U8 LSDelayChipV1::m_configAddr
private

Definition at line 172 of file LSDelayChipV1.h.

Referenced by getConfigReg(), and showConfig().

◆ m_fer

double LSDelayChipV1::m_fer
private

Definition at line 175 of file LSDelayChipV1.h.

Referenced by spiBERTest().

◆ m_nBad

long LSDelayChipV1::m_nBad
private

Definition at line 174 of file LSDelayChipV1.h.

Referenced by spiBERTest().

◆ m_regConfig

Register* LSDelayChipV1::m_regConfig
private

Definition at line 166 of file LSDelayChipV1.h.

Referenced by configRegBulkRead(), and configRegBulkWrite().

◆ m_regStatus

Register* LSDelayChipV1::m_regStatus
private

Definition at line 167 of file LSDelayChipV1.h.

◆ m_rxConfig

confRegData LSDelayChipV1::m_rxConfig
private

◆ m_rxConfigBits

U16 LSDelayChipV1::m_rxConfigBits
private

Definition at line 170 of file LSDelayChipV1.h.

Referenced by configRegBulkRead(), getConfigReg(), and spiBERTest().


The documentation for this class was generated from the following files: