Main Page | Class List | Class Members

hcalDCC::DCC Class Reference

Utility class for managing and reading out an HCAL DCC. More...

#include <DCC.hh>

List of all members.

Public Member Functions

 DCC (bool readonly=false)
 ~DCC ()
bool isReadOnly ()
void setupHAL (const std::string &lrbAddrTableFile, const std::string &ltbAddrTableFile, const std::string &log12AddrTableFile, const std::string &log123ConfAddrTableFile, const std::string &logicBoardAddrTableFile)
bool initialize (VMEBusAdapterInterface *intf, int slot, Logger &parentLogger) throw (std::exception)
bool prepareForRun (int ttcAddr, int sourceId, int monitorEventScale, bool enableSLINK) throw (hcalDCC::Exception)
bool DCC::enableSLINK ()
int readoutEvent (int maxEventBytes, void *buffer) throw (hcalDCC::Exception)
int getNextEventSize () throw (hcalDCC::Exception)
void setSpigotInUse (int nspigot, bool used)
void getFirmwareVersions (int &log1, int &log2, int &log3, int &fpga) throw (hcalDCC::Exception)
void getLRBFirmwareVersions (int &lrb0v, int &lrb1v, int &lrb2v, int &lrb3v, int &lrb4v, int &lrb5v) throw (hcalDCC::Exception)
void getLTBFirmwareVersions (int &ltb0v, int &ltb1v, int &ltb2v, int &ltb3v, int &ltb4v, int &ltb5v) throw (hcalDCC::Exception)
int getSlot () const
void updateLRBData () throw (hcalDCC::Exception)
bool getLRBMonitoring (int nLRB, int *cerr, int *uerr, int *badid, unsigned long *wc, unsigned long *blkc, unsigned long &full_over_mask)
unsigned long readItem (const std::string &name) throw (hcalDCC::Exception)
int showStatus ()
int getHTRHeaders (std::vector< unsigned long > &headers)
Logger getLogger ()
VMEAddressTable * getMainAddressMap ()
int checkRAMPages (int firstPage=0, int lastPage=0x80) throw (hcalDCC::Exception)
void resetLTB (int nLTB) throw (hcalDCC::Exception)
void writeToLTB (int nLTB, unsigned long header, std::vector< unsigned long > data, unsigned long trailer) throw (hcalDCC::Exception)
void readFromLRB (int nLTB, int channel, int &header, std::vector< int > &data, int &trailer) throw (hcalDCC::Exception)
int readFromLRB (int nLTB, int channel, unsigned long *buff) throw (hcalDCC::Exception)
void readAllLRB () throw (hcalDCC::Exception)
void setModeAllLRB (bool normal)
hcalDCC::MotherboardgetMotherboard ()
void sendFakeHTREvent (int nLTB, int eventNo) throw (hcalDCC::Exception)
void decodeLRBData (unsigned long *buffer, int size, lrbData &lrbDataStructure)
int getMask (int numberOfBits)
void disable () throw (hcalDCC::Exception)
void printLRBData (lrbData *lrbDataStructure)
hcal::VMEDeviceBundle * getMasterDevice ()


Detailed Description

Utility class for managing and reading out an HCAL DCC.

Author:
Fernando Varela (Boston University)
Revision
1.2

Date
2005/07/07 19:52:42

The HCAL Data Concentrator Card (DCC) is responsible for buffering the data which is transmitted to the central DAQ and for providing "spy" data over VME to the HCAL system. This class handles the direct VME communication with a single DCC, and can be used separately from the HCAL DAQ by compiling it with "STANDALONE" defined.

Initial configuration of the DCC is performed on the fly. The code scans the three PCI local buses on the DCC thru the Universe II VME-PCI bridge. Once a PCI device is found on a given location of a bus, it is requested to state its memory needs in terms of memory regions (Configuration, Memory, Fast Memory and IO) and their size. The DCC code handles the PCI initialization of the devices found as well as the mapping of these devices on the A32 VME Address Space. As result of this initial configuration a HAL VME address table is created. This is the so-called "master DCC address table" which is fixed as long as the physical configuration of the DCC does not change. This address table gives the base addresses of the link receiver boards (LRBs) and other parts of the DCC (such as the log1/log2 interfaces and the main logic board). The LRBs, log1/log2, and the logic board each have their own address table which gives the location of the specified setting registers within each part. Relative address maps for each of the PCI devices are then used to enable access to the different PCI memory regions.

New in revision 1.2:


Constructor & Destructor Documentation

hcalDCC::DCC::DCC bool  readonly = false  ) 
 

constructor for an uninitialized DCC

Parameters:
readonly is a boolean which tells wheather the DCC is read only or not. Default value is 0, i.e. read and write DCC

hcalDCC::DCC::~DCC  ) 
 

Default destructor


Member Function Documentation

int hcalDCC::DCC::checkRAMPages int  firstPage = 0,
int  lastPage = 0x80
throw (hcalDCC::Exception)
 

Checks the DCC RAM memory

Parameters:
firstPage first RAM page to be tested
lastPage last RAM page to be tested
Returns:
Error code. 0 if all OK.

bool hcalDCC::DCC::DCC::enableSLINK  ) 
 

Enables the SLINK

Returns:
True is successfull, false if error

void hcalDCC::DCC::decodeLRBData unsigned long *  buffer,
int  size,
lrbData lrbDataStructure
 

Decodes a buffer of integers into an event lrbData structure

Parameters:
buffer LRB raw data
size is the size of the buffer
lrbDataStructure is the resulting lrbData structure

void hcalDCC::DCC::disable  )  throw (hcalDCC::Exception)
 

clear configuration register of the logic board

void hcalDCC::DCC::getFirmwareVersions int &  log1,
int &  log2,
int &  log3,
int &  fpga
throw (hcalDCC::Exception)
 

Gets the FW revisions of log1, log2, log3 and the FPGA

Parameters:
log1 revision number of the log1
log2 revision number of the log2
log3 revision number of the log3
fpga revision number of the Xilinx

int hcalDCC::DCC::getHTRHeaders std::vector< unsigned long > &  headers  ) 
 

Diagnostic function. Gets the HTR headers from the DCC

Parameters:
headers HTR headers as read from the DCC
Returns:
error code. 0 if all OK

Logger hcalDCC::DCC::getLogger  )  [inline]
 

gets the logger

Returns:
logger in use

void hcalDCC::DCC::getLRBFirmwareVersions int &  lrb0v,
int &  lrb1v,
int &  lrb2v,
int &  lrb3v,
int &  lrb4v,
int &  lrb5v
throw (hcalDCC::Exception)
 

Gets the FW revisions of the LRBs in use

Parameters:
lrb0v revision number of the first LRB. -1 or 0xffff if LRB is not present
lrb1v revision number of the second LRB. -1 or 0xffff if LRB is not present
lrb2v revision number of the third LRB. -1 or 0xffff if LRB is not present
lrb3v revision number of the fourth LRB. -1 or 0xffff if LRB is not present
lrb4v revision number of the fifth LRB. -1 or 0xffff if LRB is not present
lrb5v revision number of the sixth LRB. -1 or 0xffff if LRB is not present

bool hcalDCC::DCC::getLRBMonitoring int  nLRB,
int *  cerr,
int *  uerr,
int *  badid,
unsigned long *  wc,
unsigned long *  blkc,
unsigned long &  full_over_mask
 

get the LRB monitoring data (return false if there is no LRB there)

Parameters:
nLRB LRB number
cerr LRB error code
uerr LRB ...
badid LRB ...
wc word count
blkc block count
full_over_mask ...
Returns:
false if there is no LRB

void hcalDCC::DCC::getLTBFirmwareVersions int &  ltb0v,
int &  ltb1v,
int &  ltb2v,
int &  ltb3v,
int &  ltb4v,
int &  ltb5v
throw (hcalDCC::Exception)
 

Gets the FW revisions of the LTBs in use

Parameters:
ltb0v revision number of the first LTB. -1 or 0xffff if LTB is not present
ltb1v revision number of the second LTB. -1 or 0xffff if LTB is not present
ltb2v revision number of the third LTB. -1 or 0xffff if LTB is not present
ltb3v revision number of the fourth LTB. -1 or 0xffff if LTB is not present
ltb4v revision number of the fifth LTB. -1 or 0xffff if LTB is not present
ltb5v revision number of the sixth LTB. -1 or 0xffff if LTB is not present

VMEAddressTable * hcalDCC::DCC::getMainAddressMap  ) 
 

returns a pointer to the main address table

Returns:
pointer to the main address map

int hcalDCC::DCC::getMask int  numberOfBits  ) 
 

Calculates the mask for a particular number of bits

Parameters:
numberOfBits is the number of bits of the mask
Returns:
Mask

hcal::VMEDeviceBundle* hcalDCC::DCC::getMasterDevice  )  [inline]
 

Gets a pointer to the HAL master VME device

Returns:
pointer to the VMEDeviceBundle for the master device

hcalDCC::Motherboard* hcalDCC::DCC::getMotherboard  )  [inline]
 

Gets a pointer to the Motherboard

Returns:
Pointer to motherboard

int hcalDCC::DCC::getNextEventSize  )  throw (hcalDCC::Exception)
 

Reads the size (in bytes) of the next event in the spy buffer

int hcalDCC::DCC::getSlot  )  const [inline]
 

get the slot

Returns:
slot number of this DCC

bool hcalDCC::DCC::initialize VMEBusAdapterInterface *  intf,
int  slot,
Logger &  parentLogger
throw (std::exception)
 

Initializes the DCC on the given bus adapter interface, slot number and logger, using the maps from setupHAL()

Parameters:
intf Pointer to a VME bus adapter interface
slot Slot number of the DCC
parentLogger is the logger in use

bool hcalDCC::DCC::isReadOnly  )  [inline]
 

Checks if we are dealing with a read-only DCC

Returns:
Flag indicating whether the DCC is read-only or not

bool hcalDCC::DCC::prepareForRun int  ttcAddr,
int  sourceId,
int  monitorEventScale,
bool  enableSLINK
throw (hcalDCC::Exception)
 

Prepare the DCC for running by setting up important parameters inside the DCC including the addresses and enabling the appropriate LRB and LTB channels (see setSpigotInUse())

Parameters:
ttcAddr Address in TTC space for this DCC
sourceId Source id to put into the common-data-format header
monitorEventScale (1/(fraction of events to load into monitor event buffers))
enableSLINK should the SLINK be enabled?

void hcalDCC::DCC::printLRBData lrbData lrbDataStructure  ) 
 

Prints out a LRB data structure

Parameters:
lrbDataStructure is the lrbData structure to be printed out

void hcalDCC::DCC::readAllLRB  )  throw (hcalDCC::Exception)
 

Finds LRBs connected to either HTR or LTB channels

int hcalDCC::DCC::readFromLRB int  nLTB,
int  channel,
unsigned long *  buff
throw (hcalDCC::Exception)
 

Read data from LRB. Gets a pointer to the LRB data (void*)

Parameters:
nLTB Number of the LRB to read data from (must be < 6)
channel LRB channel (must be < 3)
buff LRB data as a void*
Returns:
number of unsigned int words in the event (including header and trailer)

void hcalDCC::DCC::readFromLRB int  nLTB,
int  channel,
int &  header,
std::vector< int > &  data,
int &  trailer
throw (hcalDCC::Exception)
 

Read data from LRB

Parameters:
nLTB Number of the LRB to read data from (must be < 6)
channel LRB channel (must be < 3)
header data header
data array (std::vector) of 32-bit word read out
trailer data trailer

unsigned long hcalDCC::DCC::readItem const std::string &  name  )  throw (hcalDCC::Exception)
 

perform a direct read on an item in the DCC motherboard

Parameters:
name HAL item name
Returns:
value of the item. Throw exception if thre is a problem.

int hcalDCC::DCC::readoutEvent int  maxEventBytes,
void *  buffer
throw (hcalDCC::Exception)
 

Reads out the event into the given buffer

Parameters:
maxEventBytes Size of the buffer in bytes
buffer A buffer to hold the event
Returns:
Number of bytes read out

void hcalDCC::DCC::resetLTB int  nLTB  )  throw (hcalDCC::Exception)
 

Resets a given LTB

Parameters:
nLTB Number of the LTB to be reset

void hcalDCC::DCC::sendFakeHTREvent int  nLTB,
int  eventNo
throw (hcalDCC::Exception)
 

Gerenates a fake event HTR thru an LTB

Parameters:
nLTB Number of the LRB to read data from (must be < 6)
eventNo is appended to the event for offline cross-check

void hcalDCC::DCC::setModeAllLRB bool  normal  ) 
 

Set all LRBs to a given operational mode

Parameters:
normal is a flag. True means NORMAL mode, 0 means ENABLE_BURST_TRANSFER

void hcalDCC::DCC::setSpigotInUse int  nspigot,
bool  used
[inline]
 

Enable/disable a given spigot of the DCC

Parameters:
nspigot spigot number
used flag to enable or disable this particular spigot

void hcalDCC::DCC::setupHAL const std::string &  lrbAddrTableFile,
const std::string &  ltbAddrTableFile,
const std::string &  log12AddrTableFile,
const std::string &  log123ConfAddrTableFile,
const std::string &  logicBoardAddrTableFile
 

Set the address table files to be used for this DCC.

Parameters:
lrbAddrTableFile HAL map for an LRB
ltbAddrTableFile HAL map for an LTB
log12AddrTableFile HAL map for either of the log1/log2 PCI bridges
log123ConfAddrTableFile HAL map for the configuration space of any PCI bridge
logicBoardAddrTableFile HAL map for the logic board (main FPGA)

int hcalDCC::DCC::showStatus  ) 
 

Diagnostic function. Shows the DCC status

Returns:
error code. 0 if all OK

void hcalDCC::DCC::updateLRBData  )  throw (hcalDCC::Exception)
 

refresh the LRB data (consistent view)

void hcalDCC::DCC::writeToLTB int  nLTB,
unsigned long  header,
std::vector< unsigned long >  data,
unsigned long  trailer
throw (hcalDCC::Exception)
 

Write data to LTB

Parameters:
nLTB Number of the LTB to write to (must be < 6)
header data header
data array (std::vector) of 32-bit word to be written
trailer data trailer


The documentation for this class was generated from the following files:
Generated on Fri Jul 8 20:52:05 2005 for HCAL Data Concentrator Card by  doxygen 1.3.9.1