]>
Commit | Line | Data |
---|---|---|
06a3e78a DJ |
1 | /* |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2013 poljar (Damir Jelić) <poljarinho@gmail.com> | |
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_HAMEG_HMO_PROTOCOL_H | |
21 | #define LIBSIGROK_HARDWARE_HAMEG_HMO_PROTOCOL_H | |
22 | ||
06a3e78a | 23 | #include <glib.h> |
13f2b9d7 DJ |
24 | #include <stdint.h> |
25 | #include <string.h> | |
06a3e78a DJ |
26 | #include "libsigrok.h" |
27 | #include "libsigrok-internal.h" | |
28 | ||
3544f848 | 29 | #define LOG_PREFIX "hameg-hmo" |
06a3e78a | 30 | |
13f2b9d7 DJ |
31 | #define MAX_INSTRUMENT_VERSIONS 10 |
32 | #define MAX_COMMAND_SIZE 31 | |
33 | ||
13f2b9d7 DJ |
34 | struct scope_config { |
35 | const char *name[MAX_INSTRUMENT_VERSIONS]; | |
36 | const uint8_t analog_channels; | |
37 | const uint8_t digital_channels; | |
38 | const uint8_t digital_pods; | |
39 | ||
40 | const char *(*analog_names)[]; | |
41 | const char *(*digital_names)[]; | |
42 | ||
43 | const int32_t (*hw_caps)[]; | |
44 | const uint8_t num_hwcaps; | |
45 | ||
46 | const int32_t (*analog_hwcaps)[]; | |
47 | const uint8_t num_analog_hwcaps; | |
48 | ||
49 | const char *(*coupling_options)[]; | |
50 | const uint8_t num_coupling_options; | |
51 | ||
52 | const char *(*trigger_sources)[]; | |
53 | const uint8_t num_trigger_sources; | |
54 | ||
55 | const char *(*trigger_slopes)[]; | |
56 | ||
57 | const uint64_t (*timebases)[][2]; | |
58 | const uint8_t num_timebases; | |
59 | ||
60 | const uint64_t (*vdivs)[][2]; | |
61 | const uint8_t num_vdivs; | |
62 | ||
63 | const uint8_t num_xdivs; | |
64 | const uint8_t num_ydivs; | |
65 | ||
66 | const char *(*scpi_dialect)[]; | |
67 | }; | |
68 | ||
69 | struct analog_channel_state { | |
70 | int coupling; | |
71 | ||
72 | float vdiv; | |
73 | float vertical_offset; | |
74 | ||
75 | gboolean state; | |
76 | }; | |
77 | ||
78 | struct scope_state { | |
79 | struct analog_channel_state *analog_channels; | |
80 | gboolean *digital_channels; | |
81 | gboolean *digital_pods; | |
82 | ||
83 | float timebase; | |
84 | float horiz_triggerpos; | |
85 | ||
86 | int trigger_source; | |
87 | int trigger_slope; | |
88 | }; | |
89 | ||
06a3e78a DJ |
90 | /** Private, per-device-instance driver context. */ |
91 | struct dev_context { | |
13f2b9d7 DJ |
92 | void *model_config; |
93 | void *model_state; | |
06a3e78a | 94 | |
13f2b9d7 DJ |
95 | struct sr_probe_group *analog_groups; |
96 | struct sr_probe_group *digital_groups; | |
06a3e78a | 97 | |
13f2b9d7 DJ |
98 | GSList *enabled_probes; |
99 | GSList *current_probe; | |
100 | uint64_t num_frames; | |
06a3e78a | 101 | |
13f2b9d7 | 102 | uint64_t frame_limit; |
06a3e78a DJ |
103 | }; |
104 | ||
13f2b9d7 DJ |
105 | SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi); |
106 | SR_PRIV int hmo_request_data(const struct sr_dev_inst *sdi); | |
719eff68 | 107 | SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data); |
13f2b9d7 | 108 | |
719eff68 UH |
109 | SR_PRIV struct scope_state *hmo_scope_state_new(struct scope_config *config); |
110 | SR_PRIV void hmo_scope_state_free(struct scope_state *state); | |
111 | SR_PRIV int hmo_scope_state_get(struct sr_dev_inst *sdi); | |
06a3e78a DJ |
112 | |
113 | #endif |