Lines Matching full: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()
467 struct bchannel *bch; in open_bchannel() local
478 bch = &hw->bch[rq->adr.channel - 1]; in open_bchannel()
479 if (test_and_set_bit(FLG_OPEN, &bch->Flags)) in open_bchannel()
481 bch->ch.protocol = rq->protocol; in open_bchannel()
482 rq->ch = &bch->ch; in open_bchannel()
680 hfcsusb_setup_bch(struct bchannel *bch, int protocol) in hfcsusb_setup_bch() argument
682 struct hfcsusb *hw = bch->hw; in hfcsusb_setup_bch()
687 hw->name, __func__, bch->state, protocol, in hfcsusb_setup_bch()
688 bch->nr); in hfcsusb_setup_bch()
697 bch->state = -1; in hfcsusb_setup_bch()
700 if (bch->state == ISDN_P_NONE) in hfcsusb_setup_bch()
702 bch->state = ISDN_P_NONE; in hfcsusb_setup_bch()
703 clear_bit(FLG_HDLC, &bch->Flags); in hfcsusb_setup_bch()
704 clear_bit(FLG_TRANSPARENT, &bch->Flags); in hfcsusb_setup_bch()
708 bch->state = protocol; in hfcsusb_setup_bch()
709 set_bit(FLG_TRANSPARENT, &bch->Flags); in hfcsusb_setup_bch()
712 bch->state = protocol; in hfcsusb_setup_bch()
713 set_bit(FLG_HDLC, &bch->Flags); in hfcsusb_setup_bch()
723 write_reg(hw, HFCUSB_FIFO, (bch->nr == 1) ? 0 : 2); in hfcsusb_setup_bch()
726 write_reg(hw, HFCUSB_FIFO, (bch->nr == 1) ? 1 : 3); in hfcsusb_setup_bch()
732 if (test_bit(FLG_ACTIVE, &hw->bch[0].Flags)) { in hfcsusb_setup_bch()
736 if (test_bit(FLG_ACTIVE, &hw->bch[1].Flags)) { in hfcsusb_setup_bch()
744 handle_led(hw, (bch->nr == 1) ? LED_B1_ON : LED_B2_ON); in hfcsusb_setup_bch()
746 handle_led(hw, (bch->nr == 1) ? LED_B1_OFF : in hfcsusb_setup_bch()
793 channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
795 return mISDN_ctrl_bchannel(bch, cq); in channel_bctrl()
813 "dch(%p) bch(%p) ech(%p)\n", in hfcsusb_rx_frame()
815 fifo->dch, fifo->bch, fifo->ech); in hfcsusb_rx_frame()
820 if ((!!fifo->dch + !!fifo->bch + !!fifo->ech) != 1) { in hfcsusb_rx_frame()
832 if (fifo->bch) { in hfcsusb_rx_frame()
833 if (test_bit(FLG_RX_OFF, &fifo->bch->Flags)) { in hfcsusb_rx_frame()
834 fifo->bch->dropcnt += len; in hfcsusb_rx_frame()
838 maxlen = bchannel_get_rxbuf(fifo->bch, len); in hfcsusb_rx_frame()
839 rx_skb = fifo->bch->rx_skb; in hfcsusb_rx_frame()
844 hw->name, fifo->bch->nr, len); in hfcsusb_rx_frame()
848 maxlen = fifo->bch->maxlen; in hfcsusb_rx_frame()
849 hdlc = test_bit(FLG_HDLC, &fifo->bch->Flags); in hfcsusb_rx_frame()
908 if (fifo->bch) in hfcsusb_rx_frame()
909 recv_Bchannel(fifo->bch, MISDN_ID_ANY, in hfcsusb_rx_frame()
931 recv_Bchannel(fifo->bch, MISDN_ID_ANY, false); in hfcsusb_rx_frame()
1179 } else if (fifo->bch) { in tx_iso_complete()
1180 tx_skb = fifo->bch->tx_skb; in tx_iso_complete()
1181 tx_idx = &fifo->bch->tx_idx; in tx_iso_complete()
1182 hdlc = test_bit(FLG_HDLC, &fifo->bch->Flags); in tx_iso_complete()
1184 test_bit(FLG_FILLEMPTY, &fifo->bch->Flags)) in tx_iso_complete()
1187 printk(KERN_DEBUG "%s: %s: neither BCH nor DCH\n", in tx_iso_complete()
1278 memset(p, fifo->bch->fill[0], in tx_iso_complete()
1338 else if (fifo->bch && in tx_iso_complete()
1339 get_next_bframe(fifo->bch)) in tx_iso_complete()
1340 tx_skb = fifo->bch->tx_skb; in tx_iso_complete()
1762 mISDN_freebchannel(&hw->bch[1]); in release_hw()
1763 mISDN_freebchannel(&hw->bch[0]); in release_hw()
1780 deactivate_bchannel(struct bchannel *bch) in deactivate_bchannel() argument
1782 struct hfcsusb *hw = bch->hw; in deactivate_bchannel()
1785 if (bch->debug & DEBUG_HW) in deactivate_bchannel()
1786 printk(KERN_DEBUG "%s: %s: bch->nr(%i)\n", in deactivate_bchannel()
1787 hw->name, __func__, bch->nr); in deactivate_bchannel()
1790 mISDN_clear_bchannel(bch); in deactivate_bchannel()
1792 hfcsusb_setup_bch(bch, ISDN_P_NONE); in deactivate_bchannel()
1793 hfcsusb_stop_endpoint(hw, bch->nr - 1); in deactivate_bchannel()
1802 struct bchannel *bch = container_of(ch, struct bchannel, ch); in hfc_bctrl() local
1805 if (bch->debug & DEBUG_HW) in hfc_bctrl()
1816 test_and_clear_bit(FLG_OPEN, &bch->Flags); in hfc_bctrl()
1817 deactivate_bchannel(bch); in hfc_bctrl()
1824 ret = channel_bctrl(bch, arg); in hfc_bctrl()
1860 hw->bch[i].nr = i + 1; in setup_instance()
1862 hw->bch[i].debug = debug; in setup_instance()
1863 mISDN_initbchannel(&hw->bch[i], MAX_DATA_MEM, poll >> 1); in setup_instance()
1864 hw->bch[i].hw = hw; in setup_instance()
1865 hw->bch[i].ch.send = hfcusb_l2l1B; in setup_instance()
1866 hw->bch[i].ch.ctrl = hfc_bctrl; in setup_instance()
1867 hw->bch[i].ch.nr = i + 1; in setup_instance()
1868 list_add(&hw->bch[i].ch.list, &hw->dch.dev.bchannels); in setup_instance()
1871 hw->fifos[HFCUSB_B1_TX].bch = &hw->bch[0]; in setup_instance()
1872 hw->fifos[HFCUSB_B1_RX].bch = &hw->bch[0]; in setup_instance()
1873 hw->fifos[HFCUSB_B2_TX].bch = &hw->bch[1]; in setup_instance()
1874 hw->fifos[HFCUSB_B2_RX].bch = &hw->bch[1]; in setup_instance()
1900 mISDN_freebchannel(&hw->bch[1]); in setup_instance()
1901 mISDN_freebchannel(&hw->bch[0]); in setup_instance()