static void stop_acquisition(struct sr_dev_inst *sdi)
{
+ struct drv_context *drvc = sdi->driver->priv;
struct dev_context *devc;
struct sr_datafeed_packet packet;
- unsigned int i;
devc = sdi->priv;
/* Remove USB file descriptors from polling. */
- for (i = 0; i < devc->num_usbfd; i++)
- sr_source_remove(devc->usbfd[i]);
-
- g_free(devc->usbfd);
+ usb_source_remove(drvc->sr_ctx);
packet.type = SR_DF_END;
sr_session_send(devc->cb_data, &packet);
static void abort_acquisition(struct sr_dev_inst *sdi)
{
+ struct drv_context *drvc = sdi->driver->priv;
struct dev_context *devc;
struct sr_datafeed_packet packet;
- unsigned int i;
devc = sdi->priv;
/* Remove USB file descriptors from polling. */
- for (i = 0; i < devc->num_usbfd; i++)
- sr_source_remove(devc->usbfd[i]);
-
- g_free(devc->usbfd);
+ usb_source_remove(drvc->sr_ctx);
packet.type = SR_DF_END;
sr_session_send(devc->cb_data, &packet);
devc = sdi->priv;
- if (devc->probes[devc->channel]->enabled) {
+ if (devc->channels[devc->channel]->enabled) {
offset = devc->sample_packet * PACKET_NUM_SAMPLE_BYTES;
/*
* enabled one for an uniform access to them. Note that the currently
* received samples always belong to the last enabled channel.
*/
- for (i = 0; i < devc->num_enabled_probes - 1; i++)
- ptr[i] = devc->sample_buffer[devc->probe_map[i]] + offset;
+ for (i = 0; i < devc->num_enabled_channels - 1; i++)
+ ptr[i] = devc->sample_buffer[devc->channel_map[i]] + offset;
/*
* Skip the first 4 bytes of the buffer because they contain channel
/*
* Adjust the position of the first sample to be
* processed because possibly more samples than
- * necessary might have been aquired. This is because
- * the number of aquired samples is always rounded up
+ * necessary might have been acquired. This is because
+ * the number of acquired samples is always rounded up
* to a multiple of 8.
*/
k = k - (devc->pre_trigger_bytes * 8) +
* Extract the current sample for each enabled channel
* and store them in the buffer.
*/
- for (j = 0; j < devc->num_enabled_probes; j++) {
+ for (j = 0; j < devc->num_enabled_channels; j++) {
tmp = (ptr[j][i] & (1 << k)) >> k;
- buffer[n] |= tmp << devc->probe_map[j];
+ buffer[n] |= tmp << devc->channel_map[j];
}
n++;
devc->wait_data_ready_time = g_get_monotonic_time();
}
} else if (devc->state == STATE_RECEIVE_DATA) {
- last_channel = devc->probe_map[devc->num_enabled_probes - 1];
+ last_channel = devc->channel_map[devc->num_enabled_channels - 1];
if (devc->channel < last_channel) {
buffer_sample_data(sdi);
} else {
/*
* Stop acquisition because all samples of enabled
- * probes are processed.
+ * channels are processed.
*/
devc->next_state = STATE_RESET_AND_IDLE;
}
SR_PRIV void sl2_configure_trigger(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
- struct sr_probe *probe;
+ struct sr_channel *ch;
uint8_t trigger_type;
- int probe_index, num_triggers_anyedge;
+ int channel_index, num_triggers_anyedge;
char *trigger;
GSList *l;
num_triggers_anyedge = 0;
- for (l = sdi->probes, probe_index = 0; l; l = l->next, probe_index++) {
- probe = l->data;
- trigger = probe->trigger;
+ for (l = sdi->channels, channel_index = 0; l; l = l->next, channel_index++) {
+ ch = l->data;
+ trigger = ch->trigger;
- if (!trigger || !probe->enabled)
+ if (!trigger || !ch->enabled)
continue;
switch (*trigger) {
continue;
}
- devc->trigger_channel = probe_index + 1;
+ devc->trigger_channel = channel_index + 1;
devc->trigger_type = trigger_type;
}
SR_PRIV int sl2_transfer_in(libusb_device_handle *dev_handle, uint8_t *data)
{
return libusb_control_transfer(dev_handle, USB_REQUEST_TYPE_IN,
- USB_HID_SET_REPORT, USB_HID_REPORT_TYPE_FEATURE, USB_INTERFACE,
+ USB_HID_GET_REPORT, USB_HID_REPORT_TYPE_FEATURE, USB_INTERFACE,
(unsigned char *)data, PACKET_LENGTH, USB_TIMEOUT);
}