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
50
Issues
50
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
e037e781
Commit
e037e781
authored
May 24, 2019
by
Jean-Claude BAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new macro TOPS() to access timing operations
parent
b66d61fe
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
47 additions
and
42 deletions
+47
-42
diag.c
diag.c
+2
-2
fsm.c
fsm.c
+1
-1
ppsi.h
include/ppsi/ppsi.h
+5
-0
wrh-servo.c
proto-ext-common/wrh-servo.c
+3
-3
l1e-state-machine.c
proto-ext-l1sync/l1e-state-machine.c
+1
-1
state-wr-abscal.c
proto-ext-whiterabbit/state-wr-abscal.c
+3
-3
bmc.c
proto-standard/bmc.c
+8
-8
fsm-lib.c
proto-standard/fsm-lib.c
+2
-2
msg-p2p.c
proto-standard/msg-p2p.c
+1
-1
msg.c
proto-standard/msg.c
+2
-2
servo.c
proto-standard/servo.c
+9
-9
unix-socket.c
time-unix/unix-socket.c
+5
-5
timeout.c
timeout.c
+5
-5
No files found.
diag.c
View file @
e037e781
...
@@ -37,8 +37,8 @@ void __pp_diag(struct pp_instance *ppi, enum pp_diag_things th,
...
@@ -37,8 +37,8 @@ void __pp_diag(struct pp_instance *ppi, enum pp_diag_things th,
if
(
PP_DIAG_EXTRA_PRINT_TIME
)
{
if
(
PP_DIAG_EXTRA_PRINT_TIME
)
{
int
hours
,
minutes
,
seconds
;
int
hours
,
minutes
,
seconds
;
if
(
ppi
&&
ppi
->
t_ops
&&
ppi
->
t_ops
->
get_utc_time
)
if
(
ppi
&&
TOPS
(
ppi
)
&&
TOPS
(
ppi
)
->
get_utc_time
)
ppi
->
t_ops
->
get_utc_time
(
ppi
,
&
hours
,
&
minutes
,
&
seconds
);
TOPS
(
ppi
)
->
get_utc_time
(
ppi
,
&
hours
,
&
minutes
,
&
seconds
);
else
else
hours
=
minutes
=
seconds
=
0
;
hours
=
minutes
=
seconds
=
0
;
pp_printf
(
"%02d:%02d:%02d %s-%i-%s: "
,
hours
,
minutes
,
seconds
,
thing_name
[
th
],
level
,
name
);
pp_printf
(
"%02d:%02d:%02d %s-%i-%s: "
,
hours
,
minutes
,
seconds
,
thing_name
[
th
],
level
,
name
);
...
...
fsm.c
View file @
e037e781
...
@@ -24,7 +24,7 @@ static void pp_fsm_printf(struct pp_instance *ppi, char *fmt, ...)
...
@@ -24,7 +24,7 @@ static void pp_fsm_printf(struct pp_instance *ppi, char *fmt, ...)
/* temporarily set NOTIMELOG, as we'll print the time ourselves */
/* temporarily set NOTIMELOG, as we'll print the time ourselves */
pp_global_d_flags
|=
PP_FLAG_NOTIMELOG
;
pp_global_d_flags
|=
PP_FLAG_NOTIMELOG
;
ppi
->
t_ops
->
get
(
ppi
,
&
t
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
t
);
pp_global_d_flags
=
oflags
;
pp_global_d_flags
=
oflags
;
pp_printf
(
"diag-fsm-1-%s: %09d.%03d: "
,
ppi
->
port_name
,
pp_printf
(
"diag-fsm-1-%s: %09d.%03d: "
,
ppi
->
port_name
,
...
...
include/ppsi/ppsi.h
View file @
e037e781
...
@@ -143,6 +143,11 @@ static inline timePropertiesDS_t *DSPRO(struct pp_instance *ppi)
...
@@ -143,6 +143,11 @@ static inline timePropertiesDS_t *DSPRO(struct pp_instance *ppi)
return
GLBS
(
ppi
)
->
timePropertiesDS
;
return
GLBS
(
ppi
)
->
timePropertiesDS
;
}
}
static
inline
struct
pp_time_operations
*
TOPS
(
struct
pp_instance
*
ppi
)
{
return
ppi
->
t_ops
;
}
/* We used to have a "netpath" structure. Keep this until we merge pdelay */
/* We used to have a "netpath" structure. Keep this until we merge pdelay */
static
struct
pp_instance
*
NP
(
struct
pp_instance
*
ppi
)
static
struct
pp_instance
*
NP
(
struct
pp_instance
*
ppi
)
__attribute__
((
deprecated
));
__attribute__
((
deprecated
));
...
...
proto-ext-common/wrh-servo.c
View file @
e037e781
...
@@ -92,7 +92,7 @@ int wrh_servo_init(struct pp_instance *ppi)
...
@@ -92,7 +92,7 @@ int wrh_servo_init(struct pp_instance *ppi)
strcpy
(
gs
->
servo_state_name
,
wrh_servo_state_name
[
gs
->
state
]);
strcpy
(
gs
->
servo_state_name
,
wrh_servo_state_name
[
gs
->
state
]);
gs
->
flags
|=
PP_SERVO_FLAG_VALID
;
gs
->
flags
|=
PP_SERVO_FLAG_VALID
;
ppi
->
t_ops
->
get
(
ppi
,
&
gs
->
update_time
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
gs
->
update_time
);
s
->
tracking_enabled
=
wrh_tracking_enabled
;
s
->
tracking_enabled
=
wrh_tracking_enabled
;
gs
->
state
=
WRH_SYNC_TAI
;
gs
->
state
=
WRH_SYNC_TAI
;
}
}
...
@@ -225,7 +225,7 @@ static int __wrh_servo_update(struct pp_instance *ppi)
...
@@ -225,7 +225,7 @@ static int __wrh_servo_update(struct pp_instance *ppi)
// Servo updated
// Servo updated
gs
->
update_count
++
;
gs
->
update_count
++
;
ppi
->
t_ops
->
get
(
ppi
,
&
gs
->
update_time
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
gs
->
update_time
);
if
(
!
s
->
readyForSync
)
if
(
!
s
->
readyForSync
)
return
1
;
/* We have to wait before to start the synchronization */
return
1
;
/* We have to wait before to start the synchronization */
...
@@ -307,7 +307,7 @@ static int __wrh_servo_update(struct pp_instance *ppi)
...
@@ -307,7 +307,7 @@ static int __wrh_servo_update(struct pp_instance *ppi)
* it. We use current WR time.
* it. We use current WR time.
* */
* */
struct
pp_time
t
;
struct
pp_time
t
;
ppi
->
t_ops
->
get
(
ppi
,
&
t
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
t
);
unix_time_ops
.
set
(
ppi
,
&
t
);
unix_time_ops
.
set
(
ppi
,
&
t
);
pp_diag
(
ppi
,
time
,
1
,
"system time set to %s TAI
\n
"
,
pp_diag
(
ppi
,
time
,
1
,
"system time set to %s TAI
\n
"
,
time_to_string
(
&
t
));
time_to_string
(
&
t
));
...
...
proto-ext-l1sync/l1e-state-machine.c
View file @
e037e781
...
@@ -188,7 +188,7 @@ static __inline__ int measure_first_time(struct pp_instance *ppi) {
...
@@ -188,7 +188,7 @@ static __inline__ int measure_first_time(struct pp_instance *ppi) {
struct
pp_time
current_time
;
struct
pp_time
current_time
;
int
ms
;
int
ms
;
ppi
->
t_ops
->
get
(
ppi
,
&
current_time
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
current_time
);
ms
=
(
current_time
.
secs
&
0xFFFF
)
*
1000
;
/* do not take all second - Not necessary to calculate a difference*/
ms
=
(
current_time
.
secs
&
0xFFFF
)
*
1000
;
/* do not take all second - Not necessary to calculate a difference*/
ms
+=
((
current_time
.
scaled_nsecs
+
0x8000
)
>>
TIME_INTERVAL_FRACBITS
)
/
1000000
;
ms
+=
((
current_time
.
scaled_nsecs
+
0x8000
)
>>
TIME_INTERVAL_FRACBITS
)
/
1000000
;
return
ms
;
return
ms
;
...
...
proto-ext-whiterabbit/state-wr-abscal.c
View file @
e037e781
...
@@ -13,7 +13,7 @@ static int next_pps_ms(struct pp_instance *ppi, struct pp_time *t)
...
@@ -13,7 +13,7 @@ static int next_pps_ms(struct pp_instance *ppi, struct pp_time *t)
{
{
int
nsec
;
int
nsec
;
ppi
->
t_ops
->
get
(
ppi
,
t
);
TOPS
(
ppi
)
->
get
(
ppi
,
t
);
nsec
=
t
->
scaled_nsecs
>>
16
;
nsec
=
t
->
scaled_nsecs
>>
16
;
return
1000
-
(
nsec
/
1000
/
1000
);
return
1000
-
(
nsec
/
1000
/
1000
);
}
}
...
@@ -43,11 +43,11 @@ int wr_abscal(struct pp_instance *ppi, void *buf, int plen, int new_state)
...
@@ -43,11 +43,11 @@ int wr_abscal(struct pp_instance *ppi, void *buf, int plen, int new_state)
WRH_OPER
()
->
enable_timing_output
(
GLBS
(
ppi
),
1
);
WRH_OPER
()
->
enable_timing_output
(
GLBS
(
ppi
),
1
);
/* Wait for the second to tick */
/* Wait for the second to tick */
while
(
ppi
->
t_ops
->
get
(
ppi
,
&
t
),
t
.
secs
==
secs
)
while
(
TOPS
(
ppi
)
->
get
(
ppi
,
&
t
),
t
.
secs
==
secs
)
;
;
/* Send sync, no f-up -- actually we could send any frame */
/* Send sync, no f-up -- actually we could send any frame */
ppi
->
t_ops
->
get
(
ppi
,
&
t
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
t
);
len
=
msg_pack_sync
(
ppi
,
&
t
);
len
=
msg_pack_sync
(
ppi
,
&
t
);
__send_and_log
(
ppi
,
len
,
PP_NP_EVT
);
__send_and_log
(
ppi
,
len
,
PP_NP_EVT
);
...
...
proto-standard/bmc.c
View file @
e037e781
...
@@ -82,7 +82,7 @@ void bmc_m1(struct pp_instance *ppi)
...
@@ -82,7 +82,7 @@ void bmc_m1(struct pp_instance *ppi)
prop
->
ptpTimescale
=
ptpTimescale
;
prop
->
ptpTimescale
=
ptpTimescale
;
if
(
ptpTimescale
)
{
if
(
ptpTimescale
)
{
ret
=
ppi
->
t_ops
->
get_utc_offset
(
ppi
,
&
offset
,
&
leap59
,
&
leap61
);
ret
=
TOPS
(
ppi
)
->
get_utc_offset
(
ppi
,
&
offset
,
&
leap59
,
&
leap61
);
if
(
ret
)
{
if
(
ret
)
{
offset
=
PP_DEFAULT_UTC_OFFSET
;
offset
=
PP_DEFAULT_UTC_OFFSET
;
pp_diag
(
ppi
,
bmc
,
1
,
pp_diag
(
ppi
,
bmc
,
1
,
...
@@ -94,7 +94,7 @@ void bmc_m1(struct pp_instance *ppi)
...
@@ -94,7 +94,7 @@ void bmc_m1(struct pp_instance *ppi)
if
(
prop
->
currentUtcOffset
!=
offset
)
{
if
(
prop
->
currentUtcOffset
!=
offset
)
{
pp_diag
(
ppi
,
bmc
,
1
,
"New UTC offset: %i
\n
"
,
offset
);
pp_diag
(
ppi
,
bmc
,
1
,
"New UTC offset: %i
\n
"
,
offset
);
prop
->
currentUtcOffset
=
offset
;
prop
->
currentUtcOffset
=
offset
;
ppi
->
t_ops
->
set
(
ppi
,
NULL
);
TOPS
(
ppi
)
->
set
(
ppi
,
NULL
);
}
}
if
(
ret
)
if
(
ret
)
...
@@ -181,7 +181,7 @@ void bmc_s1(struct pp_instance *ppi,
...
@@ -181,7 +181,7 @@ void bmc_s1(struct pp_instance *ppi,
prop
->
ptpTimescale
=
((
frgn_master
->
flagField
[
1
]
&
FFB_PTP
)
!=
0
);
prop
->
ptpTimescale
=
((
frgn_master
->
flagField
[
1
]
&
FFB_PTP
)
!=
0
);
if
(
prop
->
ptpTimescale
)
{
if
(
prop
->
ptpTimescale
)
{
ret
=
ppi
->
t_ops
->
get_utc_time
(
ppi
,
&
hours
,
&
minutes
,
&
seconds
);
ret
=
TOPS
(
ppi
)
->
get_utc_time
(
ppi
,
&
hours
,
&
minutes
,
&
seconds
);
if
(
ret
)
{
if
(
ret
)
{
pp_diag
(
ppi
,
bmc
,
1
,
pp_diag
(
ppi
,
bmc
,
1
,
"Could not get UTC time from system, taking received flags
\n
"
);
"Could not get UTC time from system, taking received flags
\n
"
);
...
@@ -195,7 +195,7 @@ void bmc_s1(struct pp_instance *ppi,
...
@@ -195,7 +195,7 @@ void bmc_s1(struct pp_instance *ppi,
(
seconds
>=
(
60
-
(
2
*
(
1
<<
ppi
->
portDS
->
logAnnounceInterval
)))))
{
(
seconds
>=
(
60
-
(
2
*
(
1
<<
ppi
->
portDS
->
logAnnounceInterval
)))))
{
pp_diag
(
ppi
,
bmc
,
2
,
pp_diag
(
ppi
,
bmc
,
2
,
"Approaching midnight, not updating leap flags
\n
"
);
"Approaching midnight, not updating leap flags
\n
"
);
ret
=
ppi
->
t_ops
->
get_utc_offset
(
ppi
,
&
offset
,
&
leap59
,
&
leap61
);
ret
=
TOPS
(
ppi
)
->
get_utc_offset
(
ppi
,
&
offset
,
&
leap59
,
&
leap61
);
if
(
ret
)
{
if
(
ret
)
{
pp_diag
(
ppi
,
bmc
,
1
,
pp_diag
(
ppi
,
bmc
,
1
,
"Could not get UTC offset from system
\n
"
);
"Could not get UTC offset from system
\n
"
);
...
@@ -208,7 +208,7 @@ void bmc_s1(struct pp_instance *ppi,
...
@@ -208,7 +208,7 @@ void bmc_s1(struct pp_instance *ppi,
offset
,
leap59
,
leap61
);
offset
,
leap59
,
leap61
);
}
}
}
else
{
}
else
{
ret
=
ppi
->
t_ops
->
get_utc_offset
(
ppi
,
&
offset
,
&
leap59
,
&
leap61
);
ret
=
TOPS
(
ppi
)
->
get_utc_offset
(
ppi
,
&
offset
,
&
leap59
,
&
leap61
);
if
(
ret
)
{
if
(
ret
)
{
pp_diag
(
ppi
,
bmc
,
1
,
pp_diag
(
ppi
,
bmc
,
1
,
"Could not get UTC flags from system, taking received flags
\n
"
);
"Could not get UTC flags from system, taking received flags
\n
"
);
...
@@ -250,7 +250,7 @@ void bmc_s1(struct pp_instance *ppi,
...
@@ -250,7 +250,7 @@ void bmc_s1(struct pp_instance *ppi,
"leap61: %i
\n
"
,
"leap61: %i
\n
"
,
offset
,
leap59
,
leap61
);
offset
,
leap59
,
leap61
);
ret
=
ppi
->
t_ops
->
set_utc_offset
(
ppi
,
offset
,
leap59
,
leap61
);
ret
=
TOPS
(
ppi
)
->
set_utc_offset
(
ppi
,
offset
,
leap59
,
leap61
);
if
(
ret
)
{
if
(
ret
)
{
pp_diag
(
ppi
,
bmc
,
1
,
pp_diag
(
ppi
,
bmc
,
1
,
"Could not set UTC offset on system
\n
"
);
"Could not set UTC offset on system
\n
"
);
...
@@ -265,7 +265,7 @@ void bmc_s1(struct pp_instance *ppi,
...
@@ -265,7 +265,7 @@ void bmc_s1(struct pp_instance *ppi,
(
seconds
<=
(
0
+
(
2
*
(
1
<<
ppi
->
portDS
->
logAnnounceInterval
)))))
{
(
seconds
<=
(
0
+
(
2
*
(
1
<<
ppi
->
portDS
->
logAnnounceInterval
)))))
{
pp_diag
(
ppi
,
bmc
,
2
,
pp_diag
(
ppi
,
bmc
,
2
,
"short after midnight, taking local offset
\n
"
);
"short after midnight, taking local offset
\n
"
);
ret
=
ppi
->
t_ops
->
get_utc_offset
(
ppi
,
&
offset
,
&
leap59
,
&
leap61
);
ret
=
TOPS
(
ppi
)
->
get_utc_offset
(
ppi
,
&
offset
,
&
leap59
,
&
leap61
);
if
(
ret
)
{
if
(
ret
)
{
pp_diag
(
ppi
,
bmc
,
1
,
pp_diag
(
ppi
,
bmc
,
1
,
"Could not get UTC offset from system
\n
"
);
"Could not get UTC offset from system
\n
"
);
...
@@ -285,7 +285,7 @@ void bmc_s1(struct pp_instance *ppi,
...
@@ -285,7 +285,7 @@ void bmc_s1(struct pp_instance *ppi,
pp_diag
(
ppi
,
bmc
,
1
,
"New UTC offset in the middle of the day: %i
\n
"
,
pp_diag
(
ppi
,
bmc
,
1
,
"New UTC offset in the middle of the day: %i
\n
"
,
frgn_master
->
currentUtcOffset
);
frgn_master
->
currentUtcOffset
);
prop
->
currentUtcOffset
=
frgn_master
->
currentUtcOffset
;
prop
->
currentUtcOffset
=
frgn_master
->
currentUtcOffset
;
ppi
->
t_ops
->
set
(
ppi
,
NULL
);
TOPS
(
ppi
)
->
set
(
ppi
,
NULL
);
}
}
prop
->
leap59
=
((
frgn_master
->
flagField
[
1
]
&
FFB_LI59
)
!=
0
);
prop
->
leap59
=
((
frgn_master
->
flagField
[
1
]
&
FFB_LI59
)
!=
0
);
prop
->
leap61
=
((
frgn_master
->
flagField
[
1
]
&
FFB_LI61
)
!=
0
);
prop
->
leap61
=
((
frgn_master
->
flagField
[
1
]
&
FFB_LI61
)
!=
0
);
...
...
proto-standard/fsm-lib.c
View file @
e037e781
...
@@ -94,7 +94,7 @@ int pp_lib_may_issue_announce(struct pp_instance *ppi)
...
@@ -94,7 +94,7 @@ int pp_lib_may_issue_announce(struct pp_instance *ppi)
* happened before sending
* happened before sending
*/
*/
if
(
prop
->
ptpTimescale
)
{
if
(
prop
->
ptpTimescale
)
{
ret
=
ppi
->
t_ops
->
get_utc_time
(
ppi
,
&
hours
,
&
minutes
,
&
seconds
);
ret
=
TOPS
(
ppi
)
->
get_utc_time
(
ppi
,
&
hours
,
&
minutes
,
&
seconds
);
if
(
ret
)
{
if
(
ret
)
{
pp_diag
(
ppi
,
frames
,
1
,
pp_diag
(
ppi
,
frames
,
1
,
"Could not get UTC time from system, taking received flags
\n
"
);
"Could not get UTC time from system, taking received flags
\n
"
);
...
@@ -104,7 +104,7 @@ int pp_lib_may_issue_announce(struct pp_instance *ppi)
...
@@ -104,7 +104,7 @@ int pp_lib_may_issue_announce(struct pp_instance *ppi)
(
seconds
<=
(
0
+
(
2
*
(
1
<<
ppi
->
portDS
->
logAnnounceInterval
)))))
{
(
seconds
<=
(
0
+
(
2
*
(
1
<<
ppi
->
portDS
->
logAnnounceInterval
)))))
{
pp_diag
(
ppi
,
frames
,
2
,
pp_diag
(
ppi
,
frames
,
2
,
"short after midnight, taking local offset
\n
"
);
"short after midnight, taking local offset
\n
"
);
ret
=
ppi
->
t_ops
->
get_utc_offset
(
ppi
,
&
offset
,
&
leap59
,
&
leap61
);
ret
=
TOPS
(
ppi
)
->
get_utc_offset
(
ppi
,
&
offset
,
&
leap59
,
&
leap61
);
if
(
ret
)
{
if
(
ret
)
{
pp_diag
(
ppi
,
frames
,
1
,
pp_diag
(
ppi
,
frames
,
1
,
"Could not get UTC offset from system
\n
"
);
"Could not get UTC offset from system
\n
"
);
...
...
proto-standard/msg-p2p.c
View file @
e037e781
...
@@ -146,7 +146,7 @@ int msg_issue_pdelay_req(struct pp_instance *ppi)
...
@@ -146,7 +146,7 @@ int msg_issue_pdelay_req(struct pp_instance *ppi)
int
len
;
int
len
;
mark_incorrect
(
&
ppi
->
t4
);
/* see commit message */
mark_incorrect
(
&
ppi
->
t4
);
/* see commit message */
ppi
->
t_ops
->
get
(
ppi
,
&
now
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
now
);
ppi
->
received_dresp
=
ppi
->
received_dresp
=
ppi
->
received_dresp_fup
=
0
;
ppi
->
received_dresp_fup
=
0
;
len
=
msg_pack_pdelay_req
(
ppi
,
&
now
);
len
=
msg_pack_pdelay_req
(
ppi
,
&
now
);
...
...
proto-standard/msg.c
View file @
e037e781
...
@@ -385,7 +385,7 @@ int msg_issue_sync_followup(struct pp_instance *ppi)
...
@@ -385,7 +385,7 @@ int msg_issue_sync_followup(struct pp_instance *ppi)
int
e
,
len
;
int
e
,
len
;
/* Send sync on the event channel with the "current" timestamp */
/* Send sync on the event channel with the "current" timestamp */
ppi
->
t_ops
->
get
(
ppi
,
&
now
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
now
);
len
=
msg_pack_sync
(
ppi
,
&
now
);
len
=
msg_pack_sync
(
ppi
,
&
now
);
e
=
__send_and_log
(
ppi
,
len
,
PP_NP_EVT
,
PPM_SYNC_FMT
);
e
=
__send_and_log
(
ppi
,
len
,
PP_NP_EVT
,
PPM_SYNC_FMT
);
if
(
e
)
return
e
;
if
(
e
)
return
e
;
...
@@ -402,7 +402,7 @@ static int msg_issue_delay_req(struct pp_instance *ppi)
...
@@ -402,7 +402,7 @@ static int msg_issue_delay_req(struct pp_instance *ppi)
struct
pp_time
now
;
struct
pp_time
now
;
int
len
;
int
len
;
ppi
->
t_ops
->
get
(
ppi
,
&
now
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
now
);
len
=
msg_pack_delay_req
(
ppi
,
&
now
);
len
=
msg_pack_delay_req
(
ppi
,
&
now
);
return
__send_and_log
(
ppi
,
len
,
PP_NP_EVT
,
PPM_DELAY_REQ_FMT
);
return
__send_and_log
(
ppi
,
len
,
PP_NP_EVT
,
PPM_DELAY_REQ_FMT
);
...
...
proto-standard/servo.c
View file @
e037e781
...
@@ -40,9 +40,9 @@ static void _pp_servo_init(struct pp_instance *ppi)
...
@@ -40,9 +40,9 @@ static void _pp_servo_init(struct pp_instance *ppi)
PP_SERVO_RESET_DATA
(
servo
);
PP_SERVO_RESET_DATA
(
servo
);
servo
->
mpd_fltr
.
s_exp
=
0
;
/* clears meanDelay filter */
servo
->
mpd_fltr
.
s_exp
=
0
;
/* clears meanDelay filter */
if
(
ppi
->
t_ops
->
init_servo
)
{
if
(
TOPS
(
ppi
)
->
init_servo
)
{
/* The system may pre-set us to keep current frequency */
/* The system may pre-set us to keep current frequency */
d
=
ppi
->
t_ops
->
init_servo
(
ppi
);
d
=
TOPS
(
ppi
)
->
init_servo
(
ppi
);
if
(
d
==
-
1
)
{
if
(
d
==
-
1
)
{
pp_diag
(
ppi
,
servo
,
1
,
"error in t_ops->servo_init"
);
pp_diag
(
ppi
,
servo
,
1
,
"error in t_ops->servo_init"
);
d
=
0
;
d
=
0
;
...
@@ -51,7 +51,7 @@ static void _pp_servo_init(struct pp_instance *ppi)
...
@@ -51,7 +51,7 @@ static void _pp_servo_init(struct pp_instance *ppi)
}
else
{
}
else
{
/* level clock */
/* level clock */
if
(
pp_can_adjust
(
ppi
))
if
(
pp_can_adjust
(
ppi
))
ppi
->
t_ops
->
adjust
(
ppi
,
0
,
0
);
TOPS
(
ppi
)
->
adjust
(
ppi
,
0
,
0
);
servo
->
obs_drift
=
0
;
servo
->
obs_drift
=
0
;
}
}
...
@@ -413,17 +413,17 @@ static void __pp_servo_update(struct pp_instance *ppi) {
...
@@ -413,17 +413,17 @@ static void __pp_servo_update(struct pp_instance *ppi) {
/* apply controller output as a clock tick rate adjustment, if
/* apply controller output as a clock tick rate adjustment, if
* provided by arch, or as a raw offset otherwise */
* provided by arch, or as a raw offset otherwise */
if
(
pp_can_adjust
(
ppi
))
{
if
(
pp_can_adjust
(
ppi
))
{
if
(
ppi
->
t_ops
->
adjust_freq
)
if
(
TOPS
(
ppi
)
->
adjust_freq
)
ppi
->
t_ops
->
adjust_freq
(
ppi
,
adj32
);
TOPS
(
ppi
)
->
adjust_freq
(
ppi
,
adj32
);
else
else
ppi
->
t_ops
->
adjust_offset
(
ppi
,
adj32
);
TOPS
(
ppi
)
->
adjust_offset
(
ppi
,
adj32
);
}
}
pp_diag
(
ppi
,
servo
,
2
,
"Observed drift: %9i
\n
"
,
pp_diag
(
ppi
,
servo
,
2
,
"Observed drift: %9i
\n
"
,
(
int
)
SRV
(
ppi
)
->
obs_drift
>>
10
);
(
int
)
SRV
(
ppi
)
->
obs_drift
>>
10
);
}
}
servo
->
update_count
++
;
servo
->
update_count
++
;
ppi
->
t_ops
->
get
(
ppi
,
&
servo
->
update_time
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
servo
->
update_time
);
}
}
...
@@ -505,9 +505,9 @@ static int pp_servo_offset_master(struct pp_instance *ppi, struct pp_time *ofm)
...
@@ -505,9 +505,9 @@ static int pp_servo_offset_master(struct pp_instance *ppi, struct pp_time *ofm)
if
(
!
pp_can_adjust
(
ppi
))
if
(
!
pp_can_adjust
(
ppi
))
return
0
;
/* e.g., a loopback test run... "-t" on cmdline */
return
0
;
/* e.g., a loopback test run... "-t" on cmdline */
ppi
->
t_ops
->
get
(
ppi
,
&
time_tmp
);
TOPS
(
ppi
)
->
get
(
ppi
,
&
time_tmp
);
pp_time_add
(
&
time_tmp
,
ofm
);
pp_time_add
(
&
time_tmp
,
ofm
);
ppi
->
t_ops
->
set
(
ppi
,
&
time_tmp
);
TOPS
(
ppi
)
->
set
(
ppi
,
&
time_tmp
);
_pp_servo_init
(
ppi
);
_pp_servo_init
(
ppi
);
...
...
time-unix/unix-socket.c
View file @
e037e781
...
@@ -95,7 +95,7 @@ static int unix_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
...
@@ -95,7 +95,7 @@ static int unix_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
* get the recording time here, even though it may put a big
* get the recording time here, even though it may put a big
* spike in the offset signal sent to the clock servo
* spike in the offset signal sent to the clock servo
*/
*/
ppi
->
t_ops
->
get
(
ppi
,
t
);
TOPS
(
ppi
)
->
get
(
ppi
,
t
);
}
}
/* aux is only there if we asked for it, thus PROTO_VLAN */
/* aux is only there if we asked for it, thus PROTO_VLAN */
...
@@ -198,7 +198,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
...
@@ -198,7 +198,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
/* To fake a network frame loss, set the timestamp and do not send */
/* To fake a network frame loss, set the timestamp and do not send */
if
(
ppsi_drop_tx
())
{
if
(
ppsi_drop_tx
())
{
ppi
->
t_ops
->
get
(
ppi
,
t
);
TOPS
(
ppi
)
->
get
(
ppi
,
t
);
pp_diag
(
ppi
,
frames
,
1
,
"Drop sent frame
\n
"
);
pp_diag
(
ppi
,
frames
,
1
,
"Drop sent frame
\n
"
);
return
len
;
return
len
;
}
}
...
@@ -212,7 +212,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
...
@@ -212,7 +212,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
memcpy
(
hdr
->
h_dest
,
macaddr
[
is_pdelay
],
ETH_ALEN
);
memcpy
(
hdr
->
h_dest
,
macaddr
[
is_pdelay
],
ETH_ALEN
);
memcpy
(
hdr
->
h_source
,
ch
->
addr
,
ETH_ALEN
);
memcpy
(
hdr
->
h_source
,
ch
->
addr
,
ETH_ALEN
);
ppi
->
t_ops
->
get
(
ppi
,
t
);
TOPS
(
ppi
)
->
get
(
ppi
,
t
);
ret
=
send
(
ch
->
fd
,
hdr
,
len
,
0
);
ret
=
send
(
ch
->
fd
,
hdr
,
len
,
0
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
...
@@ -237,7 +237,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
...
@@ -237,7 +237,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
memcpy
(
hdr
->
h_dest
,
macaddr
[
is_pdelay
],
ETH_ALEN
);
memcpy
(
hdr
->
h_dest
,
macaddr
[
is_pdelay
],
ETH_ALEN
);
memcpy
(
vhdr
->
h_source
,
ch
->
addr
,
ETH_ALEN
);
memcpy
(
vhdr
->
h_source
,
ch
->
addr
,
ETH_ALEN
);
ppi
->
t_ops
->
get
(
ppi
,
t
);
TOPS
(
ppi
)
->
get
(
ppi
,
t
);
ret
=
send
(
ch
->
fd
,
vhdr
,
len
,
0
);
ret
=
send
(
ch
->
fd
,
vhdr
,
len
,
0
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
...
@@ -256,7 +256,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
...
@@ -256,7 +256,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg
addr
.
sin_port
=
htons
(
udpport
[
chtype
]);
addr
.
sin_port
=
htons
(
udpport
[
chtype
]);
addr
.
sin_addr
.
s_addr
=
ppi
->
mcast_addr
[
is_pdelay
];
addr
.
sin_addr
.
s_addr
=
ppi
->
mcast_addr
[
is_pdelay
];
ppi
->
t_ops
->
get
(
ppi
,
t
);
TOPS
(
ppi
)
->
get
(
ppi
,
t
);
ret
=
sendto
(
ppi
->
ch
[
chtype
].
fd
,
pkt
,
len
,
0
,
ret
=
sendto
(
ppi
->
ch
[
chtype
].
fd
,
pkt
,
len
,
0
,
(
struct
sockaddr
*
)
&
addr
,
(
struct
sockaddr
*
)
&
addr
,
...
...
timeout.c
View file @
e037e781
...
@@ -167,7 +167,7 @@ int pp_timeout_get(struct pp_instance *ppi, int index) {
...
@@ -167,7 +167,7 @@ int pp_timeout_get(struct pp_instance *ppi, int index) {
static
inline
void
__pp_timeout_set
(
struct
pp_instance
*
ppi
,
int
index
,
int
millisec
)
{
static
inline
void
__pp_timeout_set
(
struct
pp_instance
*
ppi
,
int
index
,
int
millisec
)
{
timeOutInstCnt_t
*
tmoCnt
=
__pp_get_counter
(
ppi
,
index
);
timeOutInstCnt_t
*
tmoCnt
=
__pp_get_counter
(
ppi
,
index
);
tmoCnt
->
tmo
=
ppi
->
t_ops
->
calc_timeout
(
ppi
,
millisec
);
tmoCnt
->
tmo
=
TOPS
(
ppi
)
->
calc_timeout
(
ppi
,
millisec
);
}
}
void
pp_timeout_set_rename
(
struct
pp_instance
*
ppi
,
int
index
,
int
millisec
,
char
*
name
)
void
pp_timeout_set_rename
(
struct
pp_instance
*
ppi
,
int
index
,
int
millisec
,
char
*
name
)
...
@@ -261,7 +261,7 @@ int pp_timeout(struct pp_instance *ppi, int index)
...
@@ -261,7 +261,7 @@ int pp_timeout(struct pp_instance *ppi, int index)
if
(
tmoCnt
->
initValueMs
==
TIMEOUT_DISABLE_VALUE
)
if
(
tmoCnt
->
initValueMs
==
TIMEOUT_DISABLE_VALUE
)
return
0
;
/* counter is disabled */
return
0
;
/* counter is disabled */
now
=
ppi
->
t_ops
->
calc_timeout
(
ppi
,
0
);
now
=
TOPS
(
ppi
)
->
calc_timeout
(
ppi
,
0
);
ret
=
time_after_eq
(
now
,
tmoCnt
->
tmo
);
ret
=
time_after_eq
(
now
,
tmoCnt
->
tmo
);
if
(
ret
)
if
(
ret
)
pp_diag
(
ppi
,
time
,
1
,
"timeout expired: %s - %lu
\n
"
,
pp_diag
(
ppi
,
time
,
1
,
"timeout expired: %s - %lu
\n
"
,
...
@@ -276,7 +276,7 @@ int pp_timeout(struct pp_instance *ppi, int index)
...
@@ -276,7 +276,7 @@ int pp_timeout(struct pp_instance *ppi, int index)
int
pp_next_delay_1
(
struct
pp_instance
*
ppi
,
int
i1
)
int
pp_next_delay_1
(
struct
pp_instance
*
ppi
,
int
i1
)
{
{
timeOutInstCnt_t
*
tmoCnt
=
__pp_get_counter
(
ppi
,
i1
);
timeOutInstCnt_t
*
tmoCnt
=
__pp_get_counter
(
ppi
,
i1
);
unsigned
long
now
=
ppi
->
t_ops
->
calc_timeout
(
ppi
,
0
);
unsigned
long
now
=
TOPS
(
ppi
)
->
calc_timeout
(
ppi
,
0
);
signed
long
r1
;
signed
long
r1
;
r1
=
tmoCnt
->
tmo
-
now
;
r1
=
tmoCnt
->
tmo
-
now
;
...
@@ -287,7 +287,7 @@ int pp_next_delay_2(struct pp_instance *ppi, int i1, int i2)
...
@@ -287,7 +287,7 @@ int pp_next_delay_2(struct pp_instance *ppi, int i1, int i2)
{
{
timeOutInstCnt_t
*
tmoCnt1
=
__pp_get_counter
(
ppi
,
i1
);
timeOutInstCnt_t
*
tmoCnt1
=
__pp_get_counter
(
ppi
,
i1
);
timeOutInstCnt_t
*
tmoCnt2
=
__pp_get_counter
(
ppi
,
i2
);
timeOutInstCnt_t
*
tmoCnt2
=
__pp_get_counter
(
ppi
,
i2
);
unsigned
long
now
=
ppi
->
t_ops
->
calc_timeout
(
ppi
,
0
);
unsigned
long
now
=
TOPS
(
ppi
)
->
calc_timeout
(
ppi
,
0
);
signed
long
r1
,
r2
;
signed
long
r1
,
r2
;
r1
=
tmoCnt1
->
tmo
-
now
;
r1
=
tmoCnt1
->
tmo
-
now
;
...
@@ -302,7 +302,7 @@ int pp_next_delay_3(struct pp_instance *ppi, int i1, int i2, int i3)
...
@@ -302,7 +302,7 @@ int pp_next_delay_3(struct pp_instance *ppi, int i1, int i2, int i3)
timeOutInstCnt_t
*
tmoCnt1
=
__pp_get_counter
(
ppi
,
i1
);
timeOutInstCnt_t
*
tmoCnt1
=
__pp_get_counter
(
ppi
,
i1
);
timeOutInstCnt_t
*
tmoCnt2
=
__pp_get_counter
(
ppi
,
i2
);
timeOutInstCnt_t
*
tmoCnt2
=
__pp_get_counter
(
ppi
,
i2
);
timeOutInstCnt_t
*
tmoCnt3
=
__pp_get_counter
(
ppi
,
i3
);
timeOutInstCnt_t
*
tmoCnt3
=
__pp_get_counter
(
ppi
,
i3
);
unsigned
long
now
=
ppi
->
t_ops
->
calc_timeout
(
ppi
,
0
);
unsigned
long
now
=
TOPS
(
ppi
)
->
calc_timeout
(
ppi
,
0
);
signed
long
r1
,
r2
,
r3
;
signed
long
r1
,
r2
,
r3
;
r1
=
tmoCnt1
->
tmo
-
now
;
r1
=
tmoCnt1
->
tmo
-
now
;
...
...
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