X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ffx2lafw%2Fapi.c;h=4665bca2419deae0f0347e6e2aa5039462ef04d0;hb=6ee37801751a6e76e6b5865d1b3c88b9d342fe53;hp=dc085266d1129236d1eca0bfb3f32d76c0acd647;hpb=4be5746d1dd2796aa10f0c45440005d28a554901;p=libsigrok.git diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index dc085266..4665bca2 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -105,6 +105,13 @@ static const struct fx2lafw_profile supported_fx2[] = { "fx2lafw-sigrok-fx2-16ch.fw", DEV_CAPS_16BIT, NULL, NULL }, + /* + * usb-c-grok + */ + { 0x1d50, 0x608f, "sigrok", "usb-c-grok", NULL, + "fx2lafw-usb-c-grok.fw", + 0, NULL, NULL}, + ALL_ZERO }; @@ -118,6 +125,7 @@ static const uint32_t drvopts[] = { static const uint32_t devopts[] = { SR_CONF_CONTINUOUS, + SR_CONF_LIMIT_FRAMES | SR_CONF_GET | SR_CONF_SET, SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET, SR_CONF_CONN | SR_CONF_GET, SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST, @@ -150,6 +158,7 @@ static const uint64_t samplerates[] = { SR_MHZ(12), SR_MHZ(16), SR_MHZ(24), + SR_MHZ(48), }; static gboolean is_plausible(const struct libusb_device_descriptor *des) @@ -297,15 +306,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) num_analog_channels = prof->dev_caps & DEV_CAPS_AX_ANALOG ? 1 : 0; /* Logic channels, all in one channel group. */ - cg = g_malloc0(sizeof(struct sr_channel_group)); - cg->name = g_strdup("Logic"); + cg = sr_channel_group_new(sdi, "Logic", NULL); for (j = 0; j < num_logic_channels; j++) { sprintf(channel_name, "D%d", j); ch = sr_channel_new(sdi, j, SR_CHANNEL_LOGIC, TRUE, channel_name); cg->channels = g_slist_append(cg->channels, ch); } - sdi->channel_groups = g_slist_append(NULL, cg); for (j = 0; j < num_analog_channels; j++) { snprintf(channel_name, 16, "A%d", j); @@ -313,10 +320,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) SR_CHANNEL_ANALOG, TRUE, channel_name); /* Every analog channel gets its own channel group. */ - cg = g_malloc0(sizeof(struct sr_channel_group)); - cg->name = g_strdup(channel_name); + cg = sr_channel_group_new(sdi, channel_name, NULL); cg->channels = g_slist_append(NULL, ch); - sdi->channel_groups = g_slist_append(sdi->channel_groups, cg); } devc = fx2lafw_dev_new(); @@ -483,6 +488,9 @@ static int config_get(uint32_t key, GVariant **data, return SR_ERR; *data = g_variant_new_printf("%d.%d", usb->bus, usb->address); break; + case SR_CONF_LIMIT_FRAMES: + *data = g_variant_new_uint64(devc->limit_frames); + break; case SR_CONF_LIMIT_SAMPLES: *data = g_variant_new_uint64(devc->limit_samples); break; @@ -518,6 +526,9 @@ static int config_set(uint32_t key, GVariant *data, return SR_ERR_ARG; devc->cur_samplerate = devc->samplerates[idx]; break; + case SR_CONF_LIMIT_FRAMES: + devc->limit_frames = g_variant_get_uint64(data); + break; case SR_CONF_LIMIT_SAMPLES: devc->limit_samples = g_variant_get_uint64(data); break;