Generic hardware access library
HAL::VME64xCrate Class Reference

Browses the contents of a crate and delivers the VME-Modules contained in the crate. More...

#include <VME64xCrate.hh>

List of all members.

Classes

struct  MappedItem
 A helper structure which stores information about an occupied region of the address space. More...
class  MappedItemSorter
 A functor to sort the list of occupied address regions. More...
class  WindowSorter
 A functor to sort the list of mapped Windows. More...

Public Member Functions

 VME64xCrate (VMEBusAdapterInterface &busAdapter, AddressTableContainerInterface &addressTables, ModuleMapperInterface &moduleMapper) throw ( HardwareProblemException, IllegalValueException, UnsupportedException )
 VME64xCrate (VMEBusAdapterInterface &busAdapter, AddressTableContainerInterface &addressTableContainer, ModuleMapperInterface &moduleMapper, const StaticVMEConfiguration &staticConfiguration) throw ( HardwareProblemException, IllegalValueException, UnsupportedException )
 A constructor for a crate which also contains standard (i.e.
VMEDevicegetVMEDevice (uint32_t slotId) const throw ( IllegalOperationException, IllegalValueException, UnsupportedException, BusAdapterException, NoSuchItemException )
 Retrieve VMEDevice for a slot.
VMESlotgetVMESlot (uint32_t slotId) const throw ( IllegalValueException )
 Retrieve the VMESlot pointer for a given slot.
void printAddressMap (std::ostream &out) const
 Print out the Mapping of the crate.

Private Member Functions

void configurePlugAndPlay () throw ( IllegalValueException, UnsupportedException )
 Helper function which contains functionality needed in all constructors.
void populateWithStaticConfiguration (const StaticVMEConfiguration &staticConfiguration) throw ( IllegalValueException )
 Evaluate a static VMEConfiguration given in the Constructor.
void populateWithPlugAndPlay () throw ( IllegalValueException, UnsupportedException )
 Find all plug and play modules in the create and fill the corresponding data structures.
void getAllWindows ()
 Build a list of all mapped windows of all modules in the crate.
void mapCrate ()
 Map the address space for the whole crate.
void mapWindow (VME64xMappedWindow *windowPtr, uint32_t maxAddress, uint32_t baseMin)
 Map a Window in the address space.
bool isOccupied (uint32_t base, uint32_t space, bool bit33)
 Test if an address-region is already occupied.
void makeOccupiedList ()
 Initilize the occupied address space with the static vme configuration.
void enablePlugAndPlayModules () throw ( IllegalOperationException )
 Enable all mapped plug and play modules in the crate.

Private Attributes

bool mapped_
VMEBusAdapterInterfacebusAdapter_
AddressTableContainerInterfaceaddressTableContainer_
ModuleMapperInterfacemoduleMapper_
VMEConfigurationSpaceHandler vmeConfigSpaceHandler_
std::vector< VMESlot * > slotPtrVector_
std::list< struct MappedItem * > occupiedItemList_
std::list< VME64xMappedWindow * > windowList_
std::list< const
VME64xMappedWindow * > 
notMappedList_

Detailed Description

Browses the contents of a crate and delivers the VME-Modules contained in the crate.

This class should provide all services which are needed to configure a VME64x crate with the plug and play mechanism. The result of the configuration is a list of VMEModules which can be retrieved by the user.

See also:
Author:
Christoph Schwick
Revision:
1.1
Date:
2007/03/05 18:02:10

Definition at line 38 of file VME64xCrate.hh.


Constructor & Destructor Documentation

A constructor for a crate which also contains standard (i.e.

non "plug-and-play") VME modules.

For every standard VME module a StaticVMEConfiguration has to be provided. Plug and play modules are then mapped around these standard VME modules which typically have the address-space defined by jumpers.

During debugging this constructor can also be used to avoid the automatic configuration of a plug-and-play VME64x module.

Definition at line 30 of file VME64xCrate.cc.


Member Function Documentation

Helper function which contains functionality needed in all constructors.

Definition at line 63 of file VME64xCrate.cc.

Enable all mapped plug and play modules in the crate.

Definition at line 292 of file VME64xCrate.cc.

void HAL::VME64xCrate::getAllWindows ( ) [private]

Build a list of all mapped windows of all modules in the crate.

The resulting list is sorted in ascending order with respect to the size of the region occupied by the window.

Definition at line 161 of file VME64xCrate.cc.

Retrieve VMEDevice for a slot.

IMPORTANT: the caller of this function becomes owner of the VMEDevice and is responsible for its deletion!

Returns:
A pointer to the VMEDevice or zero if the slot is empty. It is the responsibility of the caller to check that the returned pointer is not 0 before using it.

Definition at line 88 of file VME64xCrate.cc.

HAL::VMESlot * HAL::VME64xCrate::getVMESlot ( uint32_t  slotId) const throw ( IllegalValueException )

Retrieve the VMESlot pointer for a given slot.

The VME64xCrate remains owner of the VMESlot. The VMESlot is deleted when the VME64xCrate is destroyed.

Returns:
A pointer to the VMESlot. This pointer is always valid. The user must check the contents of the Slot before using it with the function VMESlotPtr->getContents().

Definition at line 101 of file VME64xCrate.cc.

bool HAL::VME64xCrate::isOccupied ( uint32_t  base,
uint32_t  space,
bool  bit33 
) [private]

Test if an address-region is already occupied.

Figure out, if at a the address base there is enough "space" to map a window.

Compare against all occupied windows in the crate.

Definition at line 248 of file VME64xCrate.cc.

Initilize the occupied address space with the static vme configuration.

Find all configured Mapped Windows and build a list of mapped Items which contain the occupied addressSpace.

Definition at line 272 of file VME64xCrate.cc.

void HAL::VME64xCrate::mapCrate ( ) [private]

Map the address space for the whole crate.

Definition at line 183 of file VME64xCrate.cc.

void HAL::VME64xCrate::mapWindow ( HAL::VME64xMappedWindow windowPtr,
uint32_t  maxAddress,
uint32_t  baseMin 
) [private]

Map a Window in the address space.

The algorithm tries to map a window stating from the highest possible address the module can use. It assumes lazy address decoding by the VME module.

Parameters:
maxAddressis the highest address the module can possibly address (for A32 0 is used, for A24 0x1000000, for A16 0x10000).
baseMinis the lowest possible baseAddress ( usually the lowest 64kB are reserved for A16 and the lowest 16MB (without the A16 window) for A24).

Definition at line 214 of file VME64xCrate.cc.

Find all plug and play modules in the create and fill the corresponding data structures.

After this routine has run there is a VMESlot object for each possilbe slot in the crate.

Definition at line 144 of file VME64xCrate.cc.

void HAL::VME64xCrate::populateWithStaticConfiguration ( const StaticVMEConfiguration staticConfiguration) throw ( IllegalValueException ) [private]

Evaluate a static VMEConfiguration given in the Constructor.

This routine is necessary in order to allow the mapping of the crate in case there are plug-and-play VME64x and VME modules coexisting in the crate.

Definition at line 115 of file VME64xCrate.cc.

void HAL::VME64xCrate::printAddressMap ( std::ostream &  out) const

Print out the Mapping of the crate.

Definition at line 309 of file VME64xCrate.cc.


Member Data Documentation

bool HAL::VME64xCrate::mapped_ [private]

Definition at line 216 of file VME64xCrate.hh.

std::list< const VME64xMappedWindow * > HAL::VME64xCrate::notMappedList_ [private]

Definition at line 224 of file VME64xCrate.hh.

std::list< struct MappedItem * > HAL::VME64xCrate::occupiedItemList_ [private]

Definition at line 222 of file VME64xCrate.hh.

std::vector< VMESlot* > HAL::VME64xCrate::slotPtrVector_ [private]

Definition at line 221 of file VME64xCrate.hh.

Definition at line 223 of file VME64xCrate.hh.


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