Generic hardware access library
|
00001 #include "VMEConfigurationSpaceHandlerTester.hh" 00002 #include <iomanip> 00003 00004 std::string HAL::VMEConfigurationSpaceHandlerTester::getName() const { 00005 return "VMEConfigurationSpaceHandlerTester"; 00006 } 00007 00008 std::string HAL::VMEConfigurationSpaceHandlerTester::getDescription() const { 00009 return "Tests of the HAL::VMEConfigurationSpaceHandler"; 00010 } 00011 00012 bool HAL::VMEConfigurationSpaceHandlerTester::execute() { 00013 00014 bool result = true; 00015 try { 00016 HAL::VME64xDummyBusAdapter busAdapter(CONFIGSPACEDEFINITIONFILE, HAL::VME64xDummyBusAdapter::VERBOSE_ON, HAL::VME64xDummyBusAdapter::MEMORY_MAP_OFF); 00017 HAL::VMEConfigurationSpaceHandler handler(busAdapter); 00018 uint32_t slotId; 00019 bool modulePresent; 00020 for ( slotId=0; slotId<MAX_NUMBER_OF_SLOTS; slotId++ ) { 00021 modulePresent = handler.containsVME64xModule( slotId ); 00022 std::cout << " Slot " << std::dec << std::setw(2) 00023 << slotId << " has VME64x module : " 00024 << modulePresent << std::endl; 00025 if ( modulePresent ) { 00026 std::string serial = handler.readSerialNumber( slotId ); 00027 std::cout << " Serial number is : " << serial << std::endl; 00028 for ( int funcId = 0; funcId < NUMBER_OF_VME64XFUNCTIONS; funcId ++ ) { 00029 if ( handler.functionIsImplemented( slotId, funcId ) ) { 00030 std::cout << " function : " << std::dec << funcId 00031 << " IS implemented" << std::endl; 00032 00033 } else { 00034 std::cout << " function : " << std::dec << funcId 00035 << " is NOT implemented" << std::endl; 00036 } 00037 } 00038 if ( (handler.checksumOk( slotId )) == false ) { 00039 std::cout << " Checksum error! " << std::endl; 00040 result = false; 00041 } else { 00042 std::cout << " Checksum is ok" << std::endl; 00043 } 00044 } 00045 } 00046 } catch( HAL::HardwareAccessException& e ) { 00047 std::cout << "Unexpected exception: " << std::endl; 00048 std::cout << e.what() << std::endl; 00049 result = false; 00050 } 00051 return result; 00052 }