]> sigrok.org Git - libsigrok.git/blame - src/hardware/hp-3457a/protocol.h
hp-3457a: Implement basic configuration and sampling
[libsigrok.git] / src / hardware / hp-3457a / protocol.h
CommitLineData
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. */
29enum card_type {
30 CARD_UNKNOWN,
31 REAR_TERMINALS,
32 HP_44491A,
33 HP_44492A,
34};
35
36struct rear_card_info {
37 unsigned int card_id;
38 enum card_type type;
39 const char *name;
40 const char *cg_name;
41};
42
43/* Possible states in an acquisition. */
44enum acquisition_state {
45 ACQ_TRIGGERED_MEASUREMENT,
46 ACQ_REQUESTED_HIRES,
47 ACQ_REQUESTED_RANGE,
48 ACQ_GOT_MEASUREMENT,
49};
50
00b2a092
AG
51/** Private, per-device-instance driver context. */
52struct dev_context {
53 /* Model-specific information */
db23af7f
AG
54 /* Information about rear card option, or NULL if unknown */
55 const struct rear_card_info *rear_card;
00b2a092
AG
56
57 /* Acquisition settings */
db23af7f
AG
58 enum sr_mq measurement_mq;
59 enum sr_unit measurement_unit;
60 uint64_t limit_samples;
61 float nplc;
00b2a092
AG
62
63 /* Operational state */
db23af7f
AG
64 enum acquisition_state acq_state;
65 uint64_t num_samples;
66 double base_measurement;
67 double hires_register;
68 double measurement_range;
00b2a092
AG
69};
70
db23af7f 71SR_PRIV const struct rear_card_info *hp_3457a_probe_rear_card(struct sr_scpi_dev_inst *scpi);
00b2a092 72SR_PRIV int hp_3457a_receive_data(int fd, int revents, void *cb_data);
db23af7f
AG
73SR_PRIV int hp_3457a_set_mq(const struct sr_dev_inst *sdi, enum sr_mq mq);
74SR_PRIV int hp_3457a_set_nplc(const struct sr_dev_inst *sdi, float nplc);
00b2a092
AG
75
76#endif