Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
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
White Rabbit Switch - Software
Commits
5f241f55
Commit
5f241f55
authored
Oct 31, 2019
by
Jean-Claude BAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HAL: RxSetup sub-state machine improvements
parent
eec4846d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
hal_port_fsm_rx.c
userspace/wrsw_hal/hal_port_fsm_rx.c
+18
-8
No files found.
userspace/wrsw_hal/hal_port_fsm_rx.c
View file @
5f241f55
...
...
@@ -275,8 +275,7 @@ static int _hal_port_rx_setup_state_wait_lock(fsm_t *fsm, int eventMsk, int isNe
*
*/
static
int
_hal_port_rx_setup_state_validate
(
fsm_t
*
fsm
,
int
eventMsk
,
int
isNewState
)
{
struct
hal_port_state
*
ps
=
(
struct
hal_port_state
*
)
fsm
->
priv
;
struct
hal_port_state
*
ps
=
(
struct
hal_port_state
*
)
fsm
->
priv
;
updatePllState
(
ps
);
...
...
@@ -296,8 +295,12 @@ static int _hal_port_rx_setup_state_validate(fsm_t *fsm, int eventMsk, int isNew
rts_enable_ptracker
(
ps
->
hw_index
,
0
);
fsm_fire_state
(
fsm
,
HAL_PORT_RX_SETUP_STATE_DONE
);
}
}
else
{
if
(
!
_isHalRxSetupEventEarlyLinkUp
(
eventMsk
)
||
libwr_tmo_expired
(
&
ps
->
lpdc
.
minCalibRx_timeout
)
)
// We are waiting for too long
fsm_fire_state
(
fsm
,
HAL_PORT_RX_SETUP_STATE_INIT
);
}
return
0
;
}
...
...
@@ -311,7 +314,7 @@ static int _hal_port_rx_setup_state_restart(fsm_t *fsm, int eventMsk, int isNewS
if
(
isNewState
)
{
// This timer is used to leave enough time to the FSM in the other side to detect a link down
libwr_tmo_
init
(
&
ps
->
lpdc
.
rxSetup
->
restart_timeout
,
100
,
0
);
libwr_tmo_
restart
(
&
ps
->
lpdc
.
rxSetup
->
restart_timeout
);
pcs_writel
(
ps
,
MDIO_LPC_CTRL_DMTD_SOURCE_TXOUTCLK
,
MDIO_LPC_CTRL
);
}
else
{
...
...
@@ -339,7 +342,7 @@ static int _hal_port_rx_setup_state_done(fsm_t *fsm, int eventMsk, int isNewStat
/* earlyLinkUp detection only if LPDC support */
if
(
ps
->
lpdc
.
isSupported
)
{
if
(
isNewState
)
{
libwr_tmo_
init
(
&
ps
->
lpdc
.
rxSetup
->
align_to_link_timeout
,
5000
,
0
);
libwr_tmo_
restart
(
&
ps
->
lpdc
.
rxSetup
->
align_to_link_timeout
);
}
if
(
!
early_up
)
{
// Port went done
...
...
@@ -431,16 +434,23 @@ void hal_port_rx_setup_fsm_init(struct hal_port_state * ps ) {
the timeout would also kick in when the START state is
entered from WAIT_LOCK*/
halPortLpdcRx_t
*
rxSetup
=
ps
->
lpdc
.
rxSetup
;
libwr_tmo_init
(
&
rxSetup
->
earlyup_timeout
,
10
,
1
);
libwr_tmo_init
(
&
rxSetup
->
earlyup_timeout
,
10
,
0
);
// link timeout
libwr_tmo_init
(
&
rxSetup
->
link_timeout
,
100
,
1
);
libwr_tmo_init
(
&
rxSetup
->
link_timeout
,
100
,
0
);
// Establish a 1ms wait for the LINK_ALIGNED flag -
// alignment detection takes a little bit more time than early
// link detect. Without the wait (depending on execution timing of the HAL code)
// the wait_lock state might detect the early link but never see it's aligned.
libwr_tmo_init
(
&
rxSetup
->
align_timeout
,
1
,
1
);
libwr_tmo_init
(
&
rxSetup
->
align_timeout
,
1
,
0
);
// Align to link time-out
libwr_tmo_init
(
&
ps
->
lpdc
.
rxSetup
->
align_to_link_timeout
,
5000
,
0
);
// This timer is used to leave enough time to the FSM in the other side to detect a link down
libwr_tmo_init
(
&
ps
->
lpdc
.
rxSetup
->
restart_timeout
,
100
,
0
);
}
/**
* This time-out is used to impose the same minimum of RX calibration time
...
...
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