packet.length = count * sample_size;
packet.unitsize = sample_size;
packet.payload = outb;
- sr_session_bus(user_data, &packet);
+ sr_session_send(user_data, &packet);
g_free(outb);
ctx->limit_samples -= count;
} while (ctx->limit_samples > 0);
packet.type = SR_DF_END;
- sr_session_bus(user_data, &packet);
+ sr_session_send(user_data, &packet);
return TRUE;
}
header.num_analog_probes = NUM_PROBES;
header.num_logic_probes = 0;
header.protocol_id = SR_PROTO_RAW;
- sr_session_bus(session_dev_id, &packet);
+ sr_session_send(session_dev_id, &packet);
g_free(ufds);
return SR_OK;
logic.length = tosend * sizeof(uint16_t);
logic.unitsize = 2;
logic.data = samples + sent;
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
sent += tosend;
}
logic.length = tosend * sizeof(uint16_t);
logic.unitsize = 2;
logic.data = samples;
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
sent += tosend;
}
/* Only send trigger if explicitly enabled. */
if (ctx->use_triggers) {
packet.type = SR_DF_TRIGGER;
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
}
}
logic.length = tosend * sizeof(uint16_t);
logic.unitsize = 2;
logic.data = samples + sent;
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
}
*lastsample = samples[n - 1];
if (ctx->state.chunks_downloaded >= numchunks) {
/* End of samples. */
packet.type = SR_DF_END;
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
ctx->state.state = SIGMA_IDLE;
gettimeofday(&header.starttime, NULL);
header.samplerate = ctx->cur_samplerate;
header.num_logic_probes = ctx->num_probes;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
/* Add capture source. */
sr_source_add(0, G_IO_IN, 10, receive_data, sdi);
logic.length = BS;
logic.unitsize = 1;
logic.data = ctx->final_buf + (block * BS);
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
return;
}
logic.length = trigger_point;
logic.unitsize = 1;
logic.data = ctx->final_buf + (block * BS);
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
}
/* Send the SR_DF_TRIGGER packet to the session bus. */
(block * BS) + trigger_point);
packet.type = SR_DF_TRIGGER;
packet.payload = NULL;
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
/* If at least one sample is located after the trigger... */
if (trigger_point < (BS - 1)) {
logic.length = BS - trigger_point;
logic.unitsize = 1;
logic.data = ctx->final_buf + (block * BS) + trigger_point;
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
}
}
gettimeofday(&header.starttime, NULL);
header.samplerate = ctx->cur_samplerate;
header.num_logic_probes = NUM_PROBES;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
/* Time when we should be done (for detecting trigger timeouts). */
ctx->done = (ctx->divcount + 1) * 0.08388608 + time(NULL)
/* Send end packet to the session bus. */
sr_dbg("la8: Sending SR_DF_END.");
packet.type = SR_DF_END;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
return SR_OK;
}
logic.length = z;
logic.unitsize = 1;
logic.data = c;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
samples_received += z;
}
} while (z > 0);
/* Send last packet. */
packet.type = SR_DF_END;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
return FALSE;
}
gettimeofday(&header->starttime, NULL);
header->samplerate = cur_samplerate;
header->num_logic_probes = NUM_PROBES;
- sr_session_bus(session_data, packet);
+ sr_session_send(session_data, packet);
g_free(header);
g_free(packet);
logic.length = cur_buflen;
logic.unitsize = 1;
logic.data = cur_buf;
- sr_session_bus(ctx->session_data, &packet);
+ sr_session_send(ctx->session_data, &packet);
g_free(cur_buf);
num_samples += cur_buflen;
gettimeofday(&header->starttime, NULL);
header->samplerate = 24000000UL;
header->num_logic_probes = ctx->profile->num_probes;
- sr_session_bus(session_data, packet);
+ sr_session_send(session_data, packet);
g_free(header);
g_free(packet);
(void)dev_index;
packet.type = SR_DF_END;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
receive_transfer(NULL);
logic.length = 1024;
logic.unitsize = 1;
logic.data = logic_out;
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
// Dont bother fixing this yet, keep it "old style"
/*
packet.length = 1024;
packet.unitsize = sizeof(double);
packet.payload = analog_out;
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
*/
packet.type = SR_DF_END;
- sr_session_bus(ctx->session_id, &packet);
+ sr_session_send(ctx->session_id, &packet);
return TRUE;
}
header.samplerate = ctx->cur_rate;
// header.num_analog_probes = 1;
header.num_logic_probes = 8;
- sr_session_bus(session_dev_id, &packet);
+ sr_session_send(session_dev_id, &packet);
return ret;
}
dev_index = dev_index;
packet.type = SR_DF_END;
- sr_session_bus(session_dev_id, &packet);
+ sr_session_send(session_dev_id, &packet);
return SR_OK;
}
logic.unitsize = 4;
logic.data = ctx->raw_sample_buf +
(ctx->limit_samples - ctx->num_samples) * 4;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
}
/* send the trigger */
packet.type = SR_DF_TRIGGER;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
/* send post-trigger samples */
packet.type = SR_DF_LOGIC;
logic.unitsize = 4;
logic.data = ctx->raw_sample_buf + ctx->trigger_at * 4 +
(ctx->limit_samples - ctx->num_samples) * 4;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
} else {
/* no trigger was used */
packet.type = SR_DF_LOGIC;
logic.unitsize = 4;
logic.data = ctx->raw_sample_buf +
(ctx->limit_samples - ctx->num_samples) * 4;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
}
g_free(ctx->raw_sample_buf);
serial_flush(fd);
serial_close(fd);
packet.type = SR_DF_END;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
}
return TRUE;
gettimeofday(&header->starttime, NULL);
header->samplerate = ctx->cur_samplerate;
header->num_logic_probes = NUM_PROBES;
- sr_session_bus(session_data, packet);
+ sr_session_send(session_data, packet);
g_free(header);
g_free(packet);
(void)dev_index;
packet.type = SR_DF_END;
- sr_session_bus(session_dev_id, &packet);
+ sr_session_send(session_dev_id, &packet);
return SR_OK;
}
*/
packet.type = SR_DF_TRIGGER;
packet.payload = NULL;
- sr_session_bus(ctx->session_data, &packet);
+ sr_session_send(ctx->session_data, &packet);
/*
* Send the samples that triggered it, since we're
logic.length = ctx->trigger_stage;
logic.unitsize = 1;
logic.data = ctx->trigger_buffer;
- sr_session_bus(ctx->session_data, &packet);
+ sr_session_send(ctx->session_data, &packet);
ctx->trigger_stage = TRIGGER_FIRED;
break;
logic.length = cur_buflen - trigger_offset;
logic.unitsize = 1;
logic.data = cur_buf + trigger_offset;
- sr_session_bus(ctx->session_data, &packet);
+ sr_session_send(ctx->session_data, &packet);
g_free(cur_buf);
num_samples += cur_buflen;
gettimeofday(&header->starttime, NULL);
header->samplerate = ctx->cur_samplerate;
header->num_logic_probes = ctx->profile->num_probes;
- sr_session_bus(session_data, packet);
+ sr_session_send(session_data, packet);
g_free(header);
g_free(packet);
(void)dev_index;
packet.type = SR_DF_END;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
receive_transfer(NULL);
gettimeofday(&header.starttime, NULL);
header.samplerate = ctx->cur_samplerate;
header.num_logic_probes = ctx->num_channels;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
if (!(buf = g_try_malloc(PACKET_SIZE))) {
sr_err("zp: %s: buf malloc failed", __func__);
logic.length = PACKET_SIZE;
logic.unitsize = 4;
logic.data = buf;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
samples_read += res / 4;
}
analyzer_read_stop(ctx->usb->devhdl);
g_free(buf);
packet.type = SR_DF_END;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
return SR_OK;
}
struct context *ctx;
packet.type = SR_DF_END;
- sr_session_bus(session_dev_id, &packet);
+ sr_session_send(session_dev_id, &packet);
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
sr_err("zp: %s: sdi was NULL", __func__);
gettimeofday(&header.starttime, NULL);
packet.type = SR_DF_HEADER;
packet.payload = &header;
- sr_session_bus(in->vdev, &packet);
+ sr_session_send(in->vdev, &packet);
/* chop up the input file into chunks and feed it into the session bus */
packet.type = SR_DF_LOGIC;
logic.data = buffer;
while ((size = read(fd, buffer, CHUNKSIZE)) > 0) {
logic.length = size;
- sr_session_bus(in->vdev, &packet);
+ sr_session_send(in->vdev, &packet);
}
close(fd);
/* end of stream */
packet.type = SR_DF_END;
- sr_session_bus(in->vdev, &packet);
+ sr_session_send(in->vdev, &packet);
return SR_OK;
}
gettimeofday(&header.starttime, NULL);
header.num_logic_probes = num_probes;
header.samplerate = samplerate;
- sr_session_bus(in->vdev, &packet);
+ sr_session_send(in->vdev, &packet);
/* TODO: Handle trigger point. */
/* TODO: Handle errors, handle incomplete reads. */
size = read(fd, buf, PACKET_SIZE);
logic.length = size;
- sr_session_bus(in->vdev, &packet);
+ sr_session_send(in->vdev, &packet);
}
close(fd); /* FIXME */
sr_dbg("la8 in: %s: sending SR_DF_END", __func__);
packet.type = SR_DF_END;
packet.payload = NULL;
- sr_session_bus(in->vdev, &packet);
+ sr_session_send(in->vdev, &packet);
return SR_OK;
}
* Hardware drivers use this to send a data packet to the frontend.
*
* @param dev TODO.
- * @param packet TODO.
+ * @param packet The datafeed packet to send to the session bus.
*
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
*/
-SR_PRIV int sr_session_bus(struct sr_dev *dev,
- struct sr_datafeed_packet *packet)
+SR_PRIV int sr_session_send(struct sr_dev *dev,
+ struct sr_datafeed_packet *packet)
{
GSList *l;
sr_datafeed_callback_t cb;
logic.unitsize = vdev->unitsize;
logic.data = buf;
vdev->bytes_read += ret;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
} else {
/* done with this capture file */
zip_fclose(vdev->capfile);
if (!got_data) {
packet.type = SR_DF_END;
- sr_session_bus(session_data, &packet);
+ sr_session_send(session_data, &packet);
}
return TRUE;
gettimeofday(&header->starttime, NULL);
header->samplerate = vdev->samplerate;
header->num_logic_probes = vdev->num_probes;
- sr_session_bus(session_dev_id, packet);
+ sr_session_send(session_dev_id, packet);
g_free(header);
g_free(packet);
/*--- session.c -------------------------------------------------------------*/
-SR_PRIV int sr_session_bus(struct sr_dev *dev,
- struct sr_datafeed_packet *packet);
+SR_PRIV int sr_session_send(struct sr_dev *dev,
+ struct sr_datafeed_packet *packet);
/* Generic device instances */
SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,