Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Related Functions

nxyter::Feb1nxGenD Class Reference

Represents a FEB Rev D with 1 nXYTER. More...

#include <Feb1nxGenD.h>

Inheritance diagram for nxyter::Feb1nxGenD:
Inheritance graph
[legend]
Collaboration diagram for nxyter::Feb1nxGenD:
Collaboration graph
[legend]

Public Types

enum  FebType {
  kFeb1nx = 100, kFeb1nxGenB, kFeb1nxGenC, kFeb1nxGenD,
  kFeb2nx = 200, kFeb2nxGas, kFeb4nx = 400, kFeb4nxBT
}

Public Member Functions

 Feb1nxGenD ()
 Feb1nxGenD (base::Board *board, int port)
 Constructor with full addressing path information.
virtual ~Feb1nxGenD ()
int getPortNumber () const
 Returns port (connector) number on ROC (0 or 1).
int getFebClass () const
 Returns class of FEB, kFeb1nx, kFeb2nx, or kFeb4nx.
int getFebType () const
 Returns type of FEB, encoding see FebBase::FebType.
int numNx () const
 Returns the number connected nXYTER on this FEB.
nxyter::NxChipnx (int nxind)
 Gives access to the NxChip object of the nXYTER with index ind.
nxyter::MainAdcadc ()
 Gives access to the MainADC object.
virtual int getFebState ()
 Get current FEB state - active flags of nXYTERs.
virtual int initRoc ()
 Initialize ROC to support this FEB.
virtual int probe ()
 Probe whether nx and adc on the FEB are available. set 'offline' flags.
virtual int setToDefault (bool ispos0=false, bool ispos1=false)
 Write default values into ADC and nXYTER registers.
virtual void printNxHeadLine (std::ostream &os, int nxind)
 Print standart headline for a nXYTER nxind.
virtual void printRegisters (std::ostream &os, int domask=nxyter::kDoAll)
 Read nXYTER and ADC registers and print to stream os.
void resetNxI2cBus ()
 Reset the I2C Interface of all nXYTERs of the FEB.
void resetNxI2cRegister ()
 Reset the I2C Registers of all nXYTERs of the FEB.
void setNxOffline (int nxind, bool isoff)
 Set 'offline' status flag for nXYTER nxind.
bool getNxOffline (int nxind)
 Returns 'offline' status flag for nXYTER nxind.
int setNxTestModes (bool testpuls, bool testtrig, int calselect)
 Setup test pulser and test trigger mode in all nXYTERs.
int setNxRegisterAll (uint8_t reg, uint8_t val, bool veri=true)
 Write a value into a register of all nXYTERs.
bool monAdcSupport ()
 Returns monitor ADC support status.
bool eepromSupport ()
 Returns EEProm support status.
int getNumMonAdc ()
int getMonAdc (int ch, uint16_t &val)
 Read value from monitoring ADC.
base::Boardboard ()
 Return reference to roc::Board which hosts the Peripheral.
base::BoardgetBoard () const
 Returns pointer to the roc::Board which hosts the Peripheral.

Static Public Member Functions

static const char * typeToString (int type)
 Converts a FebClass or FebType value into a string.
static int stringToType (const char *str)
 Converts a string into a FebClass or FebType value.
static void discoverFebs (base::Board *board, int &typeport0, int &typeport1, bool liberal=false)
 Method to discover FEB's connected to the ROC.
static nxyter::FebBasenewFeb (base::Board *board, int port, int type)
 Factory method to create a new Feb object.

Protected Member Functions

void addNxChip (int addr, int nxnum, int adcmux)

Protected Attributes

int fPort
 port the feb is connected to
int fType
 FEB class/type.
std::vector< nxyter::NxChip * > fNxChip
 vector of NxChip objects
std::vector< bool > fNxOffline
 nx offline flag
nxyter::MainAdc fMainAdc
 MainAdc object.
bool fMode4nx
 4nx mode selector
std::vector< int > fAdcChannel
 ADC channel mux settings.
roc::I2cDevice fMonAdcDevice
 monitor ADC I2C device
roc::I2cDevice fEepromDevice
 EEProm I2C device.
base::BoardfBoard
 board pointer

Related Functions

(Note that these are not member functions.)



std::ostream & operator<< (std::ostream &os, nxyter::FebBase &obj)
 ostream insertion for nxyter::FebBase

Detailed Description

Represents a FEB Rev D with 1 nXYTER.

Definition at line 15 of file Feb1nxGenD.h.


Member Enumeration Documentation

enum nxyter::FebBase::FebType [inherited]
Enumerator:
kFeb1nx 

single Nx FEB class

kFeb1nxGenB 

1nx general purpose FEB Rev B

kFeb1nxGenC 

1nx general purpose FEB Rev C

kFeb1nxGenD 

1nx general purpose FEB Rev D

kFeb2nx 

dual Nx FEB class

kFeb2nxGas 

2nx FEB for gas detectors

kFeb4nx 

quad Nx FEB class

kFeb4nxBT 

4nx FEB CBM beam tracker

Definition at line 33 of file FebBase.h.


Constructor & Destructor Documentation

nxyter::Feb1nxGenD::Feb1nxGenD (  )  [inline]

Definition at line 17 of file Feb1nxGenD.h.

nxyter::Feb1nxGenD::Feb1nxGenD ( base::Board board,
int  port 
)

Constructor with full addressing path information.

Sets up Feb1nxGenD object with full addressing information

Parameters:
board ROC board pointer
port the ROC port

Definition at line 25 of file Feb1nxGenD.cxx.

References nxyter::FebBase::addNxChip(), nxyter::FebBase::fMonAdcDevice, and roc::I2cDevice::setSlaveAddr().

nxyter::Feb1nxGenD::~Feb1nxGenD (  )  [virtual]

Definition at line 36 of file Feb1nxGenD.cxx.


Member Function Documentation

nxyter::MainAdc& nxyter::FebBase::adc (  )  [inline, inherited]
void nxyter::FebBase::addNxChip ( int  addr,
int  nxnum,
int  adcmux 
) [protected, inherited]

Adds a new nXYTER with I2C slave address addr and nXYYER number nxnum to the configuration. The FebBase class supports FEB's with up to 4 nXYTERs, so this method can be called at most 4 times.

Parameters:
addr I2C slave address of the nXYTER
nxnum see nXYTER number
adcmux setting for the ADC channel Mux
Exceptions:
std::out_of_range if called more often than the FebType requires.

Definition at line 359 of file FebBase.cxx.

References nxyter::FebBase::fAdcChannel, nxyter::FebBase::fNxChip, nxyter::FebBase::fNxOffline, nxyter::FebBase::fPort, and base::Peripheral::getBoard().

Referenced by nxyter::Feb1nxGenB::Feb1nxGenB(), nxyter::Feb1nxGenC::Feb1nxGenC(), Feb1nxGenD(), nxyter::Feb2nxGas::Feb2nxGas(), and nxyter::Feb4nxBT::Feb4nxBT().

base::Board & base::Peripheral::board (  )  [inherited]
void nxyter::FebBase::discoverFebs ( base::Board board,
int &  typeport0,
int &  typeport1,
bool  liberal = false 
) [static, inherited]

Method to discover FEB's connected to the ROC.

This static method can be used to determine what type of FEBs are connected to the two ports of the ROC represented by board. When liberal is false (the default), only fully fully functional FEBs with all nXYTERs operational will be recognized. If liberal is true, also FEBs with non-operational nXYTERs. The ADC must always be available.

The discover logic is based on the I2C slave address convention

  • 1nx boards have the nXYTER in the range 2,...,30
  • 2nx boards have the nXYTER in the range 32,...,62
  • 4nx boards have the nXYTER in the range 64,...,126

The currently available FEB's use:

  • FEB1nxGenC: [0] on 8
  • FEB1nxGenD: [0] on 8
  • FEB2nxGas: [0] on 40; [1] on 48
  • FEB4nxBT: [0] on 72; [1] on 82; [2] on 84; [3] on 88

For strict mode (liberal = false) all nXYTERs must be seen, for liberal mode (liberal = true) one is enough.

Parameters:
board ROC board pointer
typeport0 the type of FEB as defined in FebType for the FEB found on port 0, or 0 if none found.
typeport1 the type of FEB as defined in FebType for the FEB found on port 1, or 0 if none found.
liberal if true, also FEBs with disfunctional nXYTERs are accepted

Definition at line 447 of file FebBase.cxx.

References nxyter::FebBase::adc(), roc::I2cDevice::getRegister16(), nxyter::NxChip::i2c(), nxyter::FebBase::kFeb1nxGenC, nxyter::FebBase::kFeb2nxGas, nxyter::FebBase::kFeb4nx, nxyter::FebBase::kFeb4nxBT, nxyter::FebBase::nx(), nxyter::NxI2c::probe(), and nxyter::MainAdc::probe().

Referenced by cmd_feb(), RocNxWidget::detectFebs(), and nxyter::FebUtil::probe().

bool nxyter::FebBase::eepromSupport (  )  [inline, inherited]

Returns EEProm support status.

Returns:
true if the type of FEB supports an EEProm.

Definition at line 121 of file FebBase.h.

References nxyter::FebBase::fEepromDevice, and roc::I2cDevice::getSlaveAddr().

base::Board* base::Peripheral::getBoard (  )  const [inline, inherited]
int nxyter::FebBase::getFebClass (  )  const [inline, inherited]

Returns class of FEB, kFeb1nx, kFeb2nx, or kFeb4nx.

Definition at line 54 of file FebBase.h.

References nxyter::FebBase::fType.

int nxyter::FebBase::getFebState (  )  [virtual, inherited]

Get current FEB state - active flags of nXYTERs.

Returns:
see roc::Board get/put/oper return codes

Definition at line 127 of file FebBase.cxx.

References nxyter::NxChip::isactive(), nxyter::FebBase::numNx(), nxyter::FebBase::nx(), and nxyter::FebBase::setNxOffline().

Referenced by FebWidget::getSubConfig().

int nxyter::FebBase::getFebType (  )  const [inline, inherited]

Returns type of FEB, encoding see FebBase::FebType.

Definition at line 58 of file FebBase.h.

References nxyter::FebBase::fType.

Referenced by FebWidget::FebWidget(), and FebWidget::fillCmdFile().

int nxyter::FebBase::getMonAdc ( int  ch,
uint16_t &  val 
) [inherited]

Read value from monitoring ADC.

Returns reading of channel ch from the monitoring ADC.

Parameters:
ch channel number (0 to 3)
val 16 bit value to be written
Returns:
see roc::Board get/put/oper return codes, or -1 if no monitoring ADC support available, or -2 if ch out of range, or -3 if ADC read error

Definition at line 334 of file FebBase.cxx.

References nxyter::FebBase::fMonAdcDevice, roc::I2cDevice::getRegister16(), and nxyter::FebBase::monAdcSupport().

Referenced by cmd_printmon(), cmd_scanmonadc(), FebWidget::displayMonAdcs(), and roc::BoardsVector::readFeb().

int nxyter::FebBase::getNumMonAdc (  )  [inherited]
bool nxyter::FebBase::getNxOffline ( int  nxind  )  [inline, inherited]
int nxyter::FebBase::getPortNumber (  )  const [inline, inherited]

Returns port (connector) number on ROC (0 or 1).

Definition at line 50 of file FebBase.h.

References nxyter::FebBase::fPort.

Referenced by cmd_geti2c(), cmd_getnx(), cmd_printstatus(), cmd_puti2c(), cmd_seti2c(), and FebWidget::fillCmdFile().

int nxyter::FebBase::initRoc (  )  [virtual, inherited]
bool nxyter::FebBase::monAdcSupport (  )  [inline, inherited]

Returns monitor ADC support status.

Returns:
true if the type of FEB supports a monitoring ADC.

Definition at line 114 of file FebBase.h.

References nxyter::FebBase::fMonAdcDevice, and roc::I2cDevice::getSlaveAddr().

Referenced by cmd_printmon(), FebWidget::displayMonAdcs(), nxyter::FebBase::getMonAdc(), nxyter::FebBase::getNumMonAdc(), and roc::BoardsVector::readFeb().

nxyter::FebBase * nxyter::FebBase::newFeb ( base::Board board,
int  port,
int  type 
) [static, inherited]

Factory method to create a new Feb object.

Parameters:
board ROC board pointer
port the ROC port
type of Feb object to be created as encoded in FebBase::FebType
Returns:
pointer to new Feb object, or 0 if type is not a valid FEB type.

Definition at line 549 of file FebBase.cxx.

References nxyter::FebBase::kFeb1nxGenB, nxyter::FebBase::kFeb1nxGenC, nxyter::FebBase::kFeb1nxGenD, nxyter::FebBase::kFeb2nxGas, and nxyter::FebBase::kFeb4nxBT.

Referenced by RocNxWidget::addFebWidget(), cmd_feb(), and roc::BoardsVector::setBoard().

int nxyter::FebBase::numNx (  )  const [inline, inherited]
nxyter::NxChip & nxyter::FebBase::nx ( int  nxind  )  [inherited]

Gives access to the NxChip object of the nXYTER with index ind.

Provides to access the object representing one of the nXYTERs on the FEB. Acceptable values of ind are 0 to numNx() -1, otherwise an exception is thrown.

Parameters:
nxind see nXYTER index
Exceptions:
std::out_of_range if nxind out of range
Note:
the nXYTER index needed here can be different from the nXYTER number (usually named nxnum). The index nxind identifies the nXYTER on a given FEB. The nXYTER number provides a unique identification of all nXYTERs on a ROC.

Definition at line 86 of file FebBase.cxx.

References nxyter::FebBase::fNxChip.

Referenced by nxyter::FebUtil::acquireTestPulserData(), nxyter::FebUtil::acquireTestTriggerData(), autoped_setnxmode(), roc::BoardsVector::autoped_setnxmode(), cmd_autosettrh(), cmd_autotrim(), cmd_autovbiass(), cmd_getnx(), cmd_idsigch(), cmd_printnx(), cmd_printstatus(), cmd_scanadclat(), cmd_scanmonadc(), cmd_scanvbiasf(), cmd_scanvbiass(), cmd_setnx(), cmd_setnxaddr(), cmd_setnxdef(), cmd_setnxmask(), cmd_setnxmode(), cmd_setnxpower(), cmd_setnxtrim(), FebWidget::createTabs(), nxyter::FebBase::discoverFebs(), get_vbiass_data(), nxyter::FebBase::getFebState(), nxyter::FebBase::initRoc(), nxyter::FebBase::printNxHeadLine(), nxyter::FebBase::printRegisters(), nxyter::FebBase::probe(), nxyter::FebUtil::restoreFeb(), nxyter::FebUtil::saveFeb(), nxyter::FebBase::setNxRegisterAll(), nxyter::FebBase::setNxTestModes(), nxyter::FebBase::setToDefault(), nxyter::FebUtil::testFebControlPathCombo(), nxyter::FebUtil::testNxControlPath(), and nxyter::FebUtil::testNxRegisters().

void nxyter::FebBase::printNxHeadLine ( std::ostream &  os,
int  nxind 
) [virtual, inherited]
void nxyter::FebBase::printRegisters ( std::ostream &  os,
int  domask = nxyter::kDoAll 
) [virtual, inherited]

Read nXYTER and ADC registers and print to stream os.

This method uses the NxI2c::printRegisters() and MainAdc::printRegisters() methods to print the current status of the FEB board, consult the respective documentation for details.

Definition at line 223 of file FebBase.cxx.

References nxyter::FebBase::adc(), nxyter::FebBase::fNxChip, nxyter::FebBase::fPort, nxyter::FebBase::getNxOffline(), nxyter::NxChip::i2c(), nxyter::FebBase::nx(), nxyter::FebBase::printNxHeadLine(), nxyter::MainAdc::printRegisters(), and nxyter::NxI2c::printRegisters().

Referenced by cmd_printfeb(), and nxyter::FebBase::operator<<().

int nxyter::FebBase::probe (  )  [virtual, inherited]

Probe whether nx and adc on the FEB are available. set 'offline' flags.

The probe method uses the NxI2c::probe() and MainAdc::probe() methods to determine whether control access to the nXYTER and ADC can be established. If an nXYTER probe fails, the 'offline' flag will be set true, see setNxOffline().

Returns:
0 in case ADC and all nXYTYERs are successfully probed. Otherwise a bit pattern of the missing components is returned, where bit 0 to 3 set indicate that nXYTER 0 to 3 is missing, and bit 4 indicates that the ADC is missing.

Definition at line 150 of file FebBase.cxx.

References nxyter::FebBase::adc(), nxyter::FebBase::fNxChip, nxyter::NxChip::i2c(), nxyter::FebBase::nx(), nxyter::NxI2c::probe(), and nxyter::FebBase::setNxOffline().

void nxyter::FebBase::resetNxI2cBus (  )  [inherited]

Reset the I2C Interface of all nXYTERs of the FEB.

This methods resets the I2C bus state machine in all nXYYERs on the FEB. It might be useful in case this state machine is stuck. It should not affect the status of any register in the nXYTER.

See also:
resetNxI2cRegister()

Definition at line 242 of file FebBase.cxx.

References base::Peripheral::board(), nxyter::FebBase::fPort, base::Board::operPPP(), ROC_NX_I2C_RESET, and ROC_NX_I2C_SWITCH.

Referenced by cmd_resetnxi2cbus().

void nxyter::FebBase::resetNxI2cRegister (  )  [inherited]

Reset the I2C Registers of all nXYTERs of the FEB.

This method resets the I2C registers of all nXYTERs on the FEB to the chip default values, which are 0 for masks and 128 (mid range) for all bias DAC's. In general this will out the nXYTER in a state where it will not operate properly.

This method might be useful in some cases of despair and to test this reset mechanism of last resort. To put the FEB into a working state use setToDefault().

See also:
resetI2cBus(), setToDefault().

Definition at line 264 of file FebBase.cxx.

References base::Peripheral::board(), nxyter::FebBase::fPort, base::Board::operPPP(), ROC_NX_I2C_REGRESET, and ROC_NX_I2C_SWITCH.

Referenced by cmd_resetnxi2creg().

void nxyter::FebBase::setNxOffline ( int  nxind,
bool  isoff 
) [inline, inherited]

Set 'offline' status flag for nXYTER nxind.

If a nXYTER is set offline it will be silently ignored in all FEB level methods which loop over all nXYTERs, in particular initRoc(), setToDefault(), setNxRegisterAll(). The 'offline' flag does not affect the direct access to the nXYTER resources via nx().

Parameters:
nxind see nXYTER index
isoff when true, nXYTER is set inactive
Exceptions:
std::out_of_range if nxind out of range
See also:
getNxOffline()

Definition at line 95 of file FebBase.h.

References nxyter::FebBase::fNxOffline.

Referenced by cmd_setnxoff(), FebWidget::enableNxClicked(), nxyter::FebBase::getFebState(), and nxyter::FebBase::probe().

int nxyter::FebBase::setNxRegisterAll ( uint8_t  reg,
uint8_t  val,
bool  veri = true 
) [inherited]

Write a value into a register of all nXYTERs.

Writes val into register reg of all nXYTERs on the FEB.

Parameters:
reg register number
val value to be written
veri if true readback verification done (default is true)
Returns:
see roc::Board get/put/oper return codes

Definition at line 303 of file FebBase.cxx.

References nxyter::FebBase::fNxChip, nxyter::FebBase::getNxOffline(), nxyter::NxChip::i2c(), nxyter::FebBase::nx(), base::Board::operErrBuild(), and roc::I2cDevice::setRegister().

Referenced by cmd_testnxdata(), and nxyter::QuickDaq::setNxRegisterAll().

int nxyter::FebBase::setNxTestModes ( bool  testpuls,
bool  testtrig,
int  calselect 
) [inherited]

Setup test pulser and test trigger mode in all nXYTERs.

Calls for all nXYTERs on of the FEB the NxI2c::setNxTestModes() method, check the documentation of this method for details.

Parameters:
testtrig determines whether test trigger mode is enabled
testpuls determines whether test pulser mode is enabled
calselect determines which channel group receives test pulse
Returns:
see roc::Board get/put/oper return codes

Definition at line 283 of file FebBase.cxx.

References nxyter::FebBase::fNxChip, nxyter::NxChip::i2c(), nxyter::FebBase::nx(), base::Board::operErrBuild(), and nxyter::NxI2c::setTestModes().

Referenced by cmd_testnxdata(), and nxyter::QuickDaq::setNxTestModes().

int nxyter::FebBase::setToDefault ( bool  ispos0 = false,
bool  ispos1 = false 
) [virtual, inherited]

Write default values into ADC and nXYTER registers.

This method uses the NxI2c::setToDefault() and MainAdc::setToDefault() methods to setup the registers with default values, consult the respective documentation for details. The nXYTER polarity is determined by ispos0 and ispos1, where ispos0 determines the polarity for an FEB1nx, the first (index 0) chip if an FEB2nx and the first two (index 0 and 1) of an FEB4nx. ispos1 is used for the remaining chips.

Returns:
see roc::Board get/put/oper return codes

Definition at line 178 of file FebBase.cxx.

References nxyter::FebBase::adc(), nxyter::FebBase::fNxChip, nxyter::FebBase::getNxOffline(), nxyter::NxChip::i2c(), nxyter::FebBase::nx(), base::Board::operErrBuild(), nxyter::MainAdc::setToDefault(), and nxyter::NxI2c::setToDefault().

Referenced by cmd_setfebdef(), and cmd_testnxdata().

int nxyter::FebBase::stringToType ( const char *  str  )  [static, inherited]

Converts a string into a FebClass or FebType value.

Parameters:
str string with the text representation of a FEB class or FEB type.
Returns:
FEB class or FEB type value, or 0 if str doesn't match any of the valid names.

Definition at line 401 of file FebBase.cxx.

Referenced by roc::BoardsVector::setBoard().

const char * nxyter::FebBase::typeToString ( int  type  )  [static, inherited]

Converts a FebClass or FebType value into a string.

Parameters:
type FEB class or FEB type value
Returns:
pointer to a static string with text representation, or a pointer to an empty string ("") if type isn't a member of FebBase::FebType

Definition at line 377 of file FebBase.cxx.

References nxyter::FebBase::kFeb1nx, nxyter::FebBase::kFeb1nxGenB, nxyter::FebBase::kFeb1nxGenC, nxyter::FebBase::kFeb1nxGenD, nxyter::FebBase::kFeb2nx, nxyter::FebBase::kFeb2nxGas, nxyter::FebBase::kFeb4nx, and nxyter::FebBase::kFeb4nxBT.

Referenced by RocNxWidget::addFebKind(), RocNxWidget::addFebWidget(), cmd_feb(), FebWidget::fillCmdFile(), and nxyter::FebUtil::probe().


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  os,
nxyter::FebBase obj 
) [related, inherited]

ostream insertion for nxyter::FebBase

Just calls nxyter::FebBase::printRegisters()

Definition at line 150 of file FebBase.h.

References nxyter::FebBase::printRegisters().


Field Documentation

std::vector<int> nxyter::FebBase::fAdcChannel [protected, inherited]

ADC channel mux settings.

Definition at line 28 of file FebBase.h.

Referenced by nxyter::FebBase::addNxChip(), nxyter::FebBase::FebBase(), and nxyter::FebBase::initRoc().

base::Board* base::Peripheral::fBoard [protected, inherited]

board pointer

Definition at line 26 of file Peripheral.h.

Referenced by base::Peripheral::board(), base::Peripheral::getBoard(), and base::Peripheral::Peripheral().

EEProm I2C device.

Definition at line 30 of file FebBase.h.

Referenced by nxyter::FebBase::eepromSupport().

MainAdc object.

Definition at line 26 of file FebBase.h.

Referenced by nxyter::FebBase::adc().

bool nxyter::FebBase::fMode4nx [protected, inherited]

4nx mode selector

Definition at line 27 of file FebBase.h.

Referenced by nxyter::FebBase::FebBase(), and nxyter::FebBase::initRoc().

monitor ADC I2C device

Definition at line 29 of file FebBase.h.

Referenced by Feb1nxGenD(), nxyter::FebBase::getMonAdc(), and nxyter::FebBase::monAdcSupport().

std::vector<nxyter::NxChip*> nxyter::FebBase::fNxChip [protected, inherited]
std::vector<bool> nxyter::FebBase::fNxOffline [protected, inherited]
int nxyter::FebBase::fPort [protected, inherited]
int nxyter::FebBase::fType [protected, inherited]

FEB class/type.

Definition at line 23 of file FebBase.h.

Referenced by nxyter::FebBase::getFebClass(), and nxyter::FebBase::getFebType().


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