Lines Matching refs:bc
91 struct tiger_ch bc[2]; member
109 card->bc[0].bch.debug = debug; in _set_debug()
110 card->bc[1].bch.debug = debug; in _set_debug()
188 fill_mem(struct tiger_ch *bc, u32 idx, u32 cnt, u32 fill) in fill_mem() argument
190 struct tiger_hw *card = bc->bch.hw; in fill_mem()
194 bc->bch.nr, fill, cnt, idx, card->send.idx); in fill_mem()
195 if (bc->bch.nr & 2) { in fill_mem()
211 mode_tiger(struct tiger_ch *bc, u32 protocol) in mode_tiger() argument
213 struct tiger_hw *card = bc->bch.hw; in mode_tiger()
216 bc->bch.nr, bc->bch.state, protocol); in mode_tiger()
219 if (bc->bch.state == ISDN_P_NONE) in mode_tiger()
221 fill_mem(bc, 0, card->send.size, 0xff); in mode_tiger()
222 bc->bch.state = protocol; in mode_tiger()
224 if ((card->bc[0].bch.state == ISDN_P_NONE) && in mode_tiger()
225 (card->bc[1].bch.state == ISDN_P_NONE)) { in mode_tiger()
230 test_and_clear_bit(FLG_HDLC, &bc->bch.Flags); in mode_tiger()
231 test_and_clear_bit(FLG_TRANSPARENT, &bc->bch.Flags); in mode_tiger()
232 bc->txstate = 0; in mode_tiger()
233 bc->rxstate = 0; in mode_tiger()
234 bc->lastrx = -1; in mode_tiger()
237 test_and_set_bit(FLG_TRANSPARENT, &bc->bch.Flags); in mode_tiger()
238 bc->bch.state = protocol; in mode_tiger()
239 bc->idx = 0; in mode_tiger()
240 bc->free = card->send.size / 2; in mode_tiger()
241 bc->rxstate = 0; in mode_tiger()
242 bc->txstate = TX_INIT | TX_IDLE; in mode_tiger()
243 bc->lastrx = -1; in mode_tiger()
251 test_and_set_bit(FLG_HDLC, &bc->bch.Flags); in mode_tiger()
252 bc->bch.state = protocol; in mode_tiger()
253 bc->idx = 0; in mode_tiger()
254 bc->free = card->send.size / 2; in mode_tiger()
255 bc->rxstate = 0; in mode_tiger()
256 bc->txstate = TX_INIT | TX_IDLE; in mode_tiger()
257 isdnhdlc_rcv_init(&bc->hrecv, 0); in mode_tiger()
258 isdnhdlc_out_init(&bc->hsend, 0); in mode_tiger()
259 bc->lastrx = -1; in mode_tiger()
324 card->bc[i].hsbuf = kmalloc(NJ_DMA_TXSIZE, GFP_ATOMIC); in inittiger()
325 if (!card->bc[i].hsbuf) { in inittiger()
329 card->bc[i].hrbuf = kmalloc(NJ_DMA_RXSIZE, GFP_ATOMIC); in inittiger()
330 if (!card->bc[i].hrbuf) { in inittiger()
376 read_dma(struct tiger_ch *bc, u32 idx, int cnt) in read_dma() argument
378 struct tiger_hw *card = bc->bch.hw; in read_dma()
383 if (bc->lastrx == idx) { in read_dma()
384 bc->rxstate |= RX_OVERRUN; in read_dma()
386 bc->bch.nr, idx); in read_dma()
388 bc->lastrx = idx; in read_dma()
389 if (test_bit(FLG_RX_OFF, &bc->bch.Flags)) { in read_dma()
390 bc->bch.dropcnt += cnt; in read_dma()
393 stat = bchannel_get_rxbuf(&bc->bch, cnt); in read_dma()
397 card->name, bc->bch.nr, cnt); in read_dma()
400 if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags)) in read_dma()
401 p = skb_put(bc->bch.rx_skb, cnt); in read_dma()
403 p = bc->hrbuf; in read_dma()
407 if (bc->bch.nr & 2) in read_dma()
414 if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags)) { in read_dma()
415 recv_Bchannel(&bc->bch, 0, false); in read_dma()
419 pn = bc->hrbuf; in read_dma()
421 stat = isdnhdlc_decode(&bc->hrecv, pn, cnt, &i, in read_dma()
422 bc->bch.rx_skb->data, bc->bch.maxlen); in read_dma()
424 p = skb_put(bc->bch.rx_skb, stat); in read_dma()
427 "B%1d-recv %s %d ", bc->bch.nr, in read_dma()
433 recv_Bchannel(&bc->bch, 0, false); in read_dma()
434 stat = bchannel_get_rxbuf(&bc->bch, bc->bch.maxlen); in read_dma()
437 card->name, bc->bch.nr, cnt); in read_dma()
442 card->name, bc->bch.nr); in read_dma()
445 card->name, bc->bch.nr); in read_dma()
448 card->name, bc->bch.nr, bc->bch.maxlen); in read_dma()
470 if (test_bit(FLG_ACTIVE, &card->bc[0].bch.Flags)) in recv_tiger()
471 read_dma(&card->bc[0], idx, cnt); in recv_tiger()
472 if (test_bit(FLG_ACTIVE, &card->bc[1].bch.Flags)) in recv_tiger()
473 read_dma(&card->bc[1], idx, cnt); in recv_tiger()
478 resync(struct tiger_ch *bc, struct tiger_hw *card) in resync() argument
482 if (bc->free > card->send.size / 2) in resync()
483 bc->free = card->send.size / 2; in resync()
489 bc->idx = (card->recv.size / 2) - 1; in resync()
491 bc->idx = card->recv.size - 1; in resync()
492 bc->txstate = TX_RUN; in resync()
494 __func__, bc->bch.nr, bc->free, bc->idx, card->send.idx); in resync()
500 fill_hdlc_flag(struct tiger_ch *bc) in fill_hdlc_flag() argument
502 struct tiger_hw *card = bc->bch.hw; in fill_hdlc_flag()
507 if (bc->free == 0) in fill_hdlc_flag()
510 __func__, bc->bch.nr, bc->free, bc->txstate, in fill_hdlc_flag()
511 bc->idx, card->send.idx); in fill_hdlc_flag()
512 if (bc->txstate & (TX_IDLE | TX_INIT | TX_UNDERRUN)) in fill_hdlc_flag()
513 resync(bc, card); in fill_hdlc_flag()
514 count = isdnhdlc_encode(&bc->hsend, NULL, 0, &i, in fill_hdlc_flag()
515 bc->hsbuf, bc->free); in fill_hdlc_flag()
517 bc->bch.nr, count); in fill_hdlc_flag()
518 bc->free -= count; in fill_hdlc_flag()
519 p = bc->hsbuf; in fill_hdlc_flag()
520 m = (bc->bch.nr & 1) ? 0xffffff00 : 0xffff00ff; in fill_hdlc_flag()
522 if (bc->idx >= card->send.size) in fill_hdlc_flag()
523 bc->idx = 0; in fill_hdlc_flag()
524 v = card->send.start[bc->idx]; in fill_hdlc_flag()
526 v |= (bc->bch.nr & 1) ? (u32)(p[i]) : ((u32)(p[i])) << 8; in fill_hdlc_flag()
527 card->send.start[bc->idx++] = v; in fill_hdlc_flag()
531 bc->bch.nr, card->name, count); in fill_hdlc_flag()
537 fill_dma(struct tiger_ch *bc) in fill_dma() argument
539 struct tiger_hw *card = bc->bch.hw; in fill_dma()
544 if (bc->free == 0) in fill_dma()
546 if (!bc->bch.tx_skb) { in fill_dma()
547 if (!test_bit(FLG_TX_EMPTY, &bc->bch.Flags)) in fill_dma()
551 p = bc->bch.fill; in fill_dma()
553 count = bc->bch.tx_skb->len - bc->bch.tx_idx; in fill_dma()
557 card->name, __func__, bc->bch.nr, count, bc->free, in fill_dma()
558 bc->bch.tx_idx, bc->bch.tx_skb->len, bc->txstate, in fill_dma()
559 bc->idx, card->send.idx); in fill_dma()
560 p = bc->bch.tx_skb->data + bc->bch.tx_idx; in fill_dma()
562 if (bc->txstate & (TX_IDLE | TX_INIT | TX_UNDERRUN)) in fill_dma()
563 resync(bc, card); in fill_dma()
564 if (test_bit(FLG_HDLC, &bc->bch.Flags) && !fillempty) { in fill_dma()
565 count = isdnhdlc_encode(&bc->hsend, p, count, &i, in fill_dma()
566 bc->hsbuf, bc->free); in fill_dma()
568 bc->bch.nr, i, count); in fill_dma()
569 bc->bch.tx_idx += i; in fill_dma()
570 bc->free -= count; in fill_dma()
571 p = bc->hsbuf; in fill_dma()
573 if (count > bc->free) in fill_dma()
574 count = bc->free; in fill_dma()
576 bc->bch.tx_idx += count; in fill_dma()
577 bc->free -= count; in fill_dma()
579 m = (bc->bch.nr & 1) ? 0xffffff00 : 0xffff00ff; in fill_dma()
582 if (!(bc->bch.nr & 1)) in fill_dma()
585 if (bc->idx >= card->send.size) in fill_dma()
586 bc->idx = 0; in fill_dma()
587 v = card->send.start[bc->idx]; in fill_dma()
590 card->send.start[bc->idx++] = v; in fill_dma()
594 if (bc->idx >= card->send.size) in fill_dma()
595 bc->idx = 0; in fill_dma()
596 v = card->send.start[bc->idx]; in fill_dma()
599 v |= (bc->bch.nr & 1) ? n : n << 8; in fill_dma()
600 card->send.start[bc->idx++] = v; in fill_dma()
605 bc->bch.nr, card->name, count); in fill_dma()
608 if (bc->free) in fill_dma()
609 bc_next_frame(bc); in fill_dma()
614 bc_next_frame(struct tiger_ch *bc) in bc_next_frame() argument
618 if (bc->bch.tx_skb && bc->bch.tx_idx < bc->bch.tx_skb->len) { in bc_next_frame()
619 fill_dma(bc); in bc_next_frame()
621 if (bc->bch.tx_skb) in bc_next_frame()
622 dev_kfree_skb(bc->bch.tx_skb); in bc_next_frame()
623 if (get_next_bframe(&bc->bch)) { in bc_next_frame()
624 fill_dma(bc); in bc_next_frame()
625 test_and_clear_bit(FLG_TX_EMPTY, &bc->bch.Flags); in bc_next_frame()
626 } else if (test_bit(FLG_TX_EMPTY, &bc->bch.Flags)) { in bc_next_frame()
627 fill_dma(bc); in bc_next_frame()
628 } else if (test_bit(FLG_FILLEMPTY, &bc->bch.Flags)) { in bc_next_frame()
629 test_and_set_bit(FLG_TX_EMPTY, &bc->bch.Flags); in bc_next_frame()
639 send_tiger_bc(struct tiger_hw *card, struct tiger_ch *bc) in send_tiger_bc() argument
643 bc->free += card->send.size / 2; in send_tiger_bc()
644 if (bc->free >= card->send.size) { in send_tiger_bc()
645 if (!(bc->txstate & (TX_UNDERRUN | TX_INIT))) { in send_tiger_bc()
647 bc->bch.nr, bc->txstate); in send_tiger_bc()
648 bc->txstate |= TX_UNDERRUN; in send_tiger_bc()
650 bc->free = card->send.size; in send_tiger_bc()
652 ret = bc_next_frame(bc); in send_tiger_bc()
654 if (test_bit(FLG_HDLC, &bc->bch.Flags)) { in send_tiger_bc()
655 fill_hdlc_flag(bc); in send_tiger_bc()
659 bc->bch.nr, bc->free, bc->idx, card->send.idx); in send_tiger_bc()
660 if (!(bc->txstate & (TX_IDLE | TX_INIT))) { in send_tiger_bc()
661 fill_mem(bc, bc->idx, bc->free, 0xff); in send_tiger_bc()
662 if (bc->free == card->send.size) in send_tiger_bc()
663 bc->txstate |= TX_IDLE; in send_tiger_bc()
683 if (test_bit(FLG_ACTIVE, &card->bc[i].bch.Flags)) in send_tiger()
684 send_tiger_bc(card, &card->bc[i]); in send_tiger()
755 struct tiger_ch *bc = container_of(bch, struct tiger_ch, bch); in nj_l2l1B() local
765 fill_dma(bc); in nj_l2l1B()
773 ret = mode_tiger(bc, ch->protocol); in nj_l2l1B()
784 mode_tiger(bc, ISDN_P_NONE); in nj_l2l1B()
797 channel_bctrl(struct tiger_ch *bc, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
799 return mISDN_ctrl_bchannel(&bc->bch, cq); in channel_bctrl()
806 struct tiger_ch *bc = container_of(bch, struct tiger_ch, bch); in nj_bctrl() local
818 mode_tiger(bc, ISDN_P_NONE); in nj_bctrl()
826 ret = channel_bctrl(bc, arg); in nj_bctrl()
871 bch = &card->bc[rq->adr.channel - 1].bch; in open_bchannel()
947 mode_tiger(&card->bc[0], ISDN_P_NONE); in nj_init_card()
948 mode_tiger(&card->bc[1], ISDN_P_NONE); in nj_init_card()
964 mode_tiger(&card->bc[0], ISDN_P_NONE); in nj_release()
965 mode_tiger(&card->bc[1], ISDN_P_NONE); in nj_release()
977 mISDN_freebchannel(&card->bc[i].bch); in nj_release()
978 kfree(card->bc[i].hsbuf); in nj_release()
979 kfree(card->bc[i].hrbuf); in nj_release()
1032 card->bc[i].bch.nr = i + 1; in setup_instance()
1034 mISDN_initbchannel(&card->bc[i].bch, MAX_DATA_MEM, in setup_instance()
1036 card->bc[i].bch.hw = card; in setup_instance()
1037 card->bc[i].bch.ch.send = nj_l2l1B; in setup_instance()
1038 card->bc[i].bch.ch.ctrl = nj_bctrl; in setup_instance()
1039 card->bc[i].bch.ch.nr = i + 1; in setup_instance()
1040 list_add(&card->bc[i].bch.ch.list, in setup_instance()
1042 card->bc[i].bch.hw = card; in setup_instance()