Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 Schmielau | 4e57b68 | 2005-10-30 15:03:48 -0800 | [diff] [blame] | 13 | #include <linux/types.h> |
Andy Whitcroft | 60c20fb | 2009-01-02 13:49:04 +0000 | [diff] [blame] | 14 | |
Alan Cox | ba3fe7a | 2012-09-04 16:35:08 +0100 | [diff] [blame^] | 15 | #include <linux/tty_flags.h> |
| 16 | |
Andy Whitcroft | 60c20fb | 2009-01-02 13:49:04 +0000 | [diff] [blame] | 17 | #ifdef __KERNEL__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <asm/page.h> |
| 19 | |
Alan Cox | ba3fe7a | 2012-09-04 16:35:08 +0100 | [diff] [blame^] | 20 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | /* |
| 22 | * Counters of the input lines (CTS, DSR, RI, CD) interrupts |
| 23 | */ |
| 24 | |
| 25 | struct 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 | |
| 38 | struct 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 Langlais | 71cad05 | 2010-08-31 14:19:09 +0200 | [diff] [blame] | 83 | #define PORT_MAX 13 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | |
| 85 | #define SERIAL_IO_PORT 0 |
| 86 | #define SERIAL_IO_HUB6 1 |
| 87 | #define SERIAL_IO_MEM 2 |
| 88 | |
| 89 | struct 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | |
| 101 | /* |
| 102 | * Multiport serial configuration structure --- external structure |
| 103 | */ |
| 104 | struct 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 | */ |
| 122 | struct 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 Cox | c26c56c | 2008-10-13 10:37:48 +0100 | [diff] [blame] | 130 | /* |
| 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 | |
| 137 | struct serial_rs485 { |
| 138 | __u32 flags; /* RS485 feature flags */ |
Claudio Scordino | 93f3350 | 2011-11-09 15:51:49 +0100 | [diff] [blame] | 139 | #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 Roth | 83cac9f | 2011-08-24 09:48:23 +0200 | [diff] [blame] | 145 | #define SER_RS485_RX_DURING_TX (1 << 4) |
Claudio Scordino | 93f3350 | 2011-11-09 15:51:49 +0100 | [diff] [blame] | 146 | __u32 delay_rts_before_send; /* Delay before send (milliseconds) */ |
| 147 | __u32 delay_rts_after_send; /* Delay after send (milliseconds) */ |
Claudio Scordino | 1b63318 | 2010-07-20 15:26:47 -0700 | [diff] [blame] | 148 | __u32 padding[5]; /* Memory is cheap, new structs |
Alan Cox | c26c56c | 2008-10-13 10:37:48 +0100 | [diff] [blame] | 149 | are a royal PITA .. */ |
| 150 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | |
| 152 | #ifdef __KERNEL__ |
Russell King | 661f83a | 2005-07-16 09:30:53 +0100 | [diff] [blame] | 153 | #include <linux/compiler.h> |
| 154 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | #endif /* __KERNEL__ */ |
| 156 | #endif /* _LINUX_SERIAL_H */ |