#include using namespace std; #include #include "RodModule.h" #include "RodStatus.h" #include "primParams.h" #include "RCCVmeInterface.h" #include "parameters.h" using namespace SctPixelRod; int main(int argc, char *argv[]) { std::string fileName(""), option; int slot = -1; char dsp = 'M'; bool useSlave = false; unsigned long baseAddress; if (argc > 1) { for (int i=1; i 21)) { cout << "Slot number out or range [1:21] (input: " << slot << ")\n"; return 0; } break; } default: { break; } } } } // Prompt for slot number if (slot < 0 ) { cout << "Enter slot number (decimal) : "; cin >> slot; while ((slot < 1) || (slot > 21)) { cout << "Slot number out or range [1:21], re-enter: "; cin >> slot; } cout << "Master or slave (m/s) : "; cin >> dsp; } if ((dsp=='s') || (dsp=='S')) { useSlave = true; } else { useSlave = false; } baseAddress = slot << 24; // Create VME interface RCCVmeInterface *vme; try { vme = new RCCVmeInterface(); } catch (...) { std::cout << "Caught an exception when creating a VME interface." << std::endl; } // Create RodModule RodModule *rod = 0; MdspMemoryMap *mdsp = 0; SdspMemoryMap *sdsp = 0; try { rod = new RodModule(baseAddress, mapSize, *vme, numSlaves); rod->initialize(false); mdsp = rod->getMdspMap(); sdsp = rod->getSdspMap(); } catch (RodException &r) { std::cout << __FUNCTION__ << "ROD exception thrown when creating the RodModule/RodStatus objects" << std::endl << r; } catch (VmeException &v) { std::cout << __FUNCTION__ << ": VME exception thrown when creating the RodModule/RodStatus objects\n " << v << "RodModule not found on VME (wrong slot number or h/w error)!" << std::endl; } catch (...) { std::cout << __FUNCTION__ << ": Some whatever exception occured..." << std::endl; } if (useSlave) { if (sdsp) std::cout << *sdsp; } else { if (mdsp) std::cout << *mdsp; } // Delete the ROD and VME objects before exiting delete rod; delete vme; return 0; }