Commit e2be4238 authored by Jean-Claude BAU's avatar Jean-Claude BAU

HA bug fixes

- Force L1SYNC DISABLE state when the extension is not ON
- Disabling of the PLL must be done only on slave/uncalibrated states
when we leave l1sync UP state.
parent 9344198c
...@@ -206,24 +206,28 @@ static void l1e_state_change(struct pp_instance *ppi) { ...@@ -206,24 +206,28 @@ static void l1e_state_change(struct pp_instance *ppi) {
// Extension need to be re-enabled // Extension need to be re-enabled
pdstate_enable_extension(ppi); pdstate_enable_extension(ppi);
} }
if ( ppi->extState==PP_EXSTATE_ACTIVE ) {
switch (ppi->next_state) { if ( (ppi->next_state==PPS_DISABLED || ppi->extState!=PP_EXSTATE_ACTIVE) &&
case PPS_DISABLED : L1E_DSPOR(ppi)->basic.L1SyncState!=L1SYNC_DISABLED) {
/* In PPSI we go to DISABLE state when the link is down */ // Extension not active but the l1sync state is not disable yet.
/* For the time being, it should be done like this because fsm is not called when the link is down */ L1E_DSPOR(ppi)->basic.next_state=L1SYNC_DISABLED; /* Force L1Sync DISABLE state */
L1E_DSPOR(ppi)->basic.next_state=L1SYNC_DISABLED; /* Force L1Sync DISABLE state */ l1e_run_state_machine(ppi,NULL,0);
l1e_run_state_machine(ppi,NULL,0); } else {
break; if ( ppi->extState==PP_EXSTATE_ACTIVE && ppi->next_state==PPS_INITIALIZING) {
case PPS_INITIALIZING : L1E_DSPOR(ppi)->basic.L1SyncState=L1E_DSPOR(ppi)->basic.next_state=L1SYNC_DISABLED;
L1E_DSPOR(ppi)->basic.L1SyncState=L1E_DSPOR(ppi)->basic.next_state=L1SYNC_DISABLED; } else {
break; if ( ppi->state==PPS_SLAVE && ppi->next_state!=PPS_UNCALIBRATED &&
} L1E_DSPOR(ppi)->basic.L1SyncState!=L1SYNC_DISABLED ) {
if ( ppi->state==PPS_SLAVE && ppi->next_state!=PPS_UNCALIBRATED ) { /* Leave SLAVE state : We must stop the PPS generation */
/* Leave SLAVE state : We must stop the PPS generation */ TOPS(ppi)->enable_timing_output(GLBS(ppi),0);
TOPS(ppi)->enable_timing_output(GLBS(ppi),0); WRH_OPER()->locking_disable(ppi);
WRH_OPER()->locking_reset(ppi); WRH_OPER()->locking_reset(ppi);
l1e_servo_reset(ppi);
}
} }
} }
} }
static int l1e_new_slave (struct pp_instance *ppi, void *buf, int len) { static int l1e_new_slave (struct pp_instance *ppi, void *buf, int len) {
...@@ -256,6 +260,11 @@ static int l1e_is_correction_field_compliant (struct pp_instance *ppi) { ...@@ -256,6 +260,11 @@ static int l1e_is_correction_field_compliant (struct pp_instance *ppi) {
} }
static int l1e_extension_state_changed( struct pp_instance * ppi) { static int l1e_extension_state_changed( struct pp_instance * ppi) {
if ( ppi->extState!=PP_EXSTATE_ACTIVE && L1E_DSPOR(ppi)->basic.L1SyncState!=L1SYNC_DISABLED ) {
// Extension disabled : Force L1SYNC_DISABLED disable state
L1E_DSPOR(ppi)->basic.next_state=L1SYNC_DISABLED; /* Force L1Sync DISABLE state */
l1e_run_state_machine(ppi,NULL,0);
}
return 0; return 0;
} }
......
...@@ -59,7 +59,8 @@ int l1e_run_state_machine(struct pp_instance *ppi, void *buf, int len) { ...@@ -59,7 +59,8 @@ int l1e_run_state_machine(struct pp_instance *ppi, void *buf, int len) {
int *execute_state_machine=&L1E_DSPOR(ppi)->execute_state_machine; int *execute_state_machine=&L1E_DSPOR(ppi)->execute_state_machine;
int delay; int delay;
if ( ppi->extState!=PP_EXSTATE_ACTIVE || ppi->state==PPS_INITIALIZING) if ( basicDS->next_state!=L1SYNC_DISABLED &&
(ppi->extState!=PP_EXSTATE_ACTIVE || ppi->state==PPS_INITIALIZING))
return INT_MAX; /* Return a big delay. fsm will then not use it */ return INT_MAX; /* Return a big delay. fsm will then not use it */
if ( nextState>=MAX_STATE_ACTIONS) if ( nextState>=MAX_STATE_ACTIONS)
...@@ -232,6 +233,7 @@ static void l1e_send_sync_msg(struct pp_instance *ppi, Boolean immediatSend) { ...@@ -232,6 +233,7 @@ static void l1e_send_sync_msg(struct pp_instance *ppi, Boolean immediatSend) {
/* DISABLED state */ /* DISABLED state */
static int l1e_handle_state_disabled(struct pp_instance *ppi, Boolean new_state){ static int l1e_handle_state_disabled(struct pp_instance *ppi, Boolean new_state){
l1e_ext_portDS_t * l1e_portDS=L1E_DSPOR(ppi); l1e_ext_portDS_t * l1e_portDS=L1E_DSPOR(ppi);
/* State initialization */ /* State initialization */
if ( new_state ) { if ( new_state ) {
/* Table 157 - page 449 /* Table 157 - page 449
...@@ -335,9 +337,7 @@ static int l1e_handle_state_config_match(struct pp_instance *ppi, Boolean new_st ...@@ -335,9 +337,7 @@ static int l1e_handle_state_config_match(struct pp_instance *ppi, Boolean new_st
} }
break; break;
case PPS_MASTER : case PPS_MASTER :
if ( basic->congruentIsRequired ) { // Nothing to do for the master state
WRH_OPER()->locking_disable(ppi);
}
break; break;
default: default:
break; break;
...@@ -391,8 +391,10 @@ static int l1e_handle_state_up(struct pp_instance *ppi, Boolean new_state){ ...@@ -391,8 +391,10 @@ static int l1e_handle_state_up(struct pp_instance *ppi, Boolean new_state){
} }
if (next_state!=0 ) { if (next_state!=0 ) {
l1e_portDS->basic.next_state=next_state; l1e_portDS->basic.next_state=next_state;
WRH_OPER()->locking_disable(ppi); /* Unlock the PLL */ if ( ppi->state == PPS_SLAVE || ppi->state==PPS_UNCALIBRATED) {
l1e_servo_reset(ppi); WRH_OPER()->locking_disable(ppi); /* Unlock the PLL */
l1e_servo_reset(ppi);
}
return 0; /* Treat the next state asap */ return 0; /* Treat the next state asap */
} }
......
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