]> sigrok.org Git - libsigrok.git/blobdiff - hardware/zeroplus-logic-cube/zeroplus.c
Constify some more 'char *' parameters.
[libsigrok.git] / hardware / zeroplus-logic-cube / zeroplus.c
index 0c3d25bc803ca29e2dc7d157423f237460c043f7..5574281134c2ba06f3f6130ff2fc39aa8a414961 100644 (file)
@@ -17,6 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "config.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/time.h>
@@ -24,7 +25,6 @@
 #include <glib.h>
 #include <libusb.h>
 #include <sigrok.h>
-#include "config.h"
 #include "analyzer.h"
 
 #define USB_VENDOR                     0x0c12
@@ -51,7 +51,7 @@ typedef struct {
  * Note -- 16032, 16064 and 16128 *usually* -- but not always -- have the
  * same 128K sample depth.
  */
-model_t zeroplus_models[] = {
+static model_t zeroplus_models[] = {
        {0x7009, "LAP-C(16064)",  16, 64,   100},
        {0x700A, "LAP-C(16128)",  16, 128,  200},
        {0x700B, "LAP-C(32128)",  32, 128,  200},
@@ -108,7 +108,7 @@ static uint64_t supported_samplerates[] = {
        0,
 };
 
-static struct samplerates samplerates = {
+static struct sr_samplerates samplerates = {
        0, 0, 0,
        supported_samplerates,
 };
@@ -116,8 +116,8 @@ static struct samplerates samplerates = {
 /* TODO: All of these should go in a device-specific struct. */
 static uint64_t cur_samplerate = 0;
 static uint64_t limit_samples = 0;
-int num_channels = 32; /* TODO: This isn't initialized before it's needed :( */
-uint64_t memory_size = 0;
+static int num_channels = 32; /* TODO: This isn't initialized before it's needed :( */
+static uint64_t memory_size = 0;
 static uint8_t probe_mask = 0;
 static uint8_t trigger_mask[NUM_TRIGGER_STAGES] = { 0 };
 static uint8_t trigger_value[NUM_TRIGGER_STAGES] = { 0 };
@@ -189,7 +189,7 @@ static int opendev4(struct sr_device_instance **sdi, libusb_device *dev,
        return 0;
 }
 
-struct sr_device_instance *zp_open_device(int device_index)
+static struct sr_device_instance *zp_open_device(int device_index)
 {
        struct sr_device_instance *sdi;
        libusb_device **devlist;
@@ -234,7 +234,7 @@ static void close_device(struct sr_device_instance *sdi)
 
 static int configure_probes(GSList *probes)
 {
-       struct probe *probe;
+       struct sr_probe *probe;
        GSList *l;
        int probe_bit, stage, i;
        char *tc;
@@ -247,7 +247,7 @@ static int configure_probes(GSList *probes)
 
        stage = -1;
        for (l = probes; l; l = l->next) {
-               probe = (struct probe *)l->data;
+               probe = (struct sr_probe *)l->data;
                if (probe->enabled == FALSE)
                        continue;
                probe_bit = 1 << (probe->index - 1);
@@ -273,7 +273,7 @@ static int configure_probes(GSList *probes)
  * API callbacks
  */
 
-static int hw_init(char *deviceinfo)
+static int hw_init(const char *deviceinfo)
 {
        struct sr_device_instance *sdi;
        struct libusb_device_descriptor des;
@@ -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? */