• Home
  • Raw
  • Download

Lines Matching refs:card

37 isdnloop_free_queue(isdnloop_card *card, int channel)  in isdnloop_free_queue()  argument
39 struct sk_buff_head *queue = &card->bqueue[channel]; in isdnloop_free_queue()
42 card->sndcount[channel] = 0; in isdnloop_free_queue()
54 isdnloop_bchan_send(isdnloop_card *card, int ch) in isdnloop_bchan_send() argument
56 isdnloop_card *rcard = card->rcard[ch]; in isdnloop_bchan_send()
57 int rch = card->rch[ch], len, ack; in isdnloop_bchan_send()
61 while (card->sndcount[ch]) { in isdnloop_bchan_send()
62 if ((skb = skb_dequeue(&card->bqueue[ch]))) { in isdnloop_bchan_send()
64 card->sndcount[ch] -= len; in isdnloop_bchan_send()
66 cmd.driver = card->myid; in isdnloop_bchan_send()
77 card->interface.statcallb(&cmd); in isdnloop_bchan_send()
79 card->sndcount[ch] = 0; in isdnloop_bchan_send()
94 isdnloop_card *card = (isdnloop_card *) data; in isdnloop_pollbchan() local
97 if (card->flags & ISDNLOOP_FLAGS_B1ACTIVE) in isdnloop_pollbchan()
98 isdnloop_bchan_send(card, 0); in isdnloop_pollbchan()
99 if (card->flags & ISDNLOOP_FLAGS_B2ACTIVE) in isdnloop_pollbchan()
100 isdnloop_bchan_send(card, 1); in isdnloop_pollbchan()
101 if (card->flags & (ISDNLOOP_FLAGS_B1ACTIVE | ISDNLOOP_FLAGS_B2ACTIVE)) { in isdnloop_pollbchan()
103 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_pollbchan()
104 card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD; in isdnloop_pollbchan()
105 add_timer(&card->rb_timer); in isdnloop_pollbchan()
106 card->flags |= ISDNLOOP_FLAGS_RBTIMER; in isdnloop_pollbchan()
107 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_pollbchan()
109 card->flags &= ~ISDNLOOP_FLAGS_RBTIMER; in isdnloop_pollbchan()
185 isdnloop_parse_status(u_char *status, int channel, isdnloop_card *card) in isdnloop_parse_status() argument
201 cmd.driver = card->myid; in isdnloop_parse_status()
206 card->flags |= (channel) ? in isdnloop_parse_status()
211 card->flags &= ~((channel) ? in isdnloop_parse_status()
213 isdnloop_free_queue(card, channel); in isdnloop_parse_status()
221 sprintf(cmd.parm.setup.phone, "LEASED%d", card->myid); in isdnloop_parse_status()
248 card->flags &= ~ISDNLOOP_FLAGS_B1ACTIVE; in isdnloop_parse_status()
249 isdnloop_free_queue(card, 0); in isdnloop_parse_status()
251 cmd.driver = card->myid; in isdnloop_parse_status()
252 card->interface.statcallb(&cmd); in isdnloop_parse_status()
255 cmd.driver = card->myid; in isdnloop_parse_status()
256 card->interface.statcallb(&cmd); in isdnloop_parse_status()
258 card->flags &= ~ISDNLOOP_FLAGS_B2ACTIVE; in isdnloop_parse_status()
259 isdnloop_free_queue(card, 1); in isdnloop_parse_status()
261 cmd.driver = card->myid; in isdnloop_parse_status()
262 card->interface.statcallb(&cmd); in isdnloop_parse_status()
265 cmd.driver = card->myid; in isdnloop_parse_status()
268 card->interface.statcallb(&cmd); in isdnloop_parse_status()
279 isdnloop_putmsg(isdnloop_card *card, unsigned char c) in isdnloop_putmsg() argument
283 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_putmsg()
284 *card->msg_buf_write++ = (c == 0xff) ? '\n' : c; in isdnloop_putmsg()
285 if (card->msg_buf_write == card->msg_buf_read) { in isdnloop_putmsg()
286 if (++card->msg_buf_read > card->msg_buf_end) in isdnloop_putmsg()
287 card->msg_buf_read = card->msg_buf; in isdnloop_putmsg()
289 if (card->msg_buf_write > card->msg_buf_end) in isdnloop_putmsg()
290 card->msg_buf_write = card->msg_buf; in isdnloop_putmsg()
291 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_putmsg()
310 isdnloop_card *card = (isdnloop_card *) data; in isdnloop_polldchan() local
320 if ((skb = skb_dequeue(&card->dqueue))) in isdnloop_polldchan()
327 isdnloop_putmsg(card, c); in isdnloop_polldchan()
328 card->imsg[card->iptr] = c; in isdnloop_polldchan()
329 if (card->iptr < 59) in isdnloop_polldchan()
330 card->iptr++; in isdnloop_polldchan()
333 isdnloop_putmsg(card, '\n'); in isdnloop_polldchan()
334 card->imsg[card->iptr] = 0; in isdnloop_polldchan()
335 card->iptr = 0; in isdnloop_polldchan()
336 if (card->imsg[0] == '0' && card->imsg[1] >= '0' && in isdnloop_polldchan()
337 card->imsg[1] <= '2' && card->imsg[2] == ';') { in isdnloop_polldchan()
338 ch = (card->imsg[1] - '0') - 1; in isdnloop_polldchan()
339 p = &card->imsg[3]; in isdnloop_polldchan()
340 isdnloop_parse_status(p, ch, card); in isdnloop_polldchan()
342 p = card->imsg; in isdnloop_polldchan()
346 card->ptype = ISDN_PTYPE_1TR6; in isdnloop_polldchan()
347 card->interface.features |= ISDN_FEATURE_P_1TR6; in isdnloop_polldchan()
352 card->ptype = ISDN_PTYPE_EURO; in isdnloop_polldchan()
353 card->interface.features |= ISDN_FEATURE_P_EURO; in isdnloop_polldchan()
365 cmd.driver = card->myid; in isdnloop_polldchan()
367 card->interface.statcallb(&cmd); in isdnloop_polldchan()
369 if (card->flags & (ISDNLOOP_FLAGS_B1ACTIVE | ISDNLOOP_FLAGS_B2ACTIVE)) in isdnloop_polldchan()
370 if (!(card->flags & ISDNLOOP_FLAGS_RBTIMER)) { in isdnloop_polldchan()
372 card->flags |= ISDNLOOP_FLAGS_RBTIMER; in isdnloop_polldchan()
373 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_polldchan()
374 del_timer(&card->rb_timer); in isdnloop_polldchan()
375 card->rb_timer.function = isdnloop_pollbchan; in isdnloop_polldchan()
376 card->rb_timer.data = (unsigned long) card; in isdnloop_polldchan()
377 card->rb_timer.expires = jiffies + ISDNLOOP_TIMER_BCREAD; in isdnloop_polldchan()
378 add_timer(&card->rb_timer); in isdnloop_polldchan()
379 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_polldchan()
382 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_polldchan()
383 card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD; in isdnloop_polldchan()
384 add_timer(&card->st_timer); in isdnloop_polldchan()
385 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_polldchan()
399 isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card *card) in isdnloop_sendbuf() argument
411 if (!(card->flags & (channel) ? ISDNLOOP_FLAGS_B2ACTIVE : ISDNLOOP_FLAGS_B1ACTIVE)) in isdnloop_sendbuf()
413 if (card->sndcount[channel] > ISDNLOOP_MAX_SQUEUE) in isdnloop_sendbuf()
415 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_sendbuf()
420 skb_queue_tail(&card->bqueue[channel], nskb); in isdnloop_sendbuf()
424 card->sndcount[channel] += len; in isdnloop_sendbuf()
425 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_sendbuf()
442 isdnloop_readstatus(u_char __user *buf, int len, isdnloop_card *card) in isdnloop_readstatus() argument
448 if (card->msg_buf_read == card->msg_buf_write) in isdnloop_readstatus()
450 if (put_user(*card->msg_buf_read++, p)) in isdnloop_readstatus()
452 if (card->msg_buf_read > card->msg_buf_end) in isdnloop_readstatus()
453 card->msg_buf_read = card->msg_buf; in isdnloop_readstatus()
470 isdnloop_fake(isdnloop_card *card, char *s, int ch) in isdnloop_fake() argument
482 skb_queue_tail(&card->dqueue, skb); in isdnloop_fake()
519 isdnloop_fake_err(isdnloop_card *card) in isdnloop_fake_err() argument
523 snprintf(buf, sizeof(buf), "E%s", card->omsg); in isdnloop_fake_err()
524 isdnloop_fake(card, buf, -1); in isdnloop_fake_err()
525 isdnloop_fake(card, "NAK", -1); in isdnloop_fake_err()
545 isdnloop_unicause(isdnloop_card *card, int loc, int cau) in isdnloop_unicause() argument
549 switch (card->ptype) { in isdnloop_unicause()
571 isdnloop_atimeout(isdnloop_card *card, int ch) in isdnloop_atimeout() argument
576 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_atimeout()
577 if (card->rcard) { in isdnloop_atimeout()
578 isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1); in isdnloop_atimeout()
579 card->rcard[ch]->rcard[card->rch[ch]] = NULL; in isdnloop_atimeout()
580 card->rcard[ch] = NULL; in isdnloop_atimeout()
582 isdnloop_fake(card, "DDIS_I", ch + 1); in isdnloop_atimeout()
584 sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 3)); in isdnloop_atimeout()
585 isdnloop_fake(card, buf, ch + 1); in isdnloop_atimeout()
586 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_atimeout()
595 isdnloop_card *card = (isdnloop_card *) data; in isdnloop_atimeout0() local
596 isdnloop_atimeout(card, 0); in isdnloop_atimeout0()
605 isdnloop_card *card = (isdnloop_card *) data; in isdnloop_atimeout1() local
606 isdnloop_atimeout(card, 1); in isdnloop_atimeout1()
617 isdnloop_start_ctimer(isdnloop_card *card, int ch) in isdnloop_start_ctimer() argument
621 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_start_ctimer()
622 init_timer(&card->c_timer[ch]); in isdnloop_start_ctimer()
623 card->c_timer[ch].expires = jiffies + ISDNLOOP_TIMER_ALERTWAIT; in isdnloop_start_ctimer()
625 card->c_timer[ch].function = isdnloop_atimeout1; in isdnloop_start_ctimer()
627 card->c_timer[ch].function = isdnloop_atimeout0; in isdnloop_start_ctimer()
628 card->c_timer[ch].data = (unsigned long) card; in isdnloop_start_ctimer()
629 add_timer(&card->c_timer[ch]); in isdnloop_start_ctimer()
630 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_start_ctimer()
641 isdnloop_kill_ctimer(isdnloop_card *card, int ch) in isdnloop_kill_ctimer() argument
645 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_kill_ctimer()
646 del_timer(&card->c_timer[ch]); in isdnloop_kill_ctimer()
647 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_kill_ctimer()
670 isdnloop_try_call(isdnloop_card *card, char *p, int lch, isdn_ctrl *cmd) in isdnloop_try_call() argument
684 if ((cc == card) && (ch == lch)) in isdnloop_try_call()
703 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_try_call()
708 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_try_call()
712 cc->rcard[ch] = card; in isdnloop_try_call()
714 card->rcard[lch] = cc; in isdnloop_try_call()
715 card->rch[lch] = ch; in isdnloop_try_call()
716 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_try_call()
719 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_try_call()
743 isdnloop_vstphone(isdnloop_card *card, char *phone, int caller) in isdnloop_vstphone() argument
748 if (!card) { in isdnloop_vstphone()
752 switch (card->ptype) { in isdnloop_vstphone()
756 if (!(strcmp(card->s0num[i], phone))) in isdnloop_vstphone()
758 return (card->s0num[0]); in isdnloop_vstphone()
764 sprintf(nphone, "%s%c", card->s0num[0], phone[0]); in isdnloop_vstphone()
781 isdnloop_parse_cmd(isdnloop_card *card) in isdnloop_parse_cmd() argument
783 char *p = card->omsg; in isdnloop_parse_cmd()
791 if ((card->omsg[0] != '0') && (card->omsg[2] != ';')) { in isdnloop_parse_cmd()
792 isdnloop_fake_err(card); in isdnloop_parse_cmd()
795 ch = card->omsg[1] - '0'; in isdnloop_parse_cmd()
797 isdnloop_fake_err(card); in isdnloop_parse_cmd()
805 isdnloop_fake_err(card); in isdnloop_parse_cmd()
817 if (card->rcard[ch - 1]) { in isdnloop_parse_cmd()
818 isdnloop_fake(card->rcard[ch - 1], "BCON_I", in isdnloop_parse_cmd()
819 card->rch[ch - 1] + 1); in isdnloop_parse_cmd()
820 isdnloop_fake(card, "BCON_C", ch); in isdnloop_parse_cmd()
825 if (card->rcard[ch - 1]) { in isdnloop_parse_cmd()
826 isdnloop_fake(card->rcard[ch - 1], "BCON_C", in isdnloop_parse_cmd()
827 card->rch[ch - 1] + 1); in isdnloop_parse_cmd()
832 isdnloop_fake(card, "BDIS_C", ch); in isdnloop_parse_cmd()
833 if (card->rcard[ch - 1]) { in isdnloop_parse_cmd()
834 isdnloop_fake(card->rcard[ch - 1], "BDIS_I", in isdnloop_parse_cmd()
835 card->rch[ch - 1] + 1); in isdnloop_parse_cmd()
840 isdnloop_kill_ctimer(card, ch - 1); in isdnloop_parse_cmd()
841 if (card->rcard[ch - 1]) { in isdnloop_parse_cmd()
842 isdnloop_kill_ctimer(card->rcard[ch - 1], card->rch[ch - 1]); in isdnloop_parse_cmd()
843 isdnloop_fake(card->rcard[ch - 1], "DCON_C", in isdnloop_parse_cmd()
844 card->rch[ch - 1] + 1); in isdnloop_parse_cmd()
845 isdnloop_fake(card, "DCON_C", ch); in isdnloop_parse_cmd()
850 isdnloop_kill_ctimer(card, ch - 1); in isdnloop_parse_cmd()
851 if (card->rcard[ch - 1]) { in isdnloop_parse_cmd()
852 isdnloop_kill_ctimer(card->rcard[ch - 1], card->rch[ch - 1]); in isdnloop_parse_cmd()
853 isdnloop_fake(card->rcard[ch - 1], "DDIS_I", in isdnloop_parse_cmd()
854 card->rch[ch - 1] + 1); in isdnloop_parse_cmd()
855 card->rcard[ch - 1] = NULL; in isdnloop_parse_cmd()
857 isdnloop_fake(card, "DDIS_C", ch); in isdnloop_parse_cmd()
861 if (card->ptype != ISDN_PTYPE_1TR6) { in isdnloop_parse_cmd()
862 isdnloop_fake_err(card); in isdnloop_parse_cmd()
869 switch (isdnloop_try_call(card, p, ch - 1, &cmd)) { in isdnloop_parse_cmd()
874 isdnloop_vstphone(card, cmd.parm.setup.eazmsn, 1), in isdnloop_parse_cmd()
877 isdnloop_vstphone(card->rcard[ch - 1], in isdnloop_parse_cmd()
879 isdnloop_fake(card->rcard[ch - 1], buf, card->rch[ch - 1] + 1); in isdnloop_parse_cmd()
883 isdnloop_start_ctimer(card, ch - 1); in isdnloop_parse_cmd()
887 isdnloop_fake(card, "DDIS_I", ch); in isdnloop_parse_cmd()
888 sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 1)); in isdnloop_parse_cmd()
889 isdnloop_fake(card, buf, ch); in isdnloop_parse_cmd()
893 isdnloop_fake(card, "DDIS_I", ch); in isdnloop_parse_cmd()
894 sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 2)); in isdnloop_parse_cmd()
895 isdnloop_fake(card, buf, ch); in isdnloop_parse_cmd()
901 card->eazlist[ch - 1][0] = '\0'; in isdnloop_parse_cmd()
906 if (strlen(p) >= sizeof(card->eazlist[0])) in isdnloop_parse_cmd()
908 strcpy(card->eazlist[ch - 1], p); in isdnloop_parse_cmd()
912 sprintf(buf, "EAZ-LIST: %s", card->eazlist[ch - 1]); in isdnloop_parse_cmd()
913 isdnloop_fake(card, buf, ch + 1); in isdnloop_parse_cmd()
927 card->sil[ch - 1] |= si2bit[*p - '0']; in isdnloop_parse_cmd()
931 isdnloop_fake_err(card); in isdnloop_parse_cmd()
938 if (card->sil[ch - 1] & (1 << i)) in isdnloop_parse_cmd()
940 isdnloop_fake(card, buf, ch + 1); in isdnloop_parse_cmd()
944 card->sil[ch - 1] = 0; in isdnloop_parse_cmd()
970 isdnloop_writecmd(const u_char *buf, int len, int user, isdnloop_card *card) in isdnloop_writecmd() argument
988 isdnloop_putmsg(card, '>'); in isdnloop_writecmd()
992 isdnloop_putmsg(card, *p); in isdnloop_writecmd()
993 card->omsg[card->optr] = *p; in isdnloop_writecmd()
995 card->omsg[card->optr] = '\0'; in isdnloop_writecmd()
996 card->optr = 0; in isdnloop_writecmd()
997 isdnloop_parse_cmd(card); in isdnloop_writecmd()
999 isdnloop_putmsg(card, '>'); in isdnloop_writecmd()
1003 if (card->optr < 59) in isdnloop_writecmd()
1004 card->optr++; in isdnloop_writecmd()
1010 cmd.driver = card->myid; in isdnloop_writecmd()
1012 card->interface.statcallb(&cmd); in isdnloop_writecmd()
1020 isdnloop_stopcard(isdnloop_card *card) in isdnloop_stopcard() argument
1025 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_stopcard()
1026 if (card->flags & ISDNLOOP_FLAGS_RUNNING) { in isdnloop_stopcard()
1027 card->flags &= ~ISDNLOOP_FLAGS_RUNNING; in isdnloop_stopcard()
1028 del_timer(&card->st_timer); in isdnloop_stopcard()
1029 del_timer(&card->rb_timer); in isdnloop_stopcard()
1030 del_timer(&card->c_timer[0]); in isdnloop_stopcard()
1031 del_timer(&card->c_timer[1]); in isdnloop_stopcard()
1033 cmd.driver = card->myid; in isdnloop_stopcard()
1034 card->interface.statcallb(&cmd); in isdnloop_stopcard()
1036 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_stopcard()
1065 isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp) in isdnloop_start() argument
1071 if (card->flags & ISDNLOOP_FLAGS_RUNNING) in isdnloop_start()
1081 spin_lock_irqsave(&card->isdnloop_lock, flags); in isdnloop_start()
1084 if (isdnloop_fake(card, "DRV1.23EC-Q.931-CAPI-CNS-BASIS-20.02.96", in isdnloop_start()
1086 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_start()
1089 card->sil[0] = card->sil[1] = 4; in isdnloop_start()
1090 if (isdnloop_fake(card, "TEI OK", 0)) { in isdnloop_start()
1091 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_start()
1095 strlcpy(card->s0num[i], sdef.num[i], in isdnloop_start()
1096 sizeof(card->s0num[0])); in isdnloop_start()
1100 if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95", in isdnloop_start()
1102 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_start()
1105 card->sil[0] = card->sil[1] = 4; in isdnloop_start()
1106 if (isdnloop_fake(card, "TEI OK", 0)) { in isdnloop_start()
1107 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_start()
1110 strlcpy(card->s0num[0], sdef.num[0], sizeof(card->s0num[0])); in isdnloop_start()
1111 card->s0num[1][0] = '\0'; in isdnloop_start()
1112 card->s0num[2][0] = '\0'; in isdnloop_start()
1115 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_start()
1120 init_timer(&card->st_timer); in isdnloop_start()
1121 card->st_timer.expires = jiffies + ISDNLOOP_TIMER_DCREAD; in isdnloop_start()
1122 card->st_timer.function = isdnloop_polldchan; in isdnloop_start()
1123 card->st_timer.data = (unsigned long) card; in isdnloop_start()
1124 add_timer(&card->st_timer); in isdnloop_start()
1125 card->flags |= ISDNLOOP_FLAGS_RUNNING; in isdnloop_start()
1126 spin_unlock_irqrestore(&card->isdnloop_lock, flags); in isdnloop_start()
1134 isdnloop_command(isdn_ctrl *c, isdnloop_card *card) in isdnloop_command() argument
1147 return (ulong) card; in isdnloop_command()
1151 return (isdnloop_start(card, (isdnloop_sdef *) a)); in isdnloop_command()
1162 if (!card->leased) { in isdnloop_command()
1163 card->leased = 1; in isdnloop_command()
1164 while (card->ptype == ISDN_PTYPE_UNKNOWN) in isdnloop_command()
1168 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); in isdnloop_command()
1173 cmd.driver = card->myid; in isdnloop_command()
1175 card->interface.statcallb(&cmd); in isdnloop_command()
1178 if (card->leased) { in isdnloop_command()
1179 card->leased = 0; in isdnloop_command()
1181 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); in isdnloop_command()
1186 cmd.driver = card->myid; in isdnloop_command()
1188 card->interface.statcallb(&cmd); in isdnloop_command()
1197 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in isdnloop_command()
1199 if (card->leased) in isdnloop_command()
1218 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); in isdnloop_command()
1222 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in isdnloop_command()
1227 switch (card->l2_proto[a - 1]) { in isdnloop_command()
1244 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); in isdnloop_command()
1246 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); in isdnloop_command()
1250 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in isdnloop_command()
1254 switch (card->l2_proto[a - 1]) { in isdnloop_command()
1273 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); in isdnloop_command()
1276 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in isdnloop_command()
1281 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); in isdnloop_command()
1285 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in isdnloop_command()
1287 if (card->leased) in isdnloop_command()
1291 if (card->ptype == ISDN_PTYPE_EURO) { in isdnloop_command()
1297 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); in isdnloop_command()
1301 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in isdnloop_command()
1303 if (card->leased) in isdnloop_command()
1307 if (card->ptype == ISDN_PTYPE_EURO) in isdnloop_command()
1311 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); in isdnloop_command()
1315 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in isdnloop_command()
1340 i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card); in isdnloop_command()
1341 card->l2_proto[a & 255] = (a >> 8); in isdnloop_command()
1345 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in isdnloop_command()
1377 isdnloop_card *card = isdnloop_findcard(c->driver); in if_command() local
1379 if (card) in if_command()
1380 return (isdnloop_command(c, card)); in if_command()
1389 isdnloop_card *card = isdnloop_findcard(id); in if_writecmd() local
1391 if (card) { in if_writecmd()
1392 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in if_writecmd()
1394 return (isdnloop_writecmd(buf, len, 1, card)); in if_writecmd()
1404 isdnloop_card *card = isdnloop_findcard(id); in if_readstatus() local
1406 if (card) { in if_readstatus()
1407 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in if_readstatus()
1409 return (isdnloop_readstatus(buf, len, card)); in if_readstatus()
1419 isdnloop_card *card = isdnloop_findcard(id); in if_sendbuf() local
1421 if (card) { in if_sendbuf()
1422 if (!(card->flags & ISDNLOOP_FLAGS_RUNNING)) in if_sendbuf()
1426 return (isdnloop_sendbuf(channel, skb, card)); in if_sendbuf()
1440 isdnloop_card *card; in isdnloop_initcard() local
1443 if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) { in isdnloop_initcard()
1448 card->interface.owner = THIS_MODULE; in isdnloop_initcard()
1449 card->interface.channels = ISDNLOOP_BCH; in isdnloop_initcard()
1450 card->interface.hl_hdrlen = 1; /* scratch area for storing ack flag*/ in isdnloop_initcard()
1451 card->interface.maxbufsize = 4000; in isdnloop_initcard()
1452 card->interface.command = if_command; in isdnloop_initcard()
1453 card->interface.writebuf_skb = if_sendbuf; in isdnloop_initcard()
1454 card->interface.writecmd = if_writecmd; in isdnloop_initcard()
1455 card->interface.readstat = if_readstatus; in isdnloop_initcard()
1456 card->interface.features = ISDN_FEATURE_L2_X75I | in isdnloop_initcard()
1464 card->ptype = ISDN_PTYPE_UNKNOWN; in isdnloop_initcard()
1465 strlcpy(card->interface.id, id, sizeof(card->interface.id)); in isdnloop_initcard()
1466 card->msg_buf_write = card->msg_buf; in isdnloop_initcard()
1467 card->msg_buf_read = card->msg_buf; in isdnloop_initcard()
1468 card->msg_buf_end = &card->msg_buf[sizeof(card->msg_buf) - 1]; in isdnloop_initcard()
1470 card->l2_proto[i] = ISDN_PROTO_L2_X75I; in isdnloop_initcard()
1471 skb_queue_head_init(&card->bqueue[i]); in isdnloop_initcard()
1473 skb_queue_head_init(&card->dqueue); in isdnloop_initcard()
1474 spin_lock_init(&card->isdnloop_lock); in isdnloop_initcard()
1475 card->next = cards; in isdnloop_initcard()
1476 cards = card; in isdnloop_initcard()
1477 if (!register_isdn(&card->interface)) { in isdnloop_initcard()
1481 kfree(card); in isdnloop_initcard()
1484 card->myid = card->interface.channels; in isdnloop_initcard()
1485 return card; in isdnloop_initcard()
1491 isdnloop_card *card; in isdnloop_addcard() local
1493 if (!(card = isdnloop_initcard(id1))) { in isdnloop_addcard()
1498 card->interface.id); in isdnloop_addcard()
1515 isdnloop_card *card = cards; in isdnloop_exit() local
1520 while (card) { in isdnloop_exit()
1522 cmd.driver = card->myid; in isdnloop_exit()
1523 card->interface.statcallb(&cmd); in isdnloop_exit()
1525 isdnloop_free_queue(card, i); in isdnloop_exit()
1526 card = card->next; in isdnloop_exit()
1528 card = cards; in isdnloop_exit()
1529 while (card) { in isdnloop_exit()
1530 last = card; in isdnloop_exit()
1531 skb_queue_purge(&card->dqueue); in isdnloop_exit()
1532 card = card->next; in isdnloop_exit()