blob: ed5ed6640846a4fcce7ca1af5df610c661af8f5c [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI_LINUX_SERIAL_H
8#define _UAPI_LINUX_SERIAL_H
Christopher Ferrisb830ddf2024-03-28 11:48:08 -07009#include <linux/const.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070010#include <linux/types.h>
11#include <linux/tty_flags.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070012struct serial_struct {
Tao Baod7db5942015-01-28 10:07:51 -080013 int type;
14 int line;
15 unsigned int port;
Tao Baod7db5942015-01-28 10:07:51 -080016 int irq;
17 int flags;
18 int xmit_fifo_size;
19 int custom_divisor;
Tao Baod7db5942015-01-28 10:07:51 -080020 int baud_base;
21 unsigned short close_delay;
22 char io_type;
23 char reserved_char[1];
Tao Baod7db5942015-01-28 10:07:51 -080024 int hub6;
25 unsigned short closing_wait;
26 unsigned short closing_wait2;
27 unsigned char * iomem_base;
Tao Baod7db5942015-01-28 10:07:51 -080028 unsigned short iomem_reg_shift;
29 unsigned int port_high;
30 unsigned long iomap_base;
Ben Cheng655a7c02013-10-16 16:09:24 -070031};
Ben Cheng655a7c02013-10-16 16:09:24 -070032#define ASYNC_CLOSING_WAIT_INF 0
33#define ASYNC_CLOSING_WAIT_NONE 65535
34#define PORT_UNKNOWN 0
35#define PORT_8250 1
Ben Cheng655a7c02013-10-16 16:09:24 -070036#define PORT_16450 2
37#define PORT_16550 3
38#define PORT_16550A 4
39#define PORT_CIRRUS 5
Ben Cheng655a7c02013-10-16 16:09:24 -070040#define PORT_16650 6
41#define PORT_16650V2 7
42#define PORT_16750 8
43#define PORT_STARTECH 9
Ben Cheng655a7c02013-10-16 16:09:24 -070044#define PORT_16C950 10
45#define PORT_16654 11
46#define PORT_16850 12
47#define PORT_RSA 13
Ben Cheng655a7c02013-10-16 16:09:24 -070048#define PORT_MAX 13
49#define SERIAL_IO_PORT 0
50#define SERIAL_IO_HUB6 1
51#define SERIAL_IO_MEM 2
Christopher Ferris05d08e92016-02-04 13:16:38 -080052#define SERIAL_IO_MEM32 3
53#define SERIAL_IO_AU 4
54#define SERIAL_IO_TSI 5
55#define SERIAL_IO_MEM32BE 6
Christopher Ferris106b3a82016-08-24 12:15:38 -070056#define SERIAL_IO_MEM16 7
Ben Cheng655a7c02013-10-16 16:09:24 -070057#define UART_CLEAR_FIFO 0x01
58#define UART_USE_FIFO 0x02
59#define UART_STARTECH 0x04
Christopher Ferris106b3a82016-08-24 12:15:38 -070060#define UART_NATSEMI 0x08
Ben Cheng655a7c02013-10-16 16:09:24 -070061struct serial_multiport_struct {
Tao Baod7db5942015-01-28 10:07:51 -080062 int irq;
63 int port1;
Christopher Ferris106b3a82016-08-24 12:15:38 -070064 unsigned char mask1, match1;
Tao Baod7db5942015-01-28 10:07:51 -080065 int port2;
66 unsigned char mask2, match2;
67 int port3;
Christopher Ferris106b3a82016-08-24 12:15:38 -070068 unsigned char mask3, match3;
Tao Baod7db5942015-01-28 10:07:51 -080069 int port4;
70 unsigned char mask4, match4;
71 int port_monitor;
Christopher Ferris106b3a82016-08-24 12:15:38 -070072 int reserved[32];
Ben Cheng655a7c02013-10-16 16:09:24 -070073};
74struct serial_icounter_struct {
Tao Baod7db5942015-01-28 10:07:51 -080075 int cts, dsr, rng, dcd;
Christopher Ferris106b3a82016-08-24 12:15:38 -070076 int rx, tx;
Tao Baod7db5942015-01-28 10:07:51 -080077 int frame, overrun, parity, brk;
78 int buf_overrun;
79 int reserved[9];
Christopher Ferris106b3a82016-08-24 12:15:38 -070080};
Ben Cheng655a7c02013-10-16 16:09:24 -070081struct serial_rs485 {
Tao Baod7db5942015-01-28 10:07:51 -080082 __u32 flags;
Christopher Ferrisb830ddf2024-03-28 11:48:08 -070083#define SER_RS485_ENABLED _BITUL(0)
84#define SER_RS485_RTS_ON_SEND _BITUL(1)
85#define SER_RS485_RTS_AFTER_SEND _BITUL(2)
86#define SER_RS485_RX_DURING_TX _BITUL(4)
87#define SER_RS485_TERMINATE_BUS _BITUL(5)
88#define SER_RS485_ADDRB _BITUL(6)
89#define SER_RS485_ADDR_RECV _BITUL(7)
90#define SER_RS485_ADDR_DEST _BITUL(8)
91#define SER_RS485_MODE_RS422 _BITUL(9)
Tao Baod7db5942015-01-28 10:07:51 -080092 __u32 delay_rts_before_send;
Christopher Ferris106b3a82016-08-24 12:15:38 -070093 __u32 delay_rts_after_send;
Christopher Ferris7447a1c2022-10-04 18:24:44 -070094 union {
95 __u32 padding[5];
96 struct {
97 __u8 addr_recv;
98 __u8 addr_dest;
99 __u8 padding0[2];
100 __u32 padding1[4];
101 };
102 };
Ben Cheng655a7c02013-10-16 16:09:24 -0700103};
Christopher Ferris86a48372019-01-10 14:14:59 -0800104struct serial_iso7816 {
105 __u32 flags;
106#define SER_ISO7816_ENABLED (1 << 0)
107#define SER_ISO7816_T_PARAM (0x0f << 4)
108#define SER_ISO7816_T(t) (((t) & 0x0f) << 4)
109 __u32 tg;
110 __u32 sc_fi;
111 __u32 sc_di;
112 __u32 clk;
113 __u32 reserved[5];
114};
Ben Cheng655a7c02013-10-16 16:09:24 -0700115#endif