Lines Matching refs:bch
134 struct bchannel bch[2];
309 if (test_bit(FLG_ACTIVE, &hc->bch[0].Flags) &&
310 (hc->bch[0].nr & channel))
311 return &hc->bch[0];
312 else if (test_bit(FLG_ACTIVE, &hc->bch[1].Flags) &&
313 (hc->bch[1].nr & channel))
314 return &hc->bch[1];
367 if (hc->bch[fifo].debug & DEBUG_HW_BCHANNEL)
381 if (hc->bch[fifo].debug & DEBUG_HW_BCHANNEL)
393 hfcpci_empty_bfifo(struct bchannel *bch, struct bzfifo *bz,
400 if ((bch->debug & DEBUG_HW_BCHANNEL) && !(bch->debug & DEBUG_HW_BFIFO))
409 if (bch->debug & DEBUG_HW)
413 bch->err_inv++;
418 bch->rx_skb = mI_alloc_skb(count - 3, GFP_ATOMIC);
419 if (!bch->rx_skb) {
424 ptr = skb_put(bch->rx_skb, count);
444 recv_Bchannel(bch, MISDN_ID_ANY, false);
534 hfcpci_empty_fifo_trans(struct bchannel *bch, struct bzfifo *rxbz,
563 if (test_bit(FLG_RX_OFF, &bch->Flags)) {
564 bch->dropcnt += fcnt_rx;
568 maxlen = bchannel_get_rxbuf(bch, fcnt_rx);
570 pr_warn("B%d: No bufferspace for %d bytes\n", bch->nr, fcnt_rx);
572 ptr = skb_put(bch->rx_skb, fcnt_rx);
589 recv_Bchannel(bch, fcnt_tx, false); /* bch, id, !force */
598 main_rec_hfcpci(struct bchannel *bch)
600 struct hfc_pci *hc = bch->hw;
607 if ((bch->nr & 2) && (!hc->hw.bswapped)) {
621 if (bch->debug & DEBUG_HW_BCHANNEL)
623 bch->nr, rxbz->f1, rxbz->f2);
630 if (bch->debug & DEBUG_HW_BCHANNEL)
633 bch->nr, le16_to_cpu(zp->z1),
635 hfcpci_empty_bfifo(bch, rxbz, bdata, rcnt);
648 } else if (test_bit(FLG_TRANSPARENT, &bch->Flags)) {
649 hfcpci_empty_fifo_trans(bch, rxbz, txbz, bdata);
739 hfcpci_fill_fifo(struct bchannel *bch)
741 struct hfc_pci *hc = bch->hw;
749 if ((bch->debug & DEBUG_HW_BCHANNEL) && !(bch->debug & DEBUG_HW_BFIFO))
751 if ((!bch->tx_skb) || bch->tx_skb->len == 0) {
752 if (!test_bit(FLG_FILLEMPTY, &bch->Flags) &&
753 !test_bit(FLG_TRANSPARENT, &bch->Flags))
757 count = bch->tx_skb->len - bch->tx_idx;
759 if ((bch->nr & 2) && (!hc->hw.bswapped)) {
767 if (test_bit(FLG_TRANSPARENT, &bch->Flags)) {
770 if (bch->debug & DEBUG_HW_BCHANNEL)
772 "cnt(%d) z1(%x) z2(%x)\n", bch->nr, count,
777 if (test_bit(FLG_FILLEMPTY, &bch->Flags)) {
788 if (bch->debug & DEBUG_HW_BFIFO)
794 memset(dst, bch->fill[0], maxlen); /* first copy */
798 memset(dst, bch->fill[0], count);
808 count = bch->tx_skb->len - bch->tx_idx;
819 src = bch->tx_skb->data + bch->tx_idx;
824 if (bch->debug & DEBUG_HW_BFIFO)
829 bch->tx_idx += count;
840 if (bch->tx_idx < bch->tx_skb->len)
842 dev_kfree_skb_any(bch->tx_skb);
843 if (get_next_bframe(bch))
847 if (bch->debug & DEBUG_HW_BCHANNEL)
850 __func__, bch->nr, bz->f1, bz->f2,
856 if (bch->debug & DEBUG_HW_BCHANNEL)
867 if (bch->debug & DEBUG_HW_BCHANNEL)
869 bch->nr, count, maxlen);
872 if (bch->debug & DEBUG_HW_BCHANNEL)
882 src = bch->tx_skb->data + bch->tx_idx; /* source pointer */
898 dev_kfree_skb_any(bch->tx_skb);
899 get_next_bframe(bch);
1117 tx_birq(struct bchannel *bch)
1119 if (bch->tx_skb && bch->tx_idx < bch->tx_skb->len)
1120 hfcpci_fill_fifo(bch);
1122 dev_kfree_skb_any(bch->tx_skb);
1123 if (get_next_bframe(bch))
1124 hfcpci_fill_fifo(bch);
1145 struct bchannel *bch;
1187 bch = Sel_BCS(hc, hc->hw.bswapped ? 2 : 1);
1188 if (bch)
1189 main_rec_hfcpci(bch);
1194 bch = Sel_BCS(hc, 2);
1195 if (bch)
1196 main_rec_hfcpci(bch);
1201 bch = Sel_BCS(hc, hc->hw.bswapped ? 2 : 1);
1202 if (bch)
1203 tx_birq(bch);
1208 bch = Sel_BCS(hc, 2);
1209 if (bch)
1210 tx_birq(bch);
1237 mode_hfcpci(struct bchannel *bch, int bc, int protocol)
1239 struct hfc_pci *hc = bch->hw;
1243 if (bch->debug & DEBUG_HW_BCHANNEL)
1246 bch->state, protocol, bch->nr, bc);
1281 bch->state = -1;
1282 bch->nr = bc;
1285 if (bch->state == ISDN_P_NONE)
1304 if (bch->nr & 2)
1309 bch->state = ISDN_P_NONE;
1310 bch->nr = bc;
1311 test_and_clear_bit(FLG_HDLC, &bch->Flags);
1312 test_and_clear_bit(FLG_TRANSPARENT, &bch->Flags);
1315 bch->state = protocol;
1316 bch->nr = bc;
1347 test_and_set_bit(FLG_TRANSPARENT, &bch->Flags);
1350 bch->state = protocol;
1351 bch->nr = bc;
1376 test_and_set_bit(FLG_HDLC, &bch->Flags);
1430 set_hfcpci_rxtest(struct bchannel *bch, int protocol, int chan)
1432 struct hfc_pci *hc = bch->hw;
1434 if (bch->debug & DEBUG_HW_BCHANNEL)
1437 bch->state, protocol, bch->nr, chan);
1438 if (bch->nr != chan) {
1441 bch->nr, chan);
1446 bch->state = protocol;
1471 bch->state = protocol;
1505 deactivate_bchannel(struct bchannel *bch)
1507 struct hfc_pci *hc = bch->hw;
1511 mISDN_clear_bchannel(bch);
1512 mode_hfcpci(bch, bch->nr, ISDN_P_NONE);
1520 channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq)
1522 return mISDN_ctrl_bchannel(bch, cq);
1527 struct bchannel *bch = container_of(ch, struct bchannel, ch);
1528 struct hfc_pci *hc = bch->hw;
1532 if (bch->debug & DEBUG_HW)
1537 ret = set_hfcpci_rxtest(bch, ISDN_P_B_RAW, (int)(long)arg);
1542 ret = set_hfcpci_rxtest(bch, ISDN_P_B_HDLC, (int)(long)arg);
1547 mode_hfcpci(bch, bch->nr, ISDN_P_NONE);
1552 test_and_clear_bit(FLG_OPEN, &bch->Flags);
1553 deactivate_bchannel(bch);
1560 ret = channel_bctrl(bch, arg);
1664 struct bchannel *bch = container_of(ch, struct bchannel, ch);
1665 struct hfc_pci *hc = bch->hw;
1673 ret = bchannel_senddata(bch, skb);
1675 hfcpci_fill_fifo(bch);
1682 if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags))
1683 ret = mode_hfcpci(bch, bch->nr, ch->protocol);
1692 deactivate_bchannel(bch);
1713 mode_hfcpci(&hc->bch[0], 1, -1);
1714 mode_hfcpci(&hc->bch[1], 2, -1);
1932 struct bchannel *bch;
1938 bch = &hc->bch[rq->adr.channel - 1];
1939 if (test_and_set_bit(FLG_OPEN, &bch->Flags))
1941 bch->ch.protocol = rq->protocol;
1942 rq->ch = &bch->ch; /* TODO: E-channel */
2063 mode_hfcpci(&hc->bch[0], 1, ISDN_P_NONE);
2064 mode_hfcpci(&hc->bch[1], 2, ISDN_P_NONE);
2076 mISDN_freebchannel(&hc->bch[1]);
2077 mISDN_freebchannel(&hc->bch[0]);
2101 card->bch[i].nr = i + 1;
2103 card->bch[i].debug = debug;
2104 mISDN_initbchannel(&card->bch[i], MAX_DATA_MEM, poll >> 1);
2105 card->bch[i].hw = card;
2106 card->bch[i].ch.send = hfcpci_l2l1B;
2107 card->bch[i].ch.ctrl = hfc_bctrl;
2108 card->bch[i].ch.nr = i + 1;
2109 list_add(&card->bch[i].ch.list, &card->dch.dev.bchannels);
2122 mISDN_freebchannel(&card->bch[1]);
2123 mISDN_freebchannel(&card->bch[0]);
2275 struct bchannel *bch;
2281 bch = Sel_BCS(hc, hc->hw.bswapped ? 2 : 1);
2282 if (bch && bch->state == ISDN_P_B_RAW) { /* B1 rx&tx */
2283 main_rec_hfcpci(bch);
2284 tx_birq(bch);
2286 bch = Sel_BCS(hc, hc->hw.bswapped ? 1 : 2);
2287 if (bch && bch->state == ISDN_P_B_RAW) { /* B2 rx&tx */
2288 main_rec_hfcpci(bch);
2289 tx_birq(bch);