]> sigrok.org Git - libsigrok.git/blob - src/hardware/juntek-jds6600/protocol.h
output/csv: use intermediate time_t var, silence compiler warning
[libsigrok.git] / src / hardware / juntek-jds6600 / protocol.h
1 /*
2  * This file is part of the libsigrok project.
3  *
4  * Copyright (C) 2023 Gerhard Sittig <gerhard.sittig@gmx.net>
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_JUNTEK_JDS6600_PROTOCOL_H
21 #define LIBSIGROK_HARDWARE_JUNTEK_JDS6600_PROTOCOL_H
22
23 #include <glib.h>
24 #include <libsigrok/libsigrok.h>
25 #include <stdint.h>
26
27 #include "libsigrok-internal.h"
28
29 #define LOG_PREFIX "juntek-jds6600"
30
31 #define MAX_GEN_CHANNELS        2
32
33 struct dev_context {
34         struct devc_dev {
35                 unsigned int device_type;
36                 char *serial_number;
37                 uint64_t max_output_frequency;
38                 size_t channel_count_gen;
39         } device;
40         struct devc_wave {
41                 size_t builtin_count;
42                 size_t arbitrary_count;
43                 size_t names_count;
44                 const char **names;
45                 uint32_t *fw_codes;
46         } waveforms;
47         struct devc_chan {
48                 gboolean enabled;
49                 uint32_t waveform_code;
50                 size_t waveform_index;
51                 double output_frequency;
52                 double amplitude;
53                 double offset;
54                 double dutycycle;
55         } channel_config[MAX_GEN_CHANNELS];
56         double channels_phase;
57         GString *quick_req;
58 };
59
60 SR_PRIV int jds6600_identify(struct sr_dev_inst *sdi);
61 SR_PRIV int jds6600_setup_devc(struct sr_dev_inst *sdi);
62
63 SR_PRIV int jds6600_get_chans_enable(const struct sr_dev_inst *sdi);
64 SR_PRIV int jds6600_get_waveform(const struct sr_dev_inst *sdi, size_t ch_idx);
65 SR_PRIV int jds6600_get_frequency(const struct sr_dev_inst *sdi, size_t ch_idx);
66 SR_PRIV int jds6600_get_amplitude(const struct sr_dev_inst *sdi, size_t ch_idx);
67 SR_PRIV int jds6600_get_offset(const struct sr_dev_inst *sdi, size_t ch_idx);
68 SR_PRIV int jds6600_get_dutycycle(const struct sr_dev_inst *sdi, size_t ch_idx);
69 SR_PRIV int jds6600_get_phase_chans(const struct sr_dev_inst *sdi);
70
71 SR_PRIV int jds6600_set_chans_enable(const struct sr_dev_inst *sdi);
72 SR_PRIV int jds6600_set_waveform(const struct sr_dev_inst *sdi, size_t ch_idx);
73 SR_PRIV int jds6600_set_frequency(const struct sr_dev_inst *sdi, size_t ch_idx);
74 SR_PRIV int jds6600_set_amplitude(const struct sr_dev_inst *sdi, size_t ch_idx);
75 SR_PRIV int jds6600_set_offset(const struct sr_dev_inst *sdi, size_t ch_idx);
76 SR_PRIV int jds6600_set_dutycycle(const struct sr_dev_inst *sdi, size_t ch_idx);
77 SR_PRIV int jds6600_set_phase_chans(const struct sr_dev_inst *sdi);
78
79 #endif