]> sigrok.org Git - libsigrok.git/commitdiff
Add sr_ prefix for device related API functions.
authorUwe Hermann <redacted>
Tue, 8 Feb 2011 17:19:38 +0000 (18:19 +0100)
committerUwe Hermann <redacted>
Tue, 8 Feb 2011 21:28:02 +0000 (22:28 +0100)
backend.c
device.c
input/input_binary.c
output/output_analog.c
output/output_gnuplot.c
output/output_ols.c
output/output_vcd.c
output/text/text.c
session_file.c
sigrok-proto.h

index eb23ad229bd36238380b17fd4c37a89a636ed8a9..17983cd7a51a9537fffb8f5e30c5f94229f2b66c 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -28,5 +28,5 @@ int sr_init(void)
 /* TODO: Should return int to be able to report back error codes. */
 void sr_exit(void)
 {
-       device_close_all();
+       sr_device_close_all();
 }
index 9e4254adc6df4165cee94d5239e291f9ac803163..dd3a4000bcc6b9f9405ba673aca5035eedb8acfe 100644 (file)
--- a/device.c
+++ b/device.c
@@ -25,7 +25,7 @@ extern struct sr_global *global;
 
 GSList *devices = NULL;
 
-void device_scan(void)
+void sr_device_scan(void)
 {
        GSList *plugins, *l;
        struct sr_device_plugin *plugin;
@@ -39,12 +39,12 @@ void device_scan(void)
         */
        for (l = plugins; l; l = l->next) {
                plugin = l->data;
-               device_plugin_init(plugin);
+               sr_device_plugin_init(plugin);
        }
 
 }
 
-int device_plugin_init(struct sr_device_plugin *plugin)
+int sr_device_plugin_init(struct sr_device_plugin *plugin)
 {
        int num_devices, num_probes, i;
 
@@ -52,13 +52,13 @@ int device_plugin_init(struct sr_device_plugin *plugin)
        num_devices = plugin->init(NULL);
        for (i = 0; i < num_devices; i++) {
                num_probes = (int)plugin->get_device_info(i, SR_DI_NUM_PROBES);
-               device_new(plugin, i, num_probes);
+               sr_device_new(plugin, i, num_probes);
        }
 
        return num_devices;
 }
 
-void device_close_all(void)
+void sr_device_close_all(void)
 {
        struct sr_device *device;
 
@@ -66,20 +66,20 @@ void device_close_all(void)
                device = devices->data;
                if (device->plugin && device->plugin->close)
                        device->plugin->close(device->plugin_index);
-               device_destroy(device);
+               sr_device_destroy(device);
        }
 }
 
-GSList *device_list(void)
+GSList *sr_device_list(void)
 {
 
        if (!devices)
-               device_scan();
+               sr_device_scan();
 
        return devices;
 }
 
-struct sr_device *device_new(struct sr_device_plugin *plugin, int plugin_index,
+struct sr_device *sr_device_new(struct sr_device_plugin *plugin, int plugin_index,
                             int num_probes)
 {
        struct sr_device *device;
@@ -91,12 +91,12 @@ struct sr_device *device_new(struct sr_device_plugin *plugin, int plugin_index,
        devices = g_slist_append(devices, device);
 
        for (i = 0; i < num_probes; i++)
-               device_probe_add(device, NULL);
+               sr_device_probe_add(device, NULL);
 
        return device;
 }
 
-void device_clear(struct sr_device *device)
+void sr_device_clear(struct sr_device *device)
 {
        unsigned int pnum;
 
@@ -106,10 +106,10 @@ void device_clear(struct sr_device *device)
                return;
 
        for (pnum = 1; pnum <= g_slist_length(device->probes); pnum++)
-               device_probe_clear(device, pnum);
+               sr_device_probe_clear(device, pnum);
 }
 
-void device_destroy(struct sr_device *device)
+void sr_device_destroy(struct sr_device *device)
 {
        unsigned int pnum;
 
@@ -121,13 +121,13 @@ void device_destroy(struct sr_device *device)
        devices = g_slist_remove(devices, device);
        if (device->probes) {
                for (pnum = 1; pnum <= g_slist_length(device->probes); pnum++)
-                       device_probe_clear(device, pnum);
+                       sr_device_probe_clear(device, pnum);
                g_slist_free(device->probes);
        }
        g_free(device);
 }
 
-void device_probe_clear(struct sr_device *device, int probenum)
+void sr_device_probe_clear(struct sr_device *device, int probenum)
 {
        struct sr_probe *p;
 
@@ -146,7 +146,7 @@ void device_probe_clear(struct sr_device *device, int probenum)
        }
 }
 
-void device_probe_add(struct sr_device *device, char *name)
+void sr_device_probe_add(struct sr_device *device, char *name)
 {
        struct sr_probe *p;
        char probename[16];
@@ -184,7 +184,7 @@ struct sr_probe *probe_find(struct sr_device *device, int probenum)
 }
 
 /* TODO: return SIGROK_ERR if probenum not found */
-void device_probe_name(struct sr_device *device, int probenum, char *name)
+void sr_device_probe_name(struct sr_device *device, int probenum, char *name)
 {
        struct sr_probe *p;
 
@@ -198,7 +198,7 @@ void device_probe_name(struct sr_device *device, int probenum, char *name)
 }
 
 /* TODO: return SIGROK_ERR if probenum not found */
-void device_trigger_clear(struct sr_device *device)
+void sr_device_trigger_clear(struct sr_device *device)
 {
        struct sr_probe *p;
        unsigned int pnum;
@@ -216,7 +216,7 @@ void device_trigger_clear(struct sr_device *device)
 }
 
 /* TODO: return SIGROK_ERR if probenum not found */
-void device_trigger_set(struct sr_device *device, int probenum, char *trigger)
+void sr_device_trigger_set(struct sr_device *device, int probenum, char *trigger)
 {
        struct sr_probe *p;
 
@@ -231,7 +231,7 @@ void device_trigger_set(struct sr_device *device, int probenum, char *trigger)
 
 }
 
-gboolean device_has_hwcap(struct sr_device *device, int hwcap)
+gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap)
 {
        int *capabilities, i;
 
index 3f3db0b06e7aa8b56e6a2e7ab87384e8ab640520..be67f2d2d33767e8f9b59f5ee7356d38197193b0 100644 (file)
@@ -51,7 +51,7 @@ static int init(struct sr_input *in)
                num_probes = DEFAULT_NUM_PROBES;
 
        /* create a virtual device */
-       in->vdevice = device_new(NULL, 0, num_probes);
+       in->vdevice = sr_device_new(NULL, 0, num_probes);
 
        return SR_OK;
 }
index 7c5c622f94d92c886ea8955a42140487cc9fdaa6..aef88c5f1eb3563c730ed10f542f68f9293be803 100644 (file)
@@ -133,7 +133,7 @@ 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->device->probes);
-       if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
+       if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sr_samplerate_string(samplerate))) {
index 99ab6d6be97f9a10a52dd54bc765109743a92aa9..bf98bf152680344764bcc01b6be1a16aac9fe97b 100644 (file)
@@ -79,7 +79,7 @@ static int init(struct sr_output *o)
 
        num_probes = g_slist_length(o->device->probes);
        comment[0] = '\0';
-       if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
+       if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
@@ -226,7 +226,7 @@ static int analog_init(struct sr_output *o)
 
        num_probes = g_slist_length(o->device->probes);
        comment[0] = '\0';
-       if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
+       if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
index e199bb461e8670a144203a7b62c3311190a12c54..5b7d467cb89f2eb39446b4cad8daede2363d8091 100644 (file)
@@ -48,7 +48,7 @@ static void make_header(struct sr_output *o)
 
        ctx = o->internal;
 
-       if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE))
+       if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE))
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
        else
index 332a67d0087bb81a86b65b5c3b7bdee3a68b82bd..61d27a10ec157a538d338b6bca834536355d6aa7 100644 (file)
@@ -91,7 +91,7 @@ static int init(struct sr_output *o)
        g_string_append_printf(ctx->header, "$version %s %s $end\n",
                        PACKAGE, PACKAGE_VERSION);
 
-       if (o->device->plugin && device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
+       if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                ctx->samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {
index f51a8f31d34c0b3952aa9f5178df6ba798765800..98735eb41c7f5c4c6cfdb242a2ad9ba13b060ea0 100644 (file)
@@ -107,7 +107,7 @@ 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->device->probes);
-       if (o->device->plugin || device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
+       if (o->device->plugin || sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sr_samplerate_string(samplerate))) {
index aa7a8b657ccfc2a20f1b6ef6c77db430914463f7..48a2747d805709a23d9f63c63c3fcef53cfd4bba 100644 (file)
@@ -94,7 +94,7 @@ int sr_session_load(const char *filename)
                        for (j = 0; keys[j]; j++) {
                                val = g_key_file_get_string(kf, sections[i], keys[j], NULL);
                                if (!strcmp(keys[j], "capturefile")) {
-                                       device = device_new(&session_driver, devcnt, 0);
+                                       device = sr_device_new(&session_driver, devcnt, 0);
                                        if (devcnt == 0)
                                                /* first device, init the plugin */
                                                device->plugin->init((char *)filename);
@@ -111,16 +111,16 @@ int sr_session_load(const char *filename)
                                        total_probes = strtoull(val, NULL, 10);
                                        device->plugin->set_configuration(devcnt, SR_HWCAP_CAPTURE_NUM_PROBES, &total_probes);
                                        for (p = 1; p <= total_probes; p++)
-                                               device_probe_add(device, NULL);
+                                               sr_device_probe_add(device, NULL);
                                } else if (!strncmp(keys[j], "probe", 5)) {
                                        if (!device)
                                                continue;
                                        enabled_probes++;
                                        tmp_u64 = strtoul(keys[j]+5, NULL, 10);
-                                       device_probe_name(device, tmp_u64, val);
+                                       sr_device_probe_name(device, tmp_u64, val);
                                } else if (!strncmp(keys[j], "trigger", 7)) {
                                        probenum = strtoul(keys[j]+7, NULL, 10);
-                                       device_trigger_set(device, probenum, val);
+                                       sr_device_trigger_set(device, probenum, val);
                                }
                        }
                        g_strfreev(keys);
@@ -189,7 +189,7 @@ int sr_session_save(char *filename)
                        fprintf(meta, "capturefile = logic-%d\n", devcnt);
                        fprintf(meta, "unitsize = %d\n", ds->ds_unitsize);
                        fprintf(meta, "total probes = %d\n", g_slist_length(device->probes));
-                       if (device_has_hwcap(device, SR_HWCAP_SAMPLERATE)) {
+                       if (sr_device_has_hwcap(device, SR_HWCAP_SAMPLERATE)) {
                                samplerate = *((uint64_t *) device->plugin->get_device_info(
                                                device->plugin_index, SR_DI_CUR_SAMPLERATE));
                                s = sr_samplerate_string(samplerate);
index 22aab6f5c296a73f5d9212620207905225ffcb52..d13a3ac2290775da2c1d1d6074c38ab4b5ceff11 100644 (file)
@@ -34,23 +34,23 @@ void datastore_put(struct datastore *ds, void *data, unsigned int length,
 
 /*--- device.c --------------------------------------------------------------*/
 
-void device_scan(void);
-int device_plugin_init(struct sr_device_plugin *plugin);
-void device_close_all(void);
-GSList *device_list(void);
-struct sr_device *device_new(struct sr_device_plugin *plugin, int plugin_index,
+void sr_device_scan(void);
+int sr_device_plugin_init(struct sr_device_plugin *plugin);
+void sr_device_close_all(void);
+GSList *sr_device_list(void);
+struct sr_device *sr_device_new(struct sr_device_plugin *plugin, int plugin_index,
                             int num_probes);
-void device_clear(struct sr_device *device);
-void device_destroy(struct sr_device *dev);
+void sr_device_clear(struct sr_device *device);
+void sr_device_destroy(struct sr_device *dev);
 
-void device_probe_clear(struct sr_device *device, int probenum);
-void device_probe_add(struct sr_device *device, char *name);
+void sr_device_probe_clear(struct sr_device *device, int probenum);
+void sr_device_probe_add(struct sr_device *device, char *name);
 struct sr_probe *probe_find(struct sr_device *device, int probenum);
-void device_probe_name(struct sr_device *device, int probenum, char *name);
+void sr_device_probe_name(struct sr_device *device, int probenum, char *name);
 
-void device_trigger_clear(struct sr_device *device);
-void device_trigger_set(struct sr_device *device, int probenum, char *trigger);
-gboolean device_has_hwcap(struct sr_device *device, int hwcap);
+void sr_device_trigger_clear(struct sr_device *device);
+void sr_device_trigger_set(struct sr_device *device, int probenum, char *trigger);
+gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap);
 
 /*--- filter.c --------------------------------------------------------------*/