//! A program to dump text buffers in Master DSP memory space. // It does NOT initialize the ROD!! This program is intended to be // a diagnostic used to examine buffer contents after another // program, e.g. EchoTest or LedTest, has run. #include using namespace std; #include #include "RodModule.h" #include "RodDspAddresses.h" #include "RCCVmeInterface.h" int main(int argc, char *argv[]) { using namespace SctPixelRod; const unsigned long mapSize=0xc00040; // Map size const long numSlaves=4; // Number of slaves long numWords; // Number of words to dump long dspStart; // Address limits to dump MdspMemoryMap* myMdspMap; // Pointer to MDSP memory map unsigned long txtAddress[4]; void* genPtr; char* textBuff; std::string fileName(""), option; int i, ibuf, itext; int slot = -1; unsigned long baseAddress; if (argc > 1) { for (int i=1; i> slot; while ((slot < 1) || (slot > 21)) { cout << "Slot number out or range [1:21], re-enter: "; cin >> slot; } } baseAddress = slot << 24; cout << "Number of characters to dump (decimal): "; cin >> numWords; numWords = (numWords+3)/4; // Create VME interface RCCVmeInterface *vme1 = new RCCVmeInterface(); // Create RodModule but do not initialize it RodModule* rod0 = new RodModule(baseAddress, mapSize, *vme1, numSlaves); myMdspMap = rod0->getMdspMap(); for (i = 0; i < N_TXT_BUFFS; i++) { txtAddress[i] = myMdspMap->txtBuff(i); } // get starting address and number of bytes to read for (ibuf=0; ibuf<4; ibuf++) { dspStart = txtAddress[ibuf]; // create buffer and read data unsigned long * buffer = new unsigned long[numWords]; rod0->mdspBlockRead(dspStart, buffer, numWords); // output the data and delete the buffer switch(ibuf) { case 0: cout << endl << "Hexadecimal dump of ERR buffer:" << endl; break; case 1: cout << endl << "Hexadecimal dump of INFO buffer:" << endl; break; case 2: cout << endl << "Hexadecimal dump of DIAG buffer:" << endl; break; case 4: cout << endl << "Hexadecimal dump of XFER buffer:" << endl; break; } hex(cout); cout.fill('0'); for (i=0; i(buffer); textBuff = static_cast(genPtr); switch(ibuf) { case 0: cout << endl << "ASCII dump of ERR buffer:" << endl; break; case 1: cout << endl << "ASCII dump of INFO buffer:" << endl; break; case 2: cout << endl << "ASCII dump of DIAG buffer:" << endl; break; case 4: cout << endl << "ASCII dump of XFER buffer:" << endl; break; } for (itext = 0; itext< 4*numWords; itext++) { if ((textBuff[itext]<' ') || (textBuff[itext] > '~')) textBuff[itext] = '.'; cout << textBuff[itext]; if ((itext+1)%64 == 0) cout << endl; } cout << endl; delete [] buffer; } // Clean up before exiting delete rod0; delete vme1; return 0; }