Use 'di' consistently in all drivers as the name for a local, static
pointer to the respective driver's 'struct sr_dev_driver'.
#define NUM_PROBES 16
SR_PRIV struct sr_dev_driver asix_sigma_driver_info;
#define NUM_PROBES 16
SR_PRIV struct sr_dev_driver asix_sigma_driver_info;
-static struct sr_dev_driver *adi = &asix_sigma_driver_info;
+static struct sr_dev_driver *di = &asix_sigma_driver_info;
static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static const uint64_t supported_samplerates[] = {
static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static const uint64_t supported_samplerates[] = {
struct drv_context *drvc;
struct dev_context *devc;
struct drv_context *drvc;
struct dev_context *devc;
/* Properly close all devices. */
for (l = drvc->instances; l; l = l->next) {
/* Properly close all devices. */
for (l = drvc->instances; l; l = l->next) {
return SR_ERR_MALLOC;
}
drvc->sr_ctx = sr_ctx;
return SR_ERR_MALLOC;
}
drvc->sr_ctx = sr_ctx;
devices = NULL;
clear_instances();
devices = NULL;
clear_instances();
sr_err("%s: sdi was NULL", __func__);
goto free;
}
sr_err("%s: sdi was NULL", __func__);
goto free;
}
for (i = 0; probe_names[i]; i++) {
if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
for (i = 0; probe_names[i]; i++) {
if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
{
struct drv_context *drvc;
{
struct drv_context *drvc;
return drvc->instances;
}
return drvc->instances;
}
static int hw_cleanup(void)
{
static int hw_cleanup(void)
{
return SR_OK;
clear_instances();
return SR_OK;
clear_instances();
/* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */
SR_PRIV struct sr_dev_driver demo_driver_info;
/* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */
SR_PRIV struct sr_dev_driver demo_driver_info;
-static struct sr_dev_driver *ddi = &demo_driver_info;
+static struct sr_dev_driver *di = &demo_driver_info;
static uint64_t cur_samplerate = SR_KHZ(200);
static uint64_t limit_samples = 0;
static uint64_t limit_msec = 0;
static uint64_t cur_samplerate = SR_KHZ(200);
static uint64_t limit_samples = 0;
static uint64_t limit_msec = 0;
return SR_ERR_MALLOC;
}
drvc->sr_ctx = sr_ctx;
return SR_ERR_MALLOC;
}
drvc->sr_ctx = sr_ctx;
devices = NULL;
sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL);
devices = NULL;
sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL);
sr_err("%s: sr_dev_inst_new failed", __func__);
return 0;
}
sr_err("%s: sr_dev_inst_new failed", __func__);
return 0;
}
for (i = 0; probe_names[i]; i++) {
if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
for (i = 0; probe_names[i]; i++) {
if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
{
struct drv_context *drvc;
{
struct drv_context *drvc;
return drvc->instances;
}
return drvc->instances;
}
};
SR_PRIV struct sr_dev_driver fx2lafw_driver_info;
};
SR_PRIV struct sr_dev_driver fx2lafw_driver_info;
-static struct sr_dev_driver *fdi = &fx2lafw_driver_info;
+static struct sr_dev_driver *di = &fx2lafw_driver_info;
static int hw_dev_close(struct sr_dev_inst *sdi);
static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
const void *value);
static int hw_dev_close(struct sr_dev_inst *sdi);
static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
const void *value);
libusb_device **devlist;
struct libusb_device_descriptor des;
struct dev_context *devc;
libusb_device **devlist;
struct libusb_device_descriptor des;
struct dev_context *devc;
- struct drv_context *drvc = fdi->priv;
+ struct drv_context *drvc = di->priv;
struct version_info vi;
int ret, skip, i;
uint8_t revid;
struct version_info vi;
int ret, skip, i;
uint8_t revid;
struct dev_context *devc;
int ret;
struct dev_context *devc;
int ret;
ret = SR_OK;
for (l = drvc->instances; l; l = l->next) {
if (!(sdi = l->data)) {
ret = SR_OK;
for (l = drvc->instances; l; l = l->next) {
if (!(sdi = l->data)) {
/* This scan always invalidates any previous scans. */
clear_instances();
/* This scan always invalidates any previous scans. */
clear_instances();
prof->vendor, prof->model, prof->model_version);
if (!sdi)
return NULL;
prof->vendor, prof->model, prof->model_version);
if (!sdi)
return NULL;
/* Fill in probelist according to this device's profile. */
num_logic_probes = prof->dev_caps & DEV_CAPS_16BIT ? 16 : 8;
/* Fill in probelist according to this device's profile. */
num_logic_probes = prof->dev_caps & DEV_CAPS_16BIT ? 16 : 8;
{
struct drv_context *drvc;
{
struct drv_context *drvc;
return drvc->instances;
}
return drvc->instances;
}
struct drv_context *drvc;
int ret;
struct drv_context *drvc;
int ret;
- if (!(drvc = fdi->priv))
+ if (!(drvc = di->priv))
return SR_OK;
ret = clear_instances();
g_free(drvc);
return SR_OK;
ret = clear_instances();
g_free(drvc);
static int receive_data(int fd, int revents, void *cb_data)
{
struct timeval tv;
static int receive_data(int fd, int revents, void *cb_data)
{
struct timeval tv;
- struct drv_context *drvc = fdi->priv;
+ struct drv_context *drvc = di->priv;
static void finish_acquisition(struct dev_context *devc)
{
struct sr_datafeed_packet packet;
static void finish_acquisition(struct dev_context *devc)
{
struct sr_datafeed_packet packet;
- struct drv_context *drvc = fdi->priv;
+ struct drv_context *drvc = di->priv;
struct sr_datafeed_header header;
struct sr_datafeed_meta_logic meta;
struct dev_context *devc;
struct sr_datafeed_header header;
struct sr_datafeed_meta_logic meta;
struct dev_context *devc;
- struct drv_context *drvc = fdi->priv;
+ struct drv_context *drvc = di->priv;
struct libusb_transfer *transfer;
const struct libusb_pollfd **lupfd;
unsigned int i;
struct libusb_transfer *transfer;
const struct libusb_pollfd **lupfd;
unsigned int i;
};
SR_PRIV struct sr_dev_driver hantek_dso_driver_info;
};
SR_PRIV struct sr_dev_driver hantek_dso_driver_info;
-static struct sr_dev_driver *hdi = &hantek_dso_driver_info;
+static struct sr_dev_driver *di = &hantek_dso_driver_info;
static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
prof->vendor, prof->model, NULL);
if (!sdi)
return NULL;
prof->vendor, prof->model, NULL);
if (!sdi)
return NULL;
/*
* Add only the real probes -- EXT isn't a source of data, only
/*
* Add only the real probes -- EXT isn't a source of data, only
devc->triggersource = g_strdup(DEFAULT_TRIGGER_SOURCE);
devc->triggerposition = DEFAULT_HORIZ_TRIGGERPOS;
sdi->priv = devc;
devc->triggersource = g_strdup(DEFAULT_TRIGGER_SOURCE);
devc->triggerposition = DEFAULT_HORIZ_TRIGGERPOS;
sdi->priv = devc;
drvc->instances = g_slist_append(drvc->instances, sdi);
return sdi;
drvc->instances = g_slist_append(drvc->instances, sdi);
return sdi;
struct dev_context *devc;
GSList *l;
struct dev_context *devc;
GSList *l;
for (l = drvc->instances; l; l = l->next) {
if (!(sdi = l->data)) {
/* Log error, but continue cleaning up the rest. */
for (l = drvc->instances; l; l = l->next) {
if (!(sdi = l->data)) {
/* Log error, but continue cleaning up the rest. */
drvc->instances = NULL;
clear_instances();
drvc->instances = NULL;
clear_instances();
{
struct drv_context *drvc;
{
struct drv_context *drvc;
return drvc->instances;
}
return drvc->instances;
}
{
struct drv_context *drvc;
{
struct drv_context *drvc;
- if (!(drvc = hdi->priv))
+ if (!(drvc = di->priv))
return SR_OK;
clear_instances();
return SR_OK;
clear_instances();
struct sr_datafeed_packet packet;
struct timeval tv;
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct timeval tv;
struct dev_context *devc;
- struct drv_context *drvc = hdi->priv;
+ struct drv_context *drvc = di->priv;
const struct libusb_pollfd **lupfd;
int num_probes, i;
uint32_t trigger_offset;
const struct libusb_pollfd **lupfd;
int num_probes, i;
uint32_t trigger_offset;
struct sr_datafeed_header header;
struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
struct sr_datafeed_header header;
struct sr_datafeed_meta_analog meta;
struct dev_context *devc;
- struct drv_context *drvc = hdi->priv;
+ struct drv_context *drvc = di->priv;
int i;
if (sdi->status != SR_ST_ACTIVE)
int i;
if (sdi->status != SR_ST_ACTIVE)
};
SR_PRIV struct sr_dev_driver ols_driver_info;
};
SR_PRIV struct sr_dev_driver ols_driver_info;
-static struct sr_dev_driver *odi = &ols_driver_info;
+static struct sr_dev_driver *di = &ols_driver_info;
static int send_shortcommand(struct sr_serial_dev_inst *serial,
uint8_t command)
static int send_shortcommand(struct sr_serial_dev_inst *serial,
uint8_t command)
guchar tmp_c;
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
guchar tmp_c;
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, NULL, NULL);
devc = ols_dev_new();
sdi->priv = devc;
devc = ols_dev_new();
sdi->priv = devc;
return SR_ERR_MALLOC;
}
drvc->sr_ctx = sr_ctx;
return SR_ERR_MALLOC;
}
drvc->sr_ctx = sr_ctx;
char buf[8];
(void)options;
char buf[8];
(void)options;
devices = NULL;
conn = serialcomm = NULL;
devices = NULL;
conn = serialcomm = NULL;
/* Not an OLS -- some other board that uses the sump protocol. */
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
"Sump", "Logic Analyzer", "v1.0");
/* Not an OLS -- some other board that uses the sump protocol. */
sdi = sr_dev_inst_new(0, SR_ST_INACTIVE,
"Sump", "Logic Analyzer", "v1.0");
devc = ols_dev_new();
for (i = 0; i < 32; i++) {
if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
devc = ols_dev_new();
for (i = 0; i < 32; i++) {
if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
{
struct drv_context *drvc;
{
struct drv_context *drvc;
return drvc->instances;
}
return drvc->instances;
}
struct dev_context *devc;
int ret = SR_OK;
struct dev_context *devc;
int ret = SR_OK;
- if (!(drvc = odi->priv))
+ if (!(drvc = di->priv))
return SR_OK;
/* Properly close and free all devices. */
return SR_OK;
/* Properly close and free all devices. */
int num_channels, offset, i, j;
unsigned char byte;
int num_channels, offset, i, j;
unsigned char byte;
/* Find this device's devc struct by its fd. */
devc = NULL;
/* Find this device's devc struct by its fd. */
devc = NULL;
/* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */
SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info;
/* List of struct sr_dev_inst, maintained by dev_open()/dev_close(). */
SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info;
-static struct sr_dev_driver *zdi = &zeroplus_logic_cube_driver_info;
+static struct sr_dev_driver *di = &zeroplus_logic_cube_driver_info;
/*
* The hardware supports more samplerates than these, but these are the
/*
* The hardware supports more samplerates than these, but these are the
struct drv_context *drvc;
struct dev_context *devc;
struct drv_context *drvc;
struct dev_context *devc;
for (l = drvc->instances; l; l = l->next) {
sdi = l->data;
if (!(devc = sdi->priv)) {
for (l = drvc->instances; l; l = l->next) {
sdi = l->data;
if (!(devc = sdi->priv)) {
return SR_ERR_MALLOC;
}
drvc->sr_ctx = sr_ctx;
return SR_ERR_MALLOC;
}
drvc->sr_ctx = sr_ctx;
devices = NULL;
clear_instances();
devices = NULL;
clear_instances();
sr_err("zp: %s: sr_dev_inst_new failed", __func__);
return NULL;
}
sr_err("zp: %s: sr_dev_inst_new failed", __func__);
return NULL;
}
/* Allocate memory for our private driver context. */
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
/* Allocate memory for our private driver context. */
if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
{
struct drv_context *drvc;
{
struct drv_context *drvc;
return drvc->instances;
}
return drvc->instances;
}
static int hw_dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
static int hw_dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
- struct drv_context *drvc = zdi->priv;
+ struct drv_context *drvc = di->priv;
libusb_device **devlist, *dev;
struct libusb_device_descriptor des;
int device_count, ret, i;
libusb_device **devlist, *dev;
struct libusb_device_descriptor des;
int device_count, ret, i;
{
struct drv_context *drvc;
{
struct drv_context *drvc;
- if (!(drvc = zdi->priv))
+ if (!(drvc = di->priv))
return SR_OK;
clear_instances();
return SR_OK;
clear_instances();