X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=cpu%2Favr%2Fdrv%2Fkdebug_avr.c;h=35d0645d6867a61485ca708f3f5a3ce333a5fde1;hb=28b5d3be3a4fa44246db263306bda7ae99f3f238;hp=0ff8a8522528982c63e4f7af30d01ce67b22770a;hpb=27fef4ed34eb237817defa14242e726ccad70948;p=bertos.git diff --git a/cpu/avr/drv/kdebug_avr.c b/cpu/avr/drv/kdebug_avr.c index 0ff8a852..35d0645d 100644 --- a/cpu/avr/drv/kdebug_avr.c +++ b/cpu/avr/drv/kdebug_avr.c @@ -39,8 +39,9 @@ * \author Francesco Sacchi */ -#include -#include /* for BV() */ +#include +#include +#include /* for BV(), DIV_ROUND */ #include #include /* for CLOCK_FREQ */ #include /* Required for bus macros overrides */ @@ -153,8 +154,8 @@ typedef uint8_t kdbg_irqsave_t; /* - * Special debug port for BitBanged Serial see below for details... - */ + * Special debug port for BitBanged Serial see below for details... + */ #elif CONFIG_KDEBUG_PORT == 666 #include "hw_ser.h" #define KDBG_WAIT_READY() do { /*nop*/ } while(0) @@ -222,7 +223,7 @@ INLINE void kdbg_hw_init(void) 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; + uint16_t period = DIV_ROUND(CLOCK_FREQ / 16UL, CONFIG_KDEBUG_BAUDRATE) - 1; #if (CPU_AVR_ATMEGA64 || CPU_AVR_ATMEGA128) #if CONFIG_KDEBUG_PORT == 0