Lines Matching refs:bch

47 static int  hfcsusb_setup_bch(struct bchannel *bch, int protocol);
48 static void deactivate_bchannel(struct bchannel *bch);
198 struct bchannel *bch = container_of(ch, struct bchannel, ch); in hfcusb_l2l1B() local
199 struct hfcsusb *hw = bch->hw; in hfcusb_l2l1B()
210 ret = bchannel_senddata(bch, skb); in hfcusb_l2l1B()
219 if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags)) { in hfcusb_l2l1B()
220 hfcsusb_start_endpoint(hw, bch->nr - 1); in hfcusb_l2l1B()
221 ret = hfcsusb_setup_bch(bch, ch->protocol); in hfcusb_l2l1B()
229 deactivate_bchannel(bch); in hfcusb_l2l1B()
251 phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC); in hfcsusb_ph_info()
260 phi->bch[i].protocol = hw->bch[i].ch.protocol; in hfcsusb_ph_info()
261 phi->bch[i].Flags = hw->bch[i].Flags; in hfcsusb_ph_info()
264 struct_size(phi, bch, dch->dev.nrbchan), phi, GFP_ATOMIC); in hfcsusb_ph_info()
471 struct bchannel *bch; in open_bchannel() local
482 bch = &hw->bch[rq->adr.channel - 1]; in open_bchannel()
483 if (test_and_set_bit(FLG_OPEN, &bch->Flags)) in open_bchannel()
485 bch->ch.protocol = rq->protocol; in open_bchannel()
486 rq->ch = &bch->ch; in open_bchannel()
684 hfcsusb_setup_bch(struct bchannel *bch, int protocol) in hfcsusb_setup_bch() argument
686 struct hfcsusb *hw = bch->hw; in hfcsusb_setup_bch()
691 hw->name, __func__, bch->state, protocol, in hfcsusb_setup_bch()
692 bch->nr); in hfcsusb_setup_bch()
701 bch->state = -1; in hfcsusb_setup_bch()
704 if (bch->state == ISDN_P_NONE) in hfcsusb_setup_bch()
706 bch->state = ISDN_P_NONE; in hfcsusb_setup_bch()
707 clear_bit(FLG_HDLC, &bch->Flags); in hfcsusb_setup_bch()
708 clear_bit(FLG_TRANSPARENT, &bch->Flags); in hfcsusb_setup_bch()
712 bch->state = protocol; in hfcsusb_setup_bch()
713 set_bit(FLG_TRANSPARENT, &bch->Flags); in hfcsusb_setup_bch()
716 bch->state = protocol; in hfcsusb_setup_bch()
717 set_bit(FLG_HDLC, &bch->Flags); in hfcsusb_setup_bch()
727 write_reg(hw, HFCUSB_FIFO, (bch->nr == 1) ? 0 : 2); in hfcsusb_setup_bch()
730 write_reg(hw, HFCUSB_FIFO, (bch->nr == 1) ? 1 : 3); in hfcsusb_setup_bch()
736 if (test_bit(FLG_ACTIVE, &hw->bch[0].Flags)) { in hfcsusb_setup_bch()
740 if (test_bit(FLG_ACTIVE, &hw->bch[1].Flags)) { in hfcsusb_setup_bch()
748 handle_led(hw, (bch->nr == 1) ? LED_B1_ON : LED_B2_ON); in hfcsusb_setup_bch()
750 handle_led(hw, (bch->nr == 1) ? LED_B1_OFF : in hfcsusb_setup_bch()
796 channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
798 return mISDN_ctrl_bchannel(bch, cq); in channel_bctrl()
818 fifo->dch, fifo->bch, fifo->ech); in hfcsusb_rx_frame()
823 if ((!!fifo->dch + !!fifo->bch + !!fifo->ech) != 1) { in hfcsusb_rx_frame()
835 if (fifo->bch) { in hfcsusb_rx_frame()
836 if (test_bit(FLG_RX_OFF, &fifo->bch->Flags)) { in hfcsusb_rx_frame()
837 fifo->bch->dropcnt += len; in hfcsusb_rx_frame()
841 maxlen = bchannel_get_rxbuf(fifo->bch, len); in hfcsusb_rx_frame()
842 rx_skb = fifo->bch->rx_skb; in hfcsusb_rx_frame()
847 hw->name, fifo->bch->nr, len); in hfcsusb_rx_frame()
851 maxlen = fifo->bch->maxlen; in hfcsusb_rx_frame()
852 hdlc = test_bit(FLG_HDLC, &fifo->bch->Flags); in hfcsusb_rx_frame()
911 if (fifo->bch) in hfcsusb_rx_frame()
912 recv_Bchannel(fifo->bch, MISDN_ID_ANY, in hfcsusb_rx_frame()
934 recv_Bchannel(fifo->bch, MISDN_ID_ANY, false); in hfcsusb_rx_frame()
1182 } else if (fifo->bch) { in tx_iso_complete()
1183 tx_skb = fifo->bch->tx_skb; in tx_iso_complete()
1184 tx_idx = &fifo->bch->tx_idx; in tx_iso_complete()
1185 hdlc = test_bit(FLG_HDLC, &fifo->bch->Flags); in tx_iso_complete()
1187 test_bit(FLG_FILLEMPTY, &fifo->bch->Flags)) in tx_iso_complete()
1281 memset(p, fifo->bch->fill[0], in tx_iso_complete()
1341 else if (fifo->bch && in tx_iso_complete()
1342 get_next_bframe(fifo->bch)) in tx_iso_complete()
1343 tx_skb = fifo->bch->tx_skb; in tx_iso_complete()
1765 mISDN_freebchannel(&hw->bch[1]); in release_hw()
1766 mISDN_freebchannel(&hw->bch[0]); in release_hw()
1783 deactivate_bchannel(struct bchannel *bch) in deactivate_bchannel() argument
1785 struct hfcsusb *hw = bch->hw; in deactivate_bchannel()
1788 if (bch->debug & DEBUG_HW) in deactivate_bchannel()
1790 hw->name, __func__, bch->nr); in deactivate_bchannel()
1793 mISDN_clear_bchannel(bch); in deactivate_bchannel()
1795 hfcsusb_setup_bch(bch, ISDN_P_NONE); in deactivate_bchannel()
1796 hfcsusb_stop_endpoint(hw, bch->nr - 1); in deactivate_bchannel()
1805 struct bchannel *bch = container_of(ch, struct bchannel, ch); in hfc_bctrl() local
1808 if (bch->debug & DEBUG_HW) in hfc_bctrl()
1819 test_and_clear_bit(FLG_OPEN, &bch->Flags); in hfc_bctrl()
1820 deactivate_bchannel(bch); in hfc_bctrl()
1827 ret = channel_bctrl(bch, arg); in hfc_bctrl()
1863 hw->bch[i].nr = i + 1; in setup_instance()
1865 hw->bch[i].debug = debug; in setup_instance()
1866 mISDN_initbchannel(&hw->bch[i], MAX_DATA_MEM, poll >> 1); in setup_instance()
1867 hw->bch[i].hw = hw; in setup_instance()
1868 hw->bch[i].ch.send = hfcusb_l2l1B; in setup_instance()
1869 hw->bch[i].ch.ctrl = hfc_bctrl; in setup_instance()
1870 hw->bch[i].ch.nr = i + 1; in setup_instance()
1871 list_add(&hw->bch[i].ch.list, &hw->dch.dev.bchannels); in setup_instance()
1874 hw->fifos[HFCUSB_B1_TX].bch = &hw->bch[0]; in setup_instance()
1875 hw->fifos[HFCUSB_B1_RX].bch = &hw->bch[0]; in setup_instance()
1876 hw->fifos[HFCUSB_B2_TX].bch = &hw->bch[1]; in setup_instance()
1877 hw->fifos[HFCUSB_B2_RX].bch = &hw->bch[1]; in setup_instance()
1903 mISDN_freebchannel(&hw->bch[1]); in setup_instance()
1904 mISDN_freebchannel(&hw->bch[0]); in setup_instance()