Commit f93ee6a5 authored by Alessandro Rubini's avatar Alessandro Rubini

diag: split VERB_LOG_MSGS into several groups

This has currently no effect, but later I'll have an option to enable
verbose messages for individual contexts (message dumps, servo
operations, frame send/receive, time operations).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent cb527e14
......@@ -60,8 +60,28 @@ extern CONST_VERBOSITY int pp_diag_verbosity;
* constants instead, to avoid the hairyness of ifdef.
*/
#ifdef VERB_LOG_MSGS
#define pp_verbose_messages 1
#else
#define pp_verbose_messages 0
#define pp_verbose_dump 1
#define pp_verbose_servo 1
#define pp_verbose_frames 1
#define pp_verbose_time 1
#endif
/* FIXME: allow individual setting of the verbosity */
/* Provide 0 as default for all such values */
#ifndef pp_verbose_dump
#define pp_verbose_dump 0
#endif
#ifndef pp_verbose_servo
#define pp_verbose_servo 0
#endif
#ifndef pp_verbose_frames
#define pp_verbose_frames 0
#endif
#ifndef pp_verbose_time
#define pp_verbose_time 0
#endif
......@@ -42,12 +42,12 @@ int st_com_handle_pdelay_req(struct pp_instance *ppi, unsigned char *buf,
#define MSG_SEND_AND_RET_VARLEN(x, y, z, w) \
if (pp_net_ops.send(ppi, ppi->buf_out, w,\
&ppi->last_snt_time, PP_NP_##y , z) < w) { \
if (pp_verbose_messages) \
if (pp_verbose_frames) \
PP_PRINTF("%s(%d) Message can't be sent -> FAULTY\n", \
pp_msg_names[PPM_##x], PPM_##x); \
return -1; \
} \
if (pp_verbose_messages) \
if (pp_verbose_frames) \
PP_VPRINTF("SENT %02d %d.%d %s\n", w, \
ppi->last_snt_time.seconds, \
ppi->last_snt_time.nanoseconds, \
......
......@@ -9,7 +9,7 @@
static inline void Integer64_display(const char *label, Integer64 *bigint)
{
if (pp_verbose_messages) {
if (pp_verbose_dump) {
PP_VPRINTF("%s:\n", label);
PP_VPRINTF("LSB: %u\n", bigint->lsb);
PP_VPRINTF("MSB: %d\n", bigint->msb);
......@@ -18,7 +18,7 @@ static inline void Integer64_display(const char *label, Integer64 *bigint)
static inline void UInteger48_display(const char *label, UInteger48 *bigint)
{
if (pp_verbose_messages) {
if (pp_verbose_dump) {
PP_VPRINTF("%s:\n", label);
PP_VPRINTF("LSB: %u\n", bigint->lsb);
PP_VPRINTF("MSB: %u\n", bigint->msb);
......@@ -27,7 +27,7 @@ static inline void UInteger48_display(const char *label, UInteger48 *bigint)
static inline void timestamp_display(const char *label, Timestamp *timestamp)
{
if (pp_verbose_messages) {
if (pp_verbose_dump) {
PP_VPRINTF("%s:\n", label);
UInteger48_display("seconds", &timestamp->secondsField);
PP_VPRINTF("nanoseconds: %u\n", timestamp->nanosecondsField);
......@@ -36,7 +36,7 @@ static inline void timestamp_display(const char *label, Timestamp *timestamp)
static inline void msg_display_header(MsgHeader *header)
{
if (pp_verbose_messages) {
if (pp_verbose_dump) {
PP_VPRINTF("Message header:\n");
PP_VPRINTF("\n");
PP_VPRINTF("transportSpecific: %d\n",
......@@ -59,7 +59,7 @@ static inline void msg_display_header(MsgHeader *header)
static inline void msg_display_announce(MsgAnnounce *announce)
{
if (pp_verbose_messages) {
if (pp_verbose_dump) {
PP_VPRINTF("Message ANNOUNCE:\n");
timestamp_display("Origin Timestamp",
&announce->originTimestamp);
......
......@@ -32,14 +32,14 @@ void pp_update_delay(struct pp_instance *ppi, TimeInternal *correction_field)
&ppi->delay_req_send_time);
if (OPTS(ppi)->max_dly) { /* If max_delay is 0 then it's OFF */
if (s_to_m_dly.seconds && pp_verbose_messages)
if (s_to_m_dly.seconds && pp_verbose_servo)
PP_VPRINTF("pp_update_delay aborted, delay "
"greater than 1 second\n");
if (s_to_m_dly.seconds)
return;
if (s_to_m_dly.nanoseconds > OPTS(ppi)->max_dly
&& pp_verbose_messages)
&& pp_verbose_servo)
PP_VPRINTF("pp_update_delay aborted, delay %d greater "
"than administratively set maximum %d\n",
s_to_m_dly.nanoseconds,
......@@ -184,14 +184,14 @@ void pp_update_offset(struct pp_instance *ppi, TimeInternal *send_time,
sub_TimeInternal(&m_to_s_dly, recv_time, send_time);
if (OPTS(ppi)->max_dly) { /* If maxDelay is 0 then it's OFF */
if (m_to_s_dly.seconds && pp_verbose_messages)
if (m_to_s_dly.seconds && pp_verbose_servo)
PP_PRINTF("pp_update_offset aborted, delay greater "
"than 1 second\n");
if (m_to_s_dly.seconds)
return;
if (m_to_s_dly.nanoseconds > OPTS(ppi)->max_dly
&& pp_verbose_messages)
&& pp_verbose_servo)
PP_PRINTF("updateDelay aborted, delay %d greater than "
"administratively set maximum %d\n",
m_to_s_dly.nanoseconds,
......@@ -245,14 +245,14 @@ void pp_update_clock(struct pp_instance *ppi)
if (OPTS(ppi)->max_rst) { /* If max_rst is 0 then it's OFF */
if (DSCUR(ppi)->offsetFromMaster.seconds
&& pp_verbose_messages) {
&& pp_verbose_servo) {
PP_PRINTF("pp_update_clock aborted, offset greater "
"than 1 second\n");
goto display;
}
if (DSCUR(ppi)->offsetFromMaster.nanoseconds >
OPTS(ppi)->max_rst && pp_verbose_messages) {
OPTS(ppi)->max_rst && pp_verbose_servo) {
PP_VPRINTF("pp_update_clock aborted, offset %d greater than "
"administratively set maximum %d\n",
DSCUR(ppi)->offsetFromMaster.nanoseconds,
......@@ -317,7 +317,7 @@ void pp_update_clock(struct pp_instance *ppi)
}
display:
if (pp_verbose_messages) {
if (pp_verbose_servo) {
PP_VPRINTF("\n--Offset Correction--\n");
PP_VPRINTF("Raw offset from master: %10ds %11dns\n",
SRV(ppi)->m_to_s_dly.seconds,
......
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