X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Ffx2lafw%2Fapi.c;h=5cb36330461ac6e7fdef01675ec87a0b00739adc;hb=c442ffda0fc6fa9bc3c5397a21ef1d04f01a64a1;hp=a93b9a418944327edd00d3b8d32d6f82e828154c;hpb=65e0036635a54b3273436b4ea7918aea25bad788;p=libsigrok.git diff --git a/src/hardware/fx2lafw/api.c b/src/hardware/fx2lafw/api.c index a93b9a41..5cb36330 100644 --- a/src/hardware/fx2lafw/api.c +++ b/src/hardware/fx2lafw/api.c @@ -45,20 +45,33 @@ static const struct fx2lafw_profile supported_fx2[] = { FIRMWARE_DIR "/fx2lafw-cwav-usbeesx.fw", 0, NULL, NULL}, - /* - * DreamSourceLab DSLogic (before FW upload) - */ + /* DreamSourceLab DSLogic (before FW upload) */ { 0x2a0e, 0x0001, "DreamSourceLab", "DSLogic", NULL, FIRMWARE_DIR "/dreamsourcelab-dslogic-fx2.fw", DEV_CAPS_16BIT, NULL, NULL}, - - /* - * DreamSourceLab DSLogic (after FW upload) - */ + /* DreamSourceLab DSLogic (after FW upload) */ { 0x2a0e, 0x0001, "DreamSourceLab", "DSLogic", NULL, FIRMWARE_DIR "/dreamsourcelab-dslogic-fx2.fw", DEV_CAPS_16BIT, "DreamSourceLab", "DSLogic"}, + /* DreamSourceLab DSCope (before FW upload) */ + { 0x2a0e, 0x0002, "DreamSourceLab", "DSCope", NULL, + FIRMWARE_DIR "/dreamsourcelab-dscope-fx2.fw", + DEV_CAPS_16BIT, NULL, NULL}, + /* DreamSourceLab DSCope (after FW upload) */ + { 0x2a0e, 0x0002, "DreamSourceLab", "DSCope", NULL, + FIRMWARE_DIR "/dreamsourcelab-dscope-fx2.fw", + DEV_CAPS_16BIT, "DreamSourceLab", "DSCope"}, + + /* DreamSourceLab DSLogic Pro (before FW upload) */ + { 0x2a0e, 0x0003, "DreamSourceLab", "DSLogic Pro", NULL, + FIRMWARE_DIR "/dreamsourcelab-dslogic-pro-fx2.fw", + DEV_CAPS_16BIT, NULL, NULL}, + /* DreamSourceLab DSLogic Pro (after FW upload) */ + { 0x2a0e, 0x0003, "DreamSourceLab", "DSLogic Pro", NULL, + FIRMWARE_DIR "/dreamsourcelab-dslogic-pro-fx2.fw", + DEV_CAPS_16BIT, "DreamSourceLab", "DSLogic"}, + /* * Saleae Logic * EE Electronics ESLA100 @@ -180,7 +193,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) const char *conn; char manufacturer[64], product[64], serial_num[64], connection_id[64]; - drvc = di->priv; + drvc = di->context; conn = NULL; for (l = options; l; l = l->next) { @@ -296,18 +309,20 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) drvc->instances = g_slist_append(drvc->instances, sdi); devices = g_slist_append(devices, sdi); - if (strcmp(prof->model, "DSLogic")) { + if (!strcmp(prof->model, "DSLogic") + || !strcmp(prof->model, "DSLogic Pro") + || !strcmp(prof->model, "DSCope")) { + devc->dslogic = TRUE; + devc->samplerates = dslogic_samplerates; + devc->num_samplerates = ARRAY_SIZE(dslogic_samplerates); + has_firmware = match_manuf_prod(devlist[i], "DreamSourceLab", "DSLogic") + || match_manuf_prod(devlist[i], "DreamSourceLab", "DSCope"); + } else { devc->dslogic = FALSE; devc->samplerates = samplerates; devc->num_samplerates = ARRAY_SIZE(samplerates); has_firmware = match_manuf_prod(devlist[i], "sigrok", "fx2lafw"); - } else { - devc->dslogic = TRUE; - devc->samplerates = dslogic_samplerates; - devc->num_samplerates = ARRAY_SIZE(dslogic_samplerates); - has_firmware = match_manuf_prod(devlist[i], - "DreamSourceLab", "DSLogic"); } if (has_firmware) { @@ -340,7 +355,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) static GSList *dev_list(const struct sr_dev_driver *di) { - return ((struct drv_context *)(di->priv))->instances; + return ((struct drv_context *)(di->context))->instances; } static int dev_open(struct sr_dev_inst *sdi) @@ -348,6 +363,7 @@ static int dev_open(struct sr_dev_inst *sdi) struct sr_dev_driver *di = sdi->driver; struct sr_usb_dev_inst *usb; struct dev_context *devc; + char *fpga_firmware = NULL; int ret; int64_t timediff_us, timediff_ms; @@ -408,8 +424,16 @@ static int dev_open(struct sr_dev_inst *sdi) } if (devc->dslogic) { + if (!strcmp(devc->profile->model, "DSLogic")) { + fpga_firmware = DSLOGIC_FPGA_FIRMWARE; + } else if (!strcmp(devc->profile->model, "DSLogic Pro")) { + fpga_firmware = DSLOGIC_PRO_FPGA_FIRMWARE; + } else if (!strcmp(devc->profile->model, "DSCope")) { + fpga_firmware = DSCOPE_FPGA_FIRMWARE; + } + if ((ret = dslogic_fpga_firmware_upload(sdi, - DSLOGIC_FPGA_FIRMWARE)) != SR_OK) + fpga_firmware)) != SR_OK) return ret; } @@ -444,7 +468,7 @@ static int cleanup(const struct sr_dev_driver *di) int ret; struct drv_context *drvc; - if (!(drvc = di->priv)) + if (!(drvc = di->context)) return SR_OK; ret = std_dev_clear(di, NULL); @@ -740,7 +764,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) return SR_ERR_DEV_CLOSED; di = sdi->driver; - drvc = di->priv; + drvc = di->context; devc = sdi->priv; devc->ctx = drvc->sr_ctx; @@ -754,11 +778,12 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) if (devc->dslogic) { dslogic_trigger_request(sdi); - } - else { - if ((ret = fx2lafw_command_start_acquisition(sdi)) != SR_OK) - return ret; + } else { start_transfers(sdi); + if ((ret = fx2lafw_command_start_acquisition(sdi)) != SR_OK) { + fx2lafw_abort_acquisition(devc); + return ret; + } } return SR_OK; @@ -789,5 +814,5 @@ SR_PRIV struct sr_dev_driver fx2lafw_driver_info = { .dev_close = dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop, - .priv = NULL, + .context = NULL, };