#include <inttypes.h>
#include <glib.h>
#include <libusb.h>
-
#include "config.h"
#include "sigrok.h"
#include "sigrok-internal.h"
/* These are really implemented in the driver, not the hardware. */
SR_HWCAP_LIMIT_SAMPLES,
SR_HWCAP_CONTINUOUS,
- 0
+ 0,
};
static const char *fx2lafw_probe_names[] = {
"D5",
"D6",
"D7",
- NULL
+ NULL,
};
static uint64_t fx2lafw_supported_samplerates[] = {
SR_MHZ(8),
SR_MHZ(12),
SR_MHZ(16),
- SR_MHZ(24)
+ SR_MHZ(24),
};
static struct sr_samplerates fx2lafw_samplerates = {
SR_MHZ(1),
SR_MHZ(24),
SR_HZ(0),
- fx2lafw_supported_samplerates
+ fx2lafw_supported_samplerates,
};
static GSList *dev_insts = NULL;
* Check the USB configuration to determine if this is an fx2lafw device.
*
* @return true if the device's configuration profile match fx2lafw
- * configuration, flase otherwise.
+ * configuration, false otherwise.
*/
static bool check_conf_profile(libusb_device *dev)
{
libusb_device **devlist;
struct libusb_device_descriptor des;
struct sr_dev_inst *sdi;
- struct fx2lafw_device *ctx;
+ struct context *ctx;
int err, skip, i;
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
static void close_dev(struct sr_dev_inst *sdi)
{
- struct fx2lafw_device *ctx;
+ struct context *ctx;
ctx = sdi->priv;
sdi->status = SR_ST_INACTIVE;
}
-static struct fx2lafw_device* fx2lafw_device_new(void)
+static struct context *fx2lafw_device_new(void)
{
- struct fx2lafw_device *fx2lafw;
+ struct context *ctx;
- if (!(fx2lafw = g_try_malloc0(sizeof(struct fx2lafw_device)))) {
- sr_err("fx2lafw: %s: fx2lafw_device malloc failed", __func__);
+ if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
+ sr_err("fx2lafw: %s: ctx malloc failed", __func__);
return NULL;
}
- return fx2lafw;
+ return ctx;
}
/*
struct sr_dev_inst *sdi;
struct libusb_device_descriptor des;
struct fx2lafw_profile *fx2lafw_prof;
- struct fx2lafw_device *ctx;
+ struct context *ctx;
libusb_device **devlist;
int err;
int devcnt = 0;
return devcnt;
}
-static int hw_dev_open(int device_index)
+static int hw_dev_open(int dev_index)
{
GTimeVal cur_time;
struct sr_dev_inst *sdi;
- struct fx2lafw_device *ctx;
+ struct context *ctx;
int timediff, err;
- if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+ if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
return SR_ERR;
ctx = sdi->priv;
g_usleep(300 * 1000);
timediff = 0;
while (timediff < MAX_RENUM_DELAY) {
- if ((err = fx2lafw_open_dev(device_index)) == SR_OK)
+ if ((err = fx2lafw_open_dev(dev_index)) == SR_OK)
break;
g_usleep(100 * 1000);
g_get_current_time(&cur_time);
}
sr_info("fx2lafw: device came back after %d ms", timediff);
} else {
- err = fx2lafw_open_dev(device_index);
+ err = fx2lafw_open_dev(dev_index);
}
if (err != SR_OK) {
{
GSList *l;
struct sr_dev_inst *sdi;
- struct fx2lafw_device *ctx;
+ struct context *ctx;
int ret = SR_OK;
for(l = dev_insts; l; l = l->next) {
return ret;
}
-static void *hw_dev_info_get(int device_index, int device_info_id)
+static void *hw_dev_info_get(int dev_index, int dev_info_id)
{
struct sr_dev_inst *sdi;
- struct fx2lafw_device *ctx;
+ struct context *ctx;
- if (!(sdi = sr_dev_inst_get(dev_insts, device_index)))
+ if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
return NULL;
ctx = sdi->priv;
- switch (device_info_id) {
+ switch (dev_info_id) {
case SR_DI_INST:
return sdi;
case SR_DI_NUM_PROBES:
return NULL;
}
-static int hw_dev_status_get(int device_index)
+static int hw_dev_status_get(int dev_index)
{
const struct sr_dev_inst *const sdi =
- sr_dev_inst_get(dev_insts, device_index);
+ sr_dev_inst_get(dev_insts, dev_index);
if (!sdi)
return SR_ST_NOT_FOUND;
static int hw_dev_config_set(int dev_index, int hwcap, void *value)
{
struct sr_dev_inst *sdi;
- struct fx2lafw_device *ctx;
+ struct context *ctx;
int ret;
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
static int empty_transfer_count = 0;
struct sr_datafeed_packet packet;
struct sr_datafeed_logic logic;
- struct fx2lafw_device *ctx;
+ struct context *ctx;
int cur_buflen;
unsigned char *cur_buf, *new_buf;
struct sr_dev_inst *sdi;
struct sr_datafeed_packet *packet;
struct sr_datafeed_header *header;
- struct fx2lafw_device *ctx;
+ struct context *ctx;
struct libusb_transfer *transfer;
const struct libusb_pollfd **lupfd;
int size, i;
return SR_OK;
}
-/* This stops acquisition on ALL devices, ignoring device_index. */
+/* This stops acquisition on ALL devices, ignoring dev_index. */
static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
{
struct sr_datafeed_packet packet;