*
* Copyright 2003, 2004, 2005, 2006, 2007 Develer S.r.l. (http://www.develer.com/)
* Copyright 2000, 2001, 2002 Bernie Innocenti <bernie@codewiz.org>
- *
* -->
*
* \brief General pourpose debug support for embedded systems (implementation).
*
- * \version $Id$
* \author Bernie Innocenti <bernie@codewiz.org>
* \author Stefano Fedrigo <aleph@develer.com>
*/
#include <cfg/debug.h>
#include <cfg/os.h>
-#include <cpu/irq.h>
#include <cpu/attr.h>
#include <cpu/types.h>
#if OS_HOSTED
- #include <stdio.h>
+ #include <unistd.h> // write()
+
#define KDBG_WAIT_READY() do { /*nop*/ } while(0)
- #define KDBG_WRITE_CHAR(c) do { char __c = (c); write(2, &__c, sizeof(__c)); } while(0)
+ #define KDBG_WRITE_CHAR(c) do { char __c = (c); write(STDERR_FILENO, &__c, sizeof(__c)); } while(0)
#define KDBG_MASK_IRQ(old) do { (void)(old); } while(0)
#define KDBG_RESTORE_IRQ(old) do { /*nop*/ } while(0)
typedef char kdbg_irqsave_t; /* unused */
{
const unsigned char *buf = (const unsigned char *)_buf;
+ kprintf("Dumping buffer at addr [%p], %zu bytes", buf, len);
+ size_t i=0;
while (len--)
- kprintf("%02X", *buf++);
+ {
+ if ((i++ % 16) == 0)
+ kputs("\n");
+ kprintf("%02X ", *buf++);
+ }
kputchar('\n');
}