[PATCH] some more av7110 dvb-driver updates
[linux-2.6/history.git] / include / linux / isicom.h
blobc243832159789067c263aee17cc4dccf6c8acc7a
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 struct isi_board * card;
152 struct tty_struct * tty;
153 wait_queue_head_t close_wait;
154 wait_queue_head_t open_wait;
155 struct work_struct hangup_tq;
156 struct work_struct bh_tqueue;
157 unsigned char * xmit_buf;
158 int xmit_head;
159 int xmit_tail;
160 int xmit_cnt;
165 * ISI Card specific ops ...
168 static inline void raise_dtr(struct isi_port * port)
170 struct isi_board * card = port->card;
171 unsigned short base = card->base;
172 unsigned char channel = port->channel;
173 short wait=400;
174 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
175 if (wait <= 0) {
176 printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr.\n");
177 return;
179 #ifdef ISICOM_DEBUG_DTR_RTS
180 printk(KERN_DEBUG "ISICOM: raise_dtr.\n");
181 #endif
182 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
183 outw(0x0504, base);
184 InterruptTheCard(base);
185 port->status |= ISI_DTR;
188 static inline void drop_dtr(struct isi_port * port)
190 struct isi_board * card = port->card;
191 unsigned short base = card->base;
192 unsigned char channel = port->channel;
193 short wait=400;
194 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
195 if (wait <= 0) {
196 printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr.\n");
197 return;
199 #ifdef ISICOM_DEBUG_DTR_RTS
200 printk(KERN_DEBUG "ISICOM: drop_dtr.\n");
201 #endif
202 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
203 outw(0x0404, base);
204 InterruptTheCard(base);
205 port->status &= ~ISI_DTR;
207 static inline void raise_rts(struct isi_port * port)
209 struct isi_board * card = port->card;
210 unsigned short base = card->base;
211 unsigned char channel = port->channel;
212 short wait=400;
213 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
214 if (wait <= 0) {
215 printk(KERN_WARNING "ISICOM: Card found busy in raise_rts.\n");
216 return;
218 #ifdef ISICOM_DEBUG_DTR_RTS
219 printk(KERN_DEBUG "ISICOM: raise_rts.\n");
220 #endif
221 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
222 outw(0x0a04, base);
223 InterruptTheCard(base);
224 port->status |= ISI_RTS;
226 static inline void drop_rts(struct isi_port * port)
228 struct isi_board * card = port->card;
229 unsigned short base = card->base;
230 unsigned char channel = port->channel;
231 short wait=400;
232 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
233 if (wait <= 0) {
234 printk(KERN_WARNING "ISICOM: Card found busy in drop_rts.\n");
235 return;
237 #ifdef ISICOM_DEBUG_DTR_RTS
238 printk(KERN_DEBUG "ISICOM: drop_rts.\n");
239 #endif
240 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
241 outw(0x0804, base);
242 InterruptTheCard(base);
243 port->status &= ~ISI_RTS;
245 static inline void raise_dtr_rts(struct isi_port * port)
247 struct isi_board * card = port->card;
248 unsigned short base = card->base;
249 unsigned char channel = port->channel;
250 short wait=400;
251 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
252 if (wait <= 0) {
253 printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr_rts.\n");
254 return;
256 #ifdef ISICOM_DEBUG_DTR_RTS
257 printk(KERN_DEBUG "ISICOM: raise_dtr_rts.\n");
258 #endif
259 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
260 outw(0x0f04, base);
261 InterruptTheCard(base);
262 port->status |= (ISI_DTR | ISI_RTS);
264 static inline void drop_dtr_rts(struct isi_port * port)
266 struct isi_board * card = port->card;
267 unsigned short base = card->base;
268 unsigned char channel = port->channel;
269 short wait=400;
270 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
271 if (wait <= 0) {
272 printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr_rts.\n");
273 return;
275 #ifdef ISICOM_DEBUG_DTR_RTS
276 printk(KERN_DEBUG "ISICOM: drop_dtr_rts.\n");
277 #endif
278 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
279 outw(0x0c04, base);
280 InterruptTheCard(base);
281 port->status &= ~(ISI_RTS | ISI_DTR);
284 static inline void kill_queue(struct isi_port * port, short queue)
286 struct isi_board * card = port->card;
287 unsigned short base = card->base;
288 unsigned char channel = port->channel;
289 short wait=400;
290 while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
291 if (wait <= 0) {
292 printk(KERN_WARNING "ISICOM: Card found busy in kill_queue.\n");
293 return;
295 #ifdef ISICOM_DEBUG
296 printk(KERN_DEBUG "ISICOM: kill_queue 0x%x.\n", queue);
297 #endif
298 outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
299 outw((queue << 8) | 0x06, base);
300 InterruptTheCard(base);
303 #endif /* __KERNEL__ */
305 #endif /* ISICOM_H */