2
0
forked from Ivasoft/DSView

Add assert line for dsl.c about get mode list

This commit is contained in:
dreamsourcelabTAI
2023-01-30 11:38:26 +08:00
parent 58695c6c62
commit 98075b4a4f
4 changed files with 12 additions and 18 deletions

View File

@@ -1,10 +0,0 @@
[
{
"id": "vvv",
"text": "xxx"
},
{
"id": "vvv1",
"text": "xxx1"
}
]

View File

@@ -120,6 +120,8 @@ static struct DSL_context *DSCope_dev_new(const struct DSL_profile *prof)
struct DSL_context *devc;
unsigned int i;
assert(prof);
if (!(devc = g_try_malloc(sizeof(struct DSL_context)))) {
sr_err("Device context malloc failed.");
return NULL;
@@ -132,15 +134,15 @@ static struct DSL_context *DSCope_dev_new(const struct DSL_profile *prof)
devc->channel = NULL;
devc->profile = prof;
devc->fw_updated = 0;
devc->cur_samplerate = devc->profile->dev_caps.default_samplerate;
devc->limit_samples = devc->profile->dev_caps.default_samplelimit;
devc->cur_samplerate = prof->dev_caps.default_samplerate;
devc->limit_samples = prof->dev_caps.default_samplelimit;
devc->clock_type = FALSE;
devc->clock_edge = FALSE;
devc->instant = FALSE;
devc->op_mode = OP_NORMAL;
devc->test_mode = SR_TEST_NONE;
devc->stream = FALSE;
devc->ch_mode = devc->profile->dev_caps.default_channelmode;
devc->ch_mode = prof->dev_caps.default_channelmode;
devc->th_level = SR_TH_3V3;
devc->filter = SR_FILTER_NONE;
devc->timebase = 10000;

View File

@@ -196,12 +196,12 @@ SR_PRIV const GSList *dsl_mode_list(const struct sr_dev_inst *sdi)
{
struct DSL_context *devc;
GSList *l = NULL;
unsigned int i;
unsigned int i;
devc = sdi->priv;
for (i = 0; i < ARRAY_SIZE(sr_mode_list); i++) {
if (devc->profile->dev_caps.mode_caps & (1 << i))
l = g_slist_append(l, &sr_mode_list[i]);
l = g_slist_append(l, &sr_mode_list[i]);
}
return l;

View File

@@ -219,6 +219,8 @@ static struct DSL_context *DSLogic_dev_new(const struct DSL_profile *prof)
struct DSL_context *devc;
unsigned int i;
assert(prof);
if (!(devc = g_try_malloc(sizeof(struct DSL_context)))) {
sr_err("Device context malloc failed.");
return NULL;
@@ -232,15 +234,15 @@ static struct DSL_context *DSLogic_dev_new(const struct DSL_profile *prof)
devc->channel = NULL;
devc->profile = prof;
devc->fw_updated = 0;
devc->cur_samplerate = devc->profile->dev_caps.default_samplerate;
devc->limit_samples = devc->profile->dev_caps.default_samplelimit;
devc->cur_samplerate = prof->dev_caps.default_samplerate;
devc->limit_samples = prof->dev_caps.default_samplelimit;
devc->clock_type = FALSE;
devc->clock_edge = FALSE;
devc->rle_mode = FALSE;
devc->instant = FALSE;
devc->op_mode = OP_STREAM;
devc->test_mode = SR_TEST_NONE;
devc->ch_mode = devc->profile->dev_caps.default_channelmode;
devc->ch_mode = prof->dev_caps.default_channelmode;
devc->stream = (devc->op_mode == OP_STREAM);
devc->buf_options = SR_BUF_UPLOAD;
devc->th_level = SR_TH_3V3;