#include <VmeModule.h>
class CVmeModule {CVmeModule(CVmeModule::Space space, UInt_t base, UInt_t length, int nCrate = 0);
CVmeModule(const CVmeModule& aCVmeModule);
CVmeModule& operator=(const CVmeModule& aCVmeModule);
int operator==(const CVmeModule& aCVmeModule);
UChar_t peekb(UInt_t offset = 0);
UShort_t peekw(UInt_t offset = 0);
ULong_t peekl(UInt_t offset = 0);
void pokeb((Char_t byte, UInt_t nOffset);
void pokew(UShort_t word, UInt_t nOffset);
void pokel(ULong_t lword, UInt_t nOffset);
UInt_t readl(void* pBuffer, UInt_t nOffset, size_t longs);
UInt_t readw(void* pBuffer, UInt_t nOffset, size_t words);
UInt_t readb(void* pBuffer, UInt_t nOffset, size_t bytes);
}
This class provides base methods and facilities on which you can build a class to drive a specific hardware module. This can be done either by extension (public inheritance), by layering (protected/private inheritance), or composition as you choose.
CVmeModule(CVmeModule::Space space, UInt_t base, UInt_t length, int nCrate = 0);
Base class constructor. The base class encapsulates a
CVME
object. This constructor provides
the information requried to build that.
space
, base
and length
describe the addresss window
and address modifier that will access the module. nCrate
selects in which of the VME crates the module is located.
CVmeModule(const CVmeModule& aCVmeModule);
Provides copy construction of this base class. It is not necessary, and sometimes not possible for subclasses to provide a copy constructor. In that case, the recommended procedure is for the subclass to declare a private copy constructor but never implement it.
CVmeModule& operator=(const CVmeModule& aCVmeModule);
Provides for assignment of the base class. It may not be possible for the subclass to provide that function. In that case, see the remarks for the copy constructor for the recommended procedure.
int operator==(const CVmeModule& aCVmeModule);
Provides base class support for an equality comparison. If this cannot be provided in a derived class see the notes for the copy constructor.
UChar_t peekb(UInt_t offset = 0);
Fetches a byte from the address window defined in the constructor.
offset
is the byte offset from the base of
that address window to the byte fetched.
UShort_t peekw(UInt_t offset = 0);
Same as peekb
however a 16 bit word is
returned and offset
is a word offset.
ULong_t peekl(UInt_t offset = 0);
Same as peekb
however a 32 bit longword
is returned, and offset
is a longword
offset.
void pokeb((Char_t byte, UInt_t nOffset);
Writes an 8 bit byte to the address window created by the constructor.
byte
is written to nOffset
bytes from the base of the base address of the window.
void pokew(UShort_t word, UInt_t nOffset);
Same as pokeb
however a 16 bit
word
is written to
nOffset
words from the base address
of the address window.
void pokel(ULong_t lword, UInt_t nOffset);
Same as pokeb
however a 32 bit
lword
is written to
nOffset
longwords fromt he base
address of the address window.
UInt_t readl(void* pBuffer, UInt_t nOffset, size_t longs);
Reads a block from the VME bus address window defined by this
module. The block read starts at nOffset
longwords from the start of the window and is
longs
longwords long. The block is transferred
into the buffer pointed to by pBuffer
.
On success, the function returns the number of longwords read.
Where possible, this function performs each read at a longword width.
UInt_t readw(void* pBuffer, UInt_t nOffset, size_t words);
Same as readl
however,
nOffset
is a word (16 bit) offset and
words
counts the number of 16 bit words
to read. All transfers are done in 16 bit width if possible.
UInt_t readb(void* pBuffer, UInt_t nOffset, size_t bytes);
Same as readl
however
nOffset
is an 8 bit offset and
bytes
is a byte count. All transfers are
done 8 bit wide if possible).
In parallel with the address space selectors in
CVME
,
this module defines the type CVmeModule::Space
which is an enumerated type with the following values defined:
a16d16
Selects Short I/O space note that the data width is not actually restricted to 16 bits.
a24d16
and
a24d32
Selects A24 addressing with no actual data width restriction.
a32d32
Selects A32 addresssing.
geo
Selects geographical addressing for backplanes that include the CERN P3 connector.