#define NUM_PROBES 16
SR_PRIV struct sr_dev_driver asix_sigma_driver_info;
-static struct sr_dev_driver *adi = &asix_sigma_driver_info;
+static struct sr_dev_driver *di = &asix_sigma_driver_info;
static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
static const uint64_t supported_samplerates[] = {
* (the cable has two additional GND pins, and a TI and TO pin)
*/
static const char *probe_names[NUM_PROBES + 1] = {
- "1",
- "2",
- "3",
- "4",
- "5",
- "6",
- "7",
- "8",
- "9",
- "10",
- "11",
- "12",
- "13",
- "14",
- "15",
- "16",
+ "1", "2", "3", "4", "5", "6", "7", "8",
+ "9", "10", "11", "12", "13", "14", "15", "16",
NULL,
};
struct drv_context *drvc;
struct dev_context *devc;
- drvc = adi->priv;
+ drvc = di->priv;
/* Properly close all devices. */
for (l = drvc->instances; l; l = l->next) {
return SR_OK;
}
-static int hw_init(void)
+static int hw_init(struct sr_context *sr_ctx)
{
struct drv_context *drvc;
sr_err("Driver context malloc failed.");
return SR_ERR_MALLOC;
}
- adi->priv = drvc;
+ drvc->sr_ctx = sr_ctx;
+ di->priv = drvc;
return SR_OK;
}
(void)options;
- drvc = adi->priv;
+ drvc = di->priv;
devices = NULL;
clear_instances();
sr_err("%s: sdi was NULL", __func__);
goto free;
}
- sdi->driver = adi;
+ sdi->driver = di;
for (i = 0; probe_names[i]; i++) {
- if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE,
+ if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE,
probe_names[i])))
return NULL;
sdi->probes = g_slist_append(sdi->probes, probe);
{
struct drv_context *drvc;
- drvc = adi->priv;
+ drvc = di->priv;
return drvc->instances;
}
int i, ret;
struct dev_context *devc = sdi->priv;
+ ret = SR_OK;
+
for (i = 0; supported_samplerates[i]; i++) {
if (supported_samplerates[i] == samplerate)
break;
}
devc->cur_samplerate = samplerate;
- devc->period_ps = 1000000000000 / samplerate;
+ devc->period_ps = 1000000000000ULL / samplerate;
devc->samples_per_event = 16 / devc->num_probes;
devc->state.state = SIGMA_IDLE;
static int hw_cleanup(void)
{
- if (!adi->priv)
+ if (!di->priv)
return SR_OK;
clear_instances();
case SR_DI_HWCAPS:
*data = hwcaps;
break;
- case SR_DI_NUM_PROBES:
- *data = GINT_TO_POINTER(NUM_PROBES);
- break;
- case SR_DI_PROBE_NAMES:
- *data = probe_names;
- break;
case SR_DI_SAMPLERATES:
*data = &samplerates;
break;
else
hw_dev_acquisition_stop(sdi, sdi);
- } else if (devc->state.state == SIGMA_DOWNLOAD) {
+ }
+
+ if (devc->state.state == SIGMA_DOWNLOAD) {
if (devc->state.chunks_downloaded >= numchunks) {
/* End of samples. */
packet.type = SR_DF_END;
struct dev_context *devc;
struct sr_datafeed_packet *packet;
struct sr_datafeed_header *header;
- struct sr_datafeed_meta_logic meta;
struct clockselect_50 clockselect;
int frac, triggerpin, ret;
- uint8_t triggerselect;
+ uint8_t triggerselect = 0;
struct triggerinout triggerinout_conf;
struct triggerlut lut;
gettimeofday(&header->starttime, NULL);
sr_session_send(devc->session_dev_id, packet);
- /* Send metadata about the SR_DF_LOGIC packets to come. */
- packet->type = SR_DF_META_LOGIC;
- packet->payload = &meta;
- meta.samplerate = devc->cur_samplerate;
- meta.num_probes = devc->num_probes;
- sr_session_send(devc->session_dev_id, packet);
-
/* Add capture source. */
sr_source_add(0, G_IO_IN, 10, receive_data, (void *)sdi);