Lines Matching defs:bch

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