libm2k
enums.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Analog Devices Inc.
3  *
4  * This file is part of libm2k
5  * (see http://www.github.com/analogdevicesinc/libm2k).
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation, either version 2.1 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ENUMS_HPP
23 #define ENUMS_HPP
24 
25 #include <string>
26 #include <vector>
27 
28 extern "C" {
29  struct iio_context;
30  struct iio_device;
31  struct iio_channel;
32  struct iio_buffer;
33 }
39 namespace libm2k {
40 
44  enum CALIBRATION_MODE {
45  ADC_REF1,
46  ADC_REF2,
47  ADC_GND,
48  DAC,
49  NONE
50  };
51 
52 
60  double adc_gain_ch_1;
61  double adc_gain_ch_2;
64  double dac_a_gain;
65  double dac_b_gain;
66  };
67 
68 
72  enum GAIN_MODE {
73  LOW_GAIN,
74  HIGH_GAIN
75  };
76 
83  EXC_OUT_OF_RANGE = 0,
84  EXC_RUNTIME_ERROR = 1,
85  EXC_INVALID_PARAMETER = 2,
86  EXC_TIMEOUT = 3,
87  EXC_INVALID_FIRMWARE_VERSION = 4
88  };
89 
90 
97  RISING_EDGE_ANALOG = 0,
98  FALLING_EDGE_ANALOG = 1,
99  LOW_LEVEL_ANALOG = 2,
100  HIGH_LEVEL_ANALOG = 3
101  };
102 
103 
110  RISING_EDGE_DIGITAL = 0,
111  FALLING_EDGE_DIGITAL = 1,
112  LOW_LEVEL_DIGITAL = 2,
113  HIGH_LEVEL_DIGITAL = 3,
114  ANY_EDGE_DIGITAL = 4,
115  NO_TRIGGER_DIGITAL = 5,
116  };
117 
118 
124  ALWAYS = 0,
125  ANALOG = 1,
126  EXTERNAL = 2,
127  DIGITAL_OR_ANALOG = 3,
128  DIGITAL_AND_ANALOG = 4,
129  DIGITAL_XOR_ANALOG = 5,
130  N_DIGITAL_OR_ANALOG = 6,
131  N_DIGITAL_AND_ANALOG = 7,
132  N_DIGITAL_XOR_ANALOG = 8,
133  };
134 
135 
141  CHANNEL_1 = 0,
142  CHANNEL_2 = 1,
143  CHANNEL_1_OR_CHANNEL_2 = 2,
144  CHANNEL_1_AND_CHANNEL_2 = 3,
145  CHANNEL_1_XOR_CHANNEL_2 = 4,
147  CHANNEL_1_OR_SRC_LOGIC_ANALYZER = 6,
148  CHANNEL_2_OR_SRC_LOGIC_ANALYZER = 7,
149  CHANNEL_1_OR_CHANNEL_2_OR_SRC_LOGIC_ANALYZER = 8,
150  NO_SOURCE = 9,
151  };
152 
153 
159  TRIGGER_NONE = 0,
160  TRIGGER_TI = 1,
161  TRIGGER_ADC = 2,
162  TRIGGER_LA = 3,
163  };
164 
170  NONE_OUT = 0,
171  LOW_LEVEL_OUT = 1,
172  HIGH_LEVEL_OUT = 2,
173  ANY_EDGE_OUT = 3,
174  RISING_EDGE_OUT = 4,
175  FALLING_EDGE_OUT = 5,
176  };
177 
183  DISABLED = 0,
184  START = 1,
185  STOP = 2,
186  };
187 
188 
196  SRC_NONE = 2,
198  };
199 
200 
207  SELECT_TRIGGER_I_SAME_CHAN = 1,
211  };
212 
213 
219  struct SETTINGS {
220  std::vector<M2K_TRIGGER_CONDITION_ANALOG> analog_condition;
221  std::vector<M2K_TRIGGER_CONDITION_DIGITAL> digital_condition;
222  std::vector<int> raw_level;
223  std::vector<double> level;
224  std::vector<double> hysteresis;
225  std::vector<M2K_TRIGGER_MODE> mode;
227  int delay;
228  };
229 
230 
235  struct CONTEXT_INFO {
236  std::string id_vendor;
237  std::string id_product;
238  std::string manufacturer;
239  std::string product;
240  std::string serial;
241  std::string uri;
242  };
243 
244 
248  struct IIO_OBJECTS {
249  std::vector<iio_channel*> channels_in;
250  std::vector<iio_channel*> channels_out;
251  std::vector<iio_device*> devices;
252  std::vector<iio_buffer*> buffers_rx;
253  std::vector<iio_buffer*> buffers_tx;
254  iio_context* context;
255  };
256 
262  unsigned int major;
263  unsigned int minor;
264  char git_tag[8];
265  };
266 }
267 
268 
269 #endif
M2K_TRIGGER_STATUS_ANALOG_OUT
The status value determines the action that the output interface will take when the trigger condition...
Definition: enums.hpp:182
M2K_TRIGGER_SOURCE_OUT
Selects the source trigger for the output interfaces.
Definition: enums.hpp:158
double dac_b_gain
DAC calibration gain - channel 2.
Definition: enums.hpp:65
Calibration parameters of m2k.
Definition: enums.hpp:57
std::string serial
Serial number.
Definition: enums.hpp:240
std::string uri
IIO context URI.
Definition: enums.hpp:241
double adc_gain_ch_2
ADC calibration gain - channel 2.
Definition: enums.hpp:61
int adc_offset_ch_2
ADC calibration offset - channel 2.
Definition: enums.hpp:59
M2K_TRIGGER_SOURCE_ANALOG trigger_source
Triggering source.
Definition: enums.hpp:226
char git_tag[8]
git tag
Definition: enums.hpp:264
SRC_DIGITAL_IN - trigger events on the DigitalIn interface trigger the AnalogIn interface.
Definition: enums.hpp:146
M2K_TRIGGER_SOURCE_DIGITAL
Select the source for the digital trigger.
Definition: enums.hpp:193
std::string product
Product name extracted from IIO context.
Definition: enums.hpp:239
M2K_TRIGGER_CONDITION_DIGITAL
Condition of triggering.
Definition: enums.hpp:109
M2K_TRIGGER_CONDITION_OUT
Trigger condition when the source for M2K_TRIGGER_SOURCE_OUT is TRIGGER_TI.
Definition: enums.hpp:169
std::string manufacturer
Manufacturer extracted from IIO context.
Definition: enums.hpp:238
CHANNEL_2 - trigger events on analog CHANNEL_2 trigger the AnalogIn interface.
Definition: enums.hpp:142
std::string id_vendor
Vendor ID extracted from IIO context.
Definition: enums.hpp:236
M2K_EXCEPTION_TYPE
M2k exception types.
Definition: enums.hpp:82
SRC_DISABLED - block the DigitalIn interface.
Definition: enums.hpp:197
std::vector< M2K_TRIGGER_MODE > mode
Triggering mode.
Definition: enums.hpp:225
int delay
Trigger's delay.
Definition: enums.hpp:227
SELECT_DIGITAL_IN - forwards trigger events from DigitalIn interface.
Definition: enums.hpp:210
NO_SOURCE - block the AnalogIn interface.
Definition: enums.hpp:150
std::vector< M2K_TRIGGER_CONDITION_DIGITAL > digital_condition
Digital trigger's condition.
Definition: enums.hpp:221
M2K_TRIGGER_CONDITION_ANALOG
Condition of triggering.
Definition: enums.hpp:96
CHANNEL_1 - trigger events on analog CHANNEL_1 trigger the AnalogIn interface.
Definition: enums.hpp:141
The version of the backend.
Definition: enums.hpp:261
std::vector< double > hysteresis
Trigger's hysteresis.
Definition: enums.hpp:224
M2K_TRIGGER_MODE
Select the mode for the analog trigger.
Definition: enums.hpp:123
EXTERNAL - Trigger condition specified only by external trigger (TI)
Definition: enums.hpp:126
unsigned int minor
minor version
Definition: enums.hpp:263
SELECT_NONE - no trigger event is forwarded.
Definition: enums.hpp:206
Additional information about the context.
Definition: enums.hpp:235
M2K_TRIGGER_OUT_SELECT
Select which trigger event will be forwarded on TO pin (trigger out)
Definition: enums.hpp:205
std::vector< double > level
Trigger's level.
Definition: enums.hpp:223
double adc_gain_ch_1
ADC calibration gain - channel 1.
Definition: enums.hpp:60
int dac_a_offset
DAC calibration offset - channel 1.
Definition: enums.hpp:62
Triggering system.
Definition: enums.hpp:219
int dac_b_offset
DAC calibration offset - channel 2.
Definition: enums.hpp:63
ANALOG - Trigger condition specified only by analog trigger (CH1 and CH2)
Definition: enums.hpp:125
SRC_TRIGGER_IN - trigger events on the TI(trigger in) pin trigger the DigitalIn interface.
Definition: enums.hpp:194
SRC_ANALOG_IN - trigger events on the AnalogIn interface trigger the DigitalIn interface.
Definition: enums.hpp:195
ALWAYS - Disable analog trigger;.
Definition: enums.hpp:124
M2K_TRIGGER_SOURCE_ANALOG
Select the source for the analog trigger.
Definition: enums.hpp:140
std::vector< int > raw_level
Trigger's raw level.
Definition: enums.hpp:222
int adc_offset_ch_1
ADC calibration offset - channel 1.
Definition: enums.hpp:58
SRC_NONE - trigger events on the DigitalIn are conditioned by the internal digital trigger structure.
Definition: enums.hpp:196
double dac_a_gain
DAC calibration gain - channel 1.
Definition: enums.hpp:64
std::vector< M2K_TRIGGER_CONDITION_ANALOG > analog_condition
Analogical trigger's condition.
Definition: enums.hpp:220
SELECT_ANALOG_IN - forwards trigger events from AnalogIn interface.
Definition: enums.hpp:209
std::string id_product
Product ID extracted from IIO context.
Definition: enums.hpp:237
SELECT_TRIGGER_IN - forwards trigger events from TI pin(trigger in)
Definition: enums.hpp:208
unsigned int major
major version
Definition: enums.hpp:262