Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 1 | #ifndef _LINUX_ISICOM_H |
2 | #define _LINUX_ISICOM_H |
||
3 | |||
4 | /*#define ISICOM_DEBUG*/ |
||
5 | /*#define ISICOM_DEBUG_DTR_RTS*/ |
||
6 | |||
7 | |||
8 | /* |
||
9 | * Firmware Loader definitions ... |
||
10 | */ |
||
11 | |||
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) |
||
17 | |||
18 | #define DATA_SIZE 16 |
||
19 | |||
20 | typedef struct { |
||
21 | unsigned short exec_segment; |
||
22 | unsigned short exec_addr; |
||
23 | } exec_record; |
||
24 | |||
25 | typedef struct { |
||
26 | int board; /* Board to load */ |
||
27 | unsigned short addr; |
||
28 | unsigned short count; |
||
29 | } bin_header; |
||
30 | |||
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; |
||
38 | |||
39 | #ifdef __KERNEL__ |
||
40 | |||
41 | #define YES 1 |
||
42 | #define NO 0 |
||
43 | |||
44 | #define ISILOAD_MISC_MINOR 155 /* /dev/isctl */ |
||
45 | #define ISILOAD_NAME "ISILoad" |
||
46 | |||
47 | /* |
||
48 | * ISICOM Driver definitions ... |
||
49 | * |
||
50 | */ |
||
51 | |||
52 | #define ISICOM_NAME "ISICom" |
||
53 | |||
54 | /* |
||
55 | * PCI definitions |
||
56 | */ |
||
57 | |||
58 | #define DEVID_COUNT 9 |
||
59 | #define VENDOR_ID 0x10b5 |
||
60 | |||
61 | /* |
||
62 | * These are now officially allocated numbers |
||
63 | */ |
||
64 | |||
65 | #define ISICOM_NMAJOR 112 /* normal */ |
||
66 | #define ISICOM_CMAJOR 113 /* callout */ |
||
67 | #define ISICOM_MAGIC (('M' << 8) | 'T') |
||
68 | |||
69 | #define WAKEUP_CHARS 256 /* hard coded for now */ |
||
70 | #define TX_SIZE 254 |
||
71 | |||
72 | #define BOARD_COUNT 4 |
||
73 | #define PORT_COUNT (BOARD_COUNT*16) |
||
74 | |||
75 | #define SERIAL_TYPE_NORMAL 1 |
||
76 | #define SERIAL_TYPE_CALLOUT 2 |
||
77 | |||
78 | /* character sizes */ |
||
79 | |||
80 | #define ISICOM_CS5 0x0000 |
||
81 | #define ISICOM_CS6 0x0001 |
||
82 | #define ISICOM_CS7 0x0002 |
||
83 | #define ISICOM_CS8 0x0003 |
||
84 | |||
85 | /* stop bits */ |
||
86 | |||
87 | #define ISICOM_1SB 0x0000 |
||
88 | #define ISICOM_2SB 0x0004 |
||
89 | |||
90 | /* parity */ |
||
91 | |||
92 | #define ISICOM_NOPAR 0x0000 |
||
93 | #define ISICOM_ODPAR 0x0008 |
||
94 | #define ISICOM_EVPAR 0x0018 |
||
95 | |||
96 | /* flow control */ |
||
97 | |||
98 | #define ISICOM_CTSRTS 0x03 |
||
99 | #define ISICOM_INITIATE_XONXOFF 0x04 |
||
100 | #define ISICOM_RESPOND_XONXOFF 0x08 |
||
101 | |||
102 | #define InterruptTheCard(base) (outw(0,(base)+0xc)) |
||
103 | #define ClearInterrupt(base) (inw((base)+0x0a)) |
||
104 | |||
105 | #define BOARD(line) (((line) >> 4) & 0x3) |
||
106 | #define MIN(a, b) ( (a) < (b) ? (a) : (b) ) |
||
107 | |||
108 | /* isi kill queue bitmap */ |
||
109 | |||
110 | #define ISICOM_KILLTX 0x01 |
||
111 | #define ISICOM_KILLRX 0x02 |
||
112 | |||
113 | /* isi_board status bitmap */ |
||
114 | |||
115 | #define FIRMWARE_LOADED 0x0001 |
||
116 | #define BOARD_ACTIVE 0x0002 |
||
117 | |||
118 | /* isi_port status bitmap */ |
||
119 | |||
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 |
||
126 | |||
127 | |||
128 | #define ISI_TXOK 0x0001 |
||
129 | |||
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; |
||
140 | }; |
||
141 | |||
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; |
||
161 | }; |
||
162 | |||
163 | |||
164 | /* |
||
165 | * ISI Card specific ops ... |
||
166 | */ |
||
167 | |||
168 | static inline void raise_dtr(struct isi_port * port) |
||
169 | { |
||
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; |
||
178 | } |
||
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; |
||
186 | } |
||
187 | |||
188 | static inline void drop_dtr(struct isi_port * port) |
||
189 | { |
||
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; |
||
198 | } |
||
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; |
||
206 | } |
||
207 | static inline void raise_rts(struct isi_port * port) |
||
208 | { |
||
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; |
||
217 | } |
||
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; |
||
225 | } |
||
226 | static inline void drop_rts(struct isi_port * port) |
||
227 | { |
||
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; |
||
236 | } |
||
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; |
||
244 | } |
||
245 | static inline void raise_dtr_rts(struct isi_port * port) |
||
246 | { |
||
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; |
||
255 | } |
||
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); |
||
263 | } |
||
264 | static inline void drop_dtr_rts(struct isi_port * port) |
||
265 | { |
||
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; |
||
274 | } |
||
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); |
||
282 | } |
||
283 | |||
284 | static inline void kill_queue(struct isi_port * port, short queue) |
||
285 | { |
||
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; |
||
294 | } |
||
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); |
||
301 | } |
||
302 | |||
303 | #endif /* __KERNEL__ */ |
||
304 | |||
305 | #endif /* ISICOM_H */ |
||
306 |