1 /* $Id: b1.c,v 1.1.2.2 2004/01/16 21:09:27 keil Exp $
3 * Common module for AVM B1 cards.
5 * Copyright 1999 by Carsten Paeth <calle@calle.de>
7 * This software may be used and distributed according to the terms
8 * of the GNU General Public License, incorporated herein by reference.
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/pci.h>
15 #include <linux/proc_fs.h>
16 #include <linux/seq_file.h>
17 #include <linux/skbuff.h>
18 #include <linux/delay.h>
20 #include <linux/interrupt.h>
21 #include <linux/ioport.h>
22 #include <linux/capi.h>
23 #include <linux/kernelcapi.h>
25 #include <linux/init.h>
26 #include <asm/uaccess.h>
27 #include <linux/netdevice.h>
28 #include <linux/isdn/capilli.h>
30 #include <linux/isdn/capicmd.h>
31 #include <linux/isdn/capiutil.h>
33 static char *revision
= "$Revision: 1.1.2.2 $";
35 /* ------------------------------------------------------------- */
37 MODULE_DESCRIPTION("CAPI4Linux: Common support for active AVM cards");
38 MODULE_AUTHOR("Carsten Paeth");
39 MODULE_LICENSE("GPL");
41 /* ------------------------------------------------------------- */
43 int b1_irq_table
[16] =
62 /* ------------------------------------------------------------- */
64 avmcard
*b1_alloc_card(int nr_controllers
)
70 card
= kzalloc(sizeof(*card
), GFP_KERNEL
);
74 cinfo
= kzalloc(sizeof(*cinfo
) * nr_controllers
, GFP_KERNEL
);
80 card
->ctrlinfo
= cinfo
;
81 for (i
= 0; i
< nr_controllers
; i
++) {
82 INIT_LIST_HEAD(&cinfo
[i
].ncci_head
);
85 spin_lock_init(&card
->lock
);
86 card
->nr_controllers
= nr_controllers
;
91 /* ------------------------------------------------------------- */
93 void b1_free_card(avmcard
*card
)
95 kfree(card
->ctrlinfo
);
99 /* ------------------------------------------------------------- */
101 int b1_detect(unsigned int base
, enum avmcardtype cardtype
)
106 * Statusregister 0000 00xx
108 if ((inb(base
+ B1_INSTAT
) & 0xfc)
109 || (inb(base
+ B1_OUTSTAT
) & 0xfc))
112 * Statusregister 0000 001x
114 b1outp(base
, B1_INSTAT
, 0x2); /* enable irq */
115 /* b1outp(base, B1_OUTSTAT, 0x2); */
116 if ((inb(base
+ B1_INSTAT
) & 0xfe) != 0x2
117 /* || (inb(base + B1_OUTSTAT) & 0xfe) != 0x2 */)
120 * Statusregister 0000 000x
122 b1outp(base
, B1_INSTAT
, 0x0); /* disable irq */
123 b1outp(base
, B1_OUTSTAT
, 0x0);
124 if ((inb(base
+ B1_INSTAT
) & 0xfe)
125 || (inb(base
+ B1_OUTSTAT
) & 0xfe))
128 for (onoff
= !0, i
= 0; i
< 10 ; i
++) {
129 b1_set_test_bit(base
, cardtype
, onoff
);
130 if (b1_get_test_bit(base
, cardtype
) != onoff
)
135 if (cardtype
== avm_m1
)
138 if ((b1_rd_reg(base
, B1_STAT1(cardtype
)) & 0x0f) != 0x01)
144 void b1_getrevision(avmcard
*card
)
146 card
->class = inb(card
->port
+ B1_ANALYSE
);
147 card
->revision
= inb(card
->port
+ B1_REVISION
);
150 #define FWBUF_SIZE 256
151 int b1_load_t4file(avmcard
*card
, capiloaddatapart
* t4file
)
153 unsigned char buf
[FWBUF_SIZE
];
156 unsigned int base
= card
->port
;
160 while (left
> FWBUF_SIZE
) {
162 if (copy_from_user(buf
, dp
, FWBUF_SIZE
))
165 memcpy(buf
, dp
, FWBUF_SIZE
);
167 for (i
= 0; i
< FWBUF_SIZE
; i
++)
168 if (b1_save_put_byte(base
, buf
[i
]) < 0) {
169 printk(KERN_ERR
"%s: corrupted firmware file ?\n",
178 if (copy_from_user(buf
, dp
, left
))
181 memcpy(buf
, dp
, left
);
183 for (i
= 0; i
< left
; i
++)
184 if (b1_save_put_byte(base
, buf
[i
]) < 0) {
185 printk(KERN_ERR
"%s: corrupted firmware file ?\n",
193 int b1_load_config(avmcard
*card
, capiloaddatapart
* config
)
195 unsigned char buf
[FWBUF_SIZE
];
197 unsigned int base
= card
->port
;
203 b1_put_byte(base
, SEND_CONFIG
);
204 b1_put_word(base
, 1);
205 b1_put_byte(base
, SEND_CONFIG
);
206 b1_put_word(base
, left
);
208 while (left
> FWBUF_SIZE
) {
210 if (copy_from_user(buf
, dp
, FWBUF_SIZE
))
213 memcpy(buf
, dp
, FWBUF_SIZE
);
215 for (i
= 0; i
< FWBUF_SIZE
; ) {
216 b1_put_byte(base
, SEND_CONFIG
);
217 for (j
=0; j
< 4; j
++) {
218 b1_put_byte(base
, buf
[i
++]);
226 if (copy_from_user(buf
, dp
, left
))
229 memcpy(buf
, dp
, left
);
231 for (i
= 0; i
< left
; ) {
232 b1_put_byte(base
, SEND_CONFIG
);
233 for (j
=0; j
< 4; j
++) {
235 b1_put_byte(base
, buf
[i
++]);
237 b1_put_byte(base
, 0);
244 int b1_loaded(avmcard
*card
)
246 unsigned int base
= card
->port
;
249 unsigned long tout
= 2;
251 for (stop
= jiffies
+ tout
* HZ
; time_before(jiffies
, stop
);) {
252 if (b1_tx_empty(base
))
255 if (!b1_tx_empty(base
)) {
256 printk(KERN_ERR
"%s: b1_loaded: tx err, corrupted t4 file ?\n",
260 b1_put_byte(base
, SEND_POLL
);
261 for (stop
= jiffies
+ tout
* HZ
; time_before(jiffies
, stop
);) {
262 if (b1_rx_full(base
)) {
263 if ((ans
= b1_get_byte(base
)) == RECEIVE_POLL
) {
266 printk(KERN_ERR
"%s: b1_loaded: got 0x%x, firmware not running\n",
271 printk(KERN_ERR
"%s: b1_loaded: firmware not running\n", card
->name
);
275 /* ------------------------------------------------------------- */
277 int b1_load_firmware(struct capi_ctr
*ctrl
, capiloaddata
*data
)
279 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
280 avmcard
*card
= cinfo
->card
;
281 unsigned int port
= card
->port
;
287 if ((retval
= b1_load_t4file(card
, &data
->firmware
))) {
289 printk(KERN_ERR
"%s: failed to load t4file!!\n",
294 b1_disable_irq(port
);
296 if (data
->configuration
.len
> 0 && data
->configuration
.data
) {
297 if ((retval
= b1_load_config(card
, &data
->configuration
))) {
299 printk(KERN_ERR
"%s: failed to load config!!\n",
305 if (!b1_loaded(card
)) {
306 printk(KERN_ERR
"%s: failed to load t4file.\n", card
->name
);
310 spin_lock_irqsave(&card
->lock
, flags
);
311 b1_setinterrupt(port
, card
->irq
, card
->cardtype
);
312 b1_put_byte(port
, SEND_INIT
);
313 b1_put_word(port
, CAPI_MAXAPPL
);
314 b1_put_word(port
, AVM_NCCI_PER_CHANNEL
*2);
315 b1_put_word(port
, ctrl
->cnr
- 1);
316 spin_unlock_irqrestore(&card
->lock
, flags
);
321 void b1_reset_ctr(struct capi_ctr
*ctrl
)
323 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
324 avmcard
*card
= cinfo
->card
;
325 unsigned int port
= card
->port
;
331 memset(cinfo
->version
, 0, sizeof(cinfo
->version
));
332 spin_lock_irqsave(&card
->lock
, flags
);
333 capilib_release(&cinfo
->ncci_head
);
334 spin_unlock_irqrestore(&card
->lock
, flags
);
338 void b1_register_appl(struct capi_ctr
*ctrl
,
340 capi_register_params
*rp
)
342 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
343 avmcard
*card
= cinfo
->card
;
344 unsigned int port
= card
->port
;
346 int nconn
, want
= rp
->level3cnt
;
348 if (want
> 0) nconn
= want
;
349 else nconn
= ctrl
->profile
.nbchannel
* -want
;
350 if (nconn
== 0) nconn
= ctrl
->profile
.nbchannel
;
352 spin_lock_irqsave(&card
->lock
, flags
);
353 b1_put_byte(port
, SEND_REGISTER
);
354 b1_put_word(port
, appl
);
355 b1_put_word(port
, 1024 * (nconn
+1));
356 b1_put_word(port
, nconn
);
357 b1_put_word(port
, rp
->datablkcnt
);
358 b1_put_word(port
, rp
->datablklen
);
359 spin_unlock_irqrestore(&card
->lock
, flags
);
362 void b1_release_appl(struct capi_ctr
*ctrl
, u16 appl
)
364 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
365 avmcard
*card
= cinfo
->card
;
366 unsigned int port
= card
->port
;
369 spin_lock_irqsave(&card
->lock
, flags
);
370 capilib_release_appl(&cinfo
->ncci_head
, appl
);
371 b1_put_byte(port
, SEND_RELEASE
);
372 b1_put_word(port
, appl
);
373 spin_unlock_irqrestore(&card
->lock
, flags
);
376 u16
b1_send_message(struct capi_ctr
*ctrl
, struct sk_buff
*skb
)
378 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
379 avmcard
*card
= cinfo
->card
;
380 unsigned int port
= card
->port
;
382 u16 len
= CAPIMSG_LEN(skb
->data
);
383 u8 cmd
= CAPIMSG_COMMAND(skb
->data
);
384 u8 subcmd
= CAPIMSG_SUBCOMMAND(skb
->data
);
387 spin_lock_irqsave(&card
->lock
, flags
);
388 if (CAPICMD(cmd
, subcmd
) == CAPI_DATA_B3_REQ
) {
389 retval
= capilib_data_b3_req(&cinfo
->ncci_head
,
390 CAPIMSG_APPID(skb
->data
),
391 CAPIMSG_NCCI(skb
->data
),
392 CAPIMSG_MSGID(skb
->data
));
393 if (retval
!= CAPI_NOERROR
) {
394 spin_unlock_irqrestore(&card
->lock
, flags
);
398 dlen
= CAPIMSG_DATALEN(skb
->data
);
400 b1_put_byte(port
, SEND_DATA_B3_REQ
);
401 b1_put_slice(port
, skb
->data
, len
);
402 b1_put_slice(port
, skb
->data
+ len
, dlen
);
404 b1_put_byte(port
, SEND_MESSAGE
);
405 b1_put_slice(port
, skb
->data
, len
);
407 spin_unlock_irqrestore(&card
->lock
, flags
);
409 dev_kfree_skb_any(skb
);
413 /* ------------------------------------------------------------- */
415 void b1_parse_version(avmctrl_info
*cinfo
)
417 struct capi_ctr
*ctrl
= &cinfo
->capi_ctrl
;
418 avmcard
*card
= cinfo
->card
;
424 for (j
= 0; j
< AVM_MAXVERSION
; j
++)
425 cinfo
->version
[j
] = "\0\0" + 1;
427 j
< AVM_MAXVERSION
&& i
< cinfo
->versionlen
;
428 j
++, i
+= cinfo
->versionbuf
[i
] + 1)
429 cinfo
->version
[j
] = &cinfo
->versionbuf
[i
+ 1];
431 strlcpy(ctrl
->serial
, cinfo
->version
[VER_SERIAL
], sizeof(ctrl
->serial
));
432 memcpy(&ctrl
->profile
, cinfo
->version
[VER_PROFILE
],sizeof(capi_profile
));
433 strlcpy(ctrl
->manu
, "AVM GmbH", sizeof(ctrl
->manu
));
434 dversion
= cinfo
->version
[VER_DRIVER
];
435 ctrl
->version
.majorversion
= 2;
436 ctrl
->version
.minorversion
= 0;
437 ctrl
->version
.majormanuversion
= (((dversion
[0] - '0') & 0xf) << 4);
438 ctrl
->version
.majormanuversion
|= ((dversion
[2] - '0') & 0xf);
439 ctrl
->version
.minormanuversion
= (dversion
[3] - '0') << 4;
440 ctrl
->version
.minormanuversion
|=
441 (dversion
[5] - '0') * 10 + ((dversion
[6] - '0') & 0xf);
443 profp
= &ctrl
->profile
;
445 flag
= ((u8
*)(profp
->manu
))[1];
447 case 0: if (cinfo
->version
[VER_CARDTYPE
])
448 strcpy(cinfo
->cardname
, cinfo
->version
[VER_CARDTYPE
]);
449 else strcpy(cinfo
->cardname
, "B1");
451 case 3: strcpy(cinfo
->cardname
,"PCMCIA B"); break;
452 case 4: strcpy(cinfo
->cardname
,"PCMCIA M1"); break;
453 case 5: strcpy(cinfo
->cardname
,"PCMCIA M2"); break;
454 case 6: strcpy(cinfo
->cardname
,"B1 V3.0"); break;
455 case 7: strcpy(cinfo
->cardname
,"B1 PCI"); break;
456 default: sprintf(cinfo
->cardname
, "AVM?%u", (unsigned int)flag
); break;
458 printk(KERN_NOTICE
"%s: card %d \"%s\" ready.\n",
459 card
->name
, ctrl
->cnr
, cinfo
->cardname
);
461 flag
= ((u8
*)(profp
->manu
))[3];
463 printk(KERN_NOTICE
"%s: card %d Protocol:%s%s%s%s%s%s%s\n",
466 (flag
& 0x01) ? " DSS1" : "",
467 (flag
& 0x02) ? " CT1" : "",
468 (flag
& 0x04) ? " VN3" : "",
469 (flag
& 0x08) ? " NI1" : "",
470 (flag
& 0x10) ? " AUSTEL" : "",
471 (flag
& 0x20) ? " ESS" : "",
472 (flag
& 0x40) ? " 1TR6" : ""
475 flag
= ((u8
*)(profp
->manu
))[5];
477 printk(KERN_NOTICE
"%s: card %d Linetype:%s%s%s%s\n",
480 (flag
& 0x01) ? " point to point" : "",
481 (flag
& 0x02) ? " point to multipoint" : "",
482 (flag
& 0x08) ? " leased line without D-channel" : "",
483 (flag
& 0x04) ? " leased line with D-channel" : ""
487 /* ------------------------------------------------------------- */
489 irqreturn_t
b1_interrupt(int interrupt
, void *devptr
)
491 avmcard
*card
= devptr
;
492 avmctrl_info
*cinfo
= &card
->ctrlinfo
[0];
493 struct capi_ctr
*ctrl
= &cinfo
->capi_ctrl
;
504 spin_lock_irqsave(&card
->lock
, flags
);
506 if (!b1_rx_full(card
->port
)) {
507 spin_unlock_irqrestore(&card
->lock
, flags
);
511 b1cmd
= b1_get_byte(card
->port
);
515 case RECEIVE_DATA_B3_IND
:
517 ApplId
= (unsigned) b1_get_word(card
->port
);
518 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
519 DataB3Len
= b1_get_slice(card
->port
, card
->databuf
);
520 spin_unlock_irqrestore(&card
->lock
, flags
);
522 if (MsgLen
< 30) { /* not CAPI 64Bit */
523 memset(card
->msgbuf
+MsgLen
, 0, 30-MsgLen
);
525 CAPIMSG_SETLEN(card
->msgbuf
, 30);
527 if (!(skb
= alloc_skb(DataB3Len
+ MsgLen
, GFP_ATOMIC
))) {
528 printk(KERN_ERR
"%s: incoming packet dropped\n",
531 memcpy(skb_put(skb
, MsgLen
), card
->msgbuf
, MsgLen
);
532 memcpy(skb_put(skb
, DataB3Len
), card
->databuf
, DataB3Len
);
533 capi_ctr_handle_message(ctrl
, ApplId
, skb
);
537 case RECEIVE_MESSAGE
:
539 ApplId
= (unsigned) b1_get_word(card
->port
);
540 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
541 if (!(skb
= alloc_skb(MsgLen
, GFP_ATOMIC
))) {
542 printk(KERN_ERR
"%s: incoming packet dropped\n",
544 spin_unlock_irqrestore(&card
->lock
, flags
);
546 memcpy(skb_put(skb
, MsgLen
), card
->msgbuf
, MsgLen
);
547 if (CAPIMSG_CMD(skb
->data
) == CAPI_DATA_B3_CONF
)
548 capilib_data_b3_conf(&cinfo
->ncci_head
, ApplId
,
549 CAPIMSG_NCCI(skb
->data
),
550 CAPIMSG_MSGID(skb
->data
));
551 spin_unlock_irqrestore(&card
->lock
, flags
);
552 capi_ctr_handle_message(ctrl
, ApplId
, skb
);
556 case RECEIVE_NEW_NCCI
:
558 ApplId
= b1_get_word(card
->port
);
559 NCCI
= b1_get_word(card
->port
);
560 WindowSize
= b1_get_word(card
->port
);
561 capilib_new_ncci(&cinfo
->ncci_head
, ApplId
, NCCI
, WindowSize
);
562 spin_unlock_irqrestore(&card
->lock
, flags
);
565 case RECEIVE_FREE_NCCI
:
567 ApplId
= b1_get_word(card
->port
);
568 NCCI
= b1_get_word(card
->port
);
569 if (NCCI
!= 0xffffffff)
570 capilib_free_ncci(&cinfo
->ncci_head
, ApplId
, NCCI
);
571 spin_unlock_irqrestore(&card
->lock
, flags
);
575 /* b1_put_byte(card->port, SEND_POLLACK); */
576 spin_unlock_irqrestore(&card
->lock
, flags
);
577 capi_ctr_resume_output(ctrl
);
581 spin_unlock_irqrestore(&card
->lock
, flags
);
582 capi_ctr_suspend_output(ctrl
);
587 cinfo
->versionlen
= b1_get_slice(card
->port
, cinfo
->versionbuf
);
588 spin_unlock_irqrestore(&card
->lock
, flags
);
589 b1_parse_version(cinfo
);
590 printk(KERN_INFO
"%s: %s-card (%s) now active\n",
592 cinfo
->version
[VER_CARDTYPE
],
593 cinfo
->version
[VER_DRIVER
]);
594 capi_ctr_ready(ctrl
);
597 case RECEIVE_TASK_READY
:
598 ApplId
= (unsigned) b1_get_word(card
->port
);
599 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
600 spin_unlock_irqrestore(&card
->lock
, flags
);
601 card
->msgbuf
[MsgLen
] = 0;
603 && ( card
->msgbuf
[MsgLen
-1] == '\n'
604 || card
->msgbuf
[MsgLen
-1] == '\r')) {
605 card
->msgbuf
[MsgLen
-1] = 0;
608 printk(KERN_INFO
"%s: task %d \"%s\" ready.\n",
609 card
->name
, ApplId
, card
->msgbuf
);
612 case RECEIVE_DEBUGMSG
:
613 MsgLen
= b1_get_slice(card
->port
, card
->msgbuf
);
614 spin_unlock_irqrestore(&card
->lock
, flags
);
615 card
->msgbuf
[MsgLen
] = 0;
617 && ( card
->msgbuf
[MsgLen
-1] == '\n'
618 || card
->msgbuf
[MsgLen
-1] == '\r')) {
619 card
->msgbuf
[MsgLen
-1] = 0;
622 printk(KERN_INFO
"%s: DEBUG: %s\n", card
->name
, card
->msgbuf
);
626 spin_unlock_irqrestore(&card
->lock
, flags
);
627 printk(KERN_ERR
"%s: card removed ?\n", card
->name
);
630 spin_unlock_irqrestore(&card
->lock
, flags
);
631 printk(KERN_ERR
"%s: b1_interrupt: 0x%x ???\n",
638 /* ------------------------------------------------------------- */
639 static int b1ctl_proc_show(struct seq_file
*m
, void *v
)
641 struct capi_ctr
*ctrl
= m
->private;
642 avmctrl_info
*cinfo
= (avmctrl_info
*)(ctrl
->driverdata
);
643 avmcard
*card
= cinfo
->card
;
647 seq_printf(m
, "%-16s %s\n", "name", card
->name
);
648 seq_printf(m
, "%-16s 0x%x\n", "io", card
->port
);
649 seq_printf(m
, "%-16s %d\n", "irq", card
->irq
);
650 switch (card
->cardtype
) {
651 case avm_b1isa
: s
= "B1 ISA"; break;
652 case avm_b1pci
: s
= "B1 PCI"; break;
653 case avm_b1pcmcia
: s
= "B1 PCMCIA"; break;
654 case avm_m1
: s
= "M1"; break;
655 case avm_m2
: s
= "M2"; break;
656 case avm_t1isa
: s
= "T1 ISA (HEMA)"; break;
657 case avm_t1pci
: s
= "T1 PCI"; break;
658 case avm_c4
: s
= "C4"; break;
659 case avm_c2
: s
= "C2"; break;
660 default: s
= "???"; break;
662 seq_printf(m
, "%-16s %s\n", "type", s
);
663 if (card
->cardtype
== avm_t1isa
)
664 seq_printf(m
, "%-16s %d\n", "cardnr", card
->cardnr
);
665 if ((s
= cinfo
->version
[VER_DRIVER
]) != NULL
)
666 seq_printf(m
, "%-16s %s\n", "ver_driver", s
);
667 if ((s
= cinfo
->version
[VER_CARDTYPE
]) != NULL
)
668 seq_printf(m
, "%-16s %s\n", "ver_cardtype", s
);
669 if ((s
= cinfo
->version
[VER_SERIAL
]) != NULL
)
670 seq_printf(m
, "%-16s %s\n", "ver_serial", s
);
672 if (card
->cardtype
!= avm_m1
) {
673 flag
= ((u8
*)(ctrl
->profile
.manu
))[3];
675 seq_printf(m
, "%-16s%s%s%s%s%s%s%s\n",
677 (flag
& 0x01) ? " DSS1" : "",
678 (flag
& 0x02) ? " CT1" : "",
679 (flag
& 0x04) ? " VN3" : "",
680 (flag
& 0x08) ? " NI1" : "",
681 (flag
& 0x10) ? " AUSTEL" : "",
682 (flag
& 0x20) ? " ESS" : "",
683 (flag
& 0x40) ? " 1TR6" : ""
686 if (card
->cardtype
!= avm_m1
) {
687 flag
= ((u8
*)(ctrl
->profile
.manu
))[5];
689 seq_printf(m
, "%-16s%s%s%s%s\n",
691 (flag
& 0x01) ? " point to point" : "",
692 (flag
& 0x02) ? " point to multipoint" : "",
693 (flag
& 0x08) ? " leased line without D-channel" : "",
694 (flag
& 0x04) ? " leased line with D-channel" : ""
697 seq_printf(m
, "%-16s %s\n", "cardname", cinfo
->cardname
);
702 static int b1ctl_proc_open(struct inode
*inode
, struct file
*file
)
704 return single_open(file
, b1ctl_proc_show
, PDE(inode
)->data
);
707 const struct file_operations b1ctl_proc_fops
= {
708 .owner
= THIS_MODULE
,
709 .open
= b1ctl_proc_open
,
712 .release
= single_release
,
714 EXPORT_SYMBOL(b1ctl_proc_fops
);
716 /* ------------------------------------------------------------- */
721 avmcard_dma_alloc(char *name
, struct pci_dev
*pdev
, long rsize
, long ssize
)
726 p
= kzalloc(sizeof(avmcard_dmainfo
), GFP_KERNEL
);
728 printk(KERN_WARNING
"%s: no memory.\n", name
);
732 p
->recvbuf
.size
= rsize
;
733 buf
= pci_alloc_consistent(pdev
, rsize
, &p
->recvbuf
.dmaaddr
);
735 printk(KERN_WARNING
"%s: allocation of receive dma buffer failed.\n", name
);
738 p
->recvbuf
.dmabuf
= buf
;
740 p
->sendbuf
.size
= ssize
;
741 buf
= pci_alloc_consistent(pdev
, ssize
, &p
->sendbuf
.dmaaddr
);
743 printk(KERN_WARNING
"%s: allocation of send dma buffer failed.\n", name
);
744 goto err_free_consistent
;
747 p
->sendbuf
.dmabuf
= buf
;
748 skb_queue_head_init(&p
->send_queue
);
753 pci_free_consistent(p
->pcidev
, p
->recvbuf
.size
,
754 p
->recvbuf
.dmabuf
, p
->recvbuf
.dmaaddr
);
761 void avmcard_dma_free(avmcard_dmainfo
*p
)
763 pci_free_consistent(p
->pcidev
, p
->recvbuf
.size
,
764 p
->recvbuf
.dmabuf
, p
->recvbuf
.dmaaddr
);
765 pci_free_consistent(p
->pcidev
, p
->sendbuf
.size
,
766 p
->sendbuf
.dmabuf
, p
->sendbuf
.dmaaddr
);
767 skb_queue_purge(&p
->send_queue
);
771 EXPORT_SYMBOL(avmcard_dma_alloc
);
772 EXPORT_SYMBOL(avmcard_dma_free
);
776 EXPORT_SYMBOL(b1_irq_table
);
778 EXPORT_SYMBOL(b1_alloc_card
);
779 EXPORT_SYMBOL(b1_free_card
);
780 EXPORT_SYMBOL(b1_detect
);
781 EXPORT_SYMBOL(b1_getrevision
);
782 EXPORT_SYMBOL(b1_load_t4file
);
783 EXPORT_SYMBOL(b1_load_config
);
784 EXPORT_SYMBOL(b1_loaded
);
785 EXPORT_SYMBOL(b1_load_firmware
);
786 EXPORT_SYMBOL(b1_reset_ctr
);
787 EXPORT_SYMBOL(b1_register_appl
);
788 EXPORT_SYMBOL(b1_release_appl
);
789 EXPORT_SYMBOL(b1_send_message
);
791 EXPORT_SYMBOL(b1_parse_version
);
792 EXPORT_SYMBOL(b1_interrupt
);
794 static int __init
b1_init(void)
799 if ((p
= strchr(revision
, ':')) != NULL
&& p
[1]) {
800 strlcpy(rev
, p
+ 2, 32);
801 if ((p
= strchr(rev
, '$')) != NULL
&& p
> rev
)
806 printk(KERN_INFO
"b1: revision %s\n", rev
);
811 static void __exit
b1_exit(void)
815 module_init(b1_init
);
816 module_exit(b1_exit
);