Lines Matching full:bch
135 struct bchannel bch[2]; member
310 if (test_bit(FLG_ACTIVE, &hc->bch[0].Flags) && in Sel_BCS()
311 (hc->bch[0].nr & channel)) in Sel_BCS()
312 return &hc->bch[0]; in Sel_BCS()
313 else if (test_bit(FLG_ACTIVE, &hc->bch[1].Flags) && in Sel_BCS()
314 (hc->bch[1].nr & channel)) in Sel_BCS()
315 return &hc->bch[1]; in Sel_BCS()
368 if (hc->bch[fifo].debug & DEBUG_HW_BCHANNEL) in hfcpci_clear_fifo_tx()
382 if (hc->bch[fifo].debug & DEBUG_HW_BCHANNEL) in hfcpci_clear_fifo_tx()
394 hfcpci_empty_bfifo(struct bchannel *bch, struct bzfifo *bz, in hfcpci_empty_bfifo() argument
401 if ((bch->debug & DEBUG_HW_BCHANNEL) && !(bch->debug & DEBUG_HW_BFIFO)) in hfcpci_empty_bfifo()
410 if (bch->debug & DEBUG_HW) in hfcpci_empty_bfifo()
414 bch->err_inv++; in hfcpci_empty_bfifo()
419 bch->rx_skb = mI_alloc_skb(count - 3, GFP_ATOMIC); in hfcpci_empty_bfifo()
420 if (!bch->rx_skb) { in hfcpci_empty_bfifo()
425 ptr = skb_put(bch->rx_skb, count); in hfcpci_empty_bfifo()
445 recv_Bchannel(bch, MISDN_ID_ANY, false); in hfcpci_empty_bfifo()
535 hfcpci_empty_fifo_trans(struct bchannel *bch, struct bzfifo *rxbz, in hfcpci_empty_fifo_trans() argument
564 if (test_bit(FLG_RX_OFF, &bch->Flags)) { in hfcpci_empty_fifo_trans()
565 bch->dropcnt += fcnt_rx; in hfcpci_empty_fifo_trans()
569 maxlen = bchannel_get_rxbuf(bch, fcnt_rx); in hfcpci_empty_fifo_trans()
571 pr_warn("B%d: No bufferspace for %d bytes\n", bch->nr, fcnt_rx); in hfcpci_empty_fifo_trans()
573 ptr = skb_put(bch->rx_skb, fcnt_rx); in hfcpci_empty_fifo_trans()
590 recv_Bchannel(bch, fcnt_tx, false); /* bch, id, !force */ in hfcpci_empty_fifo_trans()
599 main_rec_hfcpci(struct bchannel *bch) in main_rec_hfcpci() argument
601 struct hfc_pci *hc = bch->hw; in main_rec_hfcpci()
608 if ((bch->nr & 2) && (!hc->hw.bswapped)) { in main_rec_hfcpci()
622 if (bch->debug & DEBUG_HW_BCHANNEL) in main_rec_hfcpci()
624 bch->nr, rxbz->f1, rxbz->f2); in main_rec_hfcpci()
631 if (bch->debug & DEBUG_HW_BCHANNEL) in main_rec_hfcpci()
634 bch->nr, le16_to_cpu(zp->z1), in main_rec_hfcpci()
636 hfcpci_empty_bfifo(bch, rxbz, bdata, rcnt); in main_rec_hfcpci()
649 } else if (test_bit(FLG_TRANSPARENT, &bch->Flags)) { in main_rec_hfcpci()
650 hfcpci_empty_fifo_trans(bch, rxbz, txbz, bdata); in main_rec_hfcpci()
740 hfcpci_fill_fifo(struct bchannel *bch) in hfcpci_fill_fifo() argument
742 struct hfc_pci *hc = bch->hw; in hfcpci_fill_fifo()
750 if ((bch->debug & DEBUG_HW_BCHANNEL) && !(bch->debug & DEBUG_HW_BFIFO)) in hfcpci_fill_fifo()
752 if ((!bch->tx_skb) || bch->tx_skb->len == 0) { in hfcpci_fill_fifo()
753 if (!test_bit(FLG_FILLEMPTY, &bch->Flags) && in hfcpci_fill_fifo()
754 !test_bit(FLG_TRANSPARENT, &bch->Flags)) in hfcpci_fill_fifo()
758 count = bch->tx_skb->len - bch->tx_idx; in hfcpci_fill_fifo()
760 if ((bch->nr & 2) && (!hc->hw.bswapped)) { in hfcpci_fill_fifo()
768 if (test_bit(FLG_TRANSPARENT, &bch->Flags)) { in hfcpci_fill_fifo()
771 if (bch->debug & DEBUG_HW_BCHANNEL) in hfcpci_fill_fifo()
773 "cnt(%d) z1(%x) z2(%x)\n", bch->nr, count, in hfcpci_fill_fifo()
778 if (test_bit(FLG_FILLEMPTY, &bch->Flags)) { in hfcpci_fill_fifo()
789 if (bch->debug & DEBUG_HW_BFIFO) in hfcpci_fill_fifo()
795 memset(dst, bch->fill[0], maxlen); /* first copy */ in hfcpci_fill_fifo()
799 memset(dst, bch->fill[0], count); in hfcpci_fill_fifo()
809 count = bch->tx_skb->len - bch->tx_idx; in hfcpci_fill_fifo()
820 src = bch->tx_skb->data + bch->tx_idx; in hfcpci_fill_fifo()
825 if (bch->debug & DEBUG_HW_BFIFO) in hfcpci_fill_fifo()
830 bch->tx_idx += count; in hfcpci_fill_fifo()
841 if (bch->tx_idx < bch->tx_skb->len) in hfcpci_fill_fifo()
843 dev_kfree_skb_any(bch->tx_skb); in hfcpci_fill_fifo()
844 if (get_next_bframe(bch)) in hfcpci_fill_fifo()
848 if (bch->debug & DEBUG_HW_BCHANNEL) in hfcpci_fill_fifo()
851 __func__, bch->nr, bz->f1, bz->f2, in hfcpci_fill_fifo()
857 if (bch->debug & DEBUG_HW_BCHANNEL) in hfcpci_fill_fifo()
868 if (bch->debug & DEBUG_HW_BCHANNEL) in hfcpci_fill_fifo()
870 bch->nr, count, maxlen); in hfcpci_fill_fifo()
873 if (bch->debug & DEBUG_HW_BCHANNEL) in hfcpci_fill_fifo()
883 src = bch->tx_skb->data + bch->tx_idx; /* source pointer */ in hfcpci_fill_fifo()
899 dev_kfree_skb_any(bch->tx_skb); in hfcpci_fill_fifo()
900 get_next_bframe(bch); in hfcpci_fill_fifo()
1118 tx_birq(struct bchannel *bch) in tx_birq() argument
1120 if (bch->tx_skb && bch->tx_idx < bch->tx_skb->len) in tx_birq()
1121 hfcpci_fill_fifo(bch); in tx_birq()
1123 dev_kfree_skb_any(bch->tx_skb); in tx_birq()
1124 if (get_next_bframe(bch)) in tx_birq()
1125 hfcpci_fill_fifo(bch); in tx_birq()
1146 struct bchannel *bch; in hfcpci_int() local
1188 bch = Sel_BCS(hc, hc->hw.bswapped ? 2 : 1); in hfcpci_int()
1189 if (bch) in hfcpci_int()
1190 main_rec_hfcpci(bch); in hfcpci_int()
1195 bch = Sel_BCS(hc, 2); in hfcpci_int()
1196 if (bch) in hfcpci_int()
1197 main_rec_hfcpci(bch); in hfcpci_int()
1202 bch = Sel_BCS(hc, hc->hw.bswapped ? 2 : 1); in hfcpci_int()
1203 if (bch) in hfcpci_int()
1204 tx_birq(bch); in hfcpci_int()
1209 bch = Sel_BCS(hc, 2); in hfcpci_int()
1210 if (bch) in hfcpci_int()
1211 tx_birq(bch); in hfcpci_int()
1238 mode_hfcpci(struct bchannel *bch, int bc, int protocol) in mode_hfcpci() argument
1240 struct hfc_pci *hc = bch->hw; in mode_hfcpci()
1244 if (bch->debug & DEBUG_HW_BCHANNEL) in mode_hfcpci()
1247 bch->state, protocol, bch->nr, bc); in mode_hfcpci()
1282 bch->state = -1; in mode_hfcpci()
1283 bch->nr = bc; in mode_hfcpci()
1286 if (bch->state == ISDN_P_NONE) in mode_hfcpci()
1305 if (bch->nr & 2) in mode_hfcpci()
1310 bch->state = ISDN_P_NONE; in mode_hfcpci()
1311 bch->nr = bc; in mode_hfcpci()
1312 test_and_clear_bit(FLG_HDLC, &bch->Flags); in mode_hfcpci()
1313 test_and_clear_bit(FLG_TRANSPARENT, &bch->Flags); in mode_hfcpci()
1316 bch->state = protocol; in mode_hfcpci()
1317 bch->nr = bc; in mode_hfcpci()
1348 test_and_set_bit(FLG_TRANSPARENT, &bch->Flags); in mode_hfcpci()
1351 bch->state = protocol; in mode_hfcpci()
1352 bch->nr = bc; in mode_hfcpci()
1377 test_and_set_bit(FLG_HDLC, &bch->Flags); in mode_hfcpci()
1431 set_hfcpci_rxtest(struct bchannel *bch, int protocol, int chan) in set_hfcpci_rxtest() argument
1433 struct hfc_pci *hc = bch->hw; in set_hfcpci_rxtest()
1435 if (bch->debug & DEBUG_HW_BCHANNEL) in set_hfcpci_rxtest()
1438 bch->state, protocol, bch->nr, chan); in set_hfcpci_rxtest()
1439 if (bch->nr != chan) { in set_hfcpci_rxtest()
1442 bch->nr, chan); in set_hfcpci_rxtest()
1447 bch->state = protocol; in set_hfcpci_rxtest()
1472 bch->state = protocol; in set_hfcpci_rxtest()
1506 deactivate_bchannel(struct bchannel *bch) in deactivate_bchannel() argument
1508 struct hfc_pci *hc = bch->hw; in deactivate_bchannel()
1512 mISDN_clear_bchannel(bch); in deactivate_bchannel()
1513 mode_hfcpci(bch, bch->nr, ISDN_P_NONE); in deactivate_bchannel()
1521 channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
1523 return mISDN_ctrl_bchannel(bch, cq); in channel_bctrl()
1528 struct bchannel *bch = container_of(ch, struct bchannel, ch); in hfc_bctrl() local
1529 struct hfc_pci *hc = bch->hw; in hfc_bctrl()
1533 if (bch->debug & DEBUG_HW) in hfc_bctrl()
1538 ret = set_hfcpci_rxtest(bch, ISDN_P_B_RAW, (int)(long)arg); in hfc_bctrl()
1543 ret = set_hfcpci_rxtest(bch, ISDN_P_B_HDLC, (int)(long)arg); in hfc_bctrl()
1548 mode_hfcpci(bch, bch->nr, ISDN_P_NONE); in hfc_bctrl()
1553 test_and_clear_bit(FLG_OPEN, &bch->Flags); in hfc_bctrl()
1554 deactivate_bchannel(bch); in hfc_bctrl()
1561 ret = channel_bctrl(bch, arg); in hfc_bctrl()
1665 struct bchannel *bch = container_of(ch, struct bchannel, ch); in hfcpci_l2l1B() local
1666 struct hfc_pci *hc = bch->hw; in hfcpci_l2l1B()
1674 ret = bchannel_senddata(bch, skb); in hfcpci_l2l1B()
1676 hfcpci_fill_fifo(bch); in hfcpci_l2l1B()
1683 if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags)) in hfcpci_l2l1B()
1684 ret = mode_hfcpci(bch, bch->nr, ch->protocol); in hfcpci_l2l1B()
1693 deactivate_bchannel(bch); in hfcpci_l2l1B()
1714 mode_hfcpci(&hc->bch[0], 1, -1); in inithfcpci()
1715 mode_hfcpci(&hc->bch[1], 2, -1); in inithfcpci()
1933 struct bchannel *bch; in open_bchannel() local
1939 bch = &hc->bch[rq->adr.channel - 1]; in open_bchannel()
1940 if (test_and_set_bit(FLG_OPEN, &bch->Flags)) in open_bchannel()
1942 bch->ch.protocol = rq->protocol; in open_bchannel()
1943 rq->ch = &bch->ch; /* TODO: E-channel */ in open_bchannel()
2064 mode_hfcpci(&hc->bch[0], 1, ISDN_P_NONE); in release_card()
2065 mode_hfcpci(&hc->bch[1], 2, ISDN_P_NONE); in release_card()
2077 mISDN_freebchannel(&hc->bch[1]); in release_card()
2078 mISDN_freebchannel(&hc->bch[0]); in release_card()
2102 card->bch[i].nr = i + 1; in setup_card()
2104 card->bch[i].debug = debug; in setup_card()
2105 mISDN_initbchannel(&card->bch[i], MAX_DATA_MEM, poll >> 1); in setup_card()
2106 card->bch[i].hw = card; in setup_card()
2107 card->bch[i].ch.send = hfcpci_l2l1B; in setup_card()
2108 card->bch[i].ch.ctrl = hfc_bctrl; in setup_card()
2109 card->bch[i].ch.nr = i + 1; in setup_card()
2110 list_add(&card->bch[i].ch.list, &card->dch.dev.bchannels); in setup_card()
2123 mISDN_freebchannel(&card->bch[1]); in setup_card()
2124 mISDN_freebchannel(&card->bch[0]); in setup_card()
2276 struct bchannel *bch; in _hfcpci_softirq() local
2282 bch = Sel_BCS(hc, hc->hw.bswapped ? 2 : 1); in _hfcpci_softirq()
2283 if (bch && bch->state == ISDN_P_B_RAW) { /* B1 rx&tx */ in _hfcpci_softirq()
2284 main_rec_hfcpci(bch); in _hfcpci_softirq()
2285 tx_birq(bch); in _hfcpci_softirq()
2287 bch = Sel_BCS(hc, hc->hw.bswapped ? 1 : 2); in _hfcpci_softirq()
2288 if (bch && bch->state == ISDN_P_B_RAW) { /* B2 rx&tx */ in _hfcpci_softirq()
2289 main_rec_hfcpci(bch); in _hfcpci_softirq()
2290 tx_birq(bch); in _hfcpci_softirq()