pre-2.3.4..
[davej-history.git] / include / linux / isicom.h
blob7f929b8950486e97029dc1463d60b3ccc9878ef5
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 * These are now officially allocated numbers
58 #define ISICOM_NMAJOR 112 /* normal */
59 #define ISICOM_CMAJOR 113 /* callout */
60 #define ISICOM_MAGIC (('M' << 8) | 'T')
62 #define WAKEUP_CHARS 256 /* hard coded for now */
63 #define TX_SIZE 254
65 #define BOARD_COUNT 4
66 #define PORT_COUNT (BOARD_COUNT*16)
68 #define SERIAL_TYPE_NORMAL 1
69 #define SERIAL_TYPE_CALLOUT 2
71 /* character sizes */
73 #define ISICOM_CS5 0x0000
74 #define ISICOM_CS6 0x0001
75 #define ISICOM_CS7 0x0002
76 #define ISICOM_CS8 0x0003
78 /* stop bits */
80 #define ISICOM_1SB 0x0000
81 #define ISICOM_2SB 0x0004
83 /* parity */
85 #define ISICOM_NOPAR 0x0000
86 #define ISICOM_ODPAR 0x0008
87 #define ISICOM_EVPAR 0x0018
89 /* flow control */
91 #define ISICOM_CTSRTS 0x03
92 #define ISICOM_INITIATE_XONXOFF 0x04
93 #define ISICOM_RESPOND_XONXOFF 0x08
95 #define InterruptTheCard(base) (outw(0,(base)+0xc))
96 #define ClearInterrupt(base) (inw((base)+0x0a))
98 #define BOARD(line) (((line) >> 4) & 0x3)
99 #define MIN(a, b) ( (a) < (b) ? (a) : (b) )
101 /* isi kill queue bitmap */
103 #define ISICOM_KILLTX 0x01
104 #define ISICOM_KILLRX 0x02
106 /* isi_board status bitmap */
108 #define FIRMWARE_LOADED 0x0001
109 #define BOARD_ACTIVE 0x0002
111 /* isi_port status bitmap */
113 #define ISI_CTS 0x1000
114 #define ISI_DSR 0x2000
115 #define ISI_RI 0x4000
116 #define ISI_DCD 0x8000
117 #define ISI_DTR 0x0100
118 #define ISI_RTS 0x0200
121 #define ISI_TXOK 0x0001
123 struct isi_board {
124 unsigned short base;
125 unsigned char irq;
126 unsigned char port_count;
127 unsigned short status;
128 unsigned short port_status; /* each bit represents a single port */
129 unsigned short shift_count;
130 struct isi_port * ports;
131 signed char count;
134 struct isi_port {
135 unsigned short magic;
136 unsigned int flags;
137 int count;
138 int blocked_open;
139 int close_delay;
140 unsigned short channel;
141 unsigned short status;
142 unsigned short closing_wait;
143 long session;
144 long pgrp;
145 struct isi_board * card;
146 struct tty_struct * tty;
147 wait_queue_head_t close_wait;
148 wait_queue_head_t open_wait;
149 struct tq_struct hangup_tq;
150 struct tq_struct bh_tqueue;
151 unsigned char * xmit_buf;
152 int xmit_head;
153 int xmit_tail;
154 int xmit_cnt;
155 struct termios normal_termios;
156 struct termios callout_termios;
161 * ISI Card specific ops ...
164 extern inline void raise_dtr(struct isi_port * port)
166 struct isi_board * card = port->card;
167 unsigned short base = card->base;
168 unsigned char channel = port->channel;
169 short wait=300;
170 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
171 if (wait <= 0) {
172 printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr.\n");
173 return;
175 #ifdef ISICOM_DEBUG_DTR_RTS
176 printk(KERN_DEBUG "ISICOM: raise_dtr.\n");
177 #endif
178 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
179 outw(0x0504, base);
180 InterruptTheCard(base);
181 port->status |= ISI_DTR;
184 extern inline void drop_dtr(struct isi_port * port)
186 struct isi_board * card = port->card;
187 unsigned short base = card->base;
188 unsigned char channel = port->channel;
189 short wait=300;
190 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
191 if (wait <= 0) {
192 printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr.\n");
193 return;
195 #ifdef ISICOM_DEBUG_DTR_RTS
196 printk(KERN_DEBUG "ISICOM: drop_dtr.\n");
197 #endif
198 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
199 outw(0x0404, base);
200 InterruptTheCard(base);
201 port->status &= ~ISI_DTR;
203 extern inline void raise_rts(struct isi_port * port)
205 struct isi_board * card = port->card;
206 unsigned short base = card->base;
207 unsigned char channel = port->channel;
208 short wait=300;
209 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
210 if (wait <= 0) {
211 printk(KERN_WARNING "ISICOM: Card found busy in raise_rts.\n");
212 return;
214 #ifdef ISICOM_DEBUG_DTR_RTS
215 printk(KERN_DEBUG "ISICOM: raise_rts.\n");
216 #endif
217 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
218 outw(0x0a04, base);
219 InterruptTheCard(base);
220 port->status |= ISI_RTS;
222 extern inline void drop_rts(struct isi_port * port)
224 struct isi_board * card = port->card;
225 unsigned short base = card->base;
226 unsigned char channel = port->channel;
227 short wait=300;
228 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
229 if (wait <= 0) {
230 printk(KERN_WARNING "ISICOM: Card found busy in drop_rts.\n");
231 return;
233 #ifdef ISICOM_DEBUG_DTR_RTS
234 printk(KERN_DEBUG "ISICOM: drop_rts.\n");
235 #endif
236 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
237 outw(0x0804, base);
238 InterruptTheCard(base);
239 port->status &= ~ISI_RTS;
241 extern inline void raise_dtr_rts(struct isi_port * port)
243 struct isi_board * card = port->card;
244 unsigned short base = card->base;
245 unsigned char channel = port->channel;
246 short wait=300;
247 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
248 if (wait <= 0) {
249 printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr_rts.\n");
250 return;
252 #ifdef ISICOM_DEBUG_DTR_RTS
253 printk(KERN_DEBUG "ISICOM: raise_dtr_rts.\n");
254 #endif
255 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
256 outw(0x0f04, base);
257 InterruptTheCard(base);
258 port->status |= (ISI_DTR | ISI_RTS);
260 extern inline void drop_dtr_rts(struct isi_port * port)
262 struct isi_board * card = port->card;
263 unsigned short base = card->base;
264 unsigned char channel = port->channel;
265 short wait=300;
266 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
267 if (wait <= 0) {
268 printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr_rts.\n");
269 return;
271 #ifdef ISICOM_DEBUG_DTR_RTS
272 printk(KERN_DEBUG "ISICOM: drop_dtr_rts.\n");
273 #endif
274 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
275 outw(0x0c04, base);
276 InterruptTheCard(base);
277 port->status &= ~(ISI_RTS | ISI_DTR);
280 extern inline void kill_queue(struct isi_port * port, short queue)
282 struct isi_board * card = port->card;
283 unsigned short base = card->base;
284 unsigned char channel = port->channel;
285 short wait=300;
286 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
287 if (wait <= 0) {
288 printk(KERN_WARNING "ISICOM: Card found busy in kill_queue.\n");
289 return;
291 #ifdef ISICOM_DEBUG
292 printk(KERN_DEBUG "ISICOM: kill_queue 0x%x.\n", queue);
293 #endif
294 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
295 outw((queue << 8) | 0x06, base);
296 InterruptTheCard(base);
299 #endif /* __KERNEL__ */
301 #endif /* ISICOM_H */