Generic hardware access library
/home/cschwick/hal/generic/classtester/src/common/VME64xCrateTester.cc
Go to the documentation of this file.
00001 #include "VME64xCrateTester.hh"
00002 
00003 HAL::VME64xCrateTester::VME64xCrateTester( string configSpaceDefinitionFile,
00004                                       string moduleMapperFile,
00005                                       string addressTableContainerFile )
00006   throw( HAL::IllegalValueException,
00007          HAL::NoSuchFileException,
00008          HAL::XMLProcessingException,
00009          HAL::HardwareAccessException )
00010   : busAdapter_( configSpaceDefinitionFile, 
00011                  HAL::VME64xDummyBusAdapter::VERBOSE_OFF, 
00012                  HAL::VME64xDummyBusAdapter::MEMORY_MAP_ON ),
00013     moduleMapper_(moduleMapperFile),
00014     addressTableContainer_(moduleMapper_,
00015                            addressTableContainerFile) {
00016 
00017 }
00018 
00019 bool HAL::VME64xCrateTester::execute() {
00020   bool result = true;
00021   try {
00022     HAL::VME64xCrate vmeCrate( busAdapter_,
00023                                addressTableContainer_,
00024                                moduleMapper_ );
00025     vmeCrate.printAddressMap( cout );
00026         uint32_t slotId = 0;
00027         std::cout << "try to get the device in slot 0 (tests boundary checking)" << std::endl;
00028         vmeCrate.getVMEDevice( slotId );
00029         std::cout << "a second time..." << std::endl;
00030         HAL::VMEConfigurationSpaceHandler vmeConfigHandler( busAdapter_ );
00031         HAL::ConfigCSRDumper csrDumper;
00032         csrDumper.dumpCSR( vmeConfigHandler, 6 );
00033         vmeConfigHandler.disableVME64xModule(6);
00034         vmeConfigHandler.configWrite("bitSet",6,0);
00035         HAL::VME64xCrate vmeCrate2( busAdapter_,
00036                               addressTableContainer_,
00037                               moduleMapper_ );
00038         vmeCrate2.printAddressMap( cout );
00039         csrDumper.dumpCSR( vmeConfigHandler, 6 );
00040   } catch( HAL::HardwareAccessException& e) {
00041     std::cout << "unexpected exception: test failed:" << std::endl;
00042     std::cout << e.what();
00043     result = false;
00044   }
00045   return result;
00046 }
00047 
00048 string HAL::VME64xCrateTester::getName() const {
00049   return "VME64xCrateTester";
00050 }
00051 
00052 string HAL::VME64xCrateTester::getDescription() const {
00053   return "Performs a test of the HAL::VME64xCrate";
00054 }