Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
[pandora-kernel.git] / drivers / char / specialix_io8.h
1 /*
2  *      linux/drivers/char/specialix_io8.h  -- 
3  *                                   Specialix IO8+ multiport serial driver.
4  *
5  *      Copyright (C) 1997 Roger Wolff (R.E.Wolff@BitWizard.nl)
6  *      Copyright (C) 1994-1996  Dmitry Gorodchanin (pgmdsg@ibi.com)
7  *
8  *
9  *      Specialix pays for the development and support of this driver.
10  *      Please DO contact io8-linux@specialix.co.uk if you require
11  *      support.
12  *
13  *      This driver was developped in the BitWizard linux device
14  *      driver service. If you require a linux device driver for your
15  *      product, please contact devices@BitWizard.nl for a quote.
16  *
17  *      This code is firmly based on the riscom/8 serial driver,
18  *      written by Dmitry Gorodchanin. The specialix IO8+ card
19  *      programming information was obtained from the CL-CD1865 Data
20  *      Book, and Specialix document number 6200059: IO8+ Hardware
21  *      Functional Specification.
22  *
23  *      This program is free software; you can redistribute it and/or
24  *      modify it under the terms of the GNU General Public License as
25  *      published by the Free Software Foundation; either version 2 of
26  *      the License, or (at your option) any later version.
27  *
28  *      This program is distributed in the hope that it will be
29  *      useful, but WITHOUT ANY WARRANTY; without even the implied
30  *      warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
31  *      PURPOSE.  See the GNU General Public License for more details.
32  *
33  *      You should have received a copy of the GNU General Public
34  *      License along with this program; if not, write to the Free
35  *      Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
36  *      USA.
37  * */
38
39 #ifndef __LINUX_SPECIALIX_H
40 #define __LINUX_SPECIALIX_H
41
42 #include <linux/serial.h>
43
44 #ifdef __KERNEL__
45
46 /* You can have max 4 ISA cards in one PC, and I recommend not much 
47 more than a few  PCI versions of the card. */
48
49 #define SX_NBOARD               8
50
51 /* NOTE: Specialix decoder recognizes 4 addresses, but only two are used.... */
52 #define SX_IO_SPACE             4
53 /* The PCI version decodes 8 addresses, but still only 2 are used. */
54 #define SX_PCI_IO_SPACE         8
55
56 /* eight ports per board. */
57 #define SX_NPORT                8
58 #define SX_BOARD(line)          ((line) / SX_NPORT)
59 #define SX_PORT(line)           ((line) & (SX_NPORT - 1))
60
61
62 #define SX_DATA_REG 0     /* Base+0 : Data register */
63 #define SX_ADDR_REG 1     /* base+1 : Address register. */
64
65 #define MHz *1000000    /* I'm ashamed of myself. */
66
67 /* On-board oscillator frequency */
68 #define SX_OSCFREQ      (25 MHz/2)
69 /* There is a 25MHz crystal on the board, but the chip is in /2 mode */
70
71
72 /* Ticks per sec. Used for setting receiver timeout and break length */
73 #define SPECIALIX_TPS           4000
74
75 /* Yeah, after heavy testing I decided it must be 6.
76  * Sure, You can change it if needed.
77  */
78 #define SPECIALIX_RXFIFO        6       /* Max. receiver FIFO size (1-8) */
79
80 #define SPECIALIX_MAGIC         0x0907
81
82 #define SX_CCR_TIMEOUT 10000   /* CCR timeout. You may need to wait upto
83                                   10 milliseconds before the internal
84                                   processor is available again after
85                                   you give it a command */
86
87 #define SX_IOBASE1      0x100
88 #define SX_IOBASE2      0x180
89 #define SX_IOBASE3      0x250
90 #define SX_IOBASE4      0x260
91
92 struct specialix_board {
93         unsigned long   flags;
94         unsigned short  base;
95         unsigned char   irq;
96         //signed   char count;
97         int count;
98         unsigned char   DTR;
99         int reg;
100         spinlock_t lock;
101 };
102
103 #define SX_BOARD_PRESENT        0x00000001
104 #define SX_BOARD_ACTIVE         0x00000002
105 #define SX_BOARD_IS_PCI         0x00000004
106
107
108 struct specialix_port {
109         int                     magic;
110         struct tty_port         port;
111         int                     baud_base;
112         int                     flags;
113         int                     timeout;
114         unsigned char           * xmit_buf;
115         int                     custom_divisor;
116         int                     xmit_head;
117         int                     xmit_tail;
118         int                     xmit_cnt;
119         short                   wakeup_chars;
120         short                   break_length;
121         unsigned char           mark_mask;
122         unsigned char           IER;
123         unsigned char           MSVR;
124         unsigned char           COR2;
125         unsigned long           overrun;
126         unsigned long           hits[10];
127         spinlock_t lock;
128 };
129
130 #endif /* __KERNEL__ */
131 #endif /* __LINUX_SPECIALIX_H */
132
133
134
135
136
137
138
139
140