projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SEC: add MD5 implementation.
[bertos.git]
/
bertos
/
drv
/
kdebug.c
diff --git
a/bertos/drv/kdebug.c
b/bertos/drv/kdebug.c
index 219aadffd43792717c73b97965d14abc8f532a18..2125e2a14a2d66ab1880d35775b7f5ccaf037304 100644
(file)
--- 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/)
* 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 <bernie@codewiz.org>
- *
+ * Copyright 2000, 2001, 2002 Bernie Innocenti <bernie@codewiz.org>
* -->
*
* \brief General pourpose debug support for embedded systems (implementation).
*
* -->
*
* \brief General pourpose debug support for embedded systems (implementation).
*
- * \version $Id$
- * \author Bernardo Innocenti <bernie@develer.com>
+ * \author Bernie Innocenti <bernie@codewiz.org>
* \author Stefano Fedrigo <aleph@develer.com>
*/
* \author Stefano Fedrigo <aleph@develer.com>
*/
-#include
<cfg/cfg_debug.h>
+#include
"cfg/cfg_debug.h"
#include <cfg/macros.h> /* for BV() */
#include <cfg/debug.h>
#include <cfg/os.h>
#include <cfg/macros.h> /* for BV() */
#include <cfg/debug.h>
#include <cfg/os.h>
-#include <cpu/irq.h>
#include <cpu/attr.h>
#include <cpu/types.h>
#include <mware/formatwr.h> /* for _formatted_write() */
#include <cpu/attr.h>
#include <cpu/types.h>
#include <mware/formatwr.h> /* for _formatted_write() */
-#include <
mware
/pgm.h>
+#include <
cpu
/pgm.h>
#ifdef _DEBUG
#ifdef _DEBUG
@@
-58,9
+55,10
@@
#if OS_HOSTED
#if OS_HOSTED
- #include <stdio.h>
+ #include <unistd.h> // write()
+
#define KDBG_WAIT_READY() do { /*nop*/ } while(0)
#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 */
#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(": "));
}
PGM_FUNC(kputs)(PGM_STR(": "));
}
-int PGM_FUNC(__assert)(const char * PGM_ATTR cond, const char * PGM_ATTR file, int line)
+int PGM_FUNC(__
b
assert)(const char * PGM_ATTR cond, const char * PGM_ATTR file, int line)
{
klocation(file, line);
PGM_FUNC(kputs)(PGM_STR("Assertion failed: "));
{
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;
{
const unsigned char *buf = (const unsigned char *)_buf;
+ kprintf("Dumping buffer at addr [%p], %zu bytes", buf, len);
+ size_t i=0;
while (len--)
while (len--)
- kprintf("%02X", *buf++);
+ {
+ if ((i++ % 16) == 0)
+ kputs("\n");
+ kprintf("%02X ", *buf++);
+ }
kputchar('\n');
}
kputchar('\n');
}