Commit 193fa9e4 authored by Jean-Claude BAU's avatar Jean-Claude BAU

HAL rxSetup: State machine modification

In the state machine, returns to START state if the link is going down
in RESET_PCS state.
parent 45256a97
......@@ -171,16 +171,13 @@ static int _hal_port_rx_setup_state_start(void *vpfg, int eventMsk, int isNewSta
*/
static int _hal_port_rx_setup_state_reset_pcs(void *vpfg, int eventMsk, int isNewState) {
struct hal_port_state * ps=((halPortFsmGen_t *)vpfg)->ps;
halPortLpdcRx_t *rxSetup=ps->lpdc->rxSetup;
if ( isNewState )
libwr_tmo_restart(&rxSetup->link_timeout);
if( _isHalRxSetupEventEarlyLinkUp(eventMsk)) {
halPortLpdcRx_t *rxSetup=ps->lpdc->rxSetup;
libwr_tmo_init(&rxSetup->link_timeout, 100, 1);
// 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);
pcs_writel(ps, MDIO_LPC_CTRL_RESET_RX |
MDIO_LPC_CTRL_TX_ENABLE |
......@@ -193,6 +190,9 @@ static int _hal_port_rx_setup_state_reset_pcs(void *vpfg, int eventMsk, int isNe
rxSetup->attempts++;
_fireState(vpfg,HAL_PORT_RX_SETUP_STATE_WAIT_LOCK);
} else {
if( libwr_tmo_expired( &rxSetup->link_timeout ) )
_fireState(vpfg,HAL_PORT_RX_SETUP_STATE_START);
}
return 0;
}
......@@ -205,6 +205,11 @@ static int _hal_port_rx_setup_state_wait_lock(void *vpfg, int eventMsk, int isNe
struct hal_port_state * ps=((halPortFsmGen_t *)vpfg)->ps;
halPortLpdcRx_t *rxSetup=ps->lpdc->rxSetup;
if ( isNewState ) {
libwr_tmo_restart(&rxSetup->link_timeout);
libwr_tmo_restart(&rxSetup->align_timeout);
}
if ( _isHalRxSetupEventEarlyLinkUp(eventMsk)) {
// 1ms rx align detection window, described in previous state.
if(! libwr_tmo_expired(&rxSetup->align_timeout) )
......@@ -250,7 +255,6 @@ static int _hal_port_rx_setup_state_validate(void *vpfg, int eventMsk, int isNew
"ps (after %d attempts).\n", ps->hw_index + 1,
phase, rxSetup->attempts);
rts_enable_ptracker(ps->hw_index, 0);
sleep(1); // fixme: really needed?
_fireState(vpfg, HAL_PORT_RX_SETUP_STATE_DONE);
}
......@@ -331,6 +335,15 @@ void hal_port_rx_setup_init_fsm(struct hal_port_state * ps ) {
entered from WAIT_LOCK*/
halPortLpdcRx_t *rxSetup=ps->lpdc->rxSetup;
libwr_tmo_init(&rxSetup->earlyup_timeout, 10, 1);
// link timeout
libwr_tmo_init(&rxSetup->link_timeout, 100, 1);
// 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);
}
_fireState(&_portFsm,HAL_PORT_RX_SETUP_STATE_START);
}
......
This diff is collapsed.
userspace/wrsw_hal/yakindu/hal_0_0.png

82.4 KB | W: | H:

userspace/wrsw_hal/yakindu/hal_0_0.png

84.1 KB | W: | H:

userspace/wrsw_hal/yakindu/hal_0_0.png
userspace/wrsw_hal/yakindu/hal_0_0.png
userspace/wrsw_hal/yakindu/hal_0_0.png
userspace/wrsw_hal/yakindu/hal_0_0.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment