Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raptor Engineering Public Development
dsview
Commits
13ace4b4
Commit
13ace4b4
authored
Nov 20, 2019
by
DreamSourceLab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix decode issue when skip zero
parent
7782e492
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
+18
-5
libsigrokdecode4DSL/instance.c
libsigrokdecode4DSL/instance.c
+13
-3
libsigrokdecode4DSL/libsigrokdecode.h
libsigrokdecode4DSL/libsigrokdecode.h
+3
-0
libsigrokdecode4DSL/type_decoder.c
libsigrokdecode4DSL/type_decoder.c
+2
-2
No files found.
libsigrokdecode4DSL/instance.c
View file @
13ace4b4
...
...
@@ -699,6 +699,9 @@ SRD_PRIV int srd_inst_start(struct srd_decoder_inst *di, char **error)
/* none matched */
di
->
abs_cur_matched
=
FALSE
;
/* skip zero flag */
di
->
skip_zero
=
FALSE
;
/* Set self.samplenum to 0. */
PyObject_SetAttrString
(
di
->
py_inst
,
"samplenum"
,
PyLong_FromLong
(
0
));
...
...
@@ -859,7 +862,7 @@ static void update_old_pins_array_initial_pins(struct srd_decoder_inst *di)
}
}
static
gboolean
term_matches
(
const
struct
srd_decoder_inst
*
di
,
static
gboolean
term_matches
(
struct
srd_decoder_inst
*
di
,
struct
srd_term
*
term
,
gboolean
*
skip_allow
)
{
uint8_t
old_sample
,
sample
;
...
...
@@ -869,8 +872,11 @@ static gboolean term_matches(const struct srd_decoder_inst *di,
/* Caller ensures di, di->dec_channelmap, term, sample_pos != NULL. */
*
skip_allow
=
FALSE
;
if
(
term
->
type
==
SRD_TERM_SKIP
)
if
(
term
->
type
==
SRD_TERM_SKIP
)
{
if
(
di
->
abs_cur_matched
&&
term
->
num_samples_to_skip
==
0
)
di
->
skip_zero
=
TRUE
;
return
sample_matches
(
0
,
0
,
term
);
}
ch
=
term
->
channel
;
if
(
*
(
di
->
inbuf
+
ch
)
==
NULL
)
{
...
...
@@ -886,7 +892,7 @@ static gboolean term_matches(const struct srd_decoder_inst *di,
return
sample_matches
(
old_sample
,
sample
,
term
);
}
static
gboolean
all_terms_match
(
const
struct
srd_decoder_inst
*
di
,
static
gboolean
all_terms_match
(
struct
srd_decoder_inst
*
di
,
const
GSList
*
cond
,
gboolean
*
skip_allow
)
{
const
GSList
*
l
;
...
...
@@ -900,6 +906,10 @@ static gboolean all_terms_match(const struct srd_decoder_inst *di,
return
FALSE
;
}
if
(
di
->
skip_zero
)
{
di
->
abs_cur_samplenum
--
;
di
->
skip_zero
=
FALSE
;
}
return
TRUE
;
}
...
...
libsigrokdecode4DSL/libsigrokdecode.h
View file @
13ace4b4
...
...
@@ -309,6 +309,9 @@ struct srd_decoder_inst {
/** First entry of wait(). */
gboolean
first_pos
;
/** skip zero flag. */
gboolean
skip_zero
;
/** Indicates the current state of the decoder stack. */
int
decoder_state
;
...
...
libsigrokdecode4DSL/type_decoder.c
View file @
13ace4b4
...
...
@@ -685,7 +685,7 @@ static int create_term_list(PyObject *py_dict, GSList **term_list, gboolean cur_
term
=
g_malloc
(
sizeof
(
struct
srd_term
));
term
->
type
=
SRD_TERM_SKIP
;
term
->
num_samples_to_skip
=
num_samples_to_skip
;
term
->
num_samples_already_skipped
=
cur_matched
?
1
:
0
;
term
->
num_samples_already_skipped
=
cur_matched
?
(
term
->
num_samples_to_skip
!=
0
)
:
0
;
}
else
{
srd_err
(
"Term key is neither a string nor a number."
);
goto
err
;
...
...
@@ -841,7 +841,7 @@ static int set_skip_condition(struct srd_decoder_inst *di, uint64_t count)
term
=
g_malloc
(
sizeof
(
*
term
));
term
->
type
=
SRD_TERM_SKIP
;
term
->
num_samples_to_skip
=
count
;
term
->
num_samples_already_skipped
=
di
->
abs_cur_matched
?
1
:
0
;
term
->
num_samples_already_skipped
=
di
->
abs_cur_matched
?
(
term
->
num_samples_to_skip
!=
0
)
:
0
;
term_list
=
g_slist_append
(
NULL
,
term
);
di
->
condition_list
=
g_slist_append
(
di
->
condition_list
,
term_list
);
...
...
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