/*
* $Log$
+ * Revision 1.11 2004/08/24 16:19:08 bernie
+ * kputchar(): New public function; Add missing dummy inlines for \!_DEBUG.
+ *
* Revision 1.10 2004/08/04 15:57:50 rasky
* Cambiata la putchar per kdebug per DSP56k: la nuova funzione e' quella piu' a basso livello (assembly)
*
#if defined(_EMUL)
#include <stdio.h>
- #define KDBG_WAIT_READY() do {/*nop*/} while(0)
+ #define KDBG_WAIT_READY() do { /*nop*/ } while(0)
#define KDBG_WRITE_CHAR(c) putchar((c))
- #define KDBG_MASK_IRQ(old) do {/*nop*/} while(0)
- #define KDBG_RESTORE_IRQ() do {/*nop*/} while(0)
+ #define KDBG_MASK_IRQ(old) do { (void)(old); } while(0)
+ #define KDBG_RESTORE_IRQ() do { /*nop*/ } while(0)
+ typedef kdbg_irqsave_t char; /* unused */
#elif CPU_I196
#include "Util196.h"
#define KDBG_WAIT_READY() do {} while (!(SP_STAT & (SPSF_TX_EMPTY | SPSF_TX_INT)))
INT_MASK1 &= ~INT1F_TI; \
} while(0)
#define KDBG_RESTORE_IRQ(old) do { INT_MASK1 |= (old); }
+ typedef kdbg_irqsave_t uint16_t; /* FIXME: unconfirmed */
#elif CPU_AVR
#include <avr/io.h>
#if CONFIG_KDEBUG_PORT == 0
UCR = (old); \
} while(0)
+ typedef kdbg_irqsave_t uint8_t;
+
#elif CONFIG_KDEBUG_PORT == 1
/* External 485 transceiver on UART1 (to be overridden in "hw.h"). */
UCSR1B = (old); \
} while(0)
+ typedef kdbg_irqsave_t uint8_t;
#else
#error CONFIG_KDEBUG_PORT should be either 0 or 1
#endif
/* Debugging go through the JTAG interface. The MSL library already
implements the console I/O correctly. */
#include <stdio.h>
- #define KDBG_WAIT_READY()
+ #define KDBG_WAIT_READY() do { } while (0)
#define KDBG_WRITE_CHAR(c) __put_char(c, stdout)
- #define KDBG_MASK_IRQ(old)
- #define KDBG_RESTORE_IRQ(old)
+ #define KDBG_MASK_IRQ(old) do { (void)(old); } while (0)
+ #define KDBG_RESTORE_IRQ(old) do { (void)(old); } while (0)
+ typedef kdbg_irqsave_t uint8_t; /* unused */
#else
#error Unknown architecture
#endif
/*!
* Output one character to the debug console
*/
-static void kputchar(char c, UNUSED(void *, unused))
+static void __kputchar(char c, UNUSED(void *, unused))
{
/* Poll while serial buffer is still busy */
KDBG_WAIT_READY();
}
+void kputchar(char c)
+{
+ /* Mask serial TX intr */
+ kdbg_irqsave_t irqsave;
+ KDBG_MASK_IRQ(irqsave);
+
+ __kputchar(c, 0);
+
+ /* Restore serial TX intr */
+ KDBG_RESTORE_IRQ(irqsave);
+}
+
+
void PGM_FUNC(kprintf)(const char * PGM_ATTR fmt, ...)
{
va_list ap;
/* Mask serial TX intr */
- unsigned char irqsave;
+ kdbg_irqsave_t irqsave;
KDBG_MASK_IRQ(irqsave);
va_start(ap, fmt);
- PGM_FUNC(_formatted_write)(fmt, kputchar, 0, ap);
+ PGM_FUNC(_formatted_write)(fmt, __kputchar, 0, ap);
va_end(ap);
/* Restore serial TX intr */
char c;
/* Mask serial TX intr */
- unsigned char irqsave;
+ kdbg_irqsave_t irqsave;
KDBG_MASK_IRQ(irqsave);
while ((c = PGM_READ_CHAR(str++)))
- kputchar(c, 0);
+ __kputchar(c, 0);
KDBG_RESTORE_IRQ(irqsave);
}
/*
* $Log$
+ * Revision 1.5 2004/08/24 16:19:08 bernie
+ * kputchar(): New public function; Add missing dummy inlines for \!_DEBUG.
+ *
* Revision 1.4 2004/07/30 14:26:33 rasky
* Semplificato l'output dell'ASSERT
* Aggiunta ASSERT2 con stringa di help opzionalmente disattivabile
#if defined(_DEBUG)
void kdbg_init(void);
+ void kputchar(char c);
void kdump(const void *buf, size_t len);
#ifdef __AVR__
void __init_wall(long *wall, int size);
int __check_wall(long *wall, int size, const char *name, const char *file, int line);
- #define THIS_FILE __FILE__
+ #define THIS_FILE __FILE__
#ifndef CONFIG_KDEBUG_ASSERT_NO_TEXT
#define ASSERT(x) ((x) ? 0 : __assert(#x, THIS_FILE, __LINE__))
#define ASSERT2(x, help) ((x) ? 0 : __assert(help " (" #x ")", THIS_FILE, __LINE__))
#else /* !_DEBUG */
- #define ASSERT(x)
- #define ASSERT2(x, help)
- #define ASSERT_VALID_PTR(p)
- #define ASSERT_VALID_PTR_OR_NULL(p)
- #define TRACE do {} while(0)
- #define TRACEMSG(x,...) do {} while(0)
- #define DB(x)
+ #define ASSERT(x) do {} while(0)
+ #define ASSERT2(x, help) do {} while(0)
+ #define ASSERT_VALID_PTR(p) do {} while(0)
+ #define ASSERT_VALID_PTR_OR_NULL(p) do {} while(0)
+ #define TRACE do {} while(0)
+ #define TRACEMSG(x,...) do {} while(0)
+ #define DB(x) /* nothing */
#define DECLARE_WALL(name, size)
#define INIT_WALL(name)
#define CHECK_WALL(name)
- INLINE void kdbg_init(void) {}
- INLINE void kprintf(UNUSED(const char*, fmt), ...) {}
+ INLINE void kdbg_init(void) { /*nop*/ }
+ INLINE void kputchar(UNUSED(char, c)) { /*nop*/ }
+ INLINE void kputs(UNUSED(const char*, str)) { /*nop*/ }
+ INLINE void kprintf(UNUSED(const char*, fmt), ...) { /*nop*/ }
#endif /* !_DEBUG */