Add sr_ prefix for analog stuff some structs.

This commit is contained in:
Uwe Hermann 2011-02-20 14:20:15 +01:00
parent a887e3da97
commit 809c5f2011
6 changed files with 20 additions and 20 deletions

View File

@ -204,9 +204,9 @@ static int receive_data(int fd, int revents, void *user_data)
struct sr_device_instance *sdi = user_data; struct sr_device_instance *sdi = user_data;
struct alsa *alsa = sdi->priv; struct alsa *alsa = sdi->priv;
struct sr_datafeed_packet packet; struct sr_datafeed_packet packet;
struct analog_sample *sample; struct sr_analog_sample *sample;
unsigned int sample_size = sizeof(struct analog_sample) + unsigned int sample_size = sizeof(struct sr_analog_sample) +
(NUM_PROBES * sizeof(struct analog_probe)); (NUM_PROBES * sizeof(struct sr_analog_probe));
char *outb; char *outb;
char inb[4096]; char inb[4096];
int i, x, count; int i, x, count;
@ -228,7 +228,7 @@ static int receive_data(int fd, int revents, void *user_data)
return FALSE; return FALSE;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
sample = (struct analog_sample *) sample = (struct sr_analog_sample *)
(outb + (i * sample_size)); (outb + (i * sample_size));
sample->num_probes = NUM_PROBES; sample->num_probes = NUM_PROBES;

View File

@ -48,7 +48,7 @@ struct context {
uint8_t *linevalues; uint8_t *linevalues;
char *header; char *header;
int mark_trigger; int mark_trigger;
// struct analog_sample *prevsample; // struct sr_analog_sample *prevsample;
enum outputmode mode; 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->probelist[ctx->num_enabled_probes] = 0;
ctx->unitsize = sizeof(struct analog_sample) + ctx->unitsize = sizeof(struct sr_analog_sample) +
(ctx->num_enabled_probes * sizeof(struct analog_probe)); (ctx->num_enabled_probes * sizeof(struct sr_analog_probe));
ctx->line_offset = 0; ctx->line_offset = 0;
ctx->spl_cnt = 0; ctx->spl_cnt = 0;
ctx->mark_trigger = -1; 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; struct context *ctx;
unsigned int outsize, offset, p; unsigned int outsize, offset, p;
int max_linelen; int max_linelen;
struct analog_sample *sample; struct sr_analog_sample *sample;
char *outbuf, c; char *outbuf, c;
ctx = o->internal; 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) { if (length_in >= ctx->unitsize) {
for (offset = 0; offset <= length_in - ctx->unitsize; for (offset = 0; offset <= length_in - ctx->unitsize;
offset += 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++) { for (p = 0; p < ctx->num_enabled_probes; p++) {
int val = sample->probes[p].val; int val = sample->probes[p].val;
int res = sample->probes[p].res; int res = sample->probes[p].res;

View File

@ -232,8 +232,8 @@ static int analog_init(struct sr_output *o)
} }
ctx->probelist[ctx->num_enabled_probes] = 0; ctx->probelist[ctx->num_enabled_probes] = 0;
// ctx->unitsize = (ctx->num_enabled_probes + 7) / 8; // ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
ctx->unitsize = sizeof(struct analog_sample) + ctx->unitsize = sizeof(struct sr_analog_sample) +
(ctx->num_enabled_probes * sizeof(struct analog_probe)); (ctx->num_enabled_probes * sizeof(struct sr_analog_probe));
num_probes = g_slist_length(o->device->probes); num_probes = g_slist_length(o->device->probes);
comment[0] = '\0'; 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; // uint64_t sample;
static uint64_t samplecount = 0; static uint64_t samplecount = 0;
char *outbuf, *c; char *outbuf, *c;
struct analog_sample *sample; struct sr_analog_sample *sample;
ctx = o->internal; ctx = o->internal;
// max_linelen = 16 + ctx->num_enabled_probes * 2; // 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) { for (i = 0; i <= length_in - ctx->unitsize; i += ctx->unitsize) {
// memcpy(&sample, data_in + 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). */ /* The first column is a counter (needed for gnuplot). */
c = outbuf + strlen(outbuf); c = outbuf + strlen(outbuf);

View File

@ -91,7 +91,7 @@ void sr_session_pa_clear(void)
session->analyzers = NULL; 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); session->analyzers = g_slist_append(session->analyzers, an);
} }

View File

@ -103,7 +103,7 @@ int sr_session_device_add(struct sr_device *device);
/* Protocol analyzers setup */ /* Protocol analyzers setup */
void sr_session_pa_clear(void); 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 */ /* Datafeed setup */
void sr_session_datafeed_callback_clear(void); void sr_session_datafeed_callback_clear(void);

View File

@ -88,7 +88,7 @@ enum {
}; };
/* (Unused) protocol decoder stack entry */ /* (Unused) protocol decoder stack entry */
struct protocol { struct sr_protocol {
char *name; char *name;
int id; int id;
int stackindex; int stackindex;
@ -120,15 +120,15 @@ struct sr_datafeed_header {
int num_logic_probes; int num_logic_probes;
}; };
struct analog_probe { struct sr_analog_probe {
uint8_t att; uint8_t att;
uint8_t res; /* Needs to be a power of 2, FIXME */ uint8_t res; /* Needs to be a power of 2, FIXME */
uint16_t val; /* Max hardware ADC width is 16bits */ 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 */ uint8_t num_probes; /* Max hardware probes is 256 */
struct analog_probe probes[]; struct sr_analog_probe probes[];
}; };
struct sr_input { struct sr_input {
@ -163,7 +163,7 @@ struct sr_output_format {
uint64_t *length_out); uint64_t *length_out);
}; };
struct analyzer { struct sr_analyzer {
char *name; char *name;
char *filename; char *filename;
/* /*