1 /* SPDX-License-Identifier: GPL-1.0+ WITH Linux-syscall-note */
3 * include/linux/serial.h
5 * Copyright (C) 1992 by Theodore Ts'o.
7 * Redistribution of this file is permitted under the terms of the GNU
11 #ifndef _UAPI_LINUX_SERIAL_H
12 #define _UAPI_LINUX_SERIAL_H
14 #include <linux/types.h>
16 #include <linux/tty_flags.h>
19 struct serial_struct {
28 unsigned short close_delay;
30 char reserved_char[1];
32 unsigned short closing_wait; /* time to wait before closing */
33 unsigned short closing_wait2; /* no longer used... */
34 unsigned char *iomem_base;
35 unsigned short iomem_reg_shift;
36 unsigned int port_high;
37 unsigned long iomap_base; /* cookie passed into ioremap */
41 * For the close wait times, 0 means wait forever for serial port to
42 * flush its output. 65535 means don't wait at all.
44 #define ASYNC_CLOSING_WAIT_INF 0
45 #define ASYNC_CLOSING_WAIT_NONE 65535
48 * These are the supported serial types.
50 #define PORT_UNKNOWN 0
55 #define PORT_CIRRUS 5 /* usurped by cyclades.c */
57 #define PORT_16650V2 7
59 #define PORT_STARTECH 9 /* usurped by cyclades.c */
60 #define PORT_16C950 10 /* Oxford Semiconductor */
63 #define PORT_RSA 13 /* RSA-DV II/S card */
66 #define SERIAL_IO_PORT 0
67 #define SERIAL_IO_HUB6 1
68 #define SERIAL_IO_MEM 2
69 #define SERIAL_IO_MEM32 3
70 #define SERIAL_IO_AU 4
71 #define SERIAL_IO_TSI 5
72 #define SERIAL_IO_MEM32BE 6
73 #define SERIAL_IO_MEM16 7
75 #define UART_CLEAR_FIFO 0x01
76 #define UART_USE_FIFO 0x02
77 #define UART_STARTECH 0x04
78 #define UART_NATSEMI 0x08
82 * Multiport serial configuration structure --- external structure
84 struct serial_multiport_struct {
87 unsigned char mask1, match1;
89 unsigned char mask2, match2;
91 unsigned char mask3, match3;
93 unsigned char mask4, match4;
99 * Serial input interrupt line counters -- external structure
100 * Four lines can interrupt: CTS, DSR, RI, DCD
102 struct serial_icounter_struct {
103 int cts, dsr, rng, dcd;
105 int frame, overrun, parity, brk;
111 * Serial interface for controlling RS485 settings on chips with suitable
112 * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your
113 * platform. The set function returns the new state, with any unsupported bits
114 * reverted appropriately.
117 struct serial_rs485 {
118 __u32 flags; /* RS485 feature flags */
119 #define SER_RS485_ENABLED (1 << 0) /* If enabled */
120 #define SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for
123 #define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for
125 #define SER_RS485_RX_DURING_TX (1 << 4)
126 #define SER_RS485_TERMINATE_BUS (1 << 5) /* Enable bus
129 __u32 delay_rts_before_send; /* Delay before send (milliseconds) */
130 __u32 delay_rts_after_send; /* Delay after send (milliseconds) */
131 __u32 padding[5]; /* Memory is cheap, new structs
132 are a royal PITA .. */
136 * Serial interface for controlling ISO7816 settings on chips with suitable
137 * support. Set with TIOCSISO7816 and get with TIOCGISO7816 if supported by
140 struct serial_iso7816 {
141 __u32 flags; /* ISO7816 feature flags */
142 #define SER_ISO7816_ENABLED (1 << 0)
143 #define SER_ISO7816_T_PARAM (0x0f << 4)
144 #define SER_ISO7816_T(t) (((t) & 0x0f) << 4)
152 #endif /* _UAPI_LINUX_SERIAL_H */