Generic hardware access library
/home/cschwick/hal/generic/include/hal/VMEDevice.hh
Go to the documentation of this file.
00001 #ifndef __VMEDevice
00002 #define __VMEDevice
00003 
00004 #include <vector>
00005 
00006 #include "hal/HardwareDevice.hh"
00007 #include "hal/VMEAddressTable.hh"
00008 #include "hal/VMEBusAdapterInterface.hh"
00009 #include "hal/DeviceIdentifier.hh"
00010 #include "hal/IllegalValueException.hh"
00011 
00012 namespace HAL {
00013 
00049 class VMEDevice : public HardwareDevice {
00050 public:
00073   VMEDevice( VMEAddressTable & vmeAddressTable,
00074              VMEBusAdapterInterface & vmeBusAdapter,
00075              uint32_t baseaddress,
00076              bool doSwapping = false)
00077         throw(BusAdapterException,
00078               UnsupportedException);
00079 
00080 
00105   VMEDevice( VMEAddressTable & vmeAddressTable,
00106              VMEBusAdapterInterface & vmeBusAdapter,
00107              std::vector<uint32_t>& baseaddresses,
00108              bool doSwapping = false )
00109         throw(BusAdapterException,
00110               IllegalValueException,
00111               UnsupportedException);
00112 
00113   virtual ~VMEDevice();
00114 
00119   void hardwareWrite( const GeneralHardwareAddress& vmeAddress, 
00120                       uint32_t data,
00121                       uint32_t offset = 0 ) const
00122     throw( BusAdapterException);
00123   
00127   void hardwareRead( const GeneralHardwareAddress& vmeAddress, 
00128                      uint32_t* result,
00129                      uint32_t offset = 0 ) const 
00130     throw( BusAdapterException);
00131 
00164   void hardwareReadBlock( const GeneralHardwareAddress& vmeAddress, 
00165                           uint32_t length,
00166                           char *buffer,
00167                           HalAddressIncrement addressBehaviour = HAL_DO_INCREMENT,
00168                           uint32_t offset = 0) const
00169     throw (IllegalValueException,
00170            BusAdapterException,
00171            UnsupportedException);
00172   
00205   void hardwareWriteBlock( const GeneralHardwareAddress& vmeAddress, 
00206                            uint32_t length,
00207                            char *buffer,
00208                            HalAddressIncrement addressBehaviour = HAL_DO_INCREMENT,
00209                            uint32_t offset = 0) const
00210     throw (IllegalValueException,
00211            BusAdapterException,
00212            UnsupportedException);
00213 
00214 protected:
00215   VMEBusAdapterInterface& vmeBusAdapter;
00216   DeviceIdentifier* deviceIdentifierPtr;
00217   std::vector<uint32_t> baseaddresses_;
00218   bool doSwapping_;
00219 };
00220 
00221 } /* namespace HAL */
00222 
00223 #endif /* __VMEDevice */