This now matches what the 'new-driver' tool generates.
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct sr_dev_inst *sdi;
struct drv_context *drvc;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
clear_instances();
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
- return std_hw_dev_acquisition_stop_serial(sdi, cb_data, hw_dev_close,
+ return std_hw_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
sdi->conn, LOG_PREFIX);
}
.name = "agilent-dmm",
.longname = "Agilent U12xx series DMMs",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
return alsa_scan(options, di);
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
int ret;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
int ret;
struct dev_context *devc;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
clear_instances();
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
int count, ret;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct sr_datafeed_packet packet;
struct dev_context *devc;
.name = "alsa",
.longname = "ALSA driver",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
SR_PRIV struct sr_dev_driver 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 int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static const uint64_t samplerates[] = {
SR_KHZ(200),
};
/* Prepare to upload firmware (FPGA specific). */
-static uint8_t init[] = {
+static uint8_t init_array[] = {
0x03, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
};
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct sr_dev_inst *sdi;
struct sr_probe *probe;
return NULL;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
sigma_write(suicide, sizeof(suicide), devc);
/* Prepare to upload firmware (FPGA specific). */
- sigma_write(init, sizeof(init), devc);
+ sigma_write(init_array, sizeof(init_array), devc);
ftdi_usb_purge_buffers(&devc->ftdic);
return SR_OK;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
int ret;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
if (!di->priv)
return SR_OK;
if (running_msec < devc->limit_msec && numchunks < 32767)
return TRUE; /* While capturing... */
else
- hw_dev_acquisition_stop(sdi, sdi);
+ dev_acquisition_stop(sdi, sdi);
}
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct clockselect_50 clockselect;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
uint8_t modestatus;
.name = "asix-sigma",
.longname = "ASIX SIGMA/SIGMA2",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
SR_PRIV struct sr_dev_driver brymen_bm857_driver_info;
static struct sr_dev_driver *di = &brymen_bm857_driver_info;
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
return devices;
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct sr_config *src;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
clear_instances();
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
- return std_hw_dev_acquisition_stop_serial(sdi, cb_data, hw_dev_close,
+ return std_hw_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
sdi->conn, LOG_PREFIX);
}
.name = "brymen-bm857",
.longname = "Brymen BM857",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
};
/* Function prototypes. */
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static void clear_helper(void *priv)
{
return std_dev_clear(di, clear_helper);
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct sr_dev_inst *sdi;
struct sr_probe *probe;
return NULL;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
int ret;
return SR_ERR;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
return clear_instances();
}
/* Get one block of data. */
if ((ret = la8_read_block(devc)) < 0) {
sr_err("%s: la8_read_block error: %d.", __func__, ret);
- hw_dev_acquisition_stop(sdi, sdi);
+ dev_acquisition_stop(sdi, sdi);
return FALSE;
}
for (i = 0; i < NUM_BLOCKS; i++)
send_block_to_session_bus(devc, i);
- hw_dev_acquisition_stop(sdi, sdi);
+ dev_acquisition_stop(sdi, sdi);
return TRUE;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
uint8_t buf[4];
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct sr_datafeed_packet packet;
.name = "chronovu-la8",
.longname = "ChronoVu LA8",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct dev_context *devc;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
clear_instances();
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
- return std_hw_dev_acquisition_stop_serial(sdi, cb_data, hw_dev_close,
+ return std_hw_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
sdi->conn, LOG_PREFIX);
}
.name = "colead-slm",
.longname = "Colead SLM",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
SR_PRIV struct sr_dev_driver demo_driver_info;
static struct sr_dev_driver *di = &demo_driver_info;
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static int clear_instances(void)
{
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct sr_dev_inst *sdi;
struct sr_probe *probe;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
sdi->status = SR_ST_ACTIVE;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
sdi->status = SR_ST_INACTIVE;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
GSList *l;
struct sr_dev_inst *sdi;
if (devc->limit_samples &&
devc->samples_counter >= devc->limit_samples) {
sr_info("Requested number of samples reached.");
- hw_dev_acquisition_stop(devc->sdi, cb_data);
+ dev_acquisition_stop(devc->sdi, cb_data);
return TRUE;
}
return TRUE;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *const devc = sdi->priv;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *const devc = sdi->priv;
struct sr_datafeed_packet packet;
.name = "demo",
.longname = "Demo driver and pattern generator",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
return devices;
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct sr_config *src;
GSList *l, *devices;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
clear_instances();
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
- return std_hw_dev_acquisition_stop_serial(sdi, cb_data, hw_dev_close,
+ return std_hw_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
sdi->conn, LOG_PREFIX);
}
.name = "fluke-dmm",
.longname = "Fluke 18x/28x series DMMs",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
return std_dev_clear(di, NULL);
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct dev_context *devc;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_usb_dev_inst *usb;
struct dev_context *devc;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_usb_dev_inst *usb;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
struct drv_context *drvc;
int ret;
return timeout + timeout / 4; /* Leave a headroom of 25% percent. */
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct drv_context *drvc;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
(void)cb_data;
.name = "fx2lafw",
.longname = "fx2lafw (generic driver for FX2 based LAs)",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
SR_PRIV struct sr_dev_driver 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 dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof)
{
return std_dev_clear(di, clear_dev_context);
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct dev_context *devc;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_usb_dev_inst *usb;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
dso_close(sdi);
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
struct drv_context *drvc;
return TRUE;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
const struct libusb_pollfd **lupfd;
struct dev_context *devc;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
.name = "hantek-dso",
.longname = "Hantek DSO",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
SR_PRIV struct sr_dev_inst *lascar_scan(int bus, int address);
SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info;
static struct sr_dev_driver *di = &lascar_el_usb_driver_info;
-static int hw_dev_close(struct sr_dev_inst *sdi);
+static int dev_close(struct sr_dev_inst *sdi);
static const int32_t hwopts[] = {
SR_CONF_CONN,
if (!(devc = sdi->priv))
continue;
- hw_dev_close(sdi);
+ dev_close(sdi);
sr_usb_dev_inst_free(sdi->conn);
sr_dev_inst_free(sdi);
}
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct sr_dev_inst *sdi;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct drv_context *drvc;
struct sr_usb_dev_inst *usb;
return ret;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_usb_dev_inst *usb;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
struct drv_context *drvc;
return ret;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct sr_datafeed_packet packet;
struct sr_datafeed_meta meta;
return SR_OK;
}
-SR_PRIV int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
(void)cb_data;
.name = "lascar-el-usb",
.longname = "Lascar EL-USB",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
switch (transfer->status) {
case LIBUSB_TRANSFER_NO_DEVICE:
/* USB device was unplugged. */
- hw_dev_acquisition_stop(sdi, sdi);
+ dev_acquisition_stop(sdi, sdi);
return;
case LIBUSB_TRANSFER_COMPLETED:
case LIBUSB_TRANSFER_TIMED_OUT: /* We may have received some data though */
devc->rcvd_bytes, devc->log_size,
devc->rcvd_samples, devc->logged_samples);
if (devc->rcvd_bytes >= devc->log_size)
- hw_dev_acquisition_stop(sdi, sdi);
+ dev_acquisition_stop(sdi, sdi);
}
if (sdi->status == SR_ST_ACTIVE) {
libusb_error_name(ret));
g_free(transfer->buffer);
libusb_free_transfer(transfer);
- hw_dev_acquisition_stop(sdi, sdi);
+ dev_acquisition_stop(sdi, sdi);
}
} else {
/* This was the last transfer we're going to receive, so
SR_PRIV int lascar_start_logging(const struct sr_dev_inst *sdi);
SR_PRIV int lascar_stop_logging(const struct sr_dev_inst *sdi);
SR_PRIV int lascar_is_logging(const struct sr_dev_inst *sdi);
-SR_PRIV int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
+SR_PRIV int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
#endif
SR_PRIV struct sr_dev_driver link_mso19_driver_info;
static struct sr_dev_driver *di = &link_mso19_driver_info;
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
int i;
GSList *devices = NULL;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
int ret;
struct dev_context *devc;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
GSList *l;
struct sr_dev_inst *sdi;
ret = SR_ERR_BUG;
continue;
}
- hw_dev_close(sdi);
+ dev_close(sdi);
sr_serial_dev_inst_free(devc->serial);
sr_dev_inst_free(sdi);
}
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
int ret = SR_ERR;
}
/* This stops acquisition on ALL devices, ignoring dev_index. */
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
(void)cb_data;
.name = "link-mso19",
.longname = "Link Instruments MSO-19",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
- .dev_clear = hw_cleanup,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
+ .dev_clear = cleanup,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
return std_dev_clear(mic_devs[idx].di, NULL);
}
-static int hw_init(struct sr_context *sr_ctx, int idx)
+static int init(struct sr_context *sr_ctx, int idx)
{
sr_dbg("Selected '%s' subdriver.", mic_devs[idx].di->name);
return std_hw_init(sr_ctx, mic_devs[idx].di, LOG_PREFIX);
}
-static GSList *scan(const char *conn, const char *serialcomm, int idx)
+static GSList *mic_scan(const char *conn, const char *serialcomm, int idx)
{
struct sr_dev_inst *sdi;
struct drv_context *drvc;
return devices;
}
-static GSList *hw_scan(GSList *options, int idx)
+static GSList *scan(GSList *options, int idx)
{
struct sr_config *src;
GSList *l, *devices;
if (serialcomm) {
/* Use the provided comm specs. */
- devices = scan(conn, serialcomm, idx);
+ devices = mic_scan(conn, serialcomm, idx);
} else {
/* Try the default. */
- devices = scan(conn, mic_devs[idx].conn, idx);
+ devices = mic_scan(conn, mic_devs[idx].conn, idx);
}
return devices;
}
-static GSList *hw_dev_list(int idx)
+static GSList *dev_list(int idx)
{
return ((struct drv_context *)(mic_devs[idx].di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_cleanup(int idx)
+static int cleanup(int idx)
{
return clear_instances(idx);
}
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
+static int dev_acquisition_start(const struct sr_dev_inst *sdi,
void *cb_data, int idx)
{
struct dev_context *devc;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
- return std_hw_dev_acquisition_stop_serial(sdi, cb_data, hw_dev_close,
+ return std_hw_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
sdi->conn, LOG_PREFIX);
}
/* Driver-specific API function wrappers */
#define HW_INIT(X) \
-static int hw_init_##X(struct sr_context *sr_ctx) { return hw_init(sr_ctx, X); }
+static int init_##X(struct sr_context *sr_ctx) { return init(sr_ctx, X); }
#define HW_CLEANUP(X) \
-static int hw_cleanup_##X(void) { return hw_cleanup(X); }
+static int cleanup_##X(void) { return cleanup(X); }
#define HW_SCAN(X) \
-static GSList *hw_scan_##X(GSList *options) { return hw_scan(options, X); }
+static GSList *scan_##X(GSList *options) { return scan(options, X); }
#define HW_DEV_LIST(X) \
-static GSList *hw_dev_list_##X(void) { return hw_dev_list(X); }
+static GSList *dev_list_##X(void) { return dev_list(X); }
#define CLEAR_INSTANCES(X) \
static int clear_instances_##X(void) { return clear_instances(X); }
#define HW_DEV_ACQUISITION_START(X) \
-static int hw_dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
-void *cb_data) { return hw_dev_acquisition_start(sdi, cb_data, X); }
+static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
+void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }
/* Driver structs and API function wrappers */
#define DRV(ID, ID_UPPER, NAME, LONGNAME) \
.name = NAME, \
.longname = LONGNAME, \
.api_version = 1, \
- .init = hw_init_##ID_UPPER, \
- .cleanup = hw_cleanup_##ID_UPPER, \
- .scan = hw_scan_##ID_UPPER, \
- .dev_list = hw_dev_list_##ID_UPPER, \
+ .init = init_##ID_UPPER, \
+ .cleanup = cleanup_##ID_UPPER, \
+ .scan = scan_##ID_UPPER, \
+ .dev_list = dev_list_##ID_UPPER, \
.dev_clear = clear_instances_##ID_UPPER, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
- .dev_open = hw_dev_open, \
- .dev_close = hw_dev_close, \
- .dev_acquisition_start = hw_dev_acquisition_start_##ID_UPPER, \
- .dev_acquisition_stop = hw_dev_acquisition_stop, \
+ .dev_open = dev_open, \
+ .dev_close = dev_close, \
+ .dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
+ .dev_acquisition_stop = dev_acquisition_stop, \
.priv = NULL, \
};
SR_PRIV struct sr_dev_driver nexus_osciprime_driver_info;
static struct sr_dev_driver *di = &nexus_osciprime_driver_info;
-static int hw_dev_close(struct sr_dev_inst *sdi);
+static int dev_close(struct sr_dev_inst *sdi);
/* Properly close and free all devices. */
static int clear_instances(void)
if (!(devc = sdi->priv))
continue;
- hw_dev_close(sdi);
+ dev_close(sdi);
sr_usb_dev_inst_free(devc->usb);
sr_dev_inst_free(sdi);
}
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct dev_context *devc;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
/* TODO */
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
/* TODO */
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
clear_instances();
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
/* TODO */
(void)cb_data;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
(void)cb_data;
.name = "nexus-osciprime",
.longname = "Nexus OsciPrime",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
return SR_OK;
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct sr_config *src;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
if (serial_open(sdi->conn, SERIAL_RDWR) != SR_OK)
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
clear_instances();
.name = "rigol-ds1xx2",
.longname = "Rigol DS1xx2",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
.dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
return std_dev_clear(dmms[dmm].di, NULL);
}
-static int hw_init(struct sr_context *sr_ctx, int dmm)
+static int init(struct sr_context *sr_ctx, int dmm)
{
sr_dbg("Selected '%s' subdriver.", dmms[dmm].di->name);
return std_hw_init(sr_ctx, dmms[dmm].di, LOG_PREFIX);
}
-static GSList *scan(const char *conn, const char *serialcomm, int dmm)
+static GSList *sdmm_scan(const char *conn, const char *serialcomm, int dmm)
{
struct sr_dev_inst *sdi;
struct drv_context *drvc;
return devices;
}
-static GSList *hw_scan(GSList *options, int dmm)
+static GSList *scan(GSList *options, int dmm)
{
struct sr_config *src;
GSList *l, *devices;
if (serialcomm) {
/* Use the provided comm specs. */
- devices = scan(conn, serialcomm, dmm);
+ devices = sdmm_scan(conn, serialcomm, dmm);
} else {
/* Try the default. */
- devices = scan(conn, dmms[dmm].conn, dmm);
+ devices = sdmm_scan(conn, dmms[dmm].conn, dmm);
}
return devices;
}
-static GSList *hw_dev_list(int dmm)
+static GSList *dev_list(int dmm)
{
return ((struct drv_context *)(dmms[dmm].di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_cleanup(int dmm)
+static int cleanup(int dmm)
{
return clear_instances(dmm);
}
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
+static int dev_acquisition_start(const struct sr_dev_inst *sdi,
void *cb_data, int dmm)
{
struct dev_context *devc;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
- return std_hw_dev_acquisition_stop_serial(sdi, cb_data, hw_dev_close,
+ return std_hw_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
sdi->conn, LOG_PREFIX);
}
/* Driver-specific API function wrappers */
#define HW_INIT(X) \
-static int hw_init_##X(struct sr_context *sr_ctx) { return hw_init(sr_ctx, X); }
+static int init_##X(struct sr_context *sr_ctx) { return init(sr_ctx, X); }
#define HW_CLEANUP(X) \
-static int hw_cleanup_##X(void) { return hw_cleanup(X); }
+static int cleanup_##X(void) { return cleanup(X); }
#define HW_SCAN(X) \
-static GSList *hw_scan_##X(GSList *options) { return hw_scan(options, X); }
+static GSList *scan_##X(GSList *options) { return scan(options, X); }
#define HW_DEV_LIST(X) \
-static GSList *hw_dev_list_##X(void) { return hw_dev_list(X); }
+static GSList *dev_list_##X(void) { return dev_list(X); }
#define CLEAR_INSTANCES(X) \
static int clear_instances_##X(void) { return clear_instances(X); }
#define HW_DEV_ACQUISITION_START(X) \
-static int hw_dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
-void *cb_data) { return hw_dev_acquisition_start(sdi, cb_data, X); }
+static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
+void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }
/* Driver structs and API function wrappers */
#define DRV(ID, ID_UPPER, NAME, LONGNAME) \
.name = NAME, \
.longname = LONGNAME, \
.api_version = 1, \
- .init = hw_init_##ID_UPPER, \
- .cleanup = hw_cleanup_##ID_UPPER, \
- .scan = hw_scan_##ID_UPPER, \
- .dev_list = hw_dev_list_##ID_UPPER, \
+ .init = init_##ID_UPPER, \
+ .cleanup = cleanup_##ID_UPPER, \
+ .scan = scan_##ID_UPPER, \
+ .dev_list = dev_list_##ID_UPPER, \
.dev_clear = clear_instances_##ID_UPPER, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
- .dev_open = hw_dev_open, \
- .dev_close = hw_dev_close, \
- .dev_acquisition_start = hw_dev_acquisition_start_##ID_UPPER, \
- .dev_acquisition_stop = hw_dev_acquisition_stop, \
+ .dev_open = dev_open, \
+ .dev_close = dev_close, \
+ .dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
+ .dev_acquisition_stop = dev_acquisition_stop, \
.priv = NULL, \
};
return std_dev_clear(di, NULL);
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct dev_context *devc;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_serial_dev_inst *serial;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
return clear_instances();
}
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
+static int dev_acquisition_start(const struct sr_dev_inst *sdi,
void *cb_data)
{
struct dev_context *devc;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
- return std_hw_dev_acquisition_stop_serial(sdi, cb_data, hw_dev_close,
+ return std_hw_dev_acquisition_stop_serial(sdi, cb_data, dev_close,
sdi->conn, LOG_PREFIX);
}
.name = "tondaj-sl-814",
.longname = "Tondaj SL-814",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = NULL,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
return std_dev_clear(udmms[dmm].di, NULL);
}
-static int hw_init(struct sr_context *sr_ctx, int dmm)
+static int init(struct sr_context *sr_ctx, int dmm)
{
sr_dbg("Selected '%s' subdriver.", udmms[dmm].di->name);
return std_hw_init(sr_ctx, udmms[dmm].di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options, int dmm)
+static GSList *scan(GSList *options, int dmm)
{
GSList *usb_devices, *devices, *l;
struct sr_dev_inst *sdi;
return devices;
}
-static GSList *hw_dev_list(int dmm)
+static GSList *dev_list(int dmm)
{
return ((struct drv_context *)(udmms[dmm].di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi, int dmm)
+static int dev_open(struct sr_dev_inst *sdi, int dmm)
{
struct drv_context *drvc;
struct sr_usb_dev_inst *usb;
return ret;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
(void)sdi;
return SR_OK;
}
-static int hw_cleanup(int dmm)
+static int cleanup(int dmm)
{
return clear_instances(dmm);
}
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
+static int dev_acquisition_start(const struct sr_dev_inst *sdi,
void *cb_data, int dmm)
{
struct dev_context *devc;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct sr_datafeed_packet packet;
/* Driver-specific API function wrappers */
#define HW_INIT(X) \
-static int hw_init_##X(struct sr_context *sr_ctx) { return hw_init(sr_ctx, X); }
+static int init_##X(struct sr_context *sr_ctx) { return init(sr_ctx, X); }
#define HW_CLEANUP(X) \
-static int hw_cleanup_##X(void) { return hw_cleanup(X); }
+static int cleanup_##X(void) { return cleanup(X); }
#define HW_SCAN(X) \
-static GSList *hw_scan_##X(GSList *options) { return hw_scan(options, X); }
+static GSList *scan_##X(GSList *options) { return scan(options, X); }
#define HW_DEV_LIST(X) \
-static GSList *hw_dev_list_##X(void) { return hw_dev_list(X); }
+static GSList *dev_list_##X(void) { return dev_list(X); }
#define CLEAR_INSTANCES(X) \
static int clear_instances_##X(void) { return clear_instances(X); }
#define HW_DEV_ACQUISITION_START(X) \
-static int hw_dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
-void *cb_data) { return hw_dev_acquisition_start(sdi, cb_data, X); }
+static int dev_acquisition_start_##X(const struct sr_dev_inst *sdi, \
+void *cb_data) { return dev_acquisition_start(sdi, cb_data, X); }
#define HW_DEV_OPEN(X) \
-static int hw_dev_open_##X(struct sr_dev_inst *sdi) { return hw_dev_open(sdi, X); }
+static int dev_open_##X(struct sr_dev_inst *sdi) { return dev_open(sdi, X); }
/* Driver structs and API function wrappers */
#define DRV(ID, ID_UPPER, NAME, LONGNAME) \
.name = NAME, \
.longname = LONGNAME, \
.api_version = 1, \
- .init = hw_init_##ID_UPPER, \
- .cleanup = hw_cleanup_##ID_UPPER, \
- .scan = hw_scan_##ID_UPPER, \
- .dev_list = hw_dev_list_##ID_UPPER, \
+ .init = init_##ID_UPPER, \
+ .cleanup = cleanup_##ID_UPPER, \
+ .scan = scan_##ID_UPPER, \
+ .dev_list = dev_list_##ID_UPPER, \
.dev_clear = clear_instances_##ID_UPPER, \
.config_get = NULL, \
.config_set = config_set, \
.config_list = config_list, \
- .dev_open = hw_dev_open_##ID_UPPER, \
- .dev_close = hw_dev_close, \
- .dev_acquisition_start = hw_dev_acquisition_start_##ID_UPPER, \
- .dev_acquisition_stop = hw_dev_acquisition_stop, \
+ .dev_open = dev_open_##ID_UPPER, \
+ .dev_close = dev_close, \
+ .dev_acquisition_start = dev_acquisition_start_##ID_UPPER, \
+ .dev_acquisition_stop = dev_acquisition_stop, \
.priv = NULL, \
};
SR_PRIV struct sr_dev_driver victor_dmm_driver_info;
static struct sr_dev_driver *di = &victor_dmm_driver_info;
-static int hw_dev_close(struct sr_dev_inst *sdi);
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
+static int dev_close(struct sr_dev_inst *sdi);
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static const int32_t hwopts[] = {
SR_CONF_CONN,
continue;
if (!(devc = sdi->priv))
continue;
- hw_dev_close(sdi);
+ dev_close(sdi);
sr_usb_dev_inst_free(sdi->conn);
sr_dev_inst_free(sdi);
}
return SR_OK;
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct dev_context *devc;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct drv_context *drvc = di->priv;
struct sr_usb_dev_inst *usb;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_usb_dev_inst *usb;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
struct drv_context *drvc;
devc = sdi->priv;
if (transfer->status == LIBUSB_TRANSFER_NO_DEVICE) {
/* USB device was unplugged. */
- hw_dev_acquisition_stop(sdi, sdi);
+ dev_acquisition_stop(sdi, sdi);
} else if (transfer->status == LIBUSB_TRANSFER_COMPLETED) {
sr_dbg("Got %d-byte packet.", transfer->actual_length);
if (transfer->actual_length == DMM_DATA_SIZE) {
victor_dmm_receive_data(sdi, transfer->buffer);
if (devc->limit_samples) {
if (devc->num_samples >= devc->limit_samples)
- hw_dev_acquisition_stop(sdi, sdi);
+ dev_acquisition_stop(sdi, sdi);
}
}
}
libusb_error_name(ret));
g_free(transfer->buffer);
libusb_free_transfer(transfer);
- hw_dev_acquisition_stop(sdi, sdi);
+ dev_acquisition_stop(sdi, sdi);
}
} else {
/* This was the last transfer we're going to receive, so
if (devc->limit_msec) {
now = g_get_monotonic_time() / 1000;
if (now > devc->end_time)
- hw_dev_acquisition_stop(sdi, sdi);
+ dev_acquisition_stop(sdi, sdi);
}
if (sdi->status == SR_ST_STOPPING) {
for (i = 0; devc->usbfd[i] != -1; i++)
sr_source_remove(devc->usbfd[i]);
- hw_dev_close(sdi);
+ dev_close(sdi);
packet.type = SR_DF_END;
sr_session_send(cb_data, &packet);
return TRUE;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct drv_context *drvc = di->priv;
return SR_OK;
}
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
(void)cb_data;
.name = "victor-dmm",
.longname = "Victor DMMs",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
.dev_clear = clear_instances,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
SR_MHZ(200),
};
-static int hw_dev_close(struct sr_dev_inst *sdi);
+static int dev_close(struct sr_dev_inst *sdi);
#if 0
static int configure_probes(const struct sr_dev_inst *sdi)
return std_dev_clear(di, NULL);
}
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
return std_hw_init(sr_ctx, di, "zeroplus: ");
}
-static GSList *hw_scan(GSList *options)
+static GSList *scan(GSList *options)
{
struct sr_dev_inst *sdi;
struct sr_probe *probe;
return devices;
}
-static GSList *hw_dev_list(void)
+static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct drv_context *drvc;
return SR_OK;
}
-static int hw_dev_close(struct sr_dev_inst *sdi)
+static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_usb_dev_inst *usb;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
return clear_instances();
}
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
+static int dev_acquisition_start(const struct sr_dev_inst *sdi,
void *cb_data)
{
struct dev_context *devc;
}
/* TODO: This stops acquisition on ALL devices, ignoring dev_index. */
-static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
+static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
{
struct dev_context *devc;
struct sr_usb_dev_inst *usb;
.name = "zeroplus-logic-cube",
.longname = "ZEROPLUS Logic Cube LAP-C series",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
- .scan = hw_scan,
- .dev_list = hw_dev_list,
- .dev_clear = hw_cleanup,
+ .init = init,
+ .cleanup = cleanup,
+ .scan = scan,
+ .dev_list = dev_list,
+ .dev_clear = cleanup,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
- .dev_close = hw_dev_close,
- .dev_acquisition_start = hw_dev_acquisition_start,
- .dev_acquisition_stop = hw_dev_acquisition_stop,
+ .dev_open = dev_open,
+ .dev_close = dev_close,
+ .dev_acquisition_start = dev_acquisition_start,
+ .dev_acquisition_stop = dev_acquisition_stop,
.priv = NULL,
};
SR_PRIV int std_hw_init(struct sr_context *sr_ctx, struct sr_dev_driver *di,
const char *prefix);
SR_PRIV int std_hw_dev_acquisition_stop_serial(struct sr_dev_inst *sdi,
- void *cb_data, dev_close_t hw_dev_close_fn,
+ void *cb_data, dev_close_t dev_close_fn,
struct sr_serial_dev_inst *serial, const char *prefix);
SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi,
const char *prefix);
}
/* driver callbacks */
-static int hw_cleanup(void);
+static int cleanup(void);
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
{
(void)sr_ctx;
return SR_OK;
}
-static int hw_cleanup(void)
+static int cleanup(void)
{
GSList *l;
return SR_OK;
}
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
{
if (!(sdi->priv = g_try_malloc0(sizeof(struct session_vdev)))) {
sr_err("%s: sdi->priv malloc failed", __func__);
return SR_OK;
}
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
- void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
struct zip_stat zs;
struct session_vdev *vdev;
.name = "virtual-session",
.longname = "Session-emulating driver",
.api_version = 1,
- .init = hw_init,
- .cleanup = hw_cleanup,
+ .init = init,
+ .cleanup = cleanup,
.config_get = config_get,
.config_set = config_set,
.config_list = config_list,
- .dev_open = hw_dev_open,
+ .dev_open = dev_open,
.dev_close = NULL,
- .dev_acquisition_start = hw_dev_acquisition_start,
+ .dev_acquisition_start = dev_acquisition_start,
.dev_acquisition_stop = NULL,
};
/**
* Standard sr_driver_init() API helper.
*
- * This function can be used to simplify most driver's hw_init() API callback.
+ * This function can be used to simplify most driver's init() API callback.
*
* It creates a new 'struct drv_context' (drvc), assigns sr_ctx to it, and
* then 'drvc' is assigned to the 'struct sr_dev_driver' (di) that is passed.
* Standard API helper for sending an SR_DF_HEADER packet.
*
* This function can be used to simplify most driver's
- * hw_dev_acquisition_start() API callback.
+ * dev_acquisition_start() API callback.
*
* @param sdi The device instance to use.
* @param prefix A driver-specific prefix string used for log messages.
* Standard sr_session_stop() API helper.
*
* This function can be used to simplify most (serial port based) driver's
- * hw_dev_acquisition_stop() API callback.
+ * dev_acquisition_stop() API callback.
*
* @param sdi The device instance for which acquisition should stop.
* Must not be NULL.
* @param cb_data Opaque 'cb_data' pointer. Must not be NULL.
- * @param hw_dev_close_fn Function pointer to the driver's hw_dev_close().
+ * @param dev_close_fn Function pointer to the driver's dev_close().
* Must not be NULL.
* @param serial The serial device instance (struct serial_dev_inst *).
* Must not be NULL.
* SR_ERR upon other errors.
*/
SR_PRIV int std_hw_dev_acquisition_stop_serial(struct sr_dev_inst *sdi,
- void *cb_data, dev_close_t hw_dev_close_fn,
+ void *cb_data, dev_close_t dev_close_fn,
struct sr_serial_dev_inst *serial, const char *prefix)
{
int ret;
return ret;
}
- if ((ret = hw_dev_close_fn(sdi)) < 0) {
+ if ((ret = dev_close_fn(sdi)) < 0) {
sr_err("%sFailed to close device: %d.", prefix, ret);
return ret;
}