fvtx_connection Class Reference

#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

Detailed Description

Class for VME connection


Constructor & Destructor Documentation

fvtx_connection::fvtx_connection ( std::string  server,
std::string  thiscrate = "SW" 
)

Connection contructor

Parameters:
server string with the VME ftp address
fvtx_connection::~fvtx_connection (  ) 

Connection destructor


Member Function Documentation

bool fvtx_connection::calib_fphx ( fvtx_el  element  ) 

Create and send the calib packet.

Parameters:
element wedge and fem set
Returns:
Ok if operation succeed
byte fvtx_connection::checksum ( byte *  data,
size_t  data_length 
) [protected]

simple XOR checksum used in the byte packet format

Parameters:
data byte array
data length
Returns:
checksum
bool fvtx_connection::clear_bco_fphx ( fvtx_el  element  ) 

Clear bco in a chip

Parameters:
element wedge, fem and chip set
Returns:
Ok if operation succeed
bool fvtx_connection::clear_hits_fphx ( fvtx_el  element  ) 

Clear hits in a chip

Parameters:
element wedge, fem and chip set
Returns:
Ok if operation succeed
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.

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

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

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

Returns:
0=free, otherwise (last_packet_cmd << 7) | last_fphx_cmd
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.

Parameters:
element fphx element
cmd command
data fphx data
Returns:
word with the proper header/trailer and formatting
bool fvtx_connection::mask_all_fphx ( fvtx_el  element  ) 

Mask all channels for a given chipid

Parameters:
element wedge, fem and chip set
Returns:
Ok if operation succeed
bool fvtx_connection::mask_chan_fphx ( byte  chan,
fvtx_el  element 
)

Mask a single channel for a given chipid

Parameters:
chan chip channel
element wedge, fem and chip set
Returns:
Ok if operation succeed
bool fvtx_connection::prog_reset_fphx ( byte  cmd,
fvtx_el  element 
) [protected]

Send a programmable reset, depending on the cmd used

Parameters:
cmd command
element wedge, fem and chip set
Returns:
Ok if operation succeed
void fvtx_connection::push_int_packet ( int  val,
Packet &  packet 
) [protected]

Send an integer (4 bytes) to the packet

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

Parameters:
element wedge and fem set
Returns:
Ok if operation succeed
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

Parameters:
fem 
wedge 
chipid 
dac 0-7
threshold 0-255
Returns:
Ok if command succeed
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

Parameters:
fem 
wedge 
dac 0-7
threshold 0-255
Returns:
Ok if command succeed
void fvtx_connection::set_verbose ( size_t  a  )  [inline]

set verbose mode

Parameters:
a $>0$ prints all details
int fvtx_connection::start_run (  ) 

Process all necessary commands to start data aqcuisition.

Returns:
0=OK, 1=crate busy, 2=fpga reset failed, 3=fo sync failed, 4=firefigther failed, 5=dowload failed, 6=latch failed, 7=bco start failed
bool fvtx_connection::test_command ( byte  command,
int  data 
)

test command execution

Parameters:
command 
data 
Returns:
Ok if command was sent
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

Parameters:
element wedge, fem and chip set
Returns:
Ok if operation succeed
bool fvtx_connection::unmask_chan_fphx ( byte  chan,
fvtx_el  element 
)

Unmask a single channel for a given chipid

Parameters:
chan chip channel
element wedge, fem and chip set
Returns:
Ok if operation succeed
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

Parameters:
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_bco_start ( fvtx_el  element  ) 

Send BCO start command to the FEM_IB and the FEM

Parameters:
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_bytes_to_target ( Packet  packet  )  [protected]

Write the byte packet to VME through ftp connection.

Parameters:
byte packet to be sent
Returns:
OK if operation succeed
bool fvtx_connection::write_disable_ro ( fvtx_el  element,
byte  initialval 
)

Send a command to disable chip.

Parameters:
element wedge, fem and chip set initial value (this allows the other bits in the register to be preserved, for instance)
Returns:
Ok if operation succeed
bool fvtx_connection::write_eeprom_write ( fvtx_el  element  ) 

Send EEPROM write command to the FEM

Parameters:
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_enable_ro ( fvtx_el  element,
byte  initialval 
)

Send a command to enable chip.

Parameters:
element wedge, fem and chip set
initialval initial value (this allows the other bits in the register to be preserved, for instance)
Returns:
Ok if operation succeed
bool fvtx_connection::write_fem_lvl1_delay ( byte  delay,
fvtx_el  element 
)

Send the FEM lvl-1 delay command

Parameters:
delay 
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_fo_sync ( fvtx_el  element  ) 

Send the FEM fiber opticy synch command

Parameters:
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_fpga_reset ( fvtx_el  element  ) 

Reset for both FEM and ROC

Parameters:
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_fphx ( byte  fphx_data,
byte  fphx_cmd,
fvtx_el  element 
) [protected]

Write formated packet for FPHX commands

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

Parameters:
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_packet ( Packet  packet_data,
byte  cmd,
fvtx_el  element 
) [protected]

Write formated data to FEM

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

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

Parameters:
element wedge and fem set
Returns:
Ok if operation succeed
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

Parameters:
runnumber in database
element wedge and fem set
Returns:
Ok if operation succeed
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

Parameters:
time in database. Formats: 2011-11-23; Nov-23-2011; November 23, 2011; 111123; yesterday; now
element wedge and fem set
Returns:
Ok if operation succeed
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

Parameters:
version in database
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_pulse ( fvtx_el  element  ) 

Generate a pulse

Parameters:
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_pulse_amp ( int  amp,
fvtx_el  element 
)

Sets pulse amplitude.

Parameters:
amp amplitude
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_pulse_config ( int  num,
int  deltabco,
fvtx_el  element 
)

Configure pulse train

Parameters:
num number of pulses
deltabco spacing between pulses
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_pulse_module ( int  module,
fvtx_el  element 
)

Sets module that should be pulsed

Parameters:
module (bits 0-2 - side, bits 4-7 = wedge location)
element wedge and fem set
Returns:
Ok if operation succeed
bool fvtx_connection::write_pulse_train ( int  num,
int  deltabco,
byte  amp,
fvtx_el  element 
)

Configure pulse train

Parameters:
num number of pulses
deltabco spacing between pulses
amp amplitude
element wedge and fem set
Returns:
Ok if operation succeed

The documentation for this class was generated from the following file:
 All Data Structures Functions Variables

Generated by  doxygen 1.6.2