Skip to content

Commit 2048715

Browse files
pkarashchenkoxiaoxiang781216
authored andcommitted
serial: remove 'TIOCSLINID'
Signed-off-by: Petro Karashchenko <[email protected]>
1 parent 919242d commit 2048715

File tree

2 files changed

+2
-60
lines changed

2 files changed

+2
-60
lines changed

arch/arm/src/samv7/sam_serial.c

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,8 +1633,10 @@ static int sam_interrupt(int irq, void *context, void *arg)
16331633

16341634
static int sam_ioctl(struct file *filep, int cmd, unsigned long arg)
16351635
{
1636+
#if defined(CONFIG_SERIAL_TERMIOS) || defined(CONFIG_SERIAL_TIOCSERGSTRUCT)
16361637
struct inode *inode = filep->f_inode;
16371638
struct uart_dev_s *dev = inode->i_private;
1639+
#endif
16381640
int ret = OK;
16391641

16401642
switch (cmd)
@@ -1814,62 +1816,6 @@ static int sam_ioctl(struct file *filep, int cmd, unsigned long arg)
18141816
break;
18151817
#endif /* CONFIG_SERIAL_TERMIOS */
18161818

1817-
case TIOCSLINID:
1818-
{
1819-
/* Switch USART to LIN mode -> Set identifier register -> This will
1820-
* issue a LIN header -> Restore USART mode
1821-
*/
1822-
1823-
struct sam_dev_s *priv = (struct sam_dev_s *)dev->priv;
1824-
uint32_t regvalsave = 0;
1825-
uint32_t regval = 0;
1826-
1827-
/* Save actual configuration */
1828-
1829-
regvalsave = sam_serialin(priv, SAM_UART_MR_OFFSET);
1830-
1831-
/* Issue a LIN header (Master mode only) */
1832-
1833-
regval = regvalsave & ~UART_MR_MODE_MASK;
1834-
regval |= UART_MR_MODE_LINMSTR;
1835-
sam_serialout(priv, SAM_UART_MR_OFFSET, regval);
1836-
1837-
/* Reset transaction status bits */
1838-
1839-
sam_serialout(priv, SAM_UART_CR_OFFSET, UART_CR_RSTSTA);
1840-
1841-
/* Write LIN ID to trigger header transmission */
1842-
1843-
regval = UART_LINIR_MASK & (uint8_t)arg;
1844-
sam_serialout(priv, SAM_UART_LINIR_OFFSET, regval);
1845-
1846-
/* Wait until the header is on the wire */
1847-
1848-
do
1849-
{
1850-
/* Header takes 34 bits to transmit so poll with 34 / 4 = 8 bits
1851-
* cycle time
1852-
*
1853-
* TODO: Interrupt + semaphore can be used instead of busy
1854-
* waiting to improve CPU utilization
1855-
*/
1856-
1857-
nxsig_usleep((8 * 1000 * 1000) / priv->baud);
1858-
1859-
regval = sam_serialin(priv, SAM_UART_SR_OFFSET);
1860-
}
1861-
while ((regval & UART_INT_LINID) == 0);
1862-
1863-
/* Reset transaction status bits */
1864-
1865-
sam_serialout(priv, SAM_UART_CR_OFFSET, UART_CR_RSTSTA);
1866-
1867-
/* Restore USART mode */
1868-
1869-
sam_serialout(priv, SAM_UART_MR_OFFSET, regvalsave);
1870-
}
1871-
break;
1872-
18731819
default:
18741820
ret = -ENOTTY;
18751821
break;

include/nuttx/serial/tioctl.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,6 @@
200200

201201
#define SER_SWAP_ENABLED (1 << 0) /* Enable/disable RX/TX swap */
202202

203-
/* LIN Protocol Support */
204-
205-
#define TIOCSLINID _TIOC(0x0037) /* Master send one LIN header with specified LIN identifier: uint8_t */
206-
207203
/****************************************************************************
208204
* Public Type Definitions
209205
****************************************************************************/

0 commit comments

Comments
 (0)