/*!
* \file
* <!--
- * Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2003, 2004, 2005 Develer S.r.l. (http://www.develer.com/)
* Copyright 2000, 2001, 2002 Bernardo Innocenti <bernie@codewiz.org>
- * This file is part of DevLib - See devlib/README for information.
+ * This file is part of DevLib - See README.devlib for information.
* -->
*
* \brief General pourpose debug support for embedded systems (implementation).
/*#*
*#* $Log$
+ *#* Revision 1.21 2005/02/16 20:29:48 bernie
+ *#* TRACE(), TRACEMSG(): Reduce code and data footprint.
+ *#*
+ *#* Revision 1.20 2005/01/25 08:36:40 bernie
+ *#* kputnum(): Export.
+ *#*
+ *#* Revision 1.19 2004/12/31 17:47:45 bernie
+ *#* Rename UNUSED() to UNUSED_ARG().
+ *#*
*#* Revision 1.18 2004/12/08 08:52:00 bernie
*#* Save some more RAM on AVR.
*#*
#include <debug.h>
#include <cpu.h>
-#include "hw.h"
-#include "config.h"
+#include <macros.h> /* for BV() */
+#include <config.h>
+#include <hw.h>
#include <mware/formatwr.h> /* for _formatted_write() */
/*!
* Output one character to the debug console
*/
-static void __kputchar(char c, UNUSED(void *, unused))
+static void __kputchar(char c, UNUSED_ARG(void *, unused))
{
/* Poll while serial buffer is still busy */
KDBG_WAIT_READY();
}
-void PGM_FUNC(kprintf)(const char * PGM_ATTR fmt, ...)
+void PGM_FUNC(kvprintf)(const char * PGM_ATTR fmt, va_list ap)
{
-
#if CONFIG_PRINTF
- va_list ap;
-
/* Mask serial TX intr */
kdbg_irqsave_t irqsave;
KDBG_MASK_IRQ(irqsave);
- va_start(ap, fmt);
PGM_FUNC(_formatted_write)(fmt, __kputchar, 0, ap);
- va_end(ap);
/* Restore serial TX intr */
KDBG_RESTORE_IRQ(irqsave);
#endif /* CONFIG_PRINTF */
}
+void PGM_FUNC(kprintf)(const char * PGM_ATTR fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ PGM_FUNC(kvprintf)(fmt, ap);
+ va_end(ap);
+}
void PGM_FUNC(kputs)(const char * PGM_ATTR str)
{
/*!
* Cheap function to print small integers without using printf().
*/
-static int kputnum(int num)
+int kputnum(int num)
{
int output_len = 0;
int divisor = 10000;
return 1;
}
+void PGM_FUNC(__trace)(const char * PGM_ATTR name)
+{
+ PGM_FUNC(kputs)(name);
+ PGM_FUNC(kputs)(PSTR("()\n"));
+}
+
+void PGM_FUNC(__tracemsg)(const char * PGM_ATTR name, const char * PGM_ATTR fmt, ...)
+{
+ va_list ap;
+
+ PGM_FUNC(kputs)(name);
+ PGM_FUNC(kputs)(PSTR("(): "));
+ va_start(ap, fmt);
+ PGM_FUNC(kvprintf)(fmt, ap);
+ va_end(ap);
+}
int PGM_FUNC(__invalid_ptr)(void *value, const char * PGM_ATTR name, const char * PGM_ATTR file, int line)
{