Lines Matching +full:cs +full:- +full:3
130 debugl1(struct IsdnCardState *cs, char *fmt, ...) in debugl1() argument
136 sprintf(tmp, "Card%d ", cs->cardnr + 1); in debugl1()
137 VHiSax_putstatus(cs, tmp, fmt, args); in debugl1()
145 struct PStack *st = fi->userdata; in l1m_debug()
146 struct IsdnCardState *cs = st->l1.hardware; in l1m_debug() local
150 sprintf(tmp, "Card%d ", cs->cardnr + 1); in l1m_debug()
151 VHiSax_putstatus(cs, tmp, fmt, args); in l1m_debug()
156 L1activated(struct IsdnCardState *cs) in L1activated() argument
160 st = cs->stlist; in L1activated()
162 if (test_and_clear_bit(FLG_L1_ACTIVATING, &st->l1.Flags)) in L1activated()
163 st->l1.l1l2(st, PH_ACTIVATE | CONFIRM, NULL); in L1activated()
165 st->l1.l1l2(st, PH_ACTIVATE | INDICATION, NULL); in L1activated()
166 st = st->next; in L1activated()
171 L1deactivated(struct IsdnCardState *cs) in L1deactivated() argument
175 st = cs->stlist; in L1deactivated()
177 if (test_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in L1deactivated()
178 st->l1.l1l2(st, PH_PAUSE | CONFIRM, NULL); in L1deactivated()
179 st->l1.l1l2(st, PH_DEACTIVATE | INDICATION, NULL); in L1deactivated()
180 st = st->next; in L1deactivated()
182 test_and_clear_bit(FLG_L1_DBUSY, &cs->HW_Flags); in L1deactivated()
186 DChannel_proc_xmt(struct IsdnCardState *cs) in DChannel_proc_xmt() argument
190 if (cs->tx_skb) in DChannel_proc_xmt()
193 stptr = cs->stlist; in DChannel_proc_xmt()
195 if (test_and_clear_bit(FLG_L1_PULL_REQ, &stptr->l1.Flags)) { in DChannel_proc_xmt()
196 stptr->l1.l1l2(stptr, PH_PULL | CONFIRM, NULL); in DChannel_proc_xmt()
199 stptr = stptr->next; in DChannel_proc_xmt()
204 DChannel_proc_rcv(struct IsdnCardState *cs) in DChannel_proc_rcv() argument
207 struct PStack *stptr = cs->stlist; in DChannel_proc_rcv()
211 if (test_bit(FLG_L1_ACTTIMER, &stptr->l1.Flags)) in DChannel_proc_rcv()
212 FsmEvent(&stptr->l1.l1m, EV_TIMER_ACT, NULL); in DChannel_proc_rcv()
213 while ((skb = skb_dequeue(&cs->rq))) { in DChannel_proc_rcv()
215 if (cs->debug & L1_DEB_LAPD) in DChannel_proc_rcv()
216 Logl2Frame(cs, skb, "PH_DATA", 1); in DChannel_proc_rcv()
218 stptr = cs->stlist; in DChannel_proc_rcv()
219 if (skb->len<3) { in DChannel_proc_rcv()
220 debugl1(cs, "D-channel frame too short(%d)",skb->len); in DChannel_proc_rcv()
224 if ((skb->data[0] & 1) || !(skb->data[1] &1)) { in DChannel_proc_rcv()
225 debugl1(cs, "D-channel frame wrong EA0/EA1"); in DChannel_proc_rcv()
229 sapi = skb->data[0] >> 2; in DChannel_proc_rcv()
230 tei = skb->data[1] >> 1; in DChannel_proc_rcv()
231 if (cs->debug & DEB_DLOG_HEX) in DChannel_proc_rcv()
232 LogFrame(cs, skb->data, skb->len); in DChannel_proc_rcv()
233 if (cs->debug & DEB_DLOG_VERBOSE) in DChannel_proc_rcv()
234 dlogframe(cs, skb, 1); in DChannel_proc_rcv()
239 stptr->l1.l1l2(stptr, PH_DATA | INDICATION, nskb); in DChannel_proc_rcv()
242 stptr = stptr->next; in DChannel_proc_rcv()
247 stptr->l1.l1tei(stptr, PH_DATA | INDICATION, nskb); in DChannel_proc_rcv()
250 stptr = stptr->next; in DChannel_proc_rcv()
257 if (tei == stptr->l2.tei) { in DChannel_proc_rcv()
258 stptr->l1.l1l2(stptr, PH_DATA | INDICATION, skb); in DChannel_proc_rcv()
262 stptr = stptr->next; in DChannel_proc_rcv()
273 struct PStack *st = bcs->st; in BChannel_proc_xmt()
275 if (test_bit(BC_FLG_BUSY, &bcs->Flag)) { in BChannel_proc_xmt()
276 debugl1(bcs->cs, "BC_BUSY Error"); in BChannel_proc_xmt()
280 if (test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags)) in BChannel_proc_xmt()
281 st->l1.l1l2(st, PH_PULL | CONFIRM, NULL); in BChannel_proc_xmt()
282 if (!test_bit(BC_FLG_ACTIV, &bcs->Flag)) { in BChannel_proc_xmt()
283 if (!test_bit(BC_FLG_BUSY, &bcs->Flag) && in BChannel_proc_xmt()
284 skb_queue_empty(&bcs->squeue)) { in BChannel_proc_xmt()
285 st->l2.l2l1(st, PH_DEACTIVATE | CONFIRM, NULL); in BChannel_proc_xmt()
295 if (bcs->st->l1.l1m.state == ST_L1_WAIT_ACT) { in BChannel_proc_rcv()
296 FsmDelTimer(&bcs->st->l1.timer, 4); in BChannel_proc_rcv()
297 FsmEvent(&bcs->st->l1.l1m, EV_TIMER_ACT, NULL); in BChannel_proc_rcv()
299 while ((skb = skb_dequeue(&bcs->rqueue))) { in BChannel_proc_rcv()
300 bcs->st->l1.l1l2(bcs->st, PH_DATA | INDICATION, skb); in BChannel_proc_rcv()
310 spin_lock_irqsave(&bcs->aclock, flags); in BChannel_proc_ack()
311 ack = bcs->ackcnt; in BChannel_proc_ack()
312 bcs->ackcnt = 0; in BChannel_proc_ack()
313 spin_unlock_irqrestore(&bcs->aclock, flags); in BChannel_proc_ack()
315 lli_writewakeup(bcs->st, ack); in BChannel_proc_ack()
325 if (test_and_clear_bit(B_RCVBUFREADY, &bcs->event)) in BChannel_bh()
327 if (test_and_clear_bit(B_XMTBUFREADY, &bcs->event)) in BChannel_bh()
329 if (test_and_clear_bit(B_ACKPENDING, &bcs->event)) in BChannel_bh()
334 HiSax_addlist(struct IsdnCardState *cs, in HiSax_addlist() argument
337 st->next = cs->stlist; in HiSax_addlist()
338 cs->stlist = st; in HiSax_addlist()
342 HiSax_rmlist(struct IsdnCardState *cs, in HiSax_rmlist() argument
347 FsmDelTimer(&st->l1.timer, 0); in HiSax_rmlist()
348 if (cs->stlist == st) in HiSax_rmlist()
349 cs->stlist = st->next; in HiSax_rmlist()
351 p = cs->stlist; in HiSax_rmlist()
353 if (p->next == st) { in HiSax_rmlist()
354 p->next = st->next; in HiSax_rmlist()
357 p = p->next; in HiSax_rmlist()
362 init_bcstate(struct IsdnCardState *cs, int bc) in init_bcstate() argument
364 struct BCState *bcs = cs->bcs + bc; in init_bcstate()
366 bcs->cs = cs; in init_bcstate()
367 bcs->channel = bc; in init_bcstate()
368 INIT_WORK(&bcs->tqueue, BChannel_bh); in init_bcstate()
369 spin_lock_init(&bcs->aclock); in init_bcstate()
370 bcs->BC_SetStack = NULL; in init_bcstate()
371 bcs->BC_Close = NULL; in init_bcstate()
372 bcs->Flag = 0; in init_bcstate()
391 case 3: in l2cmd()
418 sprintf(tmpdeb, "%s[%d](nr %d)", l2cmd(ptr[2]), ptr[3] & 1, ptr[3] >> 1); in l2frames()
422 case 3: in l2frames()
431 sprintf(tmpdeb, "I[%d](ns %d, nr %d)", ptr[3] & 1, ptr[2] >> 1, ptr[3] >> 1); in l2frames()
442 Logl2Frame(struct IsdnCardState *cs, struct sk_buff *skb, char *buf, int dir) in Logl2Frame() argument
446 ptr = skb->data; in Logl2Frame()
449 debugl1(cs, "Address not LAPD"); in Logl2Frame()
451 debugl1(cs, "%s %s: %s%c (sapi %d, tei %d)", in Logl2Frame()
452 (dir ? "<-" : "->"), buf, l2frames(ptr), in Logl2Frame()
466 struct PStack *st = fi->userdata; in l1_deact_cnf()
469 if (test_bit(FLG_L1_ACTIVATING, &st->l1.Flags)) in l1_deact_cnf()
470 st->l1.l1hw(st, HW_ENABLE | REQUEST, NULL); in l1_deact_cnf()
476 struct PStack *st = fi->userdata; in l1_deact_req_s()
479 FsmRestartTimer(&st->l1.timer, 550, EV_TIMER_DEACT, NULL, 2); in l1_deact_req_s()
480 test_and_set_bit(FLG_L1_DEACTTIMER, &st->l1.Flags); in l1_deact_req_s()
486 struct PStack *st = fi->userdata; in l1_power_up_s()
488 if (test_bit(FLG_L1_ACTIVATING, &st->l1.Flags)) { in l1_power_up_s()
490 st->l1.l1hw(st, HW_INFO3 | REQUEST, NULL); in l1_power_up_s()
491 FsmRestartTimer(&st->l1.timer, TIMER3_VALUE, EV_TIMER3, NULL, 2); in l1_power_up_s()
492 test_and_set_bit(FLG_L1_T3RUN, &st->l1.Flags); in l1_power_up_s()
512 struct PStack *st = fi->userdata; in l1_info2_ind()
515 if (test_bit(FLG_L1_UINT, &st->l1.Flags)) in l1_info2_ind()
520 st->l1.l1hw(st, HW_INFO3 | REQUEST, NULL); in l1_info2_ind()
526 struct PStack *st = fi->userdata; in l1_info4_ind()
529 if (test_bit(FLG_L1_UINT, &st->l1.Flags)) in l1_info4_ind()
534 st->l1.l1hw(st, HW_INFO3 | REQUEST, NULL); in l1_info4_ind()
535 if (test_and_clear_bit(FLG_L1_DEACTTIMER, &st->l1.Flags)) in l1_info4_ind()
536 FsmDelTimer(&st->l1.timer, 4); in l1_info4_ind()
537 if (!test_bit(FLG_L1_ACTIVATED, &st->l1.Flags)) { in l1_info4_ind()
538 if (test_and_clear_bit(FLG_L1_T3RUN, &st->l1.Flags)) in l1_info4_ind()
539 FsmDelTimer(&st->l1.timer, 3); in l1_info4_ind()
540 FsmRestartTimer(&st->l1.timer, 110, EV_TIMER_ACT, NULL, 2); in l1_info4_ind()
541 test_and_set_bit(FLG_L1_ACTTIMER, &st->l1.Flags); in l1_info4_ind()
548 struct PStack *st = fi->userdata; in l1_timer3()
550 test_and_clear_bit(FLG_L1_T3RUN, &st->l1.Flags); in l1_timer3()
551 if (test_and_clear_bit(FLG_L1_ACTIVATING, &st->l1.Flags)) in l1_timer3()
552 L1deactivated(st->l1.hardware); in l1_timer3()
555 if (!test_bit(FLG_L1_UINT, &st->l1.Flags)) in l1_timer3()
557 if (st->l1.l1m.state != ST_L1_F6) { in l1_timer3()
559 st->l1.l1hw(st, HW_ENABLE | REQUEST, NULL); in l1_timer3()
566 struct PStack *st = fi->userdata; in l1_timer_act()
568 test_and_clear_bit(FLG_L1_ACTTIMER, &st->l1.Flags); in l1_timer_act()
569 test_and_set_bit(FLG_L1_ACTIVATED, &st->l1.Flags); in l1_timer_act()
570 L1activated(st->l1.hardware); in l1_timer_act()
576 struct PStack *st = fi->userdata; in l1_timer_deact()
578 test_and_clear_bit(FLG_L1_DEACTTIMER, &st->l1.Flags); in l1_timer_deact()
579 test_and_clear_bit(FLG_L1_ACTIVATED, &st->l1.Flags); in l1_timer_deact()
580 L1deactivated(st->l1.hardware); in l1_timer_deact()
581 st->l1.l1hw(st, HW_DEACTIVATE | RESPONSE, NULL); in l1_timer_deact()
587 struct PStack *st = fi->userdata; in l1_activate_s()
589 st->l1.l1hw(st, HW_RESET | REQUEST, NULL); in l1_activate_s()
595 struct PStack *st = fi->userdata; in l1_activate_no()
597 if ((!test_bit(FLG_L1_DEACTTIMER, &st->l1.Flags)) && (!test_bit(FLG_L1_T3RUN, &st->l1.Flags))) { in l1_activate_no()
598 test_and_clear_bit(FLG_L1_ACTIVATING, &st->l1.Flags); in l1_activate_no()
599 L1deactivated(st->l1.hardware); in l1_activate_no()
655 struct PStack *st = fi->userdata; in l1_deact_req_u()
658 FsmRestartTimer(&st->l1.timer, 550, EV_TIMER_DEACT, NULL, 2); in l1_deact_req_u()
659 test_and_set_bit(FLG_L1_DEACTTIMER, &st->l1.Flags); in l1_deact_req_u()
660 st->l1.l1hw(st, HW_ENABLE | REQUEST, NULL); in l1_deact_req_u()
666 struct PStack *st = fi->userdata; in l1_power_up_u()
668 FsmRestartTimer(&st->l1.timer, TIMER3_VALUE, EV_TIMER3, NULL, 2); in l1_power_up_u()
669 test_and_set_bit(FLG_L1_T3RUN, &st->l1.Flags); in l1_power_up_u()
681 struct PStack *st = fi->userdata; in l1_activate_u()
683 st->l1.l1hw(st, HW_INFO1 | REQUEST, NULL); in l1_activate_u()
713 struct PStack *st = fi->userdata; in l1b_activate()
716 FsmRestartTimer(&st->l1.timer, st->l1.delay, EV_TIMER_ACT, NULL, 2); in l1b_activate()
722 struct PStack *st = fi->userdata; in l1b_deactivate()
725 FsmRestartTimer(&st->l1.timer, 10, EV_TIMER_DEACT, NULL, 2); in l1b_deactivate()
731 struct PStack *st = fi->userdata; in l1b_timer_act()
734 st->l1.l1l2(st, PH_ACTIVATE | CONFIRM, NULL); in l1b_timer_act()
740 struct PStack *st = fi->userdata; in l1b_timer_deact()
743 st->l2.l2l1(st, PH_DEACTIVATE | CONFIRM, NULL); in l1b_timer_deact()
803 struct IsdnCardState *cs = (struct IsdnCardState *) st->l1.hardware; in dch_l2l1() local
809 st->l1.l1hw(st, pr, arg); in dch_l2l1()
812 if (cs->debug) in dch_l2l1()
813 debugl1(cs, "PH_ACTIVATE_REQ %s", in dch_l2l1()
814 st->l1.l1m.fsm->strState[st->l1.l1m.state]); in dch_l2l1()
815 if (test_bit(FLG_L1_ACTIVATED, &st->l1.Flags)) in dch_l2l1()
816 st->l1.l1l2(st, PH_ACTIVATE | CONFIRM, NULL); in dch_l2l1()
818 test_and_set_bit(FLG_L1_ACTIVATING, &st->l1.Flags); in dch_l2l1()
819 FsmEvent(&st->l1.l1m, EV_PH_ACTIVATE, arg); in dch_l2l1()
824 debugl1(cs, "PH_TEST_LOOP B1"); in dch_l2l1()
826 debugl1(cs, "PH_TEST_LOOP B2"); in dch_l2l1()
827 if (!(3 & (long) arg)) in dch_l2l1()
828 debugl1(cs, "PH_TEST_LOOP DISABLED"); in dch_l2l1()
829 st->l1.l1hw(st, HW_TESTLOOP | REQUEST, arg); in dch_l2l1()
832 if (cs->debug) in dch_l2l1()
833 debugl1(cs, "dch_l2l1 msg %04X unhandled", pr); in dch_l2l1()
839 l1_msg(struct IsdnCardState *cs, int pr, void *arg) { in l1_msg() argument
842 st = cs->stlist; in l1_msg()
847 FsmEvent(&st->l1.l1m, EV_RESET_IND, arg); in l1_msg()
850 FsmEvent(&st->l1.l1m, EV_DEACT_CNF, arg); in l1_msg()
853 FsmEvent(&st->l1.l1m, EV_DEACT_IND, arg); in l1_msg()
856 FsmEvent(&st->l1.l1m, EV_POWER_UP, arg); in l1_msg()
859 FsmEvent(&st->l1.l1m, EV_RSYNC_IND, arg); in l1_msg()
862 FsmEvent(&st->l1.l1m, EV_INFO2_IND, arg); in l1_msg()
866 FsmEvent(&st->l1.l1m, EV_INFO4_IND, arg); in l1_msg()
869 if (cs->debug) in l1_msg()
870 debugl1(cs, "l1msg %04X unhandled", pr); in l1_msg()
873 st = st->next; in l1_msg()
881 FsmEvent(&st->l1.l1m, EV_PH_ACTIVATE, NULL); in l1_msg_b()
884 FsmEvent(&st->l1.l1m, EV_PH_DEACTIVATE, NULL); in l1_msg_b()
890 setstack_HiSax(struct PStack *st, struct IsdnCardState *cs) in setstack_HiSax() argument
892 st->l1.hardware = cs; in setstack_HiSax()
893 st->protocol = cs->protocol; in setstack_HiSax()
894 st->l1.l1m.fsm = &l1fsm_s; in setstack_HiSax()
895 st->l1.l1m.state = ST_L1_F3; in setstack_HiSax()
896 st->l1.Flags = 0; in setstack_HiSax()
898 if (test_bit(FLG_HW_L1_UINT, &cs->HW_Flags)) { in setstack_HiSax()
899 st->l1.l1m.fsm = &l1fsm_u; in setstack_HiSax()
900 st->l1.l1m.state = ST_L1_RESET; in setstack_HiSax()
901 st->l1.Flags = FLG_L1_UINT; in setstack_HiSax()
904 st->l1.l1m.debug = cs->debug; in setstack_HiSax()
905 st->l1.l1m.userdata = st; in setstack_HiSax()
906 st->l1.l1m.userint = 0; in setstack_HiSax()
907 st->l1.l1m.printdebug = l1m_debug; in setstack_HiSax()
908 FsmInitTimer(&st->l1.l1m, &st->l1.timer); in setstack_HiSax()
911 st->l1.stlistp = &(cs->stlist); in setstack_HiSax()
912 st->l2.l2l1 = dch_l2l1; in setstack_HiSax()
913 if (cs->setstack_d) in setstack_HiSax()
914 cs->setstack_d(st, cs); in setstack_HiSax()
920 struct IsdnCardState *cs = st->l1.hardware; in setstack_l1_B() local
922 st->l1.l1m.fsm = &l1fsm_b; in setstack_l1_B()
923 st->l1.l1m.state = ST_L1_NULL; in setstack_l1_B()
924 st->l1.l1m.debug = cs->debug; in setstack_l1_B()
925 st->l1.l1m.userdata = st; in setstack_l1_B()
926 st->l1.l1m.userint = 0; in setstack_l1_B()
927 st->l1.l1m.printdebug = l1m_debug; in setstack_l1_B()
928 st->l1.Flags = 0; in setstack_l1_B()
929 FsmInitTimer(&st->l1.l1m, &st->l1.timer); in setstack_l1_B()