Library of Bus-Adapters
|
00001 #ifndef __VMEDummyBusAdapter 00002 #define __VMEDummyBusAdapter 00003 00004 #include <iostream> 00005 #include "hal/VMEBusAdapterInterface.hh" 00006 #include "hal/VMEDummyDeviceIdentifier.hh" 00007 00008 00009 namespace HAL { 00010 00029 class VMEDummyBusAdapter : public VMEBusAdapterInterface { 00030 00031 public: 00032 00048 enum VerboseMode { VERBOSE_OFF, VERBOSE_ON }; 00049 00061 enum MemoryMode { MEMORY_MAP_OFF, MEMORY_MAP_ON }; 00062 00076 VMEDummyBusAdapter( enum VerboseMode verbose = VERBOSE_ON, 00077 enum MemoryMode memoryMode = MEMORY_MAP_ON, 00078 std::ostream& os = std::cout ); 00079 00083 virtual ~VMEDummyBusAdapter(); 00084 00085 00093 void openDevice( const VMEAddressTable& VMEAddressTable, 00094 uint32_t vmeBaseaddress, 00095 DeviceIdentifier** deviceIdentifierPtr, 00096 uint32_t* baseAddressPtr, 00097 bool doSwapping = false ) 00098 throw(); 00099 00100 void openDevice( const VMEAddressTable& vmeAddressTable, 00101 std::vector<uint32_t>& vmeBaseaddresses, 00102 DeviceIdentifier** deviceIdentifierPtr, 00103 std::vector<uint32_t>* baseAddressPtr, 00104 bool doSwapping = 0) 00105 throw(); 00110 void closeDevice( DeviceIdentifier* deviceIdentifier ) 00111 throw(); 00112 00113 void write( DeviceIdentifier* deviceIdentifier, 00114 uint32_t address, 00115 uint32_t addressModifier, 00116 uint32_t dataWidth, 00117 uint32_t data) 00118 throw(); 00119 00120 void read( DeviceIdentifier* DeviceIdentifier, 00121 uint32_t address, 00122 uint32_t addressModifier, 00123 uint32_t dataWidth, 00124 uint32_t* result) 00125 throw(); 00126 00127 void writeBlock( DeviceIdentifier* deviceIdentifierPtr, 00128 uint32_t startAddress, 00129 uint32_t length, // in bytes 00130 uint32_t addressModifier, 00131 uint32_t dataWidth, 00132 char *buffer, 00133 HalAddressIncrement addressBehaviour = HAL_DO_INCREMENT ) 00134 throw(); 00135 00136 void readBlock( DeviceIdentifier* deviceIdentifierPtr, 00137 uint32_t startAddress, 00138 uint32_t length, // in bytes 00139 uint32_t addressModifier, 00140 uint32_t dataWidth, 00141 char *buffer, 00142 HalAddressIncrement addressBehaviour = HAL_DO_INCREMENT ) 00143 throw(); 00144 00145 void resetBus( ) 00146 throw(); 00147 00148 private: 00149 uint32_t doSwap( uint32_t data, uint32_t dataWidth ) const; 00150 std::ostream& os_; 00151 uint32_t deviceNumberCounter; 00152 enum VerboseMode verbose; 00153 enum MemoryMode memoryMode; 00154 }; 00155 00156 } /* namespace HAL */ 00157 00158 #endif /* __VMEDummyBusAdapter */