sr: s/sr_session_bus/sr_session_send/.
This commit is contained in:
parent
d08490aaba
commit
31ccebc492
|
@ -281,14 +281,14 @@ static int receive_data(int fd, int revents, void *user_data)
|
||||||
packet.length = count * sample_size;
|
packet.length = count * sample_size;
|
||||||
packet.unitsize = sample_size;
|
packet.unitsize = sample_size;
|
||||||
packet.payload = outb;
|
packet.payload = outb;
|
||||||
sr_session_bus(user_data, &packet);
|
sr_session_send(user_data, &packet);
|
||||||
g_free(outb);
|
g_free(outb);
|
||||||
ctx->limit_samples -= count;
|
ctx->limit_samples -= count;
|
||||||
|
|
||||||
} while (ctx->limit_samples > 0);
|
} while (ctx->limit_samples > 0);
|
||||||
|
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(user_data, &packet);
|
sr_session_send(user_data, &packet);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_dev_id)
|
||||||
header.num_analog_probes = NUM_PROBES;
|
header.num_analog_probes = NUM_PROBES;
|
||||||
header.num_logic_probes = 0;
|
header.num_logic_probes = 0;
|
||||||
header.protocol_id = SR_PROTO_RAW;
|
header.protocol_id = SR_PROTO_RAW;
|
||||||
sr_session_bus(session_dev_id, &packet);
|
sr_session_send(session_dev_id, &packet);
|
||||||
g_free(ufds);
|
g_free(ufds);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
|
|
|
@ -935,7 +935,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
|
||||||
logic.length = tosend * sizeof(uint16_t);
|
logic.length = tosend * sizeof(uint16_t);
|
||||||
logic.unitsize = 2;
|
logic.unitsize = 2;
|
||||||
logic.data = samples + sent;
|
logic.data = samples + sent;
|
||||||
sr_session_bus(ctx->session_id, &packet);
|
sr_session_send(ctx->session_id, &packet);
|
||||||
|
|
||||||
sent += tosend;
|
sent += tosend;
|
||||||
}
|
}
|
||||||
|
@ -978,7 +978,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
|
||||||
logic.length = tosend * sizeof(uint16_t);
|
logic.length = tosend * sizeof(uint16_t);
|
||||||
logic.unitsize = 2;
|
logic.unitsize = 2;
|
||||||
logic.data = samples;
|
logic.data = samples;
|
||||||
sr_session_bus(ctx->session_id, &packet);
|
sr_session_send(ctx->session_id, &packet);
|
||||||
|
|
||||||
sent += tosend;
|
sent += tosend;
|
||||||
}
|
}
|
||||||
|
@ -986,7 +986,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
|
||||||
/* Only send trigger if explicitly enabled. */
|
/* Only send trigger if explicitly enabled. */
|
||||||
if (ctx->use_triggers) {
|
if (ctx->use_triggers) {
|
||||||
packet.type = SR_DF_TRIGGER;
|
packet.type = SR_DF_TRIGGER;
|
||||||
sr_session_bus(ctx->session_id, &packet);
|
sr_session_send(ctx->session_id, &packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,7 +999,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
|
||||||
logic.length = tosend * sizeof(uint16_t);
|
logic.length = tosend * sizeof(uint16_t);
|
||||||
logic.unitsize = 2;
|
logic.unitsize = 2;
|
||||||
logic.data = samples + sent;
|
logic.data = samples + sent;
|
||||||
sr_session_bus(ctx->session_id, &packet);
|
sr_session_send(ctx->session_id, &packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
*lastsample = samples[n - 1];
|
*lastsample = samples[n - 1];
|
||||||
|
@ -1044,7 +1044,7 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
if (ctx->state.chunks_downloaded >= numchunks) {
|
if (ctx->state.chunks_downloaded >= numchunks) {
|
||||||
/* End of samples. */
|
/* End of samples. */
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(ctx->session_id, &packet);
|
sr_session_send(ctx->session_id, &packet);
|
||||||
|
|
||||||
ctx->state.state = SIGMA_IDLE;
|
ctx->state.state = SIGMA_IDLE;
|
||||||
|
|
||||||
|
@ -1361,7 +1361,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
|
||||||
gettimeofday(&header.starttime, NULL);
|
gettimeofday(&header.starttime, NULL);
|
||||||
header.samplerate = ctx->cur_samplerate;
|
header.samplerate = ctx->cur_samplerate;
|
||||||
header.num_logic_probes = ctx->num_probes;
|
header.num_logic_probes = ctx->num_probes;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
|
|
||||||
/* Add capture source. */
|
/* Add capture source. */
|
||||||
sr_source_add(0, G_IO_IN, 10, receive_data, sdi);
|
sr_source_add(0, G_IO_IN, 10, receive_data, sdi);
|
||||||
|
|
|
@ -912,7 +912,7 @@ static void send_block_to_session_bus(struct context *ctx, int block)
|
||||||
logic.length = BS;
|
logic.length = BS;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
logic.data = ctx->final_buf + (block * BS);
|
logic.data = ctx->final_buf + (block * BS);
|
||||||
sr_session_bus(ctx->session_id, &packet);
|
sr_session_send(ctx->session_id, &packet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,7 +935,7 @@ static void send_block_to_session_bus(struct context *ctx, int block)
|
||||||
logic.length = trigger_point;
|
logic.length = trigger_point;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
logic.data = ctx->final_buf + (block * BS);
|
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. */
|
/* Send the SR_DF_TRIGGER packet to the session bus. */
|
||||||
|
@ -943,7 +943,7 @@ static void send_block_to_session_bus(struct context *ctx, int block)
|
||||||
(block * BS) + trigger_point);
|
(block * BS) + trigger_point);
|
||||||
packet.type = SR_DF_TRIGGER;
|
packet.type = SR_DF_TRIGGER;
|
||||||
packet.payload = NULL;
|
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 at least one sample is located after the trigger... */
|
||||||
if (trigger_point < (BS - 1)) {
|
if (trigger_point < (BS - 1)) {
|
||||||
|
@ -956,7 +956,7 @@ static void send_block_to_session_bus(struct context *ctx, int block)
|
||||||
logic.length = BS - trigger_point;
|
logic.length = BS - trigger_point;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
logic.data = ctx->final_buf + (block * BS) + trigger_point;
|
logic.data = ctx->final_buf + (block * BS) + trigger_point;
|
||||||
sr_session_bus(ctx->session_id, &packet);
|
sr_session_send(ctx->session_id, &packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1071,7 +1071,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
|
||||||
gettimeofday(&header.starttime, NULL);
|
gettimeofday(&header.starttime, NULL);
|
||||||
header.samplerate = ctx->cur_samplerate;
|
header.samplerate = ctx->cur_samplerate;
|
||||||
header.num_logic_probes = NUM_PROBES;
|
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). */
|
/* Time when we should be done (for detecting trigger timeouts). */
|
||||||
ctx->done = (ctx->divcount + 1) * 0.08388608 + time(NULL)
|
ctx->done = (ctx->divcount + 1) * 0.08388608 + time(NULL)
|
||||||
|
@ -1106,7 +1106,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
|
||||||
/* Send end packet to the session bus. */
|
/* Send end packet to the session bus. */
|
||||||
sr_dbg("la8: Sending SR_DF_END.");
|
sr_dbg("la8: Sending SR_DF_END.");
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
logic.length = z;
|
logic.length = z;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
logic.data = c;
|
logic.data = c;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
samples_received += z;
|
samples_received += z;
|
||||||
}
|
}
|
||||||
} while (z > 0);
|
} while (z > 0);
|
||||||
|
@ -401,7 +401,7 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
|
|
||||||
/* Send last packet. */
|
/* Send last packet. */
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
|
||||||
gettimeofday(&header->starttime, NULL);
|
gettimeofday(&header->starttime, NULL);
|
||||||
header->samplerate = cur_samplerate;
|
header->samplerate = cur_samplerate;
|
||||||
header->num_logic_probes = NUM_PROBES;
|
header->num_logic_probes = NUM_PROBES;
|
||||||
sr_session_bus(session_data, packet);
|
sr_session_send(session_data, packet);
|
||||||
g_free(header);
|
g_free(header);
|
||||||
g_free(packet);
|
g_free(packet);
|
||||||
|
|
||||||
|
|
|
@ -565,7 +565,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
|
||||||
logic.length = cur_buflen;
|
logic.length = cur_buflen;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
logic.data = cur_buf;
|
logic.data = cur_buf;
|
||||||
sr_session_bus(ctx->session_data, &packet);
|
sr_session_send(ctx->session_data, &packet);
|
||||||
g_free(cur_buf);
|
g_free(cur_buf);
|
||||||
|
|
||||||
num_samples += cur_buflen;
|
num_samples += cur_buflen;
|
||||||
|
@ -633,7 +633,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
|
||||||
gettimeofday(&header->starttime, NULL);
|
gettimeofday(&header->starttime, NULL);
|
||||||
header->samplerate = 24000000UL;
|
header->samplerate = 24000000UL;
|
||||||
header->num_logic_probes = ctx->profile->num_probes;
|
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(header);
|
||||||
g_free(packet);
|
g_free(packet);
|
||||||
|
|
||||||
|
@ -649,7 +649,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
|
||||||
(void)dev_index;
|
(void)dev_index;
|
||||||
|
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
|
|
||||||
receive_transfer(NULL);
|
receive_transfer(NULL);
|
||||||
|
|
||||||
|
|
|
@ -731,7 +731,7 @@ static int receive_data(int fd, int revents, void *user_data)
|
||||||
logic.length = 1024;
|
logic.length = 1024;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
logic.data = logic_out;
|
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"
|
// Dont bother fixing this yet, keep it "old style"
|
||||||
/*
|
/*
|
||||||
|
@ -739,11 +739,11 @@ static int receive_data(int fd, int revents, void *user_data)
|
||||||
packet.length = 1024;
|
packet.length = 1024;
|
||||||
packet.unitsize = sizeof(double);
|
packet.unitsize = sizeof(double);
|
||||||
packet.payload = analog_out;
|
packet.payload = analog_out;
|
||||||
sr_session_bus(ctx->session_id, &packet);
|
sr_session_send(ctx->session_id, &packet);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(ctx->session_id, &packet);
|
sr_session_send(ctx->session_id, &packet);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -816,7 +816,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_dev_id)
|
||||||
header.samplerate = ctx->cur_rate;
|
header.samplerate = ctx->cur_rate;
|
||||||
// header.num_analog_probes = 1;
|
// header.num_analog_probes = 1;
|
||||||
header.num_logic_probes = 8;
|
header.num_logic_probes = 8;
|
||||||
sr_session_bus(session_dev_id, &packet);
|
sr_session_send(session_dev_id, &packet);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -829,7 +829,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id)
|
||||||
dev_index = dev_index;
|
dev_index = dev_index;
|
||||||
|
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(session_dev_id, &packet);
|
sr_session_send(session_dev_id, &packet);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -834,12 +834,12 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
logic.unitsize = 4;
|
logic.unitsize = 4;
|
||||||
logic.data = ctx->raw_sample_buf +
|
logic.data = ctx->raw_sample_buf +
|
||||||
(ctx->limit_samples - ctx->num_samples) * 4;
|
(ctx->limit_samples - ctx->num_samples) * 4;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send the trigger */
|
/* send the trigger */
|
||||||
packet.type = SR_DF_TRIGGER;
|
packet.type = SR_DF_TRIGGER;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
|
|
||||||
/* send post-trigger samples */
|
/* send post-trigger samples */
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
|
@ -848,7 +848,7 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
logic.unitsize = 4;
|
logic.unitsize = 4;
|
||||||
logic.data = ctx->raw_sample_buf + ctx->trigger_at * 4 +
|
logic.data = ctx->raw_sample_buf + ctx->trigger_at * 4 +
|
||||||
(ctx->limit_samples - ctx->num_samples) * 4;
|
(ctx->limit_samples - ctx->num_samples) * 4;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
} else {
|
} else {
|
||||||
/* no trigger was used */
|
/* no trigger was used */
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
|
@ -857,14 +857,14 @@ static int receive_data(int fd, int revents, void *session_data)
|
||||||
logic.unitsize = 4;
|
logic.unitsize = 4;
|
||||||
logic.data = ctx->raw_sample_buf +
|
logic.data = ctx->raw_sample_buf +
|
||||||
(ctx->limit_samples - ctx->num_samples) * 4;
|
(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);
|
g_free(ctx->raw_sample_buf);
|
||||||
|
|
||||||
serial_flush(fd);
|
serial_flush(fd);
|
||||||
serial_close(fd);
|
serial_close(fd);
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1015,7 +1015,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
|
||||||
gettimeofday(&header->starttime, NULL);
|
gettimeofday(&header->starttime, NULL);
|
||||||
header->samplerate = ctx->cur_samplerate;
|
header->samplerate = ctx->cur_samplerate;
|
||||||
header->num_logic_probes = NUM_PROBES;
|
header->num_logic_probes = NUM_PROBES;
|
||||||
sr_session_bus(session_data, packet);
|
sr_session_send(session_data, packet);
|
||||||
|
|
||||||
g_free(header);
|
g_free(header);
|
||||||
g_free(packet);
|
g_free(packet);
|
||||||
|
@ -1031,7 +1031,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id)
|
||||||
(void)dev_index;
|
(void)dev_index;
|
||||||
|
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(session_dev_id, &packet);
|
sr_session_send(session_dev_id, &packet);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -752,7 +752,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
|
||||||
*/
|
*/
|
||||||
packet.type = SR_DF_TRIGGER;
|
packet.type = SR_DF_TRIGGER;
|
||||||
packet.payload = NULL;
|
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
|
* Send the samples that triggered it, since we're
|
||||||
|
@ -763,7 +763,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
|
||||||
logic.length = ctx->trigger_stage;
|
logic.length = ctx->trigger_stage;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
logic.data = ctx->trigger_buffer;
|
logic.data = ctx->trigger_buffer;
|
||||||
sr_session_bus(ctx->session_data, &packet);
|
sr_session_send(ctx->session_data, &packet);
|
||||||
|
|
||||||
ctx->trigger_stage = TRIGGER_FIRED;
|
ctx->trigger_stage = TRIGGER_FIRED;
|
||||||
break;
|
break;
|
||||||
|
@ -795,7 +795,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
|
||||||
logic.length = cur_buflen - trigger_offset;
|
logic.length = cur_buflen - trigger_offset;
|
||||||
logic.unitsize = 1;
|
logic.unitsize = 1;
|
||||||
logic.data = cur_buf + trigger_offset;
|
logic.data = cur_buf + trigger_offset;
|
||||||
sr_session_bus(ctx->session_data, &packet);
|
sr_session_send(ctx->session_data, &packet);
|
||||||
g_free(cur_buf);
|
g_free(cur_buf);
|
||||||
|
|
||||||
num_samples += cur_buflen;
|
num_samples += cur_buflen;
|
||||||
|
@ -868,7 +868,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
|
||||||
gettimeofday(&header->starttime, NULL);
|
gettimeofday(&header->starttime, NULL);
|
||||||
header->samplerate = ctx->cur_samplerate;
|
header->samplerate = ctx->cur_samplerate;
|
||||||
header->num_logic_probes = ctx->profile->num_probes;
|
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(header);
|
||||||
g_free(packet);
|
g_free(packet);
|
||||||
|
|
||||||
|
@ -884,7 +884,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
|
||||||
(void)dev_index;
|
(void)dev_index;
|
||||||
|
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
|
|
||||||
receive_transfer(NULL);
|
receive_transfer(NULL);
|
||||||
|
|
||||||
|
|
|
@ -655,7 +655,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
|
||||||
gettimeofday(&header.starttime, NULL);
|
gettimeofday(&header.starttime, NULL);
|
||||||
header.samplerate = ctx->cur_samplerate;
|
header.samplerate = ctx->cur_samplerate;
|
||||||
header.num_logic_probes = ctx->num_channels;
|
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))) {
|
if (!(buf = g_try_malloc(PACKET_SIZE))) {
|
||||||
sr_err("zp: %s: buf malloc failed", __func__);
|
sr_err("zp: %s: buf malloc failed", __func__);
|
||||||
|
@ -676,14 +676,14 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
|
||||||
logic.length = PACKET_SIZE;
|
logic.length = PACKET_SIZE;
|
||||||
logic.unitsize = 4;
|
logic.unitsize = 4;
|
||||||
logic.data = buf;
|
logic.data = buf;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
samples_read += res / 4;
|
samples_read += res / 4;
|
||||||
}
|
}
|
||||||
analyzer_read_stop(ctx->usb->devhdl);
|
analyzer_read_stop(ctx->usb->devhdl);
|
||||||
g_free(buf);
|
g_free(buf);
|
||||||
|
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
@ -696,7 +696,7 @@ static int hw_dev_acquisition_stop(int dev_index, gpointer session_dev_id)
|
||||||
struct context *ctx;
|
struct context *ctx;
|
||||||
|
|
||||||
packet.type = SR_DF_END;
|
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))) {
|
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
|
||||||
sr_err("zp: %s: sdi was NULL", __func__);
|
sr_err("zp: %s: sdi was NULL", __func__);
|
||||||
|
|
|
@ -83,7 +83,7 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
gettimeofday(&header.starttime, NULL);
|
gettimeofday(&header.starttime, NULL);
|
||||||
packet.type = SR_DF_HEADER;
|
packet.type = SR_DF_HEADER;
|
||||||
packet.payload = &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 */
|
/* chop up the input file into chunks and feed it into the session bus */
|
||||||
packet.type = SR_DF_LOGIC;
|
packet.type = SR_DF_LOGIC;
|
||||||
|
@ -92,13 +92,13 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
logic.data = buffer;
|
logic.data = buffer;
|
||||||
while ((size = read(fd, buffer, CHUNKSIZE)) > 0) {
|
while ((size = read(fd, buffer, CHUNKSIZE)) > 0) {
|
||||||
logic.length = size;
|
logic.length = size;
|
||||||
sr_session_bus(in->vdev, &packet);
|
sr_session_send(in->vdev, &packet);
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
/* end of stream */
|
/* end of stream */
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(in->vdev, &packet);
|
sr_session_send(in->vdev, &packet);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
gettimeofday(&header.starttime, NULL);
|
gettimeofday(&header.starttime, NULL);
|
||||||
header.num_logic_probes = num_probes;
|
header.num_logic_probes = num_probes;
|
||||||
header.samplerate = samplerate;
|
header.samplerate = samplerate;
|
||||||
sr_session_bus(in->vdev, &packet);
|
sr_session_send(in->vdev, &packet);
|
||||||
|
|
||||||
/* TODO: Handle trigger point. */
|
/* TODO: Handle trigger point. */
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
/* TODO: Handle errors, handle incomplete reads. */
|
/* TODO: Handle errors, handle incomplete reads. */
|
||||||
size = read(fd, buf, PACKET_SIZE);
|
size = read(fd, buf, PACKET_SIZE);
|
||||||
logic.length = size;
|
logic.length = size;
|
||||||
sr_session_bus(in->vdev, &packet);
|
sr_session_send(in->vdev, &packet);
|
||||||
}
|
}
|
||||||
close(fd); /* FIXME */
|
close(fd); /* FIXME */
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ static int loadfile(struct sr_input *in, const char *filename)
|
||||||
sr_dbg("la8 in: %s: sending SR_DF_END", __func__);
|
sr_dbg("la8 in: %s: sending SR_DF_END", __func__);
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
packet.payload = NULL;
|
packet.payload = NULL;
|
||||||
sr_session_bus(in->vdev, &packet);
|
sr_session_send(in->vdev, &packet);
|
||||||
|
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,12 +419,12 @@ static void datafeed_dump(struct sr_datafeed_packet *packet)
|
||||||
* Hardware drivers use this to send a data packet to the frontend.
|
* Hardware drivers use this to send a data packet to the frontend.
|
||||||
*
|
*
|
||||||
* @param dev TODO.
|
* @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.
|
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
|
||||||
*/
|
*/
|
||||||
SR_PRIV int sr_session_bus(struct sr_dev *dev,
|
SR_PRIV int sr_session_send(struct sr_dev *dev,
|
||||||
struct sr_datafeed_packet *packet)
|
struct sr_datafeed_packet *packet)
|
||||||
{
|
{
|
||||||
GSList *l;
|
GSList *l;
|
||||||
sr_datafeed_callback_t cb;
|
sr_datafeed_callback_t cb;
|
||||||
|
|
|
@ -120,7 +120,7 @@ static int feed_chunk(int fd, int revents, void *session_data)
|
||||||
logic.unitsize = vdev->unitsize;
|
logic.unitsize = vdev->unitsize;
|
||||||
logic.data = buf;
|
logic.data = buf;
|
||||||
vdev->bytes_read += ret;
|
vdev->bytes_read += ret;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
} else {
|
} else {
|
||||||
/* done with this capture file */
|
/* done with this capture file */
|
||||||
zip_fclose(vdev->capfile);
|
zip_fclose(vdev->capfile);
|
||||||
|
@ -132,7 +132,7 @@ static int feed_chunk(int fd, int revents, void *session_data)
|
||||||
|
|
||||||
if (!got_data) {
|
if (!got_data) {
|
||||||
packet.type = SR_DF_END;
|
packet.type = SR_DF_END;
|
||||||
sr_session_bus(session_data, &packet);
|
sr_session_send(session_data, &packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -324,7 +324,7 @@ static int hw_dev_acquisition_start(int dev_index, gpointer session_dev_id)
|
||||||
gettimeofday(&header->starttime, NULL);
|
gettimeofday(&header->starttime, NULL);
|
||||||
header->samplerate = vdev->samplerate;
|
header->samplerate = vdev->samplerate;
|
||||||
header->num_logic_probes = vdev->num_probes;
|
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(header);
|
||||||
g_free(packet);
|
g_free(packet);
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,8 @@ SR_PRIV void sr_hw_cleanup_all(void);
|
||||||
|
|
||||||
/*--- session.c -------------------------------------------------------------*/
|
/*--- session.c -------------------------------------------------------------*/
|
||||||
|
|
||||||
SR_PRIV int sr_session_bus(struct sr_dev *dev,
|
SR_PRIV int sr_session_send(struct sr_dev *dev,
|
||||||
struct sr_datafeed_packet *packet);
|
struct sr_datafeed_packet *packet);
|
||||||
|
|
||||||
/* Generic device instances */
|
/* Generic device instances */
|
||||||
SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,
|
SR_PRIV struct sr_dev_inst *sr_dev_inst_new(int index, int status,
|
||||||
|
|
Loading…
Reference in New Issue