2 * This file is part of the libsigrok project.
4 * Copyright (C) 2019 Katherine J. Temkin <k@ktemkin.com>
5 * Copyright (C) 2019 Mikaela Szekely <qyriad@gmail.com>
6 * Copyright (C) 2023 Gerhard Sittig <gerhard.sittig@gmx.net>
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef LIBSIGROK_HARDWARE_GREATFET_PROTOCOL_H
23 #define LIBSIGROK_HARDWARE_GREATFET_PROTOCOL_H
26 #include <libsigrok/libsigrok.h>
29 #include "libsigrok-internal.h"
31 #define LOG_PREFIX "greatfet"
34 struct sr_dev_inst *sdi;
35 GString *usb_comm_buffer;
36 char *firmware_version;
40 struct sr_sw_limits sw_limits;
42 struct dev_acquisition_t {
43 uint64_t bandwidth_threshold;
45 struct feed_queue_logic *feed_queue;
46 size_t capture_channels;
48 size_t points_per_byte;
49 uint64_t capture_samplerate;
50 size_t firmware_bufsize;
51 uint8_t samples_endpoint;
52 uint8_t control_interface;
53 uint8_t samples_interface;
60 gboolean frame_begin_sent;
61 gboolean control_interface_claimed;
62 gboolean samples_interface_claimed;
63 gboolean start_req_sent;
65 struct dev_transfers_t {
66 size_t transfer_bufsize;
67 size_t transfers_count;
68 uint8_t *transfer_buffer;
69 struct libusb_transfer **transfers;
70 size_t active_transfers;
71 size_t capture_bufsize;
75 SR_PRIV int greatfet_get_serial_number(const struct sr_dev_inst *sdi);
76 SR_PRIV int greatfet_get_version_number(const struct sr_dev_inst *sdi);
78 SR_PRIV int greatfet_setup_acquisition(const struct sr_dev_inst *sdi);
79 SR_PRIV int greatfet_start_acquisition(const struct sr_dev_inst *sdi);
80 SR_PRIV void greatfet_abort_acquisition(const struct sr_dev_inst *sdi);
81 SR_PRIV int greatfet_stop_acquisition(const struct sr_dev_inst *sdi);
82 SR_PRIV void greatfet_release_resources(const struct sr_dev_inst *sdi);
84 SR_PRIV int greatfet_receive_data(int fd, int revents, void *cb_data);