Lines Matching refs:bch
68 if (isar->ch[0].bch.debug & DEBUG_HW_BFIFO) { in send_mbox()
97 if (isar->ch[0].bch.debug & DEBUG_HW_BFIFO) { in rcv_mbox()
174 u32 saved_debug = isar->ch[0].bch.debug; in load_firmware()
193 isar->ch[0].bch.debug &= ~DEBUG_HW_BFIFO; in load_firmware()
280 isar->ch[0].bch.debug = saved_debug; in load_firmware()
392 isar->ch[0].bch.debug = saved_debug; in load_firmware()
404 _queue_data(&ch->bch.ch, PH_CONTROL_IND, status, 0, NULL, GFP_ATOMIC); in deliver_status()
418 if (test_bit(FLG_RX_OFF, &ch->bch.Flags)) { in isar_rcv_frame()
419 ch->bch.dropcnt += ch->is->clsb; in isar_rcv_frame()
423 switch (ch->bch.state) { in isar_rcv_frame()
432 maxlen = bchannel_get_rxbuf(&ch->bch, ch->is->clsb); in isar_rcv_frame()
435 ch->is->name, ch->bch.nr, ch->is->clsb); in isar_rcv_frame()
439 rcv_mbox(ch->is, skb_put(ch->bch.rx_skb, ch->is->clsb)); in isar_rcv_frame()
440 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
443 maxlen = bchannel_get_rxbuf(&ch->bch, ch->is->clsb); in isar_rcv_frame()
446 ch->is->name, ch->bch.nr, ch->is->clsb); in isar_rcv_frame()
455 ch->bch.err_inv++; in isar_rcv_frame()
457 ch->bch.err_crc++; in isar_rcv_frame()
459 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
464 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
465 ptr = skb_put(ch->bch.rx_skb, ch->is->clsb); in isar_rcv_frame()
468 if (ch->bch.rx_skb->len < 3) { /* last 2 are the FCS */ in isar_rcv_frame()
470 ch->is->name, ch->bch.rx_skb->len); in isar_rcv_frame()
471 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
474 skb_trim(ch->bch.rx_skb, ch->bch.rx_skb->len - 2); in isar_rcv_frame()
475 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
483 if (ch->bch.rx_skb) in isar_rcv_frame()
484 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
487 if (!ch->bch.rx_skb) { in isar_rcv_frame()
488 ch->bch.rx_skb = mI_alloc_skb(ch->bch.maxlen, in isar_rcv_frame()
490 if (unlikely(!ch->bch.rx_skb)) { in isar_rcv_frame()
498 rcv_mbox(ch->is, skb_put(ch->bch.rx_skb, ch->is->clsb)); in isar_rcv_frame()
500 ch->is->name, ch->bch.rx_skb->len); in isar_rcv_frame()
511 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
520 if (ch->bch.rx_skb) in isar_rcv_frame()
521 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
525 if ((ch->bch.rx_skb->len + ch->is->clsb) > in isar_rcv_frame()
526 (ch->bch.maxlen + 2)) { in isar_rcv_frame()
530 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
535 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
540 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
541 ptr = skb_put(ch->bch.rx_skb, ch->is->clsb); in isar_rcv_frame()
544 if (ch->bch.rx_skb->len < 3) { /* last 2 are the FCS */ in isar_rcv_frame()
546 ch->is->name, ch->bch.rx_skb->len); in isar_rcv_frame()
547 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
550 skb_trim(ch->bch.rx_skb, ch->bch.rx_skb->len - 2); in isar_rcv_frame()
551 recv_Bchannel(&ch->bch, 0, false); in isar_rcv_frame()
557 if (ch->bch.rx_skb) in isar_rcv_frame()
558 skb_trim(ch->bch.rx_skb, 0); in isar_rcv_frame()
566 pr_info("isar_rcv_frame protocol (%x)error\n", ch->bch.state); in isar_rcv_frame()
579 pr_debug("%s: ch%d tx_skb %d tx_idx %d\n", ch->is->name, ch->bch.nr, in isar_fill_fifo()
580 ch->bch.tx_skb ? ch->bch.tx_skb->len : -1, ch->bch.tx_idx); in isar_fill_fifo()
584 if (!ch->bch.tx_skb) { in isar_fill_fifo()
585 if (!test_bit(FLG_TX_EMPTY, &ch->bch.Flags) || in isar_fill_fifo()
586 (ch->bch.state != ISDN_P_B_RAW)) in isar_fill_fifo()
590 memset(ch->is->buf, ch->bch.fill[0], count); in isar_fill_fifo()
595 count = ch->bch.tx_skb->len - ch->bch.tx_idx; in isar_fill_fifo()
604 ptr = ch->bch.tx_skb->data + ch->bch.tx_idx; in isar_fill_fifo()
605 if (!ch->bch.tx_idx) { in isar_fill_fifo()
607 if ((ch->bch.state == ISDN_P_B_T30_FAX) && in isar_fill_fifo()
613 &ch->bch.Flags); in isar_fill_fifo()
618 &ch->bch.Flags); in isar_fill_fifo()
624 ch->bch.tx_idx += count; in isar_fill_fifo()
625 switch (ch->bch.state) { in isar_fill_fifo()
653 __func__, ch->bch.state); in isar_fill_fifo()
677 ch->bch.nr, ch->bch.tx_skb ? ch->bch.tx_skb->len : -1, in send_next()
678 ch->bch.tx_idx); in send_next()
679 if (ch->bch.state == ISDN_P_B_T30_FAX) { in send_next()
681 if (test_bit(FLG_LASTDATA, &ch->bch.Flags)) { in send_next()
683 test_and_set_bit(FLG_NMD_DATA, &ch->bch.Flags); in send_next()
686 if (test_bit(FLG_DLEETX, &ch->bch.Flags)) { in send_next()
687 test_and_set_bit(FLG_LASTDATA, &ch->bch.Flags); in send_next()
688 test_and_set_bit(FLG_NMD_DATA, &ch->bch.Flags); in send_next()
692 dev_kfree_skb(ch->bch.tx_skb); in send_next()
693 if (get_next_bframe(&ch->bch)) { in send_next()
695 test_and_clear_bit(FLG_TX_EMPTY, &ch->bch.Flags); in send_next()
696 } else if (test_bit(FLG_TX_EMPTY, &ch->bch.Flags)) { in send_next()
699 if (test_and_clear_bit(FLG_DLEETX, &ch->bch.Flags)) { in send_next()
701 &ch->bch.Flags)) { in send_next()
703 &ch->bch.Flags)) { in send_next()
708 test_and_set_bit(FLG_LL_OK, &ch->bch.Flags); in send_next()
712 } else if (test_bit(FLG_FILLEMPTY, &ch->bch.Flags)) { in send_next()
713 test_and_set_bit(FLG_TX_EMPTY, &ch->bch.Flags); in send_next()
726 if (ch && test_bit(FLG_ACTIVE, &ch->bch.Flags)) { in check_send()
727 if (ch->bch.tx_skb && (ch->bch.tx_skb->len > in check_send()
728 ch->bch.tx_idx)) in check_send()
736 if (ch && test_bit(FLG_ACTIVE, &ch->bch.Flags)) { in check_send()
737 if (ch->bch.tx_skb && (ch->bch.tx_skb->len > in check_send()
738 ch->bch.tx_idx)) in check_send()
871 if (test_bit(BC_FLG_ORIG, &ch->bch.Flags)) in isar_pump_statev_fax()
872 isar_pump_cmd(bch, HW_MOD_FRH, 3); in isar_pump_statev_fax()
874 isar_pump_cmd(bch, HW_MOD_FTH, 3); in isar_pump_statev_fax()
931 &ch->bch.Flags)) in isar_pump_statev_fax()
936 &ch->bch.Flags); in isar_pump_statev_fax()
984 if (test_and_clear_bit(FLG_LL_OK, &ch->bch.Flags)) in isar_pump_statev_fax()
1063 ch->bch.err_tx++; in mISDNisar_irq()
1065 ch->bch.err_rdo++; in mISDNisar_irq()
1076 if (ch->bch.state == ISDN_P_B_MODEM_ASYNC) in mISDNisar_irq()
1078 else if (ch->bch.state == ISDN_P_B_T30_FAX) in mISDNisar_irq()
1080 else if (ch->bch.state == ISDN_P_B_RAW) { in mISDNisar_irq()
1090 _queue_data(&ch->bch.ch, PH_CONTROL_IND, in mISDNisar_irq()
1095 isar->name, ch->bch.state, in mISDNisar_irq()
1139 pr_debug("%s: ftimer flags %lx\n", ch->is->name, ch->bch.Flags); in ftimer_handler()
1140 test_and_clear_bit(FLG_FTI_RUN, &ch->bch.Flags); in ftimer_handler()
1141 if (test_and_clear_bit(FLG_LL_CONN, &ch->bch.Flags)) in ftimer_handler()
1150 switch (ch->bch.state) { in setup_pump()
1157 if (test_bit(FLG_DTMFSEND, &ch->bch.Flags)) { in setup_pump()
1169 if (test_bit(FLG_ORIGIN, &ch->bch.Flags)) { in setup_pump()
1185 if (test_bit(FLG_ORIGIN, &ch->bch.Flags)) { in setup_pump()
1196 test_and_set_bit(FLG_FTI_RUN, &ch->bch.Flags); in setup_pump()
1209 switch (ch->bch.state) { in setup_sart()
1241 if (ch->bch.nr == 2) { in setup_iom2()
1245 switch (ch->bch.state) { in setup_iom2()
1260 if (test_bit(FLG_DTMFSEND, &ch->bch.Flags)) in setup_iom2()
1275 if (ch->bch.state == ISDN_P_NONE) { /* New Setup */ in modeisar()
1281 test_and_clear_bit(FLG_HDLC, &ch->bch.Flags); in modeisar()
1282 test_and_clear_bit(FLG_TRANSPARENT, &ch->bch.Flags); in modeisar()
1297 test_and_set_bit(FLG_HDLC, &ch->bch.Flags); in modeisar()
1300 &ch->bch.Flags); in modeisar()
1321 ch->bch.nr, ch->dpath, ch->bch.state, bprotocol); in modeisar()
1322 ch->bch.state = bprotocol; in modeisar()
1326 if (ch->bch.state == ISDN_P_NONE) { in modeisar()
1333 ch->is->ctrl(ch->is->hw, HW_DEACT_IND, ch->bch.nr); in modeisar()
1335 ch->is->ctrl(ch->is->hw, HW_ACTIVATE_IND, ch->bch.nr); in modeisar()
1346 ch->is->name, cmd, para, ch->bch.state); in isar_pump_cmd()
1459 isar->ch[i].bch.state = 0; in isar_setup()
1468 struct bchannel *bch = container_of(ch, struct bchannel, ch); in isar_l2l1() local
1469 struct isar_ch *ich = container_of(bch, struct isar_ch, bch); in isar_l2l1()
1478 ret = bchannel_senddata(bch, skb); in isar_l2l1()
1487 if (!test_and_set_bit(FLG_ACTIVE, &bch->Flags)) in isar_l2l1()
1498 mISDN_clear_bchannel(bch); in isar_l2l1()
1511 if (bch->state == ISDN_P_B_L2DTMF) { in isar_l2l1()
1526 __func__, bch->state); in isar_l2l1()
1535 test_bit(FLG_INITIALIZED, &bch->Flags)) { in isar_l2l1()
1545 test_and_set_bit(FLG_DLEETX, &bch->Flags); in isar_l2l1()
1563 channel_bctrl(struct bchannel *bch, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
1565 return mISDN_ctrl_bchannel(bch, cq); in channel_bctrl()
1571 struct bchannel *bch = container_of(ch, struct bchannel, ch); in isar_bctrl() local
1572 struct isar_ch *ich = container_of(bch, struct isar_ch, bch); in isar_bctrl()
1579 test_and_clear_bit(FLG_OPEN, &bch->Flags); in isar_bctrl()
1580 cancel_work_sync(&bch->workq); in isar_bctrl()
1582 mISDN_clear_bchannel(bch); in isar_bctrl()
1591 ret = channel_bctrl(bch, arg); in isar_bctrl()
1607 test_and_clear_bit(FLG_INITIALIZED, &isar->ch[0].bch.Flags); in free_isar()
1608 test_and_clear_bit(FLG_INITIALIZED, &isar->ch[1].bch.Flags); in free_isar()
1618 if (isar->ch[0].bch.debug & DEBUG_HW) in init_isar()
1628 test_and_set_bit(FLG_INITIALIZED, &isar->ch[0].bch.Flags); in init_isar()
1630 test_and_set_bit(FLG_INITIALIZED, &isar->ch[1].bch.Flags); in init_isar()
1637 struct bchannel *bch; in isar_open() local
1643 bch = &isar->ch[rq->adr.channel - 1].bch; in isar_open()
1644 if (test_and_set_bit(FLG_OPEN, &bch->Flags)) in isar_open()
1646 bch->ch.protocol = rq->protocol; in isar_open()
1647 rq->ch = &bch->ch; in isar_open()
1658 isar->ch[i].bch.nr = i + 1; in mISDNisar_init()
1659 mISDN_initbchannel(&isar->ch[i].bch, MAX_DATA_MEM, 32); in mISDNisar_init()
1660 isar->ch[i].bch.ch.nr = i + 1; in mISDNisar_init()
1661 isar->ch[i].bch.ch.send = &isar_l2l1; in mISDNisar_init()
1662 isar->ch[i].bch.ch.ctrl = isar_bctrl; in mISDNisar_init()
1663 isar->ch[i].bch.hw = hw; in mISDNisar_init()