From 0e24b0de612ad596103e4e01d250f0be12278783 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 14 Mar 2011 20:50:46 +0000 Subject: Add apps/poweroff lpc17 hardware handshake git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3380 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/lpc17xx/lpc17_serial.c | 16 ++++++++++++++-- nuttx/arch/arm/src/lpc17xx/lpc17_serial.h | 9 +++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'nuttx/arch/arm/src/lpc17xx') diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c index d58ce7c03..63687038f 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c @@ -664,13 +664,15 @@ static inline void lpc17_uart1config(uint32_t clkdiv) lpc17_configgpio(GPIO_UART1_TXD); lpc17_configgpio(GPIO_UART1_RXD); -#ifdef CONFIG_UART0_FLOWCONTROL +#ifdef CONFIG_UART1_FLOWCONTROL lpc17_configgpio(GPIO_UART1_CTS); + lpc17_configgpio(GPIO_UART1_RTS); lpc17_configgpio(GPIO_UART1_DCD); lpc17_configgpio(GPIO_UART1_DSR); lpc17_configgpio(GPIO_UART1_DTR); +#ifdef CONFIG_UART1_RINGINDICATOR lpc17_configgpio(GPIO_UART1_RI); - lpc17_configgpio(GPIO_UART1_RTS); +#endif #endif irqrestore(flags); }; @@ -849,6 +851,16 @@ static int up_setup(struct uart_dev_s *dev) up_serialout(priv, LPC17_UART_FCR_OFFSET, (UART_FCR_RXTRIGGER_8|UART_FCR_TXRST|UART_FCR_RXRST|UART_FCR_FIFOEN)); + + /* Enable Auto-RTS and Auto-CS Flow Control in the Modem Control Register */ + +#ifdef CONFIG_UART1_FLOWCONTROL + if (priv->uartbase == LPC17_UART1_BASE) + { + up_serialout(priv, LPC17_UART_MCR_OFFSET, (UART_MCR_RTSEN|UART_MCR_CTSEN)); + } +#endif + #endif return OK; } diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.h b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.h index 3446c4997..9fca96219 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.h @@ -92,6 +92,15 @@ # undef HAVE_CONSOLE #endif +/* Check UART flow control (Only supported by UART1) */ + +# undef CONFIG_UART0_FLOWCONTROL +# undef CONFIG_UART2_FLOWCONTROL +# undef CONFIG_UART3_FLOWCONTROL +#ifndef CONFIG_LPC17_UART1 +# undef CONFIG_UART1_FLOWCONTROL +#endif + /* We cannot allow the DLM/DLL divisor to become to small or will will lose too * much accuracy. This following is a "fudge factor" that represents the minimum * value of the divisor that we will permit. -- cgit v1.2.3