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
0a49d0dd
Commit
0a49d0dd
authored
Mar 13, 2017
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrpc: add faults in timestamps
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
9ce04d1b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
7 deletions
+44
-7
faults.c
arch-wrpc/faults.c
+20
-0
wr-servo.c
proto-ext-whiterabbit/wr-servo.c
+24
-7
No files found.
arch-wrpc/faults.c
View file @
0a49d0dd
...
...
@@ -12,6 +12,7 @@
extern
struct
pp_instance
ppi_static
;
extern
int
frame_rx_delay_us
;
extern
struct
pp_time
faulty_stamps
[
6
];
static
int
cmd_fault
(
const
char
*
args
[])
{
...
...
@@ -33,8 +34,27 @@ static int cmd_fault(const char *args[])
pp_printf
(
"delaying %i us on rx frame
\n
"
,
frame_rx_delay_us
);
return
0
;
}
if
(
args
[
0
]
&&
!
strcmp
(
args
[
0
],
"stamp"
))
{
int
i
,
v
;
struct
pp_time
*
t
;
/* input is hex, output is decimal (ps) */
pp_printf
(
"timestamp offset:"
);
for
(
i
=
0
;
i
<
6
;
i
++
)
{
t
=
faulty_stamps
+
i
;
if
(
args
[
i
+
1
])
{
fromhex
(
args
[
i
+
1
],
&
v
);
t
->
scaled_nsecs
=
v
;
}
pp_printf
(
" %i ps"
,
(
int
)((
t
->
scaled_nsecs
*
1000
)
>>
16
));
}
pp_printf
(
"
\n
"
);
}
pp_printf
(
"Use:
\"
fault drop [<rxdrop> <txdrop>]
\"
(0..999)
\n
"
);
pp_printf
(
"
\"
fault delay [<usecs>]
\"\n
"
);
pp_printf
(
"
\"
fault stamp [<hex-offset> ...]
\"\n
"
);
return
-
EINVAL
;
}
...
...
proto-ext-whiterabbit/wr-servo.c
View file @
0a49d0dd
#include <ppsi/ppsi.h>
#include <ppsi/assert.h>
#include "wr-api.h"
#include <libwr/shmem.h>
...
...
@@ -8,6 +9,23 @@
#define ARCH_IS_WRS 0
#endif
#ifdef CONFIG_WRPC_FAULTS
#define HAS_FAULTS 1
#else
#define HAS_FAULTS 0
#endif
struct
pp_time
faulty_stamps
[
6
];
/* if unused, dropped at link time */
static
void
apply_faulty_stamp
(
struct
wr_servo_state
*
s
,
int
index
)
{
if
(
HAS_FAULTS
)
{
assert
(
index
>=
1
&&
index
<=
6
,
"Wrong T index %i
\n
"
,
index
);
pp_time_add
(
&
s
->
t1
+
index
-
1
,
faulty_stamps
+
index
-
1
);
}
}
#define WR_SERVO_OFFSET_STABILITY_THRESHOLD 60
/* psec */
#define FIX_ALPHA_FRACBITS 40
...
...
@@ -198,8 +216,8 @@ int wr_servo_got_sync(struct pp_instance *ppi, struct pp_time *t1,
struct
wr_servo_state
*
s
=
&
((
struct
wr_data
*
)
ppi
->
ext_data
)
->
servo_state
;
s
->
t1
=
*
t1
;
s
->
t2
=
*
t2
;
s
->
t1
=
*
t1
;
apply_faulty_stamp
(
s
,
1
);
s
->
t2
=
*
t2
;
apply_faulty_stamp
(
s
,
2
);
got_sync
=
1
;
return
0
;
}
...
...
@@ -211,13 +229,12 @@ int wr_servo_got_delay(struct pp_instance *ppi)
wrs_shm_write
(
ppsi_head
,
WRS_SHM_WRITE_BEGIN
);
s
->
t3
=
ppi
->
t3
;
/* s->t3.phase = 0; */
s
->
t4
=
ppi
->
t4
;
s
->
t3
=
ppi
->
t3
;
apply_faulty_stamp
(
s
,
3
);
s
->
t4
=
ppi
->
t4
;
apply_faulty_stamp
(
s
,
4
);
if
(
CONFIG_HAS_P2P
&&
ppi
->
mech
==
PP_P2P_MECH
)
{
s
->
t5
=
ppi
->
t5
;
s
->
t6
=
ppi
->
t6
;
s
->
t5
=
ppi
->
t5
;
apply_faulty_stamp
(
s
,
5
);
s
->
t6
=
ppi
->
t6
;
apply_faulty_stamp
(
s
,
6
);
wr_p2p_delay
(
ppi
,
s
);
}
...
...
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