Lines Matching refs:bc

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