Lines Matching full:bch
48 static int hfcsusb_setup_bch(struct bchannel *bch, int protocol);
49 static void deactivate_bchannel(struct bchannel *bch);
199 struct bchannel *bch = container_of(ch, struct bchannel, ch); in hfcusb_l2l1B() local
200 struct hfcsusb *hw = bch->hw; in hfcusb_l2l1B()
211 ret = bchannel_senddata(bch, skb); in hfcusb_l2l1B()
220 if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags)) { in hfcusb_l2l1B()
221 hfcsusb_start_endpoint(hw, bch->nr - 1); in hfcusb_l2l1B()
222 ret = hfcsusb_setup_bch(bch, ch->protocol); in hfcusb_l2l1B()
230 deactivate_bchannel(bch); in hfcusb_l2l1B()
252 phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC); in hfcsusb_ph_info()
261 phi->bch[i].protocol = hw->bch[i].ch.protocol; in hfcsusb_ph_info()
262 phi->bch[i].Flags = hw->bch[i].Flags; in hfcsusb_ph_info()
265 struct_size(phi, bch, dch->dev.nrbchan), phi, GFP_ATOMIC); in hfcsusb_ph_info()
472 struct bchannel *bch; in open_bchannel() local
483 bch = &hw->bch[rq->adr.channel - 1]; in open_bchannel()
484 if (test_and_set_bit(FLG_OPEN, &bch->Flags)) in open_bchannel()
486 bch->ch.protocol = rq->protocol; in open_bchannel()
487 rq->ch = &bch->ch; in open_bchannel()
685 hfcsusb_setup_bch(struct bchannel *bch, int protocol) in hfcsusb_setup_bch() argument
687 struct hfcsusb *hw = bch->hw; in hfcsusb_setup_bch()
692 hw->name, __func__, bch->state, protocol, in hfcsusb_setup_bch()
693 bch->nr); in hfcsusb_setup_bch()
702 bch->state = -1; in hfcsusb_setup_bch()
705 if (bch->state == ISDN_P_NONE) in hfcsusb_setup_bch()
707 bch->state = ISDN_P_NONE; in hfcsusb_setup_bch()
708 clear_bit(FLG_HDLC, &bch->Flags); in hfcsusb_setup_bch()
709 clear_bit(FLG_TRANSPARENT, &bch->Flags); in hfcsusb_setup_bch()
713 bch->state = protocol; in hfcsusb_setup_bch()
714 set_bit(FLG_TRANSPARENT, &bch->Flags); in hfcsusb_setup_bch()
717 bch->state = protocol; in hfcsusb_setup_bch()
718 set_bit(FLG_HDLC, &bch->Flags); in hfcsusb_setup_bch()
728 write_reg(hw, HFCUSB_FIFO, (bch->nr == 1) ? 0 : 2); in hfcsusb_setup_bch()
731 write_reg(hw, HFCUSB_FIFO, (bch->nr == 1) ? 1 : 3); in hfcsusb_setup_bch()
737 if (test_bit(FLG_ACTIVE, &hw->bch[0].Flags)) { in hfcsusb_setup_bch()
741 if (test_bit(FLG_ACTIVE, &hw->bch[1].Flags)) { in hfcsusb_setup_bch()
749 handle_led(hw, (bch->nr == 1) ? LED_B1_ON : LED_B2_ON); in hfcsusb_setup_bch()
751 handle_led(hw, (bch->nr == 1) ? LED_B1_OFF : in hfcsusb_setup_bch()
797 channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
799 return mISDN_ctrl_bchannel(bch, cq); in channel_bctrl()
817 "dch(%p) bch(%p) ech(%p)\n", in hfcsusb_rx_frame()
819 fifo->dch, fifo->bch, fifo->ech); in hfcsusb_rx_frame()
824 if ((!!fifo->dch + !!fifo->bch + !!fifo->ech) != 1) { in hfcsusb_rx_frame()
836 if (fifo->bch) { in hfcsusb_rx_frame()
837 if (test_bit(FLG_RX_OFF, &fifo->bch->Flags)) { in hfcsusb_rx_frame()
838 fifo->bch->dropcnt += len; in hfcsusb_rx_frame()
842 maxlen = bchannel_get_rxbuf(fifo->bch, len); in hfcsusb_rx_frame()
843 rx_skb = fifo->bch->rx_skb; in hfcsusb_rx_frame()
848 hw->name, fifo->bch->nr, len); in hfcsusb_rx_frame()
852 maxlen = fifo->bch->maxlen; in hfcsusb_rx_frame()
853 hdlc = test_bit(FLG_HDLC, &fifo->bch->Flags); in hfcsusb_rx_frame()
912 if (fifo->bch) in hfcsusb_rx_frame()
913 recv_Bchannel(fifo->bch, MISDN_ID_ANY, in hfcsusb_rx_frame()
935 recv_Bchannel(fifo->bch, MISDN_ID_ANY, false); in hfcsusb_rx_frame()
1183 } else if (fifo->bch) { in tx_iso_complete()
1184 tx_skb = fifo->bch->tx_skb; in tx_iso_complete()
1185 tx_idx = &fifo->bch->tx_idx; in tx_iso_complete()
1186 hdlc = test_bit(FLG_HDLC, &fifo->bch->Flags); in tx_iso_complete()
1188 test_bit(FLG_FILLEMPTY, &fifo->bch->Flags)) in tx_iso_complete()
1191 printk(KERN_DEBUG "%s: %s: neither BCH nor DCH\n", in tx_iso_complete()
1282 memset(p, fifo->bch->fill[0], in tx_iso_complete()
1342 else if (fifo->bch && in tx_iso_complete()
1343 get_next_bframe(fifo->bch)) in tx_iso_complete()
1344 tx_skb = fifo->bch->tx_skb; in tx_iso_complete()
1766 mISDN_freebchannel(&hw->bch[1]); in release_hw()
1767 mISDN_freebchannel(&hw->bch[0]); in release_hw()
1784 deactivate_bchannel(struct bchannel *bch) in deactivate_bchannel() argument
1786 struct hfcsusb *hw = bch->hw; in deactivate_bchannel()
1789 if (bch->debug & DEBUG_HW) in deactivate_bchannel()
1790 printk(KERN_DEBUG "%s: %s: bch->nr(%i)\n", in deactivate_bchannel()
1791 hw->name, __func__, bch->nr); in deactivate_bchannel()
1794 mISDN_clear_bchannel(bch); in deactivate_bchannel()
1796 hfcsusb_setup_bch(bch, ISDN_P_NONE); in deactivate_bchannel()
1797 hfcsusb_stop_endpoint(hw, bch->nr - 1); in deactivate_bchannel()
1806 struct bchannel *bch = container_of(ch, struct bchannel, ch); in hfc_bctrl() local
1809 if (bch->debug & DEBUG_HW) in hfc_bctrl()
1820 test_and_clear_bit(FLG_OPEN, &bch->Flags); in hfc_bctrl()
1821 deactivate_bchannel(bch); in hfc_bctrl()
1828 ret = channel_bctrl(bch, arg); in hfc_bctrl()
1864 hw->bch[i].nr = i + 1; in setup_instance()
1866 hw->bch[i].debug = debug; in setup_instance()
1867 mISDN_initbchannel(&hw->bch[i], MAX_DATA_MEM, poll >> 1); in setup_instance()
1868 hw->bch[i].hw = hw; in setup_instance()
1869 hw->bch[i].ch.send = hfcusb_l2l1B; in setup_instance()
1870 hw->bch[i].ch.ctrl = hfc_bctrl; in setup_instance()
1871 hw->bch[i].ch.nr = i + 1; in setup_instance()
1872 list_add(&hw->bch[i].ch.list, &hw->dch.dev.bchannels); in setup_instance()
1875 hw->fifos[HFCUSB_B1_TX].bch = &hw->bch[0]; in setup_instance()
1876 hw->fifos[HFCUSB_B1_RX].bch = &hw->bch[0]; in setup_instance()
1877 hw->fifos[HFCUSB_B2_TX].bch = &hw->bch[1]; in setup_instance()
1878 hw->fifos[HFCUSB_B2_RX].bch = &hw->bch[1]; in setup_instance()
1904 mISDN_freebchannel(&hw->bch[1]); in setup_instance()
1905 mISDN_freebchannel(&hw->bch[0]); in setup_instance()