]> sigrok.org Git - libsigrok.git/commitdiff
SR_ prefix for all public enums.
authorUwe Hermann <redacted>
Sun, 30 Jan 2011 16:58:41 +0000 (17:58 +0100)
committerUwe Hermann <redacted>
Sun, 30 Jan 2011 17:32:59 +0000 (18:32 +0100)
22 files changed:
device.c
hardware/alsa/alsa.c
hardware/asix-sigma/asix-sigma.c
hardware/common/misc.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
output/output_analog.c
output/output_binary.c
output/output_gnuplot.c
output/output_ols.c
output/output_skeleton.c
output/output_vcd.c
output/text/ascii.c
output/text/bits.c
output/text/hex.c
output/text/text.c
sigrok.h

index dedae3a61840ff9d8b02cc4df977d51bd67e3eb5..9e922f050fe3df2195af7762abdb82b7e47dee55 100644 (file)
--- a/device.c
+++ b/device.c
@@ -51,7 +51,7 @@ int device_plugin_init(struct sr_device_plugin *plugin)
        g_message("initializing %s plugin", plugin->name);
        num_devices = plugin->init(NULL);
        for (i = 0; i < num_devices; i++) {
-               num_probes = (int)plugin->get_device_info(i, DI_NUM_PROBES);
+               num_probes = (int)plugin->get_device_info(i, SR_DI_NUM_PROBES);
                device_new(plugin, i, num_probes);
        }
 
index cef1814b068df415c686d323518e91b0ebcfb7a1..3ddadcb937f6838919d439bae547eadd5916db52 100644 (file)
@@ -30,9 +30,9 @@
 #define AUDIO_DEV "plughw:0,0"
 
 static int capabilities[] = {
-       HWCAP_SAMPLERATE,
-       HWCAP_LIMIT_SAMPLES,
-       HWCAP_CONTINUOUS,
+       SR_HWCAP_SAMPLERATE,
+       SR_HWCAP_LIMIT_SAMPLES,
+       SR_HWCAP_CONTINUOUS,
 };
 
 static GSList *device_instances = NULL;
@@ -58,7 +58,7 @@ static int hw_init(char *deviceinfo)
                return 0;
        memset(alsa, 0, sizeof(struct alsa));
 
-       sdi = sr_device_instance_new(0, ST_ACTIVE, "alsa", NULL, NULL);
+       sdi = sr_device_instance_new(0, SR_ST_ACTIVE, "alsa", NULL, NULL);
        if (!sdi)
                goto free_alsa;
 
@@ -146,17 +146,17 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        alsa = sdi->priv;
 
        switch (device_info_id) {
-       case DI_INSTANCE:
+       case SR_DI_INSTANCE:
                info = sdi;
                break;
-       case DI_NUM_PROBES:
+       case SR_DI_NUM_PROBES:
                info = GINT_TO_POINTER(NUM_PROBES);
                break;
-       case DI_CUR_SAMPLERATE:
+       case SR_DI_CUR_SAMPLERATE:
                info = &alsa->cur_rate;
                break;
-       // case DI_PROBE_TYPE:
-       //      info = GINT_TO_POINTER(PROBE_TYPE_ANALOG);
+       // case SR_DI_PROBE_TYPE:
+       //      info = GINT_TO_POINTER(SR_PROBE_TYPE_ANALOG);
        //      break;
        }
 
@@ -168,7 +168,7 @@ static int hw_get_status(int device_index)
        /* Avoid compiler warnings. */
        device_index = device_index;
 
-       return ST_ACTIVE;
+       return SR_ST_ACTIVE;
 }
 
 static int *hw_get_capabilities(void)
@@ -186,12 +186,12 @@ static int hw_set_configuration(int device_index, int capability, void *value)
        alsa = sdi->priv;
 
        switch (capability) {
-       case HWCAP_PROBECONFIG:
+       case SR_HWCAP_PROBECONFIG:
                return SR_OK;
-       case HWCAP_SAMPLERATE:
+       case SR_HWCAP_SAMPLERATE:
                alsa->cur_rate = *(uint64_t *) value;
                return SR_OK;
-       case HWCAP_LIMIT_SAMPLES:
+       case SR_HWCAP_LIMIT_SAMPLES:
                alsa->limit_samples = *(uint64_t *) value;
                return SR_OK;
        default:
@@ -240,7 +240,7 @@ static int receive_data(int fd, int revents, void *user_data)
                        }
                }
 
-               packet.type = DF_ANALOG;
+               packet.type = SR_DF_ANALOG;
                packet.length = count * sample_size;
                packet.unitsize = sample_size;
                packet.payload = outb;
@@ -250,7 +250,7 @@ static int receive_data(int fd, int revents, void *user_data)
 
        } while (alsa->limit_samples > 0);
 
-       packet.type = DF_END;
+       packet.type = SR_DF_END;
        session_bus(user_data, &packet);
 
        return TRUE;
@@ -333,7 +333,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        alsa->session_id = session_device_id;
        source_add(ufds[0].fd, ufds[0].events, 10, receive_data, sdi);
 
-       packet.type = DF_HEADER;
+       packet.type = SR_DF_HEADER;
        packet.length = sizeof(struct sr_datafeed_header);
        packet.payload = (unsigned char *) &header;
        header.feed_version = 1;
@@ -341,7 +341,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header.samplerate = alsa->cur_rate;
        header.num_analog_probes = NUM_PROBES;
        header.num_logic_probes = 0;
-       header.protocol_id = PROTO_RAW;
+       header.protocol_id = SR_PROTO_RAW;
        session_bus(session_device_id, &packet);
        free(ufds);
 
index f085c85ce0ce776cfac2c0413a1c79c21fefa9cf..f488cdc50c9e09f3ec9677a0485b4e7ec6efd5c8 100644 (file)
@@ -62,12 +62,12 @@ static struct samplerates samplerates = {
 };
 
 static int capabilities[] = {
-       HWCAP_LOGIC_ANALYZER,
-       HWCAP_SAMPLERATE,
-       HWCAP_CAPTURE_RATIO,
-       HWCAP_PROBECONFIG,
+       SR_HWCAP_LOGIC_ANALYZER,
+       SR_HWCAP_SAMPLERATE,
+       SR_HWCAP_CAPTURE_RATIO,
+       SR_HWCAP_PROBECONFIG,
 
-       HWCAP_LIMIT_MSEC,
+       SR_HWCAP_LIMIT_MSEC,
        0,
 };
 
@@ -411,7 +411,7 @@ static int hw_init(char *deviceinfo)
        sigma->use_triggers = 0;
 
        /* Register SIGMA device. */
-       sdi = sr_device_instance_new(0, ST_INITIALIZING,
+       sdi = sr_device_instance_new(0, SR_ST_INITIALIZING,
                        USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
        if (!sdi)
                goto free;
@@ -541,7 +541,7 @@ static int hw_opendev(int device_index)
                return 0;
        }
 
-       sdi->status = ST_ACTIVE;
+       sdi->status = SR_ST_ACTIVE;
 
        return SR_OK;
 }
@@ -672,10 +672,10 @@ static void hw_closedev(int device_index)
        if ((sdi = sr_get_device_instance(device_instances, device_index)))
        {
                sigma = sdi->priv;
-               if (sdi->status == ST_ACTIVE)
+               if (sdi->status == SR_ST_ACTIVE)
                        ftdi_usb_close(&sigma->ftdic);
 
-               sdi->status = ST_INACTIVE;
+               sdi->status = SR_ST_INACTIVE;
        }
 }
 
@@ -709,19 +709,19 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        sigma = sdi->priv;
 
        switch (device_info_id) {
-       case DI_INSTANCE:
+       case SR_DI_INSTANCE:
                info = sdi;
                break;
-       case DI_NUM_PROBES:
+       case SR_DI_NUM_PROBES:
                info = GINT_TO_POINTER(16);
                break;
-       case DI_SAMPLERATES:
+       case SR_DI_SAMPLERATES:
                info = &samplerates;
                break;
-       case DI_TRIGGER_TYPES:
+       case SR_DI_TRIGGER_TYPES:
                info = (char *)TRIGGER_TYPES;
                break;
-       case DI_CUR_SAMPLERATE:
+       case SR_DI_CUR_SAMPLERATE:
                info = &sigma->cur_samplerate;
                break;
        }
@@ -737,7 +737,7 @@ static int hw_get_status(int device_index)
        if (sdi)
                return sdi->status;
        else
-               return ST_NOT_FOUND;
+               return SR_ST_NOT_FOUND;
 }
 
 static int *hw_get_capabilities(void)
@@ -756,17 +756,17 @@ static int hw_set_configuration(int device_index, int capability, void *value)
 
        sigma = sdi->priv;
 
-       if (capability == HWCAP_SAMPLERATE) {
+       if (capability == SR_HWCAP_SAMPLERATE) {
                ret = set_samplerate(sdi, *(uint64_t*) value);
-       } else if (capability == HWCAP_PROBECONFIG) {
+       } else if (capability == SR_HWCAP_PROBECONFIG) {
                ret = configure_probes(sdi, value);
-       } else if (capability == HWCAP_LIMIT_MSEC) {
+       } else if (capability == SR_HWCAP_LIMIT_MSEC) {
                sigma->limit_msec = *(uint64_t*) value;
                if (sigma->limit_msec > 0)
                        ret = SR_OK;
                else
                        ret = SR_ERR;
-       } else if (capability == HWCAP_CAPTURE_RATIO) {
+       } else if (capability == SR_HWCAP_CAPTURE_RATIO) {
                sigma->capture_ratio = *(uint64_t*) value;
                if (sigma->capture_ratio < 0 || sigma->capture_ratio > 100)
                        ret = SR_ERR;
@@ -871,7 +871,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                while (sent < n) {
                        tosend = MIN(2048, n - sent);
 
-                       packet.type = DF_LOGIC;
+                       packet.type = SR_DF_LOGIC;
                        packet.length = tosend * sizeof(uint16_t);
                        packet.unitsize = 2;
                        packet.payload = samples + sent;
@@ -915,7 +915,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                                                    &sigma->trigger);
 
                        if (tosend > 0) {
-                               packet.type = DF_LOGIC;
+                               packet.type = SR_DF_LOGIC;
                                packet.length = tosend * sizeof(uint16_t);
                                packet.unitsize = 2;
                                packet.payload = samples;
@@ -926,7 +926,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
 
                        /* Only send trigger if explicitly enabled. */
                        if (sigma->use_triggers) {
-                               packet.type = DF_TRIGGER;
+                               packet.type = SR_DF_TRIGGER;
                                packet.length = 0;
                                packet.payload = 0;
                                session_bus(sigma->session_id, &packet);
@@ -937,7 +937,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
                tosend = n - sent;
 
                if (tosend > 0) {
-                       packet.type = DF_LOGIC;
+                       packet.type = SR_DF_LOGIC;
                        packet.length = tosend * sizeof(uint16_t);
                        packet.unitsize = 2;
                        packet.payload = samples + sent;
@@ -986,7 +986,7 @@ static int receive_data(int fd, int revents, void *user_data)
        } else if (sigma->state.state == SIGMA_DOWNLOAD) {
                if (sigma->state.chunks_downloaded >= numchunks) {
                        /* End of samples. */
-                       packet.type = DF_END;
+                       packet.type = SR_DF_END;
                        packet.length = 0;
                        session_bus(sigma->session_id, &packet);
 
@@ -1295,13 +1295,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        sigma->session_id = session_device_id;
 
        /* Send header packet to the session bus. */
-       packet.type = DF_HEADER;
+       packet.type = SR_DF_HEADER;
        packet.length = sizeof(struct sr_datafeed_header);
        packet.payload = &header;
        header.feed_version = 1;
        gettimeofday(&header.starttime, NULL);
        header.samplerate = sigma->cur_samplerate;
-       header.protocol_id = PROTO_RAW;
+       header.protocol_id = SR_PROTO_RAW;
        header.num_logic_probes = sigma->num_probes;
        header.num_analog_probes = 0;
        session_bus(session_device_id, &packet);
index 8bcd7b0907342c16c76254e951ae5de580c4fc5f..03fe2689c6f308d5717d05d1925f7e791a5103fb 100644 (file)
@@ -48,7 +48,7 @@ int opendev2(int device_index, struct sr_device_instance **sdi,
         */
        if (!(err = libusb_open(dev, &((*sdi)->usb->devhdl)))) {
                (*sdi)->usb->address = libusb_get_device_address(dev);
-               (*sdi)->status = ST_ACTIVE;
+               (*sdi)->status = SR_ST_ACTIVE;
                g_message("opened device %d on %d.%d interface %d",
                          (*sdi)->index, (*sdi)->usb->bus,
                          (*sdi)->usb->address, interface);
@@ -78,7 +78,7 @@ int opendev3(struct sr_device_instance **sdi, libusb_device *dev,
            && libusb_get_device_address(dev) == (*sdi)->usb->address) {
                /* Found it. */
                if (!(err = libusb_open(dev, &((*sdi)->usb->devhdl)))) {
-                       (*sdi)->status = ST_ACTIVE;
+                       (*sdi)->status = SR_ST_ACTIVE;
                        g_message("opened device %d on %d.%d interface %d",
                                  (*sdi)->index, (*sdi)->usb->bus,
                                  (*sdi)->usb->address, interface);
index 06722c4fc80b20e31a310b0be4a1041e53f480f0..aac08599b0d85d69379ba82a4a227829219c572b 100644 (file)
@@ -54,11 +54,11 @@ struct databag {
 };
 
 static int capabilities[] = {
-       HWCAP_LOGIC_ANALYZER,
-       HWCAP_PATTERN_MODE,
-       HWCAP_LIMIT_SAMPLES,
-       HWCAP_LIMIT_MSEC,
-       HWCAP_CONTINUOUS
+       SR_HWCAP_LOGIC_ANALYZER,
+       SR_HWCAP_PATTERN_MODE,
+       SR_HWCAP_LIMIT_SAMPLES,
+       SR_HWCAP_LIMIT_MSEC,
+       SR_HWCAP_CONTINUOUS,
 };
 
 static const char *patternmodes[] = {
@@ -96,7 +96,7 @@ static int hw_init(char *deviceinfo)
        /* Avoid compiler warnings. */
        deviceinfo = deviceinfo;
 
-       sdi = sr_device_instance_new(0, ST_ACTIVE, DEMONAME, NULL, NULL);
+       sdi = sr_device_instance_new(0, SR_ST_ACTIVE, DEMONAME, NULL, NULL);
        if (!sdi)
                return 0;
 
@@ -136,16 +136,16 @@ static void *hw_get_device_info(int device_index, int device_info_id)
                return NULL;
 
        switch (device_info_id) {
-       case DI_INSTANCE:
+       case SR_DI_INSTANCE:
                info = sdi;
                break;
-       case DI_NUM_PROBES:
+       case SR_DI_NUM_PROBES:
                info = GINT_TO_POINTER(NUM_PROBES);
                break;
-       case DI_CUR_SAMPLERATE:
+       case SR_DI_CUR_SAMPLERATE:
                info = &cur_samplerate;
                break;
-       case DI_PATTERNMODES:
+       case SR_DI_PATTERNMODES:
                info = &patternmodes;
                break;
        }
@@ -158,7 +158,7 @@ static int hw_get_status(int device_index)
        /* Avoid compiler warnings. */
        device_index = device_index;
 
-       return ST_ACTIVE;
+       return SR_ST_ACTIVE;
 }
 
 static int *hw_get_capabilities(void)
@@ -175,18 +175,18 @@ static int hw_set_configuration(int device_index, int capability, void *value)
        /* Avoid compiler warnings. */
        device_index = device_index;
 
-       if (capability == HWCAP_PROBECONFIG) {
+       if (capability == SR_HWCAP_PROBECONFIG) {
                /* Nothing to do. */
                ret = SR_OK;
-       } else if (capability == HWCAP_LIMIT_SAMPLES) {
+       } else if (capability == SR_HWCAP_LIMIT_SAMPLES) {
                tmp_u64 = value;
                limit_samples = *tmp_u64;
                ret = SR_OK;
-       } else if (capability == HWCAP_LIMIT_MSEC) {
+       } else if (capability == SR_HWCAP_LIMIT_MSEC) {
                tmp_u64 = value;
                limit_msec = *tmp_u64;
                ret = SR_OK;
-       } else if (capability == HWCAP_PATTERN_MODE) {
+       } else if (capability == SR_HWCAP_PATTERN_MODE) {
                stropt = value;
                if (!strcmp(stropt, "random")) {
                        default_genmode = GENMODE_RANDOM;
@@ -295,7 +295,7 @@ static int receive_data(int fd, int revents, void *user_data)
                                        (gchar *)&c, BUFSIZE, &z, NULL);
 
                if (z > 0) {
-                       packet.type = DF_LOGIC;
+                       packet.type = SR_DF_LOGIC;
                        packet.length = z;
                        packet.unitsize = 1;
                        packet.payload = c;
@@ -309,7 +309,7 @@ static int receive_data(int fd, int revents, void *user_data)
                g_io_channel_close(channels[0]);
 
                /* Send last packet. */
-               packet.type = DF_END;
+               packet.type = SR_DF_END;
                session_bus(user_data, &packet);
 
                return FALSE;
@@ -364,13 +364,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        if (!packet || !header)
                return SR_ERR_MALLOC;
 
-       packet->type = DF_HEADER;
+       packet->type = SR_DF_HEADER;
        packet->length = sizeof(struct sr_datafeed_header);
        packet->payload = (unsigned char *)header;
        header->feed_version = 1;
        gettimeofday(&header->starttime, NULL);
        header->samplerate = cur_samplerate;
-       header->protocol_id = PROTO_RAW;
+       header->protocol_id = SR_PROTO_RAW;
        header->num_logic_probes = NUM_PROBES;
        header->num_analog_probes = 0;
        session_bus(session_device_id, packet);
index 924ce7c1c27df04303738268f15d8c826acbfb0e..6c509ff341379233a41bf2d5ee20649fa42e2571 100644 (file)
 #define USB_PRODUCT "f190"
 
 static int capabilities[] = {
-       HWCAP_LOGIC_ANALYZER,
-//     HWCAP_OSCILLOSCOPE,
-//     HWCAP_PAT_GENERATOR,
+       SR_HWCAP_LOGIC_ANALYZER,
+//     SR_HWCAP_OSCILLOSCOPE,
+//     SR_HWCAP_PAT_GENERATOR,
 
-       HWCAP_SAMPLERATE,
-//     HWCAP_CAPTURE_RATIO,
-       HWCAP_LIMIT_SAMPLES,
+       SR_HWCAP_SAMPLERATE,
+//     SR_HWCAP_CAPTURE_RATIO,
+       SR_HWCAP_LIMIT_SAMPLES,
        0,
 };
 
@@ -425,7 +425,7 @@ static int hw_init(char *deviceinfo)
                /* hardware initial state */
                mso->ctlbase = 0;
 
-               sdi = sr_device_instance_new(devcnt, ST_INITIALIZING,
+               sdi = sr_device_instance_new(devcnt, SR_ST_INITIALIZING,
                        manufacturer, product, hwrev);
                if (!sdi) {
                        g_warning("Unable to create device instance for %s",
@@ -493,7 +493,7 @@ static int hw_opendev(int device_index)
        if (ret != SR_OK)
                return ret;
 
-       sdi->status = ST_ACTIVE;
+       sdi->status = SR_ST_ACTIVE;
 
        /* FIXME: discard serial buffer */
 
@@ -525,7 +525,7 @@ static void hw_closedev(int device_index)
        if (sdi->serial->fd != -1) {
                serial_close(sdi->serial->fd);
                sdi->serial->fd = -1;
-               sdi->status = ST_INACTIVE;
+               sdi->status = SR_ST_INACTIVE;
        }
 }
 
@@ -540,19 +540,19 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        mso = sdi->priv;
 
        switch (device_info_id) {
-       case DI_INSTANCE:
+       case SR_DI_INSTANCE:
                info = sdi;
                break;
-       case DI_NUM_PROBES: /* FIXME: How to report analog probe? */
+       case SR_DI_NUM_PROBES: /* FIXME: How to report analog probe? */
                info = GINT_TO_POINTER(8);
                break;
-       case DI_SAMPLERATES:
+       case SR_DI_SAMPLERATES:
                info = &samplerates;
                break;
-       case DI_TRIGGER_TYPES:
+       case SR_DI_TRIGGER_TYPES:
                info = "01"; /* FIXME */
                break;
-       case DI_CUR_SAMPLERATE:
+       case SR_DI_CUR_SAMPLERATE:
                info = &mso->cur_rate;
                break;
        }
@@ -564,7 +564,7 @@ static int hw_get_status(int device_index)
        struct sr_device_instance *sdi;
 
        if (!(sdi = sr_get_device_instance(device_instances, device_index)))
-               return ST_NOT_FOUND;
+               return SR_ST_NOT_FOUND;
 
        return sdi->status;
 }
@@ -582,10 +582,10 @@ static int hw_set_configuration(int device_index, int capability, void *value)
                return SR_ERR;
 
        switch (capability) {
-       case HWCAP_SAMPLERATE:
+       case SR_HWCAP_SAMPLERATE:
                return mso_configure_rate(sdi, *(uint64_t *) value);
-       case HWCAP_PROBECONFIG:
-       case HWCAP_LIMIT_SAMPLES:
+       case SR_HWCAP_PROBECONFIG:
+       case SR_HWCAP_LIMIT_SAMPLES:
        default:
                return SR_OK; /* FIXME */
        }
@@ -645,20 +645,20 @@ static int receive_data(int fd, int revents, void *user_data)
                        ((mso->buffer[i * 3 + 2] & 0x3f) << 2);
        }
 
-       packet.type = DF_LOGIC;
+       packet.type = SR_DF_LOGIC;
        packet.length = 1024;
        packet.unitsize = 1;
        packet.payload = logic_out;
        session_bus(mso->session_id, &packet);
 
 
-       packet.type = DF_ANALOG;
+       packet.type = SR_DF_ANALOG;
        packet.length = 1024;
        packet.unitsize = sizeof(double);
        packet.payload = analog_out;
        session_bus(mso->session_id, &packet);
 
-       packet.type = DF_END;
+       packet.type = SR_DF_END;
        session_bus(mso->session_id, &packet);
 
        return TRUE;
@@ -725,7 +725,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        mso->session_id = session_device_id;
        source_add(sdi->serial->fd, G_IO_IN, -1, receive_data, sdi);
 
-       packet.type = DF_HEADER;
+       packet.type = SR_DF_HEADER;
        packet.length = sizeof(struct sr_datafeed_header);
        packet.payload = (unsigned char *) &header;
        header.feed_version = 1;
@@ -733,7 +733,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header.samplerate = mso->cur_rate;
        header.num_analog_probes = 1;
        header.num_logic_probes = 8;
-       header.protocol_id = PROTO_RAW;
+       header.protocol_id = SR_PROTO_RAW;
        session_bus(session_device_id, &packet);
 
        return ret;
@@ -746,7 +746,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
 
        device_index = device_index;
 
-       packet.type = DF_END;
+       packet.type = SR_DF_END;
        session_bus(session_device_id, &packet);
 }
 
index cf9f025aecd86660be901fafe304bf7ac18b7619..9ebd6b094c18d96088155ebf08fe021f801d503d 100644 (file)
 #define FLAG_RLE                   0x0100
 
 static int capabilities[] = {
-       HWCAP_LOGIC_ANALYZER,
-       HWCAP_SAMPLERATE,
-       HWCAP_CAPTURE_RATIO,
-       HWCAP_LIMIT_SAMPLES,
+       SR_HWCAP_LOGIC_ANALYZER,
+       SR_HWCAP_SAMPLERATE,
+       SR_HWCAP_CAPTURE_RATIO,
+       SR_HWCAP_LIMIT_SAMPLES,
        0,
 };
 
@@ -287,12 +287,12 @@ static int hw_init(char *deviceinfo)
                                    || !strncmp(buf, "1ALS", 4)) {
                                        if (!strncmp(buf, "1SLO", 4))
                                                sdi = sr_device_instance_new
-                                                   (final_devcnt, ST_INACTIVE,
+                                                   (final_devcnt, SR_ST_INACTIVE,
                                                     "Openbench",
                                                     "Logic Sniffer", "v1.0");
                                        else
                                                sdi = sr_device_instance_new
-                                                   (final_devcnt, ST_INACTIVE,
+                                                   (final_devcnt, SR_ST_INACTIVE,
                                                     "Openbench", "Logic Sniffer",
                                                     "v1.0");
                                        sdi->serial = sr_serial_device_instance_new
@@ -335,7 +335,7 @@ static int hw_opendev(int device_index)
        if (sdi->serial->fd == -1)
                return SR_ERR;
 
-       sdi->status = ST_ACTIVE;
+       sdi->status = SR_ST_ACTIVE;
 
        return SR_OK;
 }
@@ -350,7 +350,7 @@ static void hw_closedev(int device_index)
        if (sdi->serial->fd != -1) {
                serial_close(sdi->serial->fd);
                sdi->serial->fd = -1;
-               sdi->status = ST_INACTIVE;
+               sdi->status = SR_ST_INACTIVE;
        }
 }
 
@@ -380,19 +380,19 @@ static void *hw_get_device_info(int device_index, int device_info_id)
 
        info = NULL;
        switch (device_info_id) {
-       case DI_INSTANCE:
+       case SR_DI_INSTANCE:
                info = sdi;
                break;
-       case DI_NUM_PROBES:
+       case SR_DI_NUM_PROBES:
                info = GINT_TO_POINTER(NUM_PROBES);
                break;
-       case DI_SAMPLERATES:
+       case SR_DI_SAMPLERATES:
                info = &samplerates;
                break;
-       case DI_TRIGGER_TYPES:
+       case SR_DI_TRIGGER_TYPES:
                info = (char *)TRIGGER_TYPES;
                break;
-       case DI_CUR_SAMPLERATE:
+       case SR_DI_CUR_SAMPLERATE:
                info = &cur_samplerate;
                break;
        }
@@ -405,7 +405,7 @@ static int hw_get_status(int device_index)
        struct sr_device_instance *sdi;
 
        if (!(sdi = sr_get_device_instance(device_instances, device_index)))
-               return ST_NOT_FOUND;
+               return SR_ST_NOT_FOUND;
 
        return sdi->status;
 }
@@ -450,18 +450,18 @@ static int hw_set_configuration(int device_index, int capability, void *value)
        if (!(sdi = sr_get_device_instance(device_instances, device_index)))
                return SR_ERR;
 
-       if (sdi->status != ST_ACTIVE)
+       if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR;
 
        switch (capability) {
-       case HWCAP_SAMPLERATE:
+       case SR_HWCAP_SAMPLERATE:
                tmp_u64 = value;
                ret = set_configuration_samplerate(sdi, *tmp_u64);
                break;
-       case HWCAP_PROBECONFIG:
+       case SR_HWCAP_PROBECONFIG:
                ret = configure_probes((GSList *) value);
                break;
-       case HWCAP_LIMIT_SAMPLES:
+       case SR_HWCAP_LIMIT_SAMPLES:
                tmp_u64 = value;
                if (*tmp_u64 < MIN_NUM_SAMPLES)
                        return SR_ERR;
@@ -469,7 +469,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
                g_message("ols: sample limit %" PRIu64, limit_samples);
                ret = SR_OK;
                break;
-       case HWCAP_CAPTURE_RATIO:
+       case SR_HWCAP_CAPTURE_RATIO:
                tmp_u64 = value;
                capture_ratio = *tmp_u64;
                if (capture_ratio < 0 || capture_ratio > 100) {
@@ -612,24 +612,24 @@ static int receive_data(int fd, int revents, void *user_data)
                         */
                        if (trigger_at > 0) {
                                /* there are pre-trigger samples, send those first */
-                               packet.type = DF_LOGIC;
+                               packet.type = SR_DF_LOGIC;
                                packet.length = trigger_at * 4;
                                packet.unitsize = 4;
                                packet.payload = raw_sample_buf;
                                session_bus(user_data, &packet);
                        }
 
-                       packet.type = DF_TRIGGER;
+                       packet.type = SR_DF_TRIGGER;
                        packet.length = 0;
                        session_bus(user_data, &packet);
 
-                       packet.type = DF_LOGIC;
+                       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);
                } else {
-                       packet.type = DF_LOGIC;
+                       packet.type = SR_DF_LOGIC;
                        packet.length = limit_samples * 4;
                        packet.unitsize = 4;
                        packet.payload = raw_sample_buf;
@@ -639,7 +639,7 @@ static int receive_data(int fd, int revents, void *user_data)
 
                serial_flush(fd);
                serial_close(fd);
-               packet.type = DF_END;
+               packet.type = SR_DF_END;
                packet.length = 0;
                session_bus(user_data, &packet);
        }
@@ -661,7 +661,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        if (!(sdi = sr_get_device_instance(device_instances, device_index)))
                return SR_ERR;
 
-       if (sdi->status != ST_ACTIVE)
+       if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR;
 
        readcount = limit_samples / 4;
@@ -761,13 +761,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        header = g_malloc(sizeof(struct sr_datafeed_header));
        if (!packet || !header)
                return SR_ERR;
-       packet->type = DF_HEADER;
+       packet->type = SR_DF_HEADER;
        packet->length = sizeof(struct sr_datafeed_header);
        packet->payload = (unsigned char *)header;
        header->feed_version = 1;
        gettimeofday(&header->starttime, NULL);
        header->samplerate = cur_samplerate;
-       header->protocol_id = PROTO_RAW;
+       header->protocol_id = SR_PROTO_RAW;
        header->num_logic_probes = NUM_PROBES;
        header->num_analog_probes = 0;
        session_bus(session_device_id, packet);
@@ -784,7 +784,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
        /* Avoid compiler warnings. */
        device_index = device_index;
 
-       packet.type = DF_END;
+       packet.type = SR_DF_END;
        packet.length = 0;
        session_bus(session_device_id, &packet);
 }
index 8a74332e615266ad40abba5a83b9afe4bbb82167..b66fd30d9743387c0cb80c4388daedb985906af1 100644 (file)
 
 /* There is only one model Saleae Logic, and this is what it supports: */
 static int capabilities[] = {
-       HWCAP_LOGIC_ANALYZER,
-       HWCAP_SAMPLERATE,
+       SR_HWCAP_LOGIC_ANALYZER,
+       SR_HWCAP_SAMPLERATE,
 
        /* These are really implemented in the driver, not the hardware. */
-       HWCAP_LIMIT_SAMPLES,
-       HWCAP_CONTINUOUS,
+       SR_HWCAP_LIMIT_SAMPLES,
+       SR_HWCAP_CONTINUOUS,
        0,
 };
 
@@ -177,7 +177,7 @@ struct sr_device_instance *sl_open_device(int device_index)
                return NULL;
 
        libusb_get_device_list(usb_context, &devlist);
-       if (sdi->status == ST_INITIALIZING) {
+       if (sdi->status == SR_ST_INITIALIZING) {
                /*
                 * This device was renumerating last time we touched it.
                 * opendev() guarantees we've waited long enough for it to
@@ -191,7 +191,7 @@ struct sr_device_instance *sl_open_device(int device_index)
                                       &skip, USB_VENDOR, USB_PRODUCT,
                                       USB_INTERFACE);
                }
-       } else if (sdi->status == ST_INACTIVE) {
+       } else if (sdi->status == SR_ST_INACTIVE) {
                /*
                 * This device is fully enumerated, so we need to find this
                 * device by vendor, product, bus and address.
@@ -203,12 +203,12 @@ struct sr_device_instance *sl_open_device(int device_index)
                                       USB_PRODUCT, USB_INTERFACE);
                }
        } else {
-               /* Status must be ST_ACTIVE, i.e. already in use... */
+               /* Status must be SR_ST_ACTIVE, i.e. already in use... */
                sdi = NULL;
        }
        libusb_free_device_list(devlist, 1);
 
-       if (sdi && sdi->status != ST_ACTIVE)
+       if (sdi && sdi->status != SR_ST_ACTIVE)
                sdi = NULL;
 
        return sdi;
@@ -238,7 +238,7 @@ static void close_device(struct sr_device_instance *sdi)
        libusb_release_interface(sdi->usb->devhdl, USB_INTERFACE);
        libusb_close(sdi->usb->devhdl);
        sdi->usb->devhdl = NULL;
-       sdi->status = ST_INACTIVE;
+       sdi->status = SR_ST_INACTIVE;
 }
 
 static int configure_probes(GSList *probes)
@@ -319,7 +319,7 @@ static int hw_init(char *deviceinfo)
                if (des.idVendor != USB_VENDOR || des.idProduct != USB_PRODUCT)
                        continue; /* Not a Saleae Logic... */
 
-               sdi = sr_device_instance_new(devcnt, ST_INITIALIZING,
+               sdi = sr_device_instance_new(devcnt, SR_ST_INITIALIZING,
                        USB_VENDOR_NAME, USB_MODEL_NAME, USB_MODEL_VERSION);
                if (!sdi)
                        return 0;
@@ -386,7 +386,7 @@ static int hw_opendev(int device_index)
 
        if (cur_samplerate == 0) {
                /* Samplerate hasn't been set; default to the slowest one. */
-               if (hw_set_configuration(device_index, HWCAP_SAMPLERATE,
+               if (hw_set_configuration(device_index, SR_HWCAP_SAMPLERATE,
                    &supported_samplerates[0]) == SR_ERR)
                        return SR_ERR;
        }
@@ -430,19 +430,19 @@ static void *hw_get_device_info(int device_index, int device_info_id)
                return NULL;
 
        switch (device_info_id) {
-       case DI_INSTANCE:
+       case SR_DI_INSTANCE:
                info = sdi;
                break;
-       case DI_NUM_PROBES:
+       case SR_DI_NUM_PROBES:
                info = GINT_TO_POINTER(NUM_PROBES);
                break;
-       case DI_SAMPLERATES:
+       case SR_DI_SAMPLERATES:
                info = &samplerates;
                break;
-       case DI_TRIGGER_TYPES:
+       case SR_DI_TRIGGER_TYPES:
                info = TRIGGER_TYPES;
                break;
-       case DI_CUR_SAMPLERATE:
+       case SR_DI_CUR_SAMPLERATE:
                info = &cur_samplerate;
                break;
        }
@@ -458,7 +458,7 @@ static int hw_get_status(int device_index)
        if (sdi)
                return sdi->status;
        else
-               return ST_NOT_FOUND;
+               return SR_ST_NOT_FOUND;
 }
 
 static int *hw_get_capabilities(void)
@@ -506,12 +506,12 @@ static int hw_set_configuration(int device_index, int capability, void *value)
        if (!(sdi = sr_get_device_instance(device_instances, device_index)))
                return SR_ERR;
 
-       if (capability == HWCAP_SAMPLERATE) {
+       if (capability == SR_HWCAP_SAMPLERATE) {
                tmp_u64 = value;
                ret = set_configuration_samplerate(sdi, *tmp_u64);
-       } else if (capability == HWCAP_PROBECONFIG) {
+       } else if (capability == SR_HWCAP_PROBECONFIG) {
                ret = configure_probes((GSList *) value);
-       } else if (capability == HWCAP_LIMIT_SAMPLES) {
+       } else if (capability == SR_HWCAP_LIMIT_SAMPLES) {
                tmp_u64 = value;
                limit_samples = *tmp_u64;
                ret = SR_OK;
@@ -607,7 +607,7 @@ void receive_transfer(struct libusb_transfer *transfer)
                                         * TODO: Send pre-trigger buffer to session bus.
                                         * Tell the frontend we hit the trigger here.
                                         */
-                                       packet.type = DF_TRIGGER;
+                                       packet.type = SR_DF_TRIGGER;
                                        packet.length = 0;
                                        session_bus(user_data, &packet);
 
@@ -615,7 +615,7 @@ void receive_transfer(struct libusb_transfer *transfer)
                                         * Send the samples that triggered it, since we're
                                         * skipping past them.
                                         */
-                                       packet.type = DF_LOGIC;
+                                       packet.type = SR_DF_LOGIC;
                                        packet.length = trigger_stage;
                                        packet.unitsize = 1;
                                        packet.payload = trigger_buffer;
@@ -648,7 +648,7 @@ void receive_transfer(struct libusb_transfer *transfer)
 
        if (trigger_stage == TRIGGER_FIRED) {
                /* Send the incoming transfer to the session bus. */
-               packet.type = DF_LOGIC;
+               packet.type = SR_DF_LOGIC;
                packet.length = cur_buflen - trigger_offset;
                packet.unitsize = 1;
                packet.payload = cur_buf + trigger_offset;
@@ -708,13 +708,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
                           NULL);
        free(lupfd);
 
-       packet->type = DF_HEADER;
+       packet->type = SR_DF_HEADER;
        packet->length = sizeof(struct sr_datafeed_header);
        packet->payload = (unsigned char *)header;
        header->feed_version = 1;
        gettimeofday(&header->starttime, NULL);
        header->samplerate = cur_samplerate;
-       header->protocol_id = PROTO_RAW;
+       header->protocol_id = SR_PROTO_RAW;
        header->num_logic_probes = NUM_PROBES;
        header->num_analog_probes = 0;
        session_bus(session_device_id, packet);
@@ -732,7 +732,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
        /* Avoid compiler warnings. */
        device_index = device_index;
 
-       packet.type = DF_END;
+       packet.type = SR_DF_END;
        session_bus(session_device_id, &packet);
 
        receive_transfer(NULL);
index 8399292cb9f06be7794798a5b864d7fb2328b562..0c3d25bc803ca29e2dc7d157423f237460c043f7 100644 (file)
@@ -62,13 +62,13 @@ model_t zeroplus_models[] = {
 };
 
 static int capabilities[] = {
-       HWCAP_LOGIC_ANALYZER,
-       HWCAP_SAMPLERATE,
-       HWCAP_PROBECONFIG,
-       HWCAP_CAPTURE_RATIO,
+       SR_HWCAP_LOGIC_ANALYZER,
+       SR_HWCAP_SAMPLERATE,
+       SR_HWCAP_PROBECONFIG,
+       SR_HWCAP_CAPTURE_RATIO,
 
        /* These are really implemented in the driver, not the hardware. */
-       HWCAP_LIMIT_SAMPLES,
+       SR_HWCAP_LIMIT_SAMPLES,
        0,
 };
 
@@ -176,7 +176,7 @@ static int opendev4(struct sr_device_instance **sdi, libusb_device *dev,
 
                /* Found it. */
                if (!(err = libusb_open(dev, &((*sdi)->usb->devhdl)))) {
-                       (*sdi)->status = ST_ACTIVE;
+                       (*sdi)->status = SR_ST_ACTIVE;
                        g_message("opened device %d on %d.%d interface %d",
                             (*sdi)->index, (*sdi)->usb->bus,
                             (*sdi)->usb->address, USB_INTERFACE);
@@ -200,7 +200,7 @@ struct sr_device_instance *zp_open_device(int device_index)
                return NULL;
 
        libusb_get_device_list(usb_context, &devlist);
-       if (sdi->status == ST_INACTIVE) {
+       if (sdi->status == SR_ST_INACTIVE) {
                /* Find the device by vendor, product, bus and address. */
                libusb_get_device_list(usb_context, &devlist);
                for (i = 0; devlist[i]; i++) {
@@ -208,12 +208,12 @@ struct sr_device_instance *zp_open_device(int device_index)
                        err = opendev4(&sdi, devlist[i], &des);
                }
        } else {
-               /* Status must be ST_ACTIVE, i.e. already in use... */
+               /* Status must be SR_ST_ACTIVE, i.e. already in use... */
                sdi = NULL;
        }
        libusb_free_device_list(devlist, 1);
 
-       if (sdi && sdi->status != ST_ACTIVE)
+       if (sdi && sdi->status != SR_ST_ACTIVE)
                sdi = NULL;
 
        return sdi;
@@ -229,7 +229,7 @@ static void close_device(struct sr_device_instance *sdi)
        libusb_release_interface(sdi->usb->devhdl, USB_INTERFACE);
        libusb_close(sdi->usb->devhdl);
        sdi->usb->devhdl = NULL;
-       sdi->status = ST_INACTIVE;
+       sdi->status = SR_ST_INACTIVE;
 }
 
 static int configure_probes(GSList *probes)
@@ -306,7 +306,7 @@ static int hw_init(char *deviceinfo)
                         * the zeroplus range?
                         */
                        sdi = sr_device_instance_new(devcnt,
-                                       ST_INACTIVE, USB_VENDOR_NAME,
+                                       SR_ST_INACTIVE, USB_VENDOR_NAME,
                                        USB_MODEL_NAME, USB_MODEL_VERSION);
                        if (!sdi)
                                return 0;
@@ -360,7 +360,7 @@ static int hw_opendev(int device_index)
 
        if (cur_samplerate == 0) {
                /* Samplerate hasn't been set. Default to the slowest one. */
-               if (hw_set_configuration(device_index, HWCAP_SAMPLERATE,
+               if (hw_set_configuration(device_index, SR_HWCAP_SAMPLERATE,
                     &samplerates.low) == SR_ERR)
                        return SR_ERR;
        }
@@ -404,19 +404,19 @@ static void *hw_get_device_info(int device_index, int device_info_id)
                return NULL;
 
        switch (device_info_id) {
-       case DI_INSTANCE:
+       case SR_DI_INSTANCE:
                info = sdi;
                break;
-       case DI_NUM_PROBES:
+       case SR_DI_NUM_PROBES:
                info = GINT_TO_POINTER(num_channels);
                break;
-       case DI_SAMPLERATES:
+       case SR_DI_SAMPLERATES:
                info = &samplerates;
                break;
-       case DI_TRIGGER_TYPES:
+       case SR_DI_TRIGGER_TYPES:
                info = TRIGGER_TYPES;
                break;
-       case DI_CUR_SAMPLERATE:
+       case SR_DI_CUR_SAMPLERATE:
                info = &cur_samplerate;
                break;
        }
@@ -432,7 +432,7 @@ static int hw_get_status(int device_index)
        if (sdi)
                return sdi->status;
        else
-               return ST_NOT_FOUND;
+               return SR_ST_NOT_FOUND;
 }
 
 static int *hw_get_capabilities(void)
@@ -465,12 +465,12 @@ static int hw_set_configuration(int device_index, int capability, void *value)
                return SR_ERR;
 
        switch (capability) {
-       case HWCAP_SAMPLERATE:
+       case SR_HWCAP_SAMPLERATE:
                tmp_u64 = value;
                return set_configuration_samplerate(*tmp_u64);
-       case HWCAP_PROBECONFIG:
+       case SR_HWCAP_PROBECONFIG:
                return configure_probes((GSList *) value);
-       case HWCAP_LIMIT_SAMPLES:
+       case SR_HWCAP_LIMIT_SAMPLES:
                tmp_u64 = value;
                limit_samples = *tmp_u64;
                return SR_OK;
@@ -505,13 +505,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        g_message("Trigger address = 0x%x",
                  analyzer_get_trigger_address(sdi->usb->devhdl));
 
-       packet.type = DF_HEADER;
+       packet.type = SR_DF_HEADER;
        packet.length = sizeof(struct sr_datafeed_header);
        packet.payload = (unsigned char *)&header;
        header.feed_version = 1;
        gettimeofday(&header.starttime, NULL);
        header.samplerate = cur_samplerate;
-       header.protocol_id = PROTO_RAW;
+       header.protocol_id = SR_PROTO_RAW;
        header.num_logic_probes = num_channels;
        header.num_analog_probes = 0;
        session_bus(session_device_id, &packet);
@@ -529,7 +529,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
                          PACKET_SIZE, res);
 #endif
 
-               packet.type = DF_LOGIC;
+               packet.type = SR_DF_LOGIC;
                packet.length = PACKET_SIZE;
                packet.unitsize = 4;
                packet.payload = buf;
@@ -538,7 +538,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
        analyzer_read_stop(sdi->usb->devhdl);
        g_free(buf);
 
-       packet.type = DF_END;
+       packet.type = SR_DF_END;
        session_bus(session_device_id, &packet);
 
        return SR_OK;
@@ -550,7 +550,7 @@ static void hw_stop_acquisition(int device_index, gpointer session_device_id)
        struct sr_datafeed_packet packet;
        struct sr_device_instance *sdi;
 
-       packet.type = DF_END;
+       packet.type = SR_DF_END;
        session_bus(session_device_id, &packet);
 
        if (!(sdi = sr_get_device_instance(device_instances, device_index)))
index 36f22016a7327d6a06b5bb9e16d3740520a5bcff..31fed10c8583fe77e255c8f38f2813477ca61112 100644 (file)
@@ -34,9 +34,9 @@ GSList *plugins;
  * options.
  */
 struct hwcap_option hwcap_options[] = {
-       {HWCAP_SAMPLERATE, T_UINT64, "Sample rate", "samplerate"},
-       {HWCAP_CAPTURE_RATIO, T_UINT64, "Pre-trigger capture ratio", "captureratio"},
-       {HWCAP_PATTERN_MODE, T_CHAR, "Pattern generator mode", "patternmode"},
+       {SR_HWCAP_SAMPLERATE, SR_T_UINT64, "Sample rate", "samplerate"},
+       {SR_HWCAP_CAPTURE_RATIO, SR_T_UINT64, "Pre-trigger capture ratio", "captureratio"},
+       {SR_HWCAP_PATTERN_MODE, SR_T_CHAR, "Pattern generator mode", "patternmode"},
        {0, 0, NULL, NULL},
 };
 
@@ -138,10 +138,10 @@ struct sr_device_instance *sr_get_device_instance(GSList *device_instances,
 void sr_device_instance_free(struct sr_device_instance *sdi)
 {
        switch (sdi->instance_type) {
-       case USB_INSTANCE:
+       case SR_USB_INSTANCE:
                sr_usb_device_instance_free(sdi->usb);
                break;
-       case SERIAL_INSTANCE:
+       case SR_SERIAL_INSTANCE:
                sr_serial_device_instance_free(sdi->serial);
                break;
        default:
index 8160c7c1046d919037c3f936d31633bdab3b475a..1da4e7014d3896380e14f212d46965eaf73ea2a1 100644 (file)
@@ -72,16 +72,16 @@ static int loadfile(struct sr_input *in, const char *filename)
        header.feed_version = 1;
        header.num_logic_probes = num_probes;
        header.num_analog_probes = 0;
-       header.protocol_id = PROTO_RAW;
+       header.protocol_id = SR_PROTO_RAW;
        header.samplerate = 0;
        gettimeofday(&header.starttime, NULL);
-       packet.type = DF_HEADER;
+       packet.type = SR_DF_HEADER;
        packet.length = sizeof(struct sr_datafeed_header);
        packet.payload = &header;
        session_bus(in->vdevice, &packet);
 
        /* chop up the input file into chunks and feed it into the session bus */
-       packet.type = DF_LOGIC;
+       packet.type = SR_DF_LOGIC;
        packet.unitsize = (num_probes + 7) / 8;
        packet.payload = buffer;
        while ((size = read(fd, buffer, CHUNKSIZE)) > 0) {
@@ -91,7 +91,7 @@ static int loadfile(struct sr_input *in, const char *filename)
        close(fd);
 
        /* end of stream */
-       packet.type = DF_END;
+       packet.type = SR_DF_END;
        packet.length = 0;
        session_bus(in->vdevice, &packet);
 
index 46eca8d124af2eeb6436e19bf2f6ff27ba9d4a14..40d5218105db54e3db890bcc16d198fa4cf99ec6 100644 (file)
@@ -135,7 +135,7 @@ static int init(struct sr_output *o, int default_spl, enum outputmode mode)
        num_probes = g_slist_length(o->device->probes);
        if (o->device->plugin) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, DI_CUR_SAMPLERATE));
+                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sr_samplerate_string(samplerate))) {
                        free(ctx->header);
                        free(ctx);
@@ -172,12 +172,12 @@ static int event(struct sr_output *o, int event_type, char **data_out,
 
        ctx = o->internal;
        switch (event_type) {
-       case DF_TRIGGER:
+       case SR_DF_TRIGGER:
                ctx->mark_trigger = ctx->spl_cnt;
                *data_out = NULL;
                *length_out = 0;
                break;
-       case DF_END:
+       case SR_DF_END:
                outsize = ctx->num_enabled_probes
                                * (ctx->samples_per_line + 20) + 512;
                if (!(outbuf = calloc(1, outsize)))
@@ -441,7 +441,7 @@ static int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in,
 struct sr_output_format output_analog_bits = {
        "analog_bits",
        "Bits (takes argument, default 64)",
-       DF_ANALOG,
+       SR_DF_ANALOG,
        init_bits,
        data_bits,
        event,
@@ -450,7 +450,7 @@ struct sr_output_format output_analog_bits = {
 struct sr_output_format output_analog_hex = {
        "analog_hex",
        "Hexadecimal (takes argument, default 192)",
-       DF_ANALOG,
+       SR_DF_ANALOG,
        init_hex,
        data_hex,
        event,
@@ -459,7 +459,7 @@ struct sr_output_format output_analog_hex = {
 struct sr_output_format output_analog_ascii = {
        "analog_ascii",
        "ASCII (takes argument, default 74)",
-       DF_ANALOG,
+       SR_DF_ANALOG,
        init_ascii,
        data_ascii,
        event,
index 5f62dfe9aa39cd0a6a265d630bd65147dd640dba..2fee7fff41e34ecc120fa0d767378bcd88b5540e 100644 (file)
@@ -46,7 +46,7 @@ static int data(struct sr_output *o, char *data_in, uint64_t length_in,
 struct sr_output_format output_binary = {
        "binary",
        "Raw binary",
-       DF_LOGIC,
+       SR_DF_LOGIC,
        NULL,
        data,
        NULL,
index 356f61aa2cabcabd2fb4d9234f2abe0f8e916068..2945f949723c028f2cc2229a070eacf57bb2281f 100644 (file)
@@ -81,7 +81,7 @@ static int init(struct sr_output *o)
        comment[0] = '\0';
        if (o->device->plugin) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, DI_CUR_SAMPLERATE));
+                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
                        free(ctx->header);
                        free(ctx);
@@ -126,10 +126,10 @@ static int event(struct sr_output *o, int event_type, char **data_out,
 
        ctx = o->internal;
        switch (event_type) {
-       case DF_TRIGGER:
+       case SR_DF_TRIGGER:
                /* TODO: can a trigger mark be in a gnuplot data file? */
                break;
-       case DF_END:
+       case SR_DF_END:
                free(o->internal);
                o->internal = NULL;
                break;
@@ -228,7 +228,7 @@ static int analog_init(struct sr_output *o)
        comment[0] = '\0';
        if (o->device->plugin) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, DI_CUR_SAMPLERATE));
+                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
                        free(ctx->header);
                        free(ctx);
@@ -329,7 +329,7 @@ static int analog_data(struct sr_output *o, char *data_in, uint64_t length_in,
 struct sr_output_format output_gnuplot = {
        "gnuplot",
        "Gnuplot",
-       DF_LOGIC,
+       SR_DF_LOGIC,
        init,
        data,
        event,
@@ -338,7 +338,7 @@ struct sr_output_format output_gnuplot = {
 struct sr_output_format output_analog_gnuplot = {
        "analog_gnuplot",
        "Gnuplot analog",
-       DF_ANALOG,
+       SR_DF_ANALOG,
        analog_init,
        analog_data,
        event,
index bdd7d786266972a33dc9fd9b4806239dc430e549..6c4876d47b80fed80ab32a2e78e85dbdb70f9978 100644 (file)
@@ -104,7 +104,7 @@ static int init(struct sr_output *o)
 
        if (o->device->plugin) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, DI_CUR_SAMPLERATE));
+                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(frequency_s = sr_samplerate_string(samplerate))) {
                        free(ctx->header);
                        free(ctx);
@@ -162,10 +162,10 @@ static int event(struct sr_output *o, int event_type, char **data_out,
 
        ctx = o->internal;
        switch (event_type) {
-       case DF_TRIGGER:
+       case SR_DF_TRIGGER:
                /* TODO */
                break;
-       case DF_END:
+       case SR_DF_END:
                free(o->internal);
                o->internal = NULL;
                break;
@@ -221,7 +221,7 @@ static int data(struct sr_output *o, char *data_in, uint64_t length_in,
 struct sr_output_format output_ols = {
        "ols",
        "OpenBench Logic Sniffer",
-       DF_LOGIC,
+       SR_DF_LOGIC,
        init,
        data,
        event,
index 67e4d902ce9fd1a7e99952b0ed4ac530907475c7..a58b87aa919b80cb3ba1b6b457ffb12979b58464 100644 (file)
@@ -40,7 +40,7 @@ static int event(struct sr_output *o, int event_type, char **data_out,
 struct sr_output_format output_foo = {
        "foo",
        "The foo format",
-       DF_LOGIC,
+       SR_DF_LOGIC,
        init,
        data,
        event,
index 958fbd7c288ba07a3a1375432cfa42de45042b58..c6d1655d1409e10a0be38503458b248473b0bea2 100644 (file)
@@ -93,7 +93,7 @@ static int init(struct sr_output *o)
 
        if (o->device->plugin) {
                ctx->samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, DI_CUR_SAMPLERATE));
+                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {
                        g_string_free(ctx->header, TRUE);
                        free(ctx);
@@ -149,7 +149,7 @@ static int event(struct sr_output *o, int event_type, char **data_out,
 
        ctx = o->internal;
        switch (event_type) {
-       case DF_END:
+       case SR_DF_END:
                outbuf = strdup("$dumpoff\n$end\n");
                *data_out = outbuf;
                *length_out = strlen(outbuf);
@@ -225,7 +225,7 @@ static int data(struct sr_output *o, char *data_in, uint64_t length_in,
 struct sr_output_format output_vcd = {
        "vcd",
        "Value Change Dump (VCD)",
-       DF_LOGIC,
+       SR_DF_LOGIC,
        init,
        data,
        event,
index e4e3e0cd5542598b4afc62e46516131a9ff42b19..3e7f2e3551215a5981ee72aa75b7d39c4a56ccf1 100644 (file)
@@ -118,7 +118,7 @@ int data_ascii(struct sr_output *o, char *data_in, uint64_t length_in,
 struct sr_output_format output_text_ascii = {
        "ascii",
        "ASCII (takes argument, default 74)",
-       DF_LOGIC,
+       SR_DF_LOGIC,
        init_ascii,
        data_ascii,
        event,
index b9b1347798c44656c5a1b5be59a2e03dd9557dc0..755a463add7674fac33293857ebe13179c60c652 100644 (file)
@@ -105,7 +105,7 @@ int data_bits(struct sr_output *o, char *data_in, uint64_t length_in,
 struct sr_output_format output_text_bits = {
        "bits",
        "Bits (takes argument, default 64)",
-       DF_LOGIC,
+       SR_DF_LOGIC,
        init_bits,
        data_bits,
        event,
index cd769aa53c94bc11705c84a60895755a881e1d4e..e63feb143e4f999467d8f6d85b69a87e86f86a94 100644 (file)
@@ -94,7 +94,7 @@ int data_hex(struct sr_output *o, char *data_in, uint64_t length_in,
 struct sr_output_format output_text_hex = {
        "hex",
        "Hexadecimal (takes argument, default 192)",
-       DF_LOGIC,
+       SR_DF_LOGIC,
        init_hex,
        data_hex,
        event,
index ea7f3ec3378b74f925d81d993cfc103d4c5d1f82..ded3adf17647f4cc1a4c15965a4090997282683f 100644 (file)
@@ -109,7 +109,7 @@ int init(struct sr_output *o, int default_spl, enum outputmode mode)
        num_probes = g_slist_length(o->device->probes);
        if (o->device->plugin) {
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
-                               o->device->plugin_index, DI_CUR_SAMPLERATE));
+                               o->device->plugin_index, SR_DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sr_samplerate_string(samplerate))) {
                        free(ctx->header);
                        free(ctx);
@@ -146,12 +146,12 @@ int event(struct sr_output *o, int event_type, char **data_out,
 
        ctx = o->internal;
        switch (event_type) {
-       case DF_TRIGGER:
+       case SR_DF_TRIGGER:
                ctx->mark_trigger = ctx->spl_cnt;
                *data_out = NULL;
                *length_out = 0;
                break;
-       case DF_END:
+       case SR_DF_END:
                outsize = ctx->num_enabled_probes
                                * (ctx->samples_per_line + 20) + 512;
                if (!(outbuf = calloc(1, outsize)))
index f45577e7cdf7885da001011a0d82add7a85921e8..01a3966beb34e0368412e99411e6b135167177e1 100644 (file)
--- a/sigrok.h
+++ b/sigrok.h
@@ -76,13 +76,13 @@ typedef int (*receive_data_callback) (int fd, int revents, void *user_data);
 
 /* Data types used by hardware plugins for set_configuration() */
 enum {
-       T_UINT64,
-       T_CHAR,
-       T_NULL,
+       SR_T_UINT64,
+       SR_T_CHAR,
+       SR_T_NULL,
 };
 
 enum {
-       PROTO_RAW,
+       SR_PROTO_RAW,
 };
 
 /* (Unused) protocol decoder stack entry */
@@ -94,12 +94,12 @@ struct protocol {
 
 /* sr_datafeed_packet.type values */
 enum {
-       DF_HEADER,
-       DF_END,
-       DF_TRIGGER,
-       DF_LOGIC,
-       DF_ANALOG,
-       DF_PD,
+       SR_DF_HEADER,
+       SR_DF_END,
+       SR_DF_TRIGGER,
+       SR_DF_LOGIC,
+       SR_DF_ANALOG,
+       SR_DF_PD,
 };
 
 struct sr_datafeed_packet {
@@ -198,8 +198,8 @@ struct sr_device {
 };
 
 enum {
-       PROBE_TYPE_LOGIC,
-       PROBE_TYPE_ANALOG,
+       SR_PROBE_TYPE_LOGIC,
+       SR_PROBE_TYPE_ANALOG,
 };
 
 struct probe {
@@ -214,20 +214,20 @@ extern GSList *devices;
 
 /* Hardware plugin capabilities */
 enum {
-       HWCAP_DUMMY,             /* Used to terminate lists */
+       SR_HWCAP_DUMMY,             /* Used to terminate lists */
        /* device classes */
-       HWCAP_LOGIC_ANALYZER,
+       SR_HWCAP_LOGIC_ANALYZER,
 
        /* device options */
-       HWCAP_SAMPLERATE,        /* Change samplerate */
-       HWCAP_PROBECONFIG,       /* Configure probe mask */
-       HWCAP_CAPTURE_RATIO,     /* Set pre/post-trigger capture ratio */
-       HWCAP_PATTERN_MODE,      /* Pattern generator mode */
+       SR_HWCAP_SAMPLERATE,        /* Change samplerate */
+       SR_HWCAP_PROBECONFIG,       /* Configure probe mask */
+       SR_HWCAP_CAPTURE_RATIO,     /* Set pre/post-trigger capture ratio */
+       SR_HWCAP_PATTERN_MODE,      /* Pattern generator mode */
 
        /* acquisition modes */
-       HWCAP_LIMIT_MSEC,        /* Set a time limit for sample acquisition */
-       HWCAP_LIMIT_SAMPLES,     /* Set a limit on number of samples */
-       HWCAP_CONTINUOUS,
+       SR_HWCAP_LIMIT_MSEC,        /* Set a time limit for sample acquisition */
+       SR_HWCAP_LIMIT_SAMPLES,     /* Set a limit on number of samples */
+       SR_HWCAP_CONTINUOUS,
 };
 
 struct hwcap_option {
@@ -253,8 +253,8 @@ struct sr_device_instance {
 
 /* sr_device_instance types */
 enum {
-       USB_INSTANCE,
-       SERIAL_INSTANCE,
+       SR_USB_INSTANCE,
+       SR_SERIAL_INSTANCE,
 };
 
 struct sr_usb_device_instance {
@@ -270,13 +270,13 @@ struct sr_serial_device_instance {
 
 /* Device instance status */
 enum {
-       ST_NOT_FOUND,
+       SR_ST_NOT_FOUND,
        /* Found, but still booting */
-       ST_INITIALIZING,
+       SR_ST_INITIALIZING,
        /* Live, but not in use */
-       ST_INACTIVE,
+       SR_ST_INACTIVE,
        /* Actively in use in a session */
-       ST_ACTIVE,
+       SR_ST_ACTIVE,
 };
 
 /*
@@ -287,17 +287,17 @@ enum {
 /* Device info IDs */
 enum {
        /* struct sr_device_instance for this specific device */
-       DI_INSTANCE,
+       SR_DI_INSTANCE,
        /* The number of probes connected to this device */
-       DI_NUM_PROBES,
+       SR_DI_NUM_PROBES,
        /* Samplerates supported by this device, (struct samplerates) */
-       DI_SAMPLERATES,
+       SR_DI_SAMPLERATES,
        /* Types of trigger supported, out of "01crf" (char *) */
-       DI_TRIGGER_TYPES,
+       SR_DI_TRIGGER_TYPES,
        /* The currently set samplerate in Hz (uint64_t) */
-       DI_CUR_SAMPLERATE,
+       SR_DI_CUR_SAMPLERATE,
        /* Supported pattern generator modes */
-       DI_PATTERNMODES,
+       SR_DI_PATTERNMODES,
 };
 
 /*