source: trunk/FACT++/src/FAD.h@ 16542

Last change on this file since 16542 was 16524, checked in by tbretz, 11 years ago
Simplified GUI_STATS
File size: 4.8 KB
Line 
1#ifndef FACT_FAD_H
2#define FACT_FAD_H
3
4//---------------------------------------------------------------
5//
6// FAD internal structures
7//
8//---------------------------------------------------------------
9
10#define NTemp 4
11#define NDAC 8
12
13typedef struct {
14
15 uint16_t start_package_flag;
16 uint16_t package_length;
17 uint16_t version_no;
18 uint16_t PLLLCK;
19
20 uint16_t trigger_crc;
21 uint16_t trigger_type;
22 uint32_t trigger_id;
23
24 uint32_t fad_evt_counter;
25 uint32_t REFCLK_frequency;
26
27 uint16_t board_id;
28 uint8_t zeroes;
29 int8_t adc_clock_phase_shift;
30 uint16_t number_of_triggers_to_generate;
31 uint16_t trigger_generator_prescaler;
32
33 uint64_t DNA;
34
35 uint32_t time;
36 uint32_t runnumber;
37
38 int16_t drs_temperature[NTemp];
39
40 uint16_t dac[NDAC];
41
42} __attribute__((__packed__)) PEVNT_HEADER;
43
44typedef struct {
45uint16_t id;
46uint16_t start_cell;
47uint16_t roi;
48uint16_t filling;
49 int16_t adc_data[];
50} __attribute__((__packed__)) PCHANNEL;
51
52
53typedef struct {
54uint16_t package_crc;
55uint16_t end_package_flag;
56} __attribute__((__packed__)) PEVNT_FOOTER;
57
58#define NBOARDS 40 // max. number of boards
59#define NPIX 1440 // max. number of pixels
60#define NTMARK 160 // max. number of timeMarker signals
61
62//---------------------------------------------------------------
63//
64// Data structures
65//
66//---------------------------------------------------------------
67
68typedef struct _EVENT {
69 uint16_t Roi ; // #slices per pixel (same for all pixels)
70 uint16_t RoiTM ; // #slices per pixel (same for all tmarks) [ 0 or Roi ]
71 uint32_t EventNum ; // EventNumber as from FADs
72 uint32_t TriggerNum ; // EventNumber as from FTM
73 uint16_t TriggerType ; // Trigger Type from FTM
74
75 uint32_t NumBoards ; // number of active boards included
76 uint8_t Errors[4] ; // indicator for mismatches
77
78 uint32_t SoftTrig ; // SoftTrigger Info (TBD)
79 uint32_t PCTime ; // epoch
80 uint32_t PCUsec ; // micro-seconds
81
82 uint32_t BoardTime[NBOARDS];//
83
84 int16_t StartPix[NPIX]; // First Channel per Pixel (Pixels sorted according Software ID) ; -1 if not filled
85
86 int16_t StartTM[NTMARK]; // First Channel for TimeMark (sorted Hardware ID) ; -1 if not filled
87
88 int16_t Adc_Data[]; // final length defined by malloc ....
89
90} __attribute__((__packed__)) EVENT ;
91
92//---------------------------------------------------------------
93
94struct RUN_HEAD
95{
96 uint32_t Version ;
97 uint32_t RunType ;
98 uint32_t RunTime ; //unix epoch for first event
99 uint32_t RunUsec ; //microseconds
100 uint16_t NBoard ; //#boards (always 40)
101 uint16_t NPix ; //#pixels (always 1440)
102 uint16_t NTm ; //#TM (always 160)
103 uint16_t Nroi ; //roi for pixels
104 uint16_t NroiTM ; //roi for TM <=0 if TM is empty
105
106//headers of all FAD-boards for first event ==> all FAD configs
107 PEVNT_HEADER FADhead[NBOARDS]; // [ NBoards ] sorted Board Headers (according Hardware ID)
108
109 RUN_HEAD() : Version(1), RunType(-1), NBoard(NBOARDS), NPix(NPIX), NTm(NTMARK)
110 {
111 }
112
113
114//do we also have info about FTM config we want to add here ???
115} __attribute__((__packed__));
116
117
118//---------------------------------------------------------------
119
120// FIXME: This doesn't neet to be here... it is inlcuded in all
121// data processors
122
123#include <netinet/in.h>
124
125typedef struct {
126 struct sockaddr_in sockAddr ;
127 int sockDef ; //<0 not defined/ ==0 not to be used/ >0 used
128} FACT_SOCK ; //internal to eventbuilder
129
130
131//---------------------------------------------------------------
132
133typedef struct {
134 //info about (current state of) the buffer
135 uint32_t bufNew ; //# incomplete events in buffer (evtCtrl)
136 uint32_t bufEvt ; //# complete events in buffer (primaryQueue)
137 uint32_t bufWrite ; //# events in write queue (secondaryQueue)
138 uint32_t bufProc ; //# events in processing queue (processingQueue1)
139 uint32_t bufTot ; //# total events currently in buffer (this corresponds to totMem)
140
141 uint64_t totMem; //# Bytes available in Buffer
142 uint64_t usdMem; //# Bytes currently used
143 uint64_t maxMem; //max # Bytes used during past cycle
144
145 //rates
146 int32_t deltaT ; //time in milli-seconds for rates
147 int32_t rateNew ; //#New start events recieved
148 int32_t rateWrite ; //#Complete events written (or flushed)
149
150 //connections
151 int8_t numConn[NBOARDS] ; //#connections per board (at the moment)
152 int32_t rateBytes[NBOARDS]; //#Bytes read this cycle **
153 int64_t totBytes[NBOARDS]; //#Bytes read (counter)
154
155
156 // ** // if counter and rates exist, do only update the rates in
157 // ** // real time;
158 // ** // counters will be updated only once per cycle based on rates
159
160} __attribute__((__packed__)) GUI_STAT ; //EventBuilder Status
161
162#endif
Note: See TracBrowser for help on using the repository browser.