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
24fe3621
Commit
24fe3621
authored
Oct 24, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time: fix wrpc
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
38427664
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
24 deletions
+21
-24
wrpc-socket.c
time-wrpc/wrpc-socket.c
+15
-18
wrpc-time.c
time-wrpc/wrpc-time.c
+6
-6
No files found.
time-wrpc/wrpc-socket.c
View file @
24fe3621
...
...
@@ -49,7 +49,7 @@ static int wrpc_open_ch(struct pp_instance *ppi)
/* To receive and send packets, we call the minic low-level stuff */
static
int
wrpc_net_recv
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
,
TimeInternal
*
t
)
struct
pp_time
*
t
)
{
int
got
;
struct
wrpc_socket
*
sock
;
...
...
@@ -59,15 +59,11 @@ static int wrpc_net_recv(struct pp_instance *ppi, void *pkt, int len,
got
=
ptpd_netif_recvfrom
(
sock
,
&
addr
,
pkt
,
len
,
&
wr_ts
);
if
(
t
)
{
t
->
seconds
=
wr_ts
.
sec
;
t
->
nanoseconds
=
wr_ts
.
nsec
;
t
->
phase
=
wr_ts
.
phase
;
t
->
correct
=
wr_ts
.
correct
;
#if 0 /* I disabled the fields, for space: they were only used here */
t->raw_nsec = wr_ts.raw_nsec;
t->raw_phase = wr_ts.raw_phase;
#endif
t
->
raw_ahead
=
wr_ts
.
raw_ahead
;
t
->
secs
=
wr_ts
.
sec
;
t
->
scaled_nsecs
=
(
int64_t
)
wr_ts
.
nsec
<<
16
;
t
->
scaled_nsecs
+=
wr_ts
.
phase
*
(
1
<<
16
)
/
1000
;
if
(
!
wr_ts
.
correct
)
mark_incorrect
(
t
);
}
/* wrpc-sw may pass this in USER_CFLAGS, to remove footprint */
...
...
@@ -87,7 +83,7 @@ static int wrpc_net_send(struct pp_instance *ppi, void *pkt, int len,
struct
wrpc_socket
*
sock
;
struct
wr_timestamp
wr_ts
;
struct
wr_sockaddr
addr
;
TimeInternal
*
t
=
&
ppi
->
last_snt_time
;
struct
pp_time
*
t
=
&
ppi
->
last_snt_time
;
int
is_pdelay
=
pp_msgtype_info
[
msgtype
].
is_pdelay
;
static
const
uint8_t
macaddr
[
2
][
ETH_ALEN
]
=
{
[
PP_E2E_MECH
]
=
PP_MCAST_MACADDRESS
,
...
...
@@ -102,13 +98,14 @@ static int wrpc_net_send(struct pp_instance *ppi, void *pkt, int len,
snt
=
ptpd_netif_sendto
(
sock
,
&
addr
,
pkt
,
len
,
&
wr_ts
);
if
(
t
)
{
t
->
seconds
=
wr_ts
.
sec
;
t
->
nanoseconds
=
wr_ts
.
nsec
;
t
->
phase
=
0
;
t
->
correct
=
wr_ts
.
correct
;
pp_diag
(
ppi
,
frames
,
2
,
"%s: snt=%d, sec=%d, nsec=%d
\n
"
,
__func__
,
snt
,
t
->
seconds
,
t
->
nanoseconds
);
t
->
secs
=
wr_ts
.
sec
;
t
->
scaled_nsecs
=
(
int64_t
)
wr_ts
.
nsec
<<
16
;
if
(
!
wr_ts
.
correct
)
mark_incorrect
(
t
);
pp_diag
(
ppi
,
frames
,
2
,
"%s: snt=%d, sec=%ld, nsec=%ld
\n
"
,
__func__
,
snt
,
(
long
)
t
->
secs
,
(
long
)(
t
->
scaled_nsecs
>>
16
));
}
/* wrpc-sw may pass this in USER_CFLAGS, to remove footprint */
#ifndef CONFIG_NO_PTPDUMP
...
...
time-wrpc/wrpc-time.c
View file @
24fe3621
...
...
@@ -9,22 +9,22 @@
#include "pps_gen.h"
/* in wrpc-sw */
#include "syscon.h"
/* in wrpc-sw */
static
int
wrpc_time_get
(
struct
pp_instance
*
ppi
,
TimeInternal
*
t
)
static
int
wrpc_time_get
(
struct
pp_instance
*
ppi
,
struct
pp_time
*
t
)
{
uint64_t
sec
;
uint32_t
nsec
;
shw_pps_gen_get_time
(
&
sec
,
&
nsec
);
t
->
sec
ond
s
=
sec
;
t
->
nanoseconds
=
nsec
;
t
->
secs
=
sec
;
t
->
scaled_nsecs
=
(
int64_t
)
nsec
<<
16
;
if
(
!
(
pp_global_d_flags
&
PP_FLAG_NOTIMELOG
))
pp_diag
(
ppi
,
time
,
2
,
"%s: %9lu.%09li
\n
"
,
__func__
,
(
long
)
sec
,
(
long
)
nsec
);
return
0
;
}
static
int
wrpc_time_set
(
struct
pp_instance
*
ppi
,
TimeInternal
*
t
)
static
int
wrpc_time_set
(
struct
pp_instance
*
ppi
,
const
struct
pp_time
*
t
)
{
uint64_t
sec
;
unsigned
long
nsec
;
...
...
@@ -32,8 +32,8 @@ static int wrpc_time_set(struct pp_instance *ppi, TimeInternal *t)
if
(
!
t
)
/* tai offset changed. We don't have it in wrpc-sw */
return
0
;
sec
=
t
->
sec
ond
s
;
nsec
=
t
->
nanoseconds
;
sec
=
t
->
secs
;
nsec
=
t
->
scaled_nsecs
>>
16
;
shw_pps_gen_set_time
(
sec
,
nsec
,
PPSG_SET_ALL
);
pp_diag
(
ppi
,
time
,
1
,
"%s: %9lu.%09li
\n
"
,
__func__
,
...
...
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