Portability cleanup as required by Linus.
[linux-2.6/linux-mips.git] / drivers / char / sx.h
blob662b27ca2aa630186011270fa3627c4f7f86643b
2 /*
3 * sx.h
5 * Copyright (C) 1998/1999 R.E.Wolff@BitWizard.nl
7 * SX serial driver.
8 * -- Supports SI, XIO and SX host cards.
9 * -- Supports TAs, MTAs and SXDCs.
11 * Version 1.3 -- March, 1999.
15 #define SX_NBOARDS 4
16 #define SX_PORTSPERBOARD 32
17 #define SX_NPORTS (SX_NBOARDS * SX_PORTSPERBOARD)
19 #ifdef __KERNEL__
21 #define SX_MAGIC 0x12345678
23 struct sx_port {
24 struct gs_port gs;
26 struct tq_struct tqueue;
27 struct tq_struct tqueue_hangup;
29 struct wait_queue *shutdown_wait;
30 int ch_base;
31 int c_dcd;
32 struct sx_board *board;
33 int line;
34 int locks;
37 struct sx_board {
38 int magic;
39 unsigned int base;
40 unsigned int base2;
41 unsigned int hw_base;
42 int eisa_base;
43 int port_base; /* Number of the first port */
44 struct sx_port *ports;
45 int nports;
46 int flags;
47 int irq;
48 int poll;
49 int ta_type;
50 struct timer_list timer;
51 int locks;
54 struct vpd_prom {
55 unsigned short id;
56 char hwrev;
57 char hwass;
58 int uniqid;
59 char myear;
60 char mweek;
61 char hw_feature[5];
62 char oem_id;
63 char identifier[16];
66 #ifndef MOD_RS232DB25MALE
67 #define MOD_RS232DB25MALE 0x0a
68 #endif
70 #define SI_ISA_BOARD 0x00000001
71 #define SX_ISA_BOARD 0x00000002
72 #define SX_PCI_BOARD 0x00000004
73 #define SX_CFPCI_BOARD 0x00000008
74 #define SX_CFISA_BOARD 0x00000010
75 #define SI_EISA_BOARD 0x00000020
77 #define SX_BOARD_PRESENT 0x00001000
78 #define SX_BOARD_INITIALIZED 0x00002000
79 #define SX_IRQ_ALLOCATED 0x00004000
81 #define SX_BOARD_TYPE 0x000000ff
83 #define IS_SX_BOARD(board) (board->flags & (SX_PCI_BOARD | SX_CFPCI_BOARD | \
84 SX_ISA_BOARD | SX_CFISA_BOARD))
86 #define IS_SI_BOARD(board) (board->flags & SI_ISA_BOARD)
88 #define IS_EISA_BOARD(board) (board->flags & SI_EISA_BOARD)
90 #define IS_CF_BOARD(board) (board->flags & (SX_CFISA_BOARD | SX_CFPCI_BOARD))
92 #define SERIAL_TYPE_NORMAL 1
94 /* The SI processor clock is required to calculate the cc_int_count register
95 value for the SI cards. */
96 #define SI_PROCESSOR_CLOCK 25000000
99 /* port flags */
100 /* Make sure these don't clash with gs flags or async flags */
101 #define SX_RX_THROTTLE 0x0000001
105 #define SX_PORT_TRANSMIT_LOCK 0
106 #define SX_BOARD_INTR_LOCK 0
110 /* Debug flags. Add these together to get more debug info. */
112 #define SX_DEBUG_OPEN 0x00000001
113 #define SX_DEBUG_SETTING 0x00000002
114 #define SX_DEBUG_FLOW 0x00000004
115 #define SX_DEBUG_MODEMSIGNALS 0x00000008
116 #define SX_DEBUG_TERMIOS 0x00000010
117 #define SX_DEBUG_TRANSMIT 0x00000020
118 #define SX_DEBUG_RECEIVE 0x00000040
119 #define SX_DEBUG_INTERRUPTS 0x00000080
120 #define SX_DEBUG_PROBE 0x00000100
121 #define SX_DEBUG_INIT 0x00000200
122 #define SX_DEBUG_CLEANUP 0x00000400
123 #define SX_DEBUG_CLOSE 0x00000800
124 #define SX_DEBUG_FIRMWARE 0x00001000
125 #define SX_DEBUG_MEMTEST 0x00002000
127 #define SX_DEBUG_ALL 0xffffffff
130 #define O_OTHER(tty) \
131 ((O_OLCUC(tty)) ||\
132 (O_ONLCR(tty)) ||\
133 (O_OCRNL(tty)) ||\
134 (O_ONOCR(tty)) ||\
135 (O_ONLRET(tty)) ||\
136 (O_OFILL(tty)) ||\
137 (O_OFDEL(tty)) ||\
138 (O_NLDLY(tty)) ||\
139 (O_CRDLY(tty)) ||\
140 (O_TABDLY(tty)) ||\
141 (O_BSDLY(tty)) ||\
142 (O_VTDLY(tty)) ||\
143 (O_FFDLY(tty)))
145 /* Same for input. */
146 #define I_OTHER(tty) \
147 ((I_INLCR(tty)) ||\
148 (I_IGNCR(tty)) ||\
149 (I_ICRNL(tty)) ||\
150 (I_IUCLC(tty)) ||\
151 (L_ISIG(tty)))
153 #define MOD_TA ( TA>>4)
154 #define MOD_MTA (MTA_CD1400>>4)
155 #define MOD_SXDC ( SXDC>>4)
158 /* We copy the download code over to the card in chunks of ... bytes */
159 #define SX_CHUNK_SIZE 128
161 #endif /* __KERNEL__ */
165 /* Specialix document 6210046-11 page 3 */
166 #define SPX(X) (('S'<<24) | ('P' << 16) | (X))
168 /* Specialix-Linux specific IOCTLS. */
169 #define SPXL(X) (SPX(('L' << 8) | (X)))
172 #define SXIO_SET_BOARD SPXL(0x01)
173 #define SXIO_GET_TYPE SPXL(0x02)
174 #define SXIO_DOWNLOAD SPXL(0x03)
175 #define SXIO_INIT SPXL(0x04)
176 #define SXIO_SETDEBUG SPXL(0x05)
177 #define SXIO_GETDEBUG SPXL(0x06)
178 #define SXIO_DO_RAMTEST SPXL(0x07)
179 #define SXIO_SETGSDEBUG SPXL(0x08)
180 #define SXIO_GETGSDEBUG SPXL(0x09)
181 #define SXIO_GETNPORTS SPXL(0x0a)
184 #ifndef SXCTL_MISC_MINOR
185 /* Allow others to gather this into "major.h" or something like that */
186 #define SXCTL_MISC_MINOR 167
187 #endif
189 #ifndef SX_NORMAL_MAJOR
190 /* This allows overriding on the compiler commandline, or in a "major.h"
191 include or something like that */
192 #define SX_NORMAL_MAJOR 32
193 #define SX_CALLOUT_MAJOR 33
194 #endif
197 #define SX_TYPE_SX 0x01
198 #define SX_TYPE_SI 0x02
199 #define SX_TYPE_CF 0x03
202 #define WINDOW_LEN(board) (IS_CF_BOARD(board)?0x20000:SX_WINDOW_LEN)
203 /* Need a #define for ^^^^^^^ !!! */