From: Uwe Hermann Date: Sun, 30 Jan 2011 16:58:41 +0000 (+0100) Subject: SR_ prefix for all public enums. X-Git-Tag: libsigrok-0.1.0~363 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5a2326a71b3a7d3bc6b367a7a3dfa6f137f5f0ec;p=libsigrok.git SR_ prefix for all public enums. --- diff --git a/device.c b/device.c index dedae3a6..9e922f05 100644 --- 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); } diff --git a/hardware/alsa/alsa.c b/hardware/alsa/alsa.c index cef1814b..3ddadcb9 100644 --- a/hardware/alsa/alsa.c +++ b/hardware/alsa/alsa.c @@ -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); diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index f085c85c..f488cdc5 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -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); diff --git a/hardware/common/misc.c b/hardware/common/misc.c index 8bcd7b09..03fe2689 100644 --- a/hardware/common/misc.c +++ b/hardware/common/misc.c @@ -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); diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 06722c4f..aac08599 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -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); diff --git a/hardware/link-mso19/link-mso19.c b/hardware/link-mso19/link-mso19.c index 924ce7c1..6c509ff3 100644 --- a/hardware/link-mso19/link-mso19.c +++ b/hardware/link-mso19/link-mso19.c @@ -36,13 +36,13 @@ #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); } diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index cf9f025a..9ebd6b09 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -82,10 +82,10 @@ #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); } diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index 8a74332e..b66fd30d 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -50,12 +50,12 @@ /* 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); diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 8399292c..0c3d25bc 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -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))) diff --git a/hwplugin.c b/hwplugin.c index 36f22016..31fed10c 100644 --- a/hwplugin.c +++ b/hwplugin.c @@ -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: diff --git a/input/input_binary.c b/input/input_binary.c index 8160c7c1..1da4e701 100644 --- a/input/input_binary.c +++ b/input/input_binary.c @@ -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); diff --git a/output/output_analog.c b/output/output_analog.c index 46eca8d1..40d52181 100644 --- a/output/output_analog.c +++ b/output/output_analog.c @@ -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, diff --git a/output/output_binary.c b/output/output_binary.c index 5f62dfe9..2fee7fff 100644 --- a/output/output_binary.c +++ b/output/output_binary.c @@ -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, diff --git a/output/output_gnuplot.c b/output/output_gnuplot.c index 356f61aa..2945f949 100644 --- a/output/output_gnuplot.c +++ b/output/output_gnuplot.c @@ -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, diff --git a/output/output_ols.c b/output/output_ols.c index bdd7d786..6c4876d4 100644 --- a/output/output_ols.c +++ b/output/output_ols.c @@ -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, diff --git a/output/output_skeleton.c b/output/output_skeleton.c index 67e4d902..a58b87aa 100644 --- a/output/output_skeleton.c +++ b/output/output_skeleton.c @@ -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, diff --git a/output/output_vcd.c b/output/output_vcd.c index 958fbd7c..c6d1655d 100644 --- a/output/output_vcd.c +++ b/output/output_vcd.c @@ -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, diff --git a/output/text/ascii.c b/output/text/ascii.c index e4e3e0cd..3e7f2e35 100644 --- a/output/text/ascii.c +++ b/output/text/ascii.c @@ -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, diff --git a/output/text/bits.c b/output/text/bits.c index b9b13477..755a463a 100644 --- a/output/text/bits.c +++ b/output/text/bits.c @@ -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, diff --git a/output/text/hex.c b/output/text/hex.c index cd769aa5..e63feb14 100644 --- a/output/text/hex.c +++ b/output/text/hex.c @@ -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, diff --git a/output/text/text.c b/output/text/text.c index ea7f3ec3..ded3adf1 100644 --- a/output/text/text.c +++ b/output/text/text.c @@ -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))) diff --git a/sigrok.h b/sigrok.h index f45577e7..01a3966b 100644 --- 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, }; /*