summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc43xx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-20 16:58:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-07-20 16:58:39 +0000
commitaaab49d3299b2f2ebbbbb35bcfc5a027da8ed4a6 (patch)
tree1f721949aec6fcb3c70430b5990daadf4f26751d /nuttx/arch/arm/src/lpc43xx
parentaf87d2de769a3f148b56f256e8c870c0f1b84580 (diff)
downloadpx4-nuttx-aaab49d3299b2f2ebbbbb35bcfc5a027da8ed4a6.tar.gz
px4-nuttx-aaab49d3299b2f2ebbbbb35bcfc5a027da8ed4a6.tar.bz2
px4-nuttx-aaab49d3299b2f2ebbbbb35bcfc5a027da8ed4a6.zip
Add infrastructure to support RS-485 on the LPC43xx (logic still incomplete)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4958 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/lpc43xx')
-rw-r--r--nuttx/arch/arm/src/lpc43xx/lpc43_serial.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c b/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c
index 1c4e56fe4..bfee7a222 100644
--- a/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c
+++ b/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c
@@ -858,6 +858,50 @@ static int up_interrupt(int irq, void *context)
}
/****************************************************************************
+ * Name: up_set_rs485_mode
+ *
+ * Description:
+ * Handle LPC43xx USART0,2,3 RS485 mode set ioctl (TIOCSRS485) to enable
+ * and disable RS-485 mode. This is part of the serial ioctl logic.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USART_RS485MODE
+static inline int up_set_rs485_mode(struct up_dev_s *priv,
+ const struct serial_rs485 *mode)
+{
+ irqstate_t flags;
+
+ DEBUGASSERT(priv && mode);
+ flags = irqsave();
+#warning "Missing logic"
+ irqrestore(flags);
+}
+#endif
+
+/****************************************************************************
+ * Name: up_get_rs485_mode
+ *
+ * Description:
+ * Handle LPC43xx USART0,2,3 RS485 mode get ioctl (TIOCGRS485) to get the
+ * current RS-485 mode.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_USART_RS485MODE
+static inline int up_get_rs485_mode(struct up_dev_s *priv,
+ struct serial_rs485 *mode)
+{
+ irqstate_t flags;
+
+ DEBUGASSERT(priv && mode);
+ flags = irqsave();
+#warning "Missing logic"
+ irqrestore(flags);
+}
+#endif
+
+/****************************************************************************
* Name: up_ioctl
*
* Description:
@@ -906,6 +950,22 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
}
break;
+#ifdef CONFIG_USART_RS485MODE
+ case TIOCSRS485: /* Set RS485 mode, arg: pointer to struct serial_rs485 */
+ {
+ ret = up_set_rs485_mode(priv,
+ (const struct serial_rs485 *)((uintptr_t)arg));
+ }
+ break;
+
+ case TIOCGRS485: /* Get RS485 mode, arg: pointer to struct serial_rs485 */
+ {
+ ret = up_get_rs485_mode(priv,
+ (struct serial_rs485 *)((uintptr_t)arg));
+ }
+ break;
+#endif
+
default:
*get_errno_ptr() = ENOTTY;
ret = ERROR;