Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
dune-raw-data
dune-raw-data
Overlays
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
12
enum
Comm_t
{
kUSB
,
kEthernet
,
kEmulated
};
13
14
//==============================================================================
15
// Enumerated Constants
16
// These are defined by the SSP hardware spec
17
//==============================================================================
18
19
//Command to send to SSP
20
enum
commandConstants
{
21
cmdNone
= 0,
22
// Basic Commands
23
cmdRead
= 1,
24
cmdReadMask
= 2,
25
cmdWrite
= 3,
26
cmdWriteMask
= 4,
27
// Array Commands
28
cmdArrayRead
= 5,
29
cmdArrayWrite
= 6,
30
// Fifo Commands
31
cmdFifoRead
= 7,
32
cmdFifoWrite
= 8,
33
numCommands
34
};
35
36
//Holder for status returned from SSP
37
enum
statusConstants
{
38
statusNoError
= 0,
39
statusSendError
= 1,
40
statusReceiveError
= 2,
41
statusTimeoutError
= 3,
42
statusAddressError
= 4,
43
statusAlignError
= 5,
44
statusCommandError
= 6,
45
statusSizeError
= 7,
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
55
struct
MillisliceHeader
{
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
{
102
CtrlHeader
header
;
103
unsigned
int
data
[
MAX_CTRL_DATA
];
104
};
105
106
}
//namespace SSPDAQ
107
#endif
SSPDAQ::EventHeader
Definition:
anlTypes.hh:68
SSPDAQ::EventHeader::triggerID
unsigned short triggerID
Definition:
anlTypes.hh:72
SSPDAQ::cmdWriteMask
Definition:
anlTypes.hh:26
SSPDAQ::statusTimeoutError
Definition:
anlTypes.hh:41
SSPDAQ::EventHeader::group2
unsigned short group2
Definition:
anlTypes.hh:73
SSPDAQ::CtrlHeader::command
unsigned int command
Definition:
anlTypes.hh:93
SSPDAQ::statusConstants
statusConstants
Definition:
anlTypes.hh:37
SSPDAQ::EventHeader::length
unsigned short length
Definition:
anlTypes.hh:70
SSPDAQ::MillisliceHeader::startTime
unsigned long startTime
Definition:
anlTypes.hh:56
SSPDAQ::statusAddressError
Definition:
anlTypes.hh:42
SSPDAQ::statusWriteError
Definition:
anlTypes.hh:46
SSPDAQ::cmdFifoRead
Definition:
anlTypes.hh:31
SSPDAQ::CtrlHeader::size
unsigned int size
Definition:
anlTypes.hh:94
SSPDAQ::CtrlHeader::length
unsigned int length
Definition:
anlTypes.hh:91
SSPDAQ::MillisliceHeader
Definition:
anlTypes.hh:55
SSPDAQ::EventHeader::intSumHigh
unsigned short intSumHigh
Definition:
anlTypes.hh:81
SSPDAQ::kEmulated
Definition:
anlTypes.hh:12
SSPDAQ::Comm_t
Comm_t
Definition:
anlTypes.hh:12
SSPDAQ::cmdFifoWrite
Definition:
anlTypes.hh:32
SSPDAQ::statusSendError
Definition:
anlTypes.hh:39
SSPDAQ::MillisliceHeader::triggerTime
unsigned long triggerTime
Definition:
anlTypes.hh:58
SSPDAQ::cmdRead
Definition:
anlTypes.hh:23
SSPDAQ::commandConstants
commandConstants
Definition:
anlTypes.hh:20
SSPDAQ::CtrlHeader::address
unsigned int address
Definition:
anlTypes.hh:92
SSPDAQ::EventHeader::preriseLow
unsigned short preriseLow
Definition:
anlTypes.hh:79
SSPDAQ::EventHeader::group4
unsigned short group4
Definition:
anlTypes.hh:80
SSPDAQ::CtrlHeader
Definition:
anlTypes.hh:90
SSPDAQ::cmdReadMask
Definition:
anlTypes.hh:24
SSPDAQ::MillisliceHeader::nTriggers
unsigned int nTriggers
Definition:
anlTypes.hh:60
SSPDAQ::statusNoError
Definition:
anlTypes.hh:38
SSPDAQ::MillisliceHeader::endTime
unsigned long endTime
Definition:
anlTypes.hh:57
make_THn_beam_input.data
data
Definition:
make_THn_beam_input.py:80
SSPDAQ
Definition:
anlTypes.hh:9
SSPDAQ::CtrlPacket
Definition:
anlTypes.hh:101
SSPDAQ::statusReceiveError
Definition:
anlTypes.hh:40
SSPDAQ::statusAlignError
Definition:
anlTypes.hh:43
SSPDAQ::EventHeader::peakSumLow
unsigned short peakSumLow
Definition:
anlTypes.hh:77
SSPDAQ::MillisliceHeader::sizeInUInts
static const size_t sizeInUInts
Definition:
anlTypes.hh:63
SSPDAQ::cmdArrayRead
Definition:
anlTypes.hh:28
SSPDAQ::statusCommandError
Definition:
anlTypes.hh:44
SSPDAQ::kUSB
Definition:
anlTypes.hh:12
SSPDAQ::EventHeader::header
unsigned int header
Definition:
anlTypes.hh:69
SSPDAQ::statusSizeError
Definition:
anlTypes.hh:45
MAX_CTRL_DATA
#define MAX_CTRL_DATA
Definition:
anlTypes.hh:7
SSPDAQ::CtrlPacket::header
CtrlHeader header
Definition:
anlTypes.hh:102
SSPDAQ::cmdWrite
Definition:
anlTypes.hh:25
SSPDAQ::EventHeader::baseline
unsigned short baseline
Definition:
anlTypes.hh:82
SSPDAQ::numCommands
Definition:
anlTypes.hh:33
SSPDAQ::kEthernet
Definition:
anlTypes.hh:12
SSPDAQ::CtrlHeader::status
unsigned int status
Definition:
anlTypes.hh:95
SSPDAQ::cmdArrayWrite
Definition:
anlTypes.hh:29
SSPDAQ::MillisliceHeader::length
unsigned int length
Definition:
anlTypes.hh:59
SSPDAQ::EventHeader::group1
unsigned short group1
Definition:
anlTypes.hh:71
SSPDAQ::MillisliceHeader::triggerType
unsigned int triggerType
Definition:
anlTypes.hh:61
SSPDAQ::cmdNone
Definition:
anlTypes.hh:21
SSPDAQ::EventHeader::group3
unsigned short group3
Definition:
anlTypes.hh:78
Generated by
1.8.11