Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PPSi
Manage
Activity
Members
Labels
Plan
Issues
55
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
PPSi
Commits
d0de8bbc
Commit
d0de8bbc
authored
10 years ago
by
Alessandro Rubini
Browse files
Options
Downloads
Patches
Plain Diff
general: introduce pp_can_adjust() for readability
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
3053b3af
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/ppsi/pp-instance.h
+18
-8
18 additions, 8 deletions
include/ppsi/pp-instance.h
proto-standard/servo.c
+4
-4
4 additions, 4 deletions
proto-standard/servo.c
with
22 additions
and
12 deletions
include/ppsi/pp-instance.h
+
18
−
8
View file @
d0de8bbc
...
...
@@ -20,14 +20,7 @@ struct pp_runtime_opts {
Integer32
max_rst
;
/* Maximum number of nanoseconds to reset */
Integer32
max_dly
;
/* Maximum number of nanoseconds of delay */
Integer32
ttl
;
int
flags
;
#define PP_FLAG_NO_ADJUST 0x01
#define PP_FLAG_NO_RESET 0x02
/* slave_only:1, -- moved to ppi, no more global */
/* master_only:1, -- moved to ppi, no more global */
/* ethernet_mode:1, -- moved to ppi, no more global */
/* e2e_mode:1, -- no more: we only support e2e */
/* gptp_mode:1, -- no more: peer-to-peer unsupported */
int
flags
;
/* see below */
Integer16
ap
,
ai
;
Integer16
s
;
Integer8
announce_intvl
;
...
...
@@ -38,6 +31,23 @@ struct pp_runtime_opts {
void
*
arch_opts
;
};
/*
* Flags for the above structure
*/
#define PP_FLAG_NO_ADJUST 0x01
#define PP_FLAG_NO_RESET 0x02
/* I'd love to use inlines, but we still miss some structure at this point*/
#define pp_can_adjust(ppi) (!(OPTS(ppi)->flags & PP_FLAG_NO_ADJUST))
#define pp_can_reset_clock(ppi) (!(OPTS(ppi)->flags & PP_FLAG_NO_RESET))
/* slave_only:1, -- moved to ppi, no more global */
/* master_only:1, -- moved to ppi, no more global */
/* ethernet_mode:1, -- moved to ppi, no more global */
/* e2e_mode:1, -- no more: we only support e2e */
/* gptp_mode:1, -- no more: peer-to-peer unsupported */
/* We need a globally-accessible structure with preset defaults */
extern
struct
pp_runtime_opts
__pp_default_rt_opts
;
...
...
This diff is collapsed.
Click to expand it.
proto-standard/servo.c
+
4
−
4
View file @
d0de8bbc
...
...
@@ -26,7 +26,7 @@ void pp_servo_init(struct pp_instance *ppi)
SRV
(
ppi
)
->
obs_drift
=
-
d
<<
10
;
/* note "-" */
}
else
{
/* level clock */
if
(
!
(
OPTS
(
ppi
)
->
flags
&
PP_FLAG_NO_ADJUST
))
if
(
pp_can_adjust
(
ppi
))
ppi
->
t_ops
->
adjust
(
ppi
,
0
,
0
);
SRV
(
ppi
)
->
obs_drift
=
0
;
}
...
...
@@ -209,8 +209,8 @@ void pp_servo_got_resp(struct pp_instance *ppi)
TimeInternal
time_tmp
;
/* if secs, reset clock or set freq adjustment to max */
if
(
!
(
OPTS
(
ppi
)
->
flags
&
PP_FLAG_NO_ADJUST
))
{
if
(
!
(
OPTS
(
ppi
)
->
flags
&
PP_FLAG_NO_RESET
))
{
if
(
pp_can_adjust
(
ppi
))
{
if
(
pp_can_reset_clock
(
ppi
))
{
/* Can't use adjust, limited to +/- 2s */
time_tmp
=
ppi
->
t4
;
add_TimeInternal
(
&
time_tmp
,
&
time_tmp
,
...
...
@@ -278,7 +278,7 @@ void pp_servo_got_resp(struct pp_instance *ppi)
/* apply controller output as a clock tick rate adjustment, if
* provided by arch, or as a raw offset otherwise */
if
(
!
(
OPTS
(
ppi
)
->
flags
&
PP_FLAG_NO_ADJUST
))
{
if
(
pp_can_adjust
(
ppi
))
{
if
(
ppi
->
t_ops
->
adjust_freq
)
ppi
->
t_ops
->
adjust_freq
(
ppi
,
-
adj
);
else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment