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()
250 if (test_bit(FLG_ACTIVE, &fc->bch[0].Flags) && in Sel_BCS()
251 (fc->bch[0].nr & channel)) in Sel_BCS()
252 return &fc->bch[0]; in Sel_BCS()
253 else if (test_bit(FLG_ACTIVE, &fc->bch[1].Flags) && in Sel_BCS()
254 (fc->bch[1].nr & channel)) in Sel_BCS()
255 return &fc->bch[1]; in Sel_BCS()
275 write_ctrl(struct bchannel *bch, int which) { in write_ctrl() argument
276 struct fritzcard *fc = bch->hw; in write_ctrl()
279 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in write_ctrl()
280 pr_debug("%s: hdlc %c wr%x ctrl %x\n", fc->name, '@' + bch->nr, in write_ctrl()
284 __write_ctrl_pciv2(fc, hdlc, bch->nr); in write_ctrl()
287 __write_ctrl_pci(fc, hdlc, bch->nr); in write_ctrl()
336 modehdlc(struct bchannel *bch, int protocol) in modehdlc() argument
338 struct fritzcard *fc = bch->hw; in modehdlc()
342 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in modehdlc()
344 '@' + bch->nr, bch->state, protocol, bch->nr); in modehdlc()
350 bch->state = -1; in modehdlc()
353 if (bch->state == ISDN_P_NONE) in modehdlc()
357 write_ctrl(bch, 5); in modehdlc()
358 bch->state = ISDN_P_NONE; in modehdlc()
359 test_and_clear_bit(FLG_HDLC, &bch->Flags); in modehdlc()
360 test_and_clear_bit(FLG_TRANSPARENT, &bch->Flags); in modehdlc()
363 bch->state = protocol; in modehdlc()
366 write_ctrl(bch, 5); in modehdlc()
368 write_ctrl(bch, 1); in modehdlc()
370 test_and_set_bit(FLG_TRANSPARENT, &bch->Flags); in modehdlc()
373 bch->state = protocol; in modehdlc()
376 write_ctrl(bch, 5); in modehdlc()
378 write_ctrl(bch, 1); in modehdlc()
380 test_and_set_bit(FLG_HDLC, &bch->Flags); in modehdlc()
390 hdlc_empty_fifo(struct bchannel *bch, int count) in hdlc_empty_fifo() argument
396 struct fritzcard *fc = bch->hw; in hdlc_empty_fifo()
399 if (test_bit(FLG_RX_OFF, &bch->Flags)) { in hdlc_empty_fifo()
401 bch->dropcnt += count; in hdlc_empty_fifo()
403 cnt = bchannel_get_rxbuf(bch, count); in hdlc_empty_fifo()
406 fc->name, bch->nr, count); in hdlc_empty_fifo()
409 p = skb_put(bch->rx_skb, count); in hdlc_empty_fifo()
413 addr = fc->addr + (bch->nr == 2 ? in hdlc_empty_fifo()
417 outl(bch->nr == 2 ? AVM_HDLC_2 : AVM_HDLC_1, fc->addr); in hdlc_empty_fifo()
430 bch->nr, fc->name, count); in hdlc_empty_fifo()
436 hdlc_fill_fifo(struct bchannel *bch) in hdlc_fill_fifo() argument
438 struct fritzcard *fc = bch->hw; in hdlc_fill_fifo()
445 idx = (bch->nr - 1) & 1; in hdlc_fill_fifo()
449 if (!bch->tx_skb) { in hdlc_fill_fifo()
450 if (!test_bit(FLG_TX_EMPTY, &bch->Flags)) in hdlc_fill_fifo()
453 p = bch->fill; in hdlc_fill_fifo()
456 count = bch->tx_skb->len - bch->tx_idx; in hdlc_fill_fifo()
459 p = bch->tx_skb->data + bch->tx_idx; in hdlc_fill_fifo()
465 if (test_bit(FLG_HDLC, &bch->Flags)) in hdlc_fill_fifo()
470 pr_debug("%s.B%d: %d/%d/%d", fc->name, bch->nr, count, in hdlc_fill_fifo()
471 bch->tx_idx, bch->tx_skb->len); in hdlc_fill_fifo()
472 bch->tx_idx += count; in hdlc_fill_fifo()
474 pr_debug("%s.B%d: fillempty %d\n", fc->name, bch->nr, count); in hdlc_fill_fifo()
478 __write_ctrl_pciv2(fc, hdlc, bch->nr); in hdlc_fill_fifo()
479 addr = fc->addr + (bch->nr == 2 ? in hdlc_fill_fifo()
482 __write_ctrl_pci(fc, hdlc, bch->nr); in hdlc_fill_fifo()
501 bch->nr, fc->name, count); in hdlc_fill_fifo()
507 HDLC_irq_xpr(struct bchannel *bch) in HDLC_irq_xpr() argument
509 if (bch->tx_skb && bch->tx_idx < bch->tx_skb->len) { in HDLC_irq_xpr()
510 hdlc_fill_fifo(bch); in HDLC_irq_xpr()
512 dev_kfree_skb(bch->tx_skb); in HDLC_irq_xpr()
513 if (get_next_bframe(bch)) { in HDLC_irq_xpr()
514 hdlc_fill_fifo(bch); in HDLC_irq_xpr()
515 test_and_clear_bit(FLG_TX_EMPTY, &bch->Flags); in HDLC_irq_xpr()
516 } else if (test_bit(FLG_TX_EMPTY, &bch->Flags)) { in HDLC_irq_xpr()
517 hdlc_fill_fifo(bch); in HDLC_irq_xpr()
523 HDLC_irq(struct bchannel *bch, u32 stat) in HDLC_irq() argument
525 struct fritzcard *fc = bch->hw; in HDLC_irq()
530 hdlc = &fc->hdlc[(bch->nr - 1) & 1]; in HDLC_irq()
531 pr_debug("%s: ch%d stat %#x\n", fc->name, bch->nr, stat); in HDLC_irq()
542 fc->name, bch->nr, stat); in HDLC_irq()
545 write_ctrl(bch, 1); in HDLC_irq()
547 write_ctrl(bch, 1); in HDLC_irq()
548 if (bch->rx_skb) in HDLC_irq()
549 skb_trim(bch->rx_skb, 0); in HDLC_irq()
554 hdlc_empty_fifo(bch, len); in HDLC_irq()
555 if (!bch->rx_skb) in HDLC_irq()
557 if (test_bit(FLG_TRANSPARENT, &bch->Flags)) { in HDLC_irq()
558 recv_Bchannel(bch, 0, false); in HDLC_irq()
562 recv_Bchannel(bch, 0, false); in HDLC_irq()
566 skb_trim(bch->rx_skb, 0); in HDLC_irq()
577 pr_warning("%s: ch%d stat %x XDU %s\n", fc->name, bch->nr, in HDLC_irq()
578 stat, bch->tx_skb ? "tx_skb" : "no tx_skb"); in HDLC_irq()
579 if (bch->tx_skb && bch->tx_skb->len) { in HDLC_irq()
580 if (!test_bit(FLG_TRANSPARENT, &bch->Flags)) in HDLC_irq()
581 bch->tx_idx = 0; in HDLC_irq()
582 } else if (test_bit(FLG_FILLEMPTY, &bch->Flags)) { in HDLC_irq()
583 test_and_set_bit(FLG_TX_EMPTY, &bch->Flags); in HDLC_irq()
587 write_ctrl(bch, 1); in HDLC_irq()
589 HDLC_irq_xpr(bch); in HDLC_irq()
592 HDLC_irq_xpr(bch); in HDLC_irq()
599 struct bchannel *bch; in HDLC_irq_main() local
603 bch = Sel_BCS(fc, 1); in HDLC_irq_main()
604 if (bch) in HDLC_irq_main()
605 HDLC_irq(bch, stat); in HDLC_irq_main()
611 bch = Sel_BCS(fc, 2); in HDLC_irq_main()
612 if (bch) in HDLC_irq_main()
613 HDLC_irq(bch, stat); in HDLC_irq_main()
682 struct bchannel *bch = container_of(ch, struct bchannel, ch); in avm_l2l1B() local
683 struct fritzcard *fc = bch->hw; in avm_l2l1B()
691 ret = bchannel_senddata(bch, skb); in avm_l2l1B()
693 hdlc_fill_fifo(bch); in avm_l2l1B()
700 if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags)) in avm_l2l1B()
701 ret = modehdlc(bch, ch->protocol); in avm_l2l1B()
711 mISDN_clear_bchannel(bch); in avm_l2l1B()
712 modehdlc(bch, ISDN_P_NONE); in avm_l2l1B()
727 modehdlc(&fc->bch[0], -1); in inithdlc()
728 modehdlc(&fc->bch[1], -1); in inithdlc()
830 channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
832 return mISDN_ctrl_bchannel(bch, cq); in channel_bctrl()
838 struct bchannel *bch = container_of(ch, struct bchannel, ch); in avm_bctrl() local
839 struct fritzcard *fc = bch->hw; in avm_bctrl()
846 test_and_clear_bit(FLG_OPEN, &bch->Flags); in avm_bctrl()
847 cancel_work_sync(&bch->workq); in avm_bctrl()
849 mISDN_clear_bchannel(bch); in avm_bctrl()
850 modehdlc(bch, ISDN_P_NONE); in avm_bctrl()
858 ret = channel_bctrl(bch, arg); in avm_bctrl()
897 struct bchannel *bch; in open_bchannel() local
903 bch = &fc->bch[rq->adr.channel - 1]; in open_bchannel()
904 if (test_and_set_bit(FLG_OPEN, &bch->Flags)) in open_bchannel()
906 bch->ch.protocol = rq->protocol; in open_bchannel()
907 rq->ch = &bch->ch; in open_bchannel()
1006 modehdlc(&card->bch[0], ISDN_P_NONE); in release_card()
1007 modehdlc(&card->bch[1], ISDN_P_NONE); in release_card()
1011 mISDN_freebchannel(&card->bch[1]); in release_card()
1012 mISDN_freebchannel(&card->bch[0]); in release_card()
1046 card->bch[i].nr = i + 1; in setup_instance()
1052 mISDN_initbchannel(&card->bch[i], MAX_DATA_MEM, minsize); in setup_instance()
1053 card->bch[i].hw = card; in setup_instance()
1054 card->bch[i].ch.send = avm_l2l1B; in setup_instance()
1055 card->bch[i].ch.ctrl = avm_bctrl; in setup_instance()
1056 card->bch[i].ch.nr = i + 1; in setup_instance()
1057 list_add(&card->bch[i].ch.list, &card->isac.dch.dev.bchannels); in setup_instance()
1077 mISDN_freebchannel(&card->bch[1]); in setup_instance()
1078 mISDN_freebchannel(&card->bch[0]); in setup_instance()