]> sigrok.org Git - libsigrok.git/commitdiff
Add sr_ prefix to session related API functions.
authorUwe Hermann <redacted>
Tue, 8 Feb 2011 17:00:49 +0000 (18:00 +0100)
committerUwe Hermann <redacted>
Tue, 8 Feb 2011 21:28:00 +0000 (22:28 +0100)
13 files changed:
hardware/alsa/alsa.c
hardware/asix-sigma/asix-sigma.c
hardware/demo/demo.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
input/input_binary.c
session.c
session_driver.c
session_file.c
sigrok-proto.h

index 3ddadcb937f6838919d439bae547eadd5916db52..4dd542d5a4689f18d5730a5f88a2f4cc6a1152da 100644 (file)
@@ -244,14 +244,14 @@ static int receive_data(int fd, int revents, void *user_data)
                packet.length = count * sample_size;
                packet.unitsize = sample_size;
                packet.payload = outb;
-               session_bus(user_data, &packet);
+               sr_session_bus(user_data, &packet);
                free(outb);
                alsa->limit_samples -= count;
 
        } while (alsa->limit_samples > 0);
 
        packet.type = SR_DF_END;
-       session_bus(user_data, &packet);
+       sr_session_bus(user_data, &packet);
 
        return TRUE;
 }
@@ -342,7 +342,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header.num_analog_probes = NUM_PROBES;
        header.num_logic_probes = 0;
        header.protocol_id = SR_PROTO_RAW;
-       session_bus(session_device_id, &packet);
+       sr_session_bus(session_device_id, &packet);
        free(ufds);
 
        return SR_OK;
index e86c1d28e57826b132e50a6f1e687a955f7658a9..935412e5c0bd58d62513b8c611e651ba6e303d02 100644 (file)
@@ -877,7 +877,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                        packet.length = tosend * sizeof(uint16_t);
                        packet.unitsize = 2;
                        packet.payload = samples + sent;
-                       session_bus(sigma->session_id, &packet);
+                       sr_session_bus(sigma->session_id, &packet);
 
                        sent += tosend;
                }
@@ -921,7 +921,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                                packet.length = tosend * sizeof(uint16_t);
                                packet.unitsize = 2;
                                packet.payload = samples;
-                               session_bus(sigma->session_id, &packet);
+                               sr_session_bus(sigma->session_id, &packet);
 
                                sent += tosend;
                        }
@@ -931,7 +931,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                                packet.type = SR_DF_TRIGGER;
                                packet.length = 0;
                                packet.payload = 0;
-                               session_bus(sigma->session_id, &packet);
+                               sr_session_bus(sigma->session_id, &packet);
                        }
                }
 
@@ -943,7 +943,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                        packet.length = tosend * sizeof(uint16_t);
                        packet.unitsize = 2;
                        packet.payload = samples + sent;
-                       session_bus(sigma->session_id, &packet);
+                       sr_session_bus(sigma->session_id, &packet);
                }
 
                *lastsample = samples[n - 1];
@@ -990,7 +990,7 @@ static int receive_data(int fd, int revents, void *user_data)
                        /* End of samples. */
                        packet.type = SR_DF_END;
                        packet.length = 0;
-                       session_bus(sigma->session_id, &packet);
+                       sr_session_bus(sigma->session_id, &packet);
 
                        sigma->state.state = SIGMA_IDLE;
 
@@ -1306,7 +1306,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header.protocol_id = SR_PROTO_RAW;
        header.num_logic_probes = sigma->num_probes;
        header.num_analog_probes = 0;
-       session_bus(session_device_id, &packet);
+       sr_session_bus(session_device_id, &packet);
 
        /* Add capture source. */
        source_add(0, G_IO_IN, 10, receive_data, sdi);
index fda8091bbced50fe915ce8834d502c34751633dc..1eec6a2074b2abf956f13a0730ffd6e1882a7b62 100644 (file)
@@ -303,7 +303,7 @@ static int receive_data(int fd, int revents, void *user_data)
                        packet.length = z;
                        packet.unitsize = 1;
                        packet.payload = c;
-                       session_bus(user_data, &packet);
+                       sr_session_bus(user_data, &packet);
                }
        } while (z > 0);
 
@@ -314,7 +314,7 @@ static int receive_data(int fd, int revents, void *user_data)
 
                /* Send last packet. */
                packet.type = SR_DF_END;
-               session_bus(user_data, &packet);
+               sr_session_bus(user_data, &packet);
 
                return FALSE;
        }
@@ -378,7 +378,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header->protocol_id = SR_PROTO_RAW;
        header->num_logic_probes = NUM_PROBES;
        header->num_analog_probes = 0;
-       session_bus(session_device_id, packet);
+       sr_session_bus(session_device_id, packet);
        free(header);
        free(packet);
 
index 6c509ff341379233a41bf2d5ee20649fa42e2571..e728317788d310adfb80848d76047b8f4a85e353 100644 (file)
@@ -649,17 +649,17 @@ static int receive_data(int fd, int revents, void *user_data)
        packet.length = 1024;
        packet.unitsize = 1;
        packet.payload = logic_out;
-       session_bus(mso->session_id, &packet);
+       sr_session_bus(mso->session_id, &packet);
 
 
        packet.type = SR_DF_ANALOG;
        packet.length = 1024;
        packet.unitsize = sizeof(double);
        packet.payload = analog_out;
-       session_bus(mso->session_id, &packet);
+       sr_session_bus(mso->session_id, &packet);
 
        packet.type = SR_DF_END;
-       session_bus(mso->session_id, &packet);
+       sr_session_bus(mso->session_id, &packet);
 
        return TRUE;
 }
@@ -734,7 +734,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header.num_analog_probes = 1;
        header.num_logic_probes = 8;
        header.protocol_id = SR_PROTO_RAW;
-       session_bus(session_device_id, &packet);
+       sr_session_bus(session_device_id, &packet);
 
        return ret;
 }
@@ -747,7 +747,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
        device_index = device_index;
 
        packet.type = SR_DF_END;
-       session_bus(session_device_id, &packet);
+       sr_session_bus(session_device_id, &packet);
 }
 
 struct sr_device_plugin link_mso19_plugin_info = {
index 4df5ef051ce37e9d63c3d3d2c6d6b4b7cc89401c..95da9a248e4bfa99bb59e9528cd1b93818657b44 100644 (file)
@@ -618,24 +618,24 @@ static int receive_data(int fd, int revents, void *user_data)
                                packet.length = trigger_at * 4;
                                packet.unitsize = 4;
                                packet.payload = raw_sample_buf;
-                               session_bus(user_data, &packet);
+                               sr_session_bus(user_data, &packet);
                        }
 
                        packet.type = SR_DF_TRIGGER;
                        packet.length = 0;
-                       session_bus(user_data, &packet);
+                       sr_session_bus(user_data, &packet);
 
                        packet.type = SR_DF_LOGIC;
                        packet.length = (limit_samples * 4) - (trigger_at * 4);
                        packet.unitsize = 4;
                        packet.payload = raw_sample_buf + trigger_at * 4;
-                       session_bus(user_data, &packet);
+                       sr_session_bus(user_data, &packet);
                } else {
                        packet.type = SR_DF_LOGIC;
                        packet.length = limit_samples * 4;
                        packet.unitsize = 4;
                        packet.payload = raw_sample_buf;
-                       session_bus(user_data, &packet);
+                       sr_session_bus(user_data, &packet);
                }
                free(raw_sample_buf);
 
@@ -643,7 +643,7 @@ static int receive_data(int fd, int revents, void *user_data)
                serial_close(fd);
                packet.type = SR_DF_END;
                packet.length = 0;
-               session_bus(user_data, &packet);
+               sr_session_bus(user_data, &packet);
        }
 
        return TRUE;
@@ -772,7 +772,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header->protocol_id = SR_PROTO_RAW;
        header->num_logic_probes = NUM_PROBES;
        header->num_analog_probes = 0;
-       session_bus(session_device_id, packet);
+       sr_session_bus(session_device_id, packet);
        g_free(header);
        g_free(packet);
 
@@ -788,7 +788,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
 
        packet.type = SR_DF_END;
        packet.length = 0;
-       session_bus(session_device_id, &packet);
+       sr_session_bus(session_device_id, &packet);
 }
 
 struct sr_device_plugin ols_plugin_info = {
index b99523f820bc696ca8f80a68854a9d854f4375f3..1a438e41bc0628d24b3dab3cb562ea40104c10e9 100644 (file)
@@ -609,7 +609,7 @@ void receive_transfer(struct libusb_transfer *transfer)
                                         */
                                        packet.type = SR_DF_TRIGGER;
                                        packet.length = 0;
-                                       session_bus(user_data, &packet);
+                                       sr_session_bus(user_data, &packet);
 
                                        /*
                                         * Send the samples that triggered it, since we're
@@ -619,7 +619,7 @@ void receive_transfer(struct libusb_transfer *transfer)
                                        packet.length = trigger_stage;
                                        packet.unitsize = 1;
                                        packet.payload = trigger_buffer;
-                                       session_bus(user_data, &packet);
+                                       sr_session_bus(user_data, &packet);
 
                                        trigger_stage = TRIGGER_FIRED;
                                        break;
@@ -652,7 +652,7 @@ void receive_transfer(struct libusb_transfer *transfer)
                packet.length = cur_buflen - trigger_offset;
                packet.unitsize = 1;
                packet.payload = cur_buf + trigger_offset;
-               session_bus(user_data, &packet);
+               sr_session_bus(user_data, &packet);
                g_free(cur_buf);
 
                num_samples += cur_buflen;
@@ -717,7 +717,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header->protocol_id = SR_PROTO_RAW;
        header->num_logic_probes = NUM_PROBES;
        header->num_analog_probes = 0;
-       session_bus(session_device_id, packet);
+       sr_session_bus(session_device_id, packet);
        g_free(header);
        g_free(packet);
 
@@ -733,7 +733,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
        device_index = device_index;
 
        packet.type = SR_DF_END;
-       session_bus(session_device_id, &packet);
+       sr_session_bus(session_device_id, &packet);
 
        receive_transfer(NULL);
 
index cb56a09f8873b859dd3717354dc26b3a4ace06bd..d7f6d4114e3d30d87084f5a6459d333948f0d5d0 100644 (file)
@@ -514,7 +514,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header.protocol_id = SR_PROTO_RAW;
        header.num_logic_probes = num_channels;
        header.num_analog_probes = 0;
-       session_bus(session_device_id, &packet);
+       sr_session_bus(session_device_id, &packet);
 
        buf = g_malloc(PACKET_SIZE);
        if (!buf)
@@ -533,13 +533,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
                packet.length = PACKET_SIZE;
                packet.unitsize = 4;
                packet.payload = buf;
-               session_bus(session_device_id, &packet);
+               sr_session_bus(session_device_id, &packet);
        }
        analyzer_read_stop(sdi->usb->devhdl);
        g_free(buf);
 
        packet.type = SR_DF_END;
-       session_bus(session_device_id, &packet);
+       sr_session_bus(session_device_id, &packet);
 
        return SR_OK;
 }
@@ -551,7 +551,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
        struct sr_device_instance *sdi;
 
        packet.type = SR_DF_END;
-       session_bus(session_device_id, &packet);
+       sr_session_bus(session_device_id, &packet);
 
        if (!(sdi = sr_get_device_instance(device_instances, device_index)))
                return; /* TODO: Cry? */
index b10164693f52adec61d8a8f457587c255055d0d1..046670d5ffe13731a98f233bbdaea6064c42e0e0 100644 (file)
@@ -231,15 +231,11 @@ struct hwcap_option *find_hwcap_option(int hwcap)
 
 void source_remove(int fd)
 {
-
-       session_source_remove(fd);
-
+       sr_session_source_remove(fd);
 }
 
 void source_add(int fd, int events, int timeout, receive_data_callback rcv_cb,
                void *user_data)
 {
-
-       session_source_add(fd, events, timeout, rcv_cb, user_data);
-
+       sr_session_source_add(fd, events, timeout, rcv_cb, user_data);
 }
index 1da4e7014d3896380e14f212d46965eaf73ea2a1..3f3db0b06e7aa8b56e6a2e7ab87384e8ab640520 100644 (file)
@@ -78,7 +78,7 @@ static int loadfile(struct sr_input *in, const char *filename)
        packet.type = SR_DF_HEADER;
        packet.length = sizeof(struct sr_datafeed_header);
        packet.payload = &header;
-       session_bus(in->vdevice, &packet);
+       sr_session_bus(in->vdevice, &packet);
 
        /* chop up the input file into chunks and feed it into the session bus */
        packet.type = SR_DF_LOGIC;
@@ -86,14 +86,14 @@ static int loadfile(struct sr_input *in, const char *filename)
        packet.payload = buffer;
        while ((size = read(fd, buffer, CHUNKSIZE)) > 0) {
                packet.length = size;
-               session_bus(in->vdevice, &packet);
+               sr_session_bus(in->vdevice, &packet);
        }
        close(fd);
 
        /* end of stream */
        packet.type = SR_DF_END;
        packet.length = 0;
-       session_bus(in->vdevice, &packet);
+       sr_session_bus(in->vdevice, &packet);
 
        return SR_OK;
 }
index e4f3921b79528c3bc8194657919a5e4e98ab12f8..2cafc0f02746846f261d0556f9aad37e35ad3991 100644 (file)
--- a/session.c
+++ b/session.c
@@ -44,14 +44,14 @@ struct source *sources = NULL;
 int source_timeout = -1;
 
 
-struct sr_session *session_new(void)
+struct sr_session *sr_session_new(void)
 {
        session = calloc(1, sizeof(struct sr_session));
 
        return session;
 }
 
-void session_destroy(void)
+void sr_session_destroy(void)
 {
        g_slist_free(session->devices);
 
@@ -60,13 +60,13 @@ void session_destroy(void)
        g_free(session);
 }
 
-void session_device_clear(void)
+void sr_session_device_clear(void)
 {
        g_slist_free(session->devices);
        session->devices = NULL;
 }
 
-int session_device_add(struct sr_device *device)
+int sr_session_device_add(struct sr_device *device)
 {
        int ret;
 
@@ -81,7 +81,7 @@ int session_device_add(struct sr_device *device)
        return SR_OK;
 }
 
-void session_pa_clear(void)
+void sr_session_pa_clear(void)
 {
        /*
         * The protocols are pointers to the global set of PA plugins,
@@ -91,24 +91,24 @@ void session_pa_clear(void)
        session->analyzers = NULL;
 }
 
-void session_pa_add(struct analyzer *an)
+void sr_session_pa_add(struct analyzer *an)
 {
        session->analyzers = g_slist_append(session->analyzers, an);
 }
 
-void session_datafeed_callback_clear(void)
+void sr_session_datafeed_callback_clear(void)
 {
        g_slist_free(session->datafeed_callbacks);
        session->datafeed_callbacks = NULL;
 }
 
-void session_datafeed_callback_add(datafeed_callback callback)
+void sr_session_datafeed_callback_add(datafeed_callback callback)
 {
        session->datafeed_callbacks =
            g_slist_append(session->datafeed_callbacks, callback);
 }
 
-static void session_run_poll()
+static void sr_session_run_poll()
 {
        GPollFD *fds, my_gpollfd;
        int ret, i;
@@ -150,7 +150,7 @@ static void session_run_poll()
 
 }
 
-int session_start(void)
+int sr_session_start(void)
 {
        struct sr_device *device;
        GSList *l;
@@ -167,7 +167,7 @@ int session_start(void)
        return ret;
 }
 
-void session_run(void)
+void sr_session_run(void)
 {
 
        g_message("session: running");
@@ -180,11 +180,11 @@ void session_run(void)
                        sources[0].cb(-1, 0, sources[0].user_data);
        else
                /* real sources, use g_poll() main loop */
-               session_run_poll();
+               sr_session_run_poll();
 
 }
 
-void session_halt(void)
+void sr_session_halt(void)
 {
 
        g_message("session: halting");
@@ -192,7 +192,7 @@ void session_halt(void)
 
 }
 
-void session_stop(void)
+void sr_session_stop(void)
 {
        struct sr_device *device;
        GSList *l;
@@ -207,7 +207,7 @@ void session_stop(void)
 
 }
 
-void session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
+void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
 {
        GSList *l;
        datafeed_callback cb;
@@ -222,7 +222,7 @@ void session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
        }
 }
 
-void session_source_add(int fd, int events, int timeout,
+void sr_session_source_add(int fd, int events, int timeout,
                receive_data_callback callback, void *user_data)
 {
        struct source *new_sources, *s;
@@ -248,7 +248,7 @@ void session_source_add(int fd, int events, int timeout,
                source_timeout = timeout;
 }
 
-void session_source_remove(int fd)
+void sr_session_source_remove(int fd)
 {
        struct source *new_sources;
        int old, new;
index 1bc430d522033bc6570551567e9d27370c17d6b5..56740fa54a551bcab53c89868d8dd6639362710b 100644 (file)
@@ -90,7 +90,7 @@ static int feed_chunk(int fd, int revents, void *user_data)
                        packet.length = ret;
                        packet.unitsize = vdevice->unitsize;
                        packet.payload = buf;
-                       session_bus(user_data, &packet);
+                       sr_session_bus(user_data, &packet);
                } else {
                        /* done with this capture file */
                        zip_fclose(vdevice->capfile);
@@ -103,7 +103,7 @@ static int feed_chunk(int fd, int revents, void *user_data)
        if (!got_data) {
                packet.type = SR_DF_END;
                packet.length = 0;
-               session_bus(user_data, &packet);
+               sr_session_bus(user_data, &packet);
        }
 
        return TRUE;
@@ -247,7 +247,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        }
 
        /* freewheeling source */
-       session_source_add(-1, 0, 0, feed_chunk, session_device_id);
+       sr_session_source_add(-1, 0, 0, feed_chunk, session_device_id);
 
        /* Send header packet to the session bus. */
        packet = g_malloc(sizeof(struct sr_datafeed_packet));
@@ -263,7 +263,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header->protocol_id = SR_PROTO_RAW;
        header->num_logic_probes = vdevice->num_probes;
        header->num_analog_probes = 0;
-       session_bus(session_device_id, packet);
+       sr_session_bus(session_device_id, packet);
        g_free(header);
        g_free(packet);
 
@@ -284,5 +284,5 @@ struct sr_device_plugin session_driver = {
        hw_get_capabilities,
        hw_set_configuration,
        hw_start_acquisition,
-       NULL
+       NULL,
 };
index bd3548ab4f7799a78a9c7b0ccee1e98704c3ef02..aa7a8b657ccfc2a20f1b6ef6c77db430914463f7 100644 (file)
@@ -30,7 +30,7 @@ extern struct sr_session *session;
 extern struct sr_device_plugin session_driver;
 
 
-int session_load(const char *filename)
+int sr_session_load(const char *filename)
 {
        GKeyFile *kf;
        GPtrArray *capturefiles;
@@ -77,7 +77,7 @@ int session_load(const char *filename)
                return SR_ERR;
        }
 
-       session = session_new();
+       session = sr_session_new();
 
        devcnt = 0;
        capturefiles = g_ptr_array_new_with_free_func(g_free);
@@ -98,7 +98,7 @@ int session_load(const char *filename)
                                        if (devcnt == 0)
                                                /* first device, init the plugin */
                                                device->plugin->init((char *)filename);
-                                       session_device_add(device);
+                                       sr_session_device_add(device);
                                        device->plugin->set_configuration(devcnt, SR_HWCAP_CAPTUREFILE, val);
                                        g_ptr_array_add(capturefiles, val);
                                } else if (!strcmp(keys[j], "samplerate")) {
@@ -136,7 +136,7 @@ int session_load(const char *filename)
        return SR_OK;
 }
 
-int session_save(char *filename)
+int sr_session_save(char *filename)
 {
        GSList *l, *p, *d;
        FILE *meta;
index 8dfe2db149daea8ce46163fd0e0e3c6585239f20..22aab6f5c296a73f5d9212620207905225ffcb52 100644 (file)
@@ -97,31 +97,31 @@ typedef void (*datafeed_callback) (struct sr_device *device,
                                 struct sr_datafeed_packet *packet);
 
 /* Session setup */
-int session_load(const char *filename);
-struct sr_session *session_new(void);
-void session_destroy(void);
-void session_device_clear(void);
-int session_device_add(struct sr_device *device);
+int sr_session_load(const char *filename);
+struct sr_session *sr_session_new(void);
+void sr_session_destroy(void);
+void sr_session_device_clear(void);
+int sr_session_device_add(struct sr_device *device);
 
 /* Protocol analyzers setup */
-void session_pa_clear(void);
-void session_pa_add(struct analyzer *pa);
+void sr_session_pa_clear(void);
+void sr_session_pa_add(struct analyzer *pa);
 
 /* Datafeed setup */
-void session_datafeed_callback_clear(void);
-void session_datafeed_callback_add(datafeed_callback callback);
+void sr_session_datafeed_callback_clear(void);
+void sr_session_datafeed_callback_add(datafeed_callback callback);
 
 /* Session control */
-int session_start(void);
-void session_run(void);
-void session_halt(void);
-void session_stop(void);
-void session_bus(struct sr_device *device, struct sr_datafeed_packet *packet);
+int sr_session_start(void);
+void sr_session_run(void);
+void sr_session_halt(void);
+void sr_session_stop(void);
+void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet);
 void make_metadata(char *filename);
-int session_save(char *filename);
-void session_source_add(int fd, int events, int timeout,
+int sr_session_save(char *filename);
+void sr_session_source_add(int fd, int events, int timeout,
                receive_data_callback callback, void *user_data);
-void session_source_remove(int fd);
+void sr_session_source_remove(int fd);
 
 /*--- input/input.c ---------------------------------------------------------*/