12 #include <linux/module.h>
13 #include <linux/kernel.h>
20 #include <linux/netdevice.h>
21 #include <linux/kernelcapi.h>
23 #include <linux/pci.h>
33 static char *
revision =
"$Revision: 1.1.2.3 $";
43 static int hema_irq_table[16] =
62 static int t1_detectandinit(
unsigned int base,
unsigned irq,
int cardnr)
64 unsigned char cregs[8];
65 unsigned char reverse_cardnr;
69 reverse_cardnr = ((cardnr & 0x01) << 3) | ((cardnr & 0x02) << 1)
70 | ((cardnr & 0x04) >> 1) | ((cardnr & 0x08) >> 3);
76 cregs[5] = hema_irq_table[irq & 0xf];
92 dummy = (base >> 4) & 0xff;
93 for (i = 1; i <= 0xf; i++) t1outp(base, i, dummy);
96 for (i = 1; i < 7; i++) t1outp(base, 0, cregs[i]);
97 t1outp(base, ((base >> 4)) & 0x3, cregs[7]);
152 while (b1_rx_full(card->
port)) {
154 b1cmd = b1_get_byte(card->
port);
160 ApplId = (unsigned) b1_get_word(card->
port);
161 MsgLen = t1_get_slice(card->
port, card->
msgbuf);
162 DataB3Len = t1_get_slice(card->
port, card->
databuf);
163 spin_unlock_irqrestore(&card->
lock, flags);
170 if (!(skb = alloc_skb(DataB3Len + MsgLen,
GFP_ATOMIC))) {
182 ApplId = (unsigned) b1_get_word(card->
port);
183 MsgLen = t1_get_slice(card->
port, card->
msgbuf);
185 spin_unlock_irqrestore(&card->
lock, flags);
194 spin_unlock_irqrestore(&card->
lock, flags);
201 ApplId = b1_get_word(card->
port);
202 NCCI = b1_get_word(card->
port);
203 WindowSize = b1_get_word(card->
port);
205 spin_unlock_irqrestore(&card->
lock, flags);
210 ApplId = b1_get_word(card->
port);
211 NCCI = b1_get_word(card->
port);
212 if (NCCI != 0xffffffff)
214 spin_unlock_irqrestore(&card->
lock, flags);
219 spin_unlock_irqrestore(&card->
lock, flags);
224 spin_unlock_irqrestore(&card->
lock, flags);
231 spin_unlock_irqrestore(&card->
lock, flags);
241 ApplId = (unsigned) b1_get_word(card->
port);
242 MsgLen = t1_get_slice(card->
port, card->
msgbuf);
243 spin_unlock_irqrestore(&card->
lock, flags);
246 && (card->
msgbuf[MsgLen - 1] ==
'\n'
247 || card->
msgbuf[MsgLen - 1] ==
'\r')) {
248 card->
msgbuf[MsgLen - 1] = 0;
256 MsgLen = t1_get_slice(card->
port, card->
msgbuf);
257 spin_unlock_irqrestore(&card->
lock, flags);
260 && (card->
msgbuf[MsgLen - 1] ==
'\n'
261 || card->
msgbuf[MsgLen - 1] ==
'\r')) {
262 card->
msgbuf[MsgLen - 1] = 0;
270 spin_unlock_irqrestore(&card->
lock, flags);
274 spin_unlock_irqrestore(&card->
lock, flags);
293 t1_disable_irq(port);
322 b1_put_word(port, ctrl->
cnr - 1);
323 spin_unlock_irqrestore(&card->
lock, flags);
328 static void t1isa_reset_ctr(
struct capi_ctr *ctrl)
332 unsigned int port = card->
port;
335 t1_disable_irq(port);
342 spin_unlock_irqrestore(&card->
lock, flags);
346 static void t1isa_remove(
struct pci_dev *pdev)
356 t1_disable_irq(card->
port);
357 b1_reset(card->
port);
358 b1_reset(card->
port);
359 t1_reset(card->
port);
370 static char *t1isa_procinfo(
struct capi_ctr *ctrl);
372 static int t1isa_probe(
struct pci_dev *pdev,
int cardnr)
392 if (!(((card->
port & 0x7) == 0) && ((card->
port & 0x30) != 0x30))) {
397 if (hema_irq_table[card->
irq & 0xf] == 0) {
412 goto err_release_region;
415 if ((retval = t1_detectandinit(card->
port, card->
irq, card->
cardnr)) != 0) {
421 t1_disable_irq(card->
port);
422 b1_reset(card->
port);
429 cinfo->
capi_ctrl.send_message = t1isa_send_message;
430 cinfo->
capi_ctrl.load_firmware = t1isa_load_firmware;
431 cinfo->
capi_ctrl.reset_ctr = t1isa_reset_ctr;
432 cinfo->
capi_ctrl.procinfo = t1isa_procinfo;
445 pci_set_drvdata(pdev, cinfo);
462 unsigned int port = card->
port;
476 spin_unlock_irqrestore(&card->
lock, flags);
482 t1_put_slice(port, skb->
data, len);
483 t1_put_slice(port, skb->
data + len, dlen);
486 t1_put_slice(port, skb->
data, len);
488 spin_unlock_irqrestore(&card->
lock, flags);
494 static char *t1isa_procinfo(
struct capi_ctr *ctrl)
503 cinfo->
card ? cinfo->
card->port : 0x0,
505 cinfo->
card ? cinfo->
card->cardnr : 0
546 .add_card = t1isa_add_card,
549 static int __init t1isa_init(
void)
557 if ((p =
strchr(rev,
'$')) !=
NULL && p > rev)
569 if (t1isa_probe(&
isa_dev[i], cardnr[i]) != 0)
580 static void __exit t1isa_exit(
void)