#include <mvlc/CVMUSBReadoutList.h>
class CVMUSBReadoutList {
public:
CVMUSBReadoutList();
virtual ~CVMUSBReadoutList(); // just in case we derive.
virtual void addWrite32(uint32_t address, uint8_t amod, uint32_t datum);
virtual void addWrite16(uint32_t address, uint8_t amod, uint16_t datum);
virtual void addBlockWrite32(uint32_t dest, uint8_t amod, const void* pData, size_t nLongs);
virtual void addRead32(uint32_t address, uint8_t amod);
virtual void addRead16(uint32_t address, uint8_t amod);
virtual void addBlockRead32(uint32_t baseAddress, uint8_t amod, size_t transfers);
virtual void addFifoRead32(uint32_t baseAddress, uint8_t amod, size_t transfers);
virtual void addBlockCountRead16(uint32_t address, uint32_t mask, uint8_t amod);
virtual void addBlockCountRead32(uint32_t address, uint32_t mask, uint8_t amod);
virtual void addMaskedCountBlockRead32(uint32_t address, uint8_t amod);
virtual void addMaskedCountFifoRead32(uint32_t address, uint8_t amod);
virtual void addDelay(uint32_t clocks);
virtual void addMarker(uint32_t value);
virtual void addLoopUntil32(uint32_t address, uint8_t amod, uint32_t mask, uint32_t value);
virtual void addLoopUntil16(uint32_t addresss, uint8_t amod, uint32_t mask, uint32_t value);
std::vector<std::string> dumpForMvlc(); // Return the operations list.
void clear(); // clear the list.
void appendToStack(CVMUSBReadoutList& other); // Add out list to another list.
public:
static const uint8_t a32UserData ;
static const uint8_t a32UserProgram ;
static const uint8_t a32UserBlock ;
static const uint8_t a32PrivData ;
static const uint8_t a32PrivProgram;
static const uint8_t a32PrivBlock;
static const uint8_t a16User ;
static const uint8_t a16Priv;
static const uint8_t a24UserData;
static const uint8_t a24UserProgram;
static const uint8_t a24UserBlock;
static const uint8_t a24PrivData;
static const uint8_t a24PrivProgram ;
static const uint8_t a24PrivBlock ;
};
The code drivers (CReadoutHardware) addReadoutList
add operations needed to perform the device readout. In order to ease the porting
of VMUSBReadout device driver modules to translator code generators. This provides
a CVMUSBReadoutList that is closely compatible with the class with the
same name defined in the VMUSBReadout framework.
This class, however saves the operations in a form that allows them to be dumped into
the yaml configuration file mvlcgenerate writes.
These lists can also be created during code generation for initialization and then
when CVMUSB's executeList method is executed,
the operations saved by this list can be appended to the operations being saved by that object.
void addWrite32(uint32_t address , uint8_t amod, uint32_t datum);
Adds a 32 bit write of datum to the address specified
by address and address modifier specified by
amod.
void addWrite16(uint32_t address , uint8_t amod, uint16_t datum);
Adds a 16 bit write of datum to the address specified
by address and address modifier specified by
amod.
void addBlockWrite32(uint32_t dest, uint8_t amod, const void* pData, size_t transfers);
Stores a block transfer in the list. The data are gotten from
transfers uint32_t
words pointed to by pData When The
transfer is executed, the destination base address are defined
by dest with the address space selected by
amod
Note that the data are copied from pData
into the list
when this is called
void addBlockRead32( uint32_t baseAddress , uint8_t amod, size_t transfers);
Adds a 32 bit wide block transfer to the list. transfers
transfers will be transferred starting from the baseAddress
in the address spacde amod. Data from the block read,
goes into the event. It is not legal to use this in a list that is executed
via CVMUSB::executeList.
void addFifoRead32(uint32_t baseAddress , uint8_t amod, size_t transfers);
Same as addBlockRead32 but all reads
are done from the same address. That address typically is a FIFO buffer.
virtual void addBlockCountRead16(uint32_t address, uint32_t mask, uint8_t amod);
The interface supports block reads whose size is given by some value read from the VME. This is used when the module might produce a variable length event but supplies a register that describes how much data has been acquired.
Variable length read require two stack operations. The first,
a addBlockCountReadxx fetches the transfer count,
while the second a addMaskedCountBlockRead32
or addMaskedCountFifoRead does the actual transfer.
This method extracts the transfer count for a subsequent masked count operation.
The read of the register containing the counf field is a 16 bit read from
address in the address space specified by amod.
The field containing the count is assumed to be a contigous set of bits in the
field specified by the mask.
Suppose, for example, the mask is 0x0f00
and the value read
was 0xabcd The subsequent masked block read will
hvae a transfer count of
0xb (or 11) 32 bit items.
virtual void addBlockCountRead32(uint32_t address, uint32_t mask, uint8_t amod);
This method is the same as addBlockCountRead16, but the
read performed is 32 bits wide.
virtual void addMaskedCountBlockRead32(uint32_t address, uint8_t amod);
Performs a block transfer with a count that was extracted by the most
recent addBlockCountRead16 or
addBlockCountRead32 operation. The transfer begins
at address in the address space specified by amod
virtual void addMaskedCountFifoRead32(uint32_t address, uint8_t amod);
Performs a block transfer with a count that was extracted by the most
recent addBlockCountRead16 or
addBlockCountRead32 operation. All transfers are from
address in the address space specified by amod
virtual void addDelay(uint32_t clocks);
Adds a delay to the stack. In order to be compatible with the VMUSBReadout delay operation,
the length of the dleay is at least clocks*200ns. Note that the
actual delay may be slightly longer because the MVLC delay operation is in units of
62.5ns, and we delay for at least clocks*200ns.
virtual void addMarker(uint32_t value);
Causes a 32 bit literal value to be stored in the event. Note that VMUSB markers are 16 bit wide.
virtual void addLoopUntil32(uint32_t address, uint8_t amod, uint32_t mask, uint32_t value);
Provides a method to delay until some specific condition exists in a device.
The stack element does a 32 bit read from
address in the address space specified by
amod until the value read bitwise anded with the
mask is equal to the value.
Note that unlike the adBlockCountReadxx methods,
No shifting is done. The read, after being anded with the value
is directly compared with the value.
virtual void addLoopUntil16(uint32_t address, uint8_t amod, uint32_t mask, uint32_t value);
Same as addLoopUntil32 but the reads are only 16 bits wide.
std::vector<std::string> dumpForMvlc();
Retuns the contenst of the stack in a form that is recognizable in MVLC configuration files. This is intended for use by the generator framework and unit tests. This dump is non-destructive.
void clear();
Clears the stack contents.
void appendToStack(CVMUSBReadoutList& other);
Intended to be used by CVMUSB when it performs an
executeList operation. This method
appends the contents of this stack to other.
The append is non-desctructive. If you want to use this stack again you should most likely
invoke clear first.