]> sigrok.org Git - libsigrok.git/blame - src/hardware/greatfet/protocol.h
greatfet: support capture of the upper pin bank (first pin 8)
[libsigrok.git] / src / hardware / greatfet / protocol.h
CommitLineData
f594b3b0
GS
1/*
2 * This file is part of the libsigrok project.
3 *
208fcedc
GS
4 * Copyright (C) 2019 Katherine J. Temkin <k@ktemkin.com>
5 * Copyright (C) 2019 Mikaela Szekely <qyriad@gmail.com>
f594b3b0
GS
6 * Copyright (C) 2023 Gerhard Sittig <gerhard.sittig@gmx.net>
7 *
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.
12 *
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.
17 *
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/>.
20 */
21
22#ifndef LIBSIGROK_HARDWARE_GREATFET_PROTOCOL_H
23#define LIBSIGROK_HARDWARE_GREATFET_PROTOCOL_H
24
f594b3b0
GS
25#include <glib.h>
26#include <libsigrok/libsigrok.h>
208fcedc
GS
27#include <stdint.h>
28
f594b3b0
GS
29#include "libsigrok-internal.h"
30
31#define LOG_PREFIX "greatfet"
32
33struct dev_context {
208fcedc
GS
34 struct sr_dev_inst *sdi;
35 GString *usb_comm_buffer;
36 char *firmware_version;
37 char *serial_number;
38 size_t channel_count;
39 char **channel_names;
40 struct sr_sw_limits sw_limits;
41 uint64_t samplerate;
42 struct dev_acquisition_t {
43 uint64_t bandwidth_threshold;
44 size_t unit_size;
45 struct feed_queue_logic *feed_queue;
46 size_t capture_channels;
70c9a254 47 gboolean use_upper_pins;
208fcedc
GS
48 size_t channel_shift;
49 size_t points_per_byte;
50 uint64_t capture_samplerate;
51 size_t firmware_bufsize;
52 uint8_t samples_endpoint;
53 uint8_t control_interface;
54 uint8_t samples_interface;
55 enum {
56 ACQ_IDLE,
57 ACQ_PREPARE,
58 ACQ_RECEIVE,
59 ACQ_SHUTDOWN,
60 } acquisition_state;
61 gboolean frame_begin_sent;
62 gboolean control_interface_claimed;
63 gboolean samples_interface_claimed;
64 gboolean start_req_sent;
65 } acquisition;
66 struct dev_transfers_t {
67 size_t transfer_bufsize;
68 size_t transfers_count;
69 uint8_t *transfer_buffer;
70 struct libusb_transfer **transfers;
71 size_t active_transfers;
72 size_t capture_bufsize;
73 } transfers;
f594b3b0
GS
74};
75
208fcedc
GS
76SR_PRIV int greatfet_get_serial_number(const struct sr_dev_inst *sdi);
77SR_PRIV int greatfet_get_version_number(const struct sr_dev_inst *sdi);
78
79SR_PRIV int greatfet_setup_acquisition(const struct sr_dev_inst *sdi);
80SR_PRIV int greatfet_start_acquisition(const struct sr_dev_inst *sdi);
81SR_PRIV void greatfet_abort_acquisition(const struct sr_dev_inst *sdi);
82SR_PRIV int greatfet_stop_acquisition(const struct sr_dev_inst *sdi);
83SR_PRIV void greatfet_release_resources(const struct sr_dev_inst *sdi);
84
f594b3b0
GS
85SR_PRIV int greatfet_receive_data(int fd, int revents, void *cb_data);
86
87#endif