Commit f42b267c authored by Tristan Gingold's avatar Tristan Gingold

l1e-state-machine.c: minor rewrite

parent 1dda5f2d
...@@ -208,30 +208,32 @@ static __inline__ int measure_last_time(struct pp_instance *ppi, int fmeas) { ...@@ -208,30 +208,32 @@ static __inline__ int measure_last_time(struct pp_instance *ppi, int fmeas) {
return ms; return ms;
} }
static void l1e_send_sync_msg(struct pp_instance *ppi, Boolean immediatSend) { static void l1e_send_sync_msg(struct pp_instance *ppi, Boolean immediatSend)
{
if (immediatSend || pp_timeout(ppi, PP_TO_L1E_TX_SYNC) ) { int len;
int len; int fmeas, lmeas;
int fmeas, lmeas; int diff;
int diff; int tmo_ms;
int tmo_ms;
if (!immediatSend && !pp_timeout(ppi, PP_TO_L1E_TX_SYNC))
fmeas=measure_first_time(ppi); return;
pp_diag(ppi, ext, 1, "Sending L1SYNC_TLV signaling msg\n");
len = l1e_pack_signal(ppi); fmeas=measure_first_time(ppi);
__send_and_log(ppi, len, PP_NP_GEN,PPM_SIGNALING_NO_FWD_FMT); pp_diag(ppi, ext, 1, "Sending L1SYNC_TLV signaling msg\n");
lmeas=measure_last_time(ppi,fmeas); len = l1e_pack_signal(ppi);
diff=lmeas-fmeas; __send_and_log(ppi, len, PP_NP_GEN,PPM_SIGNALING_NO_FWD_FMT);
/* Calculate when the next message should be sent */ lmeas=measure_last_time(ppi,fmeas);
/* A "diff" value is subtracted from the timer to take into account
* the execution time of this function. With small time-out like 64ms, /* Calculate when the next message should be sent */
* the error become not negligible. /* A "diff" value is subtracted from the timer to take into account
*/ * the execution time of this function. With small time-out like 64ms,
tmo_ms=pp_timeout_log_to_ms(L1E_DSPOR_BS(ppi)->logL1SyncInterval); * the error become not negligible.
if ( tmo_ms >= diff ) /* to be sure to have a positive value */ */
tmo_ms-=diff; tmo_ms=pp_timeout_log_to_ms(L1E_DSPOR_BS(ppi)->logL1SyncInterval);
pp_timeout_set(ppi, PP_TO_L1E_TX_SYNC,tmo_ms); /* loop ever since */ diff=lmeas-fmeas;
} if ( tmo_ms >= diff ) /* to be sure to have a positive value */
tmo_ms-=diff;
pp_timeout_set(ppi, PP_TO_L1E_TX_SYNC,tmo_ms); /* loop ever since */
} }
/* DISABLED state */ /* DISABLED state */
......
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