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
8d4eba82
Commit
8d4eba82
authored
Oct 24, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time: fix simulator
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
d395932e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
+14
-15
sim-socket.c
time-sim/sim-socket.c
+4
-4
sim-time.c
time-sim/sim-time.c
+10
-11
No files found.
time-sim/sim-socket.c
View file @
8d4eba82
...
@@ -73,7 +73,7 @@ static int pending_received(struct sim_ppg_arch_data *data)
...
@@ -73,7 +73,7 @@ static int pending_received(struct sim_ppg_arch_data *data)
}
}
static
int
sim_recv_msg
(
struct
pp_instance
*
ppi
,
int
fd
,
void
*
pkt
,
int
len
,
static
int
sim_recv_msg
(
struct
pp_instance
*
ppi
,
int
fd
,
void
*
pkt
,
int
len
,
TimeInternal
*
t
)
struct
pp_time
*
t
)
{
{
ssize_t
ret
;
ssize_t
ret
;
struct
msghdr
msg
;
struct
msghdr
msg
;
...
@@ -119,7 +119,7 @@ static int sim_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
...
@@ -119,7 +119,7 @@ static int sim_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
ppi
->
t_ops
->
get
(
ppi
,
t
);
ppi
->
t_ops
->
get
(
ppi
,
t
);
/* This is not really hw... */
/* This is not really hw... */
pp_diag
(
ppi
,
time
,
2
,
"recv stamp: %i.%09i (%s)
\n
"
,
pp_diag
(
ppi
,
time
,
2
,
"recv stamp: %i.%09i (%s)
\n
"
,
(
int
)
t
->
sec
onds
,
(
int
)
t
->
nanoseconds
,
"user"
);
(
int
)
t
->
sec
s
,
(
int
)(
t
->
scaled_nsecs
>>
16
)
,
"user"
);
/* If we got a DelayResponse print out the offset from master */
/* If we got a DelayResponse print out the offset from master */
if
(((
*
(
Enumeration4
*
)
(
pkt
+
0
))
&
0x0F
)
==
PPM_DELAY_RESP
)
{
if
(((
*
(
Enumeration4
*
)
(
pkt
+
0
))
&
0x0F
)
==
PPM_DELAY_RESP
)
{
master_ns
=
SIM_PPI_ARCH
(
INST
(
ppg
,
SIM_MASTER
))
->
time
.
current_ns
;
master_ns
=
SIM_PPI_ARCH
(
INST
(
ppg
,
SIM_MASTER
))
->
time
.
current_ns
;
...
@@ -132,7 +132,7 @@ static int sim_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
...
@@ -132,7 +132,7 @@ static int sim_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
}
}
static
int
sim_net_recv
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
,
static
int
sim_net_recv
(
struct
pp_instance
*
ppi
,
void
*
pkt
,
int
len
,
TimeInternal
*
t
)
struct
pp_time
*
t
)
{
{
struct
sim_ppg_arch_data
*
data
=
SIM_PPG_ARCH
(
ppi
->
glbs
);
struct
sim_ppg_arch_data
*
data
=
SIM_PPG_ARCH
(
ppi
->
glbs
);
struct
pp_channel
*
ch
;
struct
pp_channel
*
ch
;
...
@@ -165,7 +165,7 @@ static int sim_net_send(struct pp_instance *ppi, void *pkt, int len,
...
@@ -165,7 +165,7 @@ static int sim_net_send(struct pp_instance *ppi, void *pkt, int len,
int
msgtype
)
int
msgtype
)
{
{
int
chtype
=
pp_msgtype_info
[
msgtype
].
chtype
;
int
chtype
=
pp_msgtype_info
[
msgtype
].
chtype
;
TimeInternal
*
t
=
&
ppi
->
last_snt_time
;
struct
pp_time
*
t
=
&
ppi
->
last_snt_time
;
struct
sim_ppi_arch_data
*
data
=
SIM_PPI_ARCH
(
ppi
);
struct
sim_ppi_arch_data
*
data
=
SIM_PPI_ARCH
(
ppi
);
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
struct
sim_pending_pkt
pending
;
struct
sim_pending_pkt
pending
;
...
...
time-sim/sim-time.c
View file @
8d4eba82
...
@@ -46,32 +46,31 @@ int sim_fast_forward_ns(struct pp_globals *ppg, int64_t ff_ns)
...
@@ -46,32 +46,31 @@ int sim_fast_forward_ns(struct pp_globals *ppg, int64_t ff_ns)
return
0
;
return
0
;
}
}
static
int
sim_time_get
(
struct
pp_instance
*
ppi
,
TimeInternal
*
t
)
static
int
sim_time_get
(
struct
pp_instance
*
ppi
,
struct
pp_time
*
t
)
{
{
t
->
nanoseconds
=
SIM_PPI_ARCH
(
ppi
)
->
time
.
current_ns
%
t
->
scaled_nsecs
=
(
SIM_PPI_ARCH
(
ppi
)
->
time
.
current_ns
%
(
long
long
)
PP_NSEC_PER_SEC
;
(
long
long
)
PP_NSEC_PER_SEC
)
<<
16
;
t
->
seconds
=
(
SIM_PPI_ARCH
(
ppi
)
->
time
.
current_ns
-
t
->
nanoseconds
)
/
t
->
secs
=
SIM_PPI_ARCH
(
ppi
)
->
time
.
current_ns
/
(
long
long
)
PP_NSEC_PER_SEC
;
(
long
long
)
PP_NSEC_PER_SEC
;
t
->
correct
=
1
;
if
(
!
(
pp_global_d_flags
&
PP_FLAG_NOTIMELOG
))
if
(
!
(
pp_global_d_flags
&
PP_FLAG_NOTIMELOG
))
pp_diag
(
ppi
,
time
,
2
,
"%s: %9li.%09li
\n
"
,
__func__
,
pp_diag
(
ppi
,
time
,
2
,
"%s: %9li.%09li
\n
"
,
__func__
,
(
long
)
t
->
sec
onds
,
(
long
)
t
->
nanoseconds
);
(
long
)
t
->
sec
s
,
(
long
)(
t
->
scaled_nsecs
>>
16
)
);
return
0
;
return
0
;
}
}
static
int
sim_time_set
(
struct
pp_instance
*
ppi
,
TimeInternal
*
t
)
static
int
sim_time_set
(
struct
pp_instance
*
ppi
,
const
struct
pp_time
*
t
)
{
{
if
(
!
t
)
{
if
(
!
t
)
{
/* Change the network notion of utc/tai offset */
/* Change the network notion of utc/tai offset */
return
0
;
return
0
;
}
}
SIM_PPI_ARCH
(
ppi
)
->
time
.
current_ns
=
t
->
nanoseconds
SIM_PPI_ARCH
(
ppi
)
->
time
.
current_ns
=
(
t
->
scaled_nsecs
>>
16
)
+
t
->
sec
ond
s
*
(
long
long
)
PP_NSEC_PER_SEC
;
+
t
->
secs
*
(
long
long
)
PP_NSEC_PER_SEC
;
pp_diag
(
ppi
,
time
,
1
,
"%s: %9i.%09i
\n
"
,
__func__
,
pp_diag
(
ppi
,
time
,
1
,
"%s: %9i.%09i
\n
"
,
__func__
,
t
->
seconds
,
t
->
nanoseconds
);
(
int
)
t
->
secs
,
(
int
)(
t
->
scaled_nsecs
>>
16
)
);
return
0
;
return
0
;
}
}
...
...
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