Library of Bus-Adapters
HAL::CAENLinuxBusAdapter Class Reference

BusAdapter for the PC-to-VME interfaces from CAEN. More...

#include <CAENLinuxBusAdapter.hh>

List of all members.

Public Types

enum  CAENModel { V1718, V2718 }
 A type to distinguish the supported CAEN BusAdapters. More...
enum  CAENPCCard { A2818, A3818 }

Public Member Functions

 CAENLinuxBusAdapter (CAENModel model, int unit=0, int chain=0, CAENPCCard pcCard=A2818) throw ( BusAdapterException )
 The constructor of the CAENLinuxBusAdapter.
virtual ~CAENLinuxBusAdapter () throw ( BusAdapterException )
void openDevice (const VMEAddressTable &VMEAddressTable, uint32_t vmeBaseaddress, DeviceIdentifier **deviceIdentifierPtr, uint32_t *baseAddressPtr, bool doSwapping) throw (BusAdapterException)
 This function registers a standard VMEDevice with the BusAdapter.
void openDevice (const VMEAddressTable &VMEAddressTable, std::vector< uint32_t > vmeBaseaddresses, DeviceIdentifier **deviceIdentifierPtr, std::vector< uint32_t > *baseAddressesPtr, bool doSwapping) throw (BusAdapterException)
 This function registers a VME64x module with the BusAdapter.
void closeDevice (DeviceIdentifier *deviceIdentifier) throw ()
 Here the deviceIdentifier is destroyed.
void write (DeviceIdentifier *vmeDevice, uint32_t address, uint32_t addressModifier, uint32_t dataWidth, uint32_t data) throw ( BusAdapterException )
void read (DeviceIdentifier *vmeDevice, uint32_t address, uint32_t addressModifier, uint32_t dataWidth, uint32_t *result) throw ( BusAdapterException )
void writeBlock (DeviceIdentifier *deviceIdentifierPtr, uint32_t startAddress, uint32_t length, uint32_t addressModifier, uint32_t dataWidth, char *buffer, HalAddressIncrement addressBehaviour=HAL_DO_INCREMENT) throw ( BusAdapterException, UnsupportedException )
void readBlock (DeviceIdentifier *deviceIdentifierPtr, uint32_t startAddress, uint32_t length, uint32_t addressModifier, uint32_t dataWidth, char *buffer, HalAddressIncrement addressBehaviour=HAL_DO_INCREMENT) throw ( BusAdapterException, UnsupportedException )
void resetBus () throw ( BusAdapterException )
 Generate a Reset on the VME backplane.
void readDisplay (std::ostream &os) const throw ( BusAdapterException )
 Read the display of the CAEN display an put in in ASCII format int the output stream os.
void readVersions (std::ostream &os) const
 Print out the versions read in the Constructor in the output stream.
void enableIRQ (uint32_t mask) const throw ( BusAdapterException )
 Enable interrupts for those IRQ lines which are indicated by the mask.
void disableIRQ (uint32_t mask) const throw ( BusAdapterException )
 Disable interrupts for those IRQ lines which are indicated by the mask.
uint32_t checkIRQ () const throw ( BusAdapterException )
 Chack if an Interrupt has been asserted.
uint32_t waitIRQ (uint32_t mask, uint32_t timeoutMs) const throw ( BusAdapterException )
 Wait for an interrupts to occur.
void acknowledgeIRQ (uint32_t level, void *vector, uint32_t width) const throw ( BusAdapterException )
 Generates an Interrupt acknowledge cycle.

Private Attributes

int unit_
int chain_
char V1718FwRelease_ [256]
char V2718FwRelease_ [256]
char AX818FwRelease_ [256]
char A2719FwRelease_ [256]
char VMELibRelease_ [256]
CAENModel model_
CVBoardTypes pcCard_
std::string pcCardStr_

Static Private Attributes

static int32_t handleVX718_ [8][8]
static int32_t handleVX718UseCount_ [8][8]
static sem_t * handleSemaphore_ = 0

Detailed Description

BusAdapter for the PC-to-VME interfaces from CAEN.

This BusAdapter class handles two models of the CAEN Busadapter modules: The V2718 and the V1718. The V2718 is based on an optical link from the PC to the VME controller. The V1718 is based on a USB link. Both modules are software compatible except for some minor differences (e.g. Interrupt handling).

The correct operation of this BusAdapter needs the driver software of the CAEN interface to be installed. In the MakeVars file for the BusAdapters the path to the relevant include files must be specified in order to compile the adapter.

The busAdapter does direct driver accesses using the API of CAEN called "CAENVMELib".

See also:
BusAdapterInterface
Author:
Christoph Schwick
Revision:
1.2
Date:
2008/08/27 18:33:29

Definition at line 47 of file CAENLinuxBusAdapter.hh.


Member Enumeration Documentation

A type to distinguish the supported CAEN BusAdapters.

Enumerator:
V1718 
V2718 

Definition at line 53 of file CAENLinuxBusAdapter.hh.

Enumerator:
A2818 
A3818 

Definition at line 54 of file CAENLinuxBusAdapter.hh.


Constructor & Destructor Documentation

HAL::CAENLinuxBusAdapter::CAENLinuxBusAdapter ( CAENModel  model,
int  unit = 0,
int  chain = 0,
CAENPCCard  pcCard = A2818 
) throw ( BusAdapterException )

The constructor of the CAENLinuxBusAdapter.

It has been decided not to use polymorphism and different derived classes for the usb and the optical version of the module since the benefit would have been small.

The BusAdapter sets up the CAEN VME driver to work with the HAL. Driver parameters are preset here. Be aware that no other application on the system should change these parameters as long as the HAL is used. The bute swapping strategy is defined in the constructor.

Parameters:
CAENModelspecifies the type of the CAEN module. Two modules are supported: V2718 (optical link) and V1718 (USB).
unitis a parameter which lets you distinguish between various CAEN-busAdapters in the case that you have more than one interface connected to your PC via PCI. The interfaces are numbered from 0 to n.
chainindicates the interface in case you use a chain of controllers Numbers range from 0 to n and indicate the position of the VMEController in the chain. This parameter has no meaning (and effect) if the USB version of the bridge is used.
pcCardis a parameter which you need to indicate with which PCI card you are operating the BusAdapter. CAEN presently has the A2818 pci card with one optical link and the A3818 PCIe card with four optical links.

Having a parameter in the constructor to let the user choose between the models makes life slightly easier for implementors which often swap usb module with optical modules in the laboratory.

Definition at line 35 of file CAENLinuxBusAdapter.cc.

HAL::CAENLinuxBusAdapter::~CAENLinuxBusAdapter ( ) throw ( BusAdapterException ) [virtual]

Definition at line 188 of file CAENLinuxBusAdapter.cc.


Member Function Documentation

void HAL::CAENLinuxBusAdapter::acknowledgeIRQ ( uint32_t  level,
void *  vector,
uint32_t  width 
) const throw ( BusAdapterException )

Generates an Interrupt acknowledge cycle.

Definition at line 498 of file CAENLinuxBusAdapter.cc.

uint32_t HAL::CAENLinuxBusAdapter::checkIRQ ( ) const throw ( BusAdapterException )

Chack if an Interrupt has been asserted.

The return value contains a bit mask of the correspondign interrupt lines.

Definition at line 465 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::closeDevice ( DeviceIdentifier *  deviceIdentifier) throw ()

Here the deviceIdentifier is destroyed.

Definition at line 249 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::disableIRQ ( uint32_t  mask) const throw ( BusAdapterException )

Disable interrupts for those IRQ lines which are indicated by the mask.

Definition at line 453 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::enableIRQ ( uint32_t  mask) const throw ( BusAdapterException )

Enable interrupts for those IRQ lines which are indicated by the mask.

Definition at line 441 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::openDevice ( const VMEAddressTable &  VMEAddressTable,
uint32_t  vmeBaseaddress,
DeviceIdentifier **  deviceIdentifierPtr,
uint32_t *  baseAddressPtr,
bool  doSwapping 
) throw (BusAdapterException)

This function registers a standard VMEDevice with the BusAdapter.

Parameters:
VMEAddressTableis currently not needed by this specific busAdapter, but it is part of the interface in order to allow a busAdapter to do memory mapping.

Definition at line 218 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::openDevice ( const VMEAddressTable &  VMEAddressTable,
std::vector< uint32_t >  vmeBaseaddresses,
DeviceIdentifier **  deviceIdentifierPtr,
std::vector< uint32_t > *  baseAddressesPtr,
bool  doSwapping 
) throw (BusAdapterException)

This function registers a VME64x module with the BusAdapter.

Parameters:
VMEAddressTableis currently not needed by this specific busAdapter, but it is part of the interface in order to allow a busAdapter to do memory mapping.

Definition at line 233 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::read ( DeviceIdentifier *  vmeDevice,
uint32_t  address,
uint32_t  addressModifier,
uint32_t  dataWidth,
uint32_t *  result 
) throw ( BusAdapterException )

Definition at line 256 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::readBlock ( DeviceIdentifier *  deviceIdentifierPtr,
uint32_t  startAddress,
uint32_t  length,
uint32_t  addressModifier,
uint32_t  dataWidth,
char *  buffer,
HalAddressIncrement  addressBehaviour = HAL_DO_INCREMENT 
) throw ( BusAdapterException, UnsupportedException )

Definition at line 308 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::readDisplay ( std::ostream &  os) const throw ( BusAdapterException )

Read the display of the CAEN display an put in in ASCII format int the output stream os.

Definition at line 414 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::readVersions ( std::ostream &  os) const

Print out the versions read in the Constructor in the output stream.

Definition at line 402 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::resetBus ( ) throw ( BusAdapterException )

Generate a Reset on the VME backplane.

Definition at line 300 of file CAENLinuxBusAdapter.cc.

uint32_t HAL::CAENLinuxBusAdapter::waitIRQ ( uint32_t  mask,
uint32_t  timeoutMs 
) const throw ( BusAdapterException )

Wait for an interrupts to occur.

If the timeoutMs is set to 0 this function waits until an interrupt occurs. If it is set to value n>0 it will return after n milliseconds if no interrupt occurs. The return value contains a bitmask of the interrupt lines asserted.

Definition at line 479 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::write ( DeviceIdentifier *  vmeDevice,
uint32_t  address,
uint32_t  addressModifier,
uint32_t  dataWidth,
uint32_t  data 
) throw ( BusAdapterException )

Definition at line 278 of file CAENLinuxBusAdapter.cc.

void HAL::CAENLinuxBusAdapter::writeBlock ( DeviceIdentifier *  deviceIdentifierPtr,
uint32_t  startAddress,
uint32_t  length,
uint32_t  addressModifier,
uint32_t  dataWidth,
char *  buffer,
HalAddressIncrement  addressBehaviour = HAL_DO_INCREMENT 
) throw ( BusAdapterException, UnsupportedException )

Definition at line 355 of file CAENLinuxBusAdapter.cc.


Member Data Documentation

Definition at line 218 of file CAENLinuxBusAdapter.hh.

Definition at line 217 of file CAENLinuxBusAdapter.hh.

Definition at line 214 of file CAENLinuxBusAdapter.hh.

sem_t * HAL::CAENLinuxBusAdapter::handleSemaphore_ = 0 [static, private]

Definition at line 212 of file CAENLinuxBusAdapter.hh.

int32_t HAL::CAENLinuxBusAdapter::handleVX718_ [static, private]
Initial value:
 {{0,0,0,0,0,0,0,0},
                                                        {0,0,0,0,0,0,0,0},
                                                        {0,0,0,0,0,0,0,0},
                                                        {0,0,0,0,0,0,0,0},
                                                        {0,0,0,0,0,0,0,0},
                                                        {0,0,0,0,0,0,0,0},
                                                        {0,0,0,0,0,0,0,0},
                                                        {0,0,0,0,0,0,0,0}}

Definition at line 210 of file CAENLinuxBusAdapter.hh.

Initial value:
 {{0,0,0,0,0,0,0,0},
                                                                {0,0,0,0,0,0,0,0},
                                                                {0,0,0,0,0,0,0,0},
                                                                {0,0,0,0,0,0,0,0},
                                                                {0,0,0,0,0,0,0,0},
                                                                {0,0,0,0,0,0,0,0},
                                                                {0,0,0,0,0,0,0,0},
                                                                {0,0,0,0,0,0,0,0}}

Definition at line 211 of file CAENLinuxBusAdapter.hh.

CVBoardTypes HAL::CAENLinuxBusAdapter::pcCard_ [private]

Definition at line 221 of file CAENLinuxBusAdapter.hh.

std::string HAL::CAENLinuxBusAdapter::pcCardStr_ [private]

Definition at line 222 of file CAENLinuxBusAdapter.hh.

Definition at line 213 of file CAENLinuxBusAdapter.hh.

Definition at line 215 of file CAENLinuxBusAdapter.hh.

Definition at line 216 of file CAENLinuxBusAdapter.hh.

Definition at line 219 of file CAENLinuxBusAdapter.hh.


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