X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Flink-mso19%2Fapi.c;h=13c2972001a506627ea325f1c35467606d751a14;hb=43cd4637285833706f8a404ca027bcf0ee75b9ae;hp=a657e27008b398a4a61331962bb8ebffe72b4d33;hpb=660e398fe9f5fc608787f8fd75a9df8aac61026f;p=libsigrok.git diff --git a/hardware/link-mso19/api.c b/hardware/link-mso19/api.c index a657e270..13c29720 100644 --- a/hardware/link-mso19/api.c +++ b/hardware/link-mso19/api.c @@ -25,6 +25,7 @@ static const int32_t hwcaps[] = { SR_CONF_OSCILLOSCOPE, SR_CONF_LOGIC_ANALYZER, SR_CONF_SAMPLERATE, + SR_CONF_TRIGGER_TYPE, SR_CONF_TRIGGER_SLOPE, SR_CONF_HORIZ_TRIGGERPOS, // SR_CONF_CAPTURE_RATIO, @@ -33,11 +34,11 @@ static const int32_t hwcaps[] = { }; /* - * Probes are numbered 0 to 7. + * Channels are numbered 0 to 7. * * See also: http://www.linkinstruments.com/images/mso19_1113.gif */ -SR_PRIV const char *mso19_probe_names[NUM_PROBES + 1] = { +SR_PRIV const char *mso19_channel_names[NUM_CHANNELS + 1] = { /* Note: DSO needs to be first. */ "DSO", "0", "1", "2", "3", "4", "5", "6", "7", NULL, }; @@ -101,7 +102,7 @@ static GSList *scan(GSList *options) GSList *l; struct sr_config *src; struct udev *udev; - int ptype; + int chtype; for (l = options; l; l = l->next) { src = l->data; @@ -216,13 +217,13 @@ static GSList *scan(GSList *options) sdi->driver = di; sdi->priv = devc; - for (i = 0; i < NUM_PROBES; i++) { - struct sr_probe *probe; - ptype = (i == 0) ? SR_PROBE_ANALOG : SR_PROBE_LOGIC; - if (!(probe = sr_probe_new(i, ptype, TRUE, - mso19_probe_names[i]))) + for (i = 0; i < NUM_CHANNELS; i++) { + struct sr_channel *ch; + chtype = (i == 0) ? SR_CHANNEL_ANALOG : SR_CHANNEL_LOGIC; + if (!(ch = sr_channel_new(i, chtype, TRUE, + mso19_channel_names[i]))) return 0; - sdi->probes = g_slist_append(sdi->probes, probe); + sdi->channels = g_slist_append(sdi->channels, ch); } //Add the driver @@ -276,11 +277,11 @@ static int cleanup(void) } static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, - const struct sr_channel_group *channel_group) + const struct sr_channel_group *cg) { struct dev_context *devc; - (void)channel_group; + (void)cg; switch (id) { case SR_CONF_SAMPLERATE: @@ -298,7 +299,7 @@ static int config_get(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 *channel_group) + const struct sr_channel_group *cg) { int ret; struct dev_context *devc; @@ -307,7 +308,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, int trigger_pos; double pos; - (void)channel_group; + (void)cg; devc = sdi->priv; if (sdi->status != SR_ST_ACTIVE) @@ -369,12 +370,12 @@ static int config_set(int id, 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 *channel_group) + const struct sr_channel_group *cg) { GVariant *gvar; GVariantBuilder gvb; - (void)channel_group; + (void)cg; (void)sdi; switch (key) { @@ -409,8 +410,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) devc = sdi->priv; - if (mso_configure_probes(sdi) != SR_OK) { - sr_err("Failed to configure probes."); + if (mso_configure_channels(sdi) != SR_OK) { + sr_err("Failed to configure channels."); return SR_ERR; } @@ -457,10 +458,11 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) /* Send header packet to the session bus. */ std_session_send_df_header(cb_data, LOG_PREFIX); - /* Our first probe is analog, the other 8 are of type 'logic'. */ + /* Our first channel is analog, the other 8 are of type 'logic'. */ /* TODO. */ - serial_source_add(devc->serial, G_IO_IN, -1, mso_receive_data, cb_data); + serial_source_add(sdi->session, devc->serial, G_IO_IN, -1, + mso_receive_data, cb_data); return SR_OK; }