David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [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 _UAPI_LINUX_SERIAL_H |
| 11 | #define _UAPI_LINUX_SERIAL_H |
| 12 | |
| 13 | #include <linux/types.h> |
| 14 | |
| 15 | #include <linux/tty_flags.h> |
| 16 | |
| 17 | |
| 18 | struct serial_struct { |
| 19 | int type; |
| 20 | int line; |
| 21 | unsigned int port; |
| 22 | int irq; |
| 23 | int flags; |
| 24 | int xmit_fifo_size; |
| 25 | int custom_divisor; |
| 26 | int baud_base; |
| 27 | unsigned short close_delay; |
| 28 | char io_type; |
| 29 | char reserved_char[1]; |
| 30 | int hub6; |
| 31 | unsigned short closing_wait; /* time to wait before closing */ |
| 32 | unsigned short closing_wait2; /* no longer used... */ |
| 33 | unsigned char *iomem_base; |
| 34 | unsigned short iomem_reg_shift; |
| 35 | unsigned int port_high; |
| 36 | unsigned long iomap_base; /* cookie passed into ioremap */ |
| 37 | }; |
| 38 | |
| 39 | /* |
| 40 | * For the close wait times, 0 means wait forever for serial port to |
| 41 | * flush its output. 65535 means don't wait at all. |
| 42 | */ |
| 43 | #define ASYNC_CLOSING_WAIT_INF 0 |
| 44 | #define ASYNC_CLOSING_WAIT_NONE 65535 |
| 45 | |
| 46 | /* |
| 47 | * These are the supported serial types. |
| 48 | */ |
| 49 | #define PORT_UNKNOWN 0 |
| 50 | #define PORT_8250 1 |
| 51 | #define PORT_16450 2 |
| 52 | #define PORT_16550 3 |
| 53 | #define PORT_16550A 4 |
| 54 | #define PORT_CIRRUS 5 /* usurped by cyclades.c */ |
| 55 | #define PORT_16650 6 |
| 56 | #define PORT_16650V2 7 |
| 57 | #define PORT_16750 8 |
| 58 | #define PORT_STARTECH 9 /* usurped by cyclades.c */ |
| 59 | #define PORT_16C950 10 /* Oxford Semiconductor */ |
| 60 | #define PORT_16654 11 |
| 61 | #define PORT_16850 12 |
| 62 | #define PORT_RSA 13 /* RSA-DV II/S card */ |
| 63 | #define PORT_MAX 13 |
| 64 | |
| 65 | #define SERIAL_IO_PORT 0 |
| 66 | #define SERIAL_IO_HUB6 1 |
| 67 | #define SERIAL_IO_MEM 2 |
| 68 | |
| 69 | #define UART_CLEAR_FIFO 0x01 |
| 70 | #define UART_USE_FIFO 0x02 |
| 71 | #define UART_STARTECH 0x04 |
| 72 | #define UART_NATSEMI 0x08 |
| 73 | |
| 74 | |
| 75 | /* |
| 76 | * Multiport serial configuration structure --- external structure |
| 77 | */ |
| 78 | struct serial_multiport_struct { |
| 79 | int irq; |
| 80 | int port1; |
| 81 | unsigned char mask1, match1; |
| 82 | int port2; |
| 83 | unsigned char mask2, match2; |
| 84 | int port3; |
| 85 | unsigned char mask3, match3; |
| 86 | int port4; |
| 87 | unsigned char mask4, match4; |
| 88 | int port_monitor; |
| 89 | int reserved[32]; |
| 90 | }; |
| 91 | |
| 92 | /* |
| 93 | * Serial input interrupt line counters -- external structure |
| 94 | * Four lines can interrupt: CTS, DSR, RI, DCD |
| 95 | */ |
| 96 | struct serial_icounter_struct { |
| 97 | int cts, dsr, rng, dcd; |
| 98 | int rx, tx; |
| 99 | int frame, overrun, parity, brk; |
| 100 | int buf_overrun; |
| 101 | int reserved[9]; |
| 102 | }; |
| 103 | |
| 104 | /* |
| 105 | * Serial interface for controlling RS485 settings on chips with suitable |
| 106 | * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your |
| 107 | * platform. The set function returns the new state, with any unsupported bits |
| 108 | * reverted appropriately. |
| 109 | */ |
| 110 | |
| 111 | struct serial_rs485 { |
| 112 | __u32 flags; /* RS485 feature flags */ |
| 113 | #define SER_RS485_ENABLED (1 << 0) /* If enabled */ |
| 114 | #define SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for |
| 115 | RTS pin when |
| 116 | sending */ |
| 117 | #define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for |
| 118 | RTS pin after sent*/ |
| 119 | #define SER_RS485_RX_DURING_TX (1 << 4) |
| 120 | __u32 delay_rts_before_send; /* Delay before send (milliseconds) */ |
| 121 | __u32 delay_rts_after_send; /* Delay after send (milliseconds) */ |
| 122 | __u32 padding[5]; /* Memory is cheap, new structs |
| 123 | are a royal PITA .. */ |
| 124 | }; |
| 125 | |
| 126 | #endif /* _UAPI_LINUX_SERIAL_H */ |