summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc43xx/lpc43_uart.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-20 18:32:16 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-20 18:32:16 +0000
commitec9c693a8fbabde333c2a022c12476a12ca5f9b8 (patch)
tree2482d9d86be5c9caab9e456430706c269688baaf /nuttx/arch/arm/src/lpc43xx/lpc43_uart.c
parentaaab49d3299b2f2ebbbbb35bcfc5a027da8ed4a6 (diff)
downloadpx4-nuttx-ec9c693a8fbabde333c2a022c12476a12ca5f9b8.tar.gz
px4-nuttx-ec9c693a8fbabde333c2a022c12476a12ca5f9b8.tar.bz2
px4-nuttx-ec9c693a8fbabde333c2a022c12476a12ca5f9b8.zip
Add completed but untested support for RS-485 on the LPC43xx
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4959 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/lpc43xx/lpc43_uart.c')
-rw-r--r--nuttx/arch/arm/src/lpc43xx/lpc43_uart.c51
1 files changed, 43 insertions, 8 deletions
diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_uart.c b/nuttx/arch/arm/src/lpc43xx/lpc43_uart.c
index e5f49bdf3..f03054695 100644
--- a/nuttx/arch/arm/src/lpc43xx/lpc43_uart.c
+++ b/nuttx/arch/arm/src/lpc43xx/lpc43_uart.c
@@ -338,11 +338,24 @@ void lpc43_usart0_setup(void)
regval |= (BOARD_USART0_CLKSRC | BASE_USART0_CLK_AUTOBLOCK);
putreg32(regval, LPC43_BASE_USART0_CLK);
- /* Configure I/O pins */
+ /* Configure I/O pins. NOTE that multiple pin configuration options must
+ * be disambiguated by defining the pin configuration in the board.h
+ * header file.
+ */
lpc43_pin_config(PINCONF_U0_TXD);
lpc43_pin_config(PINCONF_U0_RXD);
+ /* If USART RS-485 mode is selected, then configure the DIR pin as well.
+ * NOTE, again, that multiple pin configuration options must be
+ * disambiguated by defining the pin configuration in the board.h header
+ * file.
+ */
+
+#ifdef CONFIG_USART0_RS485MODE
+ lpc43_pin_config(PINCONF_U0_DIR);
+#endif
+
irqrestore(flags);
};
#endif
@@ -362,8 +375,9 @@ void lpc43_uart1_setup(void)
regval |= (BOARD_UART1_CLKSRC | BASE_UART1_CLK_AUTOBLOCK);
putreg32(regval, LPC43_BASE_UART1_CLK);
- /* Configure I/O pins (resolution of mulitple pins alternatvies
- * must be provided in the board.h file).
+ /* Configure I/O pins. NOTE that multiple pin configuration options must
+ * be disambiguated by defining the pin configuration in the board.h
+ * header file.
*/
lpc43_pin_config(PINCONF_U1_TXD);
@@ -398,13 +412,24 @@ void lpc43_usart2_setup(void)
regval |= (BOARD_USART2_CLKSRC | BASE_USART2_CLK_AUTOBLOCK);
putreg32(regval, LPC43_BASE_USART2_CLK);
- /* Configure I/O pins (resolution of mulitple pins alternatvies
- * must be provided in the board.h file).
+ /* Configure I/O pins. NOTE that multiple pin configuration options must
+ * be disambiguated by defining the pin configuration in the board.h
+ * header file.
*/
lpc43_pin_config(PINCONF_U2_TXD);
lpc43_pin_config(PINCONF_U2_RXD);
+ /* If USART RS-485 mode is selected, then configure the DIR pin as well.
+ * NOTE, again, that multiple pin configuration options must be
+ * disambiguated by defining the pin configuration in the board.h header
+ * file.
+ */
+
+#ifdef CONFIG_USART2_RS485MODE
+ lpc43_pin_config(PINCONF_U2_DIR);
+#endif
+
irqrestore(flags);
};
#endif
@@ -424,13 +449,24 @@ void lpc43_usart3_setup(void)
regval |= (BOARD_USART3_CLKSRC | BASE_USART3_CLK_AUTOBLOCK);
putreg32(regval, LPC43_BASE_USART3_CLK);
- /* Configure I/O pins (resolution of mulitple pins alternatvies
- * must be provided in the board.h file).
+ /* Configure I/O pins. NOTE that multiple pin configuration options must
+ * be disambiguated by defining the pin configuration in the board.h
+ * header file.
*/
lpc43_pin_config(PINCONF_U3_TXD);
lpc43_pin_config(PINCONF_U3_RXD);
+ /* If USART RS-485 mode is selected, then configure the DIR pin as well.
+ * NOTE, again, that multiple pin configuration options must be
+ * disambiguated by defining the pin configuration in the board.h header
+ * file.
+ */
+
+#ifdef CONFIG_USART3_RS485MODE
+ lpc43_pin_config(PINCONF_U3_DIR);
+#endif
+
irqrestore(flags);
};
#endif
@@ -562,4 +598,3 @@ void lpc43_setbaud(uintptr_t uartbase, uint32_t basefreq, uint32_t baud)
putreg32((mul << UART_FDR_MULVAL_SHIFT) | (divadd << UART_FDR_DIVADDVAL_SHIFT),
uartbase + LPC43_UART_FDR_OFFSET);
}
-