Commit b6276fef authored by Adam Wujek's avatar Adam Wujek 💬 Committed by Grzegorz Daniluk

[BUG: 1530] dev/rxts_calibrator: add timeout for rxts_calibration_update

Additionally check whether link is down
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 2aa39121
......@@ -55,6 +55,10 @@
#define TD_GOT_TRANSITION 1
#define TD_DONE 2
/* Timeout for rxts_calibration_update */
#define CALIB_TIMEOUT_MS 5000
/* state of transition detector */
struct trans_detect_state {
int prev_val;
......@@ -228,10 +232,16 @@ static int calib_t24p_slave(uint32_t *value)
{
int rv;
uint32_t prev;
int timeout = 0;
rxts_calibration_start();
while (!(rv = rxts_calibration_update(value)))
/* FIXME: timeout */;
while (!(rv = rxts_calibration_update(value))) {
if (timeout > CALIB_TIMEOUT_MS || ep_link_up(NULL) == LINK_DOWN)
return -1;
timer_delay_ms(1);
timeout++;
}
if (rv < 0) {
/* Fall back on master == eeprom-or-error */
return calib_t24p_master(value);
......
ppsi @ c3492902
Subproject commit 50c32dc4bff33d353b611810da1ce582e04a9fef
Subproject commit c3492902f225a1fd22d896cccb85f213e3351e51
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