classCCCUSBReadoutList
{CCCUSBReadoutList();
CCCUSBReadoutList(const std::vector<uint16_t>& list);
CCCUSBReadoutList(const CCCUSBReadoutList& rhs);
const std::vector<uint16_t> get();
const size_t size();
void clear();
void addWrite16(int n, int a, int f, uint16_t data);
void addWrite24(int n, int a, int f, uint32_t data);
void addRead16(int n, int a, int f, bool lamWait = false);
void addRead24(int n, int a, int f, bool lamWait = false);
void addControl(int n, int a, int f);
void addQStop(int n, int a, int f, uint16_t max, bool lamWait = false);
void addQStop24(int n, int a, int f, uint16_t max, bool lamWait = false);
void addQScan(int n, int a, int f, uint16_t max, bool lamWait = false);
void addRepeat(int n, int a, int f, bool lamWait = false);
void addAddressPatternRead16(int n, int a, int f, bool lamWait = false);
void addMarker(uint16_t value);
};
CCCUSBReadoutList
provides a class whose instances can
build up lists (stacks) of CAMAC operations that can either be
submitted to a CC-USB for direct execution via CCCUSB::executeList
,
or loaded as an event or scaler stack via CCCUSB::loadStack
.
CCCUSBReadoutList();
Constructs a new readout list.
CCCUSBReadoutList(const std::vector<uint16_t>& list);
Constructs a new readout list from a raw list of stack commands. The contents of the list passed into the constructor will be copied into the list managed by this object. All subsequent commands will be appended to the new list.
CCCUSBReadoutList(const CCCUSBReadoutList& rhs);
Constructs a readout list that will be a duplicate
of the readout list in rhs
(Copy construction).
const std::vector<uint16_t> get();
Returns a std::list<uint16_t> where each element of the list is a stack line that has been built up so far.
const size_t size();
Returns the number of uint16_t stack lines built so far.
void clear();
Clears the stack. Once this is performed, the object represents an empty stack.
void addWrite16(int n, int a, int f, uint16_t data);
Adds a 16 bit CAMAC write opearation to the list.
n,a,f
specify the
slot, subaddress and function code respectively.
The data
parameter is transferred
to the device when the command is executed.
Note that this method does not perform any CAMAC operations.
The specified operation is simply encoded as stack lines
in the object.
void addWrite24(int n, int a, int f, uint32_t data);
Same as addWrite16
however
the least significant 24 bits of data
will be written when this stack line is executed.
void addRead16(int n, int a, int f, bool lamWait = false);
A 16 bit read operation whose slot, subaddress
and function code are specified by n,a,f
is encoded as a stack line and added to the list.
If the stack line is executed in immediate mode
(via CCCUSB::executeList
),
the data read will be put in the input buffer passed
to that method. IF the stack line loaded as a scaler
or event stack asnd executed in response to the appropriate
trigger condition, the data are put in the event buffer.
If the lamWait
parameter is
true the stack will stall until
either the lam timeout period is reached or the
slot the operation is directed to signals its LAM.
void addRead24(int n, int a, int f, bool lamWait = false);
Same as addRead16
, however a
uint32_t
is put in the buffer (event or buffer given to
CCCUSB::executeStack
depending
on why the stack is being executed). The format
of the uint32_t is shown in the figure just at the
end of chapter 4 of the CC-USB manual:
The bottom 24 bits are the data transferred from the
module. Bit 24 is set if there was a Q response
and bit 25 is set if there was an X response
(bits are numbered from 0 least significant bit
is bit 0).
void addControl(int n, int a, int f);
Adds a non data transfer operation to the stack.
void addQStop(int n, int a, int f, uint16_t max, bool lamWait = false);
Adds a Q-stop block transfer to the stack. Q-stop
operations perform the same n,a,f
read operation until either the module does not
return a Q response or until the max
number of transfers specified have been performed.
The lamWait
parameter allows
you to wait for a LAM from the targe module before
doing the transfer.
void addQStop24(int n, int a, int f, uint16_t max, bool lamWait = false);
Same as addQStop
except
that 24 bits of data are transferred on each
operation.
void addQScan(int n, int a, int f, uint16_t max, bool lamWait = false);
Performs a Q-scan (sometimes called an address
scan) operation. n,a,f
specify a starting slot, subaddress and function code.
After each operation a is incremented. The CC-USB
documentation does not make it clear if this is a
full Q-Scan (ACA) operation as defined by the ESONE
block transfer specification. If this operation is
a full address scan, then after each operation, the
subaddress is incremented. If A was 15 or a Q=0
response occured, the
subaddress should be set to 0 and the slot incremented.
This continues until either max
transfers have occured or both Q and X are zero.
The documentation only describes the subadress as being incremented so that may be all you can count on for this opertaion. It also does not provide a statement about what happens when Q=0 or X=0.
void addRepeat(int n, int a, int f, uint16_t max, bool lamWait = false);
Performs a block repeat operation. The specified
CAMAC operation is performed max
times regardless of the X/Q responses.
void addAddressPatternRead16(int n, int a, int f, bool lamWait = false);
Adds an address pattern read to the stack. The data read by the provided NAF is interpreted as a list of A values to use when calling the NAF of the subsequent command in the stack. For each nonzero bit in the data returned, the subsequent command's N and F values are used with each of the present A values to form an NAF command. In other words, if the NAF of this read returns a value of 0x7 and the next command in the stack is N(4)AF(0), then three commands will be executed in succession: N(4)A(0)F(0), N(4)A(1)F(0), and N(4)A(2)F(0). Note that this is a setup command for the next NAF operation that is added to the stack. If the lamWait is true, the read will wait until a LAM is identified or a timeout occurs.
void addMarker(uint16_t value);
The literal word value
is
written to the output buffer.