#include <RodModule.h>
Collaboration diagram for SctPixelRod::RodModule:
Public Member Functions | |
RodModule (unsigned long baseAddr, unsigned long mapSize, VmeInterface &ourInterface, long numSlaves) throw (RodException&, VmeException &) | |
unsigned long | getBaseAddress () |
long | getSlot () const |
unsigned long | getSerialNumber () |
unsigned long | getRevision () |
void | setNumSlaves (long numSlaves) |
long | getNumSlaves () const |
void | setFinBufferSize (long finBufferSize) |
long | getFinBufferSize () const |
std::string | getMasterImageName () |
std::string | getslaveIpramName (long slaveNum) |
std::string | getslaveIdramName (long slaveNum) |
std::string | getslaveExtName (long slaveNum) |
unsigned long | getVmeCommandRegVal (long regNum) |
VmePort * | getVmePort () |
void | setBoc (BocCard *myBoc) |
BocCard * | getBocCard () |
void | setOutList (RodOutList *outList) |
RodOutList * | getOutList () |
PrimState | getPrimState () |
TextBuffState | getTextState () |
long | getMode () |
long | getOverwrite () |
long | getOverflow () |
long | getWrap () |
TEXT_BUFFER_TYPE | getTextBufferType () |
void | initialize () |
void | initialize (bool resetFlag) throw (RodException &, VmeException &) |
void | reset () throw (RodException&, VmeException &) |
void | status () throw () |
bool | verify () throw () |
void | initSlaveDsp (const std::string &ipramFile, const std::string &idramFile, const std::string &extFile, const long slaveNumber, char opt='n') throw (RodException&, NoImageFile&, VmeException &) |
void | loadSlaveImage (const std::string &filename, const unsigned long address, const long slaveNumber, char opt='n') throw (NoImageFile &, RodException &, VmeException &) |
void | startSlave (const long slaveNumber, char mode='s') throw (RodException &, VmeException &) |
void | synchSendPrim (RodPrimitive &prim) throw (RodException &, VmeException &) |
void | sendPrimList (RodPrimList *l) throw (PrimListException &, VmeException &) |
PrimState | primHandler () throw (RodException &, VmeException &) |
bool | getDspAck () |
Get DspAck bit. | |
void | setInListReady () |
Set InListReady bit. | |
void | deleteOutList () throw () |
Delete reply buffer object. | |
long | getAllTextBuffBits () |
TextBuffState | textHandler () throw (VmeException &) |
void | getTextBuffer (char *buffer, long &length, TEXT_BUFFER_TYPE &type) throw () |
void | clearTextBuffer () throw () |
unsigned long | readRodStatusReg (long regNumber) |
Inline method to read one ROD Status Register via HPI. | |
unsigned long | readRodCommandReg (long regNumber) |
Inline method to read one ROD Command Register via HPI. | |
bool | readRodStatusBit (long regNumber, long bitNumber) |
Inline method to read one ROD Status Register Bit via HPI. | |
void | setVmeCommandRegBit (const long bitNumber) |
Inline method to set VmeCommand Register Bit. | |
void | clearVmeCommandRegBit (const long bitNumber) |
Inline method to clear VmeCommand Register Bit. | |
void | hpiLoad (const unsigned long hpiReg, const unsigned long hpiValue) throw (VmeException &) |
unsigned long | hpiFetch (const unsigned long hpiReg) throw (VmeException &) |
unsigned long | mdspSingleRead (const unsigned long dspAddr) throw (VmeException &) |
void | mdspSingleWrite (unsigned long dspAddr, unsigned long buffer) throw (VmeException &) |
void | mdspBlockRead (const unsigned long dspAddr, unsigned long *buffer, long wordCount, HpidMode mode=DYNAMIC) throw (HpiException &, VmeException &) |
void | mdspBlockWrite (const unsigned long dspAddr, unsigned long *buffer, long wordCount, HpidMode mode=DYNAMIC) throw (HpiException &, VmeException &) |
void | mdspBlockDump (const unsigned long firstAddress, const unsigned long lastAddress, const std::string &fileName) throw (RodException &, VmeException &) |
void | slvHpiLoad (unsigned long hpiReg, unsigned long hpiValue, long slaveNum) throw (VmeException &) |
unsigned long | slvHpiFetch (unsigned long hpiReg, long slaveNum) throw (VmeException &) |
unsigned long | slvSingleRead (unsigned long dspAddr, long slaveNum) throw (VmeException &) |
void | slvSingleWrite (unsigned long dspAddr, unsigned long buffer, long slaveNum) throw (VmeException &) |
void | slvBlockRead (const unsigned long dspAddr, unsigned long buffer[], const long wordCount, long slaveNum, HpidMode mode=DYNAMIC) throw (HpiException &, VmeException &) |
void | slvBlockWrite (unsigned long dspAddr, unsigned long buffer[], const long wordCount, long slaveNum, HpidMode mode=DYNAMIC) throw (HpiException &, VmeException &) |
void | resetMasterDsp () throw (RodException &, VmeException &) |
void | resetSlaveDsp (long slaveNumber) throw (RodException &, VmeException &) |
void | resetAllDsps () throw (RodException &, VmeException &) |
void | chipEraseHpi () throw (VmeException &) |
void | sectorErase (unsigned long sectorBaseAddress) throw (RodException &, VmeException &) |
void | writeByteToFlash (unsigned long address, UINT8 data) throw (RodException &, VmeException &) |
void | writeBlockToFlash (unsigned long address, UINT8 *data, unsigned long numBytes) throw (RodException &, VmeException &) |
void | writeBlockToFlashHpi (unsigned long address, UINT8 *data, unsigned long numBytes) throw (RodException &, VmeException &) |
UINT8 | readByteFromFlash (unsigned long address, long updateAddress) throw (RodException &, VmeException &) |
void | vmeWriteElementFlash (UINT8 value, unsigned long address, long handshakeBit) throw (RodException &, VmeException &) |
void | readBlockFromFlash (unsigned long address, UINT8 *buffer, unsigned long numBytes) throw (RodException &, VmeException &) |
void | commonEraseCommands (unsigned long flashBaseAddr) throw (RodException &, VmeException &) |
void | commonEraseCommandsHpi (unsigned long flashBaseAddr) throw (VmeException &) |
unsigned long | getFlashSectorSize () |
void | sleep (const double milliSecs) |
unsigned long | checkSum (const unsigned long *sourceArray, const long wordCount) |
unsigned long | endianReverse32 (const unsigned long inVal) |
Private Member Functions | |
RodModule (const RodModule &rhs) | |
RodModule & | operator= (const RodModule &rhs) |
void | setBit (unsigned long *var, long bitNumber) |
inline bit manipulation functions | |
void | clearBit (unsigned long *var, long bitNumber) |
bool | readBit (unsigned long var, long bitNumber) |
Private Attributes | |
long | m_slot |
Slot number in VME crate. | |
unsigned long | m_serialNumber |
Board serial number (read during init, dummy valued loaded by constructor. | |
unsigned long | m_revision |
Board vesion (read during init, dummy value loaded by constructor). | |
VmePort * | m_myVmePort |
VME Port handle. | |
long | m_numSlaves |
Number of slave DSPs on this ROD. | |
long | m_finBufferSize |
Size of file input buffer, in bytes. Default=4096 bytes, probably good enough. | |
std::string | m_masterImageName |
string holding name of master image file | |
std::string | m_slaveIpramName [4] |
string array holding names of slave IPRAM image files | |
std::string | m_slaveIdramName [4] |
string array holding names of slave IDRAM image files | |
std::string | m_slaveExtName [4] |
string array holding names of slave external image files | |
unsigned long | m_vmeCommandReg [2] |
Cached copy of VME command registers and ROD status registers. | |
unsigned long | m_rodStatusReg [3] |
RodOutList * | m_myOutList |
A pointer to the array holding a reply buffer from a PrimList. | |
PrimState | m_myPrimState |
State variable for sending primitive lists. | |
TextBuffState | m_myTextState |
State variable for reading text buffers. | |
TEXT_BUFFER_TYPE | m_textType |
Text buffer type. | |
TXTBUFFER | m_txtBuffer |
A struct holding text buffer info from txtbuffer.h. | |
char | m_textData [TEXT_BUFF_SIZE] |
A local buffer to hold the text data. | |
unsigned long * | m_textBuff [N_TXT_BUFFS] |
Array of pointers to the text buffers in MasterDSP space. | |
BocCard * | m_myBoc |
BocCard handle. |
This is the implementation of a ROD class derived from the VmeModules base class It should be the sole interface for VME communication with the ROD modules.
Definition at line 123 of file RodModule.h.
|
checkSum() calculates a bit-wise XOR checksum on an array Definition at line 1712 of file RodModule.cxx. |
|
chipEraseHpi(VmeException &) erases the master program flash memory chip. Definition at line 1346 of file RodModule.cxx. |
|
clearTextBuffer() clears a text buffer so it can be reused. Definition at line 821 of file RodModule.cxx. Referenced by SctApi::CrateImpl::doTextBuffer(), and SctApi::CrateImpl::getRodMessage(). |
|
Inline method to clear VmeCommand Register Bit.
Definition at line 317 of file RodModule.h. References m_vmeCommandReg, and mdspSingleWrite(). Referenced by SctApi::CrateImpl::primListControl(). |
Here is the call graph for this function:
|
commonEraseCommands() implements common erase commands for the FPGA flash. Definition at line 1623 of file RodModule.cxx. |
|
commonEraseCommandsHpi() implements common erase commands for the master program flash. Definition at line 1649 of file RodModule.cxx. |
|
Delete reply buffer object.
Definition at line 731 of file RodModule.cxx. Referenced by SctApi::CrateImpl::getResponse(), and SctApi::CrateImpl::sendPrimList(). |
|
endianReverse32( reverses the endian-ness of a 32 bit value Definition at line 1724 of file RodModule.cxx. |
|
getAllTextBuffBits() reads all four text_buffer_not_empty bits at once, do if checkAllTextBuffs returns a TRUE value. Definition at line 263 of file RodModule.h. References readRodStatusReg(). |
Here is the call graph for this function:
|
Get DspAck bit.
Definition at line 252 of file RodModule.h. References readRodStatusBit(). |
Here is the call graph for this function:
|
getFlashSectorSize() test the board revision and returns the correct value for the flash sector size. Definition at line 1681 of file RodModule.cxx. References m_revision. |
|
getTextBuffer() reads a complete text buffer into destBuffer. Buffnumber is 0 for ERR buffer, 1 for INFO buffer, 2 for DIAG buffer, and 3 for the XFER buffer. This function should be called only if checkAllTextBits shows the corresponding bit set in Status Register 0. Definition at line 809 of file RodModule.cxx. Referenced by SctApi::CrateImpl::doTextBuffer(), and SctApi::CrateImpl::getRodMessage(). |
|
hpiFetch() fetches a 32-bit value from one of the HPI registers. Although the HPI has a 16-bit data path, we use a 32-bit VME access, with the ROD firmware doing the necessary conversion. Definition at line 839 of file RodModule.cxx. |
|
hpiLoad() loads a 32-bit value into the HPIA or HPID register. Although the HPI has a 16-bit data path, we use a 32-bit VME access and the word is broken into two 16-bit values in the ROD firmware. Definition at line 830 of file RodModule.cxx. |
|
initialize() performs all actions necessary to place a properly loaded ROD in its initialized state, except for initializing the slave DSPs. This must be done separately using initSlaveDsp(). Activities: Reset the ROD Read ROD serial number Load 0x000l000l into Master DSP HPIC register. (Says low order 16-bit word comes first) Read back HPIC to verify Retrieve pointers to text buffer structs Initialize PrimList and TextBuff state variables Definition at line 192 of file RodModule.cxx. Referenced by SctApi::CrateImpl::initialiseRod(). |
|
initSlaveDsp() initializes a given slave DSP. Activities:
Definition at line 417 of file RodModule.cxx. Referenced by SctApi::CrateImpl::initialiseRod(). |
|
loadSlaveImage() reads a binary file from disk and loads it into the slave memory space at the specified location. Usually, the optional last argument should be omitted. Definition at line 462 of file RodModule.cxx. |
|
mdspBlockDump() reads a block of MDSP memory and write it to a binary file (debug use only) Definition at line 1034 of file RodModule.cxx. |
|
mdspBlockRead() reads a block of size wordCount 32-bit words from the Master DSP SDRAM via its Host Port Interface (HPI). The present version uses a loop over single word reads instead of a block read. Referenced by SctApi::CrateImpl::mdspBlockRead(). |
|
mdspBlockWrite() writes a buffer of wordCount 32-bit words to the Master DSP SDRAM via its Host Port Interface (HPI). The present version uses a loop over single word writes instead of a block write. Referenced by SctApi::CrateImpl::mdspBlockWrite(). |
|
mdspSingleRead() reads a single 32-bit word from the Master DSP SDRAM via its Host Port Interface (HPI). Definition at line 852 of file RodModule.cxx. Referenced by SctApi::CrateImpl::dspSingleRead(), readRodCommandReg(), and readRodStatusReg(). |
|
mdspSingleWrite() writes a single 32-bit word to the Master DSP SDRAM via its Host Port Interface (HPI). Definition at line 869 of file RodModule.cxx. Referenced by clearVmeCommandRegBit(), SctApi::CrateImpl::dspSingleWrite(), setVmeCommandRegBit(), and SctApi::CrateImpl::slvBlockRead(). |
|
primHandler() handles steps 2-4 in sending a primitive list to the master DSP. Its action depends on the value of the m_myPrimState state variable. Definition at line 667 of file RodModule.cxx. References SctPixelRod::RodOutList::getBody(). Referenced by SctApi::CrateImpl::awaitResponse(). |
Here is the call graph for this function:
|
readBlockFromFlash() reads a block from FPGA flash memory. Definition at line 1612 of file RodModule.cxx. |
|
readByteFromFlash( reads a byte from FPGA flash memory. Definition at line 1552 of file RodModule.cxx. |
|
Inline method to read one ROD Command Register via HPI.
Definition at line 296 of file RodModule.h. References mdspSingleRead(). Referenced by SctApi::CrateImpl::readRodCommandReg(). |
Here is the call graph for this function:
|
Inline method to read one ROD Status Register Bit via HPI.
Definition at line 303 of file RodModule.h. References readRodStatusReg(). Referenced by getDspAck(), and SctApi::CrateImpl::status(). |
Here is the call graph for this function:
|
Inline method to read one ROD Status Register via HPI.
Definition at line 289 of file RodModule.h. References mdspSingleRead(). Referenced by getAllTextBuffBits(), readRodStatusBit(), SctApi::CrateImpl::readRodStatusReg(), SctApi::CrateImpl::slvBlockRead(), and SctApi::CrateImpl::status(). |
Here is the call graph for this function:
|
reset() issues a reset signal to the ROD, clears IDRAM, resets all DSPs, and re-initializes all state variables. Definition at line 293 of file RodModule.cxx. |
|
resetAllDsps() resets all five DSPs via FPGA Control Register 2 Definition at line 1319 of file RodModule.cxx. |
|
resetMasterDsp() resets the Master DSP via FPGA Control Register 2 Definition at line 1262 of file RodModule.cxx. |
|
resetSlaveDsp() resets a slave DSP via FPGA Control Register 2 Definition at line 1291 of file RodModule.cxx. |
|
sectorErase() erases a sector of FPGA flash memory. Definition at line 1362 of file RodModule.cxx. |
|
sendPrimList() is the first of five steps in sending a primitive list to the master DSP. It writes the primitive list to the InListBuffer in SDRAM0. To send a PrimList: 1. sendPrimList(destAddr, &primBuffer) 2. Poll until DspAck = 0 using getDspAck() 3. Set InListReady bit using setInListReady() 4. poll until DspAck = 1 using getDspAck() 5. getOutList(repAddr, &repBuffer) Note: repBuffer=0 if there is no reply Buffer Definition at line 643 of file RodModule.cxx. Referenced by SctApi::CrateImpl::sendPrimList(). |
|
inline bit manipulation functions
Definition at line 495 of file RodModule.h. Referenced by setVmeCommandRegBit(). |
|
Set InListReady bit.
Definition at line 255 of file RodModule.h. References setVmeCommandRegBit(). |
Here is the call graph for this function:
|
Inline method to set VmeCommand Register Bit.
Definition at line 310 of file RodModule.h. References m_vmeCommandReg, mdspSingleWrite(), and setBit(). Referenced by SctApi::CrateImpl::primListControl(), and setInListReady(). |
Here is the call graph for this function:
|
sleep() sleeps for a given number of milliseconds, VmeException & Definition at line 1699 of file RodModule.cxx. Referenced by SctApi::CrateImpl::awaitResponse(), and SctPixelRod::BocCard::resetVpin(). |
|
slvBlockRead() reads a block of size wordCount 32-bit words from a slave DSP's SDRAM via its Host Port Interface (HPI). Endian swapping, if needed, is done in mdspBlockRead. Usually, the optional last argument should be omitted. Definition at line 1124 of file RodModule.cxx. Referenced by SctApi::CrateImpl::slvBlockRead(). |
|
slvBlockWrite() writes a buffer of wordCount 32-bit words to a slave DSP's SDRAM via its Host Port Interface (HPI). Endian swapping, if needed, is done in mdspBlockWrite. Usually, the optional last argument should be omitted. Definition at line 1192 of file RodModule.cxx. Referenced by SctApi::CrateImpl::slvBlockWrite(). |
|
slvHpiFetch() fetches a 32-bit value from a slave's HPI registers. Endian swapping, if needed, is done in mdspSingleRead. Definition at line 1075 of file RodModule.cxx. |
|
slvHpiLoad() loads a 32-bit value into a slave's HPIA or HPID register. Endian swapping, if needed, is done in mdspSingleWrite. Definition at line 1064 of file RodModule.cxx. |
|
slvSingleRead() reads a single 32-bit word from the the memory space of a slave DSP. Endian swapping, if needed, is done in mdspSingleRead. Definition at line 1088 of file RodModule.cxx. Referenced by SctApi::CrateImpl::dspSingleRead(). |
|
slvSingleWrite() writes a single 32-bit word to a slave DSP SDRAM via its Host Port Interface (HPI). Endian swapping, if needed, is done in mdspSingleWrite. Definition at line 1107 of file RodModule.cxx. Referenced by SctApi::CrateImpl::dspSingleWrite(). |
|
startSlave() sends a START_SLAVE_EXECUTING primitive to start a given slave DSP. Usually, the optional last argument should be omitted. Definition at line 542 of file RodModule.cxx. |
|
status() reports the status of the ROD. For now, it simply prints to standard output. Later we will add a structured report of name=value pairs. Definition at line 382 of file RodModule.cxx. Referenced by SctApi::CrateImpl::initialiseRod(), and SctApi::CrateImpl::status(). |
|
synchSendPrim() synchronously sends a single primitive to the MDSP and handles the calls to primHandler() to finish the transfer before returning control to its calling routine. It is not the normal way to send primitives, but is useful for initialization where time criticality is not so much of a factor. The present version writes to cout. This needs to be changed. Definition at line 571 of file RodModule.cxx. References SctPixelRod::RodPrimList::bufferBuild(). |
Here is the call graph for this function:
|
textHandler() handles reading a text buffer from the rod into a RodTextBuff object. Its action depends on the value of the m_myTextState state variable.
Definition at line 739 of file RodModule.cxx. Referenced by SctApi::CrateImpl::awaitResponse(), SctApi::CrateImpl::doTextBuffer(), SctApi::CrateImpl::getRodMessage(), and SctApi::CrateImpl::initialiseRod(). |
|
verify checks the h.o. byte of the serial number register to see that it contains the hex value 'ad', which is the signature of a ROD. It returns true if this is\ the case, false otherwise. Definition at line 366 of file RodModule.cxx. |
|
vmeWriteElementFlash() does a VME write of an element to an FPGA flash. Definition at line 1584 of file RodModule.cxx. |
|
writeBlockToFlash() writes a block to FPGA flash memory. Definition at line 1447 of file RodModule.cxx. |
|
writeBlockToFlashHpi() writes a block to the master program flash memory. Definition at line 1472 of file RodModule.cxx. |
|
writeByteToFlash() writes a byte to FPGA flash memory. Definition at line 1417 of file RodModule.cxx. |
|
Size of file input buffer, in bytes. Default=4096 bytes, probably good enough.
Definition at line 524 of file RodModule.h. |
|
string holding name of master image file
Definition at line 527 of file RodModule.h. |
|
BocCard handle.
Definition at line 564 of file RodModule.h. |
|
A pointer to the array holding a reply buffer from a PrimList.
Definition at line 543 of file RodModule.h. |
|
State variable for sending primitive lists.
Definition at line 546 of file RodModule.h. |
|
State variable for reading text buffers.
Definition at line 549 of file RodModule.h. |
|
VME Port handle.
Definition at line 518 of file RodModule.h. |
|
Number of slave DSPs on this ROD.
Definition at line 521 of file RodModule.h. |
|
Board vesion (read during init, dummy value loaded by constructor).
Definition at line 515 of file RodModule.h. Referenced by getFlashSectorSize(). |
|
Board serial number (read during init, dummy valued loaded by constructor.
Definition at line 512 of file RodModule.h. |
|
string array holding names of slave external image files
Definition at line 536 of file RodModule.h. |
|
string array holding names of slave IDRAM image files
Definition at line 533 of file RodModule.h. |
|
string array holding names of slave IPRAM image files
Definition at line 530 of file RodModule.h. |
|
Slot number in VME crate.
Definition at line 509 of file RodModule.h. |
|
Array of pointers to the text buffers in MasterDSP space.
Definition at line 561 of file RodModule.h. |
|
A local buffer to hold the text data.
Definition at line 558 of file RodModule.h. |
|
Text buffer type.
Definition at line 552 of file RodModule.h. |
|
A struct holding text buffer info from txtbuffer.h.
Definition at line 555 of file RodModule.h. |
|
Cached copy of VME command registers and ROD status registers.
Definition at line 539 of file RodModule.h. Referenced by clearVmeCommandRegBit(), and setVmeCommandRegBit(). |