#include <RodModule.h>
Inheritance diagram for SctPixelRod::RodModule:
Public Member Functions | |
RodModule (unsigned long baseAddr, unsigned long mapSize, VmeInterface &ourInterface, long numSlaves) throw (RodException&, VmeException &) | |
virtual | ~RodModule () |
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 () |
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 (VmeException &) |
void | synchSendPrim (RodPrimitive &prim) throw (RodException &, VmeException &) |
void | sendPrimList (RodPrimList *l) throw (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 (VmeException &) |
void | resetSlaveDsp (long slaveNumber) throw (VmeException &) |
void | resetAllDsps () throw (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 (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 (VmeException &) |
void | commonEraseCommands (unsigned long flashBaseAddr) throw (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 |
|
chipEraseHpi(VmeException &) erases the master program flash memory chip. |
|
Definition at line 499 of file RodModule.h. |
|
clearTextBuffer() clears a text buffer so it can be reused. |
|
Inline method to clear VmeCommand Register Bit.
Definition at line 316 of file RodModule.h. |
|
commonEraseCommands() implements common erase commands for the FPGA flash. |
|
commonEraseCommandsHpi() implements common erase commands for the master program flash. |
|
Delete reply buffer object.
|
|
endianReverse32( reverses the endian-ness of a 32 bit value |
|
getAllTextBuffBits() reads all four text_buffer_not_empty bits at once, do if checkAllTextBuffs returns a TRUE value. Definition at line 262 of file RodModule.h. References SctPixelRod::TEXT_BUFF_NOT_EMPTY. |
|
Definition at line 136 of file RodModule.h. |
|
Definition at line 152 of file RodModule.h. |
|
Get DspAck bit.
Definition at line 251 of file RodModule.h. |
|
Definition at line 143 of file RodModule.h. |
|
getFlashSectorSize() test the board revision and returns the correct value for the flash sector size. |
|
Definition at line 144 of file RodModule.h. |
|
Definition at line 158 of file RodModule.h. |
|
Definition at line 141 of file RodModule.h. |
|
Definition at line 154 of file RodModule.h. |
|
Definition at line 160 of file RodModule.h. |
|
Definition at line 159 of file RodModule.h. |
|
Definition at line 155 of file RodModule.h. References SctPixelRod::PrimState. |
|
Definition at line 139 of file RodModule.h. |
|
Definition at line 138 of file RodModule.h. |
|
Definition at line 147 of file RodModule.h. |
|
Definition at line 146 of file RodModule.h. |
|
Definition at line 145 of file RodModule.h. |
|
Definition at line 137 of file RodModule.h. |
|
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 162 of file RodModule.h. References SctPixelRod::TEXT_BUFFER_TYPE. |
|
Definition at line 156 of file RodModule.h. References SctPixelRod::TextBuffState. |
|
Definition at line 148 of file RodModule.h. |
|
Definition at line 151 of file RodModule.h. |
|
Definition at line 161 of file RodModule.h. |
|
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. |
|
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. |
|
|
|
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 Implements SctPixelRod::VmeModule. |
|
initSlaveDsp() initializes a given slave DSP. Activities:
|
|
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. |
|
mdspBlockDump() reads a block of MDSP memory and write it to a binary file (debug use only) |
|
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. |
|
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. |
|
mdspSingleRead() reads a single 32-bit word from the Master DSP SDRAM via its Host Port Interface (HPI). |
|
mdspSingleWrite() writes a single 32-bit word to the Master DSP SDRAM via its Host Port Interface (HPI). |
|
|
|
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 504 of file RodModule.h. |
|
readBlockFromFlash() reads a block from FPGA flash memory. |
|
readByteFromFlash( reads a byte from FPGA flash memory. |
|
Inline method to read one ROD Command Register via HPI.
Definition at line 295 of file RodModule.h. |
|
Inline method to read one ROD Status Register Bit via HPI.
Definition at line 302 of file RodModule.h. |
|
Inline method to read one ROD Status Register via HPI.
Definition at line 288 of file RodModule.h. |
|
reset() issues a reset signal to the ROD, clears IDRAM, resets all DSPs, and re-initializes all state variables. Implements SctPixelRod::VmeModule. |
|
resetAllDsps() resets all five DSPs via FPGA Control Register 2 |
|
resetMasterDsp() resets the Master DSP via FPGA Control Register 2 |
|
resetSlaveDsp() resets a slave DSP via FPGA Control Register 2 |
|
sectorErase() erases a sector of FPGA flash memory. |
|
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 |
|
inline bit manipulation functions
Definition at line 494 of file RodModule.h. |
|
Definition at line 142 of file RodModule.h. |
|
Set InListReady bit.
Definition at line 254 of file RodModule.h. |
|
Definition at line 140 of file RodModule.h. References numSlaves. |
|
Definition at line 153 of file RodModule.h. |
|
Inline method to set VmeCommand Register Bit.
Definition at line 309 of file RodModule.h. |
|
sleep() sleeps for a given number of milliseconds, VmeException & |
|
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. |
|
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. |
|
slvHpiFetch() fetches a 32-bit value from a slave's HPI registers. Endian swapping, if needed, is done in mdspSingleRead. |
|
slvHpiLoad() loads a 32-bit value into a slave's HPIA or HPID register. Endian swapping, if needed, is done in mdspSingleWrite. |
|
slvSingleRead() reads a single 32-bit word from the the memory space of a slave DSP. Endian swapping, if needed, is done in mdspSingleRead. |
|
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. |
|
startSlave() sends a START_SLAVE_EXECUTING primitive to start a given slave DSP. Usually, the optional last argument should be omitted. |
|
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. Implements SctPixelRod::VmeModule. |
|
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. |
|
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.
|
|
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. |
|
vmeWriteElementFlash() does a VME write of an element to an FPGA flash. |
|
writeBlockToFlash() writes a block to FPGA flash memory. |
|
writeBlockToFlashHpi() writes a block to the master program flash memory. |
|
writeByteToFlash() writes a byte to FPGA flash memory. |
|
Size of file input buffer, in bytes. Default=4096 bytes, probably good enough.
Definition at line 523 of file RodModule.h. |
|
string holding name of master image file
Definition at line 526 of file RodModule.h. |
|
BocCard handle.
Definition at line 563 of file RodModule.h. |
|
A pointer to the array holding a reply buffer from a PrimList.
Definition at line 542 of file RodModule.h. |
|
State variable for sending primitive lists.
Definition at line 545 of file RodModule.h. |
|
State variable for reading text buffers.
Definition at line 548 of file RodModule.h. |
|
VME Port handle.
Definition at line 517 of file RodModule.h. |
|
Number of slave DSPs on this ROD.
Definition at line 520 of file RodModule.h. |
|
Board vesion (read during init, dummy value loaded by constructor).
Definition at line 514 of file RodModule.h. |
|
Definition at line 539 of file RodModule.h. |
|
Board serial number (read during init, dummy valued loaded by constructor.
Definition at line 511 of file RodModule.h. |
|
string array holding names of slave external image files
Definition at line 535 of file RodModule.h. |
|
string array holding names of slave IDRAM image files
Definition at line 532 of file RodModule.h. |
|
string array holding names of slave IPRAM image files
Definition at line 529 of file RodModule.h. |
|
Slot number in VME crate.
Definition at line 508 of file RodModule.h. |
|
Array of pointers to the text buffers in MasterDSP space.
Definition at line 560 of file RodModule.h. |
|
A local buffer to hold the text data.
Definition at line 557 of file RodModule.h. |
|
Text buffer type.
Definition at line 551 of file RodModule.h. |
|
A struct holding text buffer info from txtbuffer.h.
Definition at line 554 of file RodModule.h. |
|
Cached copy of VME command registers and ROD status registers.
Definition at line 538 of file RodModule.h. |