comparison packages/infra/current/src/diag.cxx @ 76:435cced73e2f ecos-v1_3_1-release

eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
author jlarmour
date Tue, 28 Mar 2000 14:10:45 +0000
parents bf00f99aec69
children 59d97b6ba612
comparison
equal deleted inserted replaced
75:41bf073c0c32 76:435cced73e2f
441 diag_vprintf( fmt, args); 441 diag_vprintf( fmt, args);
442 } 442 }
443 443
444 #endif 444 #endif
445 445
446 static void
447 diag_dump_buf_with_offset(cyg_uint8 *p,
448 CYG_ADDRWORD s,
449 cyg_uint8 *base)
450 {
451 int i, c;
452 if ((CYG_ADDRWORD)s > (CYG_ADDRWORD)p) {
453 s = (CYG_ADDRWORD)s - (CYG_ADDRWORD)p;
454 }
455 while ((int)s > 0) {
456 if (base) {
457 diag_printf("%08X: ", (CYG_ADDRWORD)p - (CYG_ADDRWORD)base);
458 } else {
459 diag_printf("%08X: ", p);
460 }
461 for (i = 0; i < 16; i++) {
462 if (i < (int)s) {
463 diag_printf("%02X", p[i] & 0xFF);
464 } else {
465 diag_printf(" ");
466 }
467 if ((i % 2) == 1) diag_printf(" ");
468 if ((i % 8) == 7) diag_printf(" ");
469 }
470 diag_printf(" |");
471 for (i = 0; i < 16; i++) {
472 if (i < (int)s) {
473 c = p[i] & 0xFF;
474 if ((c < 0x20) || (c >= 0x7F)) c = '.';
475 } else {
476 c = ' ';
477 }
478 diag_printf("%c", c);
479 }
480 diag_printf("|\n");
481 s -= 16;
482 p += 16;
483 }
484 }
485
486 externC void
487 diag_dump_buf(void *p, CYG_ADDRWORD s)
488 {
489 diag_dump_buf_with_offset((cyg_uint8 *)p, s, 0);
490 }
491
446 /*-----------------------------------------------------------------------*/ 492 /*-----------------------------------------------------------------------*/
447 /* EOF trace/diag.c */ 493 /* EOF infra/diag.c */