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

[BUG: 1360] monitor: show IP before lock

Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 6b3848b1
...@@ -70,12 +70,12 @@ static int wrc_mon_status(void) ...@@ -70,12 +70,12 @@ static int wrc_mon_status(void)
if ((!s->flags & WR_FLAG_VALID) || (ppi->state != PPS_SLAVE)) { if ((!s->flags & WR_FLAG_VALID) || (ppi->state != PPS_SLAVE)) {
cprintf(C_RED, cprintf(C_RED,
"\n\nSync info not valid\n\n"); "\n\nSync info not valid\n");
return 0; return 0;
} }
/* show_servo */ /* show_servo */
cprintf(C_BLUE, "\n\nSynchronization status:\n\n"); cprintf(C_BLUE, "\n\nSynchronization status:\n");
return 1; return 1;
} }
...@@ -105,8 +105,8 @@ int wrc_mon_gui(void) ...@@ -105,8 +105,8 @@ int wrc_mon_gui(void)
term_clear(); term_clear();
pcprintf(1, 1, C_BLUE, "WR PTP Core Sync Monitor v 1.0"); cprintf(C_BLUE, "WR PTP Core Sync Monitor v 1.0");
pcprintf(2, 1, C_GREY, "Esc = exit"); cprintf(C_GREY, "\nEsc = exit");
shw_pps_gen_get_time(&sec, &nsec); shw_pps_gen_get_time(&sec, &nsec);
...@@ -115,19 +115,44 @@ int wrc_mon_gui(void) ...@@ -115,19 +115,44 @@ int wrc_mon_gui(void)
/*show_ports */ /*show_ports */
wrpc_get_port_state(&state, NULL); wrpc_get_port_state(&state, NULL);
pcprintf(4, 1, C_BLUE, "\n\nLink status:"); cprintf(C_BLUE, "\n\nLink status:");
pcprintf(6, 1, C_WHITE, "%s: ", "wru1"); cprintf(C_WHITE, "\n%s: ", "wru1");
if (state.state) if (state.state)
cprintf(C_GREEN, "Link up "); cprintf(C_GREEN, "Link up ");
else else
cprintf(C_RED, "Link down "); cprintf(C_RED, "Link down ");
if (state.state) {
minic_get_stats(&tx, &rx); minic_get_stats(&tx, &rx);
cprintf(C_GREY, "(RX: %d, TX: %d), mode: ", rx, tx); cprintf(C_GREY, "(RX: %d, TX: %d)", rx, tx);
if (!state.state) {
return 1;
}
if (HAS_IP) {
uint8_t ip[4];
cprintf(C_WHITE, " IPv4: ");
getIP(ip);
format_ip(buf, ip);
switch (ip_status) {
case IP_TRAINING:
cprintf(C_RED, "BOOTP running");
break;
case IP_OK_BOOTP:
cprintf(C_GREEN, "%s (from bootp)", buf);
break;
case IP_OK_STATIC:
cprintf(C_GREEN, "%s (static assignment)", buf);
break;
}
}
cprintf(C_GREY, "\nMode: ");
if (!WR_DSPOR(ppi)->wrModeOn) { if (!WR_DSPOR(ppi)->wrModeOn) {
cprintf(C_RED, "WR Off");
wrc_mon_std_servo(); wrc_mon_std_servo();
return 1; return 1;
} }
...@@ -149,28 +174,10 @@ int wrc_mon_gui(void) ...@@ -149,28 +174,10 @@ int wrc_mon_gui(void)
else else
cprintf(C_RED, "NoLock "); cprintf(C_RED, "NoLock ");
if (state.calib.rx_calibrated && state.calib.tx_calibrated) if (state.calib.rx_calibrated && state.calib.tx_calibrated)
cprintf(C_GREEN, "Calibrated "); cprintf(C_GREEN, "Calibrated");
else else
cprintf(C_RED, "Uncalibrated "); cprintf(C_RED, "Uncalibrated");
if (HAS_IP) {
uint8_t ip[4];
cprintf(C_WHITE, "\nIPv4: ");
getIP(ip);
format_ip(buf, ip);
switch (ip_status) {
case IP_TRAINING:
cprintf(C_RED, "BOOTP running");
break;
case IP_OK_BOOTP:
cprintf(C_GREEN, "%s (from bootp)", buf);
break;
case IP_OK_STATIC:
cprintf(C_GREEN, "%s (static assignment)", buf);
break;
}
}
if (wrc_mon_status() == 0) if (wrc_mon_status() == 0)
return 1; return 1;
...@@ -196,7 +203,7 @@ int wrc_mon_gui(void) ...@@ -196,7 +203,7 @@ int wrc_mon_gui(void)
cprintf(C_GREEN, ", locked"); cprintf(C_GREEN, ", locked");
pp_printf("\n"); pp_printf("\n");
cprintf(C_BLUE, "\nTiming parameters:\n\n"); cprintf(C_BLUE, "\nTiming parameters:\n");
cprintf(C_GREY, "Round-trip time (mu): "); cprintf(C_GREY, "Round-trip time (mu): ");
cprintf(C_WHITE, "%s ps\n", print64(s->picos_mu)); cprintf(C_WHITE, "%s ps\n", print64(s->picos_mu));
...@@ -214,8 +221,7 @@ int wrc_mon_gui(void) ...@@ -214,8 +221,7 @@ int wrc_mon_gui(void)
(int32_t) s->delta_rx_s); (int32_t) s->delta_rx_s);
total_asymmetry = s->picos_mu - 2LL * s->delta_ms; total_asymmetry = s->picos_mu - 2LL * s->delta_ms;
cprintf(C_GREY, "Total link asymmetry: "); cprintf(C_GREY, "Total link asymmetry: ");
cprintf(C_WHITE, "%9d ps\n", cprintf(C_WHITE, "%9d ps\n", (int32_t) (total_asymmetry));
(int32_t) (total_asymmetry));
crtt = s->picos_mu - s->delta_tx_m - s->delta_rx_m crtt = s->picos_mu - s->delta_tx_m - s->delta_rx_m
- s->delta_tx_s - s->delta_rx_s; - s->delta_tx_s - s->delta_rx_s;
...@@ -223,25 +229,16 @@ int wrc_mon_gui(void) ...@@ -223,25 +229,16 @@ int wrc_mon_gui(void)
cprintf(C_WHITE, "%s ps\n", print64(crtt)); cprintf(C_WHITE, "%s ps\n", print64(crtt));
cprintf(C_GREY, "Clock offset: "); cprintf(C_GREY, "Clock offset: ");
cprintf(C_WHITE, "%9d ps\n", cprintf(C_WHITE, "%9d ps\n", (int32_t) (s->offset));
(int32_t) (s->offset));
cprintf(C_GREY, "Phase setpoint: "); cprintf(C_GREY, "Phase setpoint: ");
cprintf(C_WHITE, "%9d ps\n", cprintf(C_WHITE, "%9d ps\n", (s->cur_setpoint));
(s->cur_setpoint));
cprintf(C_GREY, "Skew: "); cprintf(C_GREY, "Skew: ");
cprintf(C_WHITE, "%9d ps\n", cprintf(C_WHITE, "%9d ps\n", (int32_t) (s->skew));
(int32_t) (s->skew));
cprintf(C_GREY, "Update counter: "); cprintf(C_GREY, "Update counter: ");
cprintf(C_WHITE, "%9d\n", cprintf(C_WHITE, "%9d\n", (int32_t) (s->update_count));
(int32_t) (s->update_count));
}
pp_printf("--");
return 1; return 1;
} }
...@@ -264,12 +261,10 @@ static inline void cprintf_time(int color, struct pp_time *time) ...@@ -264,12 +261,10 @@ static inline void cprintf_time(int color, struct pp_time *time)
static void wrc_mon_std_servo(void) static void wrc_mon_std_servo(void)
{ {
cprintf(C_RED, "WR Off");
if (wrc_mon_status() == 0) if (wrc_mon_status() == 0)
return; return;
cprintf(C_GREY, "Clock offset: "); cprintf(C_GREY, "\nClock offset: ");
if (DSCUR(ppi)->offsetFromMaster.secs) if (DSCUR(ppi)->offsetFromMaster.secs)
cprintf_time(C_WHITE, &DSCUR(ppi)->offsetFromMaster); cprintf_time(C_WHITE, &DSCUR(ppi)->offsetFromMaster);
......
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