-
- /* Compute the baud rate */
- uint16_t period = (((CLOCK_FREQ / 16UL) + (CONFIG_KDEBUG_BAUDRATE / 2)) / CONFIG_KDEBUG_BAUDRATE) - 1;
-
- #if defined(__AVR_ATmega64__)
- #if CONFIG_KDEBUG_PORT == 0
+ #if CONFIG_KDEBUG_PORT == 666
+ SER_BITBANG_INIT;
+ #else /* CONFIG_KDEBUG_PORT != 666 */
+ /* Compute the baud rate */
+ uint16_t period = (((CLOCK_FREQ / 16UL) + (CONFIG_KDEBUG_BAUDRATE / 2)) / CONFIG_KDEBUG_BAUDRATE) - 1;
+
+ #if (CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128)
+ #if CONFIG_KDEBUG_PORT == 0
+ UBRR0H = (uint8_t)(period>>8);
+ UBRR0L = (uint8_t)period;
+ KDBG_UART0_BUS_INIT;
+ #elif CONFIG_KDEBUG_PORT == 1
+ UBRR1H = (uint8_t)(period>>8);
+ UBRR1L = (uint8_t)period;
+ KDBG_UART1_BUS_INIT;
+ #else
+ #error CONFIG_KDEBUG_PORT must be either 0 or 1
+ #endif
+
+ #elif CPU_AVR_ATMEGA168