#include <fvtx_connection.h>
Public Member Functions | |
fvtx_connection (std::string server, std::string thiscrate="SW") | |
~fvtx_connection () | |
bool | get_is_connected () |
void | set_verbose (size_t a) |
bool | write_enable_ro (fvtx_el element, byte initialval) |
bool | write_disable_ro (fvtx_el element, byte initialval) |
bool | write_pulse_amp (int amp, fvtx_el element) |
bool | write_pulse_module (int module, fvtx_el element) |
bool | write_pulse_config (int num, int deltabco, fvtx_el element) |
bool | write_pulse (fvtx_el element) |
bool | write_pulse_train (int num, int deltabco, byte amp, fvtx_el element) |
bool | write_latch (fvtx_el element) |
bool | write_fo_sync (fvtx_el element) |
bool | write_fpga_reset (fvtx_el element) |
bool | write_fem_lvl1_delay (byte delay, fvtx_el element) |
bool | write_bco_start (fvtx_el element) |
bool | write_batch_download (fvtx_el element) |
bool | write_eeprom_write (fvtx_el element) |
bool | write_page (fvtx_el element, byte row, byte col, byte side) |
bool | write_page_version (int version, fvtx_el element, byte row, byte col, byte side) |
bool | write_page_run (int runnumber, fvtx_el element, byte row, byte col, byte side) |
bool | write_page_time (std::string time, fvtx_el element, byte row, byte col, byte side) |
bool | test_write () |
bool | write_initpages_eeprom () |
bool | read_page (fvtx_el element, byte row, byte col, byte side) |
bool | read_page2 (fvtx_el element, byte row, byte col, byte side) |
bool | we_eeprom (byte femaddr) |
bool | wd_eeprom (byte femaddr) |
bool | erase_eeprom (byte femaddr) |
bool | unmask_chan_fphx (byte chan, fvtx_el element) |
bool | unmask_all_fphx (fvtx_el element) |
bool | mask_chan_fphx (byte chan, fvtx_el element) |
bool | mask_all_fphx (fvtx_el element) |
bool | set_threshold (size_t fem, size_t wedge, size_t chipid, size_t dac, size_t threshold) |
bool | set_threshold_all_chips (size_t fem, size_t wedge, size_t dac, size_t threshold) |
bool | reset_fphx (fvtx_el element, byte cmd=TESTBENCH_RESET) |
bool | clear_hits_fphx (fvtx_el element) |
bool | clear_bco_fphx (fvtx_el element) |
bool | calib_fphx (fvtx_el element) |
bool | send_pulse (byte amp, byte wedge, byte fem) |
bool | send_enable_ro (byte val, byte chipid, byte wedge, byte fem) |
bool | send_disable_ro (byte val, byte chipid, byte wedge, byte fem) |
bool | send_core_reset (byte chipid, byte wedge, byte fem) |
bool | send_bco_reset (byte chipid, byte wedge, byte fem) |
bool | send_lvl1_delay (byte delay) |
bool | send_fpga_reset () |
bool | send_fo_sync () |
bool | send_reset_fphx () |
bool | send_latch () |
bool | send_bco_start () |
int | start_run () |
bool | send_calib () |
bool | download () |
int | is_busy () |
bool | test_command (byte command, int data) |
int | last_fphx_command () |
int | last_fem () |
int | last_wedge () |
int | last_chipid () |
Protected Member Functions | |
void | create_packet (Packet &packet, byte command, fvtx_el element, int pkt_data) |
void | create_packet (Packet &packet, byte command, fvtx_el element, Packet pkt_data) |
int | make_fphx_cmd (fvtx_el element, byte cmd, int data) |
void | create_packet_fphx (Packet &packet, fvtx_el element, int fphx_data) |
byte | checksum (byte *data, size_t data_length) |
bool | write_bytes_to_target (Packet packet) |
bool | prog_reset_fphx (byte cmd, fvtx_el element) |
bool | write_packet (int packet_data, byte cmd, fvtx_el element) |
bool | write_packet (Packet packet_data, byte cmd, fvtx_el element) |
bool | write_fphx (byte fphx_data, byte fphx_cmd, fvtx_el element) |
bool | write_ro (fvtx_el element, byte initialval) |
void | push_int_packet (int val, Packet &packet) |
Protected Attributes | |
size_t | FPHXTB_VERBOSE |
std::string | ThisName |
ftplib * | ftp |
bool | is_connected |
std::string | ThisCrate |
byte | last_packet_cmd |
byte | last_fphx_cmd |
fvtx_el | last_element |
Class for VME connection
fvtx_connection::fvtx_connection | ( | std::string | server, | |
std::string | thiscrate = "SW" | |||
) |
Connection contructor
server | string with the VME ftp address |
fvtx_connection::~fvtx_connection | ( | ) |
Connection destructor
bool fvtx_connection::calib_fphx | ( | fvtx_el | element | ) |
Create and send the calib packet.
element | wedge and fem set |
byte fvtx_connection::checksum | ( | byte * | data, | |
size_t | data_length | |||
) | [protected] |
simple XOR checksum used in the byte packet format
data | byte array | |
data | length |
bool fvtx_connection::clear_bco_fphx | ( | fvtx_el | element | ) |
Clear bco in a chip
element | wedge, fem and chip set |
bool fvtx_connection::clear_hits_fphx | ( | fvtx_el | element | ) |
Clear hits in a chip
element | wedge, fem and chip set |
void fvtx_connection::create_packet | ( | Packet & | packet, | |
byte | command, | |||
fvtx_el | element, | |||
Packet | pkt_data | |||
) | [protected] |
This wraps all the slow control info around the word.
packet | pointer to the byte packet to be filled in | |
packet | command | |
element | fphx element | |
pkt_data | packet data |
void fvtx_connection::create_packet | ( | Packet & | packet, | |
byte | command, | |||
fvtx_el | element, | |||
int | pkt_data | |||
) | [protected] |
This wraps all the slow control info around the word.
packet | pointer to the byte packet to be filled in | |
packet | command | |
element | fphx element | |
pkt_data | packet data |
void fvtx_connection::create_packet_fphx | ( | Packet & | packet, | |
fvtx_el | element, | |||
int | fphx_data | |||
) | [protected] |
Create a packet based on a single FPHX command word. This wraps all the slow control info around the word.
packet | pointer to the byte packet to be filled in | |
element | fphx element | |
cmd | word data returned from make_fphx_cmd(fvtx_el element, byte cmd, int data) |
bool fvtx_connection::download | ( | ) |
Send data in EEPROM to FPHX chips
bool fvtx_connection::erase_eeprom | ( | byte | femaddr | ) |
Erase EPPROM of a given FEM
bool fvtx_connection::get_is_connected | ( | ) | [inline] |
Check if connection and login succeed.
int fvtx_connection::is_busy | ( | ) |
Check if VME is busy. Timeout=10 sec.
int fvtx_connection::last_chipid | ( | ) | [inline] |
Return last chipid accessed
int fvtx_connection::last_fem | ( | ) | [inline] |
Return last FEM accessed
int fvtx_connection::last_fphx_command | ( | ) | [inline] |
Return last fphx command
int fvtx_connection::last_wedge | ( | ) | [inline] |
Return last wedge accessed
int fvtx_connection::make_fphx_cmd | ( | fvtx_el | element, | |
byte | cmd, | |||
int | data | |||
) | [protected] |
Format a single 32-bit word as a FPHX command.
element | fphx element | |
cmd | command | |
data | fphx data |
bool fvtx_connection::mask_all_fphx | ( | fvtx_el | element | ) |
Mask all channels for a given chipid
element | wedge, fem and chip set |
bool fvtx_connection::mask_chan_fphx | ( | byte | chan, | |
fvtx_el | element | |||
) |
Mask a single channel for a given chipid
chan | chip channel | |
element | wedge, fem and chip set |
bool fvtx_connection::prog_reset_fphx | ( | byte | cmd, | |
fvtx_el | element | |||
) | [protected] |
Send a programmable reset, depending on the cmd used
cmd | command | |
element | wedge, fem and chip set |
void fvtx_connection::push_int_packet | ( | int | val, | |
Packet & | packet | |||
) | [protected] |
Send an integer (4 bytes) to the packet
val | integer value | |
packet | where you want to send the integer |
bool fvtx_connection::read_page | ( | fvtx_el | element, | |
byte | row, | |||
byte | col, | |||
byte | side | |||
) |
Read EPPROM and download chip
bool fvtx_connection::read_page2 | ( | fvtx_el | element, | |
byte | row, | |||
byte | col, | |||
byte | side | |||
) |
Read EEPROM and download page to chip
bool fvtx_connection::reset_fphx | ( | fvtx_el | element, | |
byte | cmd = TESTBENCH_RESET | |||
) |
Create and send a packet for the reset of the TB.
element | wedge and fem set |
bool fvtx_connection::send_calib | ( | ) |
Initiate calibration sequence.
bool fvtx_connection::set_threshold | ( | size_t | fem, | |
size_t | wedge, | |||
size_t | chipid, | |||
size_t | dac, | |||
size_t | threshold | |||
) |
Set threshold for a FPHX chip
fem | ||
wedge | ||
chipid | ||
dac | 0-7 | |
threshold | 0-255 |
bool fvtx_connection::set_threshold_all_chips | ( | size_t | fem, | |
size_t | wedge, | |||
size_t | dac, | |||
size_t | threshold | |||
) |
Set threshold for all FPHX chips in the wedge
fem | ||
wedge | ||
dac | 0-7 | |
threshold | 0-255 |
void fvtx_connection::set_verbose | ( | size_t | a | ) | [inline] |
set verbose mode
a | ![]() |
int fvtx_connection::start_run | ( | ) |
Process all necessary commands to start data aqcuisition.
bool fvtx_connection::test_command | ( | byte | command, | |
int | data | |||
) |
test command execution
command | ||
data |
bool fvtx_connection::test_write | ( | ) |
Test writting to EEPROM
bool fvtx_connection::unmask_all_fphx | ( | fvtx_el | element | ) |
Unmask all channels for a given chipid
element | wedge, fem and chip set |
bool fvtx_connection::unmask_chan_fphx | ( | byte | chan, | |
fvtx_el | element | |||
) |
Unmask a single channel for a given chipid
chan | chip channel | |
element | wedge, fem and chip set |
bool fvtx_connection::wd_eeprom | ( | byte | femaddr | ) |
Write disables the EEPROM of a given FEM
bool fvtx_connection::we_eeprom | ( | byte | femaddr | ) |
Write enables the EEPROM of a given FEM
bool fvtx_connection::write_batch_download | ( | fvtx_el | element | ) |
Send command to fetch pages from EEPROM to FPHX
element | wedge and fem set |
bool fvtx_connection::write_bco_start | ( | fvtx_el | element | ) |
Send BCO start command to the FEM_IB and the FEM
element | wedge and fem set |
bool fvtx_connection::write_bytes_to_target | ( | Packet | packet | ) | [protected] |
Write the byte packet to VME through ftp connection.
byte | packet to be sent |
bool fvtx_connection::write_disable_ro | ( | fvtx_el | element, | |
byte | initialval | |||
) |
Send a command to disable chip.
element | wedge, fem and chip set initial value (this allows the other bits in the register to be preserved, for instance) |
bool fvtx_connection::write_eeprom_write | ( | fvtx_el | element | ) |
Send EEPROM write command to the FEM
element | wedge and fem set |
bool fvtx_connection::write_enable_ro | ( | fvtx_el | element, | |
byte | initialval | |||
) |
Send a command to enable chip.
element | wedge, fem and chip set | |
initialval | initial value (this allows the other bits in the register to be preserved, for instance) |
bool fvtx_connection::write_fem_lvl1_delay | ( | byte | delay, | |
fvtx_el | element | |||
) |
Send the FEM lvl-1 delay command
delay | ||
element | wedge and fem set |
bool fvtx_connection::write_fo_sync | ( | fvtx_el | element | ) |
Send the FEM fiber opticy synch command
element | wedge and fem set |
bool fvtx_connection::write_fpga_reset | ( | fvtx_el | element | ) |
Reset for both FEM and ROC
element | wedge and fem set |
bool fvtx_connection::write_fphx | ( | byte | fphx_data, | |
byte | fphx_cmd, | |||
fvtx_el | element | |||
) | [protected] |
Write formated packet for FPHX commands
fphx_data | ||
fphx_cmd | fphx command | |
element | wedge, fem and chipid set |
bool fvtx_connection::write_initpages_eeprom | ( | ) |
Loop over all chips and write data in EEPROM
bool fvtx_connection::write_latch | ( | fvtx_el | element | ) |
Send the latch command to the FPGA(s)
element | wedge and fem set |
bool fvtx_connection::write_packet | ( | Packet | packet_data, | |
byte | cmd, | |||
fvtx_el | element | |||
) | [protected] |
Write formated data to FEM
packet_data | data byte array | |
cmd | command | |
element | wedge, fem set return Ok if operation succeed |
bool fvtx_connection::write_packet | ( | int | packet_data, | |
byte | cmd, | |||
fvtx_el | element | |||
) | [protected] |
Write formated data to FEM
packet_data | of up to 4 bytes | |
cmd | command | |
element | wedge, fem set return Ok if operation succeed |
bool fvtx_connection::write_page | ( | fvtx_el | element, | |
byte | row, | |||
byte | col, | |||
byte | side | |||
) |
Write a page in EPPROM for one chip.
element | wedge and fem set |
bool fvtx_connection::write_page_run | ( | int | runnumber, | |
fvtx_el | element, | |||
byte | row, | |||
byte | col, | |||
byte | side | |||
) |
Write a page in EPPROM for one chip using information from database
runnumber | in database | |
element | wedge and fem set |
bool fvtx_connection::write_page_time | ( | std::string | time, | |
fvtx_el | element, | |||
byte | row, | |||
byte | col, | |||
byte | side | |||
) |
Write a page in EPPROM for one chip using information from database
time | in database. Formats: 2011-11-23; Nov-23-2011; November 23, 2011; 111123; yesterday; now | |
element | wedge and fem set |
bool fvtx_connection::write_page_version | ( | int | version, | |
fvtx_el | element, | |||
byte | row, | |||
byte | col, | |||
byte | side | |||
) |
Write a page in EPPROM for one chip using information from database
version | in database | |
element | wedge and fem set |
bool fvtx_connection::write_pulse | ( | fvtx_el | element | ) |
Generate a pulse
element | wedge and fem set |
bool fvtx_connection::write_pulse_amp | ( | int | amp, | |
fvtx_el | element | |||
) |
Sets pulse amplitude.
amp | amplitude | |
element | wedge and fem set |
bool fvtx_connection::write_pulse_config | ( | int | num, | |
int | deltabco, | |||
fvtx_el | element | |||
) |
Configure pulse train
num | number of pulses | |
deltabco | spacing between pulses | |
element | wedge and fem set |
bool fvtx_connection::write_pulse_module | ( | int | module, | |
fvtx_el | element | |||
) |
Sets module that should be pulsed
module | (bits 0-2 - side, bits 4-7 = wedge location) | |
element | wedge and fem set |
bool fvtx_connection::write_pulse_train | ( | int | num, | |
int | deltabco, | |||
byte | amp, | |||
fvtx_el | element | |||
) |
Configure pulse train
num | number of pulses | |
deltabco | spacing between pulses | |
amp | amplitude | |
element | wedge and fem set |