]>
Commit | Line | Data |
---|---|---|
00b2a092 AG |
1 | /* |
2 | * This file is part of the libsigrok project. | |
3 | * | |
4 | * Copyright (C) 2016 Alexandru Gagniuc <mr.nuke.me@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_HP_3457A_PROTOCOL_H | |
21 | #define LIBSIGROK_HARDWARE_HP_3457A_PROTOCOL_H | |
22 | ||
23 | #include <stdint.h> | |
00b2a092 AG |
24 | #include "libsigrok-internal.h" |
25 | ||
26 | #define LOG_PREFIX "hp-3457a" | |
27 | ||
db23af7f AG |
28 | /* Information about the rear card option currently installed. */ |
29 | enum card_type { | |
30 | CARD_UNKNOWN, | |
31 | REAR_TERMINALS, | |
32 | HP_44491A, | |
33 | HP_44492A, | |
34 | }; | |
35 | ||
36 | struct rear_card_info { | |
37 | unsigned int card_id; | |
38 | enum card_type type; | |
39 | const char *name; | |
40 | const char *cg_name; | |
9a093be9 | 41 | unsigned int num_channels; |
db23af7f AG |
42 | }; |
43 | ||
44 | /* Possible states in an acquisition. */ | |
45 | enum acquisition_state { | |
46 | ACQ_TRIGGERED_MEASUREMENT, | |
47 | ACQ_REQUESTED_HIRES, | |
48 | ACQ_REQUESTED_RANGE, | |
49 | ACQ_GOT_MEASUREMENT, | |
9a093be9 AG |
50 | ACQ_REQUESTED_CHANNEL_SYNC, |
51 | ACQ_GOT_CHANNEL_SYNC, | |
52 | }; | |
53 | ||
54 | /* Channel connector (front terminals, or rear card. */ | |
55 | enum channel_conn { | |
56 | CONN_FRONT, | |
57 | CONN_REAR, | |
db23af7f AG |
58 | }; |
59 | ||
00b2a092 AG |
60 | /** Private, per-device-instance driver context. */ |
61 | struct dev_context { | |
62 | /* Model-specific information */ | |
db23af7f AG |
63 | /* Information about rear card option, or NULL if unknown */ |
64 | const struct rear_card_info *rear_card; | |
00b2a092 AG |
65 | |
66 | /* Acquisition settings */ | |
db23af7f | 67 | enum sr_mq measurement_mq; |
2c04f943 | 68 | enum sr_mqflag measurement_mq_flags; |
db23af7f AG |
69 | enum sr_unit measurement_unit; |
70 | uint64_t limit_samples; | |
71 | float nplc; | |
9a093be9 AG |
72 | GSList *active_channels; |
73 | unsigned int num_active_channels; | |
74 | struct sr_channel *current_channel; | |
00b2a092 AG |
75 | |
76 | /* Operational state */ | |
db23af7f | 77 | enum acquisition_state acq_state; |
9a093be9 | 78 | enum channel_conn input_loc; |
db23af7f AG |
79 | uint64_t num_samples; |
80 | double base_measurement; | |
81 | double hires_register; | |
82 | double measurement_range; | |
9a093be9 AG |
83 | double last_channel_sync; |
84 | }; | |
85 | ||
86 | struct channel_context { | |
87 | enum channel_conn location; | |
88 | int index; | |
00b2a092 AG |
89 | }; |
90 | ||
db23af7f | 91 | SR_PRIV const struct rear_card_info *hp_3457a_probe_rear_card(struct sr_scpi_dev_inst *scpi); |
00b2a092 | 92 | SR_PRIV int hp_3457a_receive_data(int fd, int revents, void *cb_data); |
2c04f943 AG |
93 | SR_PRIV int hp_3457a_set_mq(const struct sr_dev_inst *sdi, enum sr_mq mq, |
94 | enum sr_mqflag mq_flags); | |
db23af7f | 95 | SR_PRIV int hp_3457a_set_nplc(const struct sr_dev_inst *sdi, float nplc); |
9a093be9 AG |
96 | SR_PRIV int hp_3457a_select_input(const struct sr_dev_inst *sdi, |
97 | enum channel_conn loc); | |
98 | SR_PRIV int hp_3457a_send_scan_list(const struct sr_dev_inst *sdi, | |
99 | unsigned int *channels, size_t len); | |
00b2a092 AG |
100 | |
101 | #endif |