]> sigrok.org Git - libsigrok.git/commitdiff
sr/cli/gtk/qt/: s/plugin/driver/.
authorUwe Hermann <redacted>
Tue, 28 Feb 2012 22:52:30 +0000 (23:52 +0100)
committerUwe Hermann <redacted>
Tue, 28 Feb 2012 22:52:30 +0000 (23:52 +0100)
25 files changed:
device.c
hardware/alsa/alsa.c
hardware/asix-sigma/asix-sigma.c
hardware/chronovu-la8/chronovu-la8.c
hardware/demo/demo.c
hardware/fx2lafw/fx2lafw.c
hardware/link-mso19/link-mso19.c
hardware/openbench-logic-sniffer/ols.c
hardware/saleae-logic/saleae-logic.c
hardware/zeroplus-logic-cube/zeroplus.c
hwplugin.c
output/analog.c
output/chronovu_la8.c
output/csv.c
output/gnuplot.c
output/ols.c
output/text/text.c
output/vcd.c
session.c
session_driver.c
session_file.c
sigrok-internal.h
sigrok-proto.h
sigrok.h
strutil.c

index eb2e2b4cb2c02b392c8f02f31095ca027128a9de..24ec602f90a21686bb42da96d712af4df36b73c3 100644 (file)
--- a/device.c
+++ b/device.c
@@ -60,21 +60,21 @@ static GSList *devs = NULL;
 SR_API int sr_dev_scan(void)
 {
        int i;
-       struct sr_dev_plugin **plugins;
+       struct sr_dev_driver **drivers;
 
-       plugins = sr_hw_list();
-       if (!plugins[0]) {
-               sr_err("dev: %s: no supported devices/hwplugins", __func__);
+       drivers = sr_hw_list();
+       if (!drivers[0]) {
+               sr_err("dev: %s: no supported hardware drivers", __func__);
                return SR_ERR; /* TODO: More specific error? */
        }
 
        /*
-        * Initialize all plugins first. Since the init() call may involve
+        * Initialize all drivers first. Since the init() call may involve
         * a firmware upload and associated delay, we may as well get all
         * of these out of the way first.
         */
-       for (i = 0; plugins[i]; i++)
-               sr_hw_init(plugins[i]);
+       for (i = 0; drivers[i]; i++)
+               sr_hw_init(drivers[i]);
 
        return SR_OK;
 }
@@ -111,26 +111,26 @@ SR_API GSList *sr_dev_list(void)
  * It is the caller's responsibility to g_free() the allocated memory when
  * no longer needed. TODO: Using which API function?
  *
- * @param plugin TODO.
- *               If 'plugin' is NULL, the created device is a "virtual" one.
- * @param plugin_index TODO
+ * @param driver TODO.
+ *               If 'driver' is NULL, the created device is a "virtual" one.
+ * @param driver_index TODO
  *
  * @return Pointer to the newly allocated device, or NULL upon errors.
  */
-SR_API struct sr_dev *sr_dev_new(const struct sr_dev_plugin *plugin,
-                                int plugin_index)
+SR_API struct sr_dev *sr_dev_new(const struct sr_dev_driver *driver,
+                                int driver_index)
 {
        struct sr_dev *dev;
 
-       /* TODO: Check if plugin_index valid? */
+       /* TODO: Check if driver_index valid? */
 
        if (!(dev = g_try_malloc0(sizeof(struct sr_dev)))) {
                sr_err("dev: %s: dev malloc failed", __func__);
                return NULL;
        }
 
-       dev->plugin = (struct sr_dev_plugin *)plugin;
-       dev->plugin_index = plugin_index;
+       dev->driver = (struct sr_dev_driver *)driver;
+       dev->driver_index = driver_index;
        devs = g_slist_append(devs, dev);
 
        return dev;
@@ -362,7 +362,7 @@ SR_API int sr_dev_trigger_set(struct sr_dev *dev, int probenum,
  * TODO: Should return int?
  *
  * @param dev Pointer to the device to be checked. Must not be NULL.
- *            The device's 'plugin' field must not be NULL either.
+ *            The device's 'driver' field must not be NULL either.
  * @param hwcap The capability that should be checked (whether it's supported
  *              by the specified device).
  *
@@ -379,14 +379,14 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
                return FALSE; /* TODO: SR_ERR_ARG. */
        }
 
-       if (!dev->plugin) {
-               sr_err("dev: %s: dev->plugin was NULL", __func__);
+       if (!dev->driver) {
+               sr_err("dev: %s: dev->driver was NULL", __func__);
                return FALSE; /* TODO: SR_ERR_ARG. */
        }
 
        /* TODO: Sanity check on 'hwcap'. */
 
-       if (!(hwcaps = dev->plugin->hwcap_get_all())) {
+       if (!(hwcaps = dev->driver->hwcap_get_all())) {
                sr_err("dev: %s: dev has no capabilities", __func__);
                return FALSE; /* TODO: SR_ERR*. */
        }
@@ -407,7 +407,7 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
  * Returns information about the given device.
  *
  * @param dev Pointer to the device to be checked. Must not be NULL.
- *            The device's 'plugin' field must not be NULL either.
+ *            The device's 'driver' field must not be NULL either.
  * @param id The type of information.
  * @param data The return value. Must not be NULL.
  *
@@ -416,13 +416,13 @@ SR_API gboolean sr_dev_has_hwcap(const struct sr_dev *dev, int hwcap)
  */
 SR_API int sr_dev_info_get(const struct sr_dev *dev, int id, const void **data)
 {
-       if ((dev == NULL) || (dev->plugin == NULL))
+       if ((dev == NULL) || (dev->driver == NULL))
                return SR_ERR_ARG;
 
        if (data == NULL)
                return SR_ERR_ARG;
 
-       *data = dev->plugin->dev_info_get(dev->plugin_index, id);
+       *data = dev->driver->dev_info_get(dev->driver_index, id);
 
        if (*data == NULL)
                return SR_ERR;
index 994183fc1dd20ce16cd60500927f89e76c71cb47..ba918b93c0e2440995d430b49abd11c5d231fad6 100644 (file)
@@ -395,7 +395,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id)
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_plugin alsa_plugin_info = {
+SR_PRIV struct sr_dev_driver alsa_driver_info = {
        .name = "alsa",
        .longname = "ALSA driver",
        .api_version = 1,
index bdb797a013a668303199abfb338ddc5ce3dbec66..a1f0a8ce91b8c063bcbc92a3a4c766521a0a8217 100644 (file)
@@ -1413,7 +1413,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_plugin asix_sigma_plugin_info = {
+SR_PRIV struct sr_dev_driver asix_sigma_driver_info = {
        .name = "asix-sigma",
        .longname = "ASIX SIGMA",
        .api_version = 1,
index 60384a1d15affc822d6639e44ac6d581f086902d..ab206e9339fcca39b278616e8f25fba6517a11d5 100644 (file)
@@ -1111,7 +1111,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_plugin chronovu_la8_plugin_info = {
+SR_PRIV struct sr_dev_driver chronovu_la8_driver_info = {
        .name = "chronovu-la8",
        .longname = "ChronoVu LA8",
        .api_version = 1,
index 8a84e8ce65a3d6b7d4f407da0107703f510eb6e2..710c1fcc2b231aafcf275c0172f1b58a3b259d03 100644 (file)
@@ -493,7 +493,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_plugin demo_plugin_info = {
+SR_PRIV struct sr_dev_driver demo_driver_info = {
        .name = "demo",
        .longname = "Demo driver and pattern generator",
        .api_version = 1,
index 5bb7b7af88242b234cc1f1586133d13da634dc66..720e99f7bbfd07e869f46336c4455739d313c746 100644 (file)
@@ -658,7 +658,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_plugin fx2lafw_plugin_info = {
+SR_PRIV struct sr_dev_driver fx2lafw_driver_info = {
        .name = "fx2lafw",
        .longname = "fx2lafw",
        .api_version = 1,
index 5eaf9bd31d23f22d34ff6c6fbba9a47ef138cb5b..8c972d06a2d9346e898429dd3185adb88d1c05ec 100644 (file)
@@ -834,7 +834,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id)
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_plugin link_mso19_plugin_info = {
+SR_PRIV struct sr_dev_driver link_mso19_driver_info = {
        .name = "link-mso19",
        .longname = "Link Instruments MSO-19",
        .api_version = 1,
index c1deb759e93a5d2bdecebe997187d57ff4ee1339..9579222b60453d61b869859437ac212aa3b89c7d 100644 (file)
@@ -1036,7 +1036,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id)
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_plugin ols_plugin_info = {
+SR_PRIV struct sr_dev_driver ols_driver_info = {
        .name = "ols",
        .longname = "Openbench Logic Sniffer",
        .api_version = 1,
index b986243b80a8693fe8bfbdb29c584e8e11596e1c..5e584e46b3b941332a3c2b6aef57669f74a07736 100644 (file)
@@ -893,7 +893,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_plugin saleae_logic_plugin_info = {
+SR_PRIV struct sr_dev_driver saleae_logic_driver_info = {
        .name = "saleae-logic",
        .longname = "Saleae Logic",
        .api_version = 1,
index e33de713e36edf936a704d06510a009addec39a9..db717f65e0a8175da79110d083790b978bfdc60c 100644 (file)
@@ -714,7 +714,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id)
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_plugin zeroplus_logic_cube_plugin_info = {
+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,
index 5204a0f02c7ba2341bd377495725ddb5ebb1cdc8..c68d6e0c2167347d68f30283b8f065066f741606 100644 (file)
@@ -27,7 +27,7 @@
 #include "sigrok-internal.h"
 
 /*
- * This enumerates which plugin capabilities correspond to user-settable
+ * This enumerates which driver capabilities correspond to user-settable
  * options.
  */
 /* TODO: This shouldn't be a global. */
@@ -40,109 +40,109 @@ SR_API struct sr_hwcap_option sr_hwcap_options[] = {
 };
 
 #ifdef HAVE_LA_DEMO
-extern SR_PRIV struct sr_dev_plugin demo_plugin_info;
+extern SR_PRIV struct sr_dev_driver demo_driver_info;
 #endif
 #ifdef HAVE_LA_SALEAE_LOGIC
-extern SR_PRIV struct sr_dev_plugin saleae_logic_plugin_info;
+extern SR_PRIV struct sr_dev_driver saleae_logic_driver_info;
 #endif
 #ifdef HAVE_LA_OLS
-extern SR_PRIV struct sr_dev_plugin ols_plugin_info;
+extern SR_PRIV struct sr_dev_driver ols_driver_info;
 #endif
 #ifdef HAVE_LA_ZEROPLUS_LOGIC_CUBE
-extern SR_PRIV struct sr_dev_plugin zeroplus_logic_cube_plugin_info;
+extern SR_PRIV struct sr_dev_driver zeroplus_logic_cube_driver_info;
 #endif
 #ifdef HAVE_LA_ASIX_SIGMA
-extern SR_PRIV struct sr_dev_plugin asix_sigma_plugin_info;
+extern SR_PRIV struct sr_dev_driver asix_sigma_driver_info;
 #endif
 #ifdef HAVE_LA_CHRONOVU_LA8
-extern SR_PRIV struct sr_dev_plugin chronovu_la8_plugin_info;
+extern SR_PRIV struct sr_dev_driver chronovu_la8_driver_info;
 #endif
 #ifdef HAVE_LA_LINK_MSO19
-extern SR_PRIV struct sr_dev_plugin link_mso19_plugin_info;
+extern SR_PRIV struct sr_dev_driver link_mso19_driver_info;
 #endif
 #ifdef HAVE_LA_ALSA
-extern SR_PRIV struct sr_dev_plugin alsa_plugin_info;
+extern SR_PRIV struct sr_dev_driver alsa_driver_info;
 #endif
 #ifdef HAVE_LA_FX2LAFW
-extern SR_PRIV struct sr_dev_plugin fx2lafw_plugin_info;
+extern SR_PRIV struct sr_dev_driver fx2lafw_driver_info;
 #endif
 
-static struct sr_dev_plugin *plugins_list[] = {
+static struct sr_dev_driver *drivers_list[] = {
 #ifdef HAVE_LA_DEMO
-       &demo_plugin_info,
+       &demo_driver_info,
 #endif
 #ifdef HAVE_LA_SALEAE_LOGIC
-       &saleae_logic_plugin_info,
+       &saleae_logic_driver_info,
 #endif
 #ifdef HAVE_LA_OLS
-       &ols_plugin_info,
+       &ols_driver_info,
 #endif
 #ifdef HAVE_LA_ZEROPLUS_LOGIC_CUBE
-       &zeroplus_logic_cube_plugin_info,
+       &zeroplus_logic_cube_driver_info,
 #endif
 #ifdef HAVE_LA_ASIX_SIGMA
-       &asix_sigma_plugin_info,
+       &asix_sigma_driver_info,
 #endif
 #ifdef HAVE_LA_CHRONOVU_LA8
-       &chronovu_la8_plugin_info,
+       &chronovu_la8_driver_info,
 #endif
 #ifdef HAVE_LA_LINK_MSO19
-       &link_mso19_plugin_info,
+       &link_mso19_driver_info,
 #endif
 #ifdef HAVE_LA_ALSA
-       &alsa_plugin_info,
+       &alsa_driver_info,
 #endif
 #ifdef HAVE_LA_FX2LAFW
-       &fx2lafw_plugin_info,
+       &fx2lafw_driver_info,
 #endif
        NULL,
 };
 
 /**
- * Return the list of loaded hardware plugins.
+ * Return the list of loaded hardware drivers.
  *
- * The list of plugins is initialized from sr_init(), and can only be reset
+ * The list of drivers is initialized from sr_init(), and can only be reset
  * by calling sr_exit().
  *
- * @return Pointer to the NULL-terminated list of hardware plugin pointers.
+ * @return Pointer to the NULL-terminated list of hardware driver pointers.
  */
-SR_API struct sr_dev_plugin **sr_hw_list(void)
+SR_API struct sr_dev_driver **sr_hw_list(void)
 {
-       return plugins_list;
+       return drivers_list;
 }
 
 /**
- * Initialize a hardware plugin.
+ * Initialize a hardware driver.
  *
- * The specified plugin is initialized, and all devices discovered by the
- * plugin are instantiated.
+ * The specified driver is initialized, and all devices discovered by the
+ * driver are instantiated.
  *
- * @param plugin The plugin to initialize.
+ * @param driver The driver to initialize.
  *
- * @return The number of devices found and instantiated by the plugin.
+ * @return The number of devices found and instantiated by the driver.
  */
-SR_API int sr_hw_init(struct sr_dev_plugin *plugin)
+SR_API int sr_hw_init(struct sr_dev_driver *driver)
 {
        int num_devs, num_probes, i, j;
        int num_initialized_devs = 0;
        struct sr_dev *dev;
        char **probe_names;
 
-       sr_dbg("initializing %s plugin", plugin->name);
-       num_devs = plugin->init(NULL);
+       sr_dbg("initializing %s driver", driver->name);
+       num_devs = driver->init(NULL);
        for (i = 0; i < num_devs; i++) {
                num_probes = GPOINTER_TO_INT(
-                               plugin->dev_info_get(i, SR_DI_NUM_PROBES));
-               probe_names = (char **)plugin->dev_info_get(i,
+                               driver->dev_info_get(i, SR_DI_NUM_PROBES));
+               probe_names = (char **)driver->dev_info_get(i,
                                                        SR_DI_PROBE_NAMES);
 
                if (!probe_names) {
-                       sr_warn("hwplugin: %s: plugin %s does not return a "
-                               "list of probe names", __func__, plugin->name);
+                       sr_warn("hwdriver: %s: driver %s does not return a "
+                               "list of probe names", __func__, driver->name);
                        continue;
                }
 
-               dev = sr_dev_new(plugin, i);
+               dev = sr_dev_new(driver, i);
                for (j = 0; j < num_probes; j++)
                        sr_dev_probe_add(dev, probe_names[j]);
                num_initialized_devs++;
@@ -154,12 +154,12 @@ SR_API int sr_hw_init(struct sr_dev_plugin *plugin)
 SR_PRIV void sr_hw_cleanup_all(void)
 {
        int i;
-       struct sr_dev_plugin **plugins;
+       struct sr_dev_driver **drivers;
 
-       plugins = sr_hw_list();
-       for (i = 0; plugins[i]; i++) {
-               if (plugins[i]->cleanup)
-                       plugins[i]->cleanup();
+       drivers = sr_hw_list();
+       for (i = 0; drivers[i]; i++) {
+               if (drivers[i]->cleanup)
+                       drivers[i]->cleanup();
        }
 }
 
@@ -169,7 +169,7 @@ SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,
        struct sr_dev_inst *sdi;
 
        if (!(sdi = g_try_malloc(sizeof(struct sr_dev_inst)))) {
-               sr_err("hwplugin: %s: sdi malloc failed", __func__);
+               sr_err("hwdriver: %s: sdi malloc failed", __func__);
                return NULL;
        }
 
@@ -216,7 +216,7 @@ SR_PRIV struct sr_usb_dev_inst *sr_usb_dev_inst_new(uint8_t bus,
        struct sr_usb_dev_inst *udi;
 
        if (!(udi = g_try_malloc(sizeof(struct sr_usb_dev_inst)))) {
-               sr_err("hwplugin: %s: udi malloc failed", __func__);
+               sr_err("hwdriver: %s: udi malloc failed", __func__);
                return NULL;
        }
 
@@ -243,7 +243,7 @@ SR_PRIV struct sr_serial_dev_inst *sr_serial_dev_inst_new(const char *port,
        struct sr_serial_dev_inst *serial;
 
        if (!(serial = g_try_malloc(sizeof(struct sr_serial_dev_inst)))) {
-               sr_err("hwplugin: %s: serial malloc failed", __func__);
+               sr_err("hwdriver: %s: serial malloc failed", __func__);
                return NULL;
        }
 
@@ -259,18 +259,18 @@ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial)
 }
 
 /**
- * Find out if a hardware plugin has a specific capability.
+ * Find out if a hardware driver has a specific capability.
  *
- * @param plugin The hardware plugin in which to search for the capability.
+ * @param driver The hardware driver in which to search for the capability.
  * @param hwcap The capability to find in the list.
  *
  * @return TRUE if found, FALSE otherwise.
  */
-SR_API gboolean sr_hw_has_hwcap(struct sr_dev_plugin *plugin, int hwcap)
+SR_API gboolean sr_hw_has_hwcap(struct sr_dev_driver *driver, int hwcap)
 {
        int *hwcaps, i;
 
-       hwcaps = plugin->hwcap_get_all();
+       hwcaps = driver->hwcap_get_all();
        for (i = 0; hwcaps[i]; i++) {
                if (hwcaps[i] == hwcap)
                        return TRUE;
@@ -280,7 +280,7 @@ SR_API gboolean sr_hw_has_hwcap(struct sr_dev_plugin *plugin, int hwcap)
 }
 
 /**
- * Get a hardware plugin capability option.
+ * Get a hardware driver capability option.
  *
  * @param hwcap The capability to get.
  *
index 65bdc71d3beaff7736871d7ec7f02989d4f0dd83..762fdfc535a20ec1266ea15349fbd0641e69d647 100644 (file)
@@ -135,9 +135,9 @@ static int init(struct sr_output *o, int default_spl, enum outputmode mode)
 
        snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
        num_probes = g_slist_length(o->dev->probes);
-       if (o->dev->plugin && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->dev->plugin->dev_info_get(
-                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (o->dev->driver && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               samplerate = *((uint64_t *) o->dev->driver->dev_info_get(
+                               o->dev->driver_index, SR_DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sr_samplerate_string(samplerate))) {
                        g_free(ctx->header);
                        g_free(ctx);
index 758811952e40c17c85c9064eed4232b0a414e0ab..944473f4b40247572e77f6c0c5465e4b75208b2f 100644 (file)
@@ -98,8 +98,8 @@ static int init(struct sr_output *o)
                return SR_ERR_ARG;
        }
 
-       if (!o->dev->plugin) {
-               sr_warn("la8 out: %s: o->dev->plugin was NULL", __func__);
+       if (!o->dev->driver) {
+               sr_warn("la8 out: %s: o->dev->driver was NULL", __func__);
                return SR_ERR_ARG;
        }
 
@@ -122,8 +122,8 @@ static int init(struct sr_output *o)
        ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
 
        if (sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->dev->plugin->dev_info_get(
-                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
+               samplerate = *((uint64_t *) o->dev->driver->dev_info_get(
+                               o->dev->driver_index, SR_DI_CUR_SAMPLERATE));
                /* TODO: Error checks. */
        } else {
                samplerate = 0; /* TODO: Error or set some value? */
index 819008ae16b688f303fbc5d320ffa84b6d37aebe..cc22eb84bd9538052802a0f83c4d2f334935d00a 100644 (file)
@@ -66,8 +66,8 @@ static int init(struct sr_output *o)
                return SR_ERR_ARG;
        }
 
-       if (!o->dev->plugin) {
-               sr_err("csv out: %s: o->dev->plugin was NULL", __func__);
+       if (!o->dev->driver) {
+               sr_err("csv out: %s: o->dev->driver was NULL", __func__);
                return SR_ERR_ARG;
        }
 
@@ -92,8 +92,8 @@ static int init(struct sr_output *o)
        num_probes = g_slist_length(o->dev->probes);
 
        if (sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->dev->plugin->dev_info_get(
-                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
+               samplerate = *((uint64_t *) o->dev->driver->dev_info_get(
+                               o->dev->driver_index, SR_DI_CUR_SAMPLERATE));
                /* TODO: Error checks. */
        } else {
                samplerate = 0; /* TODO: Error or set some value? */
index c150a2fb4eba514223ce24343807ec032df4bc83..32369610a958064b4a3721acc00c2d9c7faab24c 100644 (file)
@@ -71,8 +71,8 @@ static int init(struct sr_output *o)
                return SR_ERR_ARG;
        }
 
-       if (!o->dev->plugin) {
-               sr_err("gnuplot out: %s: o->dev->plugin was NULL", __func__);
+       if (!o->dev->driver) {
+               sr_err("gnuplot out: %s: o->dev->driver was NULL", __func__);
                return SR_ERR_ARG;
        }
 
@@ -101,8 +101,8 @@ static int init(struct sr_output *o)
        num_probes = g_slist_length(o->dev->probes);
        comment[0] = '\0';
        if (sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->dev->plugin->dev_info_get(
-                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
+               samplerate = *((uint64_t *) o->dev->driver->dev_info_get(
+                               o->dev->driver_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
                        sr_err("gnuplot out: %s: sr_samplerate_string failed",
                               __func__);
@@ -320,9 +320,9 @@ static int analog_init(struct sr_output *o)
 
        num_probes = g_slist_length(o->dev->probes);
        comment[0] = '\0';
-       if (o->dev->plugin && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->dev->plugin->dev_info_get(
-                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (o->dev->driver && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               samplerate = *((uint64_t *) o->dev->driver->dev_info_get(
+                               o->dev->driver_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
                        g_free(ctx->header);
                        g_free(ctx);
index 2025249d6a350e9657be065fce8e82c776bdebf3..e0196717e7a67ef8db385bc12c1c1fa3c3cadc66 100644 (file)
@@ -60,9 +60,9 @@ static int init(struct sr_output *o)
        }
        ctx->unitsize = (num_enabled_probes + 7) / 8;
 
-       if (o->dev->plugin && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE))
-               samplerate = *((uint64_t *) o->dev->plugin->dev_info_get(
-                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (o->dev->driver && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE))
+               samplerate = *((uint64_t *) o->dev->driver->dev_info_get(
+                               o->dev->driver_index, SR_DI_CUR_SAMPLERATE));
        else
                samplerate = 0;
 
index d78895de924c79bd74eedb487c00e5abbcda3f18..f08d7cbc02ceeeac7d0200d4fb8be6f44c8dfb40 100644 (file)
@@ -110,9 +110,9 @@ SR_PRIV int init(struct sr_output *o, int default_spl, enum outputmode mode)
 
        snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
        num_probes = g_slist_length(o->dev->probes);
-       if (o->dev->plugin || sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
-               samplerate = *((uint64_t *) o->dev->plugin->dev_info_get(
-                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (o->dev->driver || sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               samplerate = *((uint64_t *) o->dev->driver->dev_info_get(
+                               o->dev->driver_index, SR_DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sr_samplerate_string(samplerate))) {
                        g_free(ctx->header);
                        g_free(ctx);
index 119a3774a734fd5714c6edc2b5b1d24e4c2e67fa..91f72c1377a63af1c24b010aa4efef1f401a1425 100644 (file)
@@ -84,9 +84,9 @@ static int init(struct sr_output *o)
        g_string_append_printf(ctx->header, "$version %s %s $end\n",
                        PACKAGE, PACKAGE_VERSION);
 
-       if (o->dev->plugin && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
-               ctx->samplerate = *((uint64_t *) o->dev->plugin->dev_info_get(
-                               o->dev->plugin_index, SR_DI_CUR_SAMPLERATE));
+       if (o->dev->driver && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) {
+               ctx->samplerate = *((uint64_t *) o->dev->driver->dev_info_get(
+                               o->dev->driver_index, SR_DI_CUR_SAMPLERATE));
                if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {
                        g_string_free(ctx->header, TRUE);
                        g_free(ctx);
index 2c066f9454553ac757f30ab6115fc3c7b728afa9..5f31597eb34d043d7d4ceaf634709ec9ac096a29 100644 (file)
--- a/session.c
+++ b/session.c
@@ -114,7 +114,7 @@ SR_API int sr_session_dev_clear(void)
  * Add a device to the current session.
  *
  * @param dev The device to add to the current session. Must not be NULL.
- *            Also, dev->plugin and dev->plugin->dev_open must not be NULL.
+ *            Also, dev->driver and dev->driver->dev_open must not be NULL.
  *
  * @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
  */
@@ -127,13 +127,13 @@ SR_API int sr_session_dev_add(struct sr_dev *dev)
                return SR_ERR_ARG;
        }
 
-       if (!dev->plugin) {
-               sr_err("session: %s: dev->plugin was NULL", __func__);
+       if (!dev->driver) {
+               sr_err("session: %s: dev->driver was NULL", __func__);
                return SR_ERR_ARG;
        }
 
-       if (!dev->plugin->dev_open) {
-               sr_err("session: %s: dev->plugin->dev_open was NULL",
+       if (!dev->driver->dev_open) {
+               sr_err("session: %s: dev->driver->dev_open was NULL",
                       __func__);
                return SR_ERR_ARG;
        }
@@ -143,7 +143,7 @@ SR_API int sr_session_dev_add(struct sr_dev *dev)
                return SR_ERR; /* TODO: SR_ERR_BUG? */
        }
 
-       if ((ret = dev->plugin->dev_open(dev->plugin_index)) != SR_OK) {
+       if ((ret = dev->driver->dev_open(dev->driver_index)) != SR_OK) {
                sr_err("session: %s: dev_open failed (%d)", __func__, ret);
                return ret;
        }
@@ -269,15 +269,15 @@ SR_API int sr_session_start(void)
                return SR_ERR; /* TODO: SR_ERR_BUG? */
        }
 
-       /* TODO: Check plugin_index validity? */
+       /* TODO: Check driver_index validity? */
 
        sr_info("session: starting");
 
        for (l = session->devs; l; l = l->next) {
                dev = l->data;
                /* TODO: Check for dev != NULL. */
-               if ((ret = dev->plugin->dev_acquisition_start(
-                               dev->plugin_index, dev)) != SR_OK) {
+               if ((ret = dev->driver->dev_acquisition_start(
+                               dev->driver_index, dev)) != SR_OK) {
                        sr_err("session: %s: could not start an acquisition "
                               "(%d)", __func__, ret);
                        break;
@@ -352,7 +352,7 @@ SR_API int sr_session_halt(void)
  * Stop the current session.
  *
  * The current session is stopped immediately, with all acquisition sessions
- * being stopped and hardware plugins cleaned up.
+ * being stopped and hardware drivers cleaned up.
  *
  * @return SR_OK upon success, SR_ERR_BUG if no session exists.
  */
@@ -372,11 +372,11 @@ SR_API int sr_session_stop(void)
        for (l = session->devs; l; l = l->next) {
                dev = l->data;
                /* Check for dev != NULL. */
-               if (dev->plugin) {
-                       if (dev->plugin->dev_acquisition_stop)
-                               dev->plugin->dev_acquisition_stop(dev->plugin_index, dev);
-                       if (dev->plugin->cleanup)
-                               dev->plugin->cleanup();
+               if (dev->driver) {
+                       if (dev->driver->dev_acquisition_stop)
+                               dev->driver->dev_acquisition_stop(dev->driver_index, dev);
+                       if (dev->driver->cleanup)
+                               dev->driver->cleanup();
                }
        }
 
@@ -434,8 +434,8 @@ SR_PRIV int sr_session_bus(struct sr_dev *dev,
                return SR_ERR_ARG;
        }
 
-       if (!dev->plugin) {
-               sr_err("session: %s: dev->plugin was NULL", __func__);
+       if (!dev->driver) {
+               sr_err("session: %s: dev->driver was NULL", __func__);
                return SR_ERR_ARG;
        }
 
index efe68a4d5f48e652b0c7a76b9fb77e26a497255b..d5f9d5549b7577772f5e286bd092cfea9d25f965 100644 (file)
@@ -331,7 +331,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_dev_id)
        return SR_OK;
 }
 
-SR_PRIV struct sr_dev_plugin session_driver = {
+SR_PRIV struct sr_dev_driver session_driver = {
        .name = "session",
        .longname = "Session-emulating driver",
        .api_version = 1,
index d11ccebd0a2e9b414f0a5189b042b0babe26bfc1..ca639cd555347354b17587897ee37d45171e17ac 100644 (file)
@@ -28,7 +28,7 @@
 #include "sigrok-internal.h"
 
 extern struct sr_session *session;
-extern SR_PRIV struct sr_dev_plugin session_driver;
+extern SR_PRIV struct sr_dev_driver session_driver;
 
 /**
  * Load the session from the specified filename.
@@ -116,20 +116,20 @@ SR_API int sr_session_load(const char *filename)
                                if (!strcmp(keys[j], "capturefile")) {
                                        dev = sr_dev_new(&session_driver, devcnt);
                                        if (devcnt == 0)
-                                               /* first device, init the plugin */
-                                               dev->plugin->init((char *)filename);
+                                               /* first device, init the driver */
+                                               dev->driver->init((char *)filename);
                                        sr_session_dev_add(dev);
-                                       dev->plugin->dev_config_set(devcnt, SR_HWCAP_CAPTUREFILE, val);
+                                       dev->driver->dev_config_set(devcnt, SR_HWCAP_CAPTUREFILE, val);
                                        g_ptr_array_add(capturefiles, val);
                                } else if (!strcmp(keys[j], "samplerate")) {
                                        sr_parse_sizestring(val, &tmp_u64);
-                                       dev->plugin->dev_config_set(devcnt, SR_HWCAP_SAMPLERATE, &tmp_u64);
+                                       dev->driver->dev_config_set(devcnt, SR_HWCAP_SAMPLERATE, &tmp_u64);
                                } else if (!strcmp(keys[j], "unitsize")) {
                                        tmp_u64 = strtoull(val, NULL, 10);
-                                       dev->plugin->dev_config_set(devcnt, SR_HWCAP_CAPTURE_UNITSIZE, &tmp_u64);
+                                       dev->driver->dev_config_set(devcnt, SR_HWCAP_CAPTURE_UNITSIZE, &tmp_u64);
                                } else if (!strcmp(keys[j], "total probes")) {
                                        total_probes = strtoull(val, NULL, 10);
-                                       dev->plugin->dev_config_set(devcnt, SR_HWCAP_CAPTURE_NUM_PROBES, &total_probes);
+                                       dev->driver->dev_config_set(devcnt, SR_HWCAP_CAPTURE_NUM_PROBES, &total_probes);
                                        for (p = 0; p < total_probes; p++) {
                                                snprintf(probename, SR_MAX_PROBENAME_LEN, "%" PRIu64, p);
                                                sr_dev_probe_add(dev, probename);
@@ -216,8 +216,8 @@ int sr_session_save(const char *filename)
                dev = l->data;
                /* metadata */
                fprintf(meta, "[device %d]\n", devcnt);
-               if (dev->plugin)
-                       fprintf(meta, "driver = %s\n", dev->plugin->name);
+               if (dev->driver)
+                       fprintf(meta, "driver = %s\n", dev->driver->name);
 
                ds = dev->datastore;
                if (ds) {
@@ -226,8 +226,8 @@ int sr_session_save(const char *filename)
                        fprintf(meta, "unitsize = %d\n", ds->ds_unitsize);
                        fprintf(meta, "total probes = %d\n", g_slist_length(dev->probes));
                        if (sr_dev_has_hwcap(dev, SR_HWCAP_SAMPLERATE)) {
-                               samplerate = *((uint64_t *) dev->plugin->dev_info_get(
-                                               dev->plugin_index, SR_DI_CUR_SAMPLERATE));
+                               samplerate = *((uint64_t *) dev->driver->dev_info_get(
+                                               dev->driver_index, SR_DI_CUR_SAMPLERATE));
                                s = sr_samplerate_string(samplerate);
                                fprintf(meta, "samplerate = %s\n", s);
                                g_free(s);
index c60b5da66265868ac7b14911af834324e498c225..0bc941fdb9dee7370ac651ddc51ccdd75e46de29 100644 (file)
@@ -76,7 +76,7 @@ SR_PRIV int sr_info(const char *format, ...);
 SR_PRIV int sr_warn(const char *format, ...);
 SR_PRIV int sr_err(const char *format, ...);
 
-/*--- hwplugin.c ------------------------------------------------------------*/
+/*--- hwdriver.c ------------------------------------------------------------*/
 
 SR_PRIV void sr_hw_cleanup_all(void);
 
index d5f1c0cd51a07028040354984245dcf436f5cd83..80d15ce955a393ac13ad72c4bd991f6d29a768e3 100644 (file)
@@ -49,8 +49,8 @@ SR_API int sr_datastore_put(struct sr_datastore *ds, void *data,
 
 SR_API int sr_dev_scan(void);
 SR_API GSList *sr_dev_list(void);
-SR_API struct sr_dev *sr_dev_new(const struct sr_dev_plugin *plugin,
-                                int plugin_index);
+SR_API struct sr_dev *sr_dev_new(const struct sr_dev_driver *driver,
+                                int driver_index);
 SR_API int sr_dev_probe_add(struct sr_dev *dev, const char *name);
 SR_API struct sr_probe *sr_dev_probe_find(const struct sr_dev *dev,
                                          int probenum);
@@ -69,11 +69,11 @@ SR_API int sr_filter_probes(int in_unitsize, int out_unitsize,
                            uint64_t length_in, char **data_out,
                            uint64_t *length_out);
 
-/*--- hwplugin.c ------------------------------------------------------------*/
+/*--- hwdriver.c ------------------------------------------------------------*/
 
-SR_API struct sr_dev_plugin **sr_hw_list(void);
-SR_API int sr_hw_init(struct sr_dev_plugin *plugin);
-SR_API gboolean sr_hw_has_hwcap(struct sr_dev_plugin *plugin, int hwcap);
+SR_API struct sr_dev_driver **sr_hw_list(void);
+SR_API int sr_hw_init(struct sr_dev_driver *driver);
+SR_API gboolean sr_hw_has_hwcap(struct sr_dev_driver *driver, int hwcap);
 SR_API struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap);
 
 /*--- session.c -------------------------------------------------------------*/
index 10a483f377fb6ee47d3b245856c831f725f515c3..5bab6adf467924495ab1f2982c334e6e731c2522 100644 (file)
--- a/sigrok.h
+++ b/sigrok.h
@@ -94,7 +94,7 @@ extern "C" {
 
 typedef int (*sr_receive_data_callback) (int fd, int revents, void *user_data);
 
-/* Data types used by hardware plugins for dev_config_set() */
+/* Data types used by hardware drivers for dev_config_set() */
 enum {
        SR_T_UINT64,
        SR_T_CHAR,
@@ -169,15 +169,15 @@ struct sr_datastore {
 
 /*
  * This represents a generic device connected to the system.
- * For device-specific information, ask the plugin. The plugin_index refers
- * to the device index within that plugin; it may be handling more than one
- * device. All relevant plugin calls take a dev_index parameter for this.
+ * For device-specific information, ask the driver. The driver_index refers
+ * to the device index within that driver; it may be handling more than one
+ * device. All relevant driver calls take a dev_index parameter for this.
  */
 struct sr_dev {
-       /* Which plugin handles this device */
-       struct sr_dev_plugin *plugin;
-       /* A plugin may handle multiple devices of the same type */
-       int plugin_index;
+       /* Which driver handles this device */
+       struct sr_dev_driver *driver;
+       /* A driver may handle multiple devices of the same type */
+       int driver_index;
        /* List of struct sr_probe* */
        GSList *probes;
        /* Data acquired by this device, if any */
@@ -196,7 +196,7 @@ struct sr_probe {
        char *trigger;
 };
 
-/* Hardware plugin capabilities */
+/* Hardware driver capabilities */
 enum {
        SR_HWCAP_DUMMY = 0, /* Used to terminate lists. Must be 0! */
 
@@ -338,8 +338,8 @@ struct sr_samplerates {
        uint64_t *list;
 };
 
-struct sr_dev_plugin {
-       /* Plugin-specific */
+struct sr_dev_driver {
+       /* Driver-specific */
        char *name;
        char *longname;
        int api_version;
index 9232ed2f56d96a28b608d9f52fb88cc0374d3c9e..57b4aa88e4532133f9409d0d46a41410ea668605 100644 (file)
--- a/strutil.c
+++ b/strutil.c
@@ -136,7 +136,7 @@ SR_API char **sr_parse_triggerstring(struct sr_dev *dev,
        }
 
        tokens = g_strsplit(triggerstring, ",", max_probes);
-       trigger_types = dev->plugin->dev_info_get(0, SR_DI_TRIGGER_TYPES);
+       trigger_types = dev->driver->dev_info_get(0, SR_DI_TRIGGER_TYPES);
        if (trigger_types == NULL)
                return NULL;