anlTypes.hh
Go to the documentation of this file.
1 #ifndef __ANLTYPES_H__
2 #define __ANLTYPES_H__
3 
4 #include <cstdlib>
5 
6 //Maximum size of packet payload on comms channel
7 #define MAX_CTRL_DATA 256
8 
9 namespace SSPDAQ{
10 
11  //Readable names for interface types
13 
14 //==============================================================================
15 // Enumerated Constants
16 // These are defined by the SSP hardware spec
17 //==============================================================================
18 
19 //Command to send to SSP
21  cmdNone = 0,
22  // Basic Commands
23  cmdRead = 1,
25  cmdWrite = 3,
27  // Array Commands
30  // Fifo Commands
34 };
35 
36 //Holder for status returned from SSP
46  statusWriteError = 8 // Returned if read-only address is written
47 };
48 
49 //==============================================================================
50 // Types
51 //==============================================================================
52 
53  //Header to write out at top of millislice (i.e. this is the artdaq "metadata"
54  //for a fragment
56  unsigned long startTime;
57  unsigned long endTime;
58  unsigned long triggerTime;
59  unsigned int length; // Packet Length in unsigned ints (including header)
60  unsigned int nTriggers;
61  unsigned int triggerType;
62 
63  static const size_t sizeInUInts = 9;
64 
65  };
66 
67  //Structure defined by hardware, i.e. hardware output can be written straight into this struct
68 struct EventHeader { // NOTE: Group fields are listed from MSB to LSB
69  unsigned int header; // 0xAAAAAAAA
70  unsigned short length; // Packet Length in unsigned ints (including header)
71  unsigned short group1; // Trigger Type, Status Flags, Header Type
72  unsigned short triggerID; // Trigger ID
73  unsigned short group2; // Module ID, Channel ID
74  unsigned short timestamp[4]; // External Timestamp
75  // Words 0-1 = Clocks since last sync pulse
76  // Words 2-3 = Sync pulse count
77  unsigned short peakSumLow; // Lower 16 bits of Peak Sum
78  unsigned short group3; // Offset of Peak, Higher 8 bits of Peak Sum
79  unsigned short preriseLow; // Lower 16 bits of Prerise
80  unsigned short group4; // Lower 8 bits of integratedSum, Higher 8 bits of Prerise
81  unsigned short intSumHigh; // Upper 16 bits of integratedSum
82  unsigned short baseline; // Baseline
83  unsigned short cfdPoint[4]; // CFD Timestamp Interpolation Points
84  unsigned short intTimestamp[4]; // Internal Timestamp
85  // Word 0 = Reserved for interpolation
86  // Words 1-3 = 48 bit Timestamp
87 };
88 
89  //byte-level structure of command header to send to SSP
90 struct CtrlHeader {
91  unsigned int length;
92  unsigned int address;
93  unsigned int command;
94  unsigned int size;
95  unsigned int status;
96 };
97 
98  //Struct containing header followed by payload.
99  //Since control packets are small, just allocate enough space to accommodate
100  //longest possible message
101 struct CtrlPacket {
103  unsigned int data[MAX_CTRL_DATA];
104 };
105 
106 }//namespace SSPDAQ
107 #endif
unsigned short triggerID
Definition: anlTypes.hh:72
unsigned short group2
Definition: anlTypes.hh:73
unsigned int command
Definition: anlTypes.hh:93
statusConstants
Definition: anlTypes.hh:37
unsigned short length
Definition: anlTypes.hh:70
unsigned long startTime
Definition: anlTypes.hh:56
unsigned int size
Definition: anlTypes.hh:94
unsigned int length
Definition: anlTypes.hh:91
unsigned short intSumHigh
Definition: anlTypes.hh:81
unsigned long triggerTime
Definition: anlTypes.hh:58
commandConstants
Definition: anlTypes.hh:20
unsigned int address
Definition: anlTypes.hh:92
unsigned short preriseLow
Definition: anlTypes.hh:79
unsigned short group4
Definition: anlTypes.hh:80
unsigned int nTriggers
Definition: anlTypes.hh:60
unsigned long endTime
Definition: anlTypes.hh:57
unsigned short peakSumLow
Definition: anlTypes.hh:77
static const size_t sizeInUInts
Definition: anlTypes.hh:63
unsigned int header
Definition: anlTypes.hh:69
#define MAX_CTRL_DATA
Definition: anlTypes.hh:7
CtrlHeader header
Definition: anlTypes.hh:102
unsigned short baseline
Definition: anlTypes.hh:82
unsigned int status
Definition: anlTypes.hh:95
unsigned int length
Definition: anlTypes.hh:59
unsigned short group1
Definition: anlTypes.hh:71
unsigned int triggerType
Definition: anlTypes.hh:61
unsigned short group3
Definition: anlTypes.hh:78