Commit 8a5a24f4 authored by Aurelio Colosimo's avatar Aurelio Colosimo

VERB_LOG_MSGS compile parameter

define VERB_LOG_MSGS if you want very verbose msg when log verbosity=2.
As default, they are not even compiled, in order to save space in the final
binary executable.
Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent 90411237
...@@ -53,6 +53,11 @@ else ifeq ($(WRMODE), slave) ...@@ -53,6 +53,11 @@ else ifeq ($(WRMODE), slave)
CFLAGS += -DPPSI_SLAVE CFLAGS += -DPPSI_SLAVE
endif endif
# VERB_LOG_MSGS: uncomment if you want very verbose msg when log verbosity=2.
# As default, they are not even compiled, in order to save space in the final
# binary executable
# VERB_LOG_MSGS=y
# Include arch code, the default is hosted GNU/Linux stuff # Include arch code, the default is hosted GNU/Linux stuff
# we need this -I so <arch/arch.h> can be found # we need this -I so <arch/arch.h> can be found
ARCH ?= gnu-linux ARCH ?= gnu-linux
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
/* Contains all functions common to more than one state */ /* Contains all functions common to more than one state */
/* The following macros are used both by msg.c and by wr-msg.c */ /* The following macros are used both by msg.c and by wr-msg.c */
#ifdef VERB_LOG_MSGS
#define MSG_SEND_AND_RET_VARLEN(x,y,z,w)\ #define MSG_SEND_AND_RET_VARLEN(x,y,z,w)\
if (pp_send_packet(ppi, ppi->buf_out, w,\ if (pp_send_packet(ppi, ppi->buf_out, w,\
&ppi->last_snt_time, PP_NP_##y , z) < w) {\ &ppi->last_snt_time, PP_NP_##y , z) < w) {\
...@@ -23,6 +24,15 @@ ...@@ -23,6 +24,15 @@
ppi->last_snt_time.nanoseconds,pp_msg_names[PPM_##x]);\ ppi->last_snt_time.nanoseconds,pp_msg_names[PPM_##x]);\
ppi->sent_seq_id[PPM_## x]++;\ ppi->sent_seq_id[PPM_## x]++;\
return 0; return 0;
#else
#define MSG_SEND_AND_RET_VARLEN(x,y,z,w)\
if (pp_send_packet(ppi, ppi->buf_out, w,\
&ppi->last_snt_time, PP_NP_##y , z) < w) {\
return -1;\
}\
ppi->sent_seq_id[PPM_## x]++;\
return 0;
#endif
#define MSG_SEND_AND_RET(x,y,z)\ #define MSG_SEND_AND_RET(x,y,z)\
MSG_SEND_AND_RET_VARLEN(x,y,z,PP_## x ##_LENGTH) MSG_SEND_AND_RET_VARLEN(x,y,z,PP_## x ##_LENGTH)
......
...@@ -10,27 +10,34 @@ ...@@ -10,27 +10,34 @@
static inline void Integer64_display(const char *label, Integer64 *bigint) static inline void Integer64_display(const char *label, Integer64 *bigint)
{ {
#ifdef VERB_LOG_MSGS
PP_VPRINTF("%s:\n", label); PP_VPRINTF("%s:\n", label);
PP_VPRINTF("LSB: %u\n", bigint->lsb); PP_VPRINTF("LSB: %u\n", bigint->lsb);
PP_VPRINTF("MSB: %d\n", bigint->msb); PP_VPRINTF("MSB: %d\n", bigint->msb);
#endif
} }
static inline void UInteger48_display(const char *label, UInteger48 *bigint) static inline void UInteger48_display(const char *label, UInteger48 *bigint)
{ {
#ifdef VERB_LOG_MSGS
PP_VPRINTF("%s:\n", label); PP_VPRINTF("%s:\n", label);
PP_VPRINTF("LSB: %u\n", bigint->lsb); PP_VPRINTF("LSB: %u\n", bigint->lsb);
PP_VPRINTF("MSB: %u\n", bigint->msb); PP_VPRINTF("MSB: %u\n", bigint->msb);
#endif
} }
static inline void timestamp_display(const char *label, Timestamp *timestamp) static inline void timestamp_display(const char *label, Timestamp *timestamp)
{ {
#ifdef VERB_LOG_MSGS
PP_VPRINTF("%s:\n", label); PP_VPRINTF("%s:\n", label);
UInteger48_display("seconds", &timestamp->secondsField); UInteger48_display("seconds", &timestamp->secondsField);
PP_VPRINTF("nanoseconds: %u\n", timestamp->nanosecondsField); PP_VPRINTF("nanoseconds: %u\n", timestamp->nanosecondsField);
#endif
} }
static inline void msg_display_header(MsgHeader *header) static inline void msg_display_header(MsgHeader *header)
{ {
#ifdef VERB_LOG_MSGS
PP_VPRINTF("Message header: \n"); PP_VPRINTF("Message header: \n");
PP_VPRINTF("\n"); PP_VPRINTF("\n");
PP_VPRINTF("transportSpecific: %d\n", header->transportSpecific); PP_VPRINTF("transportSpecific: %d\n", header->transportSpecific);
...@@ -46,10 +53,12 @@ static inline void msg_display_header(MsgHeader *header) ...@@ -46,10 +53,12 @@ static inline void msg_display_header(MsgHeader *header)
PP_VPRINTF("controlField: %d\n", header->controlField); PP_VPRINTF("controlField: %d\n", header->controlField);
PP_VPRINTF("logMessageInterval: %d\n", header->logMessageInterval); PP_VPRINTF("logMessageInterval: %d\n", header->logMessageInterval);
PP_VPRINTF("\n"); PP_VPRINTF("\n");
#endif
} }
static inline void msg_display_announce(MsgAnnounce *announce) static inline void msg_display_announce(MsgAnnounce *announce)
{ {
#ifdef VERB_LOG_MSGS
PP_VPRINTF("Message ANNOUNCE:\n"); PP_VPRINTF("Message ANNOUNCE:\n");
timestamp_display("Origin Timestamp", &announce->originTimestamp); timestamp_display("Origin Timestamp", &announce->originTimestamp);
PP_VPRINTF("currentUtcOffset: %d\n", announce->currentUtcOffset); PP_VPRINTF("currentUtcOffset: %d\n", announce->currentUtcOffset);
...@@ -65,6 +74,7 @@ static inline void msg_display_announce(MsgAnnounce *announce) ...@@ -65,6 +74,7 @@ static inline void msg_display_announce(MsgAnnounce *announce)
PP_VPRINTF("timeSource: %d\n", announce->timeSource); PP_VPRINTF("timeSource: %d\n", announce->timeSource);
PP_VPRINTF("\n"); PP_VPRINTF("\n");
/* FIXME diagnostic WR extension*/ /* FIXME diagnostic WR extension*/
#endif
} }
/* Unpack header from in buffer to msg_tmp_header field */ /* Unpack header from in buffer to msg_tmp_header field */
......
...@@ -8,27 +8,34 @@ ...@@ -8,27 +8,34 @@
static inline void Integer64_display(const char *label, Integer64 *bigint) static inline void Integer64_display(const char *label, Integer64 *bigint)
{ {
#ifdef VERB_LOG_MSGS
PP_VPRINTF("%s:\n", label); PP_VPRINTF("%s:\n", label);
PP_VPRINTF("LSB: %u\n", bigint->lsb); PP_VPRINTF("LSB: %u\n", bigint->lsb);
PP_VPRINTF("MSB: %d\n", bigint->msb); PP_VPRINTF("MSB: %d\n", bigint->msb);
#endif
} }
static inline void UInteger48_display(const char *label, UInteger48 *bigint) static inline void UInteger48_display(const char *label, UInteger48 *bigint)
{ {
#ifdef VERB_LOG_MSGS
PP_VPRINTF("%s:\n", label); PP_VPRINTF("%s:\n", label);
PP_VPRINTF("LSB: %u\n", bigint->lsb); PP_VPRINTF("LSB: %u\n", bigint->lsb);
PP_VPRINTF("MSB: %u\n", bigint->msb); PP_VPRINTF("MSB: %u\n", bigint->msb);
#endif
} }
static inline void timestamp_display(const char *label, Timestamp *timestamp) static inline void timestamp_display(const char *label, Timestamp *timestamp)
{ {
#ifdef VERB_LOG_MSGS
PP_VPRINTF("%s:\n", label); PP_VPRINTF("%s:\n", label);
UInteger48_display("seconds", &timestamp->secondsField); UInteger48_display("seconds", &timestamp->secondsField);
PP_VPRINTF("nanoseconds: %u\n", timestamp->nanosecondsField); PP_VPRINTF("nanoseconds: %u\n", timestamp->nanosecondsField);
#endif
} }
static inline void msg_display_header(MsgHeader *header) static inline void msg_display_header(MsgHeader *header)
{ {
#ifdef VERB_LOG_MSGS
PP_VPRINTF("Message header: \n"); PP_VPRINTF("Message header: \n");
PP_VPRINTF("\n"); PP_VPRINTF("\n");
PP_VPRINTF("transportSpecific: %d\n", header->transportSpecific); PP_VPRINTF("transportSpecific: %d\n", header->transportSpecific);
...@@ -44,10 +51,12 @@ static inline void msg_display_header(MsgHeader *header) ...@@ -44,10 +51,12 @@ static inline void msg_display_header(MsgHeader *header)
PP_VPRINTF("controlField: %d\n", header->controlField); PP_VPRINTF("controlField: %d\n", header->controlField);
PP_VPRINTF("logMessageInterval: %d\n", header->logMessageInterval); PP_VPRINTF("logMessageInterval: %d\n", header->logMessageInterval);
PP_VPRINTF("\n"); PP_VPRINTF("\n");
#endif
} }
static inline void msg_display_announce(MsgAnnounce *announce) static inline void msg_display_announce(MsgAnnounce *announce)
{ {
#ifdef VERB_LOG_MSGS
PP_VPRINTF("Message ANNOUNCE:\n"); PP_VPRINTF("Message ANNOUNCE:\n");
timestamp_display("Origin Timestamp", &announce->originTimestamp); timestamp_display("Origin Timestamp", &announce->originTimestamp);
PP_VPRINTF("currentUtcOffset: %d\n", announce->currentUtcOffset); PP_VPRINTF("currentUtcOffset: %d\n", announce->currentUtcOffset);
...@@ -62,6 +71,7 @@ static inline void msg_display_announce(MsgAnnounce *announce) ...@@ -62,6 +71,7 @@ static inline void msg_display_announce(MsgAnnounce *announce)
PP_VPRINTF("stepsRemoved: %d\n", announce->stepsRemoved); PP_VPRINTF("stepsRemoved: %d\n", announce->stepsRemoved);
PP_VPRINTF("timeSource: %d\n", announce->timeSource); PP_VPRINTF("timeSource: %d\n", announce->timeSource);
PP_VPRINTF("\n"); PP_VPRINTF("\n");
#endif
} }
/* Unpack header from in buffer to msg_tmp_header field */ /* Unpack header from in buffer to msg_tmp_header field */
......
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