]> sigrok.org Git - libsigrok.git/commitdiff
sr: Make more symbols private via static/SR_PRIV.
authorUwe Hermann <redacted>
Thu, 2 Feb 2012 20:15:04 +0000 (21:15 +0100)
committerUwe Hermann <redacted>
Thu, 2 Feb 2012 20:46:10 +0000 (21:46 +0100)
Additional zeroplus fixes:

 - Remove unneeded function prototypes from .h files.

 - Remove unused variables and/or use standard libusb #defines instead.

 - Remove unused GL_* error code #defines.

14 files changed:
hardware/alsa/alsa.c
hardware/asix-sigma/asix-sigma.c
hardware/chronovu-la8/chronovu-la8.c
hardware/demo/demo.c
hardware/link-mso19/link-mso19.c
hardware/link-mso19/link-mso19.h
hardware/openbench-logic-sniffer/ols.c
hardware/saleae-logic/saleae-logic.c
hardware/zeroplus-logic-cube/analyzer.c
hardware/zeroplus-logic-cube/analyzer.h
hardware/zeroplus-logic-cube/gl_usb.c
hardware/zeroplus-logic-cube/gl_usb.h
hardware/zeroplus-logic-cube/zeroplus.c
hwplugin.c

index ddfb95fa9f9a6c020ba6337d669ce356d9f87959..3fa72a8c399dc11965fb5835d908ad15c9dddda1 100644 (file)
@@ -386,7 +386,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
        session_device_id = session_device_id;
 }
 
-struct sr_device_plugin alsa_plugin_info = {
+SR_PRIV struct sr_device_plugin alsa_plugin_info = {
        .name = "alsa",
        .longname = "ALSA driver",
        .api_version = 1,
index 87a3f20003f7f3af905007355f686d81116983e9..d93291ea4bb8ba1a9ab49910b7b2d3785a230b0c 100644 (file)
@@ -1399,7 +1399,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
        sigma->state.state = SIGMA_DOWNLOAD;
 }
 
-struct sr_device_plugin asix_sigma_plugin_info = {
+SR_PRIV struct sr_device_plugin asix_sigma_plugin_info = {
        .name = "asix-sigma",
        .longname = "ASIX SIGMA",
        .api_version = 1,
index 040e23fbffe3d9c911a80c27c7e19eae15896772..ad8c3601f8e150179d8b16e97f84dc4e51684b58 100644 (file)
@@ -1127,7 +1127,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
        sr_session_bus(session_data, &packet);
 }
 
-struct sr_device_plugin chronovu_la8_plugin_info = {
+SR_PRIV struct sr_device_plugin chronovu_la8_plugin_info = {
        .name = "chronovu-la8",
        .longname = "ChronoVu LA8",
        .api_version = 1,
index 05f19e1d2a81390c50c7afb272d826058c568cba..e2cbe30de6eeeb8e3a27400762356c2b8255f496 100644 (file)
@@ -64,7 +64,7 @@ enum {
 };
 
 /* FIXME: Should not be global. */
-GIOChannel *channels[2];
+static GIOChannel *channels[2];
 
 struct databag {
        int pipe_fds[2];
@@ -487,7 +487,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
        thread_running = 0;
 }
 
-struct sr_device_plugin demo_plugin_info = {
+SR_PRIV struct sr_device_plugin demo_plugin_info = {
        .name = "demo",
        .longname = "Demo driver and pattern generator",
        .api_version = 1,
index 961d3bac42834adeaa1f6e8fe6397283d6ab7d63..1af3d2a9fddfc882da6197de1b6f1efe9e9e7a85 100644 (file)
@@ -826,7 +826,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
        sr_session_bus(session_device_id, &packet);
 }
 
-struct sr_device_plugin link_mso19_plugin_info = {
+SR_PRIV struct sr_device_plugin link_mso19_plugin_info = {
        .name = "link-mso19",
        .longname = "Link Instruments MSO-19",
        .api_version = 1,
index 0e9dec300154612cf41792f78f2678c669122d85..47a9af28be33ddbe4c575cc9085f32f0d25b6cee 100644 (file)
@@ -150,7 +150,7 @@ static struct rate_map rate_map[] = {
 };
 
 /* FIXME: Determine corresponding voltages */
-uint16_t la_threshold_map[] = {
+static uint16_t la_threshold_map[] = {
        0x8600,
        0x8770,
        0x88ff,
index 1b7970e31ed18f3ec3eff9cfbefa89642dd2a0e5..e69bcfb93eba20670ec1af2bc878ed5c61649a08 100644 (file)
@@ -1022,7 +1022,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
        sr_session_bus(session_device_id, &packet);
 }
 
-struct sr_device_plugin ols_plugin_info = {
+SR_PRIV struct sr_device_plugin ols_plugin_info = {
        .name = "ols",
        .longname = "Openbench Logic Sniffer",
        .api_version = 1,
index fb434fa3707aeee1843cad2b6fe2dffdb093cedb..49174097af0052c8805b328c98aa48660fe399d6 100644 (file)
@@ -815,7 +815,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_data)
        /* TODO: Need to cancel and free any queued up transfers. */
 }
 
-struct sr_device_plugin saleae_logic_plugin_info = {
+SR_PRIV struct sr_device_plugin saleae_logic_plugin_info = {
        .name = "saleae-logic",
        .longname = "Saleae Logic",
        .api_version = 1,
index 283820b2dbc1e15306757ddbe52c8179b5a40ec9..78db7baf68936757f19d2be0d8434e2253dcb045 100644 (file)
@@ -302,20 +302,20 @@ static void analyzer_set_filter(libusb_device_handle *devh)
                gl_reg_write(devh, FILTER_STATUS + i, g_filter_status[i]);
 }
 
-void analyzer_reset(libusb_device_handle *devh)
+SR_PRIV void analyzer_reset(libusb_device_handle *devh)
 {
        analyzer_write_status(devh, 3, STATUS_FLAG_NONE);       // reset device
        analyzer_write_status(devh, 3, STATUS_FLAG_RESET);      // reset device
 }
 
-void analyzer_initialize(libusb_device_handle *devh)
+SR_PRIV void analyzer_initialize(libusb_device_handle *devh)
 {
        analyzer_write_status(devh, 1, STATUS_FLAG_NONE);
        analyzer_write_status(devh, 1, STATUS_FLAG_INIT);
        analyzer_write_status(devh, 1, STATUS_FLAG_NONE);
 }
 
-void analyzer_wait(libusb_device_handle *devh, int set, int unset)
+SR_PRIV void analyzer_wait(libusb_device_handle *devh, int set, int unset)
 {
        int status;
        while (1) {
@@ -325,7 +325,7 @@ void analyzer_wait(libusb_device_handle *devh, int set, int unset)
        }
 }
 
-void analyzer_read_start(libusb_device_handle *devh)
+SR_PRIV void analyzer_read_start(libusb_device_handle *devh)
 {
        int i;
 
@@ -335,19 +335,19 @@ void analyzer_read_start(libusb_device_handle *devh)
                (void)gl_reg_read(devh, READ_RAM_STATUS);
 }
 
-int analyzer_read_data(libusb_device_handle *devh, void *buffer,
+SR_PRIV int analyzer_read_data(libusb_device_handle *devh, void *buffer,
                       unsigned int size)
 {
        return gl_read_bulk(devh, buffer, size);
 }
 
-void analyzer_read_stop(libusb_device_handle *devh)
+SR_PRIV void analyzer_read_stop(libusb_device_handle *devh)
 {
        analyzer_write_status(devh, 3, STATUS_FLAG_20);
        analyzer_write_status(devh, 3, STATUS_FLAG_NONE);
 }
 
-void analyzer_start(libusb_device_handle *devh)
+SR_PRIV void analyzer_start(libusb_device_handle *devh)
 {
        analyzer_write_status(devh, 1, STATUS_FLAG_NONE);
        analyzer_write_status(devh, 1, STATUS_FLAG_INIT);
@@ -355,7 +355,7 @@ void analyzer_start(libusb_device_handle *devh)
        analyzer_write_status(devh, 1, STATUS_FLAG_GO);
 }
 
-void analyzer_configure(libusb_device_handle *devh)
+SR_PRIV void analyzer_configure(libusb_device_handle *devh)
 {
        int i;
 
@@ -405,7 +405,7 @@ void analyzer_configure(libusb_device_handle *devh)
        __analyzer_set_compression(devh, g_compression);
 }
 
-void analyzer_add_trigger(int channel, int type)
+SR_PRIV void analyzer_add_trigger(int channel, int type)
 {
        int i;
 
@@ -448,7 +448,7 @@ void analyzer_add_trigger(int channel, int type)
        }
 }
 
-void analyzer_add_filter(int channel, int type)
+SR_PRIV void analyzer_add_filter(int channel, int type)
 {
        int i;
 
@@ -479,73 +479,73 @@ void analyzer_add_filter(int channel, int type)
        g_filter_enable = 1;
 }
 
-void analyzer_set_trigger_count(int count)
+SR_PRIV void analyzer_set_trigger_count(int count)
 {
        g_trigger_count = count;
 }
 
-void analyzer_set_freq(int freq, int scale)
+SR_PRIV void analyzer_set_freq(int freq, int scale)
 {
        g_freq_value = freq;
        g_freq_scale = scale;
 }
 
-void analyzer_set_memory_size(unsigned int size)
+SR_PRIV void analyzer_set_memory_size(unsigned int size)
 {
        g_memory_size = size;
 }
 
-void analyzer_set_ramsize_trigger_address(unsigned int address)
+SR_PRIV void analyzer_set_ramsize_trigger_address(unsigned int address)
 {
        g_ramsize_triggerbar_addr = address;
 }
 
-void analyzer_set_triggerbar_address(unsigned int address)
+SR_PRIV void analyzer_set_triggerbar_address(unsigned int address)
 {
        g_triggerbar_addr = address;
 }
 
-unsigned int analyzer_read_id(libusb_device_handle *devh)
+SR_PRIV unsigned int analyzer_read_id(libusb_device_handle *devh)
 {
        return gl_reg_read(devh, DEVICE_ID1) << 8 | gl_reg_read(devh,
                                                                DEVICE_ID0);
 }
 
-unsigned int analyzer_get_stop_address(libusb_device_handle *devh)
+SR_PRIV unsigned int analyzer_get_stop_address(libusb_device_handle *devh)
 {
        return gl_reg_read(devh, STOP_ADDRESS2) << 16 | gl_reg_read(devh,
                        STOP_ADDRESS1) << 8 | gl_reg_read(devh, STOP_ADDRESS0);
 }
 
-unsigned int analyzer_get_now_address(libusb_device_handle *devh)
+SR_PRIV unsigned int analyzer_get_now_address(libusb_device_handle *devh)
 {
        return gl_reg_read(devh, NOW_ADDRESS2) << 16 | gl_reg_read(devh,
                        NOW_ADDRESS1) << 8 | gl_reg_read(devh, NOW_ADDRESS0);
 }
 
-unsigned int analyzer_get_trigger_address(libusb_device_handle *devh)
+SR_PRIV unsigned int analyzer_get_trigger_address(libusb_device_handle *devh)
 {
        return gl_reg_read(devh, TRIGGER_ADDRESS2) << 16 | gl_reg_read(devh,
                TRIGGER_ADDRESS1) << 8 | gl_reg_read(devh, TRIGGER_ADDRESS0);
 }
 
-void analyzer_set_compression(unsigned int type)
+SR_PRIV void analyzer_set_compression(unsigned int type)
 {
        g_compression = type;
 }
 
-void analyzer_wait_button(libusb_device_handle *devh)
+SR_PRIV void analyzer_wait_button(libusb_device_handle *devh)
 {
        analyzer_wait(devh, STATUS_BUTTON_PRESSED, 0);
 }
 
-void analyzer_wait_data(libusb_device_handle *devh)
+SR_PRIV void analyzer_wait_data(libusb_device_handle *devh)
 {
        analyzer_wait(devh, STATUS_READY | 8, STATUS_BUSY);
 }
 
-int analyzer_decompress(void *input, unsigned int input_len, void *output,
-                       unsigned int output_len)
+SR_PRIV int analyzer_decompress(void *input, unsigned int input_len,
+                               void *output, unsigned int output_len)
 {
        unsigned char *in = input;
        unsigned char *out = output;
index 9865a2ed2a903d96ec4769f42ac172d97536521e..9416478479b4316f1e5c9463ae35dc68cec99245 100644 (file)
@@ -33,6 +33,7 @@
 #define SIGROK_ZEROPLUS_ANALYZER_H
 
 #include <libusb.h>
+#include "sigrok.h"
 
 #define STATUS_FLAG_NONE       0x00
 #define STATUS_FLAG_RESET      0x01
@@ -75,33 +76,33 @@ enum {
        TRIGGER_ANYEDGE,
 };
 
-void analyzer_set_freq(int freq, int scale);
-void analyzer_set_ramsize_trigger_address(unsigned int address);
-void analyzer_set_triggerbar_address(unsigned int address);
-void analyzer_set_compression(unsigned int type);
-void analyzer_set_memory_size(unsigned int size);
-void analyzer_add_trigger(int channel, int type);
-void analyzer_set_trigger_count(int count);
-void analyzer_add_filter(int channel, int type);
+SR_PRIV void analyzer_set_freq(int freq, int scale);
+SR_PRIV void analyzer_set_ramsize_trigger_address(unsigned int address);
+SR_PRIV void analyzer_set_triggerbar_address(unsigned int address);
+SR_PRIV void analyzer_set_compression(unsigned int type);
+SR_PRIV void analyzer_set_memory_size(unsigned int size);
+SR_PRIV void analyzer_add_trigger(int channel, int type);
+SR_PRIV void analyzer_set_trigger_count(int count);
+SR_PRIV void analyzer_add_filter(int channel, int type);
 
-unsigned int analyzer_read_id(libusb_device_handle *devh);
-unsigned int analyzer_get_stop_address(libusb_device_handle *devh);
-unsigned int analyzer_get_now_address(libusb_device_handle *devh);
-unsigned int analyzer_get_trigger_address(libusb_device_handle *devh);
-int analyzer_decompress(void *input, unsigned int input_len, void *output,
-                       unsigned int output_len);
+SR_PRIV unsigned int analyzer_read_id(libusb_device_handle *devh);
+SR_PRIV unsigned int analyzer_get_stop_address(libusb_device_handle *devh);
+SR_PRIV unsigned int analyzer_get_now_address(libusb_device_handle *devh);
+SR_PRIV unsigned int analyzer_get_trigger_address(libusb_device_handle *devh);
+SR_PRIV int analyzer_decompress(void *input, unsigned int input_len,
+                               void *output, unsigned int output_len);
 
-void analyzer_reset(libusb_device_handle *devh);
-void analyzer_initialize(libusb_device_handle *devh);
-void analyzer_wait(libusb_device_handle *devh, int set, int unset);
-void analyzer_read_start(libusb_device_handle *devh);
-int analyzer_read_data(libusb_device_handle *devh, void *buffer,
-                      unsigned int size);
-void analyzer_read_stop(libusb_device_handle *devh);
-void analyzer_start(libusb_device_handle *devh);
-void analyzer_configure(libusb_device_handle *devh);
+SR_PRIV void analyzer_reset(libusb_device_handle *devh);
+SR_PRIV void analyzer_initialize(libusb_device_handle *devh);
+SR_PRIV void analyzer_wait(libusb_device_handle *devh, int set, int unset);
+SR_PRIV void analyzer_read_start(libusb_device_handle *devh);
+SR_PRIV int analyzer_read_data(libusb_device_handle *devh, void *buffer,
+                              unsigned int size);
+SR_PRIV void analyzer_read_stop(libusb_device_handle *devh);
+SR_PRIV void analyzer_start(libusb_device_handle *devh);
+SR_PRIV void analyzer_configure(libusb_device_handle *devh);
 
-void analyzer_wait_button(libusb_device_handle *devh);
-void analyzer_wait_data(libusb_device_handle *devh);
+SR_PRIV void analyzer_wait_button(libusb_device_handle *devh);
+SR_PRIV void analyzer_wait_data(libusb_device_handle *devh);
 
 #endif
index 613028ed9391cf099c5e7a1e34ab0483cd7a756a..0d688300b0f810a4c82494ac597e96ba8b14dd6c 100644 (file)
                         LIBUSB_RECIPIENT_INTERFACE)
 #define CTRL_OUT       (LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT | \
                         LIBUSB_RECIPIENT_INTERFACE)
+#define EP1_BULK_IN    (LIBUSB_ENDPOINT_IN | 1)
 
-const int PACKET_CTRL_LEN = 2;
-const int PACKET_INT_LEN = 2;
-const int PACKET_BULK_LEN = 64;
-const int INTERFACE = 0;
-const int ENDPOINT_INT_IN = 0x81;      /* Endpoint 0x81 address for IN */
-const int ENDPOINT_INT_OUT = 0x01;     /* Endpoint 1 address for OUT */
-const int ENDPOINT_BULK_IN = 0x81;     /* Endpoint 0x81 address for IN */
-const int ENDPOINT_BULK_OUT = 0x02;    /* Endpoint 1 address for OUT */
-const int TIMEOUT = 5000;              /* Timeout in ms */
+#define TIMEOUT                5000    /* Timeout in ms */
 
 enum {
        REQ_READBULK = 0x82,
@@ -59,7 +52,7 @@ enum {
 
 static struct libusb_device_handle *g_devh = NULL;
 
-int gl_write_address(libusb_device_handle *devh, unsigned int address)
+static int gl_write_address(libusb_device_handle *devh, unsigned int address)
 {
        unsigned char packet[8] = { address & 0xFF };
        int ret;
@@ -72,7 +65,7 @@ int gl_write_address(libusb_device_handle *devh, unsigned int address)
        return ret;
 }
 
-int gl_write_data(libusb_device_handle *devh, unsigned int val)
+static int gl_write_data(libusb_device_handle *devh, unsigned int val)
 {
        unsigned char packet[8] = { val & 0xFF };
        int ret;
@@ -85,7 +78,7 @@ int gl_write_data(libusb_device_handle *devh, unsigned int val)
        return ret;
 }
 
-int gl_read_data(libusb_device_handle *devh)
+static int gl_read_data(libusb_device_handle *devh)
 {
        unsigned char packet[8] = { 0 };
        int ret;
@@ -98,7 +91,8 @@ int gl_read_data(libusb_device_handle *devh)
        return (ret == 1) ? packet[0] : ret;
 }
 
-int gl_read_bulk(libusb_device_handle *devh, void *buffer, unsigned int size)
+SR_PRIV int gl_read_bulk(libusb_device_handle *devh, void *buffer,
+                        unsigned int size)
 {
        unsigned char packet[8] =
            { 0, 0, 0, 0, size & 0xff, (size & 0xff00) >> 8,
@@ -111,14 +105,14 @@ int gl_read_bulk(libusb_device_handle *devh, void *buffer, unsigned int size)
                sr_err("%s: libusb_control_transfer returned %d\n",
                       __func__, ret);
 
-       ret = libusb_bulk_transfer(devh, ENDPOINT_BULK_IN, buffer, size,
+       ret = libusb_bulk_transfer(devh, EP1_BULK_IN, buffer, size,
                                   &transferred, TIMEOUT);
        if (ret < 0)
                sr_err("Bulk read error %d\n", ret);
        return transferred;
 }
 
-int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
+SR_PRIV int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
                 unsigned int val)
 {
        int ret;
@@ -130,7 +124,7 @@ int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
        return ret;
 }
 
-int gl_reg_read(libusb_device_handle *devh, unsigned int reg)
+SR_PRIV int gl_reg_read(libusb_device_handle *devh, unsigned int reg)
 {
        int ret;
 
index 2bc1d93863ff7cb40519257b530250ac1b258cbe..a5ae01131b1f634895a9eb79b1ff1bd0a8e8ebb3 100644 (file)
 #define SIGROK_ZEROPLUS_GL_H
 
 #include <libusb.h>
+#include "sigrok.h"
 
-#define GL_OK           0
-#define GL_ELIBUSB     -1
-#define GL_EOPEN       -2
-#define GL_ESETCONFIG  -3
-#define GL_ECLAIM      -4
-
-int gl_write_address(libusb_device_handle *devh, unsigned int address);
-int gl_write_data(libusb_device_handle *devh, unsigned int val);
-int gl_read_data(libusb_device_handle *devh);
-int gl_read_bulk(libusb_device_handle *devh, void *buffer, unsigned int size);
-int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
-                unsigned int val);
-int gl_reg_read(libusb_device_handle *devh, unsigned int reg);
+SR_PRIV int gl_read_bulk(libusb_device_handle *devh, void *buffer,
+                        unsigned int size);
+SR_PRIV int gl_reg_write(libusb_device_handle *devh, unsigned int reg,
+                        unsigned int val);
+SR_PRIV int gl_reg_read(libusb_device_handle *devh, unsigned int reg);
 
 #endif
index cd50c45d063d62479508765a2b964d97f6a92ecd..a4022f1fb63da8bdbebc6ebbca9ffe8e01d9c23f 100644 (file)
@@ -722,7 +722,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
        /* TODO: Need to cancel and free any queued up transfers. */
 }
 
-struct sr_device_plugin zeroplus_logic_cube_plugin_info = {
+SR_PRIV struct sr_device_plugin zeroplus_logic_cube_plugin_info = {
        .name = "zeroplus-logic-cube",
        .longname = "Zeroplus Logic Cube LAP-C series",
        .api_version = 1,
index 626e448389874d200417f0db1f3679e3df76b476..4e13ed1f04ae06ef10265332cee3035b9af3edde 100644 (file)
@@ -58,7 +58,7 @@ extern struct sr_device_plugin zeroplus_logic_cube_plugin_info;
 extern struct sr_device_plugin asix_sigma_plugin_info;
 #endif
 #ifdef HAVE_LA_CHRONOVU_LA8
-extern struct device_plugin chronovu_la8_plugin_info;
+extern SR_PRIV struct device_plugin chronovu_la8_plugin_info;
 #endif
 #ifdef HAVE_LA_LINK_MSO19
 extern struct sr_device_plugin link_mso19_plugin_info;