blob: 3504f428ce66a70a864e38509318c1e6610a7750 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * include/linux/serial.h
3 *
4 * Copyright (C) 1992 by Theodore Ts'o.
5 *
6 * Redistribution of this file is permitted under the terms of the GNU
7 * Public License (GPL)
8 */
9
10#ifndef _LINUX_SERIAL_H
11#define _LINUX_SERIAL_H
12
Tim Schmielau4e57b682005-10-30 15:03:48 -080013#include <linux/types.h>
Andy Whitcroft60c20fb2009-01-02 13:49:04 +000014
Alan Coxba3fe7a2012-09-04 16:35:08 +010015#include <linux/tty_flags.h>
16
Andy Whitcroft60c20fb2009-01-02 13:49:04 +000017#ifdef __KERNEL__
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <asm/page.h>
19
Alan Coxba3fe7a2012-09-04 16:35:08 +010020
Linus Torvalds1da177e2005-04-16 15:20:36 -070021/*
22 * Counters of the input lines (CTS, DSR, RI, CD) interrupts
23 */
24
25struct async_icount {
26 __u32 cts, dsr, rng, dcd, tx, rx;
27 __u32 frame, parity, overrun, brk;
28 __u32 buf_overrun;
29};
30
31/*
32 * The size of the serial xmit buffer is 1 page, or 4096 bytes
33 */
34#define SERIAL_XMIT_SIZE PAGE_SIZE
35
36#endif
37
38struct serial_struct {
39 int type;
40 int line;
41 unsigned int port;
42 int irq;
43 int flags;
44 int xmit_fifo_size;
45 int custom_divisor;
46 int baud_base;
47 unsigned short close_delay;
48 char io_type;
49 char reserved_char[1];
50 int hub6;
51 unsigned short closing_wait; /* time to wait before closing */
52 unsigned short closing_wait2; /* no longer used... */
53 unsigned char *iomem_base;
54 unsigned short iomem_reg_shift;
55 unsigned int port_high;
56 unsigned long iomap_base; /* cookie passed into ioremap */
57};
58
59/*
60 * For the close wait times, 0 means wait forever for serial port to
61 * flush its output. 65535 means don't wait at all.
62 */
63#define ASYNC_CLOSING_WAIT_INF 0
64#define ASYNC_CLOSING_WAIT_NONE 65535
65
66/*
67 * These are the supported serial types.
68 */
69#define PORT_UNKNOWN 0
70#define PORT_8250 1
71#define PORT_16450 2
72#define PORT_16550 3
73#define PORT_16550A 4
74#define PORT_CIRRUS 5 /* usurped by cyclades.c */
75#define PORT_16650 6
76#define PORT_16650V2 7
77#define PORT_16750 8
78#define PORT_STARTECH 9 /* usurped by cyclades.c */
79#define PORT_16C950 10 /* Oxford Semiconductor */
80#define PORT_16654 11
81#define PORT_16850 12
82#define PORT_RSA 13 /* RSA-DV II/S card */
Philippe Langlais71cad052010-08-31 14:19:09 +020083#define PORT_MAX 13
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
85#define SERIAL_IO_PORT 0
86#define SERIAL_IO_HUB6 1
87#define SERIAL_IO_MEM 2
88
89struct serial_uart_config {
90 char *name;
91 int dfl_xmit_fifo_size;
92 int flags;
93};
94
95#define UART_CLEAR_FIFO 0x01
96#define UART_USE_FIFO 0x02
97#define UART_STARTECH 0x04
98#define UART_NATSEMI 0x08
99
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100
101/*
102 * Multiport serial configuration structure --- external structure
103 */
104struct serial_multiport_struct {
105 int irq;
106 int port1;
107 unsigned char mask1, match1;
108 int port2;
109 unsigned char mask2, match2;
110 int port3;
111 unsigned char mask3, match3;
112 int port4;
113 unsigned char mask4, match4;
114 int port_monitor;
115 int reserved[32];
116};
117
118/*
119 * Serial input interrupt line counters -- external structure
120 * Four lines can interrupt: CTS, DSR, RI, DCD
121 */
122struct serial_icounter_struct {
123 int cts, dsr, rng, dcd;
124 int rx, tx;
125 int frame, overrun, parity, brk;
126 int buf_overrun;
127 int reserved[9];
128};
129
Alan Coxc26c56c2008-10-13 10:37:48 +0100130/*
131 * Serial interface for controlling RS485 settings on chips with suitable
132 * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your
133 * platform. The set function returns the new state, with any unsupported bits
134 * reverted appropriately.
135 */
136
137struct serial_rs485 {
138 __u32 flags; /* RS485 feature flags */
Claudio Scordino93f33502011-11-09 15:51:49 +0100139#define SER_RS485_ENABLED (1 << 0) /* If enabled */
140#define SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for
141 RTS pin when
142 sending */
143#define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for
144 RTS pin after sent*/
Bernhard Roth83cac9f2011-08-24 09:48:23 +0200145#define SER_RS485_RX_DURING_TX (1 << 4)
Claudio Scordino93f33502011-11-09 15:51:49 +0100146 __u32 delay_rts_before_send; /* Delay before send (milliseconds) */
147 __u32 delay_rts_after_send; /* Delay after send (milliseconds) */
Claudio Scordino1b633182010-07-20 15:26:47 -0700148 __u32 padding[5]; /* Memory is cheap, new structs
Alan Coxc26c56c2008-10-13 10:37:48 +0100149 are a royal PITA .. */
150};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151
152#ifdef __KERNEL__
Russell King661f83a2005-07-16 09:30:53 +0100153#include <linux/compiler.h>
154
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155#endif /* __KERNEL__ */
156#endif /* _LINUX_SERIAL_H */