aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ser_a2232.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/char/ser_a2232.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/char/ser_a2232.h')
-rw-r--r--drivers/char/ser_a2232.h202
1 files changed, 202 insertions, 0 deletions
diff --git a/drivers/char/ser_a2232.h b/drivers/char/ser_a2232.h
new file mode 100644
index 000000000000..bc09eb9e118b
--- /dev/null
+++ b/drivers/char/ser_a2232.h
@@ -0,0 +1,202 @@
1/* drivers/char/ser_a2232.h */
2
3/* $Id: ser_a2232.h,v 0.4 2000/01/25 12:00:00 ehaase Exp $ */
4
5/* Linux serial driver for the Amiga A2232 board */
6
7/* This driver is MAINTAINED. Before applying any changes, please contact
8 * the author.
9 */
10
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.
14 *
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.
19 *
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.
24 *
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.
28 *
29 */
30
31#ifndef _SER_A2232_H_
32#define _SER_A2232_H_
33
34/*
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.
39*/
40#define MAX_A2232_BOARDS 5
41
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
48
49/* Some magic is always good - Who knows :) */
50#define A2232_MAGIC 0x000a2232
51
52/* A2232 port structure to keep track of the
53 status of every single line used */
54struct 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;
61};
62
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 */
66
67
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) */
71
72
73struct 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;
82};
83
84struct 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 */
98};
99
100#define A2232_MEMPAD1 \
101 (0x0200 - NUMLINES * sizeof(struct a2232status) - \
102 sizeof(struct a2232common))
103#define A2232_MEMPAD2 (0x2000 - NUMLINES * A2232_IOBUFLEN - A2232_IOBUFLEN)
104
105struct 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 */
122};
123
124#undef A2232_MEMPAD1
125#undef A2232_MEMPAD2
126
127#define A2232INCTL_CHAR 0 /* corresponding byte in InBuf is a character */
128#define A2232INCTL_EVENT 1 /* corresponding byte in InBuf is an event */
129
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 */
134
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 */
147
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 */
171
172
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)
176static 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
201};
202#endif