kinetis:LPUART Add IOCTL for invert
This commit is contained in:
parent
5db4d2a83b
commit
34eb918665
@ -807,7 +807,7 @@ static int kinetis_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
defined(CONFIG_KINETIS_SERIALBRK_BSDCOMPAT)
|
||||
struct inode *inode;
|
||||
struct uart_dev_s *dev;
|
||||
uint8_t regval;
|
||||
uint32_t regval;
|
||||
#endif
|
||||
#if defined(CONFIG_SERIAL_TERMIOS) || defined(CONFIG_KINETIS_SERIALBRK_BSDCOMPAT)
|
||||
struct kinetis_dev_s *priv;
|
||||
@ -906,6 +906,8 @@ static int kinetis_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
# endif
|
||||
CS8;
|
||||
|
||||
cfsetispeed(termiosp, priv->baud);
|
||||
|
||||
/* TODO: CCTS_IFLOW, CCTS_OFLOW */
|
||||
}
|
||||
break;
|
||||
@ -1043,6 +1045,46 @@ static int kinetis_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
break;
|
||||
#endif /* CONFIG_KINETIS_UART_BREAKS */
|
||||
|
||||
#ifdef CONFIG_KINETIS_UART_INVERT
|
||||
case TIOCSINVERT:
|
||||
{
|
||||
uint32_t stat;
|
||||
uint32_t ctrl;
|
||||
irqstate_t flags;
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
stat = kinetis_serialin(priv, KINETIS_LPUART_STAT_OFFSET);
|
||||
ctrl = kinetis_serialin(priv, KINETIS_LPUART_CTRL_OFFSET);
|
||||
|
||||
/* {R|T}XINV bit fields can written any time */
|
||||
|
||||
if (arg & SER_INVERT_ENABLED_RX)
|
||||
{
|
||||
stat |= LPUART_STAT_RXINV;
|
||||
}
|
||||
else
|
||||
{
|
||||
stat &= ~LPUART_STAT_RXINV;
|
||||
}
|
||||
|
||||
if (arg & SER_INVERT_ENABLED_TX)
|
||||
{
|
||||
ctrl |= LPUART_CTRL_TXINV;
|
||||
}
|
||||
else
|
||||
{
|
||||
ctrl &= ~LPUART_CTRL_TXINV;
|
||||
}
|
||||
|
||||
kinetis_serialout(priv, KINETIS_LPUART_STAT_OFFSET, stat);
|
||||
kinetis_serialout(priv, KINETIS_LPUART_CTRL_OFFSET, ctrl);
|
||||
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user