| 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 | |
|---|
| 13 | struct serial_struct { |
|---|
| 14 | int type; |
|---|
| 15 | int line; |
|---|
| 16 | unsigned int port; |
|---|
| 17 | int irq; |
|---|
| 18 | int flags; |
|---|
| 19 | int xmit_fifo_size; |
|---|
| 20 | int custom_divisor; |
|---|
| 21 | int baud_base; |
|---|
| 22 | unsigned short close_delay; |
|---|
| 23 | char io_type; |
|---|
| 24 | char reserved_char[1]; |
|---|
| 25 | int hub6; |
|---|
| 26 | unsigned short closing_wait; /* time to wait before closing */ |
|---|
| 27 | unsigned short closing_wait2; /* no longer used... */ |
|---|
| 28 | unsigned char *iomem_base; |
|---|
| 29 | unsigned short iomem_reg_shift; |
|---|
| 30 | unsigned int port_high; |
|---|
| 31 | unsigned long iomap_base; /* cookie passed into ioremap */ |
|---|
| 32 | }; |
|---|
| 33 | |
|---|
| 34 | /* |
|---|
| 35 | * For the close wait times, 0 means wait forever for serial port to |
|---|
| 36 | * flush its output. 65535 means don't wait at all. |
|---|
| 37 | */ |
|---|
| 38 | #define ASYNC_CLOSING_WAIT_INF 0 |
|---|
| 39 | #define ASYNC_CLOSING_WAIT_NONE 65535 |
|---|
| 40 | |
|---|
| 41 | /* |
|---|
| 42 | * These are the supported serial types. |
|---|
| 43 | */ |
|---|
| 44 | #define PORT_UNKNOWN 0 |
|---|
| 45 | #define PORT_8250 1 |
|---|
| 46 | #define PORT_16450 2 |
|---|
| 47 | #define PORT_16550 3 |
|---|
| 48 | #define PORT_16550A 4 |
|---|
| 49 | #define PORT_CIRRUS 5 /* usurped by cyclades.c */ |
|---|
| 50 | #define PORT_16650 6 |
|---|
| 51 | #define PORT_16650V2 7 |
|---|
| 52 | #define PORT_16750 8 |
|---|
| 53 | #define PORT_STARTECH 9 /* usurped by cyclades.c */ |
|---|
| 54 | #define PORT_16C950 10 /* Oxford Semiconductor */ |
|---|
| 55 | #define PORT_16654 11 |
|---|
| 56 | #define PORT_16850 12 |
|---|
| 57 | #define PORT_RSA 13 /* RSA-DV II/S card */ |
|---|
| 58 | #define PORT_MAX 13 |
|---|
| 59 | |
|---|
| 60 | #define SERIAL_IO_PORT 0 |
|---|
| 61 | #define SERIAL_IO_HUB6 1 |
|---|
| 62 | #define SERIAL_IO_MEM 2 |
|---|
| 63 | |
|---|
| 64 | struct serial_uart_config { |
|---|
| 65 | char *name; |
|---|
| 66 | int dfl_xmit_fifo_size; |
|---|
| 67 | int flags; |
|---|
| 68 | }; |
|---|
| 69 | |
|---|
| 70 | #define UART_CLEAR_FIFO 0x01 |
|---|
| 71 | #define UART_USE_FIFO 0x02 |
|---|
| 72 | #define UART_STARTECH 0x04 |
|---|
| 73 | #define UART_NATSEMI 0x08 |
|---|
| 74 | |
|---|
| 75 | /* |
|---|
| 76 | * Definitions for async_struct (and serial_struct) flags field |
|---|
| 77 | */ |
|---|
| 78 | #define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes |
|---|
| 79 | on the callout port */ |
|---|
| 80 | #define ASYNC_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */ |
|---|
| 81 | #define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */ |
|---|
| 82 | #define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ |
|---|
| 83 | |
|---|
| 84 | #define ASYNC_SPD_MASK 0x1030 |
|---|
| 85 | #define ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */ |
|---|
| 86 | |
|---|
| 87 | #define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ |
|---|
| 88 | #define ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */ |
|---|
| 89 | |
|---|
| 90 | #define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */ |
|---|
| 91 | #define ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */ |
|---|
| 92 | #define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */ |
|---|
| 93 | #define ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ |
|---|
| 94 | #define ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */ |
|---|
| 95 | |
|---|
| 96 | #define ASYNC_HARDPPS_CD 0x0800 /* Call hardpps when CD goes high */ |
|---|
| 97 | |
|---|
| 98 | #define ASYNC_SPD_SHI 0x1000 /* Use 230400 instead of 38400 bps */ |
|---|
| 99 | #define ASYNC_SPD_WARP 0x1010 /* Use 460800 instead of 38400 bps */ |
|---|
| 100 | |
|---|
| 101 | #define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */ |
|---|
| 102 | |
|---|
| 103 | #define ASYNC_BUGGY_UART 0x4000 /* This is a buggy UART, skip some safety |
|---|
| 104 | * checks. Note: can be dangerous! */ |
|---|
| 105 | |
|---|
| 106 | #define ASYNC_AUTOPROBE 0x8000 /* Port was autoprobed by PCI or PNP code */ |
|---|
| 107 | |
|---|
| 108 | #define ASYNC_FLAGS 0x7FFF /* Possible legal async flags */ |
|---|
| 109 | #define ASYNC_USR_MASK 0x3430 /* Legal flags that non-privileged |
|---|
| 110 | * users can set or reset */ |
|---|
| 111 | |
|---|
| 112 | /* Internal flags used only by kernel/chr_drv/serial.c */ |
|---|
| 113 | #define ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */ |
|---|
| 114 | #define ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */ |
|---|
| 115 | #define ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */ |
|---|
| 116 | #define ASYNC_CLOSING 0x08000000 /* Serial port is closing */ |
|---|
| 117 | #define ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */ |
|---|
| 118 | #define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */ |
|---|
| 119 | #define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards |
|---|
| 120 | --- no longer used */ |
|---|
| 121 | #define ASYNC_CONS_FLOW 0x00800000 /* flow control for console */ |
|---|
| 122 | |
|---|
| 123 | #define ASYNC_BOOT_ONLYMCA 0x00400000 /* Probe only if MCA bus */ |
|---|
| 124 | #define ASYNC_INTERNAL_FLAGS 0xFFC00000 /* Internal flags */ |
|---|
| 125 | |
|---|
| 126 | /* |
|---|
| 127 | * Multiport serial configuration structure --- external structure |
|---|
| 128 | */ |
|---|
| 129 | struct serial_multiport_struct { |
|---|
| 130 | int irq; |
|---|
| 131 | int port1; |
|---|
| 132 | unsigned char mask1, match1; |
|---|
| 133 | int port2; |
|---|
| 134 | unsigned char mask2, match2; |
|---|
| 135 | int port3; |
|---|
| 136 | unsigned char mask3, match3; |
|---|
| 137 | int port4; |
|---|
| 138 | unsigned char mask4, match4; |
|---|
| 139 | int port_monitor; |
|---|
| 140 | int reserved[32]; |
|---|
| 141 | }; |
|---|
| 142 | |
|---|
| 143 | /* |
|---|
| 144 | * Serial input interrupt line counters -- external structure |
|---|
| 145 | * Four lines can interrupt: CTS, DSR, RI, DCD |
|---|
| 146 | */ |
|---|
| 147 | struct serial_icounter_struct { |
|---|
| 148 | int cts, dsr, rng, dcd; |
|---|
| 149 | int rx, tx; |
|---|
| 150 | int frame, overrun, parity, brk; |
|---|
| 151 | int buf_overrun; |
|---|
| 152 | int reserved[9]; |
|---|
| 153 | }; |
|---|
| 154 | |
|---|
| 155 | #endif /* _LINUX_SERIAL_H */ |
|---|