X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=hardware%2Fikalogic-scanaplus%2Fapi.c;h=3f8276305bbfcaa4688a0569b25ca459307c730f;hp=7f1109a8fda1f9bdc1ecdbae658380b860825134;hb=43cd4637285833706f8a404ca027bcf0ee75b9ae;hpb=ab4bb6eb7c6d7ab2eb212088a764fb696726c8dc diff --git a/hardware/ikalogic-scanaplus/api.c b/hardware/ikalogic-scanaplus/api.c index 7f1109a8..3f827630 100644 --- a/hardware/ikalogic-scanaplus/api.c +++ b/hardware/ikalogic-scanaplus/api.c @@ -22,7 +22,7 @@ #define USB_VENDOR_ID 0x0403 #define USB_DEVICE_ID 0x6014 -#define USB_VENDOR_NAME "Ikalogic" +#define USB_VENDOR_NAME "IKALOGIC" #define USB_MODEL_NAME "ScanaPLUS" #define USB_IPRODUCT "SCANAPLUS" @@ -36,13 +36,13 @@ static const int32_t hwcaps[] = { SR_CONF_CONTINUOUS, // TODO? }; -/* Probes are numbered 1-9. */ -static const char *probe_names[] = { +/* Channels are numbered 1-9. */ +static const char *channel_names[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL, }; -/* Note: The Ikalogic ScanaPLUS always samples at 100MHz. */ +/* Note: The IKALOGIC ScanaPLUS always samples at 100MHz. */ static uint64_t samplerates[1] = { SR_MHZ(100) }; SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info; @@ -74,7 +74,7 @@ static int init(struct sr_context *sr_ctx) static GSList *scan(GSList *options) { struct sr_dev_inst *sdi; - struct sr_probe *probe; + struct sr_channel *ch; struct drv_context *drvc; struct dev_context *devc; GSList *devices; @@ -132,11 +132,11 @@ static GSList *scan(GSList *options) sdi->driver = di; sdi->priv = devc; - for (i = 0; probe_names[i]; i++) { - if (!(probe = sr_probe_new(i, SR_PROBE_LOGIC, TRUE, - probe_names[i]))) + for (i = 0; channel_names[i]; i++) { + if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE, + channel_names[i]))) return NULL; - sdi->probes = g_slist_append(sdi->probes, probe); + sdi->channels = g_slist_append(sdi->channels, ch); } devices = g_slist_append(devices, sdi); @@ -279,9 +279,11 @@ static int cleanup(void) return dev_clear(); } -static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi) +static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg) { (void)sdi; + (void)cg; switch (id) { case SR_CONF_SAMPLERATE: @@ -295,10 +297,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi) return SR_OK; } -static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi) +static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg) { struct dev_context *devc; + (void)cg; + if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; @@ -329,12 +334,14 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi) return SR_OK; } -static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi) +static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, + const struct sr_channel_group *cg) { GVariant *gvar; GVariantBuilder gvb; (void)sdi; + (void)cg; switch (key) { case SR_CONF_DEVICE_OPTIONS: @@ -370,7 +377,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) if (!devc->ftdic) return SR_ERR_BUG; - /* TODO: Configure probes later (thresholds etc.). */ + /* TODO: Configure channels later (thresholds etc.). */ devc->cb_data = cb_data; @@ -386,10 +393,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) return ret; /* Send header packet to the session bus. */ - std_session_send_df_header(cb_data, LOG_PREFIX); + std_session_send_df_header(sdi, LOG_PREFIX); /* Hook up a dummy handler to receive data from the device. */ - sr_source_add(-1, G_IO_IN, 0, scanaplus_receive_data, (void *)sdi); + sr_session_source_add(sdi->session, -1, G_IO_IN, 0, scanaplus_receive_data, (void *)sdi); return SR_OK; } @@ -398,22 +405,22 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) { struct sr_datafeed_packet packet; - (void)sdi; + (void)cb_data; sr_dbg("Stopping acquisition."); - sr_source_remove(-1); + sr_session_source_remove(sdi->session, -1); /* Send end packet to the session bus. */ sr_dbg("Sending SR_DF_END."); packet.type = SR_DF_END; - sr_session_send(cb_data, &packet); + sr_session_send(sdi, &packet); return SR_OK; } SR_PRIV struct sr_dev_driver ikalogic_scanaplus_driver_info = { .name = "ikalogic-scanaplus", - .longname = "Ikalogic ScanaPLUS", + .longname = "IKALOGIC ScanaPLUS", .api_version = 1, .init = init, .cleanup = cleanup,