Public Member Functions | Static Public Member Functions | Protected Attributes

base::Gpio Class Reference

Device class with all GPIO access methods. More...

#include <Gpio.h>

Inheritance diagram for base::Gpio:
Inheritance graph
[legend]
Collaboration diagram for base::Gpio:
Collaboration graph
[legend]

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::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 * 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::BoardfBoard
 board pointer

Detailed Description

Device class with all GPIO access methods.

Definition at line 11 of file Gpio.h.


Constructor & Destructor Documentation

base::Gpio::Gpio ( base::Board board  ) 

Constructor with full addressing path information.

Sets up Gpio object with full addressing information

Parameters:
board ROC board pointer

Definition at line 17 of file Gpio.cxx.

base::Gpio::~Gpio (  )  [virtual]

Definition at line 24 of file Gpio.cxx.


Member Function Documentation

void base::Gpio::addAddrMap ( base::Board board  )  [static]
base::Board & base::Peripheral::board (  )  [inherited]
base::Board* base::Peripheral::getBoard (  )  const [inline, inherited]
int base::Gpio::getConfig ( uint32_t &  mask  ) 

Read GPIO configuration register.

Parameters:
mask read value of GPIO configuration register
Returns:
see roc::Board get/put/oper return codes
See also:
setConfig(), unpackConfig(), packConfig()

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.

Parameters:
val sync message scale down exponent
Returns:
see roc::Board get/put/oper return codes

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.

Parameters:
mask new content of the GPIO configuration register
Returns:
see roc::Board get/put/oper return codes
See also:
getConfig(), unpackConfig(), packConfig()

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.

Parameters:
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:

  • for SYNC_S0: loop-back from SYNC_M
  • for SYNC_S1: loop-back from SYNC_M
  • for AUX2: TP_in active, ROC will send AUX2 to nXYTER TESTPULSE
  • for AUX3: THR_in active, ROC will throttle when AUX3=1
altin if true, switches an AUX to an alternate input source:

  • for AUX1: PULSER_ACTIVE (test pulse generator monitor)
  • for AUX3: THROTTLE_OUT (throttle loopback)
Returns:
see roc::Board get/put/oper return codes or -1 if gpio_nr out of range.
See also:
getConfig(), setConfig(), unpackConfig(), packConfig()

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.

Parameters:
gpio_nr The number of the GPIO port

  • 1 for SYNC_M the sync message sender
  • 2 for SYNC_S0 the sync message receiver channel 0
  • 3 for SYNC_S1 the sync message receiver channel 1
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
Returns:
see roc::Board get/put/oper return codes, or -1 of gpio_nr out of range
See also:
setSyncBaud(int gpio_nr, uint32_t ratediv)
getSyncBaud(int gpio_nr, uint32_t& offset, uint32_t& odd, uint32_t& even)

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.

Parameters:
gpio_nr The number of the GPIO port

  • 1 for SYNC_M the sync message sender
  • 2 for SYNC_S0 the sync message receiver channel 0
  • 3 for SYNC_S1 the sync message receiver channel 1
ratediv rate divider factor
Returns:
see roc::Board get/put/oper return codes, or
  • -1 if gpio_nr out of range
  • -2 if ratediv too large (>511)
See also:
getSyncBaud(int gpio_nr, uint32_t ratediv)

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.

Parameters:
val sync message scale down exponent, range 0 to 21.
Returns:
see roc::Board get/put/oper return codes
Table of scale down factors and resulting periods:
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().


Field Documentation

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().


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