Lines Matching refs:bcs

144 W6692B_sched_event(struct BCState *bcs, int event)  in W6692B_sched_event()  argument
146 bcs->event |= 1 << event; in W6692B_sched_event()
147 queue_task(&bcs->tqueue, &tq_immediate); in W6692B_sched_event()
231 W6692B_empty_fifo(struct BCState *bcs, int count) in W6692B_empty_fifo() argument
234 struct IsdnCardState *cs = bcs->cs; in W6692B_empty_fifo()
240 if (bcs->hw.w6692.rcvidx + count > HSCX_BUFMAX) { in W6692B_empty_fifo()
243 cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RACT); in W6692B_empty_fifo()
244 bcs->hw.w6692.rcvidx = 0; in W6692B_empty_fifo()
247 ptr = bcs->hw.w6692.rcvbuf + bcs->hw.w6692.rcvidx; in W6692B_empty_fifo()
248 bcs->hw.w6692.rcvidx += count; in W6692B_empty_fifo()
251 READW6692BFIFO(cs, bcs->channel, ptr, count); in W6692B_empty_fifo()
252 cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RACT); in W6692B_empty_fifo()
255 char *t = bcs->blog; in W6692B_empty_fifo()
258 bcs->channel + '1', count); in W6692B_empty_fifo()
260 debugl1(cs, bcs->blog); in W6692B_empty_fifo()
265 W6692B_fill_fifo(struct BCState *bcs) in W6692B_fill_fifo() argument
267 struct IsdnCardState *cs = bcs->cs; in W6692B_fill_fifo()
276 if (!bcs->tx_skb) in W6692B_fill_fifo()
278 if (bcs->tx_skb->len <= 0) in W6692B_fill_fifo()
281 more = (bcs->mode == L1_MODE_TRANS) ? 1 : 0; in W6692B_fill_fifo()
282 if (bcs->tx_skb->len > W_B_FIFO_THRESH) { in W6692B_fill_fifo()
286 count = bcs->tx_skb->len; in W6692B_fill_fifo()
290 ptr = bcs->tx_skb->data; in W6692B_fill_fifo()
291 skb_pull(bcs->tx_skb, count); in W6692B_fill_fifo()
292 bcs->tx_cnt -= count; in W6692B_fill_fifo()
293 bcs->hw.w6692.count += count; in W6692B_fill_fifo()
294 WRITEW6692BFIFO(cs, bcs->channel, ptr, count); in W6692B_fill_fifo()
295 …cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACT | W_B_CMDR_XMS | (more ? 0 : W_B_CMDR_X… in W6692B_fill_fifo()
298 char *t = bcs->blog; in W6692B_fill_fifo()
301 bcs->channel + '1', count); in W6692B_fill_fifo()
303 debugl1(cs, bcs->blog); in W6692B_fill_fifo()
312 struct BCState *bcs; in W6692B_interrupt() local
316 bcs = (cs->bcs->channel == bchan) ? cs->bcs : (cs->bcs+1); in W6692B_interrupt()
320 if (!test_bit(BC_FLG_INIT, &bcs->Flag)) { in W6692B_interrupt()
327 if ((r & W_B_STAR_RDOV) && bcs->mode) in W6692B_interrupt()
330 bcs->mode); in W6692B_interrupt()
339 W6692B_empty_fifo(bcs, count); in W6692B_interrupt()
340 if ((count = bcs->hw.w6692.rcvidx) > 0) { in W6692B_interrupt()
346 memcpy(skb_put(skb, count), bcs->hw.w6692.rcvbuf, count); in W6692B_interrupt()
347 skb_queue_tail(&bcs->rqueue, skb); in W6692B_interrupt()
351 bcs->hw.w6692.rcvidx = 0; in W6692B_interrupt()
352 W6692B_sched_event(bcs, B_RCVBUFREADY); in W6692B_interrupt()
355 W6692B_empty_fifo(bcs, W_B_FIFO_THRESH); in W6692B_interrupt()
356 if (bcs->mode == L1_MODE_TRANS) { in W6692B_interrupt()
361 memcpy(skb_put(skb, W_B_FIFO_THRESH), bcs->hw.w6692.rcvbuf, W_B_FIFO_THRESH); in W6692B_interrupt()
362 skb_queue_tail(&bcs->rqueue, skb); in W6692B_interrupt()
364 bcs->hw.w6692.rcvidx = 0; in W6692B_interrupt()
365 W6692B_sched_event(bcs, B_RCVBUFREADY); in W6692B_interrupt()
369 if (bcs->tx_skb) { in W6692B_interrupt()
370 if (bcs->tx_skb->len) { in W6692B_interrupt()
371 W6692B_fill_fifo(bcs); in W6692B_interrupt()
374 if (bcs->st->lli.l1writewakeup && in W6692B_interrupt()
375 (PACKET_NOACK != bcs->tx_skb->pkt_type)) in W6692B_interrupt()
376 bcs->st->lli.l1writewakeup(bcs->st, bcs->hw.w6692.count); in W6692B_interrupt()
377 dev_kfree_skb_irq(bcs->tx_skb); in W6692B_interrupt()
378 bcs->hw.w6692.count = 0; in W6692B_interrupt()
379 bcs->tx_skb = NULL; in W6692B_interrupt()
382 if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) { in W6692B_interrupt()
383 bcs->hw.w6692.count = 0; in W6692B_interrupt()
384 test_and_set_bit(BC_FLG_BUSY, &bcs->Flag); in W6692B_interrupt()
385 W6692B_fill_fifo(bcs); in W6692B_interrupt()
387 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in W6692B_interrupt()
388 W6692B_sched_event(bcs, B_XMTBUFREADY); in W6692B_interrupt()
392 if (bcs->mode == 1) in W6692B_interrupt()
393 W6692B_fill_fifo(bcs); in W6692B_interrupt()
398 if (bcs->tx_skb) { in W6692B_interrupt()
399 skb_push(bcs->tx_skb, bcs->hw.w6692.count); in W6692B_interrupt()
400 bcs->tx_cnt += bcs->hw.w6692.count; in W6692B_interrupt()
401 bcs->hw.w6692.count = 0; in W6692B_interrupt()
717 W6692Bmode(struct BCState *bcs, int mode, int bchan) in W6692Bmode() argument
719 struct IsdnCardState *cs = bcs->cs; in W6692Bmode()
724 bcs->mode = mode; in W6692Bmode()
725 bcs->channel = bchan; in W6692Bmode()
726 bcs->hw.w6692.bchan = bchan; in W6692Bmode()
757 if (st->l1.bcs->tx_skb) { in W6692_l2l1()
758 skb_queue_tail(&st->l1.bcs->squeue, skb); in W6692_l2l1()
761 st->l1.bcs->tx_skb = skb; in W6692_l2l1()
762 test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag); in W6692_l2l1()
763 st->l1.bcs->hw.w6692.count = 0; in W6692_l2l1()
765 st->l1.bcs->cs->BC_Send_Data(st->l1.bcs); in W6692_l2l1()
769 if (st->l1.bcs->tx_skb) { in W6692_l2l1()
773 test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag); in W6692_l2l1()
774 st->l1.bcs->tx_skb = skb; in W6692_l2l1()
775 st->l1.bcs->hw.w6692.count = 0; in W6692_l2l1()
776 st->l1.bcs->cs->BC_Send_Data(st->l1.bcs); in W6692_l2l1()
779 if (!st->l1.bcs->tx_skb) { in W6692_l2l1()
786 test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag); in W6692_l2l1()
787 W6692Bmode(st->l1.bcs, st->l1.mode, st->l1.bc); in W6692_l2l1()
794 test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag); in W6692_l2l1()
795 test_and_clear_bit(BC_FLG_BUSY, &st->l1.bcs->Flag); in W6692_l2l1()
796 W6692Bmode(st->l1.bcs, 0, st->l1.bc); in W6692_l2l1()
803 close_w6692state(struct BCState *bcs) in close_w6692state() argument
805 W6692Bmode(bcs, 0, bcs->channel); in close_w6692state()
806 if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) { in close_w6692state()
807 if (bcs->hw.w6692.rcvbuf) { in close_w6692state()
808 kfree(bcs->hw.w6692.rcvbuf); in close_w6692state()
809 bcs->hw.w6692.rcvbuf = NULL; in close_w6692state()
811 if (bcs->blog) { in close_w6692state()
812 kfree(bcs->blog); in close_w6692state()
813 bcs->blog = NULL; in close_w6692state()
815 skb_queue_purge(&bcs->rqueue); in close_w6692state()
816 skb_queue_purge(&bcs->squeue); in close_w6692state()
817 if (bcs->tx_skb) { in close_w6692state()
818 dev_kfree_skb_any(bcs->tx_skb); in close_w6692state()
819 bcs->tx_skb = NULL; in close_w6692state()
820 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in close_w6692state()
826 open_w6692state(struct IsdnCardState *cs, struct BCState *bcs) in open_w6692state() argument
828 if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) { in open_w6692state()
829 if (!(bcs->hw.w6692.rcvbuf = kmalloc(HSCX_BUFMAX, GFP_ATOMIC))) { in open_w6692state()
832 test_and_clear_bit(BC_FLG_INIT, &bcs->Flag); in open_w6692state()
835 if (!(bcs->blog = kmalloc(MAX_BLOG_SPACE, GFP_ATOMIC))) { in open_w6692state()
838 test_and_clear_bit(BC_FLG_INIT, &bcs->Flag); in open_w6692state()
839 kfree(bcs->hw.w6692.rcvbuf); in open_w6692state()
840 bcs->hw.w6692.rcvbuf = NULL; in open_w6692state()
843 skb_queue_head_init(&bcs->rqueue); in open_w6692state()
844 skb_queue_head_init(&bcs->squeue); in open_w6692state()
846 bcs->tx_skb = NULL; in open_w6692state()
847 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in open_w6692state()
848 bcs->event = 0; in open_w6692state()
849 bcs->hw.w6692.rcvidx = 0; in open_w6692state()
850 bcs->tx_cnt = 0; in open_w6692state()
855 setstack_w6692(struct PStack *st, struct BCState *bcs) in setstack_w6692() argument
857 bcs->channel = st->l1.bc; in setstack_w6692()
858 if (open_w6692state(st->l1.hardware, bcs)) in setstack_w6692()
860 st->l1.bcs = bcs; in setstack_w6692()
863 bcs->st = st; in setstack_w6692()
905 cs->bcs[0].BC_SetStack = setstack_w6692; in initW6692()
906 cs->bcs[1].BC_SetStack = setstack_w6692; in initW6692()
907 cs->bcs[0].BC_Close = close_w6692state; in initW6692()
908 cs->bcs[1].BC_Close = close_w6692state; in initW6692()
909 W6692Bmode(cs->bcs, 0, 0); in initW6692()
910 W6692Bmode(cs->bcs + 1, 0, 0); in initW6692()