forked from Ivasoft/DSView
firmware/hdl updated, fix initialization issue and improve stability
This commit is contained in:
@@ -19,8 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@@ -523,8 +523,8 @@ void MainWindow::show_error()
|
||||
ch_status += (i > 9 ? " " : "");
|
||||
error_pattern >>= 1;
|
||||
}
|
||||
details = tr("the received data are not consist with pre-defined test data!\n") +
|
||||
tr("0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\n") + ch_status;
|
||||
details = tr("the received data are not consist with pre-defined test data!") + "\n" +
|
||||
tr("0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15")+ "\n" + ch_status;
|
||||
break;
|
||||
case SigSession::Pkt_data_err:
|
||||
title = tr("Packet Error");
|
||||
@@ -723,6 +723,13 @@ bool MainWindow::load_session(QString name)
|
||||
return false;
|
||||
}
|
||||
|
||||
// clear decoders
|
||||
#ifdef ENABLE_DECODE
|
||||
if (sdi->mode == LOGIC) {
|
||||
_protocol_widget->del_all_protocol();
|
||||
}
|
||||
#endif
|
||||
|
||||
// load device settings
|
||||
GVariant *gvar_opts;
|
||||
gsize num_opts;
|
||||
|
||||
@@ -445,7 +445,6 @@ bool SigSession::get_capture_status(bool &triggered, int &progress)
|
||||
sr_status status;
|
||||
if (sr_status_get(_dev_inst->dev_inst(), &status, SR_STATUS_TRIG_BEGIN, SR_STATUS_TRIG_END) == SR_OK){
|
||||
triggered = status.trig_hit & 0x01;
|
||||
const bool captured_cnt_dec = status.trig_hit & 0x02;
|
||||
uint64_t captured_cnt = status.trig_hit >> 2;
|
||||
captured_cnt = ((uint64_t)status.captured_cnt0 +
|
||||
((uint64_t)status.captured_cnt1 << 8) +
|
||||
@@ -454,7 +453,7 @@ bool SigSession::get_capture_status(bool &triggered, int &progress)
|
||||
(captured_cnt << 32));
|
||||
if (_dev_inst->dev_inst()->mode == DSO)
|
||||
captured_cnt = captured_cnt * _signals.size() / get_ch_num(SR_CHANNEL_DSO);
|
||||
if (captured_cnt_dec)
|
||||
if (triggered)
|
||||
progress = (sample_limits - captured_cnt) * 100.0 / sample_limits;
|
||||
else
|
||||
progress = captured_cnt * 100.0 / sample_limits;
|
||||
@@ -1057,8 +1056,10 @@ void SigSession::data_feed_in(const struct sr_dev_inst *sdi,
|
||||
|
||||
case SR_DF_OVERFLOW:
|
||||
{
|
||||
_error = Data_overflow;
|
||||
session_error();
|
||||
if (_error == No_err) {
|
||||
_error = Data_overflow;
|
||||
session_error();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SR_DF_END:
|
||||
|
||||
BIN
DSView/res/DSCope.bin
Normal file → Executable file
BIN
DSView/res/DSCope.bin
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSCope.fw
Normal file → Executable file
BIN
DSView/res/DSCope.fw
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSCope20.bin
Normal file → Executable file
BIN
DSView/res/DSCope20.bin
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSCope20.fw
Normal file → Executable file
BIN
DSView/res/DSCope20.fw
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSCopeB20.fw
Executable file
BIN
DSView/res/DSCopeB20.fw
Executable file
Binary file not shown.
BIN
DSView/res/DSLogic.fw
Normal file → Executable file
BIN
DSView/res/DSLogic.fw
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSLogic33.bin
Normal file → Executable file
BIN
DSView/res/DSLogic33.bin
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSLogic50.bin
Normal file → Executable file
BIN
DSView/res/DSLogic50.bin
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSLogicBasic.bin
Normal file → Executable file
BIN
DSView/res/DSLogicBasic.bin
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSLogicBasic.fw
Normal file → Executable file
BIN
DSView/res/DSLogicBasic.fw
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSLogicPlus.bin
Normal file → Executable file
BIN
DSView/res/DSLogicPlus.bin
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSLogicPlus.fw
Normal file → Executable file
BIN
DSView/res/DSLogicPlus.fw
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSLogicPro.bin
Normal file → Executable file
BIN
DSView/res/DSLogicPro.bin
Normal file → Executable file
Binary file not shown.
BIN
DSView/res/DSLogicPro.fw
Normal file → Executable file
BIN
DSView/res/DSLogicPro.fw
Normal file → Executable file
Binary file not shown.
@@ -23,6 +23,7 @@ noinst_LTLIBRARIES = libsigrok4DSL_hw_dsl.la
|
||||
|
||||
libsigrok4DSL_hw_dsl_la_SOURCES = \
|
||||
command.c \
|
||||
dsl.c \
|
||||
dslogic.c \
|
||||
dscope.c
|
||||
|
||||
|
||||
@@ -19,179 +19,22 @@
|
||||
|
||||
#include "libsigrok.h"
|
||||
#include "libsigrok-internal.h"
|
||||
//#include <libusb.h>
|
||||
|
||||
#include "command.h"
|
||||
//#include "libsigrok.h"
|
||||
#include "dsl.h"
|
||||
#include <assert.h>
|
||||
|
||||
SR_PRIV int command_get_fw_version(libusb_device_handle *devhdl,
|
||||
struct version_info *vi)
|
||||
SR_PRIV int command_ctl_wr(libusb_device_handle *devhdl, struct ctl_wr_cmd cmd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_IN, CMD_GET_FW_VERSION, 0x0000, 0x0000,
|
||||
(unsigned char *)vi, sizeof(struct version_info), 3000);
|
||||
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to get version info: %s.",
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
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, 3000);
|
||||
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to get REVID: %s.", libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int command_start_acquisition(libusb_device_handle *devhdl,
|
||||
uint64_t samplerate, gboolean samplewide, gboolean la_mode)
|
||||
{
|
||||
struct cmd_start_acquisition cmd;
|
||||
int delay = 0, ret;
|
||||
|
||||
(void) samplerate;
|
||||
|
||||
cmd.flags = la_mode ? CMD_START_FLAGS_MODE_LA : 0;
|
||||
|
||||
cmd.flags |= CMD_START_FLAGS_CLK_30MHZ;
|
||||
delay = 0;
|
||||
|
||||
sr_info("GPIF delay = %d, clocksource = %sMHz.", delay,
|
||||
(cmd.flags & CMD_START_FLAGS_CLK_48MHZ) ? "48" : "30");
|
||||
|
||||
// if (delay <= 0 || delay > MAX_SAMPLE_DELAY) {
|
||||
// sr_err("Unable to sample at %" PRIu64 "Hz.", samplerate);
|
||||
// return SR_ERR;
|
||||
// }
|
||||
|
||||
cmd.sample_delay_h = (delay >> 8) & 0xff;
|
||||
cmd.sample_delay_l = delay & 0xff;
|
||||
|
||||
/* Select the sampling width. */
|
||||
cmd.flags |= samplewide ? CMD_START_FLAGS_SAMPLE_16BIT :
|
||||
CMD_START_FLAGS_SAMPLE_8BIT;
|
||||
|
||||
/* Send the control message. */
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_OUT, CMD_START, 0x0000, 0x0000,
|
||||
(unsigned char *)&cmd, sizeof(cmd), 3000);
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to send start command: %s.",
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int command_stop_acquisition(libusb_device_handle *devhdl)
|
||||
{
|
||||
struct cmd_start_acquisition cmd;
|
||||
int ret;
|
||||
|
||||
/* stop acquisition command */
|
||||
cmd.flags = CMD_START_FLAGS_STOP;
|
||||
cmd.sample_delay_h = 0;
|
||||
cmd.sample_delay_l = 0;
|
||||
|
||||
/* Send the control message. */
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_OUT, CMD_START, 0x0000, 0x0000,
|
||||
(unsigned char *)&cmd, sizeof(cmd), 3000);
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to send stop command: %s.",
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int command_fpga_config(libusb_device_handle *devhdl)
|
||||
{
|
||||
struct cmd_cfg_count cmd;
|
||||
int ret;
|
||||
|
||||
/* ... */
|
||||
cmd.byte0 = (uint8_t)0;
|
||||
cmd.byte1 = (uint8_t)0;
|
||||
cmd.byte2 = (uint8_t)0;
|
||||
|
||||
/* Send the control message. */
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_OUT, CMD_CONFIG, 0x0000, 0x0000,
|
||||
(unsigned char *)&cmd, sizeof(cmd), 3000);
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to send FPGA configure command: %s.",
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int command_fpga_setting(libusb_device_handle *devhdl, uint32_t setting_count)
|
||||
{
|
||||
struct cmd_setting_count cmd;
|
||||
int ret;
|
||||
|
||||
/* ... */
|
||||
cmd.byte0 = (uint8_t)setting_count;
|
||||
cmd.byte1 = (uint8_t)(setting_count >> 8);
|
||||
cmd.byte2 = (uint8_t)(setting_count >> 16);
|
||||
|
||||
/* Send the control message. */
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_OUT, CMD_SETTING, 0x0000, 0x0000,
|
||||
(unsigned char *)&cmd, sizeof(cmd), 3000);
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to send FPGA setting command: %s.",
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int command_dso_ctrl(libusb_device_handle *devhdl, uint64_t command)
|
||||
{
|
||||
struct cmd_control cmd;
|
||||
int ret;
|
||||
|
||||
/* ... */
|
||||
cmd.byte0 = (uint8_t)command;
|
||||
cmd.byte1 = (uint8_t)(command >> 8);
|
||||
cmd.byte2 = (uint8_t)(command >> 16);
|
||||
cmd.byte3 = (uint8_t)(command >> 24);
|
||||
cmd.byte4 = (uint8_t)(command >> 32);
|
||||
cmd.byte5 = (uint8_t)(command >> 40);
|
||||
cmd.byte6 = (uint8_t)(command >> 48);
|
||||
cmd.byte7 = (uint8_t)(command >> 56);
|
||||
|
||||
|
||||
/* Send the control command. */
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_OUT, CMD_CONTROL, 0x0000, 0x0000,
|
||||
(unsigned char *)&cmd, sizeof(cmd), 3000);
|
||||
LIBUSB_ENDPOINT_OUT, CMD_CTL_WR, 0x0000, 0x0000,
|
||||
(unsigned char *)&cmd, cmd.header.size+sizeof(struct ctl_header), 3000);
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to send oscilloscope control command: %s.",
|
||||
sr_err("Unable to send CMD_CTL_WR command(dest:%d/offset:%d/size:%d): %s.",
|
||||
cmd.header.dest, cmd.header.offset, cmd.header.size,
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
@@ -199,95 +42,17 @@ SR_PRIV int command_dso_ctrl(libusb_device_handle *devhdl, uint64_t command)
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int command_get_status(libusb_device_handle *devhdl,
|
||||
unsigned char *status, int begin, int end)
|
||||
{
|
||||
struct cmd_status_info cmd;
|
||||
int ret;
|
||||
|
||||
/* status acquisition command */
|
||||
assert(begin >= 0);
|
||||
assert(end >= 0);
|
||||
cmd.begin = begin;
|
||||
cmd.end = end;
|
||||
|
||||
/* Send the control message. */
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_OUT, CMD_STATUS_INFO, 0x0000, 0x0000,
|
||||
(unsigned char *)&cmd, sizeof(cmd), 3000);
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to send status info: %s.",
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
g_usleep(10*1000);
|
||||
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_IN, CMD_STATUS, 0x0000, 0x0000,
|
||||
(unsigned char *)status, CMD_STATUS_CNT, 3000);
|
||||
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to get status info: %s.",
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int command_wr_reg(libusb_device_handle *devhdl, uint8_t value, uint8_t addr)
|
||||
{
|
||||
int ret;
|
||||
uint16_t cmd;
|
||||
|
||||
cmd = value + (addr << 8);
|
||||
/* Send the control command. */
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_OUT, CMD_WR_REG, 0x0000, 0x0000,
|
||||
(unsigned char *)&cmd, sizeof(cmd), 3000);
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to write REG @ address %d : %s.",
|
||||
addr, libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int command_wr_nvm(libusb_device_handle *devhdl, unsigned char *ctx, uint8_t len)
|
||||
SR_PRIV int command_ctl_rd(libusb_device_handle *devhdl, struct ctl_rd_cmd cmd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Send the control message. */
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_OUT, CMD_WR_NVM, 0x0000, 0x0000,
|
||||
(unsigned char *)ctx, len, 3000);
|
||||
|
||||
LIBUSB_ENDPOINT_OUT, CMD_CTL_RD_PRE, 0x0000, 0x0000,
|
||||
(unsigned char *)&cmd, sizeof(struct ctl_header), 3000);
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to get status info: %s.",
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int command_rd_nvm(libusb_device_handle *devhdl, unsigned char *ctx, uint16_t addr, uint8_t len)
|
||||
{
|
||||
int ret;
|
||||
|
||||
struct cmd_nvm_info nvm_info;
|
||||
assert(len <= 32);
|
||||
nvm_info.addr = addr;
|
||||
nvm_info.len = len;
|
||||
|
||||
/* Send the control message. */
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_OUT, CMD_RD_NVM_PRE, 0x0000, 0x0000,
|
||||
(unsigned char *)&nvm_info, sizeof(struct cmd_nvm_info), 3000);
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to send CMD_RD_NVM_PRE command: %s.",
|
||||
sr_err("Unable to send CMD_CTL_RD_PRE command(dest:%d/offset:%d/size:%d): %s.",
|
||||
cmd.header.dest, cmd.header.offset, cmd.header.size,
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
@@ -296,32 +61,14 @@ SR_PRIV int command_rd_nvm(libusb_device_handle *devhdl, unsigned char *ctx, uin
|
||||
|
||||
/* Send the control message. */
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_IN, CMD_RD_NVM, 0x0000, 0x0000,
|
||||
(unsigned char *)ctx, len, 3000);
|
||||
LIBUSB_ENDPOINT_IN, CMD_CTL_RD, 0x0000, 0x0000,
|
||||
(unsigned char *)cmd.data, cmd.header.size, 3000);
|
||||
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to get zero info: %s.",
|
||||
sr_err("Unable to send CMD_CTL_RD command: %s.",
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
SR_PRIV int command_get_hw_info(libusb_device_handle *devhdl, uint8_t *info)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = libusb_control_transfer(devhdl, LIBUSB_REQUEST_TYPE_VENDOR |
|
||||
LIBUSB_ENDPOINT_IN, CMD_GET_HW_INFO, 0x0000, 0x0000,
|
||||
info, 1, 3000);
|
||||
|
||||
if (ret < 0) {
|
||||
sr_err("Unable to get hardware info: %s.",
|
||||
libusb_error_name(ret));
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,82 +25,54 @@
|
||||
#include "libsigrok-internal.h"
|
||||
|
||||
/* Protocol commands */
|
||||
#define CMD_GET_FW_VERSION 0xb0
|
||||
#define CMD_GET_REVID_VERSION 0xb1
|
||||
#define CMD_START 0xb2
|
||||
#define CMD_CONFIG 0xb3
|
||||
#define CMD_SETTING 0xb4
|
||||
#define CMD_CONTROL 0xb5
|
||||
#define CMD_STATUS 0xb6
|
||||
#define CMD_STATUS_INFO 0xb7
|
||||
#define CMD_WR_REG 0xb8
|
||||
#define CMD_WR_NVM 0xb9
|
||||
#define CMD_RD_NVM 0xba
|
||||
#define CMD_RD_NVM_PRE 0xbb
|
||||
#define CMD_GET_HW_INFO 0xbc
|
||||
#define CMD_CTL_WR 0xb0
|
||||
#define CMD_CTL_RD_PRE 0xb1
|
||||
#define CMD_CTL_RD 0xb2
|
||||
|
||||
#define CMD_START_FLAGS_MODE_POS 4
|
||||
#define CMD_START_FLAGS_WIDE_POS 5
|
||||
#define CMD_START_FLAGS_CLK_SRC_POS 6
|
||||
#define CMD_START_FLAGS_STOP_POS 7
|
||||
#define bmGPIF_DONE (1 << 7)
|
||||
#define bmFPGA_DONE (1 << 6)
|
||||
#define bmFPGA_INIT_B (1 << 5)
|
||||
#define bmSYS_OVERFLOW (1 << 4)
|
||||
#define bmSYS_CLR (1 << 3)
|
||||
#define bmSYS_EN (1 << 2)
|
||||
#define bmLED_RED (1 << 1)
|
||||
#define bmLED_GREEN (1 << 0)
|
||||
|
||||
#define CMD_START_FLAGS_MODE_LA (1 << CMD_START_FLAGS_MODE_POS)
|
||||
|
||||
#define CMD_START_FLAGS_SAMPLE_8BIT (0 << CMD_START_FLAGS_WIDE_POS)
|
||||
#define CMD_START_FLAGS_SAMPLE_16BIT (1 << CMD_START_FLAGS_WIDE_POS)
|
||||
|
||||
#define CMD_START_FLAGS_CLK_30MHZ (0 << CMD_START_FLAGS_CLK_SRC_POS)
|
||||
#define CMD_START_FLAGS_CLK_48MHZ (1 << CMD_START_FLAGS_CLK_SRC_POS)
|
||||
|
||||
#define CMD_START_FLAGS_STOP (1 << CMD_START_FLAGS_STOP_POS)
|
||||
|
||||
#define CMD_STATUS_CNT 32
|
||||
#define bmWR_PROG_B (1 << 2)
|
||||
#define bmWR_INTRDY (1 << 7)
|
||||
#define bmWR_WORDWIDE (1 << 0)
|
||||
|
||||
#define VTH_ADDR 0x78
|
||||
#define EEWP_ADDR 0x70
|
||||
#define COMB_ADDR 0x68
|
||||
|
||||
#pragma pack(push, 1)
|
||||
enum {
|
||||
DSL_CTL_FW_VERSION = 0,
|
||||
DSL_CTL_REVID_VERSION = 1,
|
||||
DSL_CTL_HW_STATUS = 2,
|
||||
DSL_CTL_PROG_B = 3,
|
||||
DSL_CTL_SYS = 4,
|
||||
DSL_CTL_LED = 5,
|
||||
DSL_CTL_INTRDY = 6,
|
||||
DSL_CTL_WORDWIDE = 7,
|
||||
|
||||
DSL_CTL_START = 8,
|
||||
DSL_CTL_STOP = 9,
|
||||
DSL_CTL_BULK_WR = 10,
|
||||
DSL_CTL_REG = 11,
|
||||
DSL_CTL_NVM = 12,
|
||||
|
||||
DSL_CTL_I2C_DSO = 13,
|
||||
DSL_CTL_I2C_REG = 14,
|
||||
DSL_CTL_DSO_MEASURE = 15,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1) // byte align
|
||||
struct version_info {
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
};
|
||||
|
||||
struct cmd_start_acquisition {
|
||||
uint8_t flags;
|
||||
uint8_t sample_delay_h;
|
||||
uint8_t sample_delay_l;
|
||||
};
|
||||
|
||||
struct cmd_setting_count {
|
||||
uint8_t byte0;
|
||||
uint8_t byte1;
|
||||
uint8_t byte2;
|
||||
};
|
||||
|
||||
struct cmd_cfg_count {
|
||||
uint8_t byte0;
|
||||
uint8_t byte1;
|
||||
uint8_t byte2;
|
||||
};
|
||||
|
||||
struct cmd_control {
|
||||
uint8_t byte0;
|
||||
uint8_t byte1;
|
||||
uint8_t byte2;
|
||||
uint8_t byte3;
|
||||
uint8_t byte4;
|
||||
uint8_t byte5;
|
||||
uint8_t byte6;
|
||||
uint8_t byte7;
|
||||
};
|
||||
|
||||
struct cmd_status_info {
|
||||
uint8_t begin;
|
||||
uint8_t end;
|
||||
};
|
||||
|
||||
struct cmd_zero_info {
|
||||
uint8_t zero_addr;
|
||||
uint8_t voff0;
|
||||
@@ -137,35 +109,23 @@ struct cmd_vga_info {
|
||||
uint16_t vga7;
|
||||
};
|
||||
|
||||
struct cmd_nvm_info {
|
||||
uint16_t addr;
|
||||
uint8_t len;
|
||||
struct ctl_header {
|
||||
uint8_t dest;
|
||||
uint16_t offset;
|
||||
uint8_t size;
|
||||
};
|
||||
struct ctl_wr_cmd {
|
||||
struct ctl_header header;
|
||||
uint8_t data[60];
|
||||
};
|
||||
struct ctl_rd_cmd {
|
||||
struct ctl_header header;
|
||||
uint8_t *data;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
SR_PRIV int command_get_fw_version(libusb_device_handle *devhdl,
|
||||
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,
|
||||
uint64_t samplerate, gboolean samplewide, gboolean la_mode);
|
||||
SR_PRIV int command_stop_acquisition(libusb_device_handle *devhdl);
|
||||
|
||||
SR_PRIV int command_fpga_config(libusb_device_handle *devhdl);
|
||||
SR_PRIV int command_fpga_setting(libusb_device_handle *devhdl, uint32_t setting_count);
|
||||
SR_PRIV int command_ctl_wr(libusb_device_handle *devhdl, struct ctl_wr_cmd cmd);
|
||||
SR_PRIV int command_ctl_rd(libusb_device_handle *devhdl, struct ctl_rd_cmd cmd);
|
||||
|
||||
SR_PRIV int command_dso_ctrl(libusb_device_handle *devhdl, uint64_t command);
|
||||
|
||||
SR_PRIV int command_get_status(libusb_device_handle *devhdl,
|
||||
unsigned char *status,
|
||||
int begin, int end);
|
||||
|
||||
SR_PRIV int command_wr_reg(libusb_device_handle *devhdl, uint8_t value, uint8_t addr);
|
||||
|
||||
SR_PRIV int command_wr_nvm(libusb_device_handle *devhdl, unsigned char *ctx, uint8_t len);
|
||||
SR_PRIV int command_rd_nvm(libusb_device_handle *devhdl, unsigned char *ctx, uint16_t addr, uint8_t len);
|
||||
|
||||
SR_PRIV int command_get_hw_info(libusb_device_handle *devhdl,
|
||||
uint8_t *fpga_done);
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1482
libsigrok4DSL/hardware/DSL/dsl.c
Executable file
1482
libsigrok4DSL/hardware/DSL/dsl.c
Executable file
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,21 @@
|
||||
#include "libsigrok.h"
|
||||
#include "libsigrok-internal.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#undef min
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#undef max
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
/* Message logging helpers with subsystem-specific prefix string. */
|
||||
#define LOG_PREFIX "DSL Hardware: "
|
||||
#define ds_log(l, s, args...) ds_log(l, LOG_PREFIX s, ## args)
|
||||
@@ -43,8 +58,8 @@
|
||||
#define NUM_SIMUL_TRANSFERS 64
|
||||
#define MAX_EMPTY_TRANSFERS (NUM_SIMUL_TRANSFERS * 2)
|
||||
|
||||
#define DSL_REQUIRED_VERSION_MAJOR 1
|
||||
#define DSL_REQUIRED_VERSION_MINOR 1
|
||||
#define DSL_REQUIRED_VERSION_MAJOR 2
|
||||
#define DSL_REQUIRED_VERSION_MINOR 0
|
||||
|
||||
#define MAX_8BIT_SAMPLE_RATE DS_MHZ(24)
|
||||
#define MAX_16BIT_SAMPLE_RATE DS_MHZ(12)
|
||||
@@ -233,6 +248,12 @@ static const struct DSL_profile supported_DSCope[] = {
|
||||
"DSCope20.bin",
|
||||
DEV_CAPS_16BIT},
|
||||
|
||||
{0x2A0E, 0x0022, NULL, "DSCope B20", NULL,
|
||||
"DSCopeB20.fw",
|
||||
"DSCope20.bin",
|
||||
"DSCope20.bin",
|
||||
DEV_CAPS_16BIT},
|
||||
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -326,7 +347,9 @@ struct DSL_context {
|
||||
GIOChannel *channel;
|
||||
|
||||
int status;
|
||||
int trf_completed;
|
||||
gboolean mstatus_valid;
|
||||
struct sr_status mstatus;
|
||||
gboolean abort;
|
||||
gboolean overflow;
|
||||
};
|
||||
@@ -375,4 +398,29 @@ struct DSL_vga {
|
||||
uint16_t voff1;
|
||||
};
|
||||
|
||||
SR_PRIV int dsl_en_ch_num(const struct sr_dev_inst *sdi);
|
||||
SR_PRIV gboolean dsl_check_conf_profile(libusb_device *dev);
|
||||
SR_PRIV int dsl_configure_probes(const struct sr_dev_inst *sdi);
|
||||
SR_PRIV uint64_t dsl_channel_depth(const struct sr_dev_inst *sdi);
|
||||
|
||||
SR_PRIV int dsl_wr_reg(const struct sr_dev_inst *sdi, uint8_t addr, uint8_t value);
|
||||
SR_PRIV int dsl_wr_dso(const struct sr_dev_inst *sdi, uint64_t cmd);
|
||||
SR_PRIV int dsl_wr_nvm(const struct sr_dev_inst *sdi, unsigned char *ctx, uint16_t addr, uint8_t len);
|
||||
SR_PRIV int dsl_rd_nvm(const struct sr_dev_inst *sdi, unsigned char *ctx, uint16_t addr, uint8_t len);
|
||||
|
||||
SR_PRIV int dsl_fpga_arm(const struct sr_dev_inst *sdi);
|
||||
SR_PRIV int dsl_fpga_config(struct libusb_device_handle *hdl, const char *filename);
|
||||
|
||||
SR_PRIV int dsl_config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
const struct sr_channel *ch,
|
||||
const struct sr_channel_group *cg);
|
||||
|
||||
SR_PRIV int dsl_dev_open(struct sr_dev_driver *di, struct sr_dev_inst *sdi, gboolean *fpga_done);
|
||||
SR_PRIV int dsl_dev_close(struct sr_dev_inst *sdi);
|
||||
SR_PRIV int dsl_dev_acquisition_stop(const struct sr_dev_inst *sdi, void *cb_data);
|
||||
SR_PRIV int dsl_dev_status_get(const struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end);
|
||||
|
||||
SR_PRIV unsigned int dsl_get_timeout(struct DSL_context *devc);
|
||||
SR_PRIV int dsl_start_transfers(const struct sr_dev_inst *sdi);
|
||||
|
||||
#endif
|
||||
|
||||
1892
libsigrok4DSL/hardware/DSL/dslogic.c
Normal file → Executable file
1892
libsigrok4DSL/hardware/DSL/dslogic.c
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
@@ -556,9 +556,6 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
|
||||
case SR_CONF_DSO_BITS:
|
||||
*data = g_variant_new_byte(devc->dso_bits);
|
||||
break;
|
||||
case SR_CONF_HW_STATUS:
|
||||
*data = g_variant_new_byte(0);
|
||||
break;
|
||||
case SR_CONF_VLD_CH_NUM:
|
||||
*data = g_variant_new_int16(NUM_PROBES);
|
||||
break;
|
||||
|
||||
@@ -878,9 +878,6 @@ enum {
|
||||
SR_CONF_MAX_DSO_SAMPLELIMITS,
|
||||
SR_CONF_HW_DEPTH,
|
||||
|
||||
/** Hardware status */
|
||||
SR_CONF_HW_STATUS,
|
||||
|
||||
/*--- Special stuff -------------------------------------------------*/
|
||||
|
||||
/** Scan options supported by the driver. */
|
||||
|
||||
Reference in New Issue
Block a user