CVMUSBReadoutList

Name

CVMUSBReadoutList -- Construct VM-USB stacks

Synopsis


#include <CVMUSBReadoutList.h>

class CVMUSBReadoutList
    
  CVMUSBReadoutList();
      CVMUSBReadoutList(std::vector<uint32_t>& list);
      CVMUSBReadoutList(const CVMUSBReadoutList& rhs);
    
    void clear();
       const size_t size();
       const std::vector<uint32_t> get();
                    
        void addRegisterRead(unsigned int address);
       void addRegisterWrite(unsigned int address, uint32_t data);
        void addWrite32(uint32_t address, uint8_t amod, uint32_t datum);
        void addWrite16(uint32_t address, uint8_t amod, uint16_t datum);
       void addWrite8(uint32_t address, uint8_t amod, uint8_t datum);
       void addRead32(uint32_t address, uint8_t amod);
       void addRead16(uint32_t address, uint8_t amod);
       void addRead8(uint32_t address, uint8_t amod);
       void addBlockRead32(uint32_t baseAddress, uint8_t amod, size_t transfers);
       void addFifoRead32(uint32_t baseAddress, uint8_t amod, size_t transfers);
       void addFifoRead16(uint32_t baseAddress, uint8_t amod, size_t transfers);
       void addBlockWrite32(uint32_t baseAddress, uint8_t amod, void* data, size_t transfers);
       void addBlockCountRead8(uint32_t address, uint32_t mask, uint8_t amod);
       void addBlockCountRead16(uint32_t address, uint32_t mask, uint8_t amod);
       void addBlockCountRead32(uint32_t address, uint32_t mask, uint8_t amod);
       void addMaskedCountBlockRead32(uint32_t address, uint8_t amod);
       void addMaskedCountFifoRead32(uint32_t address, uint8_t amod);
       void addDelay(uint8_t clocks);
  
       void addMarker(uint16_t value);
      static const uint8_t a32UserData = 0x09;
      static const uint8_t a32UserProgram = 0xa;
      static const uint8_t a32UserBlock = 0x0b;
      static const uint8_t a32PrivData = 0x0d;
      static const uint8_t a32PrivProgram = 0x0e;
      static const uint8_t a32PrivBlock = 0x0f;
      static const uint8_t a16User = 0x29;
      static const uint8_t a16Priv = 0x2d;
      static const uint8_t a24UserData = 0x39;
      static const uint8_t a24UserProgram = 0x3a;
      static const uint8_t a24UserBlock = 0x3b;
      static const uint8_t a24PrivData = 0x3d;
      static const uint8_t a24PrivProgram = 0x3e;
      static const uint8_t a24PrivBlock = 0x3f;

DESCRIPTION

This object is used to build up lists (stacks) of VME commands. The normal procedure is to create an instance of a CVMUSBReadoutList and invoke its member functions to build up the list of operations desired. The resulting list is then passed either to CVMUSB::executeList, which executes the operations in the list immediately and returns any data read. Alternatively, if the list is being created for use as a data acquisition mode stack, it is passed to CVMUSB::loadList to load it into the VM-USB stack memory.

METHODS

This section desribes the methods provide by the CVMUSBReadoutList class and objects. Several parameters are common throughout and will only be explained here.

uint8_t amod is always a VME Bus address modifier. See CONSTANTS below for a list of the address modifiers.

uint32_taddress is the VME address that is the source or target of an operation.

uint32_tbaseAddress is the starting address of a block transfer operation.

CVMUSBReadoutList();

This is the constructor you will normally use. It produces an empty VM-USB stack which can be built up using the remaining methods described in this section.

CVMUSBReadoutList(std::vector<uint32_t>& list);

This constructor builds a VM-USB list that is intially stocked with the stack contained in list. This list can be built either by hand or could have been gotten by a call to get on a previously existinglist.

CVMUSBReadoutList(const CVMUSBReadoutList& rhs);

Copy constructor. The existence of this constructor also allows lists to be passed by value to other functions.

void clear();

Clears the stack. This allows a CVMUSBReadoutList to be re-used once it has been either loaded or executed.

const size_t size();

Returns the number of stack lines. The VM-USB manual defines a stack line as a 32 bit datum. Most instructions require at least two lines. Some are even longer.

const std::vector<uint32_t> get();

Returns the undelying std::list that is used to store the stack as it is being built. The return value from this method is also usable in a constructor.

void addRegisterRead(unsigned int address);

Adds an instruction to read a VM-USB internal register. In this case address is a VM-USB register rather than a VME address. The register addresses are listed in the table in section 3.4 of the VM-USB manual.

void addRegisterWrite(unsigned int address, uint32_t data);

Adds an instruction to do a write to a VM-USB internal register. data is the data to be written. As with addRegisterRead, address is a register file address from the table in section 3.4 of the VM-USB manual.

void addWrite32(uint32_t address, uint8_t amod, uint32_t datum);

Adds a command to write a 32 bit datum to the VME bus.

void addWrite16(uint32_t address, uint8_t amod, uint16_t datum);

Adds a command to write a 16 bit datum to the VME bus.

void addWrite8(uint32_t address, uint8_t amod, uint8_t datum);

Adds an instruction to perform an 8 bit write of datum to the VME-Bus.

void addRead32(uint32_t address, uint8_t amod);

Adds an instruction to do a 32 bit read from the VME bus to the stack. The data read are either placed in the buffer handed to CVMUSB::executeList or, if the stack is triggered in data taking mode, to the event read for the trigger.

void addRead16(uint32_t address, uint8_t amod);

Adds an instruction to perform a 16 bit read from the VME bus to the stack.

void addRead8(uint32_t address, uint8_t amod);

Adds an instruction to perform an 8 bit read from the VME bus to the stack.

void addBlockRead32(uint32_t baseAddress, uint8_t amod, size_t transfers);

Adds a block read of 32 bit wide quantities to the stack. transfers is the maximum number of transfers that will be performed. The transfer will also terminate if VME bus reports a bus error. In that case, a 32 bit 0xffffffff will be put in the buffer to mark termination.

If the amod is a VME block transfer address modifier, the block transfer will only provde an address cycle at the beginning of the transfer and whenever the address crosses a 256 byte boundary as provided for in the VME bus specification for block transfers. This can significantly improve performance.

void addFifoRead32(uint32_t baseAddress, uint8_t amod, size_t transfers);

Same as addBlockRead32, however all address cycles will assert baseAddress.

void addFifoRead16(uint32_t baseAddress, uint8_t amod, size_t transfers);

Same as addFifoRead32, however the transfers will be 16 bits wide.

void addBlockWrite32(uint32_t baseAddress, uint8_t amod, void* data, size_t transfers);

Adds a block write to the list. data is a buffer containing transfers worth of 32 bit data to transfer. If a block transfer amod is used, the controller will only perform address cycles atthe start of the transfer and as the address crosses 256-byte boundaries as provided for in the VME bus block transfer specification. There must be at least 2 transfers for this to succeed.

void addBlockCountRead8(uint32_t address, uint32_t mask, uint8_t amod);

The VM-USB provides a set of instructions that allow you to perform variable length block transfers. This is done in two steps. The first step readss the length of the transfer from somewhere on the VME bus (usually this is a module register). The second step is to actually perform the variable block transfer.

This method adds a stack instruction to perform an 8 bit data transfer from the VME bus and place the result in the output buffer or event. The set of bits in that data defined by mask are used to set the transfer count for the next variable length block transfer.

void addBlockCountRead16(uint32_t address, uint32_t mask, uint8_t amod);

Same as addBlockCountRead8 however the datum transferred from the VME bus is 16 bits wide rather than 8.

void addBlockCountRead32(uint32_t address, uint32_t mask, uint8_t amod);

Same as addBlockCountRead16, however the datum transferred from the VME bus is 32 bits wide rather than 16.

void addMaskedCountBlockRead32(uint32_t baseAddress, uint8_t amod);

This method adds an instruction to use the transfer count register loaded by one of the addBlockCountReadxx methods as the transfer count for a block read that is 32 bits wide.

void addMaskedCountFifoRead32(uint32_t address, uint8_t amod);

Same as addMaskedCountBlockRead32 however all address cycles provide address on the bus.

void addDelay(uint8_t clocks);

Adds a delay of clocks FPGA cycles to the stack. Each cyle is 12.5ns long.

void addMarker(uint16_t value);

Adds an instruction to put the literal value into the output buffer.

CONSTANTS

The class defines a set of constants that are symbolic definitions of the VME address modifiers. Remember that since these constants are defined within CVUSBReadoutList the classname must be used to scope uses of those definitions. For example

CVMUSBReadoutList::a32UserData
.

static const uint8_t a32UserData = 0x09;

In the VME bus standard this is referred to as Extended Non-privileged Data Access Extended means addresses use the full 32 bits of width. VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a32UserProgram = 0xa;

In the VME bus standard thisis referred to as Extended Non-privileged program access Extended means addresses use the full 32 bits of width. VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a32UserBlock = 0x0b;

In the VME bus standard this is referred to as Extended Non-privileged Block Transfer Block transfer address modifiers only require address cycles on the first cycle, to establish the base address and whenver the address would cross a 256 byte boundary. Using block transfers where possible provides a measurable performance improvement.

Extended means addresses use the full 32 bits of width. VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a32PrivData = 0x0d;

The VME bus standard refers to this as Extended Supervisory Data. Supervisory data accesses are considered to be from a privileged state. Extended means addresses use the full 32 bits of width. VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a32PrivProgram = 0x0e;

The VME bus standard refers to this as Extended Supervisory Program access Extended means addresses use the full 32 bits of width. VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a32PrivBlock = 0x0f;

The VME bus standard refers to this as Extended Supervisory Block Transfer. Transfers using block transfer modifiers are assumed to go over a contiguous address block. The bus master only needs to perform an address cycle at the beginning of the transfer and again as the address crosses 256 byte boundaries.

Extended means addresses use the full 32 bits of width. VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a16User = 0x29;

In the VME standard this is referred to as Short Non-privileged. Short addresses are those that only use 16 bits of address. The address space is assumed to be used for devices.

static const uint8_t a16Priv = 0x2d;

In the VME standard this is referred to as Short Supervisory. Short addresses are those that only use 16 bits of address. The address space is assumed to be used for devices.

static const uint8_t a24UserData = 0x39;

In the VME standard, this is referred to as Standard Non-privileged Data. Standard address modifiers pay attention to 24 bits of' address.

VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a24UserProgram = 0x3a;

The VME standard refers to this a Standard Non-Privileged Program VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a24UserBlock = 0x3b;

The VME standad refers to this as Standard Non-privileged Block. Block transfer address modifiers allow the master to improve performance by only requiring an address cycle at the start of the first transfer and as the block transfer crosses 256 byte address boundaries.

VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a24PrivData = 0x3d;

The VME standard refers to ths as Standard Supervisory Data VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a24PrivProgram = 0x3e;

The VME standard refers to this as Standard Supervisory Program VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.

static const uint8_t a24PrivBlock = 0x3f;

The VME standard refers to this as Standard Supervisory Block. Block transfer address modifiers allow the master to improve performance by only requiring an address cycle at the start of the first transfer and as the block transfer crosses 256 byte address boundaries.

VME bus provides for privileged and non-privileged access modes as well as program and data access modes.

Check the documentation of your target to see which address modifiers are accetpable.