Lines Matching full:bch

130 	struct bchannel		bch[2];  member
141 card->bch[0].debug = debug; in _set_debug()
142 card->bch[1].debug = debug; in _set_debug()
251 if (test_bit(FLG_ACTIVE, &fc->bch[0].Flags) && in Sel_BCS()
252 (fc->bch[0].nr & channel)) in Sel_BCS()
253 return &fc->bch[0]; in Sel_BCS()
254 else if (test_bit(FLG_ACTIVE, &fc->bch[1].Flags) && in Sel_BCS()
255 (fc->bch[1].nr & channel)) in Sel_BCS()
256 return &fc->bch[1]; in Sel_BCS()
276 write_ctrl(struct bchannel *bch, int which) { in write_ctrl() argument
277 struct fritzcard *fc = bch->hw; in write_ctrl()
280 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in write_ctrl()
281 pr_debug("%s: hdlc %c wr%x ctrl %x\n", fc->name, '@' + bch->nr, in write_ctrl()
285 __write_ctrl_pciv2(fc, hdlc, bch->nr); in write_ctrl()
288 __write_ctrl_pci(fc, hdlc, bch->nr); in write_ctrl()
337 modehdlc(struct bchannel *bch, int protocol) in modehdlc() argument
339 struct fritzcard *fc = bch->hw; in modehdlc()
343 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in modehdlc()
345 '@' + bch->nr, bch->state, protocol, bch->nr); in modehdlc()
351 bch->state = -1; in modehdlc()
354 if (bch->state == ISDN_P_NONE) in modehdlc()
358 write_ctrl(bch, 5); in modehdlc()
359 bch->state = ISDN_P_NONE; in modehdlc()
360 test_and_clear_bit(FLG_HDLC, &bch->Flags); in modehdlc()
361 test_and_clear_bit(FLG_TRANSPARENT, &bch->Flags); in modehdlc()
364 bch->state = protocol; in modehdlc()
367 write_ctrl(bch, 5); in modehdlc()
369 write_ctrl(bch, 1); in modehdlc()
371 test_and_set_bit(FLG_TRANSPARENT, &bch->Flags); in modehdlc()
374 bch->state = protocol; in modehdlc()
377 write_ctrl(bch, 5); in modehdlc()
379 write_ctrl(bch, 1); in modehdlc()
381 test_and_set_bit(FLG_HDLC, &bch->Flags); in modehdlc()
391 hdlc_empty_fifo(struct bchannel *bch, int count) in hdlc_empty_fifo() argument
397 struct fritzcard *fc = bch->hw; in hdlc_empty_fifo()
400 if (test_bit(FLG_RX_OFF, &bch->Flags)) { in hdlc_empty_fifo()
402 bch->dropcnt += count; in hdlc_empty_fifo()
404 cnt = bchannel_get_rxbuf(bch, count); in hdlc_empty_fifo()
407 fc->name, bch->nr, count); in hdlc_empty_fifo()
410 p = skb_put(bch->rx_skb, count); in hdlc_empty_fifo()
414 addr = fc->addr + (bch->nr == 2 ? in hdlc_empty_fifo()
418 outl(bch->nr == 2 ? AVM_HDLC_2 : AVM_HDLC_1, fc->addr); in hdlc_empty_fifo()
431 bch->nr, fc->name, count); in hdlc_empty_fifo()
437 hdlc_fill_fifo(struct bchannel *bch) in hdlc_fill_fifo() argument
439 struct fritzcard *fc = bch->hw; in hdlc_fill_fifo()
446 idx = (bch->nr - 1) & 1; in hdlc_fill_fifo()
450 if (!bch->tx_skb) { in hdlc_fill_fifo()
451 if (!test_bit(FLG_TX_EMPTY, &bch->Flags)) in hdlc_fill_fifo()
454 p = bch->fill; in hdlc_fill_fifo()
457 count = bch->tx_skb->len - bch->tx_idx; in hdlc_fill_fifo()
460 p = bch->tx_skb->data + bch->tx_idx; in hdlc_fill_fifo()
466 if (test_bit(FLG_HDLC, &bch->Flags)) in hdlc_fill_fifo()
471 pr_debug("%s.B%d: %d/%d/%d", fc->name, bch->nr, count, in hdlc_fill_fifo()
472 bch->tx_idx, bch->tx_skb->len); in hdlc_fill_fifo()
473 bch->tx_idx += count; in hdlc_fill_fifo()
475 pr_debug("%s.B%d: fillempty %d\n", fc->name, bch->nr, count); in hdlc_fill_fifo()
479 __write_ctrl_pciv2(fc, hdlc, bch->nr); in hdlc_fill_fifo()
480 addr = fc->addr + (bch->nr == 2 ? in hdlc_fill_fifo()
483 __write_ctrl_pci(fc, hdlc, bch->nr); in hdlc_fill_fifo()
502 bch->nr, fc->name, count); in hdlc_fill_fifo()
508 HDLC_irq_xpr(struct bchannel *bch) in HDLC_irq_xpr() argument
510 if (bch->tx_skb && bch->tx_idx < bch->tx_skb->len) { in HDLC_irq_xpr()
511 hdlc_fill_fifo(bch); in HDLC_irq_xpr()
513 dev_kfree_skb(bch->tx_skb); in HDLC_irq_xpr()
514 if (get_next_bframe(bch)) { in HDLC_irq_xpr()
515 hdlc_fill_fifo(bch); in HDLC_irq_xpr()
516 test_and_clear_bit(FLG_TX_EMPTY, &bch->Flags); in HDLC_irq_xpr()
517 } else if (test_bit(FLG_TX_EMPTY, &bch->Flags)) { in HDLC_irq_xpr()
518 hdlc_fill_fifo(bch); in HDLC_irq_xpr()
524 HDLC_irq(struct bchannel *bch, u32 stat) in HDLC_irq() argument
526 struct fritzcard *fc = bch->hw; in HDLC_irq()
531 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in HDLC_irq()
532 pr_debug("%s: ch%d stat %#x\n", fc->name, bch->nr, stat); in HDLC_irq()
543 fc->name, bch->nr, stat); in HDLC_irq()
546 write_ctrl(bch, 1); in HDLC_irq()
548 write_ctrl(bch, 1); in HDLC_irq()
549 if (bch->rx_skb) in HDLC_irq()
550 skb_trim(bch->rx_skb, 0); in HDLC_irq()
555 hdlc_empty_fifo(bch, len); in HDLC_irq()
556 if (!bch->rx_skb) in HDLC_irq()
558 if (test_bit(FLG_TRANSPARENT, &bch->Flags)) { in HDLC_irq()
559 recv_Bchannel(bch, 0, false); in HDLC_irq()
563 recv_Bchannel(bch, 0, false); in HDLC_irq()
567 skb_trim(bch->rx_skb, 0); in HDLC_irq()
578 pr_warn("%s: ch%d stat %x XDU %s\n", fc->name, bch->nr, in HDLC_irq()
579 stat, bch->tx_skb ? "tx_skb" : "no tx_skb"); in HDLC_irq()
580 if (bch->tx_skb && bch->tx_skb->len) { in HDLC_irq()
581 if (!test_bit(FLG_TRANSPARENT, &bch->Flags)) in HDLC_irq()
582 bch->tx_idx = 0; in HDLC_irq()
583 } else if (test_bit(FLG_FILLEMPTY, &bch->Flags)) { in HDLC_irq()
584 test_and_set_bit(FLG_TX_EMPTY, &bch->Flags); in HDLC_irq()
588 write_ctrl(bch, 1); in HDLC_irq()
590 HDLC_irq_xpr(bch); in HDLC_irq()
593 HDLC_irq_xpr(bch); in HDLC_irq()
600 struct bchannel *bch; in HDLC_irq_main() local
604 bch = Sel_BCS(fc, 1); in HDLC_irq_main()
605 if (bch) in HDLC_irq_main()
606 HDLC_irq(bch, stat); in HDLC_irq_main()
612 bch = Sel_BCS(fc, 2); in HDLC_irq_main()
613 if (bch) in HDLC_irq_main()
614 HDLC_irq(bch, stat); in HDLC_irq_main()
683 struct bchannel *bch = container_of(ch, struct bchannel, ch); in avm_l2l1B() local
684 struct fritzcard *fc = bch->hw; in avm_l2l1B()
692 ret = bchannel_senddata(bch, skb); in avm_l2l1B()
694 hdlc_fill_fifo(bch); in avm_l2l1B()
701 if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags)) in avm_l2l1B()
702 ret = modehdlc(bch, ch->protocol); in avm_l2l1B()
712 mISDN_clear_bchannel(bch); in avm_l2l1B()
713 modehdlc(bch, ISDN_P_NONE); in avm_l2l1B()
728 modehdlc(&fc->bch[0], -1); in inithdlc()
729 modehdlc(&fc->bch[1], -1); in inithdlc()
831 channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
833 return mISDN_ctrl_bchannel(bch, cq); in channel_bctrl()
839 struct bchannel *bch = container_of(ch, struct bchannel, ch); in avm_bctrl() local
840 struct fritzcard *fc = bch->hw; in avm_bctrl()
847 test_and_clear_bit(FLG_OPEN, &bch->Flags); in avm_bctrl()
848 cancel_work_sync(&bch->workq); in avm_bctrl()
850 mISDN_clear_bchannel(bch); in avm_bctrl()
851 modehdlc(bch, ISDN_P_NONE); in avm_bctrl()
859 ret = channel_bctrl(bch, arg); in avm_bctrl()
898 struct bchannel *bch; in open_bchannel() local
904 bch = &fc->bch[rq->adr.channel - 1]; in open_bchannel()
905 if (test_and_set_bit(FLG_OPEN, &bch->Flags)) in open_bchannel()
907 bch->ch.protocol = rq->protocol; in open_bchannel()
908 rq->ch = &bch->ch; in open_bchannel()
1007 modehdlc(&card->bch[0], ISDN_P_NONE); in release_card()
1008 modehdlc(&card->bch[1], ISDN_P_NONE); in release_card()
1012 mISDN_freebchannel(&card->bch[1]); in release_card()
1013 mISDN_freebchannel(&card->bch[0]); in release_card()
1047 card->bch[i].nr = i + 1; in setup_instance()
1053 mISDN_initbchannel(&card->bch[i], MAX_DATA_MEM, minsize); in setup_instance()
1054 card->bch[i].hw = card; in setup_instance()
1055 card->bch[i].ch.send = avm_l2l1B; in setup_instance()
1056 card->bch[i].ch.ctrl = avm_bctrl; in setup_instance()
1057 card->bch[i].ch.nr = i + 1; in setup_instance()
1058 list_add(&card->bch[i].ch.list, &card->isac.dch.dev.bchannels); in setup_instance()
1078 mISDN_freebchannel(&card->bch[1]); in setup_instance()
1079 mISDN_freebchannel(&card->bch[0]); in setup_instance()