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()
468 struct bchannel *bch; in open_bchannel() local
479 bch = &hw->bch[rq->adr.channel - 1]; in open_bchannel()
480 if (test_and_set_bit(FLG_OPEN, &bch->Flags)) in open_bchannel()
482 bch->ch.protocol = rq->protocol; in open_bchannel()
483 rq->ch = &bch->ch; in open_bchannel()
681 hfcsusb_setup_bch(struct bchannel *bch, int protocol) in hfcsusb_setup_bch() argument
683 struct hfcsusb *hw = bch->hw; in hfcsusb_setup_bch()
688 hw->name, __func__, bch->state, protocol, in hfcsusb_setup_bch()
689 bch->nr); in hfcsusb_setup_bch()
698 bch->state = -1; in hfcsusb_setup_bch()
701 if (bch->state == ISDN_P_NONE) in hfcsusb_setup_bch()
703 bch->state = ISDN_P_NONE; in hfcsusb_setup_bch()
704 clear_bit(FLG_HDLC, &bch->Flags); in hfcsusb_setup_bch()
705 clear_bit(FLG_TRANSPARENT, &bch->Flags); in hfcsusb_setup_bch()
709 bch->state = protocol; in hfcsusb_setup_bch()
710 set_bit(FLG_TRANSPARENT, &bch->Flags); in hfcsusb_setup_bch()
713 bch->state = protocol; in hfcsusb_setup_bch()
714 set_bit(FLG_HDLC, &bch->Flags); in hfcsusb_setup_bch()
724 write_reg(hw, HFCUSB_FIFO, (bch->nr == 1) ? 0 : 2); in hfcsusb_setup_bch()
727 write_reg(hw, HFCUSB_FIFO, (bch->nr == 1) ? 1 : 3); in hfcsusb_setup_bch()
733 if (test_bit(FLG_ACTIVE, &hw->bch[0].Flags)) { in hfcsusb_setup_bch()
737 if (test_bit(FLG_ACTIVE, &hw->bch[1].Flags)) { in hfcsusb_setup_bch()
745 handle_led(hw, (bch->nr == 1) ? LED_B1_ON : LED_B2_ON); in hfcsusb_setup_bch()
747 handle_led(hw, (bch->nr == 1) ? LED_B1_OFF : in hfcsusb_setup_bch()
794 channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
796 return mISDN_ctrl_bchannel(bch, cq); in channel_bctrl()
814 "dch(%p) bch(%p) ech(%p)\n", in hfcsusb_rx_frame()
816 fifo->dch, fifo->bch, fifo->ech); in hfcsusb_rx_frame()
821 if ((!!fifo->dch + !!fifo->bch + !!fifo->ech) != 1) { in hfcsusb_rx_frame()
833 if (fifo->bch) { in hfcsusb_rx_frame()
834 if (test_bit(FLG_RX_OFF, &fifo->bch->Flags)) { in hfcsusb_rx_frame()
835 fifo->bch->dropcnt += len; in hfcsusb_rx_frame()
839 maxlen = bchannel_get_rxbuf(fifo->bch, len); in hfcsusb_rx_frame()
840 rx_skb = fifo->bch->rx_skb; in hfcsusb_rx_frame()
845 hw->name, fifo->bch->nr, len); in hfcsusb_rx_frame()
849 maxlen = fifo->bch->maxlen; in hfcsusb_rx_frame()
850 hdlc = test_bit(FLG_HDLC, &fifo->bch->Flags); in hfcsusb_rx_frame()
909 if (fifo->bch) in hfcsusb_rx_frame()
910 recv_Bchannel(fifo->bch, MISDN_ID_ANY, in hfcsusb_rx_frame()
932 recv_Bchannel(fifo->bch, MISDN_ID_ANY, false); in hfcsusb_rx_frame()
1180 } else if (fifo->bch) { in tx_iso_complete()
1181 tx_skb = fifo->bch->tx_skb; in tx_iso_complete()
1182 tx_idx = &fifo->bch->tx_idx; in tx_iso_complete()
1183 hdlc = test_bit(FLG_HDLC, &fifo->bch->Flags); in tx_iso_complete()
1185 test_bit(FLG_FILLEMPTY, &fifo->bch->Flags)) in tx_iso_complete()
1188 printk(KERN_DEBUG "%s: %s: neither BCH nor DCH\n", in tx_iso_complete()
1279 memset(p, fifo->bch->fill[0], in tx_iso_complete()
1339 else if (fifo->bch && in tx_iso_complete()
1340 get_next_bframe(fifo->bch)) in tx_iso_complete()
1341 tx_skb = fifo->bch->tx_skb; in tx_iso_complete()
1763 mISDN_freebchannel(&hw->bch[1]); in release_hw()
1764 mISDN_freebchannel(&hw->bch[0]); in release_hw()
1781 deactivate_bchannel(struct bchannel *bch) in deactivate_bchannel() argument
1783 struct hfcsusb *hw = bch->hw; in deactivate_bchannel()
1786 if (bch->debug & DEBUG_HW) in deactivate_bchannel()
1787 printk(KERN_DEBUG "%s: %s: bch->nr(%i)\n", in deactivate_bchannel()
1788 hw->name, __func__, bch->nr); in deactivate_bchannel()
1791 mISDN_clear_bchannel(bch); in deactivate_bchannel()
1793 hfcsusb_setup_bch(bch, ISDN_P_NONE); in deactivate_bchannel()
1794 hfcsusb_stop_endpoint(hw, bch->nr - 1); in deactivate_bchannel()
1803 struct bchannel *bch = container_of(ch, struct bchannel, ch); in hfc_bctrl() local
1806 if (bch->debug & DEBUG_HW) in hfc_bctrl()
1817 test_and_clear_bit(FLG_OPEN, &bch->Flags); in hfc_bctrl()
1818 deactivate_bchannel(bch); in hfc_bctrl()
1825 ret = channel_bctrl(bch, arg); in hfc_bctrl()
1861 hw->bch[i].nr = i + 1; in setup_instance()
1863 hw->bch[i].debug = debug; in setup_instance()
1864 mISDN_initbchannel(&hw->bch[i], MAX_DATA_MEM, poll >> 1); in setup_instance()
1865 hw->bch[i].hw = hw; in setup_instance()
1866 hw->bch[i].ch.send = hfcusb_l2l1B; in setup_instance()
1867 hw->bch[i].ch.ctrl = hfc_bctrl; in setup_instance()
1868 hw->bch[i].ch.nr = i + 1; in setup_instance()
1869 list_add(&hw->bch[i].ch.list, &hw->dch.dev.bchannels); in setup_instance()
1872 hw->fifos[HFCUSB_B1_TX].bch = &hw->bch[0]; in setup_instance()
1873 hw->fifos[HFCUSB_B1_RX].bch = &hw->bch[0]; in setup_instance()
1874 hw->fifos[HFCUSB_B2_TX].bch = &hw->bch[1]; in setup_instance()
1875 hw->fifos[HFCUSB_B2_RX].bch = &hw->bch[1]; in setup_instance()
1901 mISDN_freebchannel(&hw->bch[1]); in setup_instance()
1902 mISDN_freebchannel(&hw->bch[0]); in setup_instance()