Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
47
Issues
47
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
PPSi
Commits
d0de8bbc
Commit
d0de8bbc
authored
Nov 05, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
general: introduce pp_can_adjust() for readability
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
3053b3af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
12 deletions
+22
-12
pp-instance.h
include/ppsi/pp-instance.h
+18
-8
servo.c
proto-standard/servo.c
+4
-4
No files found.
include/ppsi/pp-instance.h
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
;
...
...
proto-standard/servo.c
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
...
...
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