From b06e68ef1f6df69cc86d72356c3a002054a35fad Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 17 Aug 1995 19:51:51 +0000 Subject: Numerous miscellaneous features incorporated from Tony Bennett (tbennett@divnc.com) including the following major additions: + variable length messages + named devices + debug monitor + association tables/variables --- c/src/lib/libmisc/monitor/mon-prmisc.c | 257 +++++++++++++++++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 c/src/lib/libmisc/monitor/mon-prmisc.c (limited to 'c/src/lib/libmisc/monitor/mon-prmisc.c') diff --git a/c/src/lib/libmisc/monitor/mon-prmisc.c b/c/src/lib/libmisc/monitor/mon-prmisc.c new file mode 100644 index 0000000000..0a9f9bdf2e --- /dev/null +++ b/c/src/lib/libmisc/monitor/mon-prmisc.c @@ -0,0 +1,257 @@ +/* + * @(#)prmisc.c 1.9 - 95/08/02 + * + * + * Print misc stuff for the monitor dump routines + * Each routine returns the number of characters it output. + * + * TODO: + * + * $Id$ + */ + +#include +#include "monitor.h" + +#include + +#include +#include + +void +rtems_monitor_separator(void) +{ + printf("------------------------------------------------------------------------------\n"); +} + +unsigned32 +rtems_monitor_pad( + unsigned32 destination_column, + unsigned32 current_column +) +{ + int pad_length; + + if (destination_column <= current_column) + pad_length = 1; + else + pad_length = destination_column - current_column; + + return printf("%*s", pad_length, ""); +} + +unsigned32 +rtems_monitor_dump_char(rtems_unsigned8 ch) +{ + if (isprint(ch)) + return printf("%c", ch); + else + return printf("%02x", ch); +} + +unsigned32 +rtems_monitor_dump_decimal(unsigned32 num) +{ + return printf("%4d", num); +} + +unsigned32 +rtems_monitor_dump_hex(unsigned32 num) +{ + return printf("0x%x", num); +} + +unsigned32 +rtems_monitor_dump_assoc_bitfield( + rtems_assoc_t *ap, + char *separator, + unsigned32 value + ) +{ + unsigned32 b; + unsigned32 length = 0; + char *name; + + for (b = 1; b; b <<= 1) + if (b & value) + { + if (length) + length += printf("%s", separator); + + name = rtems_assoc_name_by_local(ap, b); + + if (name) + length += printf("%s", name); + else + length += printf("0x%x", b); + } + + return length; +} + +unsigned32 +rtems_monitor_dump_id(rtems_id id) +{ + return printf("%08x", id); +} + +unsigned32 +rtems_monitor_dump_name(rtems_name name) +{ + int i; + unsigned32 length = 0; + union { + unsigned32 ui; + char c[4]; + } u; + + u.ui = (rtems_unsigned32) name; + + for (i=0; i