]> sigrok.org Git - libsigrok.git/blobdiff - hardware/saleae-logic16/protocol.h
saleae-logic16: Use unitsize 1 if none of channels 8-15 are used.
[libsigrok.git] / hardware / saleae-logic16 / protocol.h
index 80b20f95643ad14fa0d7fd232b3ac4fcd11eafe0..00f96560645cb539816bd92f118192fc74b7fc7d 100644 (file)
@@ -2,6 +2,8 @@
  * This file is part of the libsigrok project.
  *
  * Copyright (C) 2013 Marcus Comstedt <marcus@mc.pp.se>
+ * Copyright (C) 2013 Bert Vermeulen <bert@biot.com>
+ * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
  *
  * 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
 #include "libsigrok.h"
 #include "libsigrok-internal.h"
 
-/* Message logging helpers with subsystem-specific prefix string. */
-#define LOG_PREFIX "saleae-logic16: "
-#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args)
-#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args)
-#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args)
-#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args)
-#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args)
-#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args)
+#define LOG_PREFIX "saleae-logic16"
 
 enum voltage_range {
        VOLTAGE_RANGE_UNKNOWN,
@@ -53,24 +48,25 @@ struct dev_context {
        /** The currently configured samplerate of the device. */
        uint64_t cur_samplerate;
 
-       /** Maximum number of samples to capture, if nonzero */
+       /** Maximum number of samples to capture, if nonzero. */
        uint64_t limit_samples;
 
-       /** The currently configured input voltage of the device */
+       /** The currently configured input voltage of the device. */
        enum voltage_range cur_voltage_range;
 
-       /** Channels to use */
+       /** The input voltage selected by the user. */
+       enum voltage_range selected_voltage_range;
+
+       /** Channels to use. */
        uint16_t cur_channels;
 
-       /*
-        * EEPROM data from address 8
-        */
+       /* EEPROM data from address 8. */
        uint8_t eeprom_data[8];
 
        int64_t num_samples;
        int submitted_transfers;
        int empty_transfer_count;
-       int num_channels, cur_channel;
+       int num_channels, cur_channel, unitsize;
        uint16_t channel_masks[16];
        uint16_t channel_data[16];
        uint8_t *convbuffer;
@@ -79,15 +75,14 @@ struct dev_context {
        void *cb_data;
        unsigned int num_transfers;
        struct libusb_transfer **transfers;
-       int *usbfd;
+       struct sr_context *ctx;
 };
 
-SR_PRIV int saleae_logic16_setup_acquisition(const struct sr_dev_inst *sdi,
-                                            uint64_t samplerate,
-                                            uint16_t channels);
-SR_PRIV int saleae_logic16_start_acquisition(const struct sr_dev_inst *sdi);
-SR_PRIV int saleae_logic16_abort_acquisition(const struct sr_dev_inst *sdi);
-SR_PRIV int saleae_logic16_init_device(const struct sr_dev_inst *sdi);
-SR_PRIV void saleae_logic16_receive_transfer(struct libusb_transfer *transfer);
+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);
 
 #endif