Use consistent API callback function names.

This now matches what the 'new-driver' tool generates.
This commit is contained in:
Uwe Hermann 2013-05-10 19:37:54 +02:00
parent 8111446ae0
commit 6078d2c996
25 changed files with 394 additions and 408 deletions

View File

@ -89,12 +89,12 @@ 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 drv_context *drvc;
@ -187,12 +187,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -205,7 +205,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -218,7 +218,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
clear_instances();
@ -282,7 +282,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *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 sr_serial_dev_inst *serial;
@ -307,9 +307,9 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi, 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)
{
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);
}
@ -317,17 +317,17 @@ SR_PRIV struct sr_dev_driver agdmm_driver_info = {
.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,
};

View File

@ -49,22 +49,22 @@ 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)
{
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;
@ -97,7 +97,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -119,7 +119,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
clear_instances();
@ -200,8 +200,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *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 count, ret;
@ -300,7 +299,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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;
@ -322,17 +321,17 @@ SR_PRIV struct sr_dev_driver alsa_driver_info = {
.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,
};

View File

@ -42,7 +42,7 @@
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),
@ -81,7 +81,7 @@ static uint8_t suicide[] = {
};
/* Prepare to upload firmware (FPGA specific). */
static uint8_t init[] = {
static uint8_t init_array[] = {
0x03, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
};
@ -408,12 +408,12 @@ 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;
@ -499,7 +499,7 @@ free:
return NULL;
}
static GSList *hw_dev_list(void)
static GSList *dev_list(void)
{
return ((struct drv_context *)(di->priv))->instances;
}
@ -541,7 +541,7 @@ static int upload_firmware(int firmware_idx, struct dev_context *devc)
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);
@ -598,7 +598,7 @@ static int upload_firmware(int firmware_idx, struct dev_context *devc)
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;
@ -738,7 +738,7 @@ static int configure_probes(const struct sr_dev_inst *sdi)
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;
@ -753,7 +753,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
if (!di->priv)
return SR_OK;
@ -1044,7 +1044,7 @@ static int receive_data(int fd, int revents, void *cb_data)
if (running_msec < devc->limit_msec && numchunks < 32767)
return TRUE; /* While capturing... */
else
hw_dev_acquisition_stop(sdi, sdi);
dev_acquisition_stop(sdi, sdi);
}
@ -1262,8 +1262,7 @@ static int build_basic_trigger(struct triggerlut *lut, struct dev_context *devc)
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;
@ -1373,7 +1372,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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;
@ -1414,17 +1413,17 @@ SR_PRIV struct sr_dev_driver asix_sigma_driver_info = {
.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,
};

View File

@ -34,7 +34,7 @@ static const int32_t hwcaps[] = {
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);
}
@ -129,7 +129,7 @@ scan_cleanup:
return devices;
}
static GSList *hw_scan(GSList *options)
static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct sr_config *src;
@ -166,12 +166,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -184,7 +184,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -197,7 +197,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
clear_instances();
@ -252,8 +252,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *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 sr_serial_dev_inst *serial;
@ -287,9 +286,9 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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);
}
@ -297,17 +296,17 @@ SR_PRIV struct sr_dev_driver brymen_bm857_driver_info = {
.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,
};

View File

@ -54,7 +54,7 @@ static const uint16_t usb_pids[] = {
};
/* 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)
{
@ -71,12 +71,12 @@ static int clear_instances(void)
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;
@ -181,12 +181,12 @@ err_free_nothing:
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;
@ -239,7 +239,7 @@ err_dev_open_close_ftdic:
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;
@ -257,7 +257,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
return clear_instances();
}
@ -387,7 +387,7 @@ static int receive_data(int fd, int revents, void *cb_data)
/* 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;
}
@ -403,13 +403,12 @@ static int receive_data(int fd, int revents, void *cb_data)
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];
@ -475,7 +474,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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;
@ -496,17 +495,17 @@ SR_PRIV struct sr_dev_driver chronovu_la8_driver_info = {
.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,
};

View File

@ -72,12 +72,12 @@ 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 drv_context *drvc;
struct dev_context *devc;
@ -133,12 +133,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -151,7 +151,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -164,7 +164,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
clear_instances();
@ -227,8 +227,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *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 sr_serial_dev_inst *serial;
@ -254,9 +253,9 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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);
}
@ -264,17 +263,17 @@ SR_PRIV struct sr_dev_driver colead_slm_driver_info = {
.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,
};

View File

@ -141,7 +141,7 @@ static uint8_t pattern_sigrok[] = {
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)
{
@ -150,12 +150,12 @@ 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;
@ -203,26 +203,26 @@ static GSList *hw_scan(GSList *options)
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;
@ -447,15 +447,14 @@ static int receive_data(int fd, int revents, void *cb_data)
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;
@ -500,7 +499,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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;
@ -525,17 +524,17 @@ SR_PRIV struct sr_dev_driver demo_driver_info = {
.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,
};

View File

@ -87,7 +87,7 @@ 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);
}
@ -182,7 +182,7 @@ static GSList *fluke_scan(const char *conn, const char *serialcomm)
return devices;
}
static GSList *hw_scan(GSList *options)
static GSList *scan(GSList *options)
{
struct sr_config *src;
GSList *l, *devices;
@ -220,12 +220,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -238,7 +238,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -251,7 +251,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
clear_instances();
@ -315,8 +315,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *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 sr_serial_dev_inst *serial;
@ -348,9 +347,9 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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);
}
@ -358,17 +357,17 @@ SR_PRIV struct sr_dev_driver flukedmm_driver_info = {
.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,
};

View File

@ -351,12 +351,12 @@ static int clear_instances(void)
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;
@ -471,12 +471,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -547,7 +547,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -565,7 +565,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
struct drv_context *drvc;
int ret;
@ -935,8 +935,7 @@ static unsigned int get_timeout(struct dev_context *devc)
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;
@ -1022,7 +1021,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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;
@ -1035,17 +1034,17 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = {
.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,
};

View File

@ -155,7 +155,7 @@ static const char *coupling[] = {
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)
{
@ -249,12 +249,12 @@ static int clear_instances(void)
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;
@ -357,12 +357,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -410,14 +410,14 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -912,8 +912,7 @@ static int handle_event(int fd, int revents, void *cb_data)
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;
@ -950,7 +949,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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;
@ -969,17 +968,17 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = {
.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,
};

View File

@ -26,7 +26,7 @@
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,
@ -56,7 +56,7 @@ static int clear_instances(void)
if (!(devc = sdi->priv))
continue;
hw_dev_close(sdi);
dev_close(sdi);
sr_usb_dev_inst_free(sdi->conn);
sr_dev_inst_free(sdi);
}
@ -67,12 +67,12 @@ 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 drv_context *drvc;
struct sr_dev_inst *sdi;
@ -118,12 +118,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -148,7 +148,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -171,7 +171,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
struct drv_context *drvc;
@ -347,8 +347,7 @@ static int lascar_proc_config(const struct sr_dev_inst *sdi)
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;
@ -480,7 +479,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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;
@ -504,17 +503,17 @@ SR_PRIV struct sr_dev_driver lascar_el_usb_driver_info = {
.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,
};

View File

@ -532,7 +532,7 @@ SR_PRIV void lascar_el_usb_receive_transfer(struct libusb_transfer *transfer)
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 */
@ -551,7 +551,7 @@ SR_PRIV void lascar_el_usb_receive_transfer(struct libusb_transfer *transfer)
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) {
@ -561,7 +561,7 @@ SR_PRIV void lascar_el_usb_receive_transfer(struct libusb_transfer *transfer)
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

View File

@ -82,6 +82,6 @@ SR_PRIV void lascar_el_usb_receive_transfer(struct libusb_transfer *transfer);
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

View File

@ -51,12 +51,12 @@ static const uint64_t samplerates[] = {
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;
@ -198,12 +198,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -234,7 +234,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -248,7 +248,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
GSList *l;
struct sr_dev_inst *sdi;
@ -273,7 +273,7 @@ static int hw_cleanup(void)
ret = SR_ERR_BUG;
continue;
}
hw_dev_close(sdi);
dev_close(sdi);
sr_serial_dev_inst_free(devc->serial);
sr_dev_inst_free(sdi);
}
@ -397,8 +397,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *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;
@ -465,7 +464,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
}
/* 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;
@ -478,17 +477,17 @@ SR_PRIV struct sr_dev_driver link_mso19_driver_info = {
.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,
};

View File

@ -54,14 +54,14 @@ static int clear_instances(int idx)
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;
@ -120,7 +120,7 @@ scan_cleanup:
return devices;
}
static GSList *hw_scan(GSList *options, int idx)
static GSList *scan(GSList *options, int idx)
{
struct sr_config *src;
GSList *l, *devices;
@ -143,21 +143,21 @@ static GSList *hw_scan(GSList *options, int idx)
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;
@ -170,7 +170,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -183,7 +183,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(int idx)
static int cleanup(int idx)
{
return clear_instances(idx);
}
@ -235,7 +235,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
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;
@ -260,26 +260,26 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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) \
@ -293,18 +293,18 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.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, \
};

View File

@ -105,7 +105,7 @@ static const uint64_t vdivs[][2] = {
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)
@ -124,7 +124,7 @@ 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);
}
@ -135,12 +135,12 @@ 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 drv_context *drvc;
struct dev_context *devc;
@ -209,12 +209,12 @@ static GSList *hw_scan(GSList *options)
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 */
@ -223,7 +223,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_dev_close(struct sr_dev_inst *sdi)
static int dev_close(struct sr_dev_inst *sdi)
{
/* TODO */
@ -232,7 +232,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
clear_instances();
@ -274,8 +274,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *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)
{
/* TODO */
(void)cb_data;
@ -286,7 +285,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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;
@ -304,17 +303,17 @@ SR_PRIV struct sr_dev_driver nexus_osciprime_driver_info = {
.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,
};

View File

@ -192,7 +192,7 @@ static int set_cfg(const struct sr_dev_inst *sdi, const char *format, ...)
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);
}
@ -297,7 +297,7 @@ static int probe_port(const char *port, GSList **devices)
return SR_OK;
}
static GSList *hw_scan(GSList *options)
static GSList *scan(GSList *options)
{
struct drv_context *drvc;
struct sr_config *src;
@ -345,12 +345,12 @@ static GSList *hw_scan(GSList *options)
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)
@ -364,7 +364,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -377,7 +377,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
clear_instances();
@ -659,16 +659,16 @@ SR_PRIV struct sr_dev_driver rigol_ds1xx2_driver_info = {
.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,

View File

@ -197,14 +197,14 @@ static int clear_instances(int dmm)
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;
@ -289,7 +289,7 @@ scan_cleanup:
return devices;
}
static GSList *hw_scan(GSList *options, int dmm)
static GSList *scan(GSList *options, int dmm)
{
struct sr_config *src;
GSList *l, *devices;
@ -312,21 +312,21 @@ static GSList *hw_scan(GSList *options, int dmm)
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;
@ -339,7 +339,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -352,7 +352,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(int dmm)
static int cleanup(int dmm)
{
return clear_instances(dmm);
}
@ -408,7 +408,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
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;
@ -443,26 +443,26 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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) \
@ -476,18 +476,18 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.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, \
};

View File

@ -45,12 +45,12 @@ static int clear_instances(void)
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;
@ -123,12 +123,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -141,7 +141,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -154,7 +154,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
return clear_instances();
}
@ -202,7 +202,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
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;
@ -225,9 +225,9 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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);
}
@ -235,17 +235,17 @@ SR_PRIV struct sr_dev_driver tondaj_sl_814_driver_info = {
.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,
};

View File

@ -94,14 +94,14 @@ static int clear_instances(int dmm)
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;
@ -163,12 +163,12 @@ static GSList *hw_scan(GSList *options, int dmm)
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;
@ -183,7 +183,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi, int dmm)
return ret;
}
static int hw_dev_close(struct sr_dev_inst *sdi)
static int dev_close(struct sr_dev_inst *sdi)
{
(void)sdi;
@ -194,7 +194,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(int dmm)
static int cleanup(int dmm)
{
return clear_instances(dmm);
}
@ -251,7 +251,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
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;
@ -271,7 +271,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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;
@ -292,20 +292,20 @@ static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
/* 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) \
@ -320,18 +320,18 @@ SR_PRIV struct sr_dev_driver ID##_driver_info = { \
.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, \
};

View File

@ -33,8 +33,8 @@
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,
@ -64,7 +64,7 @@ static int clear_instances(void)
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);
}
@ -75,12 +75,12 @@ 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 drv_context *drvc;
struct dev_context *devc;
@ -134,12 +134,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -190,7 +190,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -213,7 +213,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
struct drv_context *drvc;
@ -315,14 +315,14 @@ static void receive_transfer(struct libusb_transfer *transfer)
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);
}
}
}
@ -336,7 +336,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
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
@ -365,14 +365,14 @@ static int handle_events(int fd, int revents, void *cb_data)
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);
@ -385,8 +385,7 @@ static int handle_events(int fd, int revents, void *cb_data)
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;
@ -440,7 +439,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
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;
@ -463,17 +462,17 @@ SR_PRIV struct sr_dev_driver victor_dmm_driver_info = {
.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,
};

View File

@ -120,7 +120,7 @@ const uint64_t samplerates_200[] = {
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)
@ -243,12 +243,12 @@ static int clear_instances(void)
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;
@ -340,12 +340,12 @@ static GSList *hw_scan(GSList *options)
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;
@ -442,7 +442,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
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;
@ -462,7 +462,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
return SR_OK;
}
static int hw_cleanup(void)
static int cleanup(void)
{
return clear_instances();
}
@ -554,7 +554,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
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;
@ -634,7 +634,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
}
/* 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;
@ -659,17 +659,17 @@ SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info = {
.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,
};

View File

@ -128,7 +128,7 @@ typedef void (*std_dev_clear_t)(void *priv);
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);

View File

@ -115,16 +115,16 @@ static int receive_data(int fd, int revents, void *cb_data)
}
/* 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;
@ -136,7 +136,7 @@ static int hw_cleanup(void)
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__);
@ -217,8 +217,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *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 zip_stat zs;
struct session_vdev *vdev;
@ -261,13 +260,13 @@ SR_PRIV struct sr_dev_driver session_driver = {
.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,
};

12
std.c
View File

@ -25,7 +25,7 @@
/**
* 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.
@ -63,7 +63,7 @@ SR_PRIV int std_hw_init(struct sr_context *sr_ctx, struct sr_dev_driver *di,
* 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.
@ -105,12 +105,12 @@ SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi,
* 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.
@ -121,7 +121,7 @@ SR_PRIV int std_session_send_df_header(const struct sr_dev_inst *sdi,
* 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;
@ -144,7 +144,7 @@ SR_PRIV int std_hw_dev_acquisition_stop_serial(struct sr_dev_inst *sdi,
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;
}