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 
161  SRC_NONE = 2,
163  };
164 
165 
172  SELECT_TRIGGER_I_SAME_CHAN = 1,
176  };
177 
178 
184  struct SETTINGS {
185  std::vector<M2K_TRIGGER_CONDITION_ANALOG> analog_condition;
186  std::vector<M2K_TRIGGER_CONDITION_DIGITAL> digital_condition;
187  std::vector<int> raw_level;
188  std::vector<double> level;
189  std::vector<double> hysteresis;
190  std::vector<M2K_TRIGGER_MODE> mode;
192  int delay;
193  };
194 
195 
200  struct CONTEXT_INFO {
201  std::string id_vendor;
202  std::string id_product;
203  std::string manufacturer;
204  std::string product;
205  std::string serial;
206  std::string uri;
207  };
208 
209 
213  struct IIO_OBJECTS {
214  std::vector<iio_channel*> channels_in;
215  std::vector<iio_channel*> channels_out;
216  std::vector<iio_device*> devices;
217  std::vector<iio_buffer*> buffers_rx;
218  std::vector<iio_buffer*> buffers_tx;
219  iio_context* context;
220  };
221 
227  unsigned int major;
228  unsigned int minor;
229  char git_tag[8];
230  };
231 }
232 
233 
234 #endif
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:205
std::string uri
IIO context URI.
Definition: enums.hpp:206
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:191
char git_tag[8]
git tag
Definition: enums.hpp:229
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:158
std::string product
Product name extracted from IIO context.
Definition: enums.hpp:204
M2K_TRIGGER_CONDITION_DIGITAL
Condition of triggering.
Definition: enums.hpp:109
std::string manufacturer
Manufacturer extracted from IIO context.
Definition: enums.hpp:203
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:201
M2K_EXCEPTION_TYPE
M2k exception types.
Definition: enums.hpp:82
SRC_DISABLED - block the DigitalIn interface.
Definition: enums.hpp:162
std::vector< M2K_TRIGGER_MODE > mode
Triggering mode.
Definition: enums.hpp:190
int delay
Trigger's delay.
Definition: enums.hpp:192
SELECT_DIGITAL_IN - forwards trigger events from DigitalIn interface.
Definition: enums.hpp:175
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:186
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:226
std::vector< double > hysteresis
Trigger's hysteresis.
Definition: enums.hpp:189
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:228
SELECT_NONE - no trigger event is forwarded.
Definition: enums.hpp:171
Additional information about the context.
Definition: enums.hpp:200
M2K_TRIGGER_OUT_SELECT
Select which trigger event will be forwarded on TO pin (trigger out)
Definition: enums.hpp:170
std::vector< double > level
Trigger's level.
Definition: enums.hpp:188
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:184
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:159
SRC_ANALOG_IN - trigger events on the AnalogIn interface trigger the DigitalIn interface.
Definition: enums.hpp:160
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:187
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:161
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:185
SELECT_ANALOG_IN - forwards trigger events from AnalogIn interface.
Definition: enums.hpp:174
std::string id_product
Product ID extracted from IIO context.
Definition: enums.hpp:202
SELECT_TRIGGER_IN - forwards trigger events from TI pin(trigger in)
Definition: enums.hpp:173
unsigned int major
major version
Definition: enums.hpp:227