lm3s1968-gpio: coding style fixes.
[bertos.git] / bertos / cpu / cortex-m3 / drv / kdebug_lm3s.c
index 321a87e3d8dd45767522e18a4945818b739af41c..65c1dccb46512e36ccc917ee349840dccf6355a7 100644 (file)
  * \author Andrea Righi <arighi@develer.com>
  */
 
+#include <cfg/cfg_debug.h>
 #include <cfg/macros.h> /* for BV() */
+#include <drv/clock_lm3s.h> /* lm3s_busyWait() */
+#include <drv/gpio_lm3s.h>
+#include <io/lm3s.h>
 #include "kdebug_lm3s.h"
-#include "cfg/cfg_debug.h"
-#include "io/lm3s.h"
 
 INLINE void uart_disable(size_t base)
 {
@@ -123,14 +125,11 @@ INLINE void kdbg_hw_init(void)
        /* Enable the peripheral clock */
        SYSCTL_RCGC1_R |= SYSCTL_RCGC1_UART0;
        SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOA;
+       lm3s_busyWait(512);
 
        /* Set GPIO A0 and A1 as UART pins */
-       HWREG(GPIO_PORTA_BASE + GPIO_O_DIR) |= BV(0) | BV(1);
-       HWREG(GPIO_PORTA_BASE + GPIO_O_AFSEL) |= BV(0) | BV(1);
-       HWREG(GPIO_PORTA_BASE + GPIO_O_DR2R) |= BV(0) | BV(1);
-       HWREG(GPIO_PORTA_BASE + GPIO_O_DEN) |= BV(0) | BV(1);
-       HWREG(GPIO_PORTA_BASE + GPIO_O_AMSEL) &= ~(BV(0) | BV(1));
-
+       lm3s_gpioPinConfig(GPIO_PORTA_BASE, BV(0) | BV(1),
+                       GPIO_DIR_MODE_HW, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
        /* 115.200, 8-bit word, no parity, one stop bit */
-       uart_config(UART0_BASE, 115200, UART_LCRH_WLEN_8);
+       uart_config(UART0_BASE, CONFIG_KDEBUG_BAUDRATE, UART_LCRH_WLEN_8);
 }