Skip to content

Latest commit

 

History

History
116 lines (84 loc) · 5.13 KB

data_format.md

File metadata and controls

116 lines (84 loc) · 5.13 KB

MVLC data format

All data is 32-bit oriented and written in little-endian.

Frame types

Name Value Binary Value
StackFrame 0xF3 0b1111'0011
StackContinuation 0xF9 0b1111'1001
BlockRead 0xF5 0b1111'0101
StackError 0xF7 0b1111'0111
SystemEvent 0xFA 0b1111'1010
SystemEvent2 (future) 0xFB 0b1111'1011
  • Frame header format (except for SystemEvent)

    Type[7:0] Continue[0:0] ErrorFlags[2:0] StackNum[3:0] CtrlId[2:0] Length[12:0]

    • Type: is one of the non-SystemEvent frame types.
    • Continue: If set the payload is continued in the following frame.
    • ErrorFlags: 3 bits: 2=SyntaxError, 1=VME BusError, 0=VME Timeout
    • StackNum: 0 based index of the MVLC command stack that produced the frame.
    • CtrlId: The MVLC controller/crate ID set via the 0x1304 controller_id register.
    • Length: The number of 32-bit words following this header word.
  • SystemEvent format:

    Type[7:0] Continue[0:0] CtrlId[2:0] Subtype[6:0] Length[12:0]

    • Common fields are the same as for non-SystemEvent frames.
    • Subtype: specifies the type of data this SystemEvent frame is carrying. See the table below for details.

    SystemEvent frames are not generated by the MVLC. mvme and the mvlc-mini-daq inject these frames into the data stream.

Output Format

Outgoing data is wrapped in a 0xF3 StackFrame with the StackNum field set to the number of the command stack that produced the data. If the Continue flag is set the 0xF3 StackFrame will be followed by one or more 0xF9 StackContinuation frames. The Continue bit will be set for all but the last part in the chain.

Outer framing example:

TODO: copy me from real data please!
0xF3
0xF9
0XF9

The format is 32-bit oriented. 16-bit VME reads are returned as masked-off 32-bit values. Single value VME reads are directly written into the frame contents, VME block reads are wrapped in inner 0xF5 BlockRead frames. These inner frames also make use of the Continue bit but do not have an extra continuation frame type.

UDP packet format

Two 32-bit headers, afterwards payload containing the above framing format starts. The total packet size is always a multiple of 32-bits.

Header0: { 0b00, packet_channel[1:0], packet_number[11:0], ctrl_id[2:0], data_word_count[12:0] }

Header1: { udp_timestamp[18:0], next_header_pointer[12:0] }

  • packet_channel:

    • 0 = Command: Low level command responses.
    • 1 = Stack: Data from immediate stack executions and 0xF7 error notifications.
    • 2 = Data: Readout data produced by command stacks routed to the data pipe.

    Each packet_channel carries its own packet_number sequence.

  • packet_number: Wrapping sequence number for packet loss detection.

  • ctrl_id: The MVLC controller/crate ID set via the 0x1304 controller_id register.

  • data_word_count: Number of 32-bit words following the Header1 word.

  • udp_timestamp: currently not used.

  • next_header_pointer: Offset from Header1 to the first outer frame header (0xF3, 0xF9) in the packet. 0 is the first word in the payload. 0xffff indicates that no frame header is present in the packet.

    This field can be used to safely resume parsing on a frame header after packet loss occured.

Max incoming packet size accepted by the MVLC is 1472 bytes (ETH MTU - IPv4_Header - UDP_header == 1500 - 20 - 8). Outgoing packets are limited to 1500 bytes or 9000 bytes if jumbo frames are used.

Header0 starts with 0b00. This prefix does not collide with any of the frame headers, so it is possible to store mixed streams (USB and ETH) in a single listmode file.

SystemEvent subtypes

Name Value Description
EndianMarker 0x01 Payload is set to 0x12345678.
BeginRun 0x02 Inserted at the start of a DAQ run.
EndRun 0x03 Inserted at the end of a DAQ run.
MVMEConfig 0x10 MVME configuration serialized to JSON.
UnitTimetick 0x11 Software generated low-accuracy timestamp, written once per second.
Pause 0x12 Inserted when the DAQ was paused by the user.
Resume 0x13 Inserted when the DAQ was resumed by the user.
MVLCCrateConfig 0x14 MVLC CrateConfig in serialized to YAML.
StackErrors 0x15 stackNum [3:0], frameFlags [3:0], stackLine [7:0], count [15:0]
UserMin 0x20 First user defined type.
UserMax 0x2F Last user defiend type.
EndOfFile 0x77 Written when a listfile is closed.