More Makefile cleanups, otherwise mainly noticeable are the netfilter fix
[davej-history.git] / include / linux / isicom.h
blob670d72f4eb6611e117ef96224efdee5a04f6471c
1 #ifndef _LINUX_ISICOM_H
2 #define _LINUX_ISICOM_H
4 /*#define ISICOM_DEBUG*/
5 /*#define ISICOM_DEBUG_DTR_RTS*/
8 /*
9 * Firmware Loader definitions ...
12 #define __MultiTech ('M'<<8)
13 #define MIOCTL_LOAD_FIRMWARE (__MultiTech | 0x01)
14 #define MIOCTL_READ_FIRMWARE (__MultiTech | 0x02)
15 #define MIOCTL_XFER_CTRL (__MultiTech | 0x03)
16 #define MIOCTL_RESET_CARD (__MultiTech | 0x04)
18 #define DATA_SIZE 16
20 typedef struct {
21 unsigned short exec_segment;
22 unsigned short exec_addr;
23 } exec_record;
25 typedef struct {
26 int board; /* Board to load */
27 unsigned short addr;
28 unsigned short count;
29 } bin_header;
31 typedef struct {
32 int board; /* Board to load */
33 unsigned short addr;
34 unsigned short count;
35 unsigned short segment;
36 unsigned char bin_data[DATA_SIZE];
37 } bin_frame;
39 #ifdef __KERNEL__
41 #define YES 1
42 #define NO 0
44 #define ISILOAD_MISC_MINOR 155 /* /dev/isctl */
45 #define ISILOAD_NAME "ISILoad"
47 /*
48 * ISICOM Driver definitions ...
52 #define ISICOM_NAME "ISICom"
55 * PCI definitions
58 #define DEVID_COUNT 9
59 #define VENDOR_ID 0x10b5
62 * These are now officially allocated numbers
65 #define ISICOM_NMAJOR 112 /* normal */
66 #define ISICOM_CMAJOR 113 /* callout */
67 #define ISICOM_MAGIC (('M' << 8) | 'T')
69 #define WAKEUP_CHARS 256 /* hard coded for now */
70 #define TX_SIZE 254
72 #define BOARD_COUNT 4
73 #define PORT_COUNT (BOARD_COUNT*16)
75 #define SERIAL_TYPE_NORMAL 1
76 #define SERIAL_TYPE_CALLOUT 2
78 /* character sizes */
80 #define ISICOM_CS5 0x0000
81 #define ISICOM_CS6 0x0001
82 #define ISICOM_CS7 0x0002
83 #define ISICOM_CS8 0x0003
85 /* stop bits */
87 #define ISICOM_1SB 0x0000
88 #define ISICOM_2SB 0x0004
90 /* parity */
92 #define ISICOM_NOPAR 0x0000
93 #define ISICOM_ODPAR 0x0008
94 #define ISICOM_EVPAR 0x0018
96 /* flow control */
98 #define ISICOM_CTSRTS 0x03
99 #define ISICOM_INITIATE_XONXOFF 0x04
100 #define ISICOM_RESPOND_XONXOFF 0x08
102 #define InterruptTheCard(base) (outw(0,(base)+0xc))
103 #define ClearInterrupt(base) (inw((base)+0x0a))
105 #define BOARD(line) (((line) >> 4) & 0x3)
106 #define MIN(a, b) ( (a) < (b) ? (a) : (b) )
108 /* isi kill queue bitmap */
110 #define ISICOM_KILLTX 0x01
111 #define ISICOM_KILLRX 0x02
113 /* isi_board status bitmap */
115 #define FIRMWARE_LOADED 0x0001
116 #define BOARD_ACTIVE 0x0002
118 /* isi_port status bitmap */
120 #define ISI_CTS 0x1000
121 #define ISI_DSR 0x2000
122 #define ISI_RI 0x4000
123 #define ISI_DCD 0x8000
124 #define ISI_DTR 0x0100
125 #define ISI_RTS 0x0200
128 #define ISI_TXOK 0x0001
130 struct isi_board {
131 unsigned short base;
132 unsigned char irq;
133 unsigned char port_count;
134 unsigned short status;
135 unsigned short port_status; /* each bit represents a single port */
136 unsigned short shift_count;
137 struct isi_port * ports;
138 signed char count;
139 unsigned char isa;
142 struct isi_port {
143 unsigned short magic;
144 unsigned int flags;
145 int count;
146 int blocked_open;
147 int close_delay;
148 unsigned short channel;
149 unsigned short status;
150 unsigned short closing_wait;
151 long session;
152 long pgrp;
153 struct isi_board * card;
154 struct tty_struct * tty;
155 wait_queue_head_t close_wait;
156 wait_queue_head_t open_wait;
157 struct tq_struct hangup_tq;
158 struct tq_struct bh_tqueue;
159 unsigned char * xmit_buf;
160 int xmit_head;
161 int xmit_tail;
162 int xmit_cnt;
163 struct termios normal_termios;
164 struct termios callout_termios;
169 * ISI Card specific ops ...
172 extern inline void raise_dtr(struct isi_port * port)
174 struct isi_board * card = port->card;
175 unsigned short base = card->base;
176 unsigned char channel = port->channel;
177 short wait=400;
178 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
179 if (wait <= 0) {
180 printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr.\n");
181 return;
183 #ifdef ISICOM_DEBUG_DTR_RTS
184 printk(KERN_DEBUG "ISICOM: raise_dtr.\n");
185 #endif
186 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
187 outw(0x0504, base);
188 InterruptTheCard(base);
189 port->status |= ISI_DTR;
192 extern inline void drop_dtr(struct isi_port * port)
194 struct isi_board * card = port->card;
195 unsigned short base = card->base;
196 unsigned char channel = port->channel;
197 short wait=400;
198 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
199 if (wait <= 0) {
200 printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr.\n");
201 return;
203 #ifdef ISICOM_DEBUG_DTR_RTS
204 printk(KERN_DEBUG "ISICOM: drop_dtr.\n");
205 #endif
206 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
207 outw(0x0404, base);
208 InterruptTheCard(base);
209 port->status &= ~ISI_DTR;
211 extern inline void raise_rts(struct isi_port * port)
213 struct isi_board * card = port->card;
214 unsigned short base = card->base;
215 unsigned char channel = port->channel;
216 short wait=400;
217 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
218 if (wait <= 0) {
219 printk(KERN_WARNING "ISICOM: Card found busy in raise_rts.\n");
220 return;
222 #ifdef ISICOM_DEBUG_DTR_RTS
223 printk(KERN_DEBUG "ISICOM: raise_rts.\n");
224 #endif
225 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
226 outw(0x0a04, base);
227 InterruptTheCard(base);
228 port->status |= ISI_RTS;
230 extern inline void drop_rts(struct isi_port * port)
232 struct isi_board * card = port->card;
233 unsigned short base = card->base;
234 unsigned char channel = port->channel;
235 short wait=400;
236 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
237 if (wait <= 0) {
238 printk(KERN_WARNING "ISICOM: Card found busy in drop_rts.\n");
239 return;
241 #ifdef ISICOM_DEBUG_DTR_RTS
242 printk(KERN_DEBUG "ISICOM: drop_rts.\n");
243 #endif
244 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
245 outw(0x0804, base);
246 InterruptTheCard(base);
247 port->status &= ~ISI_RTS;
249 extern inline void raise_dtr_rts(struct isi_port * port)
251 struct isi_board * card = port->card;
252 unsigned short base = card->base;
253 unsigned char channel = port->channel;
254 short wait=400;
255 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
256 if (wait <= 0) {
257 printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr_rts.\n");
258 return;
260 #ifdef ISICOM_DEBUG_DTR_RTS
261 printk(KERN_DEBUG "ISICOM: raise_dtr_rts.\n");
262 #endif
263 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
264 outw(0x0f04, base);
265 InterruptTheCard(base);
266 port->status |= (ISI_DTR | ISI_RTS);
268 extern inline void drop_dtr_rts(struct isi_port * port)
270 struct isi_board * card = port->card;
271 unsigned short base = card->base;
272 unsigned char channel = port->channel;
273 short wait=400;
274 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
275 if (wait <= 0) {
276 printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr_rts.\n");
277 return;
279 #ifdef ISICOM_DEBUG_DTR_RTS
280 printk(KERN_DEBUG "ISICOM: drop_dtr_rts.\n");
281 #endif
282 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
283 outw(0x0c04, base);
284 InterruptTheCard(base);
285 port->status &= ~(ISI_RTS | ISI_DTR);
288 extern inline void kill_queue(struct isi_port * port, short queue)
290 struct isi_board * card = port->card;
291 unsigned short base = card->base;
292 unsigned char channel = port->channel;
293 short wait=400;
294 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
295 if (wait <= 0) {
296 printk(KERN_WARNING "ISICOM: Card found busy in kill_queue.\n");
297 return;
299 #ifdef ISICOM_DEBUG
300 printk(KERN_DEBUG "ISICOM: kill_queue 0x%x.\n", queue);
301 #endif
302 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
303 outw((queue << 8) | 0x06, base);
304 InterruptTheCard(base);
307 #endif /* __KERNEL__ */
309 #endif /* ISICOM_H */