/* * Print misc stuff for the monitor dump routines * Each routine returns the number of characters it output. * * TODO: * * $Id$ */ #include #include #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; const 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) { unsigned32 i; unsigned32 length = 0; union { unsigned32 ui; char c[4]; } u; u.ui = (rtems_unsigned32) name; #if (CPU_BIG_ENDIAN == TRUE) for (i=0; i