#include <pit_driver.h>
Public Member Functions | |
pit_driver_optinBoard & | getOptinBoard (unsigned int optinBoardNumber) |
Returns a optin board object does the bound checking inside. | |
int | executeCommand (const char *inString) |
Function to parse and execute a string command. | |
int | checkDimCommands () |
checks if there is any dim command available and if so, executes it | |
pit_driver (void) | |
~pit_driver (void) | |
bool | checkSIULink (void) |
unsigned int | readFpgaFirmwareVersion (void) |
reads and sets the control FPGA firmware version from the hardware | |
unsigned int | getFpgaFirmwareVersion (void) |
unsigned int | pitMemoryAccessTest (unsigned int blockLength, unsigned int initialAddress, unsigned int finalAddress, unsigned int repetitions, unsigned int addressIncrement=0) |
Test function to execute pit memory block write/read accesses. | |
int | refresh () |
Static Public Member Functions | |
static void | initializeWithRandom (UInt32 *dataBlock, unsigned int size) |
inializes a block of data with random numbers | |
static UInt32 | chekBitErrorsNumber (UInt32 data1, UInt32 data2, unsigned int posErrorHist[]) |
gets the number of bit errors between two arrays of 32 bit numbers | |
Public Attributes | |
pit_comm * | commFEE |
Private Member Functions | |
pit_driver_optinBoard & | getOptinBoardFromStream (stringstream &inStr) |
parses an input stream with sector, side, halfstave and returns the correspondind optinBoard | |
pit_driver_opticalLink & | getLinkFromStream (stringstream &inStr) |
parses an input stream with sector, side, halfstave and returns the correspondind optical link | |
pit_driver_foChannel & | getFoChannelFromStream (stringstream &inStr) |
parses an input stream with sector, side, halfstave, foNumber and returns the correspondind fastor channel | |
Private Attributes | |
unsigned int | fpgaFirmwareVersion |
bool | statusSIULink |
log4cpp::Category * | logDriver |
pit_driver_optinBoard * | optinBoard [NUMBER_OPTIN] |
pit_driver_procFpga * | procFPGA |
internal instance of the processing fpga | |
DimService * | serviceCmdAnswer |
Dim service to publish the answer of the generic command from PVSS name "PIT/GENERIC_CMD_RETURN" type = integer. | |
DimService * | serviceCmdStatus |
Dim service to publish the status of the general command. | |
DimCommand * | commandGenericCmd |
Dim command used to receive the PVSS command name ="PIT/GENERIC_CMD" type = *char. | |
int | cmdReturn |
internal member connected to the dim service 'serviceCmdAnswer' |
Definition at line 21 of file pit_driver.h.
pit_driver::pit_driver | ( | void | ) |
Definition at line 21 of file pit_driver.cpp.
References cmdReturn, commandGenericCmd, commFEE, GENERIC_CMD_NAME, GENERIC_CMD_SERVICE, GENERIC_CMD_STATUS_SERVICE, logDriver, NUMBER_OPTIN, optinBoard, procFPGA, readFpgaFirmwareVersion(), serviceCmdAnswer, and serviceCmdStatus.
pit_driver::~pit_driver | ( | void | ) |
Definition at line 61 of file pit_driver.cpp.
References commandGenericCmd, commFEE, logDriver, NUMBER_OPTIN, optinBoard, serviceCmdAnswer, and serviceCmdStatus.
pit_driver_optinBoard & pit_driver::getOptinBoardFromStream | ( | stringstream & | inStr | ) | [private] |
parses an input stream with sector, side, halfstave and returns the correspondind optinBoard
its used by the execute command function for the optinboard commands
Definition at line 505 of file pit_driver.cpp.
References pit_configuration::getBoardNumber(), pit_configuration::getInstance(), pit_configuration::getLinkNumber(), and getOptinBoard().
Referenced by executeCommand().
pit_driver_opticalLink & pit_driver::getLinkFromStream | ( | stringstream & | inStr | ) | [private] |
parses an input stream with sector, side, halfstave and returns the correspondind optical link
its used by the execute command function for the optinboard commands
Definition at line 483 of file pit_driver.cpp.
References pit_configuration::getBoardNumber(), pit_configuration::getInstance(), pit_configuration::getLinkNumber(), pit_driver_optinBoard::getOpticalLink(), and getOptinBoard().
Referenced by executeCommand().
pit_driver_foChannel & pit_driver::getFoChannelFromStream | ( | stringstream & | inStr | ) | [private] |
parses an input stream with sector, side, halfstave, foNumber and returns the correspondind fastor channel
its used by the execute command function for the optinboard commands
Definition at line 461 of file pit_driver.cpp.
References pit_configuration::getBoardNumber(), pit_driver_opticalLink::getFoChannel(), pit_configuration::getInstance(), pit_configuration::getLinkNumber(), pit_driver_optinBoard::getOpticalLink(), and getOptinBoard().
Referenced by executeCommand().
void pit_driver::initializeWithRandom | ( | UInt32 * | dataBlock, | |
unsigned int | size | |||
) | [static] |
inializes a block of data with random numbers
Definition at line 705 of file pit_driver.cpp.
Referenced by pitMemoryAccessTest().
static UInt32 pit_driver::chekBitErrorsNumber | ( | UInt32 | data1, | |
UInt32 | data2, | |||
unsigned int | posErrorHist[] | |||
) | [static] |
gets the number of bit errors between two arrays of 32 bit numbers
Its used int the pit_memoryAccessTest, its declared static so to be possible to be called without any object and because its not dependent on any data elements of the class
array1 | first array to compare | |
array2 | second array to compare | |
size | the number of elements to compare between both arrays | |
posErrorHistogram | array of 32 ints to histogram the distribution of the bit error position |
Referenced by pitMemoryAccessTest().
pit_driver_optinBoard & pit_driver::getOptinBoard | ( | unsigned int | optinBoardNumber | ) |
Returns a optin board object does the bound checking inside.
Definition at line 94 of file pit_driver.cpp.
References logDriver, NUMBER_OPTIN, and optinBoard.
Referenced by executeCommand(), getFoChannelFromStream(), getLinkFromStream(), and getOptinBoardFromStream().
int pit_driver::executeCommand | ( | const char * | inString | ) |
Function to parse and execute a string command.
For the moment its public so that wwe can use a command line interface but in the future can be put to private and all commands have to be acessed through the dim command
Definition at line 122 of file pit_driver.cpp.
References CDM_READ_PROC_TIMER_PERIOD, CMD_ASSIGN_CHIP_FOMASK, CMD_CHECK_BOARD_PLUGGED, CMD_CLEAR_CHIP_FOMASK, CMD_FORCE_FO_CHANNEL, CMD_LOAD_REQUIRED_CHANNELS_FILE, CMD_MEMORY_ACCESS_TEST, CMD_PROC_START_COUNTER, CMD_PROC_STOP_COUNTER, CMD_READ_ERROR_COUNTER, CMD_READ_FO_COUNTER, CMD_READ_FO_MASK, CMD_READ_LINK_DELAY, CMD_READ_LINK_PHASE, CMD_READ_MAX_FASTOR_COUNTS, CMD_READ_MIN_FASTOR_COUNTS, CMD_READ_PROC_CMD_REG, CMD_READ_PROC_COUNTER, CMD_READ_PROC_GEN_COUNTER, CMD_READ_PROC_SETTINGS_REGISTER, CMD_READ_PROC_SIGNATURE, CMD_READ_PROC_STATUS, CMD_READ_PROC_TIME_STAMP, CMD_READ_PROC_TRIGGER_MODE, CMD_READ_TIME_STAMP, CMD_READ_UDF_ENABLE, CMD_READ_WORD, CMD_REFRESH_GLOBAL_STATUS, CMD_REFRESH_LINK_STATUS, CMD_REFRESH_OPTIN_STATUS, CMD_RELEASE_FO_CHANNEL, CMD_RESET_SIU, CMD_SET_PROC_TIMER_ENABLE, CMD_STATUS_EXECUTING, CMD_STATUS_FAILED, CMD_STATUS_FINISHED, CMD_WRITE_LINK_DELAY, CMD_WRITE_MAX_FASTOR_COUNTS, CMD_WRITE_MIN_FASTOR_COUNTS, CMD_WRITE_PROC_CMD_REG, CMD_WRITE_PROC_SETTINGS_REGISTER, CMD_WRITE_PROC_SIGNATURE, CMD_WRITE_PROC_TIMER_PERIOD, CMD_WRITE_PROC_TRIGGER_MODE, CMD_WRITE_UDF_ENABLE, CMD_WRITE_WORD, cmdReturn, commFEE, pit_driver_foChannel::forceHigh(), getFoChannelFromStream(), pit_configuration::getInstance(), getLinkFromStream(), getOptinBoard(), getOptinBoardFromStream(), pit_driver_optinBoard::IsBoardPlugged(), logDriver, pit_configuration::openRequiredChannelsFile(), optinBoard, pit_comm::PITCheckCommStatus(), pitMemoryAccessTest(), pit_comm::PITReadBlock(), pit_comm::PITrorcReset(), pit_comm::PITWriteBlock(), procFPGA, pit_driver_procFpga::readCmdReg(), pit_driver_foChannel::readCounter(), pit_driver_procFpga::readCounter(), pit_driver_procFpga::readCounterInGroup(), pit_driver_opticalLink::readEnUdFastors(), pit_driver_opticalLink::readErrorCounter(), pit_driver_opticalLink::readFoMask(), pit_driver_opticalLink::readLinkDelay(), pit_driver_opticalLink::readLinkPhase(), pit_driver_optinBoard::readMaxFastorCounts(), pit_driver_optinBoard::readMinFastorCounts(), pit_driver_procFpga::readSettingRegister(), pit_driver_procFpga::readSignature(), pit_driver_procFpga::readStatusRegister(), pit_driver_procFpga::readTimerPeriod(), pit_driver_optinBoard::readTimeStamp(), pit_driver_procFpga::readTimeStamp(), pit_driver_procFpga::readTriggerMode(), pit_driver_optinBoard::refresh(), refresh(), pit_driver_opticalLink::refreshLinkStatus(), serviceCmdAnswer, serviceCmdStatus, pit_driver_foChannel::setMask(), pit_driver_procFpga::setTimerEnable(), pit_driver_procFpga::startCounter(), pit_driver_procFpga::stopCounter(), pit_driver_procFpga::writeCmdReg(), pit_driver_opticalLink::writeEnUdFastors(), pit_driver_opticalLink::writeLinkDelay(), pit_driver_optinBoard::writeMaxFastorCounts(), pit_driver_optinBoard::writeMinFastorCounts(), pit_driver_procFpga::writeSettingRegister(), pit_driver_procFpga::writeSignature(), pit_driver_procFpga::writeTimerPeriod(), and pit_driver_procFpga::writeTriggerMode().
Referenced by checkDimCommands(), and main().
int pit_driver::checkDimCommands | ( | ) |
checks if there is any dim command available and if so, executes it
Definition at line 447 of file pit_driver.cpp.
References commandGenericCmd, and executeCommand().
Referenced by main().
bool pit_driver::checkSIULink | ( | void | ) |
unsigned int pit_driver::readFpgaFirmwareVersion | ( | void | ) |
reads and sets the control FPGA firmware version from the hardware
Definition at line 85 of file pit_driver.cpp.
References commFEE, fpgaFirmwareVersion, and pit_comm::PITGetVersion().
Referenced by pit_driver().
unsigned int pit_driver::getFpgaFirmwareVersion | ( | void | ) | [inline] |
unsigned int pit_driver::pitMemoryAccessTest | ( | unsigned int | blockLength, | |
unsigned int | initialAddress, | |||
unsigned int | finalAddress, | |||
unsigned int | repetitions, | |||
unsigned int | addressIncrement = 0 | |||
) |
Test function to execute pit memory block write/read accesses.
A number of write/read cycles are executed, reading writing blocks to the pit memory, comparing returned data and counting for bit errors. It is a hardware test function
blockLength | Lenght of the data block to write and read | |
initialAddress | Initial memory address | |
finalAddress | Maximum memory address | |
addressIncrement | It loops on the entire memory region, incrementing start address by this value at each loop | |
repetitions | The full process is repeated for "repetitions" times |
Histogram of the bit errors versus bit position
Histogram of the word errors versus word position in block
Definition at line 527 of file pit_driver.cpp.
References chekBitErrorsNumber(), commFEE, initializeWithRandom(), logDriver, pit_comm::PITReadBlock(), and pit_comm::PITWriteBlock().
Referenced by executeCommand().
int pit_driver::refresh | ( | ) |
Definition at line 105 of file pit_driver.cpp.
References commFEE, logDriver, NUMBER_OPTIN, pit_comm::PITCheckCommStatus(), and statusSIULink.
Referenced by executeCommand().
unsigned int pit_driver::fpgaFirmwareVersion [private] |
Definition at line 23 of file pit_driver.h.
Referenced by getFpgaFirmwareVersion(), and readFpgaFirmwareVersion().
bool pit_driver::statusSIULink [private] |
log4cpp::Category* pit_driver::logDriver [private] |
Definition at line 25 of file pit_driver.h.
Referenced by executeCommand(), getOptinBoard(), pit_driver(), pitMemoryAccessTest(), refresh(), and ~pit_driver().
pit_driver_optinBoard* pit_driver::optinBoard[NUMBER_OPTIN] [private] |
Definition at line 27 of file pit_driver.h.
Referenced by executeCommand(), getOptinBoard(), pit_driver(), and ~pit_driver().
pit_driver_procFpga* pit_driver::procFPGA [private] |
internal instance of the processing fpga
Definition at line 30 of file pit_driver.h.
Referenced by executeCommand(), and pit_driver().
DimService* pit_driver::serviceCmdAnswer [private] |
Dim service to publish the answer of the generic command from PVSS name "PIT/GENERIC_CMD_RETURN" type = integer.
Definition at line 33 of file pit_driver.h.
Referenced by executeCommand(), pit_driver(), and ~pit_driver().
DimService* pit_driver::serviceCmdStatus [private] |
Dim service to publish the status of the general command.
It will have the status of the of the execution of the current command name ="PIT/GENERIC_CMD_STATUS" type = *char When the command is asked it will have the value "EXECUTING", if everything went ok it will have the value "FINISHED" and if it was not executed for any reaso it will have the value "FAILED"
Definition at line 39 of file pit_driver.h.
Referenced by executeCommand(), pit_driver(), and ~pit_driver().
DimCommand* pit_driver::commandGenericCmd [private] |
Dim command used to receive the PVSS command name ="PIT/GENERIC_CMD" type = *char.
Definition at line 41 of file pit_driver.h.
Referenced by checkDimCommands(), pit_driver(), and ~pit_driver().
int pit_driver::cmdReturn [private] |
internal member connected to the dim service 'serviceCmdAnswer'
Definition at line 43 of file pit_driver.h.
Referenced by executeCommand(), and pit_driver().
Definition at line 75 of file pit_driver.h.
Referenced by executeCommand(), pit_driver(), pitMemoryAccessTest(), readFpgaFirmwareVersion(), refresh(), simulate_values(), testReadMemBlock(), testReadWord(), and ~pit_driver().