Lines Matching refs:bcs

204 W6692B_empty_fifo(struct BCState *bcs, int count)  in W6692B_empty_fifo()  argument
207 struct IsdnCardState *cs = bcs->cs; in W6692B_empty_fifo()
212 if (bcs->hw.w6692.rcvidx + count > HSCX_BUFMAX) { in W6692B_empty_fifo()
215 cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RACT); in W6692B_empty_fifo()
216 bcs->hw.w6692.rcvidx = 0; in W6692B_empty_fifo()
219 ptr = bcs->hw.w6692.rcvbuf + bcs->hw.w6692.rcvidx; in W6692B_empty_fifo()
220 bcs->hw.w6692.rcvidx += count; in W6692B_empty_fifo()
221 READW6692BFIFO(cs, bcs->channel, ptr, count); in W6692B_empty_fifo()
222 cs->BC_Write_Reg(cs, bcs->channel, W_B_CMDR, W_B_CMDR_RACK | W_B_CMDR_RACT); in W6692B_empty_fifo()
224 char *t = bcs->blog; in W6692B_empty_fifo()
227 bcs->channel + '1', count); in W6692B_empty_fifo()
229 debugl1(cs, "%s", bcs->blog); in W6692B_empty_fifo()
234 W6692B_fill_fifo(struct BCState *bcs) in W6692B_fill_fifo() argument
236 struct IsdnCardState *cs = bcs->cs; in W6692B_fill_fifo()
240 if (!bcs->tx_skb) in W6692B_fill_fifo()
242 if (bcs->tx_skb->len <= 0) in W6692B_fill_fifo()
245 more = (bcs->mode == L1_MODE_TRANS) ? 1 : 0; in W6692B_fill_fifo()
246 if (bcs->tx_skb->len > W_B_FIFO_THRESH) { in W6692B_fill_fifo()
250 count = bcs->tx_skb->len; in W6692B_fill_fifo()
255 ptr = bcs->tx_skb->data; in W6692B_fill_fifo()
256 skb_pull(bcs->tx_skb, count); in W6692B_fill_fifo()
257 bcs->tx_cnt -= count; in W6692B_fill_fifo()
258 bcs->hw.w6692.count += count; in W6692B_fill_fifo()
259 WRITEW6692BFIFO(cs, bcs->channel, ptr, count); in W6692B_fill_fifo()
260 …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()
262 char *t = bcs->blog; in W6692B_fill_fifo()
265 bcs->channel + '1', count); in W6692B_fill_fifo()
267 debugl1(cs, "%s", bcs->blog); in W6692B_fill_fifo()
276 struct BCState *bcs; in W6692B_interrupt() local
280 bcs = (cs->bcs->channel == bchan) ? cs->bcs : (cs->bcs + 1); in W6692B_interrupt()
284 if (!test_bit(BC_FLG_INIT, &bcs->Flag)) { in W6692B_interrupt()
293 if ((r & W_B_STAR_RDOV) && bcs->mode) in W6692B_interrupt()
296 bcs->mode); in W6692B_interrupt()
305 W6692B_empty_fifo(bcs, count); in W6692B_interrupt()
306 if ((count = bcs->hw.w6692.rcvidx) > 0) { in W6692B_interrupt()
312 memcpy(skb_put(skb, count), bcs->hw.w6692.rcvbuf, count); in W6692B_interrupt()
313 skb_queue_tail(&bcs->rqueue, skb); in W6692B_interrupt()
317 bcs->hw.w6692.rcvidx = 0; in W6692B_interrupt()
318 schedule_event(bcs, B_RCVBUFREADY); in W6692B_interrupt()
321 W6692B_empty_fifo(bcs, W_B_FIFO_THRESH); in W6692B_interrupt()
325 debugl1(cs, "W6692 B RDOV(RMR) mode=%d", bcs->mode); in W6692B_interrupt()
327 if (bcs->mode != L1_MODE_TRANS) in W6692B_interrupt()
328 bcs->hw.w6692.rcvidx = 0; in W6692B_interrupt()
330 if (bcs->mode == L1_MODE_TRANS) { in W6692B_interrupt()
335 memcpy(skb_put(skb, W_B_FIFO_THRESH), bcs->hw.w6692.rcvbuf, W_B_FIFO_THRESH); in W6692B_interrupt()
336 skb_queue_tail(&bcs->rqueue, skb); in W6692B_interrupt()
338 bcs->hw.w6692.rcvidx = 0; in W6692B_interrupt()
339 schedule_event(bcs, B_RCVBUFREADY); in W6692B_interrupt()
346 if (bcs->mode == 1) in W6692B_interrupt()
347 W6692B_fill_fifo(bcs); in W6692B_interrupt()
352 if (bcs->tx_skb) { in W6692B_interrupt()
353 skb_push(bcs->tx_skb, bcs->hw.w6692.count); in W6692B_interrupt()
354 bcs->tx_cnt += bcs->hw.w6692.count; in W6692B_interrupt()
355 bcs->hw.w6692.count = 0; in W6692B_interrupt()
366 if (bcs->tx_skb && (bcs->mode != 1)) { in W6692B_interrupt()
367 skb_push(bcs->tx_skb, bcs->hw.w6692.count); in W6692B_interrupt()
368 bcs->tx_cnt += bcs->hw.w6692.count; in W6692B_interrupt()
369 bcs->hw.w6692.count = 0; in W6692B_interrupt()
372 if (bcs->tx_skb) { in W6692B_interrupt()
373 if (bcs->tx_skb->len) { in W6692B_interrupt()
374 W6692B_fill_fifo(bcs); in W6692B_interrupt()
377 if (test_bit(FLG_LLI_L1WAKEUP, &bcs->st->lli.flag) && in W6692B_interrupt()
378 (PACKET_NOACK != bcs->tx_skb->pkt_type)) { in W6692B_interrupt()
380 spin_lock_irqsave(&bcs->aclock, flags); in W6692B_interrupt()
381 bcs->ackcnt += bcs->hw.w6692.count; in W6692B_interrupt()
382 spin_unlock_irqrestore(&bcs->aclock, flags); in W6692B_interrupt()
383 schedule_event(bcs, B_ACKPENDING); in W6692B_interrupt()
385 dev_kfree_skb_irq(bcs->tx_skb); in W6692B_interrupt()
386 bcs->hw.w6692.count = 0; in W6692B_interrupt()
387 bcs->tx_skb = NULL; in W6692B_interrupt()
390 if ((bcs->tx_skb = skb_dequeue(&bcs->squeue))) { in W6692B_interrupt()
391 bcs->hw.w6692.count = 0; in W6692B_interrupt()
392 test_and_set_bit(BC_FLG_BUSY, &bcs->Flag); in W6692B_interrupt()
393 W6692B_fill_fifo(bcs); in W6692B_interrupt()
395 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in W6692B_interrupt()
396 schedule_event(bcs, B_XMTBUFREADY); in W6692B_interrupt()
725 W6692Bmode(struct BCState *bcs, int mode, int bchan) in W6692Bmode() argument
727 struct IsdnCardState *cs = bcs->cs; in W6692Bmode()
732 bcs->mode = mode; in W6692Bmode()
733 bcs->channel = bchan; in W6692Bmode()
734 bcs->hw.w6692.bchan = bchan; in W6692Bmode()
759 struct BCState *bcs = st->l1.bcs; in W6692_l2l1() local
764 spin_lock_irqsave(&bcs->cs->lock, flags); in W6692_l2l1()
765 if (bcs->tx_skb) { in W6692_l2l1()
766 skb_queue_tail(&bcs->squeue, skb); in W6692_l2l1()
768 bcs->tx_skb = skb; in W6692_l2l1()
769 test_and_set_bit(BC_FLG_BUSY, &bcs->Flag); in W6692_l2l1()
770 bcs->hw.w6692.count = 0; in W6692_l2l1()
771 bcs->cs->BC_Send_Data(bcs); in W6692_l2l1()
773 spin_unlock_irqrestore(&bcs->cs->lock, flags); in W6692_l2l1()
776 if (bcs->tx_skb) { in W6692_l2l1()
780 spin_lock_irqsave(&bcs->cs->lock, flags); in W6692_l2l1()
781 test_and_set_bit(BC_FLG_BUSY, &bcs->Flag); in W6692_l2l1()
782 bcs->tx_skb = skb; in W6692_l2l1()
783 bcs->hw.w6692.count = 0; in W6692_l2l1()
784 bcs->cs->BC_Send_Data(bcs); in W6692_l2l1()
785 spin_unlock_irqrestore(&bcs->cs->lock, flags); in W6692_l2l1()
788 if (!bcs->tx_skb) { in W6692_l2l1()
795 spin_lock_irqsave(&bcs->cs->lock, flags); in W6692_l2l1()
796 test_and_set_bit(BC_FLG_ACTIV, &bcs->Flag); in W6692_l2l1()
797 W6692Bmode(bcs, st->l1.mode, st->l1.bc); in W6692_l2l1()
798 spin_unlock_irqrestore(&bcs->cs->lock, flags); in W6692_l2l1()
805 spin_lock_irqsave(&bcs->cs->lock, flags); in W6692_l2l1()
806 test_and_clear_bit(BC_FLG_ACTIV, &bcs->Flag); in W6692_l2l1()
807 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in W6692_l2l1()
808 W6692Bmode(bcs, 0, st->l1.bc); in W6692_l2l1()
809 spin_unlock_irqrestore(&bcs->cs->lock, flags); in W6692_l2l1()
816 close_w6692state(struct BCState *bcs) in close_w6692state() argument
818 W6692Bmode(bcs, 0, bcs->channel); in close_w6692state()
819 if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) { in close_w6692state()
820 kfree(bcs->hw.w6692.rcvbuf); in close_w6692state()
821 bcs->hw.w6692.rcvbuf = NULL; in close_w6692state()
822 kfree(bcs->blog); in close_w6692state()
823 bcs->blog = NULL; in close_w6692state()
824 skb_queue_purge(&bcs->rqueue); in close_w6692state()
825 skb_queue_purge(&bcs->squeue); in close_w6692state()
826 if (bcs->tx_skb) { in close_w6692state()
827 dev_kfree_skb_any(bcs->tx_skb); in close_w6692state()
828 bcs->tx_skb = NULL; in close_w6692state()
829 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in close_w6692state()
835 open_w6692state(struct IsdnCardState *cs, struct BCState *bcs) in open_w6692state() argument
837 if (!test_and_set_bit(BC_FLG_INIT, &bcs->Flag)) { in open_w6692state()
838 if (!(bcs->hw.w6692.rcvbuf = kmalloc(HSCX_BUFMAX, GFP_ATOMIC))) { in open_w6692state()
841 test_and_clear_bit(BC_FLG_INIT, &bcs->Flag); in open_w6692state()
844 if (!(bcs->blog = kmalloc(MAX_BLOG_SPACE, GFP_ATOMIC))) { in open_w6692state()
847 test_and_clear_bit(BC_FLG_INIT, &bcs->Flag); in open_w6692state()
848 kfree(bcs->hw.w6692.rcvbuf); in open_w6692state()
849 bcs->hw.w6692.rcvbuf = NULL; in open_w6692state()
852 skb_queue_head_init(&bcs->rqueue); in open_w6692state()
853 skb_queue_head_init(&bcs->squeue); in open_w6692state()
855 bcs->tx_skb = NULL; in open_w6692state()
856 test_and_clear_bit(BC_FLG_BUSY, &bcs->Flag); in open_w6692state()
857 bcs->event = 0; in open_w6692state()
858 bcs->hw.w6692.rcvidx = 0; in open_w6692state()
859 bcs->tx_cnt = 0; in open_w6692state()
864 setstack_w6692(struct PStack *st, struct BCState *bcs) in setstack_w6692() argument
866 bcs->channel = st->l1.bc; in setstack_w6692()
867 if (open_w6692state(st->l1.hardware, bcs)) in setstack_w6692()
869 st->l1.bcs = bcs; in setstack_w6692()
872 bcs->st = st; in setstack_w6692()
913 cs->bcs[0].BC_SetStack = setstack_w6692; in initW6692()
914 cs->bcs[1].BC_SetStack = setstack_w6692; in initW6692()
915 cs->bcs[0].BC_Close = close_w6692state; in initW6692()
916 cs->bcs[1].BC_Close = close_w6692state; in initW6692()
917 W6692Bmode(cs->bcs, 0, 0); in initW6692()
918 W6692Bmode(cs->bcs + 1, 0, 0); in initW6692()