2013-07-21 10:30:32 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the libsigrok project.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 Marcus Comstedt <marcus@mc.pp.se>
|
2013-08-05 10:05:40 +00:00
|
|
|
* Copyright (C) 2013 Bert Vermeulen <bert@biot.com>
|
|
|
|
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
|
2013-07-21 10:30:32 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LIBSIGROK_HARDWARE_SALEAE_LOGIC16_PROTOCOL_H
|
|
|
|
#define LIBSIGROK_HARDWARE_SALEAE_LOGIC16_PROTOCOL_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <glib.h>
|
|
|
|
#include "libsigrok.h"
|
|
|
|
#include "libsigrok-internal.h"
|
|
|
|
|
2013-12-23 03:38:35 +00:00
|
|
|
#define LOG_PREFIX "saleae-logic16"
|
2013-07-21 10:30:32 +00:00
|
|
|
|
2013-08-02 22:35:44 +00:00
|
|
|
enum voltage_range {
|
|
|
|
VOLTAGE_RANGE_UNKNOWN,
|
|
|
|
VOLTAGE_RANGE_18_33_V, /* 1.8V and 3.3V logic */
|
|
|
|
VOLTAGE_RANGE_5_V, /* 5V logic */
|
|
|
|
};
|
|
|
|
|
2013-07-21 10:30:32 +00:00
|
|
|
/** Private, per-device-instance driver context. */
|
|
|
|
struct dev_context {
|
2013-08-02 19:02:00 +00:00
|
|
|
/*
|
|
|
|
* Since we can't keep track of a Logic16 device after upgrading
|
|
|
|
* the firmware (it renumerates into a different device address
|
|
|
|
* after the upgrade) this is like a global lock. No device will open
|
|
|
|
* until a proper delay after the last device was upgraded.
|
|
|
|
*/
|
|
|
|
int64_t fw_updated;
|
|
|
|
|
2013-07-31 14:53:35 +00:00
|
|
|
/** The currently configured samplerate of the device. */
|
|
|
|
uint64_t cur_samplerate;
|
2013-08-02 22:35:44 +00:00
|
|
|
|
2013-08-21 00:02:41 +00:00
|
|
|
/** Maximum number of samples to capture, if nonzero. */
|
2013-08-04 11:46:35 +00:00
|
|
|
uint64_t limit_samples;
|
|
|
|
|
2013-08-21 00:02:41 +00:00
|
|
|
/** The currently configured input voltage of the device. */
|
2013-08-02 22:35:44 +00:00
|
|
|
enum voltage_range cur_voltage_range;
|
|
|
|
|
2013-08-21 00:02:41 +00:00
|
|
|
/** The input voltage selected by the user. */
|
2013-08-04 14:20:07 +00:00
|
|
|
enum voltage_range selected_voltage_range;
|
|
|
|
|
2013-08-21 00:02:41 +00:00
|
|
|
/** Channels to use. */
|
2013-08-04 11:46:35 +00:00
|
|
|
uint16_t cur_channels;
|
|
|
|
|
2013-08-21 00:02:41 +00:00
|
|
|
/* EEPROM data from address 8. */
|
2013-08-02 22:35:44 +00:00
|
|
|
uint8_t eeprom_data[8];
|
2013-08-04 11:46:35 +00:00
|
|
|
|
|
|
|
int64_t num_samples;
|
|
|
|
int submitted_transfers;
|
|
|
|
int empty_transfer_count;
|
|
|
|
int num_channels, cur_channel;
|
|
|
|
uint16_t channel_masks[16];
|
|
|
|
uint16_t channel_data[16];
|
|
|
|
uint8_t *convbuffer;
|
|
|
|
size_t convbuffer_size;
|
|
|
|
|
|
|
|
void *cb_data;
|
|
|
|
unsigned int num_transfers;
|
|
|
|
struct libusb_transfer **transfers;
|
2013-12-21 23:03:24 +00:00
|
|
|
struct sr_context *ctx;
|
2013-07-21 10:30:32 +00:00
|
|
|
};
|
|
|
|
|
2013-08-21 00:02:41 +00:00
|
|
|
SR_PRIV int logic16_setup_acquisition(const struct sr_dev_inst *sdi,
|
|
|
|
uint64_t samplerate, uint16_t channels);
|
|
|
|
SR_PRIV int logic16_start_acquisition(const struct sr_dev_inst *sdi);
|
|
|
|
SR_PRIV int logic16_abort_acquisition(const struct sr_dev_inst *sdi);
|
|
|
|
SR_PRIV int logic16_init_device(const struct sr_dev_inst *sdi);
|
|
|
|
SR_PRIV void logic16_receive_transfer(struct libusb_transfer *transfer);
|
2013-07-21 10:30:32 +00:00
|
|
|
|
|
|
|
#endif
|