sr: fx2lafw: Get/display FX2 REVID.
This commit is contained in:
parent
1663e4706c
commit
1e94408ae5
|
@ -39,6 +39,23 @@ SR_PRIV int command_get_fw_version(libusb_device_handle *devhdl,
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SR_PRIV int command_get_revid_version(libusb_device_handle *devhdl,
|
||||||
|
uint8_t *revid)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||||
|
LIBUSB_ENDPOINT_IN, CMD_GET_REVID_VERSION, 0x0000, 0x0000,
|
||||||
|
revid, 1, 100);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
sr_err("fx2lafw: Unable to get REVID: %d.", ret);
|
||||||
|
return SR_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
SR_PRIV int command_start_acquisition(libusb_device_handle *devhdl,
|
SR_PRIV int command_start_acquisition(libusb_device_handle *devhdl,
|
||||||
uint64_t samplerate)
|
uint64_t samplerate)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
/* Protocol commands */
|
/* Protocol commands */
|
||||||
#define CMD_GET_FW_VERSION 0xb0
|
#define CMD_GET_FW_VERSION 0xb0
|
||||||
#define CMD_START 0xb1
|
#define CMD_START 0xb1
|
||||||
|
#define CMD_GET_REVID_VERSION 0xb2
|
||||||
|
|
||||||
#define CMD_START_FLAGS_CLK_SRC_POS 6
|
#define CMD_START_FLAGS_CLK_SRC_POS 6
|
||||||
|
|
||||||
|
@ -47,7 +48,8 @@ struct cmd_start_acquisition {
|
||||||
|
|
||||||
SR_PRIV int command_get_fw_version(libusb_device_handle *devhdl,
|
SR_PRIV int command_get_fw_version(libusb_device_handle *devhdl,
|
||||||
struct version_info *vi);
|
struct version_info *vi);
|
||||||
|
SR_PRIV int command_get_revid_version(libusb_device_handle *devhdl,
|
||||||
|
uint8_t *revid);
|
||||||
SR_PRIV int command_start_acquisition(libusb_device_handle *devhdl,
|
SR_PRIV int command_start_acquisition(libusb_device_handle *devhdl,
|
||||||
uint64_t samplerate);
|
uint64_t samplerate);
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,7 @@ static int fx2lafw_dev_open(int dev_index)
|
||||||
struct context *ctx;
|
struct context *ctx;
|
||||||
struct version_info vi;
|
struct version_info vi;
|
||||||
int ret, skip, i;
|
int ret, skip, i;
|
||||||
|
uint8_t revid;
|
||||||
|
|
||||||
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
|
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
@ -239,19 +240,25 @@ static int fx2lafw_dev_open(int dev_index)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = command_get_revid_version(ctx->usb->devhdl, &revid);
|
||||||
|
if (ret != SR_OK) {
|
||||||
|
sr_err("fx2lafw: Failed to retrieve REVID.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (vi.major != FX2LAFW_VERSION_MAJOR ||
|
if (vi.major != FX2LAFW_VERSION_MAJOR ||
|
||||||
vi.minor != FX2LAFW_VERSION_MINOR) {
|
vi.minor != FX2LAFW_VERSION_MINOR) {
|
||||||
sr_err("fx2lafw: Expected firmware version %d.%02d "
|
sr_err("fx2lafw: Expected firmware version %d.%d "
|
||||||
"got %d.%02d.", FX2LAFW_VERSION_MAJOR,
|
"got %d.%d.", FX2LAFW_VERSION_MAJOR,
|
||||||
FX2LAFW_VERSION_MINOR, vi.major, vi.minor);
|
FX2LAFW_VERSION_MINOR, vi.major, vi.minor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sdi->status = SR_ST_ACTIVE;
|
sdi->status = SR_ST_ACTIVE;
|
||||||
sr_info("fx2lafw: Opened device %d on %d.%d "
|
sr_info("fx2lafw: Opened device %d on %d.%d "
|
||||||
"interface %d, firmware version %d.%02d",
|
"interface %d, firmware %d.%d, REVID %d.",
|
||||||
sdi->index, ctx->usb->bus, ctx->usb->address,
|
sdi->index, ctx->usb->bus, ctx->usb->address,
|
||||||
USB_INTERFACE, vi.major, vi.minor);
|
USB_INTERFACE, vi.major, vi.minor, revid);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue