From: Uwe Hermann Date: Sat, 29 Jan 2011 16:03:26 +0000 (+0100) Subject: Prefix datafeed structs with sr_. X-Git-Tag: libsigrok-0.1.0~367 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b9c735a275512ce82da7f66275c7cb62eaf66b60;p=libsigrok.git Prefix datafeed structs with sr_. --- diff --git a/hardware/alsa/alsa.c b/hardware/alsa/alsa.c index 8181f7dd..417745bb 100644 --- a/hardware/alsa/alsa.c +++ b/hardware/alsa/alsa.c @@ -203,7 +203,7 @@ static int receive_data(int fd, int revents, void *user_data) { struct sr_device_instance *sdi = user_data; struct alsa *alsa = sdi->priv; - struct datafeed_packet packet; + struct sr_datafeed_packet packet; struct analog_sample *sample; unsigned int sample_size = sizeof(struct analog_sample) + (NUM_PROBES * sizeof(struct analog_probe)); @@ -260,8 +260,8 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) { struct sr_device_instance *sdi; struct alsa *alsa; - struct datafeed_packet packet; - struct datafeed_header header; + struct sr_datafeed_packet packet; + struct sr_datafeed_header header; struct pollfd *ufds; int count; int err; @@ -334,7 +334,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) source_add(ufds[0].fd, ufds[0].events, 10, receive_data, sdi); packet.type = DF_HEADER; - packet.length = sizeof(struct datafeed_header); + packet.length = sizeof(struct sr_datafeed_header); packet.payload = (unsigned char *) &header; header.feed_version = 1; gettimeofday(&header.starttime, NULL); diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 68bfd8f8..a987e3f3 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -827,7 +827,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts, struct sigma *sigma = sdi->priv; uint16_t tsdiff, ts; uint16_t samples[65536 * sigma->samples_per_event]; - struct datafeed_packet packet; + struct sr_datafeed_packet packet; int i, j, k, l, numpad, tosend; size_t n = 0, sent = 0; int clustersize = EVENTS_PER_CLUSTER * sigma->samples_per_event; @@ -954,7 +954,7 @@ static int receive_data(int fd, int revents, void *user_data) { struct sr_device_instance *sdi = user_data; struct sigma *sigma = sdi->priv; - struct datafeed_packet packet; + struct sr_datafeed_packet packet; const int chunks_per_read = 32; unsigned char buf[chunks_per_read * CHUNK_SIZE]; int bufsz, numchunks, i, newchunks; @@ -1200,8 +1200,8 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) { struct sr_device_instance *sdi; struct sigma *sigma; - struct datafeed_packet packet; - struct datafeed_header header; + struct sr_datafeed_packet packet; + struct sr_datafeed_header header; struct clockselect_50 clockselect; int frac; uint8_t triggerselect; @@ -1296,7 +1296,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) /* Send header packet to the session bus. */ packet.type = DF_HEADER; - packet.length = sizeof(struct datafeed_header); + packet.length = sizeof(struct sr_datafeed_header); packet.payload = &header; header.feed_version = 1; gettimeofday(&header.starttime, NULL); diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 348fd704..825fcea9 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -282,7 +282,7 @@ static void thread_func(void *data) /* Callback handling data */ static int receive_data(int fd, int revents, void *user_data) { - struct datafeed_packet packet; + struct sr_datafeed_packet packet; char c[BUFSIZE]; gsize z; @@ -320,8 +320,8 @@ static int receive_data(int fd, int revents, void *user_data) static int hw_start_acquisition(int device_index, gpointer session_device_id) { - struct datafeed_packet *packet; - struct datafeed_header *header; + struct sr_datafeed_packet *packet; + struct sr_datafeed_header *header; struct databag *mydata; mydata = malloc(sizeof(struct databag)); @@ -359,13 +359,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) if (!my_thread) return SR_ERR; - packet = malloc(sizeof(struct datafeed_packet)); - header = malloc(sizeof(struct datafeed_header)); + packet = malloc(sizeof(struct sr_datafeed_packet)); + header = malloc(sizeof(struct sr_datafeed_header)); if (!packet || !header) return SR_ERR_MALLOC; packet->type = DF_HEADER; - packet->length = sizeof(struct datafeed_header); + packet->length = sizeof(struct sr_datafeed_header); packet->payload = (unsigned char *)header; header->feed_version = 1; gettimeofday(&header->starttime, NULL); diff --git a/hardware/link-mso19/link-mso19.c b/hardware/link-mso19/link-mso19.c index 392399d3..1c371cac 100644 --- a/hardware/link-mso19/link-mso19.c +++ b/hardware/link-mso19/link-mso19.c @@ -605,7 +605,7 @@ static int receive_data(int fd, int revents, void *user_data) { struct sr_device_instance *sdi = user_data; struct mso *mso = sdi->priv; - struct datafeed_packet packet; + struct sr_datafeed_packet packet; uint8_t in[1024], logic_out[1024]; double analog_out[1024]; size_t i, s; @@ -668,8 +668,8 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) { struct sr_device_instance *sdi; struct mso *mso; - struct datafeed_packet packet; - struct datafeed_header header; + struct sr_datafeed_packet packet; + struct sr_datafeed_header header; int ret = SR_ERR; if (!(sdi = sr_get_device_instance(device_instances, device_index))) @@ -726,7 +726,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) source_add(sdi->serial->fd, G_IO_IN, -1, receive_data, sdi); packet.type = DF_HEADER; - packet.length = sizeof(struct datafeed_header); + packet.length = sizeof(struct sr_datafeed_header); packet.payload = (unsigned char *) &header; header.feed_version = 1; gettimeofday(&header.starttime, NULL); @@ -742,7 +742,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) /* FIXME */ static void hw_stop_acquisition(int device_index, gpointer session_device_id) { - struct datafeed_packet packet; + struct sr_datafeed_packet packet; device_index = device_index; diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index d5eb8ac9..d74a12f0 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -494,7 +494,7 @@ static int receive_data(int fd, int revents, void *user_data) static unsigned char tmp_sample[4]; static unsigned char *raw_sample_buf = NULL; int count, buflen, num_channels, offset, i, j; - struct datafeed_packet packet; + struct sr_datafeed_packet packet; unsigned char byte, *buffer; if (num_transfers++ == 0) { @@ -650,8 +650,8 @@ static int receive_data(int fd, int revents, void *user_data) static int hw_start_acquisition(int device_index, gpointer session_device_id) { int i; - struct datafeed_packet *packet; - struct datafeed_header *header; + struct sr_datafeed_packet *packet; + struct sr_datafeed_header *header; struct sr_device_instance *sdi; uint32_t trigger_config[4]; uint32_t data; @@ -757,12 +757,12 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) session_device_id); /* Send header packet to the session bus. */ - packet = g_malloc(sizeof(struct datafeed_packet)); - header = g_malloc(sizeof(struct datafeed_header)); + packet = g_malloc(sizeof(struct sr_datafeed_packet)); + header = g_malloc(sizeof(struct sr_datafeed_header)); if (!packet || !header) return SR_ERR; packet->type = DF_HEADER; - packet->length = sizeof(struct datafeed_header); + packet->length = sizeof(struct sr_datafeed_header); packet->payload = (unsigned char *)header; header->feed_version = 1; gettimeofday(&header->starttime, NULL); @@ -779,7 +779,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) static void hw_stop_acquisition(int device_index, gpointer session_device_id) { - struct datafeed_packet packet; + struct sr_datafeed_packet packet; /* Avoid compiler warnings. */ device_index = device_index; diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index 3ddb4ccf..8ac45afc 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -541,7 +541,7 @@ void receive_transfer(struct libusb_transfer *transfer) { static int num_samples = 0; static int empty_transfer_count = 0; - struct datafeed_packet packet; + struct sr_datafeed_packet packet; void *user_data; int cur_buflen, trigger_offset, i; unsigned char *cur_buf, *new_buf; @@ -670,8 +670,8 @@ void receive_transfer(struct libusb_transfer *transfer) static int hw_start_acquisition(int device_index, gpointer session_device_id) { struct sr_device_instance *sdi; - struct datafeed_packet *packet; - struct datafeed_header *header; + struct sr_datafeed_packet *packet; + struct sr_datafeed_header *header; struct libusb_transfer *transfer; const struct libusb_pollfd **lupfd; int size, i; @@ -680,8 +680,8 @@ 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; - packet = g_malloc(sizeof(struct datafeed_packet)); - header = g_malloc(sizeof(struct datafeed_header)); + packet = g_malloc(sizeof(struct sr_datafeed_packet)); + header = g_malloc(sizeof(struct sr_datafeed_header)); if (!packet || !header) return SR_ERR; @@ -709,7 +709,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) free(lupfd); packet->type = DF_HEADER; - packet->length = sizeof(struct datafeed_header); + packet->length = sizeof(struct sr_datafeed_header); packet->payload = (unsigned char *)header; header->feed_version = 1; gettimeofday(&header->starttime, NULL); @@ -727,7 +727,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) /* This stops acquisition on ALL devices, ignoring device_index. */ static void hw_stop_acquisition(int device_index, gpointer session_device_id) { - struct datafeed_packet packet; + struct sr_datafeed_packet packet; /* Avoid compiler warnings. */ device_index = device_index; diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index b6916db1..017fa7ba 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -482,8 +482,8 @@ static int hw_set_configuration(int device_index, int capability, void *value) static int hw_start_acquisition(int device_index, gpointer session_device_id) { struct sr_device_instance *sdi; - struct datafeed_packet packet; - struct datafeed_header header; + struct sr_datafeed_packet packet; + struct sr_datafeed_header header; int res; unsigned int packet_num; unsigned char *buf; @@ -506,7 +506,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) analyzer_get_trigger_address(sdi->usb->devhdl)); packet.type = DF_HEADER; - packet.length = sizeof(struct datafeed_header); + packet.length = sizeof(struct sr_datafeed_header); packet.payload = (unsigned char *)&header; header.feed_version = 1; gettimeofday(&header.starttime, NULL); @@ -547,7 +547,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) /* This stops acquisition on ALL devices, ignoring device_index. */ static void hw_stop_acquisition(int device_index, gpointer session_device_id) { - struct datafeed_packet packet; + struct sr_datafeed_packet packet; struct sr_device_instance *sdi; packet.type = DF_END; diff --git a/input/input_binary.c b/input/input_binary.c index 79fe37c7..8160c7c1 100644 --- a/input/input_binary.c +++ b/input/input_binary.c @@ -58,8 +58,8 @@ static int init(struct sr_input *in) static int loadfile(struct sr_input *in, const char *filename) { - struct datafeed_header header; - struct datafeed_packet packet; + struct sr_datafeed_header header; + struct sr_datafeed_packet packet; char buffer[CHUNKSIZE]; int fd, size, num_probes; @@ -76,7 +76,7 @@ static int loadfile(struct sr_input *in, const char *filename) header.samplerate = 0; gettimeofday(&header.starttime, NULL); packet.type = DF_HEADER; - packet.length = sizeof(struct datafeed_header); + packet.length = sizeof(struct sr_datafeed_header); packet.payload = &header; session_bus(in->vdevice, &packet); diff --git a/session.c b/session.c index ec4ae6fb..e08b39b2 100644 --- a/session.c +++ b/session.c @@ -209,7 +209,7 @@ void session_stop(void) } -void session_bus(struct device *device, struct datafeed_packet *packet) +void session_bus(struct device *device, struct sr_datafeed_packet *packet) { GSList *l; datafeed_callback cb; diff --git a/sigrok-proto.h b/sigrok-proto.h index 658553d4..6cf3ff1d 100644 --- a/sigrok-proto.h +++ b/sigrok-proto.h @@ -91,7 +91,7 @@ typedef void (*source_callback_remove) (int fd); typedef void (*source_callback_add) (int fd, int events, int timeout, receive_data_callback callback, void *user_data); typedef void (*datafeed_callback) (struct device *device, - struct datafeed_packet *packet); + struct sr_datafeed_packet *packet); /* Session setup */ struct session *session_load(const char *filename); @@ -113,7 +113,7 @@ int session_start(void); void session_run(void); void session_halt(void); void session_stop(void); -void session_bus(struct device *device, struct datafeed_packet *packet); +void session_bus(struct device *device, struct sr_datafeed_packet *packet); void make_metadata(char *filename); int session_save(char *filename); void session_source_add(int fd, int events, int timeout, diff --git a/sigrok.h b/sigrok.h index c25380af..101a2f9f 100644 --- a/sigrok.h +++ b/sigrok.h @@ -92,7 +92,7 @@ struct protocol { int stackindex; }; -/* datafeed_packet.type values */ +/* sr_datafeed_packet.type values */ enum { DF_HEADER, DF_END, @@ -102,14 +102,14 @@ enum { DF_PD, }; -struct datafeed_packet { +struct sr_datafeed_packet { uint16_t type; uint64_t length; uint16_t unitsize; void *payload; }; -struct datafeed_header { +struct sr_datafeed_header { int feed_version; struct timeval starttime; uint64_t samplerate;