Library of Bus-Adapters
HAL::PCILinuxBusAdapter Class Reference

A memory mapped PCI bus adapter for use in Linux PCs. More...

#include <PCILinuxBusAdapter.hh>

List of all members.

Public Member Functions

 PCILinuxBusAdapter () throw (HAL::BusAdapterException)
virtual ~PCILinuxBusAdapter ()
void findDeviceByVendor (uint32_t vendorID, uint32_t deviceID, uint32_t index, const PCIAddressTable &pciAddressTable, PCIDeviceIdentifier **deviceIdentifierPtr, std::vector< uint32_t > &barRegisters, bool swapFlag=false) throw ( BusAdapterException, NoSuchDeviceException )
 Registers the device with the i2ocore driver and maps it into the address space of the user program.
void findDeviceByBus (uint32_t busID, uint32_t slotID, uint32_t functionID, const PCIAddressTable &pciAddressTable, PCIDeviceIdentifier **deviceIdentifierPtr, std::vector< uint32_t > &barRegisters, bool swapFlag=false) throw ( BusAdapterException, NoSuchDeviceException )
 Registers the device with the i2ocore driver and maps it into the address space of the user program.
void closeDevice (PCIDeviceIdentifier *deviceIdentifier) throw ()
 Destroys the deviceIdentifier and releases the resources taken for the memory mapping.
void write (PCIDeviceIdentifier &device, uint32_t address, uint32_t data) throw ( BusAdapterException )
void read (PCIDeviceIdentifier &device, uint32_t address, uint32_t *result) throw ( BusAdapterException )
void configWrite (PCIDeviceIdentifier &device, uint32_t address, uint32_t data) throw ( BusAdapterException )
void configRead (PCIDeviceIdentifier &device, uint32_t address, uint32_t *result) throw ( BusAdapterException )
void writeBlock (PCIDeviceIdentifier &device, uint32_t startAddress, uint32_t length, char *buffer, HalAddressIncrement addressBehaviour=HAL_DO_INCREMENT) throw ( BusAdapterException )
void readBlock (PCIDeviceIdentifier &device, uint32_t startAddress, uint32_t length, char *buffer, HalAddressIncrement addressBehaviour=HAL_DO_INCREMENT) throw ( BusAdapterException )

Private Member Functions

void findDevice (xpci::Address &deviceConfigAddress, const PCIAddressTable &pciAddressTable, PCIDeviceIdentifier **deviceIdentifierPtr, std::vector< uint32_t > &barRegisters, bool swapFlag=false) throw ( BusAdapterException, NoSuchDeviceException )
 Common Helper funcition for the public findDeviceByXXX methods.

Private Attributes

xpci::Bus pciBus_

Detailed Description

A memory mapped PCI bus adapter for use in Linux PCs.

This class implements the PCIBusAdapterInterface using the I2O-core library developed for accessing hardware plugged into Linux PCs. The functions are described in detail in the PCIBusAdapterInterface.

This BusAdapter uses memory mapping in order to map memory space accesses to the user space. This optimizes the access time for the user.

See also:
PCIBusAdapterInterface, I2O core library documentation
Author:
Christoph Schwick
Revision:
1.1
Date:
2007/03/05 17:54:12

Definition at line 39 of file PCILinuxBusAdapter.hh.


Constructor & Destructor Documentation

HAL::PCILinuxBusAdapter::PCILinuxBusAdapter ( ) throw (HAL::BusAdapterException)

Definition at line 6 of file PCILinuxBusAdapter.cc.

Definition at line 15 of file PCILinuxBusAdapter.cc.


Member Function Documentation

void HAL::PCILinuxBusAdapter::closeDevice ( PCIDeviceIdentifier *  deviceIdentifier) throw ()

Destroys the deviceIdentifier and releases the resources taken for the memory mapping.

Definition at line 334 of file PCILinuxBusAdapter.cc.

void HAL::PCILinuxBusAdapter::configRead ( PCIDeviceIdentifier &  device,
uint32_t  address,
uint32_t *  result 
) throw ( BusAdapterException )

Definition at line 125 of file PCILinuxBusAdapter.cc.

void HAL::PCILinuxBusAdapter::configWrite ( PCIDeviceIdentifier &  device,
uint32_t  address,
uint32_t  data 
) throw ( BusAdapterException )

Definition at line 100 of file PCILinuxBusAdapter.cc.

void HAL::PCILinuxBusAdapter::findDevice ( xpci::Address &  deviceConfigAddress,
const PCIAddressTable &  pciAddressTable,
PCIDeviceIdentifier **  deviceIdentifierPtr,
std::vector< uint32_t > &  barRegisters,
bool  swapFlag = false 
) throw ( BusAdapterException, NoSuchDeviceException ) [private]

Common Helper funcition for the public findDeviceByXXX methods.

Definition at line 58 of file PCILinuxBusAdapter.cc.

void HAL::PCILinuxBusAdapter::findDeviceByBus ( uint32_t  busID,
uint32_t  slotID,
uint32_t  functionID,
const PCIAddressTable &  pciAddressTable,
PCIDeviceIdentifier **  deviceIdentifierPtr,
std::vector< uint32_t > &  barRegisters,
bool  swapFlag = false 
) throw ( BusAdapterException, NoSuchDeviceException )

Registers the device with the i2ocore driver and maps it into the address space of the user program.

The vector barRegisters which is returned by this routine contains the base addresses to be used by the user in order to access the memory reagions corresponding to the various PCI-BARs. (All this is of course automatically handled by the HAL-library.)

Parameters:
swapFlagcan be given if the device does only handle big endian accesses. (The Myrinet Lanai9 card is such an exotic card.) If this option is set to true all data accesses for this device are byte-swapped.

Definition at line 18 of file PCILinuxBusAdapter.cc.

void HAL::PCILinuxBusAdapter::findDeviceByVendor ( uint32_t  vendorID,
uint32_t  deviceID,
uint32_t  index,
const PCIAddressTable &  pciAddressTable,
PCIDeviceIdentifier **  deviceIdentifierPtr,
std::vector< uint32_t > &  barRegisters,
bool  swapFlag = false 
) throw ( BusAdapterException, NoSuchDeviceException )

Registers the device with the i2ocore driver and maps it into the address space of the user program.

The vector barRegisters which is returned by this routine contains the base addresses to be used by the user in order to access the memory reagions corresponding to the various PCI-BARs. (All this is of course automatically handled by the HAL-library.)

Parameters:
swapFlagcan be given if the device does only handle big endian accesses. (The Myrinet Lanai9 card is such an exotic card.) If this option is set to true all data accesses for this device are byte-swapped.

Definition at line 38 of file PCILinuxBusAdapter.cc.

void HAL::PCILinuxBusAdapter::read ( PCIDeviceIdentifier &  device,
uint32_t  address,
uint32_t *  result 
) throw ( BusAdapterException )

Definition at line 180 of file PCILinuxBusAdapter.cc.

void HAL::PCILinuxBusAdapter::readBlock ( PCIDeviceIdentifier &  device,
uint32_t  startAddress,
uint32_t  length,
char *  buffer,
HalAddressIncrement  addressBehaviour = HAL_DO_INCREMENT 
) throw ( BusAdapterException )

Definition at line 270 of file PCILinuxBusAdapter.cc.

void HAL::PCILinuxBusAdapter::write ( PCIDeviceIdentifier &  device,
uint32_t  address,
uint32_t  data 
) throw ( BusAdapterException )

Definition at line 151 of file PCILinuxBusAdapter.cc.

void HAL::PCILinuxBusAdapter::writeBlock ( PCIDeviceIdentifier &  device,
uint32_t  startAddress,
uint32_t  length,
char *  buffer,
HalAddressIncrement  addressBehaviour = HAL_DO_INCREMENT 
) throw ( BusAdapterException )

Definition at line 213 of file PCILinuxBusAdapter.cc.


Member Data Documentation

xpci::Bus HAL::PCILinuxBusAdapter::pciBus_ [private]

Definition at line 143 of file PCILinuxBusAdapter.hh.


The documentation for this class was generated from the following files: