USB: protect hcd.h from multiple inclusions
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / char / ser_a2232.h
blobbc09eb9e118b1ac04562b60e31ac282193e5f3c0
1 /* drivers/char/ser_a2232.h */
3 /* $Id: ser_a2232.h,v 0.4 2000/01/25 12:00:00 ehaase Exp $ */
5 /* Linux serial driver for the Amiga A2232 board */
7 /* This driver is MAINTAINED. Before applying any changes, please contact
8 * the author.
9 */
11 /* Copyright (c) 2000-2001 Enver Haase <ehaase@inf.fu-berlin.de>
12 * alias The A2232 driver project <A2232@gmx.net>
13 * All rights reserved.
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 #ifndef _SER_A2232_H_
32 #define _SER_A2232_H_
35 How many boards are to be supported at maximum;
36 "up to five A2232 Multiport Serial Cards may be installed in a
37 single Amiga 2000" states the A2232 User's Guide. If you have
38 more slots available, you might want to change the value below.
40 #define MAX_A2232_BOARDS 5
42 #ifndef A2232_NORMAL_MAJOR
43 /* This allows overriding on the compiler commandline, or in a "major.h"
44 include or something like that */
45 #define A2232_NORMAL_MAJOR 224 /* /dev/ttyY* */
46 #define A2232_CALLOUT_MAJOR 225 /* /dev/cuy* */
47 #endif
49 /* Some magic is always good - Who knows :) */
50 #define A2232_MAGIC 0x000a2232
52 /* A2232 port structure to keep track of the
53 status of every single line used */
54 struct a2232_port{
55 struct gs_port gs;
56 unsigned int which_a2232;
57 unsigned int which_port_on_a2232;
58 short disable_rx;
59 short throttle_input;
60 short cd_status;
63 #define NUMLINES 7 /* number of lines per board */
64 #define A2232_IOBUFLEN 256 /* number of bytes per buffer */
65 #define A2232_IOBUFLENMASK 0xff /* mask for maximum number of bytes */
68 #define A2232_UNKNOWN 0 /* crystal not known */
69 #define A2232_NORMAL 1 /* normal A2232 (1.8432 MHz oscillator) */
70 #define A2232_TURBO 2 /* turbo A2232 (3.6864 MHz oscillator) */
73 struct a2232common {
74 char Crystal; /* normal (1) or turbo (2) board? */
75 u_char Pad_a;
76 u_char TimerH; /* timer value after speed check */
77 u_char TimerL;
78 u_char CDHead; /* head pointer for CD message queue */
79 u_char CDTail; /* tail pointer for CD message queue */
80 u_char CDStatus;
81 u_char Pad_b;
84 struct a2232status {
85 u_char InHead; /* input queue head */
86 u_char InTail; /* input queue tail */
87 u_char OutDisable; /* disables output */
88 u_char OutHead; /* output queue head */
89 u_char OutTail; /* output queue tail */
90 u_char OutCtrl; /* soft flow control character to send */
91 u_char OutFlush; /* flushes output buffer */
92 u_char Setup; /* causes reconfiguration */
93 u_char Param; /* parameter byte - see A2232PARAM */
94 u_char Command; /* command byte - see A2232CMD */
95 u_char SoftFlow; /* enables xon/xoff flow control */
96 /* private 65EC02 fields: */
97 u_char XonOff; /* stores XON/XOFF enable/disable */
100 #define A2232_MEMPAD1 \
101 (0x0200 - NUMLINES * sizeof(struct a2232status) - \
102 sizeof(struct a2232common))
103 #define A2232_MEMPAD2 (0x2000 - NUMLINES * A2232_IOBUFLEN - A2232_IOBUFLEN)
105 struct a2232memory {
106 struct a2232status Status[NUMLINES]; /* 0x0000-0x006f status areas */
107 struct a2232common Common; /* 0x0070-0x0077 common flags */
108 u_char Dummy1[A2232_MEMPAD1]; /* 0x00XX-0x01ff */
109 u_char OutBuf[NUMLINES][A2232_IOBUFLEN];/* 0x0200-0x08ff output bufs */
110 u_char InBuf[NUMLINES][A2232_IOBUFLEN]; /* 0x0900-0x0fff input bufs */
111 u_char InCtl[NUMLINES][A2232_IOBUFLEN]; /* 0x1000-0x16ff control data */
112 u_char CDBuf[A2232_IOBUFLEN]; /* 0x1700-0x17ff CD event buffer */
113 u_char Dummy2[A2232_MEMPAD2]; /* 0x1800-0x2fff */
114 u_char Code[0x1000]; /* 0x3000-0x3fff code area */
115 u_short InterruptAck; /* 0x4000 intr ack */
116 u_char Dummy3[0x3ffe]; /* 0x4002-0x7fff */
117 u_short Enable6502Reset; /* 0x8000 Stop board, */
118 /* 6502 RESET line held low */
119 u_char Dummy4[0x3ffe]; /* 0x8002-0xbfff */
120 u_short ResetBoard; /* 0xc000 reset board & run, */
121 /* 6502 RESET line held high */
124 #undef A2232_MEMPAD1
125 #undef A2232_MEMPAD2
127 #define A2232INCTL_CHAR 0 /* corresponding byte in InBuf is a character */
128 #define A2232INCTL_EVENT 1 /* corresponding byte in InBuf is an event */
130 #define A2232EVENT_Break 1 /* break set */
131 #define A2232EVENT_CarrierOn 2 /* carrier raised */
132 #define A2232EVENT_CarrierOff 3 /* carrier dropped */
133 #define A2232EVENT_Sync 4 /* don't know, defined in 2232.ax */
135 #define A2232CMD_Enable 0x1 /* enable/DTR bit */
136 #define A2232CMD_Close 0x2 /* close the device */
137 #define A2232CMD_Open 0xb /* open the device */
138 #define A2232CMD_CMask 0xf /* command mask */
139 #define A2232CMD_RTSOff 0x0 /* turn off RTS */
140 #define A2232CMD_RTSOn 0x8 /* turn on RTS */
141 #define A2232CMD_Break 0xd /* transmit a break */
142 #define A2232CMD_RTSMask 0xc /* mask for RTS stuff */
143 #define A2232CMD_NoParity 0x00 /* don't use parity */
144 #define A2232CMD_OddParity 0x20 /* odd parity */
145 #define A2232CMD_EvenParity 0x60 /* even parity */
146 #define A2232CMD_ParityMask 0xe0 /* parity mask */
148 #define A2232PARAM_B115200 0x0 /* baud rates */
149 #define A2232PARAM_B50 0x1
150 #define A2232PARAM_B75 0x2
151 #define A2232PARAM_B110 0x3
152 #define A2232PARAM_B134 0x4
153 #define A2232PARAM_B150 0x5
154 #define A2232PARAM_B300 0x6
155 #define A2232PARAM_B600 0x7
156 #define A2232PARAM_B1200 0x8
157 #define A2232PARAM_B1800 0x9
158 #define A2232PARAM_B2400 0xa
159 #define A2232PARAM_B3600 0xb
160 #define A2232PARAM_B4800 0xc
161 #define A2232PARAM_B7200 0xd
162 #define A2232PARAM_B9600 0xe
163 #define A2232PARAM_B19200 0xf
164 #define A2232PARAM_BaudMask 0xf /* baud rate mask */
165 #define A2232PARAM_RcvBaud 0x10 /* enable receive baud rate */
166 #define A2232PARAM_8Bit 0x00 /* numbers of bits */
167 #define A2232PARAM_7Bit 0x20
168 #define A2232PARAM_6Bit 0x40
169 #define A2232PARAM_5Bit 0x60
170 #define A2232PARAM_BitMask 0x60 /* numbers of bits mask */
173 /* Standard speeds tables, -1 means unavailable, -2 means 0 baud: switch off line */
174 #define A2232_BAUD_TABLE_NOAVAIL -1
175 #define A2232_BAUD_TABLE_NUM_RATES (18)
176 static int a2232_baud_table[A2232_BAUD_TABLE_NUM_RATES*3] = {
177 //Baud //Normal //Turbo
178 50, A2232PARAM_B50, A2232_BAUD_TABLE_NOAVAIL,
179 75, A2232PARAM_B75, A2232_BAUD_TABLE_NOAVAIL,
180 110, A2232PARAM_B110, A2232_BAUD_TABLE_NOAVAIL,
181 134, A2232PARAM_B134, A2232_BAUD_TABLE_NOAVAIL,
182 150, A2232PARAM_B150, A2232PARAM_B75,
183 200, A2232_BAUD_TABLE_NOAVAIL, A2232_BAUD_TABLE_NOAVAIL,
184 300, A2232PARAM_B300, A2232PARAM_B150,
185 600, A2232PARAM_B600, A2232PARAM_B300,
186 1200, A2232PARAM_B1200, A2232PARAM_B600,
187 1800, A2232PARAM_B1800, A2232_BAUD_TABLE_NOAVAIL,
188 2400, A2232PARAM_B2400, A2232PARAM_B1200,
189 4800, A2232PARAM_B4800, A2232PARAM_B2400,
190 9600, A2232PARAM_B9600, A2232PARAM_B4800,
191 19200, A2232PARAM_B19200, A2232PARAM_B9600,
192 38400, A2232_BAUD_TABLE_NOAVAIL, A2232PARAM_B19200,
193 57600, A2232_BAUD_TABLE_NOAVAIL, A2232_BAUD_TABLE_NOAVAIL,
194 #ifdef A2232_SPEEDHACK
195 115200, A2232PARAM_B115200, A2232_BAUD_TABLE_NOAVAIL,
196 230400, A2232_BAUD_TABLE_NOAVAIL, A2232PARAM_B115200
197 #else
198 115200, A2232_BAUD_TABLE_NOAVAIL, A2232_BAUD_TABLE_NOAVAIL,
199 230400, A2232_BAUD_TABLE_NOAVAIL, A2232_BAUD_TABLE_NOAVAIL
200 #endif
202 #endif