Generic hardware access library
HAL::AddressTableInterface Class Reference

The user interface for the AddressTable. More...

#include <AddressTableInterface.hh>

Inheritance diagram for HAL::AddressTableInterface:
HAL::AddressTable HAL::PCIAddressTable HAL::VMEAddressTable

List of all members.

Public Member Functions

virtual ~AddressTableInterface ()
virtual std::string getName () const =0
 Retrieve the name of the AddressTable.
virtual const
GeneralHardwareAddress
getGeneralHardwareAddress (std::string item) const =0 throw ( NoSuchItemException )
 Retrieve the GeneralHardwareAddress of a particular item.
virtual const
GeneralHardwareAddress
getWritableHardwareAddress (std::string item) const =0 throw (NoSuchItemException, IllegalOperationException)
 Retrieve a writable General Address of a particular item.
virtual const
GeneralHardwareAddress
getReadableHardwareAddress (std::string item) const =0 throw (NoSuchItemException, IllegalOperationException)
 Retrieve a writable General Address of a particular item.
virtual const AddressTableItemcheckItem (std::string item) const =0 throw (NoSuchItemException)
 Check if an item exists and return a reference to it.
virtual bool isReadable (std::string item) const =0 throw ( NoSuchItemException )
 Test if an item in the map is readable.
virtual bool isWritable (std::string item) const =0 throw ( NoSuchItemException )
 Test if an item in the map is writable.
virtual bool exists (std::string item) const =0
 Test if an item exists in the map.
virtual void checkAddressLimits (std::string item, uint32_t offset) const =0 throw ( NoSuchItemException, AddressOutOfLimitsException )
 Check if an item with an offset is in the limits of the address table.
virtual void checkAddressLimits (const GeneralHardwareAddress &address, uint32_t offset) const =0 throw ( AddressOutOfLimitsException )
 Check in a GeneralHardwareAddress is in the limits of the items listed in the address table.
virtual uint32_t getMask (std::string item) const =0 throw ( NoSuchItemException )
 Retrieve the Bitmap of the item.
virtual std::string getDescription (std::string item) const =0 throw ( NoSuchItemException )
 Retrieve the description of the item.
virtual bool isBit (std::string item) const =0 throw ( NoSuchItemException )
 Tests if an item is a flag.
virtual __gnu_cxx::hash_map
< std::string,
AddressTableItem *, HalHash
< std::string >
>::const_iterator 
getItemListBegin () const =0
 Provide an iterator for the map of AddressTableItems.
virtual __gnu_cxx::hash_map
< std::string,
AddressTableItem *, HalHash
< std::string >
>::const_iterator 
getItemListEnd () const =0
 Provide an iterator pointing to the end of the AddressTableItems map.
virtual void print (std::ostream &os=std::cout) const =0
 This function does what it should...
virtual uint32_t applyToMask (std::string item, uint32_t data, bool MaskBoundaryCheck=true) const =0 throw ( NoSuchItemException, MaskBoundaryException )
 Shifts data to the bitpositions defined by the item's mask.
virtual uint32_t applyFromMask (std::string item, uint32_t data, bool MaskBoundaryCheck=false) const =0 throw ( NoSuchItemException, MaskBoundaryException )
 Retrieve a value from a bitfield and convert it to a hex number.

Detailed Description

The user interface for the AddressTable.

The AddressTable contains the information about all accessible items of a hardware device. This interface summarizes all functions on the AddressTable which are technology independent. The items common to all AddressTables are :

  • The key (=name) of the item.
  • Some kind of Address. The specific properties of the Address depend on the technology (PCI or VME), but all include an address which means an offset to some kind of baseaddress, and information on how to access the item.
  • A mask for the item. This mask indicates the bitfield which refers to the item. It should be a continuous field where all bits set are next to each other. (In practice this restriction should not be problematic.)
  • A flag indicating if the item is readable.
  • A flag indicating if the item is writable.
  • A string to describe the meaning of the item.

The AddressTableInterface describes the services provided once the AddressTable is loaded into the internal data-structures of the HAL. In order to read the table itself from some medium (file, database, ...) look at the documentation of the AddressTableReader tree.

See also:
GeneralHardwareAddress, PCIHardwareAddress
VMEHardwareAddress, AddressTableReader
Author:
Christoph Schwick
Revision:
1.3
Date:
2009/04/29 10:23:07

Definition at line 57 of file AddressTableInterface.hh.


Constructor & Destructor Documentation

Definition at line 60 of file AddressTableInterface.hh.


Member Function Documentation

virtual uint32_t HAL::AddressTableInterface::applyFromMask ( std::string  item,
uint32_t  data,
bool  MaskBoundaryCheck = false 
) const throw ( NoSuchItemException, MaskBoundaryException ) [pure virtual]

Retrieve a value from a bitfield and convert it to a hex number.

Every item is associated to some bitfield in a dataword. This function is shifting a data value for a given item, which is assumed to be at the position indicated by the item-mask, in a way that the least significant bit becomes bit 0 ( and the data value of the bitfield becomes "human-readable").

Parameters:
datais the value for the item which should be shifted.
MaskBoundaryCheckis an optional parameter which allows to switch off a check that only bits within the mask are set. If checking is switched on and the routine finds data bits set outside of the mask it will issue a warning on the terminal. The check is switched of by defaults because it will be ofter the case that bits might be set outside the mask since they belong to other items.

Implemented in HAL::AddressTable.

virtual uint32_t HAL::AddressTableInterface::applyToMask ( std::string  item,
uint32_t  data,
bool  MaskBoundaryCheck = true 
) const throw ( NoSuchItemException, MaskBoundaryException ) [pure virtual]

Shifts data to the bitpositions defined by the item's mask.

Every item is usually associated to some bitfield in a dataword. This function is shifting a value for a given item into the bitfield indicated by the mask of the item.

Parameters:
datais the value for the item which should be shifted.
MaskBoundaryCheckis an optional parameter which allows to switch off a check that the data value fits into the bitfields of the mask. If checking is switched on and the user provides a value which would set bits outside of the items mask, a warning is printed on the terminal. By default checking is switched on since this usually means that the user of the method provided a wrong data value for the item.

Implemented in HAL::AddressTable.

virtual void HAL::AddressTableInterface::checkAddressLimits ( std::string  item,
uint32_t  offset 
) const throw ( NoSuchItemException, AddressOutOfLimitsException ) [pure virtual]

Check if an item with an offset is in the limits of the address table.

Implemented in HAL::PCIAddressTable, and HAL::VMEAddressTable.

virtual void HAL::AddressTableInterface::checkAddressLimits ( const GeneralHardwareAddress address,
uint32_t  offset 
) const throw ( AddressOutOfLimitsException ) [pure virtual]

Check in a GeneralHardwareAddress is in the limits of the items listed in the address table.

This function is used internally since it is more efficient than the equally named function with the std::string in the signature. (The lookup of the item is saved.)

Implemented in HAL::PCIAddressTable, and HAL::VMEAddressTable.

virtual const AddressTableItem& HAL::AddressTableInterface::checkItem ( std::string  item) const throw (NoSuchItemException) [pure virtual]

Check if an item exists and return a reference to it.

Exceptions:
NoSuchItemExceptionis thrown if the item does not exist.

Implemented in HAL::AddressTable.

virtual bool HAL::AddressTableInterface::exists ( std::string  item) const [pure virtual]

Test if an item exists in the map.

Implemented in HAL::AddressTable.

virtual std::string HAL::AddressTableInterface::getDescription ( std::string  item) const throw ( NoSuchItemException ) [pure virtual]

Retrieve the description of the item.

Implemented in HAL::AddressTable.

virtual const GeneralHardwareAddress& HAL::AddressTableInterface::getGeneralHardwareAddress ( std::string  item) const throw ( NoSuchItemException ) [pure virtual]

Retrieve the GeneralHardwareAddress of a particular item.

If the item is not existing an "NoSuchItemException" is thrown.

Implemented in HAL::AddressTable.

virtual __gnu_cxx::hash_map<std::string, AddressTableItem*, HalHash<std::string> >::const_iterator HAL::AddressTableInterface::getItemListBegin ( ) const [pure virtual]

Provide an iterator for the map of AddressTableItems.

This method is needed for tools which need to perform checks on all items in the table. For example a class which is configuring a VME64x module wants to check if the AMs specified in the AddressTable are consistent with the AMCAP settings in the configuration ROM. The Iterator delivered is pointing to the first element of the iterator sequence.

Implemented in HAL::AddressTable.

virtual __gnu_cxx::hash_map<std::string, AddressTableItem*, HalHash<std::string> >::const_iterator HAL::AddressTableInterface::getItemListEnd ( ) const [pure virtual]

Provide an iterator pointing to the end of the AddressTableItems map.

This iterator is needed for loops over all items of the AddressTable.

See also:
getItemListBegin()

Implemented in HAL::AddressTable.

virtual uint32_t HAL::AddressTableInterface::getMask ( std::string  item) const throw ( NoSuchItemException ) [pure virtual]

Retrieve the Bitmap of the item.

Implemented in HAL::AddressTable.

virtual std::string HAL::AddressTableInterface::getName ( ) const [pure virtual]

Retrieve the name of the AddressTable.

Implemented in HAL::AddressTable.

Retrieve a writable General Address of a particular item.

If the item is not existing an "NoSuchItemException" is thrown. If the item is not readable an "IllegalOperationException" is thrown.

Implemented in HAL::AddressTable.

Retrieve a writable General Address of a particular item.

If the item is not existing an "NoSuchItemException" is thrown. If the item is not writable an "IllegalOperationException" is thrown.

Implemented in HAL::AddressTable.

virtual bool HAL::AddressTableInterface::isBit ( std::string  item) const throw ( NoSuchItemException ) [pure virtual]

Tests if an item is a flag.

If in the mask of an item only one bit is set it is considered a flag. This is tested here.

Implemented in HAL::AddressTable.

virtual bool HAL::AddressTableInterface::isReadable ( std::string  item) const throw ( NoSuchItemException ) [pure virtual]

Test if an item in the map is readable.

Implemented in HAL::AddressTable.

virtual bool HAL::AddressTableInterface::isWritable ( std::string  item) const throw ( NoSuchItemException ) [pure virtual]

Test if an item in the map is writable.

Implemented in HAL::AddressTable.

virtual void HAL::AddressTableInterface::print ( std::ostream &  os = std::cout) const [pure virtual]

This function does what it should...

Implemented in HAL::PCIAddressTable, and HAL::VMEAddressTable.


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