Generic hardware access library
/home/cschwick/hal/generic/include/hal/PCIBusAdapterInterface.hh
Go to the documentation of this file.
00001 #ifndef __PCIBusAdapterInterface
00002 #define __PCIBusAdapterInterface
00003 
00004 #include <vector>
00005 
00006 #include "hal/PCIDeviceIdentifier.hh"
00007 #include "hal/PCIAddressTable.hh"
00008 #include "hal/BusAdapterException.hh"
00009 #include "hal/NoSuchDeviceException.hh"
00010 #include "hal/UnsupportedException.hh"
00011 #include "hal/HardwareDeviceInterface.hh"
00012 
00013 namespace HAL {
00014 
00040 class PCIBusAdapterInterface {
00041 public :
00042 
00046   virtual ~PCIBusAdapterInterface() {};
00047 
00084   virtual void findDeviceByVendor( uint32_t vendorID, 
00085                                    uint32_t deviceID,
00086                                    uint32_t index,
00087                                    const PCIAddressTable& pciAddressTable,
00088                                    PCIDeviceIdentifier** deviceIdentifierPtr,
00089                                    std::vector<uint32_t>& barRegisters,
00090                                    bool swapFlag = false) 
00091     throw( NoSuchDeviceException,
00092            BusAdapterException ) = 0;
00126   virtual void findDeviceByBus( uint32_t busID, 
00127                                 uint32_t slotID,
00128                                 uint32_t functionID,
00129                                 const PCIAddressTable& pciAddressTable,
00130                                 PCIDeviceIdentifier** deviceIdentifierPtr,
00131                                 std::vector<uint32_t>& barRegisters,
00132                                 bool swapFlag = false )
00133     throw( BusAdapterException,
00134            NoSuchDeviceException ) = 0;
00135   
00142   virtual void closeDevice( PCIDeviceIdentifier* deviceIdentifier ) 
00143     throw( BusAdapterException ) = 0;
00144 
00151   virtual void write( PCIDeviceIdentifier& device, 
00152                       uint32_t address,
00153                       uint32_t data) 
00154     throw( BusAdapterException ) = 0;
00155 
00162   virtual void read( PCIDeviceIdentifier& device, 
00163                      uint32_t address,
00164                      uint32_t* result) 
00165     throw( BusAdapterException ) = 0;
00172   virtual void configWrite( PCIDeviceIdentifier& device, 
00173                             uint32_t address, 
00174                             uint32_t data ) 
00175     throw( BusAdapterException ) = 0;
00182   virtual void configRead( PCIDeviceIdentifier& device,
00183                            uint32_t address, 
00184                            uint32_t* result )
00185     throw( BusAdapterException ) = 0;
00186 
00209   virtual void writeBlock(  PCIDeviceIdentifier& device,
00210                             uint32_t startAddress,
00211                             uint32_t length,
00212                             char *buffer,
00213                             HalAddressIncrement addressBehaviour = HAL_DO_INCREMENT )
00214     throw( BusAdapterException,
00215            UnsupportedException ) = 0;
00238   virtual void readBlock(  PCIDeviceIdentifier& device,
00239                            uint32_t startAddress,
00240                            uint32_t length,
00241                            char *buffer,
00242                            HalAddressIncrement addressBehaviour = HAL_DO_INCREMENT )
00243   throw( BusAdapterException,
00244          UnsupportedException ) = 0;
00245 };
00246 } /* namespace HAL */
00247 
00248 #endif /* __PCIBusAdapterInterface */