]>
Commit | Line | Data |
---|---|---|
e3b83c5e SS |
1 | /* |
2 | * This file is part of the libsigrok project. | |
3 | * | |
3f2c7c94 | 4 | * Copyright (C) 2013 poljar (Damir Jelić) <poljarinho@gmail.com> |
e3b83c5e SS |
5 | * |
6 | * This program is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | */ | |
19 | ||
20 | #ifndef LIBSIGROK_HARDWARE_LECROY_XSTREAM_PROTOCOL_H | |
21 | #define LIBSIGROK_HARDWARE_LECROY_XSTREAM_PROTOCOL_H | |
22 | ||
e3b83c5e | 23 | #include <glib.h> |
3f2c7c94 SS |
24 | #include <stdint.h> |
25 | #include <string.h> | |
e3b83c5e SS |
26 | #include <libsigrok/libsigrok.h> |
27 | #include "libsigrok-internal.h" | |
28 | ||
29 | #define LOG_PREFIX "lecroy-xstream" | |
30 | ||
3f2c7c94 SS |
31 | #define MAX_INSTRUMENT_VERSIONS 10 |
32 | #define MAX_COMMAND_SIZE 48 | |
33 | #define MAX_ANALOG_CHANNEL_COUNT 4 | |
34 | ||
35 | struct scope_config { | |
36 | const char *name[MAX_INSTRUMENT_VERSIONS]; | |
37 | const uint8_t analog_channels; | |
38 | ||
39 | const char *(*analog_names)[]; | |
40 | ||
3f2c7c94 SS |
41 | const char *(*coupling_options)[]; |
42 | const uint8_t num_coupling_options; | |
43 | ||
44 | const char *(*trigger_sources)[]; | |
45 | const uint8_t num_trigger_sources; | |
46 | ||
47 | const char *(*trigger_slopes)[]; | |
692716f5 | 48 | const uint8_t num_trigger_slopes; |
3f2c7c94 | 49 | |
76f0fa5d | 50 | const uint64_t (*timebases)[][2]; |
3f2c7c94 SS |
51 | const uint8_t num_timebases; |
52 | ||
76f0fa5d | 53 | const uint64_t (*vdivs)[][2]; |
3f2c7c94 SS |
54 | const uint8_t num_vdivs; |
55 | ||
56 | const uint8_t num_xdivs; | |
57 | const uint8_t num_ydivs; | |
58 | }; | |
59 | ||
60 | struct analog_channel_state { | |
61 | int coupling; | |
62 | ||
63 | int vdiv; | |
64 | float vertical_offset; | |
65 | ||
66 | gboolean state; | |
67 | }; | |
68 | ||
69 | struct scope_state { | |
70 | struct analog_channel_state *analog_channels; | |
71 | ||
72 | int timebase; | |
73 | float horiz_triggerpos; | |
74 | ||
75 | int trigger_source; | |
76 | int trigger_slope; | |
77 | uint64_t sample_rate; | |
78 | }; | |
79 | ||
e3b83c5e | 80 | struct dev_context { |
3f2c7c94 SS |
81 | const void *model_config; |
82 | void *model_state; | |
e3b83c5e | 83 | |
3f2c7c94 | 84 | struct sr_channel_group **analog_groups; |
e3b83c5e | 85 | |
3f2c7c94 SS |
86 | GSList *enabled_channels; |
87 | GSList *current_channel; | |
88 | uint64_t num_frames; | |
e3b83c5e | 89 | |
3f2c7c94 | 90 | uint64_t frame_limit; |
e3b83c5e SS |
91 | }; |
92 | ||
3f2c7c94 SS |
93 | SR_PRIV int lecroy_xstream_init_device(struct sr_dev_inst *sdi); |
94 | SR_PRIV int lecroy_xstream_request_data(const struct sr_dev_inst *sdi); | |
e3b83c5e SS |
95 | SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data); |
96 | ||
3f2c7c94 SS |
97 | SR_PRIV void lecroy_xstream_state_free(struct scope_state *state); |
98 | SR_PRIV int lecroy_xstream_state_get(struct sr_dev_inst *sdi); | |
79100d4e SA |
99 | SR_PRIV int lecroy_xstream_channel_state_set(const struct sr_dev_inst *sdi, |
100 | const int ch_index, gboolean ch_state); | |
e0b6855b SA |
101 | SR_PRIV int lecroy_xstream_update_sample_rate(const struct sr_dev_inst *sdi, |
102 | int num_of_samples); | |
3f2c7c94 | 103 | |
e3b83c5e | 104 | #endif |