X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbeaglelogic%2Fapi.c;h=9abbbefc972e059b0aeaed04e13518182c789392;hb=aed4ad0beaf64062752039a13f9a95326aa1df87;hp=c86925be56d9133ed1443d282cec44d65c7fe834;hpb=155b680da482cea2381becb73c51cfb838bff31e;p=libsigrok.git diff --git a/src/hardware/beaglelogic/api.c b/src/hardware/beaglelogic/api.c index c86925be..9abbbefc 100644 --- a/src/hardware/beaglelogic/api.c +++ b/src/hardware/beaglelogic/api.c @@ -23,16 +23,19 @@ SR_PRIV struct sr_dev_driver beaglelogic_driver_info; static struct sr_dev_driver *di = &beaglelogic_driver_info; -/* Hardware capabiities */ -static const int32_t hwcaps[] = { - SR_CONF_LOGIC_ANALYZER, - SR_CONF_SAMPLERATE, - SR_CONF_TRIGGER_MATCH, +/* Scan options */ +static const uint32_t scanopts[] = { + SR_CONF_NUM_LOGIC_CHANNELS, +}; - SR_CONF_LIMIT_SAMPLES, +/* Hardware capabilities */ +static const uint32_t devopts[] = { + SR_CONF_LOGIC_ANALYZER, SR_CONF_CONTINUOUS, - - SR_CONF_NUM_LOGIC_CHANNELS, + SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET, + SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET, + SR_CONF_TRIGGER_MATCH | SR_CONF_LIST, + SR_CONF_NUM_LOGIC_CHANNELS | SR_CONF_GET, }; /* Trigger matching capabilities */ @@ -52,9 +55,9 @@ SR_PRIV const char *beaglelogic_channel_names[NUM_CHANNELS + 1] = { /* Possible sample rates : 10 Hz to 100 MHz = (100 / x) MHz */ static const uint64_t samplerates[] = { - SR_HZ(10), - SR_MHZ(100), - SR_HZ(1), + SR_HZ(10), + SR_MHZ(100), + SR_HZ(1), }; static int init(struct sr_context *sr_ctx) @@ -94,7 +97,7 @@ static GSList *scan(GSList *options) if (!g_file_test(BEAGLELOGIC_DEV_NODE, G_FILE_TEST_EXISTS)) return NULL; - sdi = sr_dev_inst_new(0, SR_ST_INACTIVE, NULL, "BeagleLogic", "1.0"); + sdi = sr_dev_inst_new(SR_ST_INACTIVE, NULL, "BeagleLogic", "1.0"); sdi->driver = di; /* Unless explicitly specified, keep max channels to 8 only */ @@ -223,7 +226,7 @@ static int cleanup(void) return SR_OK; } -static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, +static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc = sdi->priv; @@ -249,7 +252,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi, return SR_OK; } -static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi, +static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { struct dev_context *devc = sdi->priv; @@ -289,7 +292,7 @@ static int config_set(int key, 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(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { int ret; @@ -302,9 +305,13 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, ret = SR_OK; switch (key) { + case SR_CONF_SCAN_OPTIONS: + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t)); + break; case SR_CONF_DEVICE_OPTIONS: - *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32, - hwcaps, ARRAY_SIZE(hwcaps), sizeof(int32_t)); + *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32, + devopts, ARRAY_SIZE(devopts), sizeof(uint32_t)); break; case SR_CONF_SAMPLERATE: g_variant_builder_init(&gvb, G_VARIANT_TYPE("a{sv}"));