Library of Bus-Adapters
|
A dummy VMEBusAdapter in order to work without hardware. More...
#include <VMEDummyBusAdapter.hh>
Public Types | |
enum | VerboseMode { VERBOSE_OFF, VERBOSE_ON } |
This enumerator is used in the constructor. More... | |
enum | MemoryMode { MEMORY_MAP_OFF, MEMORY_MAP_ON } |
This enumerator is used in the constructor. More... | |
Public Member Functions | |
VMEDummyBusAdapter (enum VerboseMode verbose=VERBOSE_ON, enum MemoryMode memoryMode=MEMORY_MAP_ON, std::ostream &os=std::cout) | |
The constructor takes two arguments: | |
virtual | ~VMEDummyBusAdapter () |
There is nothing to do in the desctructor. | |
void | openDevice (const VMEAddressTable &VMEAddressTable, uint32_t vmeBaseaddress, DeviceIdentifier **deviceIdentifierPtr, uint32_t *baseAddressPtr, bool doSwapping=false) throw () |
If the VMEDummyBusAdapter was created with the memoryMode option set to true, the call scans the VMEAddressTable in order to find out how much memory has to be reserved for the dummy Hardware device. | |
void | openDevice (const VMEAddressTable &vmeAddressTable, std::vector< uint32_t > &vmeBaseaddresses, DeviceIdentifier **deviceIdentifierPtr, std::vector< uint32_t > *baseAddressPtr, bool doSwapping=0) throw () |
void | closeDevice (DeviceIdentifier *deviceIdentifier) throw () |
Here the memory regions which might have beeen reserved in the openDevice call, are deleted. | |
void | write (DeviceIdentifier *deviceIdentifier, uint32_t address, uint32_t addressModifier, uint32_t dataWidth, uint32_t data) throw () |
void | read (DeviceIdentifier *DeviceIdentifier, uint32_t address, uint32_t addressModifier, uint32_t dataWidth, uint32_t *result) throw () |
void | writeBlock (DeviceIdentifier *deviceIdentifierPtr, uint32_t startAddress, uint32_t length, uint32_t addressModifier, uint32_t dataWidth, char *buffer, HalAddressIncrement addressBehaviour=HAL_DO_INCREMENT) throw () |
void | readBlock (DeviceIdentifier *deviceIdentifierPtr, uint32_t startAddress, uint32_t length, uint32_t addressModifier, uint32_t dataWidth, char *buffer, HalAddressIncrement addressBehaviour=HAL_DO_INCREMENT) throw () |
void | resetBus () throw () |
Private Member Functions | |
uint32_t | doSwap (uint32_t data, uint32_t dataWidth) const |
Private Attributes | |
std::ostream & | os_ |
uint32_t | deviceNumberCounter |
enum VerboseMode | verbose |
enum MemoryMode | memoryMode |
A dummy VMEBusAdapter in order to work without hardware.
This BusAdapter merely serves to let you test you software without actually having hardware connected to your computer. All actions which in real life would result in read or write operations will be reported on the standard output.
Definition at line 29 of file VMEDummyBusAdapter.hh.
This enumerator is used in the constructor.
It switches the memory-mapping behaviour of the BusAdapter on or off. If switched on every address-space corresponding to a specific BAR or to the configuration space is mapped into the local memory of the host. It is then used to perform read and write operations into the mapped memory. This allows to play in a more realistic way with the device. See VerboseMode comments for a note on how to use this enumerator.
Definition at line 61 of file VMEDummyBusAdapter.hh.
This enumerator is used in the constructor.
It switches the versbose behaviour of the BusAdapter on or off. Note that the enumerator is a member of the class PCIDummyBusAdapter. So it must be used. This means that a Scope identifier is needed when calling the constructor of the class. A valid example would be:
PCIDummyBusAdapter myBa( PCIDummyBusAdapter::VERBOSE_ON, PCIDummyBusAdapter::MEMORY_MAP_OFF );
The enumerators have been put into the class in order not to contaminate the global namesapce with objects merely used for debugging purposes.
Definition at line 48 of file VMEDummyBusAdapter.hh.
HAL::VMEDummyBusAdapter::VMEDummyBusAdapter | ( | enum VerboseMode | verbose = VERBOSE_ON , |
enum MemoryMode | memoryMode = MEMORY_MAP_ON , |
||
std::ostream & | os = std::cout |
||
) |
The constructor takes two arguments:
verbose | allows you to monitor all data transfers: If set to true every action is reported on the standard output. |
memoryMode | allows you to create memory regions which fake the hardware device. For every openDevice call a memory region is created into which or from which data is transfered. With this you can write and read back data from you dummy-device. The size of the mapped region depend on the VMEAddressTable given to the openDevice call. |
Definition at line 10 of file VMEDummyBusAdapter.cc.
HAL::VMEDummyBusAdapter::~VMEDummyBusAdapter | ( | ) | [virtual] |
There is nothing to do in the desctructor.
Definition at line 23 of file VMEDummyBusAdapter.cc.
void HAL::VMEDummyBusAdapter::closeDevice | ( | DeviceIdentifier * | deviceIdentifier | ) | throw () |
Here the memory regions which might have beeen reserved in the openDevice call, are deleted.
Definition at line 161 of file VMEDummyBusAdapter.cc.
uint32_t HAL::VMEDummyBusAdapter::doSwap | ( | uint32_t | data, |
uint32_t | dataWidth | ||
) | const [private] |
Definition at line 236 of file VMEDummyBusAdapter.cc.
void HAL::VMEDummyBusAdapter::openDevice | ( | const VMEAddressTable & | VMEAddressTable, |
uint32_t | vmeBaseaddress, | ||
DeviceIdentifier ** | deviceIdentifierPtr, | ||
uint32_t * | baseAddressPtr, | ||
bool | doSwapping = false |
||
) | throw () |
If the VMEDummyBusAdapter was created with the memoryMode option set to true, the call scans the VMEAddressTable in order to find out how much memory has to be reserved for the dummy Hardware device.
The pointer to this memory is then contained in the deviceIdentifier.
Definition at line 28 of file VMEDummyBusAdapter.cc.
void HAL::VMEDummyBusAdapter::openDevice | ( | const VMEAddressTable & | vmeAddressTable, |
std::vector< uint32_t > & | vmeBaseaddresses, | ||
DeviceIdentifier ** | deviceIdentifierPtr, | ||
std::vector< uint32_t > * | baseAddressPtr, | ||
bool | doSwapping = 0 |
||
) | throw () |
Definition at line 92 of file VMEDummyBusAdapter.cc.
void HAL::VMEDummyBusAdapter::read | ( | DeviceIdentifier * | DeviceIdentifier, |
uint32_t | address, | ||
uint32_t | addressModifier, | ||
uint32_t | dataWidth, | ||
uint32_t * | result | ||
) | throw () |
Definition at line 169 of file VMEDummyBusAdapter.cc.
void HAL::VMEDummyBusAdapter::readBlock | ( | DeviceIdentifier * | deviceIdentifierPtr, |
uint32_t | startAddress, | ||
uint32_t | length, | ||
uint32_t | addressModifier, | ||
uint32_t | dataWidth, | ||
char * | buffer, | ||
HalAddressIncrement | addressBehaviour = HAL_DO_INCREMENT |
||
) | throw () |
Definition at line 264 of file VMEDummyBusAdapter.cc.
void HAL::VMEDummyBusAdapter::resetBus | ( | ) | throw () |
Definition at line 254 of file VMEDummyBusAdapter.cc.
void HAL::VMEDummyBusAdapter::write | ( | DeviceIdentifier * | deviceIdentifier, |
uint32_t | address, | ||
uint32_t | addressModifier, | ||
uint32_t | dataWidth, | ||
uint32_t | data | ||
) | throw () |
Definition at line 204 of file VMEDummyBusAdapter.cc.
void HAL::VMEDummyBusAdapter::writeBlock | ( | DeviceIdentifier * | deviceIdentifierPtr, |
uint32_t | startAddress, | ||
uint32_t | length, | ||
uint32_t | addressModifier, | ||
uint32_t | dataWidth, | ||
char * | buffer, | ||
HalAddressIncrement | addressBehaviour = HAL_DO_INCREMENT |
||
) | throw () |
Definition at line 323 of file VMEDummyBusAdapter.cc.
uint32_t HAL::VMEDummyBusAdapter::deviceNumberCounter [private] |
Definition at line 151 of file VMEDummyBusAdapter.hh.
enum MemoryMode HAL::VMEDummyBusAdapter::memoryMode [private] |
Definition at line 153 of file VMEDummyBusAdapter.hh.
std::ostream& HAL::VMEDummyBusAdapter::os_ [private] |
Definition at line 150 of file VMEDummyBusAdapter.hh.
enum VerboseMode HAL::VMEDummyBusAdapter::verbose [private] |
Definition at line 152 of file VMEDummyBusAdapter.hh.