Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PTP noposix stack
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PTP noposix stack
Commits
8c6c365b
Commit
8c6c365b
authored
Apr 20, 2012
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
softpll: starting ptracker should clear its' state
parent
b6ec8446
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
+16
-9
spll_ptracker.h
rt/dev/spll_ptracker.h
+16
-9
No files found.
rt/dev/spll_ptracker.h
View file @
8c6c365b
...
...
@@ -5,7 +5,7 @@ struct spll_ptracker_state {
int
id_a
,
id_b
;
int
n_avg
,
acc
,
avg_count
;
int
phase_val
,
ready
;
int
tag_a
,
tag_b
;
int
tag_a
,
tag_b
;
int
sample_n
;
int
preserve_sign
;
};
...
...
@@ -14,7 +14,7 @@ struct spll_ptracker_state {
static
void
ptracker_init
(
struct
spll_ptracker_state
*
s
,
int
id_a
,
int
id_b
,
int
num_avgs
)
{
s
->
tag_a
=
s
->
tag_b
=
-
1
;
s
->
id_a
=
id_a
;
s
->
id_b
=
id_b
;
s
->
ready
=
0
;
...
...
@@ -27,6 +27,13 @@ static void ptracker_init(struct spll_ptracker_state *s, int id_a, int id_b, int
static
void
ptracker_start
(
struct
spll_ptracker_state
*
s
)
{
s
->
tag_a
=
s
->
tag_b
=
-
1
;
s
->
ready
=
0
;
s
->
acc
=
0
;
s
->
avg_count
=
0
;
s
->
sample_n
=
0
;
s
->
preserve_sign
=
0
;
spll_enable_tagger
(
s
->
id_a
,
1
);
spll_enable_tagger
(
s
->
id_b
,
1
);
}
...
...
@@ -45,13 +52,13 @@ static int ptracker_update(struct spll_ptracker_state *s, int tag, int source)
if
(
s
->
tag_a
>=
0
&&
s
->
tag_b
>=
0
)
{
int
delta
=
(
s
->
tag_a
-
s
->
tag_b
)
&
((
1
<<
HPLL_N
)
-
1
);
s
->
sample_n
++
;
if
(
s
->
avg_count
==
0
)
{
if
(
delta
<=
PTRACK_WRAP_LO
)
if
(
delta
<=
PTRACK_WRAP_LO
)
s
->
preserve_sign
=
-
1
;
else
if
(
delta
>=
PTRACK_WRAP_HI
)
s
->
preserve_sign
=
1
;
...
...
@@ -61,7 +68,7 @@ static int ptracker_update(struct spll_ptracker_state *s, int tag, int source)
s
->
avg_count
++
;
s
->
acc
=
delta
;
}
else
{
if
(
delta
<=
PTRACK_WRAP_LO
&&
s
->
preserve_sign
>
0
)
s
->
acc
+=
delta
+
(
1
<<
HPLL_N
);
else
if
(
delta
>=
PTRACK_WRAP_HI
&&
s
->
preserve_sign
<
0
)
...
...
@@ -78,8 +85,8 @@ static int ptracker_update(struct spll_ptracker_state *s, int tag, int source)
s
->
acc
=
0
;
s
->
avg_count
=
0
;
}
}
}
s
->
tag_b
=
s
->
tag_a
=
-
1
;
}
...
...
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