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