Commit 18d76f2f authored by Jean-Claude BAU's avatar Jean-Claude BAU

Slave/Uncalib states: GM detection by BMCA

- When a new GM has been detected by the BMCA, the SLAVE state must
transition to UNCALIBRATED. If the state is already set to UNCALIBRATED
, nothing must be done.
parent 4daf4aec
......@@ -245,7 +245,6 @@ int pp_slave(struct pp_instance *ppi, void *buf, int len)
int ret = PP_SEND_OK; /* error var, to check errors in msg handling */
Boolean uncalibrated = (ppi->state == PPS_UNCALIBRATED);
MsgHeader *hdr = &ppi->received_ptp_header;
int newState=ppi->is_new_state;
/* upgrade from uncalibrated to slave or back*/
if (uncalibrated) {
......@@ -256,7 +255,7 @@ int pp_slave(struct pp_instance *ppi, void *buf, int len)
} else {
ppi->next_state = PPS_SLAVE;
}
}
} else {
/* Check if the foreign master has changed */
if ( DSPAR(ppi)->newGrandmaster ) {
......@@ -264,16 +263,14 @@ int pp_slave(struct pp_instance *ppi, void *buf, int len)
DSPAR(ppi)->newGrandmaster=FALSE; // Clear it
if ( !uncalibrated )
// State must transition from SLAVE to UNCALIBRATED
ppi->next_state =PPS_UNCALIBRATED;
else
newState=1;// If already in uncalibrated state, force to see it as a new state
ppi->next_state = PPS_UNCALIBRATED;
Octet *id=DSPAR(ppi)->parentPortIdentity.clockIdentity.id;
pp_info("New grandmaster detected: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
id[0],id[1],id[2],id[3],id[4],id[5],id[6],id[7]);
}
}
/* Force to stay on desired state if externalPortConfiguration option is enabled */
if (is_externalPortConfigurationEnabled(DSDEF(ppi)) &&
......@@ -282,7 +279,7 @@ int pp_slave(struct pp_instance *ppi, void *buf, int len)
ppi->next_state = PPS_UNCALIBRATED; //Force to stay in uncalibrated state
/* when entering uncalibrated init servo */
if (uncalibrated && newState) {
if (uncalibrated && ppi->is_new_state) {
memset(&ppi->t1, 0, sizeof(ppi->t1));
pp_diag(ppi, bmc, 2, "Entered to uncalibrated, reset servo\n");
pp_servo_init(ppi);
......
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