1 | #ifndef FADFORMAT_H_SEEN
|
---|
2 | #define FADFORMAT_H_SEEN
|
---|
3 |
|
---|
4 | #include <stdint.h>
|
---|
5 |
|
---|
6 | //
|
---|
7 | // Commands for FAD
|
---|
8 | //
|
---|
9 | #define CMD_Start 0x2200 // Start Run
|
---|
10 | #define CMD_Stop 0x2300 // Stop Run
|
---|
11 | #define CMD_mode_command 0x3000 // Set Socket mode to: command mode
|
---|
12 | #define CMD_mode_all_sockets 0x3100// Set Socket mode to: daq mode
|
---|
13 |
|
---|
14 | #define CMD_Trigger 0xA000 // single trigger
|
---|
15 | #define CMD_DENABLE 0x0600 // DENABLE line HIGH
|
---|
16 | #define CMD_DDISABLE 0x0700 // DENABLE line LOW
|
---|
17 | #define CMD_DWRITE_RUN 0x0800 // DWRITE possibly HIGH
|
---|
18 | #define CMD_DWRITE_STOP 0x0900 // DWRITE always LOW
|
---|
19 | #define CMD_SCLK_ON 0x1000
|
---|
20 | #define CMD_SCLK_OFF 0x1100
|
---|
21 | #define CMD_PS_DIRINC 0x1200
|
---|
22 | #define CMD_PS_DIRDEC 0x1300
|
---|
23 | #define CMD_PS_DO 0x1400
|
---|
24 | #define CMD_PS_RESET 0x1700
|
---|
25 | #define CMD_SRCLK_ON 0x1500
|
---|
26 | #define CMD_SRCLK_OFF 0x1600
|
---|
27 | #define CMD_Trigger_C 0xB000 // continous trigger
|
---|
28 | #define CMD_Trigger_S 0x2000 // stop continous trigger
|
---|
29 |
|
---|
30 | #define CMD_Execute 0x0400 // only after 'execute' Config-RAM changes will have an effect
|
---|
31 | #define CMD_Write 0x0500 // write to Config-RAM
|
---|
32 | #define CMD_Read 0x0A00 // read from Config-RAM
|
---|
33 | #define CMD_RESET_TRIGGER_ID 0x2A00
|
---|
34 |
|
---|
35 | #define CMD_TRIGGERS_ON 0x1800 // enables the trigger line
|
---|
36 | #define CMD_TRIGGERS_OFF 0x1900 // disables the trigger line
|
---|
37 |
|
---|
38 | //
|
---|
39 | // Other definitions
|
---|
40 | //
|
---|
41 | #define MAX_ADDR 0xFF // highest address in Config-RAM
|
---|
42 | #define BADDR_ROI 0x00 // Baseaddress ROI-Values
|
---|
43 | #define BADDR_DAC 0x24 // Baseaddress DAC-Values
|
---|
44 | #define BADDR_CONT_TRIGGER_TIME 0x2C // Baseaddress for the continouus trigger timing.
|
---|
45 | #define ADDR_RUNNUMBER 0x2D //
|
---|
46 | #define MAX_VAL 65535
|
---|
47 | #define MAX_ROIVAL 1024
|
---|
48 | #define MAX_DACVAL 65535
|
---|
49 |
|
---|
50 | const unsigned int NChannels = 9;
|
---|
51 | const unsigned int NBins = 1024;
|
---|
52 | const unsigned int NChips = 4;
|
---|
53 | const unsigned int NTemp = 4;
|
---|
54 | const unsigned int NDAC = 8;
|
---|
55 |
|
---|
56 | //
|
---|
57 | // Data structures
|
---|
58 | //
|
---|
59 | typedef struct {
|
---|
60 |
|
---|
61 | uint16_t start_package_flag;
|
---|
62 | uint16_t package_length;
|
---|
63 | uint16_t version_no;
|
---|
64 | uint16_t PLLLCK;
|
---|
65 |
|
---|
66 | uint16_t trigger_crc;
|
---|
67 | uint16_t trigger_type;
|
---|
68 | uint32_t trigger_id;
|
---|
69 |
|
---|
70 | uint32_t fad_evt_counter;
|
---|
71 | uint32_t REFCLK_frequency;
|
---|
72 |
|
---|
73 | uint16_t board_id;
|
---|
74 | uint8_t zeroes;
|
---|
75 | int8_t adc_clock_phase_shift;
|
---|
76 | uint16_t number_of_triggers_to_generate;
|
---|
77 | uint16_t trigger_generator_prescaler;
|
---|
78 |
|
---|
79 | uint64_t DNA;
|
---|
80 |
|
---|
81 | uint32_t time;
|
---|
82 | uint32_t runnumber;
|
---|
83 |
|
---|
84 | int16_t drs_temperature[NTemp];
|
---|
85 |
|
---|
86 | uint16_t dac[NDAC];
|
---|
87 |
|
---|
88 | } __attribute__((__packed__)) PEVNT_HEADER;
|
---|
89 |
|
---|
90 | typedef struct {
|
---|
91 | uint16_t id;
|
---|
92 | uint16_t start_cell;
|
---|
93 | uint16_t roi;
|
---|
94 | uint16_t filling;
|
---|
95 | uint16_t adc_data[];
|
---|
96 | } __attribute__((__packed__)) PCHANNEL;
|
---|
97 | typedef struct {
|
---|
98 | uint16_t package_crc;
|
---|
99 | uint16_t end_package_flag;
|
---|
100 | } __attribute__((__packed__)) PEVNT_FOOTER;
|
---|
101 |
|
---|
102 | #endif
|
---|