Lines Matching full:bch
134 struct bchannel bch[2]; member
308 if (test_bit(FLG_ACTIVE, &hc->bch[0].Flags) && in Sel_BCS()
309 (hc->bch[0].nr & channel)) in Sel_BCS()
310 return &hc->bch[0]; in Sel_BCS()
311 else if (test_bit(FLG_ACTIVE, &hc->bch[1].Flags) && in Sel_BCS()
312 (hc->bch[1].nr & channel)) in Sel_BCS()
313 return &hc->bch[1]; in Sel_BCS()
366 if (hc->bch[fifo].debug & DEBUG_HW_BCHANNEL) in hfcpci_clear_fifo_tx()
380 if (hc->bch[fifo].debug & DEBUG_HW_BCHANNEL) in hfcpci_clear_fifo_tx()
392 hfcpci_empty_bfifo(struct bchannel *bch, struct bzfifo *bz, in hfcpci_empty_bfifo() argument
399 if ((bch->debug & DEBUG_HW_BCHANNEL) && !(bch->debug & DEBUG_HW_BFIFO)) in hfcpci_empty_bfifo()
408 if (bch->debug & DEBUG_HW) in hfcpci_empty_bfifo()
412 bch->err_inv++; in hfcpci_empty_bfifo()
417 bch->rx_skb = mI_alloc_skb(count - 3, GFP_ATOMIC); in hfcpci_empty_bfifo()
418 if (!bch->rx_skb) { in hfcpci_empty_bfifo()
423 ptr = skb_put(bch->rx_skb, count); in hfcpci_empty_bfifo()
443 recv_Bchannel(bch, MISDN_ID_ANY, false); in hfcpci_empty_bfifo()
533 hfcpci_empty_fifo_trans(struct bchannel *bch, struct bzfifo *rxbz, in hfcpci_empty_fifo_trans() argument
562 if (test_bit(FLG_RX_OFF, &bch->Flags)) { in hfcpci_empty_fifo_trans()
563 bch->dropcnt += fcnt_rx; in hfcpci_empty_fifo_trans()
567 maxlen = bchannel_get_rxbuf(bch, fcnt_rx); in hfcpci_empty_fifo_trans()
570 bch->nr, fcnt_rx); in hfcpci_empty_fifo_trans()
572 ptr = skb_put(bch->rx_skb, fcnt_rx); in hfcpci_empty_fifo_trans()
589 recv_Bchannel(bch, fcnt_tx, false); /* bch, id, !force */ in hfcpci_empty_fifo_trans()
598 main_rec_hfcpci(struct bchannel *bch) in main_rec_hfcpci() argument
600 struct hfc_pci *hc = bch->hw; in main_rec_hfcpci()
607 if ((bch->nr & 2) && (!hc->hw.bswapped)) { in main_rec_hfcpci()
621 if (bch->debug & DEBUG_HW_BCHANNEL) in main_rec_hfcpci()
623 bch->nr, rxbz->f1, rxbz->f2); in main_rec_hfcpci()
630 if (bch->debug & DEBUG_HW_BCHANNEL) in main_rec_hfcpci()
633 bch->nr, le16_to_cpu(zp->z1), in main_rec_hfcpci()
635 hfcpci_empty_bfifo(bch, rxbz, bdata, rcnt); in main_rec_hfcpci()
648 } else if (test_bit(FLG_TRANSPARENT, &bch->Flags)) { in main_rec_hfcpci()
649 hfcpci_empty_fifo_trans(bch, rxbz, txbz, bdata); in main_rec_hfcpci()
739 hfcpci_fill_fifo(struct bchannel *bch) in hfcpci_fill_fifo() argument
741 struct hfc_pci *hc = bch->hw; in hfcpci_fill_fifo()
749 if ((bch->debug & DEBUG_HW_BCHANNEL) && !(bch->debug & DEBUG_HW_BFIFO)) in hfcpci_fill_fifo()
751 if ((!bch->tx_skb) || bch->tx_skb->len == 0) { in hfcpci_fill_fifo()
752 if (!test_bit(FLG_FILLEMPTY, &bch->Flags) && in hfcpci_fill_fifo()
753 !test_bit(FLG_TRANSPARENT, &bch->Flags)) in hfcpci_fill_fifo()
757 count = bch->tx_skb->len - bch->tx_idx; in hfcpci_fill_fifo()
759 if ((bch->nr & 2) && (!hc->hw.bswapped)) { in hfcpci_fill_fifo()
767 if (test_bit(FLG_TRANSPARENT, &bch->Flags)) { in hfcpci_fill_fifo()
770 if (bch->debug & DEBUG_HW_BCHANNEL) in hfcpci_fill_fifo()
772 "cnt(%d) z1(%x) z2(%x)\n", bch->nr, count, in hfcpci_fill_fifo()
777 if (test_bit(FLG_FILLEMPTY, &bch->Flags)) { in hfcpci_fill_fifo()
788 if (bch->debug & DEBUG_HW_BFIFO) in hfcpci_fill_fifo()
794 memset(dst, bch->fill[0], maxlen); /* first copy */ in hfcpci_fill_fifo()
798 memset(dst, bch->fill[0], count); in hfcpci_fill_fifo()
808 count = bch->tx_skb->len - bch->tx_idx; in hfcpci_fill_fifo()
819 src = bch->tx_skb->data + bch->tx_idx; in hfcpci_fill_fifo()
824 if (bch->debug & DEBUG_HW_BFIFO) in hfcpci_fill_fifo()
829 bch->tx_idx += count; in hfcpci_fill_fifo()
840 if (bch->tx_idx < bch->tx_skb->len) in hfcpci_fill_fifo()
842 dev_kfree_skb(bch->tx_skb); in hfcpci_fill_fifo()
843 if (get_next_bframe(bch)) in hfcpci_fill_fifo()
847 if (bch->debug & DEBUG_HW_BCHANNEL) in hfcpci_fill_fifo()
850 __func__, bch->nr, bz->f1, bz->f2, in hfcpci_fill_fifo()
856 if (bch->debug & DEBUG_HW_BCHANNEL) in hfcpci_fill_fifo()
867 if (bch->debug & DEBUG_HW_BCHANNEL) in hfcpci_fill_fifo()
869 bch->nr, count, maxlen); in hfcpci_fill_fifo()
872 if (bch->debug & DEBUG_HW_BCHANNEL) in hfcpci_fill_fifo()
882 src = bch->tx_skb->data + bch->tx_idx; /* source pointer */ in hfcpci_fill_fifo()
898 dev_kfree_skb(bch->tx_skb); in hfcpci_fill_fifo()
899 get_next_bframe(bch); in hfcpci_fill_fifo()
1117 tx_birq(struct bchannel *bch) in tx_birq() argument
1119 if (bch->tx_skb && bch->tx_idx < bch->tx_skb->len) in tx_birq()
1120 hfcpci_fill_fifo(bch); in tx_birq()
1122 dev_kfree_skb(bch->tx_skb); in tx_birq()
1123 if (get_next_bframe(bch)) in tx_birq()
1124 hfcpci_fill_fifo(bch); in tx_birq()
1145 struct bchannel *bch; in hfcpci_int() local
1187 bch = Sel_BCS(hc, hc->hw.bswapped ? 2 : 1); in hfcpci_int()
1188 if (bch) in hfcpci_int()
1189 main_rec_hfcpci(bch); in hfcpci_int()
1194 bch = Sel_BCS(hc, 2); in hfcpci_int()
1195 if (bch) in hfcpci_int()
1196 main_rec_hfcpci(bch); in hfcpci_int()
1201 bch = Sel_BCS(hc, hc->hw.bswapped ? 2 : 1); in hfcpci_int()
1202 if (bch) in hfcpci_int()
1203 tx_birq(bch); in hfcpci_int()
1208 bch = Sel_BCS(hc, 2); in hfcpci_int()
1209 if (bch) in hfcpci_int()
1210 tx_birq(bch); in hfcpci_int()
1237 mode_hfcpci(struct bchannel *bch, int bc, int protocol) in mode_hfcpci() argument
1239 struct hfc_pci *hc = bch->hw; in mode_hfcpci()
1243 if (bch->debug & DEBUG_HW_BCHANNEL) in mode_hfcpci()
1246 bch->state, protocol, bch->nr, bc); in mode_hfcpci()
1281 bch->state = -1; in mode_hfcpci()
1282 bch->nr = bc; in mode_hfcpci()
1285 if (bch->state == ISDN_P_NONE) in mode_hfcpci()
1304 if (bch->nr & 2) in mode_hfcpci()
1309 bch->state = ISDN_P_NONE; in mode_hfcpci()
1310 bch->nr = bc; in mode_hfcpci()
1311 test_and_clear_bit(FLG_HDLC, &bch->Flags); in mode_hfcpci()
1312 test_and_clear_bit(FLG_TRANSPARENT, &bch->Flags); in mode_hfcpci()
1315 bch->state = protocol; in mode_hfcpci()
1316 bch->nr = bc; in mode_hfcpci()
1347 test_and_set_bit(FLG_TRANSPARENT, &bch->Flags); in mode_hfcpci()
1350 bch->state = protocol; in mode_hfcpci()
1351 bch->nr = bc; in mode_hfcpci()
1376 test_and_set_bit(FLG_HDLC, &bch->Flags); in mode_hfcpci()
1430 set_hfcpci_rxtest(struct bchannel *bch, int protocol, int chan) in set_hfcpci_rxtest() argument
1432 struct hfc_pci *hc = bch->hw; in set_hfcpci_rxtest()
1434 if (bch->debug & DEBUG_HW_BCHANNEL) in set_hfcpci_rxtest()
1437 bch->state, protocol, bch->nr, chan); in set_hfcpci_rxtest()
1438 if (bch->nr != chan) { in set_hfcpci_rxtest()
1441 bch->nr, chan); in set_hfcpci_rxtest()
1446 bch->state = protocol; in set_hfcpci_rxtest()
1471 bch->state = protocol; in set_hfcpci_rxtest()
1505 deactivate_bchannel(struct bchannel *bch) in deactivate_bchannel() argument
1507 struct hfc_pci *hc = bch->hw; in deactivate_bchannel()
1511 mISDN_clear_bchannel(bch); in deactivate_bchannel()
1512 mode_hfcpci(bch, bch->nr, ISDN_P_NONE); in deactivate_bchannel()
1520 channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
1522 return mISDN_ctrl_bchannel(bch, cq); in channel_bctrl()
1527 struct bchannel *bch = container_of(ch, struct bchannel, ch); in hfc_bctrl() local
1528 struct hfc_pci *hc = bch->hw; in hfc_bctrl()
1532 if (bch->debug & DEBUG_HW) in hfc_bctrl()
1537 ret = set_hfcpci_rxtest(bch, ISDN_P_B_RAW, (int)(long)arg); in hfc_bctrl()
1542 ret = set_hfcpci_rxtest(bch, ISDN_P_B_HDLC, (int)(long)arg); in hfc_bctrl()
1547 mode_hfcpci(bch, bch->nr, ISDN_P_NONE); in hfc_bctrl()
1552 test_and_clear_bit(FLG_OPEN, &bch->Flags); in hfc_bctrl()
1553 deactivate_bchannel(bch); in hfc_bctrl()
1560 ret = channel_bctrl(bch, arg); in hfc_bctrl()
1659 struct bchannel *bch = container_of(ch, struct bchannel, ch); in hfcpci_l2l1B() local
1660 struct hfc_pci *hc = bch->hw; in hfcpci_l2l1B()
1668 ret = bchannel_senddata(bch, skb); in hfcpci_l2l1B()
1670 hfcpci_fill_fifo(bch); in hfcpci_l2l1B()
1677 if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags)) in hfcpci_l2l1B()
1678 ret = mode_hfcpci(bch, bch->nr, ch->protocol); in hfcpci_l2l1B()
1687 deactivate_bchannel(bch); in hfcpci_l2l1B()
1708 mode_hfcpci(&hc->bch[0], 1, -1); in inithfcpci()
1709 mode_hfcpci(&hc->bch[1], 2, -1); in inithfcpci()
1927 struct bchannel *bch; in open_bchannel() local
1933 bch = &hc->bch[rq->adr.channel - 1]; in open_bchannel()
1934 if (test_and_set_bit(FLG_OPEN, &bch->Flags)) in open_bchannel()
1936 bch->ch.protocol = rq->protocol; in open_bchannel()
1937 rq->ch = &bch->ch; /* TODO: E-channel */ in open_bchannel()
2053 mode_hfcpci(&hc->bch[0], 1, ISDN_P_NONE); in release_card()
2054 mode_hfcpci(&hc->bch[1], 2, ISDN_P_NONE); in release_card()
2066 mISDN_freebchannel(&hc->bch[1]); in release_card()
2067 mISDN_freebchannel(&hc->bch[0]); in release_card()
2091 card->bch[i].nr = i + 1; in setup_card()
2093 card->bch[i].debug = debug; in setup_card()
2094 mISDN_initbchannel(&card->bch[i], MAX_DATA_MEM, poll >> 1); in setup_card()
2095 card->bch[i].hw = card; in setup_card()
2096 card->bch[i].ch.send = hfcpci_l2l1B; in setup_card()
2097 card->bch[i].ch.ctrl = hfc_bctrl; in setup_card()
2098 card->bch[i].ch.nr = i + 1; in setup_card()
2099 list_add(&card->bch[i].ch.list, &card->dch.dev.bchannels); in setup_card()
2112 mISDN_freebchannel(&card->bch[1]); in setup_card()
2113 mISDN_freebchannel(&card->bch[0]); in setup_card()
2265 struct bchannel *bch; in _hfcpci_softirq() local
2271 bch = Sel_BCS(hc, hc->hw.bswapped ? 2 : 1); in _hfcpci_softirq()
2272 if (bch && bch->state == ISDN_P_B_RAW) { /* B1 rx&tx */ in _hfcpci_softirq()
2273 main_rec_hfcpci(bch); in _hfcpci_softirq()
2274 tx_birq(bch); in _hfcpci_softirq()
2276 bch = Sel_BCS(hc, hc->hw.bswapped ? 1 : 2); in _hfcpci_softirq()
2277 if (bch && bch->state == ISDN_P_B_RAW) { /* B2 rx&tx */ in _hfcpci_softirq()
2278 main_rec_hfcpci(bch); in _hfcpci_softirq()
2279 tx_birq(bch); in _hfcpci_softirq()