TSPD-ADQ EPICS device support  1.2.0
ADQDefinition.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018 Cosylab d.d.
3 // This software is distributed under the terms found
4 // in file LICENSE.txt that is included with this distribution.
5 //
6 
7 #ifndef ADQDEFINITION_H
8 #define ADQDEFINITION_H
9 
10 #include <iostream>
11 #include <nds3/nds.h>
12 #include <sstream>
13 #include <unistd.h>
14 
23 #define PINI true
24 
28 #define CELSIUS_CONVERT 1 / 256
29 
33 #define TEMP_LOCAL 0
34 
38 #define TEMP_ADC_ONE 1
39 
43 #define TEMP_ADC_TWO 2
44 
48 #define TEMP_FPGA 3
49 
53 #define TEMP_DIOD 4
54 
58 #define DATA_MAX_ELEMENTS (4 * 1024 * 1024)
59 
63 #define BUFFERSIZE_ADQ14 (512 * 1024)
64 
68 #define BUFFERSIZE_ADQ7 (256 * 1024)
69 
73 #define CHANNEL_COUNT_MAX 8
74 
78 #define EXTERN_TRIG_COUNT 1
79 
83 #define STRING_ENUM 32
84 
88 #define GROUP_CHAN_DEVICE "-ChGrp"
89 
93 #define INFO_DEVICE "-Info"
94 
99 #define SLEEP(interval) usleep(1000 * interval)
100 
104 #define MIN(a, b) ((a) > (b) ? (b) : (a))
105 
109 #define UNUSED(x) (void)x
110 
115 #define ADQNDS_MSG_INFOLOG_PV(text) \
116  do \
117  { \
118  struct timespec now = { 0, 0 }; \
119  clock_gettime(CLOCK_REALTIME, &now); \
120  m_logMsgPV.push(now, std::string(text)); \
121  ndsInfoStream(m_node) << std::string(text) << std::endl; \
122  } while (0)
123 
130 #define ADQNDS_MSG_ERRLOG_PV_GOTO_FINISH(status, text) \
131  do \
132  { \
133  if (!status) \
134  { \
135  struct timespec now = { 0, 0 }; \
136  clock_gettime(CLOCK_REALTIME, &now); \
137  m_logMsgPV.push(now, std::string(text)); \
138  ndsErrorStream(m_node) << std::string(text) << std::endl; \
139  goto finish; \
140  } \
141  } while (0)
142 
149 #define ADQNDS_MSG_WARNLOG_PV(status, text) \
150  do \
151  { \
152  if (!status) \
153  { \
154  struct timespec now = { 0, 0 }; \
155  clock_gettime(CLOCK_REALTIME, &now); \
156  m_logMsgPV.push(now, std::string(text)); \
157  ndsWarningStream(m_node) << std::string(text) << std::endl; \
158  } \
159  } while (0)
160 
161 #endif /* ADQDEFINITION_H */