diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-07-20 16:58:39 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-07-20 16:58:39 +0000 |
commit | 3dd3e950cbb7e7050b3d1743ef651513a6c61bcf (patch) | |
tree | 1f721949aec6fcb3c70430b5990daadf4f26751d /nuttx/arch/arm/src/lpc43xx/lpc43_serial.c | |
parent | bfeaf56050b65d0a6887049ab42cfd20c04c6ca2 (diff) | |
download | px4-firmware-3dd3e950cbb7e7050b3d1743ef651513a6c61bcf.tar.gz px4-firmware-3dd3e950cbb7e7050b3d1743ef651513a6c61bcf.tar.bz2 px4-firmware-3dd3e950cbb7e7050b3d1743ef651513a6c61bcf.zip |
Add infrastructure to support RS-485 on the LPC43xx (logic still incomplete)
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4958 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/arch/arm/src/lpc43xx/lpc43_serial.c')
-rw-r--r-- | nuttx/arch/arm/src/lpc43xx/lpc43_serial.c | 60 |
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; |