Generic hardware access library
/home/cschwick/hal/generic/include/hal/VMEBusAdapterInterface.hh
Go to the documentation of this file.
00001 #ifndef __VMEBusAdapterInterface
00002 #define __VMEBusAdapterInterface
00003 
00004 #include <string>
00005 #include <vector>
00006 
00007 #include "hal/IllegalValueException.hh"
00008 #include "hal/VMEAddressTable.hh"
00009 #include "hal/DeviceIdentifier.hh"
00010 #include "hal/BusAdapterException.hh"
00011 #include "hal/UnsupportedException.hh"
00012 #include "hal/HardwareDeviceInterface.hh"
00013 
00014 namespace HAL {
00015 
00038 class VMEBusAdapterInterface {
00039 
00040 public:
00041 
00045   virtual ~VMEBusAdapterInterface() {};
00046 
00079   virtual void openDevice( const VMEAddressTable& vmeAddressTable,
00080                            uint32_t vmeBaseaddress,
00081                            DeviceIdentifier** deviceIdentifierPtr,
00082                            uint32_t* baseAddressPtr,
00083                            bool doSwapping )
00084     throw (BusAdapterException,
00085            UnsupportedException) = 0;
00086   
00103   virtual void openDevice( const VMEAddressTable& vmeAddressTable,
00104                            std::vector<uint32_t> vmeBaseaddresses,
00105                            DeviceIdentifier** deviceIdentifierPtr,
00106                            std::vector<uint32_t>* baseAddressesPtr,
00107                            bool doSwapping )
00108     throw (BusAdapterException,
00109            UnsupportedException) {
00110     std::string text = "openDevice for VME64x modules not implemented.\n    (VMEBusAdapterInterface::openDevice)";
00111     throw (UnsupportedException( text, __FILE__, __LINE__, __FUNCTION__  ) );
00112   }
00113   
00120   virtual void closeDevice( DeviceIdentifier* deviceIdentifier )
00121     throw( BusAdapterException ) = 0;
00122 
00123   virtual void write( DeviceIdentifier* deviceIdentifierPtr,
00124                       uint32_t address,
00125                       uint32_t addressModifier,
00126                       uint32_t dataWidth,
00127                       uint32_t data)
00128     throw( IllegalValueException, BusAdapterException ) = 0;
00129 
00130   virtual void read( DeviceIdentifier* deviceIdentifierPtr,
00131                      uint32_t address,
00132                      uint32_t addressModifier,
00133                      uint32_t dataWidth,
00134                      uint32_t* result)
00135     throw( IllegalValueException, BusAdapterException ) = 0;
00136   
00152   virtual void readBlock( DeviceIdentifier* deviceIdentifierPtr,
00153                           uint32_t startAddress,
00154                           uint32_t length,      // in bytes
00155                           uint32_t addressModifier,
00156                           uint32_t dataWidth,
00157                           char *buffer,
00158                           HalAddressIncrement addressBehaviour = HAL_DO_INCREMENT )
00159     throw( UnsupportedException,
00160            BusAdapterException ) = 0;
00176   virtual void writeBlock( DeviceIdentifier* deviceIdentifierPtr,
00177                           uint32_t startAddress,
00178                           uint32_t length,      // in bytes
00179                           uint32_t addressModifier,
00180                           uint32_t dataWidth,
00181                           char *buffer,
00182                           HalAddressIncrement addressBehaviour = HAL_DO_INCREMENT )
00183     throw( UnsupportedException,
00184            BusAdapterException ) = 0;
00185 
00193   virtual void resetBus( )
00194     throw( BusAdapterException,
00195            UnsupportedException ) = 0; 
00196 };
00197 
00198 } /* namespace HAL */
00199 
00200 #endif /* __VMEBusAdapterInterface */