devc->submitted_transfers++;
}
- devc->send_data_proc = la_send_data_proc;
+ if (devc->profile->dev_caps & DEV_CAPS_AX_ANALOG)
+ devc->send_data_proc = mso_send_data_proc;
+ else
+ devc->send_data_proc = la_send_data_proc;
/* Send header packet to the session bus. */
std_session_send_df_header(sdi, LOG_PREFIX);
struct drv_context *drvc;
struct dev_context *devc;
int timeout, ret;
+ size_t size;
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
if (devc->dslogic) {
dslogic_trigger_request(sdi);
} else {
+ size = fx2lafw_get_buffer_size(devc);
+ /* Prepare for analog sampling. */
+ if (devc->profile->dev_caps & DEV_CAPS_AX_ANALOG) {
+ /* We need a buffer half the size of a transfer. */
+ devc->logic_buffer = g_try_malloc(size / 2);
+ devc->analog_buffer = g_try_malloc(
+ sizeof(float) * size / 2);
+ }
start_transfers(sdi);
if ((ret = fx2lafw_command_start_acquisition(sdi)) != SR_OK) {
fx2lafw_abort_acquisition(devc);
devc->num_transfers = 0;
g_free(devc->transfers);
+ /* Free the deinterlace buffers if we had them */
+ g_free(devc->logic_buffer);
+ g_free(devc->analog_buffer);
+
if (devc->stl) {
soft_trigger_logic_free(devc->stl);
devc->stl = NULL;
}
-SR_PRIV void la_send_data_proc(void *cb_data,
+SR_PRIV void mso_send_data_proc(struct dev_context *devc,
+ uint8_t *data, size_t length, size_t sample_width)
+{
+ size_t i;
+ sample_width = sample_width;
+ length /= 2;
+
+ sr_dbg("mso_send_data_proc length = %d", length);
+
+ /* Send the logic */
+ for(i = 0; i < length; i++) {
+ devc->logic_buffer[i] = data[i * 2];
+ devc->analog_buffer[i] = data[i * 2 + 1] - 128.0f;
+ };
+
+ const struct sr_datafeed_logic logic = {
+ .length = length,
+ .unitsize = 1,
+ .data = devc->logic_buffer
+ };
+
+ const struct sr_datafeed_packet logic_packet = {
+ .type = SR_DF_LOGIC,
+ .payload = &logic
+ };
+ sr_session_send(devc->cb_data, &logic_packet);
+
+ const struct sr_datafeed_analog_old analog = {
+ .num_samples = length,
+ .mq = SR_MQ_VOLTAGE,
+ .unit = SR_UNIT_VOLT,
+ .mqflags = SR_MQFLAG_DC,
+ .data = devc->analog_buffer
+ };
+
+ const struct sr_datafeed_packet analog_packet = {
+ .type = SR_DF_ANALOG_OLD,
+ .payload = &analog
+ };
+
+ sr_dbg("mso_send_data_proc length = %d", length);
+ sr_session_send(devc->cb_data, &analog_packet);
+
+}
+
+SR_PRIV void la_send_data_proc(struct dev_context *devc,
uint8_t *data, size_t length, size_t sample_width)
{
const struct sr_datafeed_logic logic = {
.payload = &logic
};
- sr_session_send(cb_data, &packet);
+ sr_session_send(devc->cb_data, &packet);
}
SR_PRIV void LIBUSB_CALL fx2lafw_receive_transfer(struct libusb_transfer *transfer)
else
num_samples = cur_sample_count;
- devc->send_data_proc(devc->cb_data,
+ devc->send_data_proc(devc,
(uint8_t*)transfer->buffer,
num_samples * unitsize,
unitsize);
num_samples > devc->limit_samples - devc->sent_samples)
num_samples = devc->limit_samples - devc->sent_samples;
- devc->send_data_proc(devc->cb_data,
+ devc->send_data_proc(devc,
(uint8_t*)transfer->buffer + trigger_offset * unitsize,
num_samples * unitsize,
unitsize);
unsigned int num_transfers;
struct libusb_transfer **transfers;
struct sr_context *ctx;
- void (*send_data_proc)(void *cb_data,
+ void (*send_data_proc)(struct dev_context *devc,
uint8_t *data, size_t length, size_t sample_width);
+ uint8_t *logic_buffer;
+ float *analog_buffer;
/* Is this a DSLogic? */
gboolean dslogic;
SR_PRIV size_t fx2lafw_get_buffer_size(struct dev_context *devc);
SR_PRIV unsigned int fx2lafw_get_number_of_transfers(struct dev_context *devc);
SR_PRIV unsigned int fx2lafw_get_timeout(struct dev_context *devc);
-SR_PRIV void la_send_data_proc(void *cb_data, uint8_t *data, size_t length,
+SR_PRIV void la_send_data_proc(struct dev_context *devc, uint8_t *data, size_t length,
+ size_t sample_width);
+SR_PRIV void mso_send_data_proc(struct dev_context *devc, uint8_t *data, size_t length,
size_t sample_width);
#endif