Device class with all GPIO access methods. More...
#include <Gpio.h>
Public Member Functions | |
Gpio (base::Board *board) | |
Constructor with full addressing path information. | |
virtual | ~Gpio () |
int | setSyncBaud (int gpio_nr, uint32_t ratediv) |
Set baud rate for sync message sender or receiver. | |
int | setSyncBaud (int gpio_nr, uint32_t offset, uint32_t even, uint32_t odd) |
Set baud rate for sync message sender or receiver. | |
int | getSyncBaud (int gpio_nr, uint32_t &ratediv) |
Get baud rate divider setting for sync message sender or receiver. | |
int | getSyncBaud (int gpio_nr, uint32_t &offset, uint32_t &even, uint32_t &odd) |
Get baud rate settings for sync message sender or receiver. | |
int | setSyncScale (uint32_t val) |
Sets the synch message sender scale down to 1 to 2** val. | |
int | getSyncScale (uint32_t &val) |
Get the synch message sender scale down. | |
int | getConfig (uint32_t &mask) |
Read GPIO configuration register. | |
int | setConfig (uint32_t mask) |
Write GPIO configuration register. | |
int | setConfig (int gpio_nr, bool riseedge, bool falledge, bool throttled, bool extrafunc, bool altin) |
Configure one GPIO port. | |
base::Board & | board () |
Return reference to roc::Board which hosts the Peripheral . | |
base::Board * | getBoard () const |
Returns pointer to the roc::Board which hosts the Peripheral . | |
Static Public Member Functions | |
static const char * | name (int n) |
static bool | packConfig (uint32_t &mask, int gpio_nr, bool riseedge, bool falledge, bool throttled, bool extrafunc, bool altin) |
Update part of GPIO configuration mask. | |
static bool | unpackConfig (uint32_t mask, int gpio_nr, bool &riseedge, bool &falledge, bool &throttled, bool &extrafunc, bool &altin) |
Retrieve attribute flags from GPIO configuration mask. | |
static void | addAddrMap (base::Board *board) |
Add the GPIO interface address set to the address mapping tables. | |
Protected Attributes | |
base::Board * | fBoard |
board pointer |
Device class with all GPIO access methods.
Definition at line 11 of file Gpio.h.
base::Gpio::Gpio | ( | base::Board * | board | ) |
void base::Gpio::addAddrMap | ( | base::Board * | board | ) | [static] |
Add the GPIO interface address set to the address mapping tables.
Definition at line 353 of file Gpio.cxx.
References base::Board::addRegAddrMapping(), base::GPIO_CONFIG, base::GPIO_SYNCM_BAUD1, base::GPIO_SYNCM_BAUD2, base::GPIO_SYNCM_BAUD_START, base::GPIO_SYNCM_SCALEDOWN, base::GPIO_SYNCS0_BAUD1, base::GPIO_SYNCS0_BAUD2, base::GPIO_SYNCS0_BAUD_START, base::GPIO_SYNCS1_BAUD1, base::GPIO_SYNCS1_BAUD2, and base::GPIO_SYNCS1_BAUD_START.
Referenced by cmd_board(), and main().
base::Board & base::Peripheral::board | ( | ) | [inherited] |
Return reference to roc::Board
which hosts the Peripheral
.
std::runtime_error | if board pointer not initialized or 0. |
Definition at line 30 of file Peripheral.cxx.
References base::Peripheral::fBoard.
Referenced by nxyter::RocNx::fireTestPulse(), nxyter::MainAdc::getAdcDirect(), nxyter::NxChip::getChannelDelay(), nxyter::MainAdc::getChannelLatency(), nxyter::MainAdc::getClockDelayBufg(), nxyter::MainAdc::getClockDelaySrInit(), getConfig(), nxyter::RocNx::getDataDebug(), nxyter::RocNx::getFifoEmpty(), nxyter::RocNx::getFifoFull(), nxyter::RocNx::getNxActive(), roc::I2cDevice::getRegister(), nxyter::MainAdc::getRegister(), roc::I2cDevice::getRegister16(), getSyncBaud(), getSyncScale(), nxyter::FebBase::initRoc(), nxyter::FebBase::resetNxI2cBus(), nxyter::FebBase::resetNxI2cRegister(), nxyter::RocNx::resetRocNxTs(), nxyter::NxChip::setChannelDelay(), nxyter::MainAdc::setChannelLatency(), nxyter::MainAdc::setChannelMux(), nxyter::MainAdc::setClockDelay(), nxyter::MainAdc::setClockDelayBufg(), nxyter::MainAdc::setClockDelaySrInit(), setConfig(), nxyter::RocNx::setDebugMode(), nxyter::RocNx::setLTSDelay(), nxyter::RocNx::setNxActive(), nxyter::NxChip::setNxNumber(), nxyter::RocNx::setParityCheck(), roc::I2cDevice::setRegister(), nxyter::MainAdc::setRegister(), roc::I2cDevice::setRegisterVerify(), setSyncBaud(), setSyncScale(), and nxyter::RocNx::setToDefault().
base::Board* base::Peripheral::getBoard | ( | ) | const [inline, inherited] |
Returns pointer to the roc::Board which hosts the Peripheral
.
Note: normally using board()
is more convenient.
Definition at line 38 of file Peripheral.h.
References base::Peripheral::fBoard.
Referenced by nxyter::FebUtil::acquireTestTriggerData(), nxyter::NxChip::activate(), nxyter::FebBase::addNxChip(), nxyter::NxChip::deactivate(), nxyter::NxChip::isactive(), and nxyter::QuickDaq::QuickDaq().
int base::Gpio::getConfig | ( | uint32_t & | mask | ) |
Read GPIO configuration register.
mask | read value of GPIO configuration register |
Definition at line 215 of file Gpio.cxx.
References base::Peripheral::board(), base::Board::get(), and base::GPIO_CONFIG.
Referenced by cmd_autoped(), cmd_firepulser(), cmd_printgpio(), cmd_printstatus(), GpioWidget::getSubConfig(), roc::BoardsVector::setBoard(), and setConfig().
int base::Gpio::getSyncBaud | ( | int | gpio_nr, | |
uint32_t & | ratediv | |||
) |
Get baud rate divider setting for sync message sender or receiver.
see setSyncBaud(int gpio_nr, uint32_t ratediv) for detailed description of the arguments.
Definition at line 139 of file Gpio.cxx.
Referenced by cmd_printgpio(), and GpioWidget::getSubConfig().
int base::Gpio::getSyncBaud | ( | int | gpio_nr, | |
uint32_t & | offset, | |||
uint32_t & | odd, | |||
uint32_t & | even | |||
) |
Get baud rate settings for sync message sender or receiver.
set setSyncBaud(int gpio_nr, uint32_t& offset, uint32_t& odd, uint32_t& even) for detailed description of the arguments.
Definition at line 102 of file Gpio.cxx.
References base::Peripheral::board(), base::GPIO_SYNCS1_BAUD1, base::GPIO_SYNCS1_BAUD2, base::GPIO_SYNCS1_BAUD_START, and base::Board::operGGG().
int base::Gpio::getSyncScale | ( | uint32_t & | val | ) |
Get the synch message sender scale down.
val | sync message scale down exponent |
Definition at line 202 of file Gpio.cxx.
References base::Peripheral::board(), base::Board::get(), and base::GPIO_SYNCM_SCALEDOWN.
Referenced by cmd_printgpio(), cmd_printstatus(), and GpioWidget::getSubConfig().
const char * base::Gpio::name | ( | int | n | ) | [static] |
Definition at line 371 of file Gpio.cxx.
References base::NumGpio.
Referenced by GpioWidget::GpioWidget().
bool base::Gpio::packConfig | ( | uint32_t & | mask, | |
int | gpio_nr, | |||
bool | riseedge, | |||
bool | falledge, | |||
bool | throttled, | |||
bool | extrafunc, | |||
bool | altin | |||
) | [static] |
Update part of GPIO configuration mask.
Updates in the GPIO configuration mask mask the bits corresponding to GPIO port gpio_nr accoding to the attributes riseedge, falledge, throttled, extrafunc and altin. For detailed description of attributes see setRocGpioConfig(). Unsupported attributes are ignored. Returns false
if gpio_nr is outside range 2 to 7.
Definition at line 282 of file Gpio.cxx.
Referenced by cmd_autoped(), cmd_firepulser(), GpioWidget::getMaskValue(), roc::BoardsVector::setBoard(), and setConfig().
int base::Gpio::setConfig | ( | uint32_t | mask | ) |
Write GPIO configuration register.
mask | new content of the GPIO configuration register |
Definition at line 228 of file Gpio.cxx.
References base::Peripheral::board(), base::GPIO_CONFIG, and base::Board::put().
Referenced by roc::BoardsVector::autoped_switch(), cmd_autoped(), cmd_firepulser(), cmd_setaux(), cmd_setsyncs(), roc::BoardsVector::returnBoards(), setConfig(), and GpioWidget::setMask().
int base::Gpio::setConfig | ( | int | gpio_nr, | |
bool | riseedge, | |||
bool | falledge, | |||
bool | throttled, | |||
bool | extrafunc, | |||
bool | altin | |||
) |
Configure one GPIO port.
gpio_nr | The number of the GPIO port (2 - 7 for SYNC_S0, SYNC_S1, AUX0, AUX1, AUX2, AUX3) | |
riseedge | if true , SYNC is enable or AUX records rising edges | |
falledge | if true , SYNC is enable or AUX records falling edges | |
throttled | if true , the channel is sensitive to throttling, data is dropped when ROC is throttling. If false , port sends data even when ROC is throttling. | |
extrafunc | if true enables additional functionality associated with port:
| |
altin | if true , switches an AUX to an alternate input source:
|
Definition at line 258 of file Gpio.cxx.
References getConfig(), base::Board::operErrBuildInc(), packConfig(), and setConfig().
int base::Gpio::setSyncBaud | ( | int | gpio_nr, | |
uint32_t | offset, | |||
uint32_t | odd, | |||
uint32_t | even | |||
) |
Set baud rate for sync message sender or receiver.
gpio_nr | The number of the GPIO port
| |
offset | number of 250 MHz clock cycles between the start bit edge and the first data capture | |
odd | number of 250 MHz clock cycles between the (2n + 1) data capture and the (2n + 2) data capture | |
even | number of 250 MHz clock cycles between the (2n + 0) data capture and the (2n + 1) data capture |
Definition at line 48 of file Gpio.cxx.
References base::Peripheral::board(), base::GPIO_SYNCS1_BAUD1, base::GPIO_SYNCS1_BAUD2, base::GPIO_SYNCS1_BAUD_START, and base::Board::operPPP().
int base::Gpio::setSyncBaud | ( | int | gpio_nr, | |
uint32_t | ratediv | |||
) |
Set baud rate for sync message sender or receiver.
gpio_nr | The number of the GPIO port
| |
ratediv | rate divider factor |
Definition at line 84 of file Gpio.cxx.
Referenced by cmd_setsyncm(), cmd_setsyncs(), and GpioWidget::setSyncRate().
int base::Gpio::setSyncScale | ( | uint32_t | val | ) |
Sets the synch message sender scale down to 1 to 2** val.
The sync message sender sends a sync message either at every epoch or scaled down every every 2nd, or every 4th, or every 2**n'th epoch. This methods sets the scale down exponent, allowed values for val are 0 to 21. Since the epoch is 16.384 usec this allows to adjust the sync message period between ~16 usec and 35 sec.
val | sync message scale down exponent, range 0 to 21. |
val | period | Comment |
0 | 16.384 usec | every epoch |
1 | 32.768 usec | every 2nd epoch |
2 | 65.536 usec | every 4th epoch |
3 | 131.072 usec | every 8th epoch |
4 | 262.144 usec | every 16th epoch |
5 | 524.288 usec | every 32th epoch |
6 | ~1.05 msec | every 64th epoch |
7 | ~2.09 msec | every 128th epoch |
8 | ~4.19 msec | every 256th epoch |
9 | ~8.38 msec | every 512th epoch |
10 | ~16.77 msec | every 1024th epoch |
11 | ~33.55 msec | every 2048th epoch |
12 | ~67.11 msec | every 4096th epoch |
13 | ~134.21 msec | every 8192th epoch |
14 | ~268.43 msec | every 16384th epoch |
15 | ~536.69 msec | every 32768th epoch |
16 | ~1.07 sec | every 65536th epoch |
17 | ~2.15 sec | every 131072th epoch |
18 | ~4.29 sec | every 262144th epoch |
19 | ~8.59 sec | every 524288th epoch |
20 | ~17.18 sec | every 1048576th epoch |
21 | ~34.35 sec | every 2097152th epoch |
Definition at line 190 of file Gpio.cxx.
References base::Peripheral::board(), base::GPIO_SYNCM_SCALEDOWN, and base::Board::put().
Referenced by cmd_setsyncm(), GpioWidget::setSubConfig(), and GpioWidget::sync0scaleactivated().
bool base::Gpio::unpackConfig | ( | uint32_t | mask, | |
int | gpio_nr, | |||
bool & | riseedge, | |||
bool & | falledge, | |||
bool & | throttled, | |||
bool & | extrafunc, | |||
bool & | altin | |||
) | [static] |
Retrieve attribute flags from GPIO configuration mask.
Retrieves from the GPIO configuration mask mask the bits corresponding to GPIO port gpio_nr accoding to the attributes riseedge, falledge, throttled, extrafunc and altin. For detailed description of attributes see setRocGpioConfig(). Returns false
if gpio_nr is outside range 2 to 7.
Definition at line 321 of file Gpio.cxx.
Referenced by cmd_autoped(), cmd_firepulser(), cmd_printgpio(), cmd_printstatus(), GpioWidget::getSubConfig(), and roc::BoardsVector::setBoard().
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().