/** * \file * * * \brief General pourpose debug support for embedded systems (implementation). * * \author Bernie Innocenti * \author Stefano Fedrigo */ #error Revise me! #include #include /* for BV() */ #include #include /* for CPU_FREQ */ #include /* Required for bus macros overrides */ #include "Util196.h" #define KDBG_WAIT_READY() do {} while (!(SP_STAT & (SPSF_TX_EMPTY | SPSF_TX_INT))) #define KDBG_WRITE_CHAR(c) do { SBUF = (c); } while(0) #define KDBG_MASK_IRQ(old) \ do { \ (old) = INT_MASK1 & INT1F_TI; \ INT_MASK1 &= ~INT1F_TI; \ } while(0) #define KDBG_RESTORE_IRQ(old) do { INT_MASK1 |= (old); } typedef uint16_t kdbg_irqsave_t; /* FIXME: unconfirmed */ #if CONFIG_KDEBUG_PORT == 666 #error BITBANG debug console missing for this platform #endif INLINE void kdbg_hw_init(void) { /* Set serial port for 19200bps 8N1 */ INT_MASK1 &= ~(INT1F_TI | INT1F_RI); SP_CON = SPCF_RECEIVE_ENABLE | SPCF_MODE1; ioc1_img |= IOC1F_TXD_SEL | IOC1F_EXTINT_SRC; IOC1 = ioc1_img; BAUD_RATE = 0x33; BAUD_RATE = 0x80; }