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
adc08e73
Commit
adc08e73
authored
Feb 03, 2020
by
Jean-Claude BAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve diagnostics getting PLL state
parent
d4930dda
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
27 deletions
+44
-27
hal_exports.h
arch-wrs/include/hal_exports.h
+4
-6
wrh.h
include/hw-specific/wrh.h
+7
-5
wrh-servo.c
proto-ext-common/wrh-servo.c
+2
-4
l1e-state-machine.c
proto-ext-l1sync/l1e-state-machine.c
+2
-2
wrs-time.c
time-wrs/wrs-time.c
+29
-10
No files found.
arch-wrs/include/hal_exports.h
View file @
adc08e73
...
...
@@ -28,9 +28,10 @@
#define HEXP_LOCK_CMD_ENABLE_TRACKING 3
#define HEXP_LOCK_CMD_RESET 4
#define HEXP_LOCK_STATUS_LOCKED 0
#define HEXP_LOCK_STATUS_BUSY 1
#define HEXP_LOCK_STATUS_NONE 2
#define HEXP_LOCK_STATUS_UNLOCKED 0
#define HEXP_LOCK_STATUS_LOCKED 1
#define HEXP_LOCK_STATUS_RELOCK_ERROR 2
#define HEXP_LOCK_STATUS_ERROR 3
#define HEXP_PPSG_CMD_GET 0
#define HEXP_PPSG_CMD_ADJUST_PHASE 1
...
...
@@ -117,9 +118,6 @@ extern struct minipc_pd __rpcdef_pps_cmd;
extern
struct
minipc_pd
__rpcdef_port_update_cmd
;
/* Prototypes of functions that call on rpc */
extern
int
halexp_check_running
(
void
);
extern
int
halexp_reset_port
(
const
char
*
port_name
);
extern
int
halexp_calibration_cmd
(
const
char
*
port_name
,
int
command
,
int
on_off
);
extern
int
halexp_lock_cmd
(
const
char
*
port_name
,
int
command
,
int
priority
);
extern
int
halexp_pps_cmd
(
int
cmd
,
hexp_pps_params_t
*
params
);
...
...
include/hw-specific/wrh.h
View file @
adc08e73
...
...
@@ -14,13 +14,15 @@
#include <ppsi/lib.h>
/* Please increment WRS_PPSI_SHMEM_VERSION if you change any exported data structure */
#define WRS_PPSI_SHMEM_VERSION 3
2
/* added HAL_PORT_STATE_RESET to hal */
#define WRS_PPSI_SHMEM_VERSION 3
3
/* White Rabbit softpll status values */
#define WRH_SPLL_OK 0
#define WRH_SPLL_READY 1
#define WRH_SPLL_CALIB_NOT_READY 2
#define WRH_SPLL_ERROR -1
#define WRH_SPLL_OK 0
#define WRH_SPLL_LOCKED 1
#define WRH_SPLL_UNLOCKED 2
#define WRH_SPLL_RELOCK_ERROR 3
#define WRH_SPLL_UNKWOWN_ERROR 4
/* White Rabbit calibration defines */
#define WRH_HW_CALIB_TX 1
...
...
proto-ext-common/wrh-servo.c
View file @
adc08e73
...
...
@@ -241,10 +241,8 @@ static int __wrh_servo_update(struct pp_instance *ppi)
return
1
;
/* We have to wait before to start the synchronization */
locking_poll_ret
=
WRH_OPER
()
->
locking_poll
(
ppi
);
if
(
locking_poll_ret
!=
WRH_SPLL_READY
&&
locking_poll_ret
!=
WRH_SPLL_CALIB_NOT_READY
)
{
pp_error
(
"%s: PLL out of lock (Err=%d)
\n
"
,
__func__
,
locking_poll_ret
);
if
(
locking_poll_ret
!=
WRH_SPLL_LOCKED
){
pp_error
(
"%s: PLL error detected (Err=%d). Force restart.
\n
"
,
__func__
,
locking_poll_ret
);
s
->
doRestart
=
TRUE
;
return
0
;
}
...
...
proto-ext-l1sync/l1e-state-machine.c
View file @
adc08e73
...
...
@@ -146,7 +146,7 @@ static Boolean le1_evt_STATE_OK(struct pp_instance *ppi) {
case
PPS_UNCALIBRATED
:
pll_state
=
WRH_OPER
()
->
locking_poll
(
ppi
);
/* Get the PPL state */
basicDS
->
isCongruent
=
basicDS
->
isRxCoherent
=
pll_state
==
WRH_SPLL_
READY
?
1
:
0
;
basicDS
->
isRxCoherent
=
pll_state
==
WRH_SPLL_
LOCKED
?
1
:
0
;
break
;
case
PPS_MASTER
:
basicDS
->
isRxCoherent
=
...
...
@@ -162,7 +162,7 @@ static Boolean le1_evt_STATE_OK(struct pp_instance *ppi) {
* might remain locked. We want to detect this case.
*
* Thus, the condition should be:
* basicDS->isCongruent= pll_state == !WRH_SPLL_
READY
? 1 : 0;
* basicDS->isCongruent= pll_state == !WRH_SPLL_
LOCKED
? 1 : 0;
*/
basicDS
->
isCongruent
=
1
;
break
;
...
...
time-wrs/wrs-time.c
View file @
adc08e73
...
...
@@ -295,7 +295,7 @@ int wrs_locking_reset(struct pp_instance *ppi)
if
(
ppi
->
glbs
->
defaultDS
->
clockQuality
.
clockClass
!=
PP_PTP_CLASS_GM_LOCKED
)
if
(
wrs_set_timing_mode
(
GLBS
(
ppi
),
WRH_TM_FREE_MASTER
)
<
0
)
{
return
-
1
;
return
WRH_SPLL_ERROR
;
}
WRS_ARCH_I
(
ppi
)
->
timingModeLockingState
=
WRH_TM_LOCKING_STATE_LOCKING
;
...
...
@@ -305,20 +305,39 @@ int wrs_locking_reset(struct pp_instance *ppi)
int
wrs_locking_poll
(
struct
pp_instance
*
ppi
)
{
int
ret
,
rval
;
char
*
pp_diag_msg
;
char
text
[
128
];
ret
=
minipc_call
(
hal_ch
,
DEFAULT_TO
,
&
__rpcdef_lock_cmd
,
&
rval
,
ppi
->
iface_name
,
HEXP_LOCK_CMD_CHECK
,
0
);
if
(
ret
<
0
)
{
pp_diag
(
ppi
,
time
,
2
,
"PLL is not ready: minirpc communication error %s
\n
"
,
strerror
(
errno
));
return
WRH_SPLL_ERROR
;
/* FIXME should be WRH_SPLL_NOT_READY */
if
(
PP_HAS_DIAG
)
{
pp_sprintf
(
text
,
"not ready: minirpc communication error %s"
,
strerror
(
errno
));
pp_diag_set_msg
(
pp_diag_msg
,
text
);
}
if
(
rval
!=
HEXP_LOCK_STATUS_LOCKED
)
{
pp_diag
(
ppi
,
time
,
2
,
"PLL not locked(%d)
\n
"
,
rval
);
return
WRH_SPLL_ERROR
;
/* FIXME should be WRH_SPLL_NOT_READY */
ret
=
WRH_SPLL_ERROR
;
}
else
{
switch
(
rval
)
{
case
HEXP_LOCK_STATUS_LOCKED
:
pp_diag_set_msg
(
pp_diag_msg
,
"locked"
);
ret
=
WRH_SPLL_LOCKED
;
break
;
case
HEXP_LOCK_STATUS_UNLOCKED
:
pp_diag_set_msg
(
pp_diag_msg
,
"unlocked"
);
ret
=
WRH_SPLL_UNLOCKED
;
break
;
case
HEXP_LOCK_STATUS_RELOCK_ERROR
:
pp_diag_set_msg
(
pp_diag_msg
,
"in fault. Re-locking error."
);
ret
=
WRH_SPLL_RELOCK_ERROR
;
break
;
default:
pp_diag_set_msg
(
pp_diag_msg
,
"in an unknown state"
);
ret
=
WRH_SPLL_UNKWOWN_ERROR
;
break
;
}
pp_diag
(
ppi
,
time
,
2
,
"PLL is
locked
\n
"
);
return
WRH_SPLL_READY
;
}
pp_diag
(
ppi
,
time
,
2
,
"PLL is
%s
\n
"
,
pp_diag_get_msg
(
pp_diag_msg
)
);
return
ret
;
}
/* This is a hack, but at least the year is 640bit clean */
...
...
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