Prefix datafeed structs with sr_.

This commit is contained in:
Uwe Hermann 2011-01-29 17:03:26 +01:00
parent d32d961d17
commit b9c735a275
11 changed files with 47 additions and 47 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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,

View File

@ -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;