From: Uwe Hermann Date: Sun, 20 Feb 2011 13:20:15 +0000 (+0100) Subject: Add sr_ prefix for analog stuff some structs. X-Git-Tag: libsigrok-0.1.0~317 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=809c5f2011198a064a2e5e4028f19e63eb532ec1;p=libsigrok.git Add sr_ prefix for analog stuff some structs. --- diff --git a/hardware/alsa/alsa.c b/hardware/alsa/alsa.c index e4618cdf..c985e6be 100644 --- a/hardware/alsa/alsa.c +++ b/hardware/alsa/alsa.c @@ -204,9 +204,9 @@ static int receive_data(int fd, int revents, void *user_data) struct sr_device_instance *sdi = user_data; struct alsa *alsa = sdi->priv; struct sr_datafeed_packet packet; - struct analog_sample *sample; - unsigned int sample_size = sizeof(struct analog_sample) + - (NUM_PROBES * sizeof(struct analog_probe)); + struct sr_analog_sample *sample; + unsigned int sample_size = sizeof(struct sr_analog_sample) + + (NUM_PROBES * sizeof(struct sr_analog_probe)); char *outb; char inb[4096]; int i, x, count; @@ -228,7 +228,7 @@ static int receive_data(int fd, int revents, void *user_data) return FALSE; for (i = 0; i < count; i++) { - sample = (struct analog_sample *) + sample = (struct sr_analog_sample *) (outb + (i * sample_size)); sample->num_probes = NUM_PROBES; diff --git a/output/output_analog.c b/output/output_analog.c index aef88c5f..94bd8d8d 100644 --- a/output/output_analog.c +++ b/output/output_analog.c @@ -48,7 +48,7 @@ struct context { uint8_t *linevalues; char *header; int mark_trigger; -// struct analog_sample *prevsample; +// struct sr_analog_sample *prevsample; enum outputmode mode; }; @@ -112,8 +112,8 @@ static int init(struct sr_output *o, int default_spl, enum outputmode mode) } ctx->probelist[ctx->num_enabled_probes] = 0; - ctx->unitsize = sizeof(struct analog_sample) + - (ctx->num_enabled_probes * sizeof(struct analog_probe)); + ctx->unitsize = sizeof(struct sr_analog_sample) + + (ctx->num_enabled_probes * sizeof(struct sr_analog_probe)); ctx->line_offset = 0; ctx->spl_cnt = 0; ctx->mark_trigger = -1; @@ -208,7 +208,7 @@ static int data_bits(struct sr_output *o, char *data_in, uint64_t length_in, struct context *ctx; unsigned int outsize, offset, p; int max_linelen; - struct analog_sample *sample; + struct sr_analog_sample *sample; char *outbuf, c; ctx = o->internal; @@ -239,7 +239,7 @@ static int data_bits(struct sr_output *o, char *data_in, uint64_t length_in, if (length_in >= ctx->unitsize) { for (offset = 0; offset <= length_in - ctx->unitsize; offset += ctx->unitsize) { - sample = (struct analog_sample *) (data_in + offset); + sample = (struct sr_analog_sample *) (data_in + offset); for (p = 0; p < ctx->num_enabled_probes; p++) { int val = sample->probes[p].val; int res = sample->probes[p].res; diff --git a/output/output_gnuplot.c b/output/output_gnuplot.c index 18e76318..10b9c264 100644 --- a/output/output_gnuplot.c +++ b/output/output_gnuplot.c @@ -232,8 +232,8 @@ static int analog_init(struct sr_output *o) } ctx->probelist[ctx->num_enabled_probes] = 0; // ctx->unitsize = (ctx->num_enabled_probes + 7) / 8; - ctx->unitsize = sizeof(struct analog_sample) + - (ctx->num_enabled_probes * sizeof(struct analog_probe)); + ctx->unitsize = sizeof(struct sr_analog_sample) + + (ctx->num_enabled_probes * sizeof(struct sr_analog_probe)); num_probes = g_slist_length(o->device->probes); comment[0] = '\0'; @@ -285,7 +285,7 @@ static int analog_data(struct sr_output *o, char *data_in, uint64_t length_in, // uint64_t sample; static uint64_t samplecount = 0; char *outbuf, *c; - struct analog_sample *sample; + struct sr_analog_sample *sample; ctx = o->internal; // max_linelen = 16 + ctx->num_enabled_probes * 2; @@ -307,7 +307,7 @@ static int analog_data(struct sr_output *o, char *data_in, uint64_t length_in, for (i = 0; i <= length_in - ctx->unitsize; i += ctx->unitsize) { // memcpy(&sample, data_in + i, ctx->unitsize); - sample = (struct analog_sample *) (data_in + i); + sample = (struct sr_analog_sample *) (data_in + i); /* The first column is a counter (needed for gnuplot). */ c = outbuf + strlen(outbuf); diff --git a/session.c b/session.c index 65f7a8df..cc6c133d 100644 --- a/session.c +++ b/session.c @@ -91,7 +91,7 @@ void sr_session_pa_clear(void) session->analyzers = NULL; } -void sr_session_pa_add(struct analyzer *an) +void sr_session_pa_add(struct sr_analyzer *an) { session->analyzers = g_slist_append(session->analyzers, an); } diff --git a/sigrok-proto.h b/sigrok-proto.h index 4b4de45b..65fd4362 100644 --- a/sigrok-proto.h +++ b/sigrok-proto.h @@ -103,7 +103,7 @@ int sr_session_device_add(struct sr_device *device); /* Protocol analyzers setup */ void sr_session_pa_clear(void); -void sr_session_pa_add(struct analyzer *pa); +void sr_session_pa_add(struct sr_analyzer *pa); /* Datafeed setup */ void sr_session_datafeed_callback_clear(void); diff --git a/sigrok.h b/sigrok.h index 7c0ed572..81709b3e 100644 --- a/sigrok.h +++ b/sigrok.h @@ -88,7 +88,7 @@ enum { }; /* (Unused) protocol decoder stack entry */ -struct protocol { +struct sr_protocol { char *name; int id; int stackindex; @@ -120,15 +120,15 @@ struct sr_datafeed_header { int num_logic_probes; }; -struct analog_probe { +struct sr_analog_probe { uint8_t att; uint8_t res; /* Needs to be a power of 2, FIXME */ uint16_t val; /* Max hardware ADC width is 16bits */ }; -struct analog_sample { +struct sr_analog_sample { uint8_t num_probes; /* Max hardware probes is 256 */ - struct analog_probe probes[]; + struct sr_analog_probe probes[]; }; struct sr_input { @@ -163,7 +163,7 @@ struct sr_output_format { uint64_t *length_out); }; -struct analyzer { +struct sr_analyzer { char *name; char *filename; /*