EDOC957

 

 


AIDA/R3B + MBS Data Format


 

Edition 2.1
Oct 7 2014

 

STFC Nuclear Physics Group
Daresbury Laboratory


Introduction

This document describes the protocol used by AIDA & R3B when transferring data to the GSI MBS server. It has been updated to use the MIDAS TDR format data (GREAT etc al). The timestamp used is supplied by the GSI White Rabbit system.

The basic unit of data is the 32bit word. There may be many events in an event block. The length of significant data in an event block is variable and terminated by the end block token. The size of data blocks transferred between the client and MBS server is a fixed value determined dynamically when the data connection is initially made.

MBS Data Transfer Protocol

Data is transfered to MBS by making a TCP connection with the server using a default port number of 6500. The first data block sent by the client to the server during the connection must have a length of 1024 bytes. The first two 32 bit items in the buffer have the following structure

typedef struct mbs_block_header {
        unsigned int mbs_endian;
        unsigned int mbs_blocksize;
} MBS_HEADER;

and the contents of the remainder of the buffer is undefined.
mbs_endian should contain the value 1 and mbs_blocksize is the size (in bytes) of all following data blocks sent using this data connection. The blocksize should be in the range **** to *****. Normally 64K bytes will be used.

MBS Data Structures

Start Data Block Token
This protocol has no specific Start Block information.

End Data Block Token
For this protocol there is an End Block marker which is a 32bit data word that indicates the end of valid information in the current data block.

16 bits
0xffff
16 bits
0xffff

MBS Normal Data
This structure is used for normal application data.
Note: The data length is given in units of 16 bits but does not include itself or the MBS Type and SubType fields.
This will then have the value (AppDataLen * 2) + 4.

32 bits
data length (units 16 bits)
16 bits
MBS SubType = 10400 (0x28a0)
16 bits
MBS Type = 104 (0x0068)
8 bits
Control = 37
8 bits
SubCrate = 0
16 bits
Trigger Type = 1
32 bits
MBS SubSystem ID = 0x00000200
Application Data - AppDataLen words (32 bit)

The MBS Start Data Token
This token is used to indicate the start of a run.

32 bits
length = 2 (units 16 bits)
16 bits
MBS SubType = 1
16 bits
MBS Type = 10
8 bits
Control = 37
8 bits
SubCrate = 0
16 bits
Trigger Type = 14

The MBS End Data Token
This token is used to indicate the end of a run.

32 bits
length = 2 (units 16 bits)
16 bits
MBS SubType = 1
16 bits
MBS Type = 10
8 bits
Control = 37
8 bits
SubCrate = 0
16 bits
Trigger Type = 15

Application Data

The Application Data above has the following structure.
At the start of the data structure there are four 32 bit data items which contain the global MBS time for the event. This is a 64 bit counter provided by the White Rabbit system. This is used to merge data from this subsystem with data from other subsystems into a single time ordered stream.

16 bits
0x03e1
16 bits
MBS/WR Time bits 0-15
16 bits
0x04e1
16 bits
MBS/WR Time bits 16-31
16 bits
0x05e1
16 bits
MBS/WR Time bits 32-47
16 bits
0x06e1
16 bits
MBS/WR Time bits 48-63

Finally there is AIDA/R3B application data which uses the MIDAS TDR data format. See edoc504
These data items are written as 2 * 32 bit words which is expected by the MBS server if data endian is an issue.


© 2014 NPG - STFC