packet.length = count * sample_size;
packet.unitsize = sample_size;
packet.payload = outb;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
free(outb);
alsa->limit_samples -= count;
} while (alsa->limit_samples > 0);
packet.type = SR_DF_END;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
return TRUE;
}
header.num_analog_probes = NUM_PROBES;
header.num_logic_probes = 0;
header.protocol_id = SR_PROTO_RAW;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
free(ufds);
return SR_OK;
packet.length = tosend * sizeof(uint16_t);
packet.unitsize = 2;
packet.payload = samples + sent;
- session_bus(sigma->session_id, &packet);
+ sr_session_bus(sigma->session_id, &packet);
sent += tosend;
}
packet.length = tosend * sizeof(uint16_t);
packet.unitsize = 2;
packet.payload = samples;
- session_bus(sigma->session_id, &packet);
+ sr_session_bus(sigma->session_id, &packet);
sent += tosend;
}
packet.type = SR_DF_TRIGGER;
packet.length = 0;
packet.payload = 0;
- session_bus(sigma->session_id, &packet);
+ sr_session_bus(sigma->session_id, &packet);
}
}
packet.length = tosend * sizeof(uint16_t);
packet.unitsize = 2;
packet.payload = samples + sent;
- session_bus(sigma->session_id, &packet);
+ sr_session_bus(sigma->session_id, &packet);
}
*lastsample = samples[n - 1];
/* End of samples. */
packet.type = SR_DF_END;
packet.length = 0;
- session_bus(sigma->session_id, &packet);
+ sr_session_bus(sigma->session_id, &packet);
sigma->state.state = SIGMA_IDLE;
header.protocol_id = SR_PROTO_RAW;
header.num_logic_probes = sigma->num_probes;
header.num_analog_probes = 0;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
/* Add capture source. */
source_add(0, G_IO_IN, 10, receive_data, sdi);
packet.length = z;
packet.unitsize = 1;
packet.payload = c;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
}
} while (z > 0);
/* Send last packet. */
packet.type = SR_DF_END;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
return FALSE;
}
header->protocol_id = SR_PROTO_RAW;
header->num_logic_probes = NUM_PROBES;
header->num_analog_probes = 0;
- session_bus(session_device_id, packet);
+ sr_session_bus(session_device_id, packet);
free(header);
free(packet);
packet.length = 1024;
packet.unitsize = 1;
packet.payload = logic_out;
- session_bus(mso->session_id, &packet);
+ sr_session_bus(mso->session_id, &packet);
packet.type = SR_DF_ANALOG;
packet.length = 1024;
packet.unitsize = sizeof(double);
packet.payload = analog_out;
- session_bus(mso->session_id, &packet);
+ sr_session_bus(mso->session_id, &packet);
packet.type = SR_DF_END;
- session_bus(mso->session_id, &packet);
+ sr_session_bus(mso->session_id, &packet);
return TRUE;
}
header.num_analog_probes = 1;
header.num_logic_probes = 8;
header.protocol_id = SR_PROTO_RAW;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
return ret;
}
device_index = device_index;
packet.type = SR_DF_END;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
}
struct sr_device_plugin link_mso19_plugin_info = {
packet.length = trigger_at * 4;
packet.unitsize = 4;
packet.payload = raw_sample_buf;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
}
packet.type = SR_DF_TRIGGER;
packet.length = 0;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
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);
+ sr_session_bus(user_data, &packet);
} else {
packet.type = SR_DF_LOGIC;
packet.length = limit_samples * 4;
packet.unitsize = 4;
packet.payload = raw_sample_buf;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
}
free(raw_sample_buf);
serial_close(fd);
packet.type = SR_DF_END;
packet.length = 0;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
}
return TRUE;
header->protocol_id = SR_PROTO_RAW;
header->num_logic_probes = NUM_PROBES;
header->num_analog_probes = 0;
- session_bus(session_device_id, packet);
+ sr_session_bus(session_device_id, packet);
g_free(header);
g_free(packet);
packet.type = SR_DF_END;
packet.length = 0;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
}
struct sr_device_plugin ols_plugin_info = {
*/
packet.type = SR_DF_TRIGGER;
packet.length = 0;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
/*
* Send the samples that triggered it, since we're
packet.length = trigger_stage;
packet.unitsize = 1;
packet.payload = trigger_buffer;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
trigger_stage = TRIGGER_FIRED;
break;
packet.length = cur_buflen - trigger_offset;
packet.unitsize = 1;
packet.payload = cur_buf + trigger_offset;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
g_free(cur_buf);
num_samples += cur_buflen;
header->protocol_id = SR_PROTO_RAW;
header->num_logic_probes = NUM_PROBES;
header->num_analog_probes = 0;
- session_bus(session_device_id, packet);
+ sr_session_bus(session_device_id, packet);
g_free(header);
g_free(packet);
device_index = device_index;
packet.type = SR_DF_END;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
receive_transfer(NULL);
header.protocol_id = SR_PROTO_RAW;
header.num_logic_probes = num_channels;
header.num_analog_probes = 0;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
buf = g_malloc(PACKET_SIZE);
if (!buf)
packet.length = PACKET_SIZE;
packet.unitsize = 4;
packet.payload = buf;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
}
analyzer_read_stop(sdi->usb->devhdl);
g_free(buf);
packet.type = SR_DF_END;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
return SR_OK;
}
struct sr_device_instance *sdi;
packet.type = SR_DF_END;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return; /* TODO: Cry? */
void source_remove(int fd)
{
-
- session_source_remove(fd);
-
+ sr_session_source_remove(fd);
}
void source_add(int fd, int events, int timeout, receive_data_callback rcv_cb,
void *user_data)
{
-
- session_source_add(fd, events, timeout, rcv_cb, user_data);
-
+ sr_session_source_add(fd, events, timeout, rcv_cb, user_data);
}
packet.type = SR_DF_HEADER;
packet.length = sizeof(struct sr_datafeed_header);
packet.payload = &header;
- session_bus(in->vdevice, &packet);
+ sr_session_bus(in->vdevice, &packet);
/* chop up the input file into chunks and feed it into the session bus */
packet.type = SR_DF_LOGIC;
packet.payload = buffer;
while ((size = read(fd, buffer, CHUNKSIZE)) > 0) {
packet.length = size;
- session_bus(in->vdevice, &packet);
+ sr_session_bus(in->vdevice, &packet);
}
close(fd);
/* end of stream */
packet.type = SR_DF_END;
packet.length = 0;
- session_bus(in->vdevice, &packet);
+ sr_session_bus(in->vdevice, &packet);
return SR_OK;
}
int source_timeout = -1;
-struct sr_session *session_new(void)
+struct sr_session *sr_session_new(void)
{
session = calloc(1, sizeof(struct sr_session));
return session;
}
-void session_destroy(void)
+void sr_session_destroy(void)
{
g_slist_free(session->devices);
g_free(session);
}
-void session_device_clear(void)
+void sr_session_device_clear(void)
{
g_slist_free(session->devices);
session->devices = NULL;
}
-int session_device_add(struct sr_device *device)
+int sr_session_device_add(struct sr_device *device)
{
int ret;
return SR_OK;
}
-void session_pa_clear(void)
+void sr_session_pa_clear(void)
{
/*
* The protocols are pointers to the global set of PA plugins,
session->analyzers = NULL;
}
-void session_pa_add(struct analyzer *an)
+void sr_session_pa_add(struct analyzer *an)
{
session->analyzers = g_slist_append(session->analyzers, an);
}
-void session_datafeed_callback_clear(void)
+void sr_session_datafeed_callback_clear(void)
{
g_slist_free(session->datafeed_callbacks);
session->datafeed_callbacks = NULL;
}
-void session_datafeed_callback_add(datafeed_callback callback)
+void sr_session_datafeed_callback_add(datafeed_callback callback)
{
session->datafeed_callbacks =
g_slist_append(session->datafeed_callbacks, callback);
}
-static void session_run_poll()
+static void sr_session_run_poll()
{
GPollFD *fds, my_gpollfd;
int ret, i;
}
-int session_start(void)
+int sr_session_start(void)
{
struct sr_device *device;
GSList *l;
return ret;
}
-void session_run(void)
+void sr_session_run(void)
{
g_message("session: running");
sources[0].cb(-1, 0, sources[0].user_data);
else
/* real sources, use g_poll() main loop */
- session_run_poll();
+ sr_session_run_poll();
}
-void session_halt(void)
+void sr_session_halt(void)
{
g_message("session: halting");
}
-void session_stop(void)
+void sr_session_stop(void)
{
struct sr_device *device;
GSList *l;
}
-void session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
+void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
{
GSList *l;
datafeed_callback cb;
}
}
-void session_source_add(int fd, int events, int timeout,
+void sr_session_source_add(int fd, int events, int timeout,
receive_data_callback callback, void *user_data)
{
struct source *new_sources, *s;
source_timeout = timeout;
}
-void session_source_remove(int fd)
+void sr_session_source_remove(int fd)
{
struct source *new_sources;
int old, new;
packet.length = ret;
packet.unitsize = vdevice->unitsize;
packet.payload = buf;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
} else {
/* done with this capture file */
zip_fclose(vdevice->capfile);
if (!got_data) {
packet.type = SR_DF_END;
packet.length = 0;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
}
return TRUE;
}
/* freewheeling source */
- session_source_add(-1, 0, 0, feed_chunk, session_device_id);
+ sr_session_source_add(-1, 0, 0, feed_chunk, session_device_id);
/* Send header packet to the session bus. */
packet = g_malloc(sizeof(struct sr_datafeed_packet));
header->protocol_id = SR_PROTO_RAW;
header->num_logic_probes = vdevice->num_probes;
header->num_analog_probes = 0;
- session_bus(session_device_id, packet);
+ sr_session_bus(session_device_id, packet);
g_free(header);
g_free(packet);
hw_get_capabilities,
hw_set_configuration,
hw_start_acquisition,
- NULL
+ NULL,
};
extern struct sr_device_plugin session_driver;
-int session_load(const char *filename)
+int sr_session_load(const char *filename)
{
GKeyFile *kf;
GPtrArray *capturefiles;
return SR_ERR;
}
- session = session_new();
+ session = sr_session_new();
devcnt = 0;
capturefiles = g_ptr_array_new_with_free_func(g_free);
if (devcnt == 0)
/* first device, init the plugin */
device->plugin->init((char *)filename);
- session_device_add(device);
+ sr_session_device_add(device);
device->plugin->set_configuration(devcnt, SR_HWCAP_CAPTUREFILE, val);
g_ptr_array_add(capturefiles, val);
} else if (!strcmp(keys[j], "samplerate")) {
return SR_OK;
}
-int session_save(char *filename)
+int sr_session_save(char *filename)
{
GSList *l, *p, *d;
FILE *meta;
struct sr_datafeed_packet *packet);
/* Session setup */
-int session_load(const char *filename);
-struct sr_session *session_new(void);
-void session_destroy(void);
-void session_device_clear(void);
-int session_device_add(struct sr_device *device);
+int sr_session_load(const char *filename);
+struct sr_session *sr_session_new(void);
+void sr_session_destroy(void);
+void sr_session_device_clear(void);
+int sr_session_device_add(struct sr_device *device);
/* Protocol analyzers setup */
-void session_pa_clear(void);
-void session_pa_add(struct analyzer *pa);
+void sr_session_pa_clear(void);
+void sr_session_pa_add(struct analyzer *pa);
/* Datafeed setup */
-void session_datafeed_callback_clear(void);
-void session_datafeed_callback_add(datafeed_callback callback);
+void sr_session_datafeed_callback_clear(void);
+void sr_session_datafeed_callback_add(datafeed_callback callback);
/* Session control */
-int session_start(void);
-void session_run(void);
-void session_halt(void);
-void session_stop(void);
-void session_bus(struct sr_device *device, struct sr_datafeed_packet *packet);
+int sr_session_start(void);
+void sr_session_run(void);
+void sr_session_halt(void);
+void sr_session_stop(void);
+void sr_session_bus(struct sr_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,
+int sr_session_save(char *filename);
+void sr_session_source_add(int fd, int events, int timeout,
receive_data_callback callback, void *user_data);
-void session_source_remove(int fd);
+void sr_session_source_remove(int fd);
/*--- input/input.c ---------------------------------------------------------*/