summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-05-12 13:01:01 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-05-12 13:01:01 +0000
commit011c4581314e5db495a6bb089e10044a5949381b (patch)
tree3027d46e02b485c0a51e43c123403ce83ff0870f /nuttx/arch/arm
parent653293320a64e69454ee832e23bd2d9203580f92 (diff)
downloadpx4-nuttx-011c4581314e5db495a6bb089e10044a5949381b.tar.gz
px4-nuttx-011c4581314e5db495a6bb089e10044a5949381b.tar.bz2
px4-nuttx-011c4581314e5db495a6bb089e10044a5949381b.zip
Fix some UART initialization problems
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1771 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm')
-rw-r--r--nuttx/arch/arm/src/lm3s/chip.h26
-rw-r--r--nuttx/arch/arm/src/lm3s/lm3s_lowputc.c31
-rw-r--r--nuttx/arch/arm/src/lm3s/lm3s_start.c14
-rw-r--r--nuttx/arch/arm/src/str71x/str71x_serial.c2
4 files changed, 49 insertions, 24 deletions
diff --git a/nuttx/arch/arm/src/lm3s/chip.h b/nuttx/arch/arm/src/lm3s/chip.h
index e0900c7df..9613e4c07 100644
--- a/nuttx/arch/arm/src/lm3s/chip.h
+++ b/nuttx/arch/arm/src/lm3s/chip.h
@@ -60,8 +60,28 @@
* Public Data
************************************************************************************/
-/************************************************************************************
- * Public Functions
- ************************************************************************************/
+#ifndef __ASSEMBLY__
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+/* Defined in lm3s_lowputc.c */
+
+EXTERN void up_lowsetup(void);
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+#endif /* __ASSEMBLY__ */
#endif /* __ARCH_ARM_SRC_LM3S_CHIP_H */
diff --git a/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c b/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c
index 554e57f7f..974488600 100644
--- a/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c
+++ b/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c
@@ -219,8 +219,9 @@ void up_lowputc(char ch)
void up_lowsetup(void)
{
+ uint32 rcgc1;
#ifdef HAVE_CONSOLE
- uint16 ctl;
+ uint32 ctl;
/* Enable the selected console device */
/* 1. Disable the UART by clearing the UARTEN bit in the UART CTL register */
@@ -247,18 +248,34 @@ void up_lowsetup(void)
putreg32(ctl, LM3S_CONSOLE_BASE+LM3S_UART_CTL_OFFSET);
#endif
- /* Configure GPIO pins to enable all UARTs in the configuration
- * (the serial driver later depends on this configuration)
+ /* Peripheral clocking to the selected UART modules and to the GPIO
+ * modules used for the pin configuration. NOTE: this function is
+ * called very early in the boot sequence so we do not need to be
+ * concerned about exclusive access to registers.
+ */
+
+ rcgc1 = getreg32(LM3S_SYSCON_RCGC1);
+#if !defined(CONFIG_UART0_DISABLE) && !defined(CONFIG_UART1_DISABLE)
+ rcgc1 |= (SYSCON_RCGC1_UART0|SYSCON_RCGC2_GPIOA|SYSCON_RCGC1_UART1|SYSCON_RCGC2_GPIOD);
+#elif !defined(CONFIG_UART0_DISABLE)
+ rcgc1 |= (SYSCON_RCGC1_UART0|SYSCON_RCGC2_GPIOA);
+#elif !defined(CONFIG_UART1_DISABLE)
+ rcgc1 |= (SYSCON_RCGC1_UART1|SYSCON_RCGC2_GPIOD);
+#endif
+ putreg32(rcgc1, LM3S_SYSCON_RCGC1);
+
+ /* Then configure GPIO pins to enable the selected UARTs. NOTE: The
+ * serial driver later depends on this pin configuration.
*/
#ifndef CONFIG_UART0_DISABLE
- lm3x_configgpio(GPIO_UART0_RX);
- lm3x_configgpio(GPIO_UART0_TX);
+ lm3s_configgpio(GPIO_UART0_RX);
+ lm3s_configgpio(GPIO_UART0_TX);
#endif
#ifndef CONFIG_UART1_DISABLE
- lm3x_configgpio(GPIO_UART1_RX);
- lm3x_configgpio(GPIO_UART1_TX);
+ lm3s_configgpio(GPIO_UART1_RX);
+ lm3s_configgpio(GPIO_UART1_TX);
#endif
}
diff --git a/nuttx/arch/arm/src/lm3s/lm3s_start.c b/nuttx/arch/arm/src/lm3s/lm3s_start.c
index 8894117dc..279b4a961 100644
--- a/nuttx/arch/arm/src/lm3s/lm3s_start.c
+++ b/nuttx/arch/arm/src/lm3s/lm3s_start.c
@@ -88,19 +88,6 @@ extern uint32 _ebss; /* End+1 of .bss */
#endif
/****************************************************************************
- * Name: up_lowsetup
- *
- * Description:
- * Set up initial clocking
- *
- ****************************************************************************/
-
-static inline void up_lowsetup(void)
-{
- up_clockconfig();
-}
-
-/****************************************************************************
* Public Functions
****************************************************************************/
@@ -119,6 +106,7 @@ void _start(void)
/* Configure the uart so that we can get debug output as soon as possible */
+ up_clockconfig();
up_lowsetup();
showprogress('A');
diff --git a/nuttx/arch/arm/src/str71x/str71x_serial.c b/nuttx/arch/arm/src/str71x/str71x_serial.c
index 38bbd149d..9ee2d7434 100644
--- a/nuttx/arch/arm/src/str71x/str71x_serial.c
+++ b/nuttx/arch/arm/src/str71x/str71x_serial.c
@@ -154,7 +154,7 @@
# elif CONFIG_STR71X_UART3
# define TTYS1_DEV g_uart3port /* UART3 is tty1 */
# endif
-#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
+#elif defined(CONFIG_UART3_SERIAL_CONSOLE)
# ifndef CONFIG_STR71X_UART3
# error "UART3 not selected, cannot be console"
# endif