1 #ifndef _LINUX_ISICOM_H
2 #define _LINUX_ISICOM_H
4 /*#define ISICOM_DEBUG*/
5 /*#define ISICOM_DEBUG_DTR_RTS*/
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)
21 unsigned short exec_segment
;
22 unsigned short exec_addr
;
26 int board
; /* Board to load */
32 int board
; /* Board to load */
35 unsigned short segment
;
36 unsigned char bin_data
[DATA_SIZE
];
44 #define ISILOAD_MISC_MINOR 155 /* /dev/isctl */
45 #define ISILOAD_NAME "ISILoad"
48 * ISICOM Driver definitions ...
52 #define ISICOM_NAME "ISICom"
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 */
73 #define PORT_COUNT (BOARD_COUNT*16)
75 #define SERIAL_TYPE_NORMAL 1
76 #define SERIAL_TYPE_CALLOUT 2
80 #define ISICOM_CS5 0x0000
81 #define ISICOM_CS6 0x0001
82 #define ISICOM_CS7 0x0002
83 #define ISICOM_CS8 0x0003
87 #define ISICOM_1SB 0x0000
88 #define ISICOM_2SB 0x0004
92 #define ISICOM_NOPAR 0x0000
93 #define ISICOM_ODPAR 0x0008
94 #define ISICOM_EVPAR 0x0018
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
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
;
143 unsigned short magic
;
148 unsigned short channel
;
149 unsigned short status
;
150 unsigned short closing_wait
;
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
;
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
;
178 while(((inw(base
+0x0e) & 0x01) == 0) && (wait
-- > 0));
180 printk(KERN_WARNING
"ISICOM: Card found busy in raise_dtr.\n");
183 #ifdef ISICOM_DEBUG_DTR_RTS
184 printk(KERN_DEBUG
"ISICOM: raise_dtr.\n");
186 outw(0x8000 | (channel
<< card
->shift_count
) | 0x02 , 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
;
198 while(((inw(base
+0x0e) & 0x01) == 0) && (wait
-- > 0));
200 printk(KERN_WARNING
"ISICOM: Card found busy in drop_dtr.\n");
203 #ifdef ISICOM_DEBUG_DTR_RTS
204 printk(KERN_DEBUG
"ISICOM: drop_dtr.\n");
206 outw(0x8000 | (channel
<< card
->shift_count
) | 0x02 , 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
;
217 while(((inw(base
+0x0e) & 0x01) == 0) && (wait
-- > 0));
219 printk(KERN_WARNING
"ISICOM: Card found busy in raise_rts.\n");
222 #ifdef ISICOM_DEBUG_DTR_RTS
223 printk(KERN_DEBUG
"ISICOM: raise_rts.\n");
225 outw(0x8000 | (channel
<< card
->shift_count
) | 0x02 , 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
;
236 while(((inw(base
+0x0e) & 0x01) == 0) && (wait
-- > 0));
238 printk(KERN_WARNING
"ISICOM: Card found busy in drop_rts.\n");
241 #ifdef ISICOM_DEBUG_DTR_RTS
242 printk(KERN_DEBUG
"ISICOM: drop_rts.\n");
244 outw(0x8000 | (channel
<< card
->shift_count
) | 0x02 , 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
;
255 while(((inw(base
+0x0e) & 0x01) == 0) && (wait
-- > 0));
257 printk(KERN_WARNING
"ISICOM: Card found busy in raise_dtr_rts.\n");
260 #ifdef ISICOM_DEBUG_DTR_RTS
261 printk(KERN_DEBUG
"ISICOM: raise_dtr_rts.\n");
263 outw(0x8000 | (channel
<< card
->shift_count
) | 0x02 , 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
;
274 while(((inw(base
+0x0e) & 0x01) == 0) && (wait
-- > 0));
276 printk(KERN_WARNING
"ISICOM: Card found busy in drop_dtr_rts.\n");
279 #ifdef ISICOM_DEBUG_DTR_RTS
280 printk(KERN_DEBUG
"ISICOM: drop_dtr_rts.\n");
282 outw(0x8000 | (channel
<< card
->shift_count
) | 0x02 , 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
;
294 while(((inw(base
+0x0e) & 0x01) == 0) && (wait
-- > 0));
296 printk(KERN_WARNING
"ISICOM: Card found busy in kill_queue.\n");
300 printk(KERN_DEBUG
"ISICOM: kill_queue 0x%x.\n", queue
);
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 */