Generic hardware access library
|
00001 #ifndef __VMEConfigurationSpaceHandler 00002 #define __VMEConfigurationSpaceHandler 00003 00004 #include <string> 00005 #include <vector> 00006 00007 #include "hal/VMEBusAdapterInterface.hh" 00008 #include "hal/NoSuchItemException.hh" 00009 #include "hal/IllegalOperationException.hh" 00010 #include "hal/BusAdapterException.hh" 00011 #include "hal/VMEConfigurationSpaceDevice.hh" 00012 #include "hal/VMEAddressTable.hh" 00013 #include "hal/VMEConfigurationSpaceAddressReader.hh" 00014 00015 namespace HAL { 00016 00036 class VMEConfigurationSpaceHandler { 00037 public: 00038 VMEConfigurationSpaceHandler( VMEBusAdapterInterface& busAdapter ); 00039 virtual ~VMEConfigurationSpaceHandler(); 00040 00041 void configWrite( std::string item, 00042 uint32_t slotId, 00043 uint32_t data, 00044 HalVerifyOption verifyFlag = HAL_NO_VERIFY, 00045 uint32_t offset = 0 ) const 00046 throw( NoSuchItemException, 00047 IllegalOperationException, 00048 BusAdapterException ); 00049 00050 void configRead( std::string item, 00051 uint32_t slotId, 00052 uint32_t* resultPtr, 00053 uint32_t offset = 0 ) const 00054 throw( NoSuchItemException, 00055 IllegalOperationException, 00056 BusAdapterException ); 00057 00058 bool containsVME64xModule( uint32_t slotId ) const 00059 throw( IllegalValueException ); 00060 00061 bool functionIsImplemented( uint32_t slotId, 00062 uint32_t functionId ) const; 00063 00064 std::string readSerialNumber( uint32_t slotId ) const 00065 throw( IllegalOperationException ); 00066 00067 void enableVME64xModule( uint32_t slotId ) const 00068 throw( IllegalOperationException ); 00069 00070 void disableVME64xModule( uint32_t slotId ) const 00071 throw( IllegalOperationException ); 00072 00073 bool enabled( uint32_t slotId ) const 00074 throw( IllegalOperationException ); 00075 00076 uint32_t getUserROMInterval( uint32_t slotId ) const; 00077 00081 void readROMBlock( uint32_t slotId, 00082 uint32_t startAdr, 00083 uint32_t endAdr, 00084 std::vector<unsigned char>* data ) const; 00085 00086 bool checksumOk( uint32_t slotId ) const 00087 throw( IllegalOperationException ); 00088 00089 VMEBusAdapterInterface& getBusAdapter() const; 00090 00091 private: 00092 void checkVME64xConfigSpace( uint32_t slot ) const 00093 throw( IllegalOperationException ); 00094 00095 inline uint32_t calculateOffset( uint32_t slotId ) const; 00096 00104 void saveRead( std::string item, 00105 uint32_t slot, 00106 uint32_t* result, 00107 uint32_t offset = 0 ) const ; 00108 00116 void saveWrite( std::string item, 00117 uint32_t slot, 00118 uint32_t data, 00119 HalVerifyOption verifyFlag = HAL_NO_VERIFY, 00120 uint32_t offset = 0 ) const ; 00121 00122 VMEBusAdapterInterface& busAdapter_; 00123 VMEConfigurationSpaceDevice* vmeDevicePtr_; 00124 VMEAddressTable* configurationAddressTablePtr_; 00125 }; 00126 00127 } /* namespace HAL */ 00128 00129 #endif /* __VMEConfigurationSpaceHandler */ 00130