X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fkdebug.c;h=9c210343bc149f03235032d68ff3dc90d7a80aa7;hb=7beb5f7878aa2773badde63fd3dd81d3396e5723;hp=63a93f503e30dc9221eff94bb29ac32240e1f589;hpb=11da44352fcd4d33b173c976db45293ac1a87cca;p=bertos.git diff --git a/bertos/drv/kdebug.c b/bertos/drv/kdebug.c index 63a93f50..9c210343 100644 --- a/bertos/drv/kdebug.c +++ b/bertos/drv/kdebug.c @@ -27,28 +27,25 @@ * the GNU General Public License. * * Copyright 2003, 2004, 2005, 2006, 2007 Develer S.r.l. (http://www.develer.com/) - * Copyright 2000, 2001, 2002 Bernardo Innocenti - * + * Copyright 2000, 2001, 2002 Bernie Innocenti * --> * * \brief General pourpose debug support for embedded systems (implementation). * - * \version $Id$ - * \author Bernardo Innocenti + * \author Bernie Innocenti * \author Stefano Fedrigo */ -#include - +#include "cfg/cfg_debug.h" #include /* for BV() */ #include +#include -#include #include #include #include /* for _formatted_write() */ -#include +#include #ifdef _DEBUG @@ -58,9 +55,10 @@ #if OS_HOSTED - #include + #include // write() + #define KDBG_WAIT_READY() do { /*nop*/ } while(0) - #define KDBG_WRITE_CHAR(c) putc((c), stderr) + #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 */ @@ -190,7 +188,7 @@ static void klocation(const char * PGM_ATTR file, int line) PGM_FUNC(kputs)(PGM_STR(": ")); } -int PGM_FUNC(__assert)(const char * PGM_ATTR cond, const char * PGM_ATTR file, int line) +int PGM_FUNC(__bassert)(const char * PGM_ATTR cond, const char * PGM_ATTR file, int line) { klocation(file, line); PGM_FUNC(kputs)(PGM_STR("Assertion failed: ")); @@ -276,8 +274,14 @@ void kdump(const void *_buf, size_t len) { const unsigned char *buf = (const unsigned char *)_buf; + kprintf("Dumping buffer at addr [%p], %z bytes", buf, len); + size_t i=0; while (len--) - kprintf("%02X", *buf++); + { + if ((i % 16) == 0) + kputs("\n"); + kprintf("%02X ", *buf++); + } kputchar('\n'); }