This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Infra - diag_vdump_buf_with_offset


New function for more general diagnostic dumps.

Index: infra/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/infra/current/ChangeLog,v
retrieving revision 1.29
diff -u -5 -p -r1.29 ChangeLog
--- infra/current/ChangeLog	29 May 2002 18:28:20 -0000	1.29
+++ infra/current/ChangeLog	18 Jul 2002 20:07:26 -0000
@@ -1,5 +1,10 @@
+2002-07-18  Gary Thomas  <gary@chez-thomas.org>
+
+	* include/diag.h: 
+	* src/diag.cxx (diag_vdump_buf_with_offset): New function.
+
 2002-05-22  Jesper Skov  <jskov@redhat.com>
 
 	* cdl/infra.cdl: Added two options to control CFLAGS.
 
 2002-05-17  Martin Buck <martin.buck@ascom.ch>
Index: infra/current/include/diag.h
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/infra/current/include/diag.h,v
retrieving revision 1.9
diff -u -5 -p -r1.9 diag.h
--- infra/current/include/diag.h	23 May 2002 23:05:50 -0000	1.9
+++ infra/current/include/diag.h	18 Jul 2002 20:07:44 -0000
@@ -10,10 +10,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -72,10 +73,15 @@ externC void diag_write_dec( cyg_int32 n
 externC void diag_write_hex( cyg_uint32 n);   /* Write hexadecimal value   */
 
 externC void diag_dump_buf(void *buf, CYG_ADDRWORD len);
 externC void diag_dump_buf_32bit(void *buf, CYG_ADDRWORD len);
 externC void diag_dump_buf_16bit(void *buf, CYG_ADDRWORD len);
+typedef int __printf_fun(const char *fmt, ...);
+externC void diag_vdump_buf_with_offset(__printf_fun *pf,
+                                        cyg_uint8     *p, 
+                                        CYG_ADDRWORD   s, 
+                                        cyg_uint8     *base);
 externC void diag_dump_buf_with_offset(cyg_uint8     *p, 
                                        CYG_ADDRWORD   s, 
                                        cyg_uint8     *base);
 
 externC void diag_dump_buf_with_offset_32bit(cyg_uint32 *p, 
Index: infra/current/src/diag.cxx
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/infra/current/src/diag.cxx,v
retrieving revision 1.12
diff -u -5 -p -r1.12 diag.cxx
--- infra/current/src/diag.cxx	23 May 2002 23:05:51 -0000	1.12
+++ infra/current/src/diag.cxx	18 Jul 2002 20:07:53 -0000
@@ -7,10 +7,11 @@
 //========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -578,49 +579,58 @@ diag_vprintf(const char *fmt, va_list ap
     ret = _vprintf(_putc, (void **)0, fmt, ap);
     return (ret);
 }
 
 void
-diag_dump_buf_with_offset(cyg_uint8     *p, 
-                          CYG_ADDRWORD   s, 
-                          cyg_uint8     *base)
+diag_vdump_buf_with_offset(__printf_fun *pf,
+                           cyg_uint8     *p, 
+                           CYG_ADDRWORD   s, 
+                           cyg_uint8     *base)
 {
     int i, c;
     if ((CYG_ADDRWORD)s > (CYG_ADDRWORD)p) {
         s = (CYG_ADDRWORD)s - (CYG_ADDRWORD)p;
     }
     while ((int)s > 0) {
         if (base) {
-            diag_printf("%08X: ", (CYG_ADDRWORD)p - (CYG_ADDRWORD)base);
+            (*pf)("%08X: ", (CYG_ADDRWORD)p - (CYG_ADDRWORD)base);
         } else {
-            diag_printf("%08X: ", p);
+            (*pf)("%08X: ", p);
         }
         for (i = 0;  i < 16;  i++) {
             if (i < (int)s) {
-                diag_printf("%02X ", p[i] & 0xFF);
+                (*pf)("%02X ", p[i] & 0xFF);
             } else {
-                diag_printf("   ");
+                (*pf)("   ");
             }
-	    if (i == 7) diag_printf(" ");
+	    if (i == 7) (*pf)(" ");
         }
-        diag_printf(" |");
+        (*pf)(" |");
         for (i = 0;  i < 16;  i++) {
             if (i < (int)s) {
                 c = p[i] & 0xFF;
                 if ((c < 0x20) || (c >= 0x7F)) c = '.';
             } else {
                 c = ' ';
             }
-            diag_printf("%c", c);
+            (*pf)("%c", c);
         }
-        diag_printf("|\n");
+        (*pf)("|\n");
         s -= 16;
         p += 16;
     }
 }
 
-externC void
+void
+diag_dump_buf_with_offset(cyg_uint8     *p, 
+                          CYG_ADDRWORD   s, 
+                          cyg_uint8     *base)
+{
+    diag_vdump_buf_with_offset(diag_printf, p, s, base);
+}
+
+void
 diag_dump_buf(void *p, CYG_ADDRWORD s)
 {
    diag_dump_buf_with_offset((cyg_uint8 *)p, s, 0);
 }
 




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]