Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 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
 
22
#include <linux/version.h>
23
#include <linux/config.h>
24
#include <linux/termios.h>
25
#include <linux/workqueue.h>
26
#include <linux/interrupt.h>
27
#include <linux/circ_buf.h>
28
#include <linux/wait.h>
29
#if (LINUX_VERSION_CODE < 0x020300)
30
/* Unfortunate, but Linux 2.2 needs async_icount defined here and
31
 * it got moved in 2.3 */
32
#include <linux/serial.h>
33
#endif
34
 
35
struct serial_state {
36
        int     magic;
37
        int     baud_base;
38
        unsigned long   port;
39
        int     irq;
40
        int     flags;
41
        int     hub6;
42
        int     type;
43
        int     line;
44
        int     revision;       /* Chip revision (950) */
45
        int     xmit_fifo_size;
46
        int     custom_divisor;
47
        int     count;
48
        u8      *iomem_base;
49
        u16     iomem_reg_shift;
50
        unsigned short  close_delay;
51
        unsigned short  closing_wait; /* time to wait before closing */
52
        struct async_icount     icount;
53
        int     io_type;
54
        struct async_struct *info;
55
        struct pci_dev  *dev;
56
};
57
 
58
struct async_struct {
59
        int                     magic;
60
        unsigned long           port;
61
        int                     hub6;
62
        int                     flags;
63
        int                     xmit_fifo_size;
64
        struct serial_state     *state;
65
        struct tty_struct       *tty;
66
        int                     read_status_mask;
67
        int                     ignore_status_mask;
68
        int                     timeout;
69
        int                     quot;
70
        int                     x_char; /* xon/xoff character */
71
        int                     close_delay;
72
        unsigned short          closing_wait;
73
        unsigned short          closing_wait2; /* obsolete */
74
        int                     IER;    /* Interrupt Enable Register */
75
        int                     MCR;    /* Modem control register */
76
        int                     LCR;    /* Line control register */
77
        int                     ACR;     /* 16950 Additional Control Reg. */
78
        unsigned long           event;
79
        unsigned long           last_active;
80
        int                     line;
81
        int                     blocked_open; /* # of blocked opens */
82
        struct circ_buf         xmit;
83
        spinlock_t              xmit_lock;
84
        u8                      *iomem_base;
85
        u16                     iomem_reg_shift;
86
        int                     io_type;
87
        struct work_struct                      work;
88
        struct tasklet_struct   tlet;
89
#ifdef DECLARE_WAITQUEUE
90
        wait_queue_head_t       open_wait;
91
        wait_queue_head_t       close_wait;
92
        wait_queue_head_t       delta_msr_wait;
93
#else   
94
        struct wait_queue       *open_wait;
95
        struct wait_queue       *close_wait;
96
        struct wait_queue       *delta_msr_wait;
97
#endif  
98
        struct async_struct     *next_port; /* For the linked list */
99
        struct async_struct     *prev_port;
100
};
101
 
102
#define CONFIGURED_SERIAL_PORT(info) ((info)->port || ((info)->iomem_base))
103
 
104
#define SERIAL_MAGIC 0x5301
105
#define SSTATE_MAGIC 0x5302
106
 
107
/*
108
 * Events are used to schedule things to happen at timer-interrupt
109
 * time, instead of at rs interrupt time.
110
 */
111
#define RS_EVENT_WRITE_WAKEUP   0
112
 
113
/*
114
 * Multiport serial configuration structure --- internal structure
115
 */
116
struct rs_multiport_struct {
117
        int             port1;
118
        unsigned char   mask1, match1;
119
        int             port2;
120
        unsigned char   mask2, match2;
121
        int             port3;
122
        unsigned char   mask3, match3;
123
        int             port4;
124
        unsigned char   mask4, match4;
125
        int             port_monitor;
126
};
127
 
128
#if defined(__alpha__) && !defined(CONFIG_PCI)
129
/*
130
 * Digital did something really horribly wrong with the OUT1 and OUT2
131
 * lines on at least some ALPHA's.  The failure mode is that if either
132
 * is cleared, the machine locks up with endless interrupts.
133
 *
134
 * This is still used by arch/mips/au1000/common/serial.c for some weird
135
 * reason (mips != alpha!)
136
 */
137
#define ALPHA_KLUDGE_MCR  (UART_MCR_OUT2 | UART_MCR_OUT1)
138
#else
139
#define ALPHA_KLUDGE_MCR 0
140
#endif
141
 
142
/*
143
 * Definitions for PCI support.
144
 */
145
#define SPCI_FL_BASE_MASK       0x0007
146
#define SPCI_FL_BASE0   0x0000
147
#define SPCI_FL_BASE1   0x0001
148
#define SPCI_FL_BASE2   0x0002
149
#define SPCI_FL_BASE3   0x0003
150
#define SPCI_FL_BASE4   0x0004
151
#define SPCI_FL_GET_BASE(x)     (x & SPCI_FL_BASE_MASK)
152
 
153
#define SPCI_FL_IRQ_MASK       (0x0007 << 4)
154
#define SPCI_FL_IRQBASE0       (0x0000 << 4)
155
#define SPCI_FL_IRQBASE1       (0x0001 << 4)
156
#define SPCI_FL_IRQBASE2       (0x0002 << 4)
157
#define SPCI_FL_IRQBASE3       (0x0003 << 4)
158
#define SPCI_FL_IRQBASE4       (0x0004 << 4)
159
#define SPCI_FL_GET_IRQBASE(x)        ((x & SPCI_FL_IRQ_MASK) >> 4)
160
 
161
/* Use successive BARs (PCI base address registers),
162
   else use offset into some specified BAR */
163
#define SPCI_FL_BASE_TABLE      0x0100
164
 
165
/* Use successive entries in the irq resource table */
166
#define SPCI_FL_IRQ_TABLE       0x0200
167
 
168
/* Use the irq resource table instead of dev->irq */
169
#define SPCI_FL_IRQRESOURCE     0x0400
170
 
171
/* Use the Base address register size to cap number of ports */
172
#define SPCI_FL_REGION_SZ_CAP   0x0800
173
 
174
/* Do not use irq sharing for this device */
175
#define SPCI_FL_NO_SHIRQ        0x1000
176
 
177
/* This is a PNP device */
178
#define SPCI_FL_ISPNP           0x2000
179
 
180
#define SPCI_FL_PNPDEFAULT      (SPCI_FL_IRQRESOURCE|SPCI_FL_ISPNP)
181
 
182
#endif /* _LINUX_SERIAL_H */