2 * This file is part of the libsigrok project.
4 * Copyright (C) 2020 Timo Kokkonen <tjko@iki.fi>
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_RIGOL_DG_PROTOCOL_H
21 #define LIBSIGROK_HARDWARE_RIGOL_DG_PROTOCOL_H
25 #include <libsigrok/libsigrok.h>
26 #include "libsigrok-internal.h"
28 #define LOG_PREFIX "rigol-dg"
33 PSG_CMD_SELECT_CHANNEL,
40 PSG_CMD_SET_FREQUENCY,
41 PSG_CMD_GET_FREQUENCY,
42 PSG_CMD_SET_AMPLITUDE,
43 PSG_CMD_GET_AMPLITUDE,
48 PSG_CMD_GET_DCYCL_PULSE,
49 PSG_CMD_SET_DCYCL_PULSE,
50 PSG_CMD_GET_DCYCL_SQUARE,
51 PSG_CMD_SET_DCYCL_SQUARE,
52 PSG_CMD_COUNTER_GET_ENABLED,
53 PSG_CMD_COUNTER_SET_ENABLE,
54 PSG_CMD_COUNTER_SET_DISABLE,
55 PSG_CMD_COUNTER_MEASURE,
68 enum waveform_options {
76 struct waveform_spec {
78 enum waveform_type waveform;
87 const struct waveform_spec *waveforms;
88 uint32_t num_waveforms;
91 struct channel_status {
92 enum waveform_type wf;
93 const struct waveform_spec *wf_spec;
103 const uint32_t *devopts;
104 const uint32_t num_devopts;
105 const uint32_t *devopts_cg;
106 const uint32_t num_devopts_cg;
107 const struct channel_spec *channels;
108 const uint32_t num_channels;
109 const struct scpi_command *cmdset;
113 const struct scpi_command *cmdset;
114 const struct device_spec *device;
115 struct channel_status *ch_status;
116 struct sr_sw_limits limits;
117 gboolean counter_enabled;
120 SR_PRIV const char *rigol_dg_waveform_to_string(enum waveform_type type);
121 SR_PRIV const struct waveform_spec *rigol_dg_get_waveform_spec(
122 const struct channel_spec *ch, enum waveform_type wf);
123 SR_PRIV int rigol_dg_get_channel_state(const struct sr_dev_inst *sdi,
124 const struct sr_channel_group *cg);
125 SR_PRIV int rigol_dg_receive_data(int fd, int revents, void *cb_data);