Lines Matching refs:bc
78 struct tiger_ch bc[2]; member
96 card->bc[0].bch.debug = debug; in _set_debug()
97 card->bc[1].bch.debug = debug; in _set_debug()
175 fill_mem(struct tiger_ch *bc, u32 idx, u32 cnt, u32 fill) in fill_mem() argument
177 struct tiger_hw *card = bc->bch.hw; in fill_mem()
181 bc->bch.nr, fill, cnt, idx, card->send.idx); in fill_mem()
182 if (bc->bch.nr & 2) { in fill_mem()
198 mode_tiger(struct tiger_ch *bc, u32 protocol) in mode_tiger() argument
200 struct tiger_hw *card = bc->bch.hw; in mode_tiger()
203 bc->bch.nr, bc->bch.state, protocol); in mode_tiger()
206 if (bc->bch.state == ISDN_P_NONE) in mode_tiger()
208 fill_mem(bc, 0, card->send.size, 0xff); in mode_tiger()
209 bc->bch.state = protocol; in mode_tiger()
211 if ((card->bc[0].bch.state == ISDN_P_NONE) && in mode_tiger()
212 (card->bc[1].bch.state == ISDN_P_NONE)) { in mode_tiger()
217 test_and_clear_bit(FLG_HDLC, &bc->bch.Flags); in mode_tiger()
218 test_and_clear_bit(FLG_TRANSPARENT, &bc->bch.Flags); in mode_tiger()
219 bc->txstate = 0; in mode_tiger()
220 bc->rxstate = 0; in mode_tiger()
221 bc->lastrx = -1; in mode_tiger()
224 test_and_set_bit(FLG_TRANSPARENT, &bc->bch.Flags); in mode_tiger()
225 bc->bch.state = protocol; in mode_tiger()
226 bc->idx = 0; in mode_tiger()
227 bc->free = card->send.size / 2; in mode_tiger()
228 bc->rxstate = 0; in mode_tiger()
229 bc->txstate = TX_INIT | TX_IDLE; in mode_tiger()
230 bc->lastrx = -1; in mode_tiger()
238 test_and_set_bit(FLG_HDLC, &bc->bch.Flags); in mode_tiger()
239 bc->bch.state = protocol; in mode_tiger()
240 bc->idx = 0; in mode_tiger()
241 bc->free = card->send.size / 2; in mode_tiger()
242 bc->rxstate = 0; in mode_tiger()
243 bc->txstate = TX_INIT | TX_IDLE; in mode_tiger()
244 isdnhdlc_rcv_init(&bc->hrecv, 0); in mode_tiger()
245 isdnhdlc_out_init(&bc->hsend, 0); in mode_tiger()
246 bc->lastrx = -1; in mode_tiger()
311 card->bc[i].hsbuf = kmalloc(NJ_DMA_TXSIZE, GFP_ATOMIC); in inittiger()
312 if (!card->bc[i].hsbuf) { in inittiger()
316 card->bc[i].hrbuf = kmalloc(NJ_DMA_RXSIZE, GFP_ATOMIC); in inittiger()
317 if (!card->bc[i].hrbuf) { in inittiger()
363 read_dma(struct tiger_ch *bc, u32 idx, int cnt) in read_dma() argument
365 struct tiger_hw *card = bc->bch.hw; in read_dma()
370 if (bc->lastrx == idx) { in read_dma()
371 bc->rxstate |= RX_OVERRUN; in read_dma()
373 bc->bch.nr, idx); in read_dma()
375 bc->lastrx = idx; in read_dma()
376 if (test_bit(FLG_RX_OFF, &bc->bch.Flags)) { in read_dma()
377 bc->bch.dropcnt += cnt; in read_dma()
380 stat = bchannel_get_rxbuf(&bc->bch, cnt); in read_dma()
384 card->name, bc->bch.nr, cnt); in read_dma()
387 if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags)) in read_dma()
388 p = skb_put(bc->bch.rx_skb, cnt); in read_dma()
390 p = bc->hrbuf; in read_dma()
394 if (bc->bch.nr & 2) in read_dma()
401 if (test_bit(FLG_TRANSPARENT, &bc->bch.Flags)) { in read_dma()
402 recv_Bchannel(&bc->bch, 0, false); in read_dma()
406 pn = bc->hrbuf; in read_dma()
408 stat = isdnhdlc_decode(&bc->hrecv, pn, cnt, &i, in read_dma()
409 bc->bch.rx_skb->data, bc->bch.maxlen); in read_dma()
411 p = skb_put(bc->bch.rx_skb, stat); in read_dma()
414 "B%1d-recv %s %d ", bc->bch.nr, in read_dma()
420 recv_Bchannel(&bc->bch, 0, false); in read_dma()
421 stat = bchannel_get_rxbuf(&bc->bch, bc->bch.maxlen); in read_dma()
424 card->name, bc->bch.nr, cnt); in read_dma()
429 card->name, bc->bch.nr); in read_dma()
432 card->name, bc->bch.nr); in read_dma()
435 card->name, bc->bch.nr, bc->bch.maxlen); in read_dma()
457 if (test_bit(FLG_ACTIVE, &card->bc[0].bch.Flags)) in recv_tiger()
458 read_dma(&card->bc[0], idx, cnt); in recv_tiger()
459 if (test_bit(FLG_ACTIVE, &card->bc[1].bch.Flags)) in recv_tiger()
460 read_dma(&card->bc[1], idx, cnt); in recv_tiger()
465 resync(struct tiger_ch *bc, struct tiger_hw *card) in resync() argument
469 if (bc->free > card->send.size / 2) in resync()
470 bc->free = card->send.size / 2; in resync()
476 bc->idx = (card->recv.size / 2) - 1; in resync()
478 bc->idx = card->recv.size - 1; in resync()
479 bc->txstate = TX_RUN; in resync()
481 __func__, bc->bch.nr, bc->free, bc->idx, card->send.idx); in resync()
487 fill_hdlc_flag(struct tiger_ch *bc) in fill_hdlc_flag() argument
489 struct tiger_hw *card = bc->bch.hw; in fill_hdlc_flag()
494 if (bc->free == 0) in fill_hdlc_flag()
497 __func__, bc->bch.nr, bc->free, bc->txstate, in fill_hdlc_flag()
498 bc->idx, card->send.idx); in fill_hdlc_flag()
499 if (bc->txstate & (TX_IDLE | TX_INIT | TX_UNDERRUN)) in fill_hdlc_flag()
500 resync(bc, card); in fill_hdlc_flag()
501 count = isdnhdlc_encode(&bc->hsend, NULL, 0, &i, in fill_hdlc_flag()
502 bc->hsbuf, bc->free); in fill_hdlc_flag()
504 bc->bch.nr, count); in fill_hdlc_flag()
505 bc->free -= count; in fill_hdlc_flag()
506 p = bc->hsbuf; in fill_hdlc_flag()
507 m = (bc->bch.nr & 1) ? 0xffffff00 : 0xffff00ff; in fill_hdlc_flag()
509 if (bc->idx >= card->send.size) in fill_hdlc_flag()
510 bc->idx = 0; in fill_hdlc_flag()
511 v = card->send.start[bc->idx]; in fill_hdlc_flag()
513 v |= (bc->bch.nr & 1) ? (u32)(p[i]) : ((u32)(p[i])) << 8; in fill_hdlc_flag()
514 card->send.start[bc->idx++] = v; in fill_hdlc_flag()
518 bc->bch.nr, card->name, count); in fill_hdlc_flag()
524 fill_dma(struct tiger_ch *bc) in fill_dma() argument
526 struct tiger_hw *card = bc->bch.hw; in fill_dma()
531 if (bc->free == 0) in fill_dma()
533 if (!bc->bch.tx_skb) { in fill_dma()
534 if (!test_bit(FLG_TX_EMPTY, &bc->bch.Flags)) in fill_dma()
538 p = bc->bch.fill; in fill_dma()
540 count = bc->bch.tx_skb->len - bc->bch.tx_idx; in fill_dma()
544 card->name, __func__, bc->bch.nr, count, bc->free, in fill_dma()
545 bc->bch.tx_idx, bc->bch.tx_skb->len, bc->txstate, in fill_dma()
546 bc->idx, card->send.idx); in fill_dma()
547 p = bc->bch.tx_skb->data + bc->bch.tx_idx; in fill_dma()
549 if (bc->txstate & (TX_IDLE | TX_INIT | TX_UNDERRUN)) in fill_dma()
550 resync(bc, card); in fill_dma()
551 if (test_bit(FLG_HDLC, &bc->bch.Flags) && !fillempty) { in fill_dma()
552 count = isdnhdlc_encode(&bc->hsend, p, count, &i, in fill_dma()
553 bc->hsbuf, bc->free); in fill_dma()
555 bc->bch.nr, i, count); in fill_dma()
556 bc->bch.tx_idx += i; in fill_dma()
557 bc->free -= count; in fill_dma()
558 p = bc->hsbuf; in fill_dma()
560 if (count > bc->free) in fill_dma()
561 count = bc->free; in fill_dma()
563 bc->bch.tx_idx += count; in fill_dma()
564 bc->free -= count; in fill_dma()
566 m = (bc->bch.nr & 1) ? 0xffffff00 : 0xffff00ff; in fill_dma()
569 if (!(bc->bch.nr & 1)) in fill_dma()
572 if (bc->idx >= card->send.size) in fill_dma()
573 bc->idx = 0; in fill_dma()
574 v = card->send.start[bc->idx]; in fill_dma()
577 card->send.start[bc->idx++] = v; in fill_dma()
581 if (bc->idx >= card->send.size) in fill_dma()
582 bc->idx = 0; in fill_dma()
583 v = card->send.start[bc->idx]; in fill_dma()
586 v |= (bc->bch.nr & 1) ? n : n << 8; in fill_dma()
587 card->send.start[bc->idx++] = v; in fill_dma()
592 bc->bch.nr, card->name, count); in fill_dma()
595 if (bc->free) in fill_dma()
596 bc_next_frame(bc); in fill_dma()
601 bc_next_frame(struct tiger_ch *bc) in bc_next_frame() argument
605 if (bc->bch.tx_skb && bc->bch.tx_idx < bc->bch.tx_skb->len) { in bc_next_frame()
606 fill_dma(bc); in bc_next_frame()
608 dev_kfree_skb(bc->bch.tx_skb); in bc_next_frame()
609 if (get_next_bframe(&bc->bch)) { in bc_next_frame()
610 fill_dma(bc); in bc_next_frame()
611 test_and_clear_bit(FLG_TX_EMPTY, &bc->bch.Flags); in bc_next_frame()
612 } else if (test_bit(FLG_TX_EMPTY, &bc->bch.Flags)) { in bc_next_frame()
613 fill_dma(bc); in bc_next_frame()
614 } else if (test_bit(FLG_FILLEMPTY, &bc->bch.Flags)) { in bc_next_frame()
615 test_and_set_bit(FLG_TX_EMPTY, &bc->bch.Flags); in bc_next_frame()
625 send_tiger_bc(struct tiger_hw *card, struct tiger_ch *bc) in send_tiger_bc() argument
629 bc->free += card->send.size / 2; in send_tiger_bc()
630 if (bc->free >= card->send.size) { in send_tiger_bc()
631 if (!(bc->txstate & (TX_UNDERRUN | TX_INIT))) { in send_tiger_bc()
633 bc->bch.nr, bc->txstate); in send_tiger_bc()
634 bc->txstate |= TX_UNDERRUN; in send_tiger_bc()
636 bc->free = card->send.size; in send_tiger_bc()
638 ret = bc_next_frame(bc); in send_tiger_bc()
640 if (test_bit(FLG_HDLC, &bc->bch.Flags)) { in send_tiger_bc()
641 fill_hdlc_flag(bc); in send_tiger_bc()
645 bc->bch.nr, bc->free, bc->idx, card->send.idx); in send_tiger_bc()
646 if (!(bc->txstate & (TX_IDLE | TX_INIT))) { in send_tiger_bc()
647 fill_mem(bc, bc->idx, bc->free, 0xff); in send_tiger_bc()
648 if (bc->free == card->send.size) in send_tiger_bc()
649 bc->txstate |= TX_IDLE; in send_tiger_bc()
669 if (test_bit(FLG_ACTIVE, &card->bc[i].bch.Flags)) in send_tiger()
670 send_tiger_bc(card, &card->bc[i]); in send_tiger()
741 struct tiger_ch *bc = container_of(bch, struct tiger_ch, bch); in nj_l2l1B() local
751 fill_dma(bc); in nj_l2l1B()
759 ret = mode_tiger(bc, ch->protocol); in nj_l2l1B()
770 mode_tiger(bc, ISDN_P_NONE); in nj_l2l1B()
783 channel_bctrl(struct tiger_ch *bc, struct mISDN_ctrl_req *cq) in channel_bctrl() argument
785 return mISDN_ctrl_bchannel(&bc->bch, cq); in channel_bctrl()
792 struct tiger_ch *bc = container_of(bch, struct tiger_ch, bch); in nj_bctrl() local
804 mode_tiger(bc, ISDN_P_NONE); in nj_bctrl()
812 ret = channel_bctrl(bc, arg); in nj_bctrl()
857 bch = &card->bc[rq->adr.channel - 1].bch; in open_bchannel()
933 mode_tiger(&card->bc[0], ISDN_P_NONE); in nj_init_card()
934 mode_tiger(&card->bc[1], ISDN_P_NONE); in nj_init_card()
950 mode_tiger(&card->bc[0], ISDN_P_NONE); in nj_release()
951 mode_tiger(&card->bc[1], ISDN_P_NONE); in nj_release()
963 mISDN_freebchannel(&card->bc[i].bch); in nj_release()
964 kfree(card->bc[i].hsbuf); in nj_release()
965 kfree(card->bc[i].hrbuf); in nj_release()
1017 card->bc[i].bch.nr = i + 1; in setup_instance()
1019 mISDN_initbchannel(&card->bc[i].bch, MAX_DATA_MEM, in setup_instance()
1021 card->bc[i].bch.hw = card; in setup_instance()
1022 card->bc[i].bch.ch.send = nj_l2l1B; in setup_instance()
1023 card->bc[i].bch.ch.ctrl = nj_bctrl; in setup_instance()
1024 card->bc[i].bch.ch.nr = i + 1; in setup_instance()
1025 list_add(&card->bc[i].bch.ch.list, in setup_instance()
1027 card->bc[i].bch.hw = card; in setup_instance()