2 * This file is part of the libsigrok project.
4 * Copyright (C) 2016 Alexandru Gagniuc <mr.nuke.me@gmail.com>
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.
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.
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/>.
20 #ifndef LIBSIGROK_HARDWARE_HP_3457A_PROTOCOL_H
21 #define LIBSIGROK_HARDWARE_HP_3457A_PROTOCOL_H
24 #include "libsigrok-internal.h"
26 #define LOG_PREFIX "hp-3457a"
28 /* Information about the rear card option currently installed. */
36 struct rear_card_info {
41 unsigned int num_channels;
44 /* Possible states in an acquisition. */
45 enum acquisition_state {
46 ACQ_TRIGGERED_MEASUREMENT,
50 ACQ_REQUESTED_CHANNEL_SYNC,
54 /* Channel connector (front terminals, or rear card. */
61 /* Information about rear card option, or NULL if unknown */
62 const struct rear_card_info *rear_card;
64 enum sr_mq measurement_mq;
65 enum sr_mqflag measurement_mq_flags;
66 enum sr_unit measurement_unit;
67 uint64_t limit_samples;
69 GSList *active_channels;
70 unsigned int num_active_channels;
71 struct sr_channel *current_channel;
73 enum acquisition_state acq_state;
74 enum channel_conn input_loc;
76 double base_measurement;
77 double hires_register;
78 double measurement_range;
79 double last_channel_sync;
82 struct channel_context {
83 enum channel_conn location;
87 SR_PRIV const struct rear_card_info *hp_3457a_probe_rear_card(struct sr_scpi_dev_inst *scpi);
88 SR_PRIV int hp_3457a_receive_data(int fd, int revents, void *cb_data);
89 SR_PRIV int hp_3457a_set_mq(const struct sr_dev_inst *sdi, enum sr_mq mq,
90 enum sr_mqflag mq_flags);
91 SR_PRIV int hp_3457a_set_nplc(const struct sr_dev_inst *sdi, float nplc);
92 SR_PRIV int hp_3457a_select_input(const struct sr_dev_inst *sdi,
93 enum channel_conn loc);
94 SR_PRIV int hp_3457a_send_scan_list(const struct sr_dev_inst *sdi,
95 unsigned int *channels, size_t len);