DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
cib_data_fmt.h
Go to the documentation of this file.
1/*
2 * cib_data_fmt.h
3 *
4 * Created on: Jun 5, 2024
5 * Author: Nuno Barros
6 */
7
8#ifndef COMMON_CIB_DATA_FMT_H_
9#define COMMON_CIB_DATA_FMT_H_
10extern "C"
11{
12#include <inttypes.h>
13}
14#include <cstdint>
15#include <cstddef>
16#include <string>
17
18#ifdef CIB_DUNEDAQ
19namespace dunedaq {
20#endif
21
22 namespace cib
23 {
24 typedef struct mapped_mem_t
25 {
26 uintptr_t p_addr;
27 uintptr_t v_addr;
28 } mapped_mem_t;
29
43
44 typedef struct motor_t
45 {
46 uint16_t index;
47 int32_t pos_i;
48 uint32_t dir;
49 } motor_t;
50
51 namespace limits
52 {
53
54 typedef struct motor_limits_t
55 {
56 int32_t m1_min;
57 int32_t m1_max;
58 int32_t m2_min;
59 int32_t m2_max;
60 int32_t m3_min;
61 int32_t m3_max;
62 } motor_limits_t;
63
64 }
65
66 namespace daq
67 {
68
69 typedef struct iols_trigger_t
70 {
71 // lsb
72 uint32_t pos_m3 : 17;
73 uint32_t pos_m2_lsb : 15;
74 uint32_t pos_m2_msb : 7;
75 uint32_t pos_m1 : 22;
76 uint32_t padding : 3;
77 uint64_t timestamp;
78 // msb
79 static const uint32_t mask_m3 = 0x1FFFF;
80 static const uint32_t bitmask_m3 = 0x1FFFF;
81 static const uint32_t mask_m2_lsb = 0xFFFE0000;
82 static const uint32_t bitmask_m2_lsb = 0xEFFF;
83
84 static const uint32_t mask_m2_msb = 0x7F;
85 static const uint32_t bitmask_m2_msb = 0x3F8000;
86 static const uint32_t bitmask_m2 = 0x3FFFFF;
87 static const uint32_t mask_m1 = 0x1FFFFF80;
88 static const uint32_t bitmask_m1 = 0x3FFFFF;
89
90 static size_t const size_bytes = 16;
91
92 } iols_trigger_t;
93
97
98 typedef struct tcp_header_t
99 {
100 typedef uint16_t pkt_size_t;
101 typedef uint8_t seq_size_t;
102 typedef uint8_t ver_size_t;
103 uint16_t packet_size : 16; // Size of the data content in bytes
104 uint8_t sequence_id : 8; // packet order...rotates every 256
105 uint8_t format_version : 8;
106 static size_t const size_bytes = sizeof(uint32_t);
107 static size_t const n_bits_size = 16;
108 static size_t const n_bits_sequence_id = 8;
109 static size_t const n_bits_version = 8;
110 uint16_t get_version() {return ((format_version >> 4 ) & 0xF);}
111 void set_version(uint16_t v) {format_version = ((v & 0xF) << 4) | (~v & 0xF);}
112 } tcp_header_t;
113
114 typedef union tcp_header
115 {
117 uint32_t value;
118 } tcp_header;
119
120
121 // -- this should be the base structure to data taking and shipment
122 typedef struct iols_tcp_packet_t
123 {
126 } iols_tcp_packet_t;
127
128 typedef struct iols_feedback_msg_t
129 {
130 std::string sev;
131 std::string msg;
132 } iols_feedback_msg_t;
133
134
135 } // namespace daq
136
137 }
138#ifdef CIB_DUNEDAQ
139}
140#endif
141
142
143#endif /* COMMON_CIB_DATA_FMT_H_ */
Including ers headers.
Including Qt Headers.
mapped_mem_t gpio_motor_3
mapped_mem_t gpio_pdts
mapped_mem_t gpio_laser
mapped_mem_t gpio_motor_1
mapped_mem_t gpio_mon_0
mapped_mem_t gpio_motor_2
mapped_mem_t gpio_misc
mapped_mem_t gpio_align
mapped_mem_t gpio_mon_1
void set_version(uint16_t v)
int32_t pos_i
uint16_t index
uint32_t dir