Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
Software for White Rabbit PTP Core
Commits
d18dde7b
Commit
d18dde7b
authored
Aug 15, 2019
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ljd: check only once whether it is present
parent
c0b241ea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
+14
-9
ext-board.h
include/ext-board.h
+2
-0
spll_external.c
softpll/spll_external.c
+8
-8
wrs_main.c
wrs_main.c
+4
-1
No files found.
include/ext-board.h
View file @
d18dde7b
...
...
@@ -7,4 +7,6 @@
#define GPIO_EXT_OSC_FRED_D1 7
#define GPIO_EXT_OSC_FRED_D2 8
extern
int
ljd_present
;
#endif
softpll/spll_external.c
View file @
d18dde7b
...
...
@@ -29,7 +29,7 @@ void external_init(volatile struct spll_external_state *s, int ext_ref,
{
int
idx
=
spll_n_chan_ref
+
spll_n_chan_out
;
if
(
gpio_in
(
GPIO_EXT_BOARD_DETECT
)
)
if
(
ljd_present
)
idx
++
;
helper_init
(
s
->
helper
,
idx
);
...
...
@@ -55,12 +55,12 @@ int external_locked(volatile struct spll_external_state *s)
if
(
!
s
->
helper
->
ld
.
locked
||
!
s
->
main
->
ld
.
locked
)
return
0
;
if
(
!
gpio_in
(
GPIO_EXT_BOARD_DETECT
)
&&
(
!
(
SPLL
->
ECCR
&
SPLL_ECCR_EXT_REF_LOCKED
)
||
// ext PLL became unlocked
if
(
!
ljd_present
&&
(
!
(
SPLL
->
ECCR
&
SPLL_ECCR_EXT_REF_LOCKED
)
||
// ext PLL became unlocked
(
SPLL
->
ECCR
&
SPLL_ECCR_EXT_REF_STOPPED
)))
// 10MHz unplugged (only SPEC)
return
0
;
//FIXME A bug prevents the correct locking if the external lock check is executed
// Correct way to solve it: export the LOCK signal from the gateware and check it
// if (
gpio_in(GPIO_EXT_BOARD_DETECT)
&& ext_ad9516_locked())
// if (
ljd_present
&& ext_ad9516_locked())
// return 1;
switch
(
s
->
align_state
)
{
...
...
@@ -102,13 +102,13 @@ int external_align_fsm(volatile struct spll_external_state *s)
break
;
case
ALIGN_STATE_WAIT_CLKIN
:
if
(
!
gpio_in
(
GPIO_EXT_BOARD_DETECT
)
&&
!
(
SPLL
->
ECCR
&
SPLL_ECCR_EXT_REF_STOPPED
)
)
{
if
(
!
ljd_present
&&
!
(
SPLL
->
ECCR
&
SPLL_ECCR_EXT_REF_STOPPED
)
)
{
SPLL
->
ECCR
|=
SPLL_ECCR_EXT_REF_PLLRST
;
s
->
align_state
=
ALIGN_STATE_WAIT_PLOCK
;
done_sth
++
;
}
f_ext
=
spll_measure_frequency
(
SPLL_OSC_EXT
);
if
(
gpio_in
(
GPIO_EXT_BOARD_DETECT
)
&&
(
f_ext
>
9999000
)
&&
(
f_ext
<
10001000
))
if
(
ljd_present
&&
(
f_ext
>
9999000
)
&&
(
f_ext
<
10001000
))
if
(
!
ext_ad9516_init
())
{
s
->
align_state
=
ALIGN_STATE_WAIT_PLOCK
;
pp_printf
(
"External AD9516 locked
\n
"
);
...
...
@@ -118,10 +118,10 @@ int external_align_fsm(volatile struct spll_external_state *s)
case
ALIGN_STATE_WAIT_PLOCK
:
SPLL
->
ECCR
&=
(
~
SPLL_ECCR_EXT_REF_PLLRST
);
if
(
!
gpio_in
(
GPIO_EXT_BOARD_DETECT
)
&&
SPLL
->
ECCR
&
SPLL_ECCR_EXT_REF_STOPPED
)
if
(
!
ljd_present
&&
SPLL
->
ECCR
&
SPLL_ECCR_EXT_REF_STOPPED
)
s
->
align_state
=
ALIGN_STATE_WAIT_CLKIN
;
else
if
((
!
gpio_in
(
GPIO_EXT_BOARD_DETECT
)
&&
SPLL
->
ECCR
&
SPLL_ECCR_EXT_REF_LOCKED
)
||
gpio_in
(
GPIO_EXT_BOARD_DETECT
)
&&
ext_ad9516_locked
())
else
if
((
!
ljd_present
&&
SPLL
->
ECCR
&
SPLL_ECCR_EXT_REF_LOCKED
)
||
ljd_present
&&
ext_ad9516_locked
())
s
->
align_state
=
ALIGN_STATE_START
;
done_sth
++
;
break
;
...
...
wrs_main.c
View file @
d18dde7b
...
...
@@ -18,6 +18,7 @@
int
scb_ver
=
33
;
/* SCB version */
int
ljd_present
=
0
;
/* Low-jitter Daughterboard presence indicator */
extern
struct
spll_stats
stats
;
...
...
@@ -42,7 +43,9 @@ int main(void)
build_revision
,
build_date
,
build_time
);
pp_printf
(
"SCB version: %d. %s
\n
"
,
scb_ver
,(
scb_ver
>=
34
)
?
"10 MHz SMC Output."
:
""
);
pp_printf
(
"Start counter %d
\n
"
,
stats
.
start_cnt
);
if
(
gpio_in
(
GPIO_EXT_BOARD_DETECT
))
/* Low-jitter Daughterboard detection */
ljd_present
=
gpio_in
(
GPIO_EXT_BOARD_DETECT
);
if
(
ljd_present
)
pp_printf
(
"
\n
--- WRS Low jitter board detected. ---
\n
Allow 1 hour of warming \
up before starting measurements
\n
"
);
pp_printf
(
"--
\n
"
);
...
...
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