Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Raptor Engineering Public Development
dsview
Commits
83d77b03
Commit
83d77b03
authored
7 years ago
by
DreamSourceLab
Browse files
Options
Download
Email Patches
Plain Diff
warnings fix
parent
233f8f84
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
161 additions
and
167 deletions
+161
-167
libsigrok4DSL/backend.c
libsigrok4DSL/backend.c
+1
-1
libsigrok4DSL/configure.ac
libsigrok4DSL/configure.ac
+6
-0
libsigrok4DSL/hardware/DSL/command.h
libsigrok4DSL/hardware/DSL/command.h
+1
-1
libsigrok4DSL/hardware/DSL/dscope.c
libsigrok4DSL/hardware/DSL/dscope.c
+43
-63
libsigrok4DSL/hardware/DSL/dsl.h
libsigrok4DSL/hardware/DSL/dsl.h
+2
-3
libsigrok4DSL/hardware/DSL/dslogic.c
libsigrok4DSL/hardware/DSL/dslogic.c
+29
-35
libsigrok4DSL/hardware/demo/demo.c
libsigrok4DSL/hardware/demo/demo.c
+16
-18
libsigrok4DSL/hwdriver.c
libsigrok4DSL/hwdriver.c
+3
-3
libsigrok4DSL/input/in_vcd.c
libsigrok4DSL/input/in_vcd.c
+2
-2
libsigrok4DSL/libsigrok.h
libsigrok4DSL/libsigrok.h
+11
-11
libsigrok4DSL/output/csv.c
libsigrok4DSL/output/csv.c
+1
-1
libsigrok4DSL/proto.h
libsigrok4DSL/proto.h
+10
-4
libsigrok4DSL/session.c
libsigrok4DSL/session.c
+2
-2
libsigrok4DSL/session_driver.c
libsigrok4DSL/session_driver.c
+23
-11
libsigrok4DSL/session_file.c
libsigrok4DSL/session_file.c
+3
-3
libsigrok4DSL/trigger.c
libsigrok4DSL/trigger.c
+8
-9
No files found.
libsigrok4DSL/backend.c
View file @
83d77b03
...
...
@@ -261,7 +261,7 @@ static int sanity_check_all_input_modules(void)
static
int
sanity_check_all_output_modules
(
void
)
{
int
i
,
errors
,
ret
=
SR_OK
;
struct
sr_output_module
**
outputs
;
const
struct
sr_output_module
**
outputs
;
const
char
*
d
;
sr_spew
(
"Sanity-checking all output modules."
);
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/configure.ac
View file @
83d77b03
...
...
@@ -52,6 +52,12 @@ AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
# https://github.com/rsyslog/rsyslog/issues/1179
# Seems libtool doesn't honors ARFLAGS, but statically set AR_FLAGS=cru
# This causes a few warnings on build:
# "ar u modifier ignored since D is the default (see U)"
m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"])
# Required for per-target flags or subdir-objects with C sources.
AM_PROG_CC_C_O
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/hardware/DSL/command.h
View file @
83d77b03
...
...
@@ -150,7 +150,7 @@ 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_acquis
t
ition
(
libusb_device_handle
*
devhdl
);
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
);
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/hardware/DSL/dscope.c
View file @
83d77b03
...
...
@@ -181,7 +181,7 @@ struct DSL_vga DSCope_vga[] = {
{500, DSCOPE_DEFAULT_VGAIN5, DSCOPE_DEFAULT_VGAIN5, DSCOPE_DEFAULT_VOFF, DSCOPE_DEFAULT_VOFF},
{1000,DSCOPE_DEFAULT_VGAIN6, DSCOPE_DEFAULT_VGAIN6, DSCOPE_DEFAULT_VOFF, DSCOPE_DEFAULT_VOFF},
{2000,DSCOPE_DEFAULT_VGAIN7, DSCOPE_DEFAULT_VGAIN7, DSCOPE_DEFAULT_VOFF, DSCOPE_DEFAULT_VOFF},
{0, 0, 0, 0},
{0, 0, 0,
0,
0},
};
struct DSL_vga DSCope20_vga[] = {
{10, DSCOPE20_DEFAULT_VGAIN0, DSCOPE20_DEFAULT_VGAIN0, DSCOPE20_DEFAULT_VOFF, CALI_VOFF_RANGE-DSCOPE20_DEFAULT_VOFF},
...
...
@@ -192,7 +192,7 @@ struct DSL_vga DSCope20_vga[] = {
{500, DSCOPE20_DEFAULT_VGAIN5, DSCOPE20_DEFAULT_VGAIN5, DSCOPE20_DEFAULT_VOFF, CALI_VOFF_RANGE-DSCOPE20_DEFAULT_VOFF},
{1000,DSCOPE20_DEFAULT_VGAIN6, DSCOPE20_DEFAULT_VGAIN6, DSCOPE20_DEFAULT_VOFF, CALI_VOFF_RANGE-DSCOPE20_DEFAULT_VOFF},
{2000,DSCOPE20_DEFAULT_VGAIN7, DSCOPE20_DEFAULT_VGAIN7, DSCOPE20_DEFAULT_VOFF, CALI_VOFF_RANGE-DSCOPE20_DEFAULT_VOFF},
{0, 0, 0, 0},
{0, 0, 0,
0,
0},
};
/**
...
...
@@ -466,7 +466,7 @@ static int fpga_setting(const struct sr_dev_inst *sdi)
result = SR_OK;
ret = libusb_bulk_transfer(hdl, 2 | LIBUSB_ENDPOINT_OUT,
&setting, sizeof(struct DSL_setting),
(unsigned char*)
&setting, sizeof(struct DSL_setting),
&transferred, 1000);
if (ret < 0) {
...
...
@@ -751,7 +751,7 @@ static int init(struct sr_context *sr_ctx)
}
static struct DSL_vga* get_vga_ptr(struct sr_dev_inst *sdi)
static struct DSL_vga* get_vga_ptr(
const
struct sr_dev_inst *sdi)
{
struct DSL_vga *vga_ptr = NULL;
if (strcmp(sdi->model, "DSCope") == 0)
...
...
@@ -762,7 +762,7 @@ static struct DSL_vga* get_vga_ptr(struct sr_dev_inst *sdi)
return vga_ptr;
}
static uint16_t get_default_trans(struct sr_dev_inst *sdi)
static uint16_t get_default_trans(
const
struct sr_dev_inst *sdi)
{
uint16_t trans = 1;
if (strcmp(sdi->model, "DSCope") == 0)
...
...
@@ -773,21 +773,22 @@ static uint16_t get_default_trans(struct sr_dev_inst *sdi)
return trans;
}
static uint16_t get_default_voff(struct sr_dev_inst *sdi, int ch_index)
static uint16_t get_default_voff(
const
struct sr_dev_inst *sdi, int ch_index)
{
uint16_t voff = 0;
if (strcmp(sdi->model, "DSCope") == 0)
if (strcmp(sdi->model, "DSCope") == 0)
{
voff = DSCOPE_DEFAULT_VOFF;
else if (strcmp(sdi->model, "DSCope20") == 0)
}
else if (strcmp(sdi->model, "DSCope20") == 0)
{
if (ch_index == 1)
voff = CALI_VOFF_RANGE - DSCOPE20_DEFAULT_VOFF;
else
voff = DSCOPE20_DEFAULT_VOFF;
}
return voff;
}
static uint64_t get_default_vgain(struct sr_dev_inst *sdi, int num)
static uint64_t get_default_vgain(
const
struct sr_dev_inst *sdi,
unsigned
int num)
{
uint64_t vgain = 0;
if (strcmp(sdi->model, "DSCope") == 0) {
...
...
@@ -802,10 +803,10 @@ static uint64_t get_default_vgain(struct sr_dev_inst *sdi, int num)
return vgain;
}
static
int
probe_init(struct sr_dev_inst *sdi)
static
void
probe_init(struct sr_dev_inst *sdi)
{
int i;
GList *l;
G
S
List *l;
for (l = sdi->channels; l; l = l->next) {
struct sr_channel *probe = (struct sr_channel *)l->data;
if (sdi->mode == DSO) {
...
...
@@ -840,9 +841,7 @@ static int set_probes(struct sr_dev_inst *sdi, int num_probes)
static int adjust_probes(struct sr_dev_inst *sdi, int num_probes)
{
uint16_t j;
GSList *l;
struct sr_channel *probe;
GSList *p;
assert(num_probes > 0);
...
...
@@ -856,7 +855,7 @@ static int adjust_probes(struct sr_dev_inst *sdi, int num_probes)
}
while(j > num_probes) {
g_slist_delete_link(sdi->channels, g_slist_last(sdi->channels));
sdi->channels =
g_slist_delete_link(sdi->channels, g_slist_last(sdi->channels));
j--;
}
...
...
@@ -989,7 +988,7 @@ static GSList *dev_mode_list(const struct sr_dev_inst *sdi)
{
(void)sdi;
GSList *l = NULL;
int i;
unsigned
int i;
for(i = 0; i < ARRAY_SIZE(mode_list); i++) {
l = g_slist_append(l, &mode_list[i]);
...
...
@@ -998,7 +997,7 @@ static GSList *dev_mode_list(const struct sr_dev_inst *sdi)
return l;
}
static uint64_t dso_vga(struct sr_dev_inst *sdi, struct sr_channel* ch)
static uint64_t dso_vga(
const
struct sr_dev_inst *sdi,
const
struct sr_channel* ch)
{
int i;
struct DSL_vga *vga_ptr = get_vga_ptr(sdi);
...
...
@@ -1010,7 +1009,7 @@ static uint64_t dso_vga(struct sr_dev_inst *sdi, struct sr_channel* ch)
return 0;
}
static uint64_t dso_voff(struct sr_dev_inst *sdi, struct sr_channel* ch)
static uint64_t dso_voff(
const
struct sr_dev_inst *sdi,
const
struct sr_channel* ch)
{
int i;
struct DSL_vga *vga_ptr = get_vga_ptr(sdi);
...
...
@@ -1021,7 +1020,7 @@ static uint64_t dso_voff(struct sr_dev_inst *sdi, struct sr_channel* ch)
return 0;
}
static uint64_t dso_vpos(struct sr_dev_inst *sdi, struct sr_channel* ch)
static uint64_t dso_vpos(
const
struct sr_dev_inst *sdi,
const
struct sr_channel* ch)
{
uint64_t vpos;
int vpos_coarse, vpos_fine;
...
...
@@ -1052,7 +1051,7 @@ static uint64_t dso_vpos(struct sr_dev_inst *sdi, struct sr_channel* ch)
return 0;
}
static uint64_t dso_cmd_gen(struct sr_dev_inst *sdi, struct sr_channel* ch, int id)
static uint64_t dso_cmd_gen(
const
struct sr_dev_inst *sdi, struct sr_channel* ch, int id)
{
struct DSL_context *devc;
uint64_t cmd = 0;
...
...
@@ -1208,7 +1207,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
struct DSL_context *devc;
struct sr_usb_dev_inst *usb;
char str[128];
int i;
unsigned
int i;
struct DSL_vga *vga_ptr;
uint8_t tmp_u8;
int ret;
...
...
@@ -1471,7 +1470,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
struct sr_channel *ch,
const
struct sr_channel_group *cg )
struct sr_channel_group *cg )
{
struct DSL_context *devc;
const char *stropt;
...
...
@@ -1531,7 +1530,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
sr_dbg("%s: Initial setting for DSO mode failed", __func__);
devc->cur_samplerate = DSCOPE_MAX_SAMPLERATE / num_probes;
devc->limit_samples = DSCOPE_MAX_DEPTH / num_probes;
} else
if (sdi->mode == ANALOG)
{
} else {
num_probes = devc->profile->dev_caps & DEV_CAPS_16BIT ? MAX_ANALOG_PROBES_NUM : 1;
}
sr_dev_probes_free(sdi);
...
...
@@ -1696,7 +1695,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
* because the samplelimits may changed
*/
devc->trigger_hpos = devc->trigger_hrate * en_ch_num(sdi) * devc->limit_samples / 200.0;
if ((ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi,
1
, SR_CONF_HORIZ_TRIGGERPOS))) == SR_OK)
if ((ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi,
NULL
, SR_CONF_HORIZ_TRIGGERPOS))) == SR_OK)
sr_dbg("%s: setting DSO Horiz Trigger Position to %d",
__func__, devc->trigger_hpos);
else
...
...
@@ -1730,8 +1729,8 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
devc->zero_stage = -1;
devc->zero_pcnt = 0;
devc->zero_comb = -1;
GList *l;
int i;
G
S
List *l;
unsigned
int i;
struct DSL_vga *vga_ptr = get_vga_ptr(sdi);
for(l = sdi->channels; l; l = l->next) {
struct sr_channel *probe = (struct sr_channel *)l->data;
...
...
@@ -1810,11 +1809,12 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
int i;
struct DSL_vga *vga_ptr = get_vga_ptr(sdi);
for (i = 0; vga_ptr && (vga_ptr+i)->key; i++) {
if ((vga_ptr+i)->key == ch->vdiv)
if ((vga_ptr+i)->key == ch->vdiv)
{
if (ch->index == 0)
(vga_ptr+i)->vgain0 = vgain;
else if (ch->index == 1)
(vga_ptr+i)->vgain1 = vgain;
}
}
ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi, ch, SR_CONF_VDIV));
if (ret == SR_OK)
...
...
@@ -1840,11 +1840,12 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
int i;
struct DSL_vga *vga_ptr = get_vga_ptr(sdi);
for (i = 0; vga_ptr && (vga_ptr+i)->key; i++) {
if ((vga_ptr+i)->key == ch->vdiv)
if ((vga_ptr+i)->key == ch->vdiv)
{
if (ch->index == 0)
(vga_ptr+i)->voff0 = voff;
else if (ch->index == 1)
(vga_ptr+i)->voff1 = voff;
}
}
ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi, ch, SR_CONF_VPOS));
if (ret == SR_OK)
...
...
@@ -1929,7 +1930,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
static int dso_init(const struct sr_dev_inst *sdi)
{
int ret
, i
;
int ret;
GSList *l;
struct sr_usb_dev_inst *usb = sdi->conn;
...
...
@@ -1990,16 +1991,16 @@ static int dso_init(const struct sr_dev_inst *sdi)
return ret;
}
static int dso_zero(struct sr_dev_inst *sdi, struct sr_status mstatus)
static int dso_zero(
const
struct sr_dev_inst *sdi, struct sr_status mstatus)
{
struct DSL_context *devc = sdi->priv;
struct sr_usb_dev_inst *usb = sdi->conn;
GSList *l;
int ret
, i
;
int ret;
static double vpos_back[2];
static uint64_t vdiv_back[2];
struct DSL_vga *vga_ptr = get_vga_ptr(sdi);
struct sr_channel *probe0, *probe1;
struct sr_channel *probe0
= NULL
, *probe1
= NULL
;
for(l = sdi->channels; l; l = l->next) {
struct sr_channel *probe = (struct sr_channel *)l->data;
if (probe->index == 0)
...
...
@@ -2152,7 +2153,6 @@ static int dev_open(struct sr_dev_inst *sdi)
struct sr_usb_dev_inst *usb;
struct DSL_context *devc;
int ret;
int64_t timediff_us, timediff_ms;
uint8_t hw_info;
GSList *l;
gboolean zeroed;
...
...
@@ -2340,21 +2340,6 @@ static void resubmit_transfer(struct libusb_transfer *transfer)
sr_err("%s: %s", __func__, libusb_error_name(ret));
}
static struct sr_config * new_config(int key, GVariant *data)
{
struct sr_config *config;
if (!(config = g_try_malloc0(sizeof(struct sr_config)))) {
sr_err("META config malloc failed.");
return NULL;
}
config->key = key;
config->data = data;
return config;
}
static void receive_transfer(struct libusb_transfer *transfer)
{
struct sr_datafeed_packet packet;
...
...
@@ -2362,12 +2347,12 @@ static void receive_transfer(struct libusb_transfer *transfer)
struct sr_datafeed_dso dso;
struct sr_datafeed_analog analog;
const
uint8_t *cur_buf = transfer->buffer;
uint8_t *cur_buf = transfer->buffer;
struct DSL_context *devc = transfer->user_data;
struct sr_dev_inst *sdi = devc->cb_data;
const int sample_width = 2;
int cur_sample_count = transfer->actual_length / sample_width;
int i;
unsigned
int i;
if (devc->data_lock) {
resubmit_transfer(transfer);
...
...
@@ -2455,7 +2440,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
analog.mq = SR_MQ_VOLTAGE;
analog.unit = SR_UNIT_VOLT;
analog.mqflags = SR_MQFLAG_AC;
analog.data = cur_buf;
analog.data =
(float *)
cur_buf;
}
if (devc->limit_samples) {
...
...
@@ -2572,7 +2557,7 @@ static int dev_transfer_start(const struct sr_dev_inst *sdi)
struct DSL_context *devc;
struct sr_usb_dev_inst *usb;
struct libusb_transfer *transfer;
unsigned int i,
timeout,
num_transfers;
unsigned int i, num_transfers;
int ret;
unsigned char *buf;
size_t size;
...
...
@@ -2581,10 +2566,6 @@ static int dev_transfer_start(const struct sr_dev_inst *sdi)
devc = sdi->priv;
usb = sdi->conn;
// timeout = get_timeout(devc);
// num_transfers = get_number_of_transfers(devc);
// size = get_buffer_size(devc);
timeout = 500;
#ifndef _WIN32
num_transfers = 1;
#else
...
...
@@ -2640,7 +2621,6 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
struct drv_context *drvc;
struct DSL_context *devc;
struct sr_usb_dev_inst *usb;
int i;
int ret;
(void)fd;
...
...
@@ -2720,8 +2700,10 @@ static void receive_trigger_pos(struct libusb_transfer *transfer)
}
}
static int dev_acquisition_start(
const
struct sr_dev_inst *sdi, void *cb_data)
static int dev_acquisition_start(struct sr_dev_inst *sdi, void *cb_data)
{
(void)cb_data;
struct DSL_context *devc;
struct drv_context *drvc;
struct sr_usb_dev_inst *usb;
...
...
@@ -2790,7 +2772,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
*/
if (sdi->mode == DSO) {
devc->trigger_hpos = devc->trigger_hrate * en_ch_num(sdi) * devc->limit_samples / 200.0;
if ((ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi,
1
, SR_CONF_HORIZ_TRIGGERPOS))) == SR_OK)
if ((ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi,
NULL
, SR_CONF_HORIZ_TRIGGERPOS))) == SR_OK)
sr_dbg("%s: setting DSO Horiz Trigger Position to %d",
__func__, devc->trigger_hpos);
else
...
...
@@ -2810,7 +2792,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
}
transfer = libusb_alloc_transfer(0);
libusb_fill_bulk_transfer(transfer, usb->devhdl,
6 | LIBUSB_ENDPOINT_IN, trigger_pos, sizeof(struct ds_trigger_pos),
6 | LIBUSB_ENDPOINT_IN,
(unsigned char*)
trigger_pos, sizeof(struct ds_trigger_pos),
receive_trigger_pos, devc, 0);
if ((ret = libusb_submit_transfer(transfer)) != 0) {
sr_err("%s: Failed to submit trigger_pos transfer: %s.",
...
...
@@ -2853,15 +2835,13 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
return SR_OK;
}
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
static int dev_acquisition_stop(
const
struct sr_dev_inst *sdi, void *cb_data)
{
(void)cb_data;
struct drv_context *drvc;
struct DSL_context *devc;
struct sr_usb_dev_inst *usb;
drvc = di->priv;
devc = sdi->priv;
usb = sdi->conn;
...
...
@@ -2873,7 +2853,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
return SR_OK;
}
static int dev_status_get(struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
static int dev_status_get(
const
struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
{
int ret = SR_ERR;
if (sdi) {
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/hardware/DSL/dsl.h
View file @
83d77b03
...
...
@@ -236,7 +236,7 @@ static const struct DSL_profile supported_DSCope[] = {
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
};
static
const
gboolean
default_ms_en
[
DSO_MS_END
-
DSO_MS_BEGIN
]
=
{
static
const
gboolean
default_ms_en
[]
=
{
FALSE
,
/* DSO_MS_BEGIN */
TRUE
,
/* DSO_MS_FREQ */
FALSE
,
/* DSO_MS_PERD */
...
...
@@ -245,7 +245,6 @@ static const gboolean default_ms_en[DSO_MS_END - DSO_MS_BEGIN] = {
FALSE
,
/* DSO_MS_VRMS */
FALSE
,
/* DSO_MS_VMEA */
FALSE
,
/* DSO_MS_VP2P */
FALSE
,
/* DSO_MS_END */
};
enum
{
...
...
@@ -369,7 +368,7 @@ struct DSL_setting {
};
struct
DSL_vga
{
int
key
;
u
int
64_t
key
;
uint64_t
vgain0
;
uint64_t
vgain1
;
uint16_t
voff0
;
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/hardware/DSL/dslogic.c
View file @
83d77b03
...
...
@@ -36,11 +36,11 @@
#undef max
#define max(a,b) ((a)>(b)?(a):(b))
static const int single_buffer_time = 20;
static const int total_buffer_time = 200;
static const int instant_buffer_size = 1024 * 1024;
static const int cons_buffer_size = 128;
static const int buffer_cnt = 4;
static const
unsigned
int single_buffer_time = 20;
static const
unsigned
int total_buffer_time = 200;
static const
unsigned
int instant_buffer_size = 1024 * 1024;
static const
unsigned
int cons_buffer_size = 128;
static const
unsigned
int buffer_cnt = 4;
static struct sr_dev_mode mode_list[] = {
{"LA", LOGIC},
...
...
@@ -568,7 +568,8 @@ static int fpga_setting(const struct sr_dev_inst *sdi)
result = SR_OK;
ret = libusb_bulk_transfer(hdl, 2 | LIBUSB_ENDPOINT_OUT,
&setting, sizeof(struct DSL_setting),
(unsigned char *)&setting,
sizeof(struct DSL_setting),
&transferred, 1000);
if (ret < 0) {
...
...
@@ -851,10 +852,10 @@ static int init(struct sr_context *sr_ctx)
return std_hw_init(sr_ctx, di, LOG_PREFIX);
}
static
int
probe_init(struct sr_dev_inst *sdi)
static
void
probe_init(struct sr_dev_inst *sdi)
{
int i;
GList *l;
G
S
List *l;
for (l = sdi->channels; l; l = l->next) {
struct sr_channel *probe = (struct sr_channel *)l->data;
if (sdi->mode == DSO) {
...
...
@@ -902,7 +903,7 @@ static int adjust_probes(struct sr_dev_inst *sdi, int num_probes)
}
while(j > num_probes) {
g_slist_delete_link(sdi->channels, g_slist_last(sdi->channels));
sdi->channels =
g_slist_delete_link(sdi->channels, g_slist_last(sdi->channels));
j--;
}
...
...
@@ -1037,7 +1038,7 @@ static GSList *dev_list(void)
static GSList *dev_mode_list(const struct sr_dev_inst *sdi)
{
GSList *l = NULL;
int i;
unsigned
int i;
if (strcmp(sdi->model, "DSLogic") == 0) {
for(i = 0; i < ARRAY_SIZE(mode_list); i++) {
...
...
@@ -1170,12 +1171,11 @@ static uint64_t dso_cmd_gen(const struct sr_dev_inst *sdi, struct sr_channel* ch
return cmd;
}
static int dso_init(const struct sr_dev_inst *sdi
, gboolean from_eep
)
static int dso_init(const struct sr_dev_inst *sdi)
{
int ret
, i
;
int ret;
GSList *l;
struct sr_usb_dev_inst *usb = sdi->conn;
gboolean zeroed = FALSE;
for(l = sdi->channels; l; l = l->next) {
struct sr_channel *probe = (struct sr_channel *)l->data;
...
...
@@ -1523,13 +1523,13 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
struct sr_channel *ch,
const
struct sr_channel_group *cg )
struct sr_channel_group *cg )
{
struct DSL_context *devc;
const char *stropt;
int ret, num_probes;
struct sr_usb_dev_inst *usb;
int i;
unsigned
int i;
struct drv_context *drvc;
(void)cg;
...
...
@@ -1585,7 +1585,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
devc->cur_samplerate = DSLOGIC_MAX_DSO_SAMPLERATE / num_probes;
devc->limit_samples = DSLOGIC_MAX_DSO_DEPTH / num_probes;
devc->samplerates_size = 15;
} else
if (sdi->mode == ANALOG)
{
} else {
command_wr_reg(usb->devhdl, bmSCOPE_CLR, EEWP_ADDR);
num_probes = devc->profile->dev_caps & DEV_CAPS_16BIT ? MAX_ANALOG_PROBES_NUM : 1;
devc->op_mode = SR_OP_STREAM;
...
...
@@ -1597,7 +1597,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
set_probes(sdi, num_probes);
sr_dbg("%s: setting mode to %d", __func__, sdi->mode);
if (sdi->mode == DSO) {
dso_init(sdi
, 0
);
dso_init(sdi);
}
} else if (id == SR_CONF_OPERATION_MODE) {
stropt = g_variant_get_string(data, NULL);
...
...
@@ -1870,7 +1870,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
* because the samplelimits may changed
*/
devc->trigger_hpos = devc->trigger_hrate * en_ch_num(sdi) * devc->limit_samples / 200.0;
if ((ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi,
1
, SR_CONF_HORIZ_TRIGGERPOS))) == SR_OK)
if ((ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi,
NULL
, SR_CONF_HORIZ_TRIGGERPOS))) == SR_OK)
sr_dbg("%s: setting DSO Horiz Trigger Position to %d",
__func__, devc->trigger_hpos);
else
...
...
@@ -2005,9 +2005,7 @@ static int dev_open(struct sr_dev_inst *sdi)
{
struct sr_usb_dev_inst *usb;
struct DSL_context *devc;
GSList *l;
int ret;
int64_t timediff_us, timediff_ms;
uint8_t hw_info;
gboolean fpga_done;
...
...
@@ -2101,12 +2099,10 @@ static int dev_open(struct sr_dev_inst *sdi)
static int dev_close(struct sr_dev_inst *sdi)
{
struct sr_usb_dev_inst *usb;
struct DSL_context *devc;
usb = sdi->conn;
if (usb->devhdl == NULL)
return SR_ERR;
devc = sdi->priv;
sr_info("DSLogic: Closing device %d on %d.%d interface %d.",
sdi->index, usb->bus, usb->address, USB_INTERFACE);
...
...
@@ -2205,10 +2201,9 @@ static void receive_transfer(struct libusb_transfer *transfer)
struct sr_datafeed_logic logic;
struct sr_datafeed_dso dso;
struct sr_datafeed_analog analog;
uint64_t cur_sample_count;
int i, j, k;
uint64_t cur_sample_count = 0;
const
uint8_t *cur_buf = transfer->buffer;
uint8_t *cur_buf = transfer->buffer;
struct DSL_context *devc = transfer->user_data;
struct sr_dev_inst *sdi = devc->cb_data;
const int sample_width = (devc->sample_wide) ? 2 : 1;
...
...
@@ -2305,7 +2300,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
analog.mq = SR_MQ_VOLTAGE;
analog.unit = SR_UNIT_VOLT;
analog.mqflags = SR_MQFLAG_AC;
analog.data = cur_buf;
analog.data =
(float *)
cur_buf;
}
if ((devc->limit_samples && devc->num_bytes < devc->actual_bytes) ||
...
...
@@ -2392,7 +2387,6 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
struct drv_context *drvc;
struct DSL_context *devc;
struct sr_usb_dev_inst *usb;
unsigned int i;
int ret;
(void)fd;
...
...
@@ -2432,7 +2426,6 @@ static void receive_trigger_pos(struct libusb_transfer *transfer)
struct sr_datafeed_packet packet;
struct ds_trigger_pos *trigger_pos;
const struct sr_dev_inst *sdi;
int ret;
uint64_t remain_cnt;
packet.status = SR_PKT_OK;
...
...
@@ -2485,7 +2478,7 @@ static int start_transfers(const struct sr_dev_inst *sdi)
int ret;
unsigned char *buf;
size_t size;
int dso_buffer_size;
unsigned
int dso_buffer_size;
struct ds_trigger_pos *trigger_pos;
devc = sdi->priv;
...
...
@@ -2513,7 +2506,7 @@ static int start_transfers(const struct sr_dev_inst *sdi)
}
transfer = libusb_alloc_transfer(0);
libusb_fill_bulk_transfer(transfer, usb->devhdl,
6 | LIBUSB_ENDPOINT_IN, trigger_pos, sizeof(struct ds_trigger_pos),
6 | LIBUSB_ENDPOINT_IN,
(unsigned char *)
trigger_pos, sizeof(struct ds_trigger_pos),
receive_trigger_pos, devc, 0);
if ((ret = libusb_submit_transfer(transfer)) != 0) {
sr_err("%s: Failed to submit trigger_pos transfer: %s.",
...
...
@@ -2555,12 +2548,13 @@ static int start_transfers(const struct sr_dev_inst *sdi)
return SR_OK;
}
static int dev_acquisition_start(
const
struct sr_dev_inst *sdi, void *cb_data)
static int dev_acquisition_start(struct sr_dev_inst *sdi, void *cb_data)
{
(void)cb_data;
struct DSL_context *devc;
struct drv_context *drvc;
struct sr_usb_dev_inst *usb;
struct libusb_transfer *transfer;
const struct libusb_pollfd **lupfd;
unsigned int i;
int ret;
...
...
@@ -2618,7 +2612,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
*/
if (sdi->mode == DSO) {
devc->trigger_hpos = devc->trigger_hrate * en_ch_num(sdi) * devc->limit_samples / 200.0;
if ((ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi,
1
, SR_CONF_HORIZ_TRIGGERPOS))) == SR_OK)
if ((ret = command_dso_ctrl(usb->devhdl, dso_cmd_gen(sdi,
NULL
, SR_CONF_HORIZ_TRIGGERPOS))) == SR_OK)
sr_dbg("%s: setting DSO Horiz Trigger Position to %d",
__func__, devc->trigger_hpos);
else
...
...
@@ -2661,7 +2655,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
return SR_OK;
}
static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
static int dev_acquisition_stop(
const
struct sr_dev_inst *sdi, void *cb_data)
{
(void)cb_data;
...
...
@@ -2679,7 +2673,7 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
return SR_OK;
}
static int dev_status_get(struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
static int dev_status_get(
const
struct sr_dev_inst *sdi, struct sr_status *status, int begin, int end)
{
int ret = SR_ERR;
if (sdi) {
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/hardware/demo/demo.c
View file @
83d77b03
...
...
@@ -287,7 +287,7 @@ static const char *probe_names[NUM_PROBES + 1] = {
};
static
const
gboolean
default_ms_en
[
DSO_MS_END
-
DSO_MS_BEGIN
]
=
{
static
const
gboolean
default_ms_en
[]
=
{
FALSE
,
/* DSO_MS_BEGIN */
TRUE
,
/* DSO_MS_FREQ */
FALSE
,
/* DSO_MS_PERD */
...
...
@@ -296,7 +296,6 @@ static const gboolean default_ms_en[DSO_MS_END - DSO_MS_BEGIN] = {
FALSE
,
/* DSO_MS_VRMS */
FALSE
,
/* DSO_MS_VMEA */
FALSE
,
/* DSO_MS_VP2P */
FALSE
,
/* DSO_MS_END */
};
/* Private, per-device-instance driver context. */
...
...
@@ -308,7 +307,7 @@ static struct sr_dev_driver *di = &demo_driver_info;
extern
struct
ds_trigger
*
trigger
;
static
int
hw_dev_acquisition_stop
(
struct
sr_dev_inst
*
sdi
,
void
*
cb_data
);
static
int
hw_dev_acquisition_stop
(
const
struct
sr_dev_inst
*
sdi
,
void
*
cb_data
);
static
int
clear_instances
(
void
)
{
...
...
@@ -400,7 +399,7 @@ static GSList *hw_dev_mode_list(const struct sr_dev_inst *sdi)
{
(
void
)
sdi
;
GSList
*
l
=
NULL
;
int
i
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
mode_list
);
i
++
)
{
l
=
g_slist_append
(
l
,
&
mode_list
[
i
]);
...
...
@@ -472,16 +471,15 @@ static int hw_cleanup(void)
return
ret
;
}
static
int
en_ch_num
(
const
struct
sr_dev_inst
*
sdi
)
static
unsigned
int
en_ch_num
(
const
struct
sr_dev_inst
*
sdi
)
{
GSList
*
l
;
int
channel_en_cnt
=
0
;
unsigned
int
channel_en_cnt
=
0
;
for
(
l
=
sdi
->
channels
;
l
;
l
=
l
->
next
)
{
struct
sr_channel
*
probe
=
(
struct
sr_channel
*
)
l
->
data
;
channel_en_cnt
+=
probe
->
enabled
;
}
channel_en_cnt
+=
(
channel_en_cnt
==
0
);
return
channel_en_cnt
;
}
...
...
@@ -573,7 +571,7 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
static
int
config_set
(
int
id
,
GVariant
*
data
,
struct
sr_dev_inst
*
sdi
,
struct
sr_channel
*
ch
,
const
struct
sr_channel_group
*
cg
)
struct
sr_channel_group
*
cg
)
{
uint16_t
i
,
j
;
int
ret
;
...
...
@@ -822,16 +820,16 @@ static void samples_generator(uint16_t *buf, uint64_t size,
const
struct
sr_dev_inst
*
sdi
,
struct
dev_context
*
devc
)
{
uint64_t
i
,
pre0_i
,
pre1_i
,
index
;
uint64_t
i
,
pre0_i
,
pre1_i
;
GSList
*
l
;
struct
sr_channel
*
probe
;
int
offset
;
int
start_rand
;
unsigned
int
start_rand
;
const
uint64_t
span
=
DEMO_MAX_DSO_SAMPLERATE
/
devc
->
cur_samplerate
;
const
uint64_t
len
=
ARRAY_SIZE
(
sinx
)
-
1
;
int
*
pre_buf
;
const
int
*
pre_buf
;
uint16_t
tmp_u16
=
0
;
int
ch_num
=
en_ch_num
(
sdi
);
unsigned
int
ch_num
=
en_ch_num
(
sdi
)
?
en_ch_num
(
sdi
)
:
1
;
switch
(
devc
->
sample_generator
)
{
case
PATTERN_SINE
:
/* Sine */
...
...
@@ -955,11 +953,11 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
struct
sr_datafeed_dso
dso
;
struct
sr_datafeed_analog
analog
;
double
samples_elaspsed
;
uint64_t
samples_to_send
=
0
,
expected_samplenum
,
sending_now
;
uint64_t
samples_to_send
=
0
,
sending_now
;
int64_t
time
,
elapsed
;
static
uint16_t
last_sample
=
0
;
uint16_t
cur_sample
;
int
i
;
u
int
64_t
i
;
(
void
)
fd
;
(
void
)
revents
;
...
...
@@ -1069,7 +1067,7 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
analog
.
mq
=
SR_MQ_VOLTAGE
;
analog
.
unit
=
SR_UNIT_VOLT
;
analog
.
mqflags
=
SR_MQFLAG_AC
;
analog
.
data
=
devc
->
buf
;
analog
.
data
=
(
float
*
)
devc
->
buf
;
}
if
(
sdi
->
mode
==
DSO
&&
!
devc
->
instant
)
{
...
...
@@ -1098,7 +1096,7 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *sdi)
return
TRUE
;
}
static
int
hw_dev_acquisition_start
(
const
struct
sr_dev_inst
*
sdi
,
static
int
hw_dev_acquisition_start
(
struct
sr_dev_inst
*
sdi
,
void
*
cb_data
)
{
struct
dev_context
*
const
devc
=
sdi
->
priv
;
...
...
@@ -1159,7 +1157,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
return
SR_OK
;
}
static
int
hw_dev_acquisition_stop
(
struct
sr_dev_inst
*
sdi
,
void
*
cb_data
)
static
int
hw_dev_acquisition_stop
(
const
struct
sr_dev_inst
*
sdi
,
void
*
cb_data
)
{
(
void
)
cb_data
;
...
...
@@ -1184,7 +1182,7 @@ static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
return
SR_OK
;
}
static
int
hw_dev_status_get
(
struct
sr_dev_inst
*
sdi
,
struct
sr_status
*
status
,
int
begin
,
int
end
)
static
int
hw_dev_status_get
(
const
struct
sr_dev_inst
*
sdi
,
struct
sr_status
*
status
,
int
begin
,
int
end
)
{
(
void
)
begin
;
(
void
)
end
;
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/hwdriver.c
View file @
83d77b03
...
...
@@ -326,9 +326,9 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver,
* but this is not to be flagged as an error by the caller; merely
* as an indication that it's not applicable.
*/
SR_API
int
sr_config_set
(
const
struct
sr_dev_inst
*
sdi
,
const
struct
sr_channel
*
ch
,
const
struct
sr_channel_group
*
cg
,
SR_API
int
sr_config_set
(
struct
sr_dev_inst
*
sdi
,
struct
sr_channel
*
ch
,
struct
sr_channel_group
*
cg
,
int
key
,
GVariant
*
data
)
{
int
ret
;
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/input/in_vcd.c
View file @
83d77b03
...
...
@@ -299,7 +299,7 @@ static int format_match(const char *filename)
gchar
*
name
=
NULL
,
*
contents
=
NULL
;
gboolean
status
;
file
=
g_
fopen
(
filename
,
"r"
);
file
=
fopen
(
filename
,
"r"
);
if
(
file
==
NULL
)
return
FALSE
;
...
...
@@ -565,7 +565,7 @@ static int loadfile(struct sr_input *in, const char *filename)
ctx
=
in
->
internal
;
packet
.
status
=
SR_PKT_OK
;
if
((
file
=
g_
fopen
(
filename
,
"r"
))
==
NULL
)
if
((
file
=
fopen
(
filename
,
"r"
))
==
NULL
)
return
SR_ERR
;
if
(
!
parse_header
(
file
,
ctx
))
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/libsigrok.h
View file @
83d77b03
...
...
@@ -156,8 +156,6 @@ enum {
#define SR_PRIV
#endif
typedef
int
(
*
sr_receive_data_callback_t
)(
int
fd
,
int
revents
,
const
struct
sr_dev_inst
*
sdi
);
/** Data types used by sr_config_info(). */
enum
{
SR_T_UINT64
=
10000
,
...
...
@@ -456,13 +454,13 @@ struct sr_output {
* A pointer to this output format's 'struct sr_output_format'.
* The frontend can use this to call the module's callbacks.
*/
struct
sr_output_module
*
module
;
const
struct
sr_output_module
*
module
;
/**
* The device for which this output module is creating output. This
* can be used by the module to find out probe names and numbers.
*/
struct
sr_dev_inst
*
sdi
;
const
struct
sr_dev_inst
*
sdi
;
/**
* An optional parameter which the frontend can pass in to the
...
...
@@ -665,7 +663,7 @@ struct sr_status {
uint64_t
ch1_period
;
uint32_t
ch1_pcnt
;
u
int
32_t
vlen
;
int
vlen
;
gboolean
stream_mode
;
uint32_t
sample_divider
;
gboolean
sample_divider_tog
;
...
...
@@ -1084,9 +1082,9 @@ struct sr_dev_driver {
const
struct
sr_channel
*
ch
,
const
struct
sr_channel_group
*
cg
);
int
(
*
config_set
)
(
int
id
,
GVariant
*
data
,
const
struct
sr_dev_inst
*
sdi
,
const
struct
sr_channel
*
ch
,
const
struct
sr_channel_group
*
cg
);
struct
sr_dev_inst
*
sdi
,
struct
sr_channel
*
ch
,
struct
sr_channel_group
*
cg
);
int
(
*
config_list
)
(
int
info_id
,
GVariant
**
data
,
const
struct
sr_dev_inst
*
sdi
,
const
struct
sr_channel_group
*
cg
);
...
...
@@ -1094,12 +1092,12 @@ struct sr_dev_driver {
/* Device-specific */
int
(
*
dev_open
)
(
struct
sr_dev_inst
*
sdi
);
int
(
*
dev_close
)
(
struct
sr_dev_inst
*
sdi
);
int
(
*
dev_status_get
)
(
struct
sr_dev_inst
*
sdi
,
int
(
*
dev_status_get
)
(
const
struct
sr_dev_inst
*
sdi
,
struct
sr_status
*
status
,
int
begin
,
int
end
);
int
(
*
dev_acquisition_start
)
(
const
struct
sr_dev_inst
*
sdi
,
int
(
*
dev_acquisition_start
)
(
struct
sr_dev_inst
*
sdi
,
void
*
cb_data
);
int
(
*
dev_acquisition_stop
)
(
struct
sr_dev_inst
*
sdi
,
int
(
*
dev_acquisition_stop
)
(
const
struct
sr_dev_inst
*
sdi
,
void
*
cb_data
);
/* Dynamic */
...
...
@@ -1177,6 +1175,8 @@ struct ds_trigger_pos {
unsigned
char
first_block
[
488
];
};
typedef
int
(
*
sr_receive_data_callback_t
)(
int
fd
,
int
revents
,
const
struct
sr_dev_inst
*
sdi
);
#include "proto.h"
#include "version.h"
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/output/csv.c
View file @
83d77b03
...
...
@@ -236,7 +236,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
*
out
=
g_string_sized_new
(
512
);
}
for
(
i
=
0
;
i
<
dso
->
num_samples
;
i
++
)
{
for
(
i
=
0
;
i
<
(
uint64_t
)
dso
->
num_samples
;
i
++
)
{
for
(
j
=
0
;
j
<
ctx
->
num_enabled_channels
;
j
++
)
{
idx
=
ctx
->
channel_index
[
j
];
p
=
dso
->
data
+
i
*
ctx
->
num_enabled_channels
+
idx
*
((
ctx
->
num_enabled_channels
>
1
)
?
1
:
0
);
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/proto.h
View file @
83d77b03
...
...
@@ -69,9 +69,9 @@ SR_API int sr_config_get(const struct sr_dev_driver *driver,
const
struct
sr_channel
*
ch
,
const
struct
sr_channel_group
*
cg
,
int
key
,
GVariant
**
data
);
SR_API
int
sr_config_set
(
const
struct
sr_dev_inst
*
sdi
,
const
struct
sr_channel
*
ch
,
const
struct
sr_channel_group
*
cg
,
SR_API
int
sr_config_set
(
struct
sr_dev_inst
*
sdi
,
struct
sr_channel
*
ch
,
struct
sr_channel_group
*
cg
,
int
key
,
GVariant
*
data
);
SR_API
int
sr_config_list
(
const
struct
sr_dev_driver
*
driver
,
const
struct
sr_dev_inst
*
sdi
,
...
...
@@ -91,7 +91,7 @@ SR_API int sr_session_load(const char *filename);
SR_API
struct
sr_session
*
sr_session_new
(
void
);
SR_API
int
sr_session_destroy
(
void
);
SR_API
int
sr_session_dev_remove_all
(
void
);
SR_API
int
sr_session_dev_add
(
const
struct
sr_dev_inst
*
sdi
);
SR_API
int
sr_session_dev_add
(
struct
sr_dev_inst
*
sdi
);
SR_API
int
sr_session_dev_list
(
GSList
**
devlist
);
/* Datafeed setup */
...
...
@@ -174,4 +174,10 @@ SR_API int ds_trigger_set_en(uint16_t enable);
SR_API
uint16_t
ds_trigger_get_en
();
SR_API
int
ds_trigger_set_mode
(
uint16_t
mode
);
SR_PRIV
uint64_t
ds_trigger_get_mask0
(
uint16_t
stage
);
SR_PRIV
uint64_t
ds_trigger_get_value0
(
uint16_t
stage
);
SR_PRIV
uint64_t
ds_trigger_get_edge0
(
uint16_t
stage
);
SR_PRIV
uint64_t
ds_trigger_get_mask1
(
uint16_t
stage
);
SR_PRIV
uint64_t
ds_trigger_get_value1
(
uint16_t
stage
);
SR_PRIV
uint64_t
ds_trigger_get_edge1
(
uint16_t
stage
);
#endif
This diff is collapsed.
Click to expand it.
libsigrok4DSL/session.c
View file @
83d77b03
...
...
@@ -51,7 +51,7 @@
struct
source
{
int
timeout
;
sr_receive_data_callback_t
cb
;
void
*
cb_data
;
const
void
*
cb_data
;
/* This is used to keep track of the object (fd, pollfd or channel) which is
* being polled and will be used to match the source when removing it again.
...
...
@@ -187,7 +187,7 @@ SR_API int sr_session_dev_remove_all(void)
*
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
*/
SR_API
int
sr_session_dev_add
(
const
struct
sr_dev_inst
*
sdi
)
SR_API
int
sr_session_dev_add
(
struct
sr_dev_inst
*
sdi
)
{
int
ret
;
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/session_driver.c
View file @
83d77b03
...
...
@@ -24,6 +24,7 @@
#include <sys/time.h>
#include <zip.h>
#include <assert.h>
#include <string.h>
#include "libsigrok.h"
#include "libsigrok-internal.h"
...
...
@@ -91,7 +92,7 @@ static int trans_data(struct sr_dev_inst *sdi)
{
// translate for old format
struct
session_vdev
*
vdev
=
sdi
->
priv
;
GList
*
l
;
G
S
List
*
l
;
struct
sr_channel
*
probe
;
assert
(
vdev
->
buf
!=
NULL
);
...
...
@@ -124,7 +125,7 @@ static int trans_data(struct sr_dev_inst *sdi)
static
int
receive_data
(
int
fd
,
int
revents
,
const
struct
sr_dev_inst
*
cb_sdi
)
{
struct
sr_dev_inst
*
sdi
;
struct
session_vdev
*
vdev
;
struct
session_vdev
*
vdev
=
NULL
;
struct
sr_datafeed_packet
packet
;
struct
sr_datafeed_logic
logic
;
struct
sr_datafeed_dso
dso
;
...
...
@@ -132,7 +133,7 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *cb_sdi)
GSList
*
l
;
int
ret
;
char
file_name
[
32
];
struct
sr_channel
*
probe
;
struct
sr_channel
*
probe
=
NULL
;
GSList
*
pl
;
int
channel
;
...
...
@@ -242,7 +243,8 @@ static int receive_data(int fd, int revents, const struct sr_dev_inst *cb_sdi)
}
}
if
(
vdev
->
cur_channel
>=
vdev
->
num_probes
||
if
(
!
vdev
||
vdev
->
cur_channel
>=
vdev
->
num_probes
||
revents
==
-
1
)
{
packet
.
type
=
SR_DF_END
;
sr_session_send
(
cb_sdi
,
&
packet
);
...
...
@@ -320,6 +322,8 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
const
struct
sr_channel
*
ch
,
const
struct
sr_channel_group
*
cg
)
{
(
void
)
cg
;
struct
session_vdev
*
vdev
;
switch
(
id
)
{
...
...
@@ -443,13 +447,15 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
return
SR_OK
;
}
static
int
config_set
(
int
id
,
GVariant
*
data
,
const
struct
sr_dev_inst
*
sdi
,
static
int
config_set
(
int
id
,
GVariant
*
data
,
struct
sr_dev_inst
*
sdi
,
struct
sr_channel
*
ch
,
const
struct
sr_channel_group
*
cg
)
struct
sr_channel_group
*
cg
)
{
(
void
)
cg
;
struct
session_vdev
*
vdev
;
const
char
*
stropt
;
int
i
;
unsigned
int
i
;
vdev
=
sdi
->
priv
;
...
...
@@ -565,8 +571,12 @@ static int config_set(int id, 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
(
int
key
,
GVariant
**
data
,
const
struct
sr_dev_inst
*
sdi
,
const
struct
sr_channel_group
*
cg
)
{
(
void
)
cg
;
GVariant
*
gvar
;
GVariantBuilder
gvb
;
...
...
@@ -611,7 +621,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
return
SR_OK
;
}
static
int
dev_status_get
(
struct
sr_dev_inst
*
sdi
,
struct
sr_status
*
status
,
int
begin
,
int
end
)
static
int
dev_status_get
(
const
struct
sr_dev_inst
*
sdi
,
struct
sr_status
*
status
,
int
begin
,
int
end
)
{
(
void
)
begin
;
(
void
)
end
;
...
...
@@ -627,14 +637,16 @@ static int dev_status_get(struct sr_dev_inst *sdi, struct sr_status *status, int
}
}
static
int
dev_acquisition_start
(
const
struct
sr_dev_inst
*
sdi
,
static
int
dev_acquisition_start
(
struct
sr_dev_inst
*
sdi
,
void
*
cb_data
)
{
(
void
)
cb_data
;
struct
zip_stat
zs
;
struct
session_vdev
*
vdev
;
struct
sr_datafeed_packet
packet
;
int
ret
;
GList
*
l
;
G
S
List
*
l
;
struct
sr_channel
*
probe
;
vdev
=
sdi
->
priv
;
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/session_file.c
View file @
83d77b03
...
...
@@ -121,12 +121,12 @@ SR_API int sr_session_load(const char *filename)
struct
zip_stat
zs
;
struct
sr_dev_inst
*
sdi
;
struct
sr_channel
*
probe
;
int
ret
,
devcnt
,
i
,
j
,
k
;
int
ret
,
devcnt
,
i
,
j
;
uint16_t
probenum
;
uint64_t
tmp_u64
,
total_probes
,
enabled_probes
;
uint16_t
p
;
int64_t
tmp_64
;
char
**
sections
,
**
keys
,
*
metafile
,
*
val
,
s
[
11
]
;
char
**
sections
,
**
keys
,
*
metafile
,
*
val
;
char
probename
[
SR_MAX_PROBENAME_LEN
+
1
];
int
mode
=
LOGIC
;
int
channel_type
=
SR_CHANNEL_LOGIC
;
...
...
@@ -239,7 +239,7 @@ SR_API int sr_session_load(const char *filename)
channel_type
=
(
mode
==
DSO
)
?
SR_CHANNEL_DSO
:
(
mode
==
ANALOG
)
?
SR_CHANNEL_ANALOG
:
SR_CHANNEL_LOGIC
;
for
(
p
=
0
;
p
<
total_probes
;
p
++
)
{
snprintf
(
probename
,
SR_MAX_PROBENAME_LEN
,
"%"
PRIu64
,
p
);
snprintf
(
probename
,
SR_MAX_PROBENAME_LEN
,
"%
u
"
,
p
);
if
(
!
(
probe
=
sr_channel_new
(
p
,
channel_type
,
FALSE
,
probename
)))
return
SR_ERR
;
...
...
This diff is collapsed.
Click to expand it.
libsigrok4DSL/trigger.c
View file @
83d77b03
...
...
@@ -177,7 +177,6 @@ SR_API int ds_trigger_set_stage(uint16_t stages)
SR_API
int
ds_trigger_set_pos
(
uint16_t
position
)
{
assert
(
position
<=
100
);
assert
(
position
>=
0
);
trigger
->
trigger_pos
=
position
;
...
...
@@ -245,7 +244,7 @@ SR_PRIV uint64_t ds_trigger_get_mask0(uint16_t stage)
for
(
i
=
TriggerProbes
-
1
;
i
>=
0
;
i
--
)
{
mask
=
(
mask
<<
1
);
mask
+=
(
trigger
->
trigger0
[
stage
][
i
]
==
'X'
|
trigger
->
trigger0
[
stage
][
i
]
==
'C'
);
mask
+=
(
trigger
->
trigger0
[
stage
][
i
]
==
'X'
|
|
trigger
->
trigger0
[
stage
][
i
]
==
'C'
);
}
return
mask
;
...
...
@@ -259,7 +258,7 @@ SR_PRIV uint64_t ds_trigger_get_mask1(uint16_t stage)
for
(
i
=
TriggerProbes
-
1
;
i
>=
0
;
i
--
)
{
mask
=
(
mask
<<
1
);
mask
+=
(
trigger
->
trigger1
[
stage
][
i
]
==
'X'
|
trigger
->
trigger1
[
stage
][
i
]
==
'C'
);
mask
+=
(
(
trigger
->
trigger1
[
stage
][
i
]
==
'X'
)
|
(
trigger
->
trigger1
[
stage
][
i
]
==
'C'
)
)
;
}
return
mask
;
...
...
@@ -273,7 +272,7 @@ SR_PRIV uint64_t ds_trigger_get_value0(uint16_t stage)
for
(
i
=
TriggerProbes
-
1
;
i
>=
0
;
i
--
)
{
value
=
(
value
<<
1
);
value
+=
(
trigger
->
trigger0
[
stage
][
i
]
==
'1'
|
trigger
->
trigger0
[
stage
][
i
]
==
'R'
);
value
+=
(
(
trigger
->
trigger0
[
stage
][
i
]
==
'1'
)
|
(
trigger
->
trigger0
[
stage
][
i
]
==
'R'
)
)
;
}
return
value
;
...
...
@@ -287,7 +286,7 @@ SR_PRIV uint64_t ds_trigger_get_value1(uint16_t stage)
for
(
i
=
TriggerProbes
-
1
;
i
>=
0
;
i
--
)
{
value
=
(
value
<<
1
);
value
+=
(
trigger
->
trigger1
[
stage
][
i
]
==
'1'
|
trigger
->
trigger1
[
stage
][
i
]
==
'R'
);
value
+=
(
(
trigger
->
trigger1
[
stage
][
i
]
==
'1'
)
|
(
trigger
->
trigger1
[
stage
][
i
]
==
'R'
)
)
;
}
return
value
;
...
...
@@ -301,8 +300,8 @@ SR_PRIV uint64_t ds_trigger_get_edge0(uint16_t stage)
for
(
i
=
TriggerProbes
-
1
;
i
>=
0
;
i
--
)
{
edge
=
(
edge
<<
1
);
edge
+=
(
trigger
->
trigger0
[
stage
][
i
]
==
'R'
|
trigger
->
trigger0
[
stage
][
i
]
==
'F'
|
trigger
->
trigger0
[
stage
][
i
]
==
'C'
);
edge
+=
(
(
trigger
->
trigger0
[
stage
][
i
]
==
'R'
)
|
(
trigger
->
trigger0
[
stage
][
i
]
==
'F'
)
|
(
trigger
->
trigger0
[
stage
][
i
]
==
'C'
)
)
;
}
return
edge
;
...
...
@@ -316,8 +315,8 @@ SR_PRIV uint64_t ds_trigger_get_edge1(uint16_t stage)
for
(
i
=
TriggerProbes
-
1
;
i
>=
0
;
i
--
)
{
edge
=
(
edge
<<
1
);
edge
+=
(
trigger
->
trigger1
[
stage
][
i
]
==
'R'
|
trigger
->
trigger1
[
stage
][
i
]
==
'F'
|
trigger
->
trigger1
[
stage
][
i
]
==
'C'
);
edge
+=
(
(
trigger
->
trigger1
[
stage
][
i
]
==
'R'
)
|
(
trigger
->
trigger1
[
stage
][
i
]
==
'F'
)
|
(
trigger
->
trigger1
[
stage
][
i
]
==
'C'
)
)
;
}
return
edge
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment