Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Private header file for the (dumb) serial driver |
| 3 | * |
| 4 | * Copyright (C) 1997 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_SERIALP_H |
| 11 | #define _LINUX_SERIALP_H |
| 12 | |
| 13 | /* |
| 14 | * This is our internal structure for each serial port's state. |
| 15 | * |
| 16 | * Many fields are paralleled by the structure used by the serial_struct |
| 17 | * structure. |
| 18 | * |
| 19 | * For definitions of the flags field, see tty.h |
| 20 | */ |
| 21 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <linux/termios.h> |
| 23 | #include <linux/workqueue.h> |
| 24 | #include <linux/interrupt.h> |
| 25 | #include <linux/circ_buf.h> |
| 26 | #include <linux/wait.h> |
| 27 | |
| 28 | struct serial_state { |
| 29 | int magic; |
| 30 | int baud_base; |
| 31 | unsigned long port; |
| 32 | int irq; |
| 33 | int flags; |
| 34 | int hub6; |
| 35 | int type; |
| 36 | int line; |
| 37 | int revision; /* Chip revision (950) */ |
| 38 | int xmit_fifo_size; |
| 39 | int custom_divisor; |
| 40 | int count; |
| 41 | u8 *iomem_base; |
| 42 | u16 iomem_reg_shift; |
| 43 | unsigned short close_delay; |
| 44 | unsigned short closing_wait; /* time to wait before closing */ |
| 45 | struct async_icount icount; |
| 46 | int io_type; |
| 47 | struct async_struct *info; |
| 48 | struct pci_dev *dev; |
| 49 | }; |
| 50 | |
| 51 | struct async_struct { |
| 52 | int magic; |
| 53 | unsigned long port; |
| 54 | int hub6; |
| 55 | int flags; |
| 56 | int xmit_fifo_size; |
| 57 | struct serial_state *state; |
| 58 | struct tty_struct *tty; |
| 59 | int read_status_mask; |
| 60 | int ignore_status_mask; |
| 61 | int timeout; |
| 62 | int quot; |
| 63 | int x_char; /* xon/xoff character */ |
| 64 | int close_delay; |
| 65 | unsigned short closing_wait; |
| 66 | unsigned short closing_wait2; /* obsolete */ |
| 67 | int IER; /* Interrupt Enable Register */ |
| 68 | int MCR; /* Modem control register */ |
| 69 | int LCR; /* Line control register */ |
| 70 | int ACR; /* 16950 Additional Control Reg. */ |
| 71 | unsigned long event; |
| 72 | unsigned long last_active; |
| 73 | int line; |
| 74 | int blocked_open; /* # of blocked opens */ |
| 75 | struct circ_buf xmit; |
| 76 | spinlock_t xmit_lock; |
| 77 | u8 *iomem_base; |
| 78 | u16 iomem_reg_shift; |
| 79 | int io_type; |
| 80 | struct work_struct work; |
| 81 | struct tasklet_struct tlet; |
| 82 | #ifdef DECLARE_WAITQUEUE |
| 83 | wait_queue_head_t open_wait; |
| 84 | wait_queue_head_t close_wait; |
| 85 | wait_queue_head_t delta_msr_wait; |
| 86 | #else |
| 87 | struct wait_queue *open_wait; |
| 88 | struct wait_queue *close_wait; |
| 89 | struct wait_queue *delta_msr_wait; |
| 90 | #endif |
| 91 | struct async_struct *next_port; /* For the linked list */ |
| 92 | struct async_struct *prev_port; |
| 93 | }; |
| 94 | |
| 95 | #define CONFIGURED_SERIAL_PORT(info) ((info)->port || ((info)->iomem_base)) |
| 96 | |
| 97 | #define SERIAL_MAGIC 0x5301 |
| 98 | #define SSTATE_MAGIC 0x5302 |
| 99 | |
| 100 | /* |
| 101 | * Events are used to schedule things to happen at timer-interrupt |
| 102 | * time, instead of at rs interrupt time. |
| 103 | */ |
| 104 | #define RS_EVENT_WRITE_WAKEUP 0 |
| 105 | |
| 106 | /* |
| 107 | * Multiport serial configuration structure --- internal structure |
| 108 | */ |
| 109 | struct rs_multiport_struct { |
| 110 | int port1; |
| 111 | unsigned char mask1, match1; |
| 112 | int port2; |
| 113 | unsigned char mask2, match2; |
| 114 | int port3; |
| 115 | unsigned char mask3, match3; |
| 116 | int port4; |
| 117 | unsigned char mask4, match4; |
| 118 | int port_monitor; |
| 119 | }; |
| 120 | |
| 121 | #if defined(__alpha__) && !defined(CONFIG_PCI) |
| 122 | /* |
| 123 | * Digital did something really horribly wrong with the OUT1 and OUT2 |
| 124 | * lines on at least some ALPHA's. The failure mode is that if either |
| 125 | * is cleared, the machine locks up with endless interrupts. |
| 126 | * |
| 127 | * This is still used by arch/mips/au1000/common/serial.c for some weird |
| 128 | * reason (mips != alpha!) |
| 129 | */ |
| 130 | #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1) |
| 131 | #elif defined(CONFIG_SBC8560) |
| 132 | /* |
| 133 | * WindRiver did something similarly broken on their SBC8560 board. The |
| 134 | * UART tristates its IRQ output while OUT2 is clear, but they pulled |
| 135 | * the interrupt line _up_ instead of down, so if we register the IRQ |
| 136 | * while the UART is in that state, we die in an IRQ storm. */ |
| 137 | #define ALPHA_KLUDGE_MCR (UART_MCR_OUT2) |
| 138 | #else |
| 139 | #define ALPHA_KLUDGE_MCR 0 |
| 140 | #endif |
| 141 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 142 | #endif /* _LINUX_SERIAL_H */ |