2 * This file is part of the libsigrok project.
4 * Copyright (C) 2017 Jan Luebbe <jluebbe@lasnet.de>
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_SALEAE_LOGICPRO_PROTOCOL_H
21 #define LIBSIGROK_HARDWARE_SALEAE_LOGICPRO_PROTOCOL_H
25 #include <libsigrok/libsigrok.h>
26 #include "libsigrok-internal.h"
28 #define LOG_PREFIX "saleae-logicpro"
30 /* 16 channels * 32 samples */
31 #define CONV_BATCH_SIZE (2*32)
32 /* one packet + one partial conversion:
33 * worst case is only one active channel converted to 2 bytes per sample, with
34 * 8*16384 samples per packet
36 #define CONV_BUFFER_SIZE (2*8*16384 + CONV_BATCH_SIZE)
38 /** Private, per-device-instance driver context. */
40 /* Acquisition settings */
41 unsigned int dig_channel_cnt;
42 uint16_t dig_channel_mask;
43 uint16_t dig_channel_masks[16];
44 uint64_t dig_samplerate;
46 /* Operational state */
49 /* Temporary state across callbacks */
50 unsigned int num_transfers;
51 unsigned int submitted_transfers;
52 struct libusb_transfer **transfers;
54 /* Conversion buffer */
56 unsigned int conv_size;
57 unsigned int batch_index;
60 SR_PRIV int saleae_logicpro_init(const struct sr_dev_inst *sdi);
61 SR_PRIV int saleae_logicpro_prepare(const struct sr_dev_inst *sdi);
62 SR_PRIV int saleae_logicpro_start(const struct sr_dev_inst *sdi);
63 SR_PRIV int saleae_logicpro_stop(const struct sr_dev_inst *sdi);
64 SR_PRIV void LIBUSB_CALL saleae_logicpro_receive_data(struct libusb_transfer *transfer);