Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

RegPeek.cxx

00001 
00002 // It does NOT initialize the ROD!! This program is intended to be 
00003 // a diagnostic used to examine register contents after another
00004 // program, e.g. EchoTest or LedTest, has run.
00005 
00006 #include <iostream>
00007 using namespace std;
00008 
00009 #include <ctype.h>
00010 
00011 #include "RodModule.h"
00012 #include "RodDspAddresses.h"
00013 
00014 #include "RCCVmeInterface.h"
00015 
00016 int main(int argc, char *argv[]) {
00017 
00018 using namespace SctPixelRod;
00019 
00020   const unsigned long mapSize=0xc00040;         // Map size
00021   const long numSlaves=4;                       // Number of slaves
00022   unsigned long statusVal;
00023   
00024   std::string fileName(""), option;
00025   int slot = -1;
00026   unsigned long baseAddress;
00027 
00028   if (argc > 1) {
00029     for (int i=1; i<argc; i++) {
00030       option = argv[i];
00031       if (option[0] != '-') break;
00032       switch (option[1]) {
00033         case 's': {
00034           slot = atoi(option.substr(2).c_str());
00035           break;
00036         }
00037         default: {
00038           break;
00039         }
00040       }
00041     }
00042   }
00043 
00044 // Prompt for slot number
00045   if (slot < 0 ) {
00046     cout << "Enter slot number (decimal):"; 
00047     cin >> slot;
00048     while ((slot < 1) || (slot > 21)) {
00049       cout << "Slot number out or range [1:21], re-enter: ";
00050       cin >> slot;
00051     }
00052   }
00053   baseAddress = slot << 24;
00054 
00055 // Create VME interface
00056   RCCVmeInterface *vme1 = new RCCVmeInterface();
00057   
00058 // Create RodModule but do not initialize it
00059   RodModule* rod0 = new RodModule(baseAddress, mapSize, *vme1, numSlaves);
00060     
00061     hex(cout);
00062     for (int i=0; i<3; i++) {
00063       statusVal = rod0->mdspSingleRead(STATUS_REG[i]);
00064       cout << "Status register " << i << " (hex)  = ";
00065       cout.width(8);
00066       cout << statusVal << endl;
00067     }
00068     for (int i=0; i<2; i++) {
00069       statusVal = rod0->mdspSingleRead(COMMAND_REG[i]);
00070       cout << "Command register " << i << " (hex) = ";
00071       cout.width(8);
00072       cout << statusVal << endl;
00073     }
00074     dec(cout);
00075     
00076 // Clean up before exiting
00077   delete rod0;
00078   delete vme1;
00079 
00080   return 0;  
00081 }
00082 
00083 

Generated on Thu Dec 22 20:17:07 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5