20 {{ 0x86, 0x02},
"DATA_B3_IND"},
21 {{ 0x86, 0x01},
"DATA_B3_CONF"},
22 {{ 0x02, 0x01},
"CONNECT_CONF"},
23 {{ 0x02, 0x02},
"CONNECT_IND"},
24 {{ 0x09, 0x01},
"CONNECT_INFO_CONF"},
25 {{ 0x03, 0x02},
"CONNECT_ACTIVE_IND"},
26 {{ 0x04, 0x01},
"DISCONNECT_CONF"},
27 {{ 0x04, 0x02},
"DISCONNECT_IND"},
28 {{ 0x05, 0x01},
"LISTEN_CONF"},
29 {{ 0x06, 0x01},
"GET_PARAMS_CONF"},
30 {{ 0x07, 0x01},
"INFO_CONF"},
31 {{ 0x07, 0x02},
"INFO_IND"},
32 {{ 0x08, 0x01},
"DATA_CONF"},
33 {{ 0x08, 0x02},
"DATA_IND"},
34 {{ 0x40, 0x01},
"SELECT_B2_PROTOCOL_CONF"},
35 {{ 0x80, 0x01},
"SELECT_B3_PROTOCOL_CONF"},
36 {{ 0x81, 0x01},
"LISTEN_B3_CONF"},
37 {{ 0x82, 0x01},
"CONNECT_B3_CONF"},
38 {{ 0x82, 0x02},
"CONNECT_B3_IND"},
39 {{ 0x83, 0x02},
"CONNECT_B3_ACTIVE_IND"},
40 {{ 0x84, 0x01},
"DISCONNECT_B3_CONF"},
41 {{ 0x84, 0x02},
"DISCONNECT_B3_IND"},
42 {{ 0x85, 0x01},
"GET_B3_PARAMS_CONF"},
43 {{ 0x01, 0x01},
"RESET_B3_CONF"},
44 {{ 0x01, 0x02},
"RESET_B3_IND"},
46 {{ 0xff, 0x01},
"MANUFACTURER_CONF"},
47 {{ 0xff, 0x02},
"MANUFACTURER_IND"},
50 {{ 0x01, 0x00},
"RESET_B3_REQ"},
51 {{ 0x02, 0x00},
"CONNECT_REQ"},
52 {{ 0x04, 0x00},
"DISCONNECT_REQ"},
53 {{ 0x05, 0x00},
"LISTEN_REQ"},
54 {{ 0x06, 0x00},
"GET_PARAMS_REQ"},
55 {{ 0x07, 0x00},
"INFO_REQ"},
56 {{ 0x08, 0x00},
"DATA_REQ"},
57 {{ 0x09, 0x00},
"CONNECT_INFO_REQ"},
58 {{ 0x40, 0x00},
"SELECT_B2_PROTOCOL_REQ"},
59 {{ 0x80, 0x00},
"SELECT_B3_PROTOCOL_REQ"},
60 {{ 0x81, 0x00},
"LISTEN_B3_REQ"},
61 {{ 0x82, 0x00},
"CONNECT_B3_REQ"},
62 {{ 0x84, 0x00},
"DISCONNECT_B3_REQ"},
63 {{ 0x85, 0x00},
"GET_B3_PARAMS_REQ"},
64 {{ 0x86, 0x00},
"DATA_B3_REQ"},
65 {{ 0xff, 0x00},
"MANUFACTURER_REQ"},
67 {{ 0x01, 0x03},
"RESET_B3_RESP"},
68 {{ 0x02, 0x03},
"CONNECT_RESP"},
69 {{ 0x03, 0x03},
"CONNECT_ACTIVE_RESP"},
70 {{ 0x04, 0x03},
"DISCONNECT_RESP"},
71 {{ 0x07, 0x03},
"INFO_RESP"},
72 {{ 0x08, 0x03},
"DATA_RESP"},
73 {{ 0x82, 0x03},
"CONNECT_B3_RESP"},
74 {{ 0x83, 0x03},
"CONNECT_B3_ACTIVE_RESP"},
75 {{ 0x84, 0x03},
"DISCONNECT_B3_RESP"},
76 {{ 0x86, 0x03},
"DATA_B3_RESP"},
77 {{ 0xff, 0x03},
"MANUFACTURER_RESP"},
79 {{ 0x00, 0x00},
NULL},
81 #define num_valid_imsg 27
107 #define ACTCAPI_MKHDR(l, c, s) { \
108 skb = alloc_skb(l + 8, GFP_ATOMIC); \
110 m = (actcapi_msg *)skb_put(skb, l + 8); \
111 m->hdr.len = l + 8; \
112 m->hdr.applicationID = 1; \
113 m->hdr.cmd.cmd = c; \
114 m->hdr.cmd.subcmd = s; \
115 m->hdr.msgnum = actcapi_nextsmsg(card); \
119 #define ACTCAPI_CHKSKB if (!skb) { \
120 printk(KERN_WARNING "actcapi: alloc_skb failed\n"); \
124 #define ACTCAPI_QUEUE_TX { \
125 actcapi_debug_msg(skb, 1); \
126 skb_queue_tail(&card->sndq, skb); \
127 act2000_schedule_tx(card); \
138 for (i = 0; i < ACT2000_BCH; i++)
139 eazmask |= card->bch[i].eazmask;
163 chan->fsm_state = ACT2000_STATE_NULL;
171 m->
msg.connect_req.
eaz = eaz ? eaz :
'0';
181 actcapi_connect_b3_req(act2000_card *
card, act2000_chan *
chan)
188 m->
msg.connect_b3_req.
plci = chan->plci;
190 sizeof(m->
msg.connect_b3_req.
ncpi));
191 m->
msg.connect_b3_req.
ncpi.len = 13;
192 m->
msg.connect_b3_req.
ncpi.modulo = 8;
215 card->interface.id, (card->ptype ==
ISDN_PTYPE_EURO) ?
"euro" :
"1tr6");
216 card->interface.features &=
218 card->interface.features |=
228 actcapi_manufacturer_req_v42(act2000_card *
card,
ulong arg)
274 msn_entry *
p = card->msn_list;
283 for (i = 0; i < 2; i++) {
309 m->
msg.select_b2_protocol_req.
plci = chan->plci;
311 sizeof(m->
msg.select_b2_protocol_req.
dlpd));
313 switch (chan->l2prot) {
337 actcapi_select_b3_protocol_req(act2000_card *card, act2000_chan *
chan)
344 m->
msg.select_b3_protocol_req.
plci = chan->plci;
346 sizeof(m->
msg.select_b3_protocol_req.
ncpd));
347 switch (chan->l3prot) {
358 actcapi_listen_b3_req(act2000_card *card, act2000_chan *chan)
370 actcapi_disconnect_req(act2000_card *card, act2000_chan *chan)
390 m->
msg.disconnect_b3_req.
ncci = chan->ncci;
392 sizeof(m->
msg.disconnect_b3_req.
ncpi));
393 m->
msg.disconnect_b3_req.
ncpi.len = 13;
394 m->
msg.disconnect_b3_req.
ncpi.modulo = 8;
395 chan->fsm_state = ACT2000_STATE_BHWAIT;
410 chan->fsm_state = ACT2000_STATE_NULL;
413 chan->fsm_state = ACT2000_STATE_IWAIT;
418 actcapi_connect_active_resp(act2000_card *card, act2000_chan *chan)
426 if (chan->fsm_state == ACT2000_STATE_IWAIT)
427 chan->fsm_state = ACT2000_STATE_IBWAIT;
432 actcapi_connect_b3_resp(act2000_card *card, act2000_chan *chan,
__u8 rejectcause)
439 m->
msg.connect_b3_resp.
ncci = chan->ncci;
443 sizeof(m->
msg.connect_b3_resp.
ncpi));
444 m->
msg.connect_b3_resp.
ncpi.len = 13;
445 m->
msg.connect_b3_resp.
ncpi.modulo = 8;
446 chan->fsm_state = ACT2000_STATE_BWAIT;
452 actcapi_connect_b3_active_resp(act2000_card *card, act2000_chan *chan)
460 chan->fsm_state = ACT2000_STATE_ACTIVE;
465 actcapi_info_resp(act2000_card *card, act2000_chan *chan)
477 actcapi_disconnect_b3_resp(act2000_card *card, act2000_chan *chan)
491 actcapi_disconnect_resp(act2000_card *card, act2000_chan *chan)
507 for (i = 0; i < ACT2000_BCH; i++)
508 if (card->bch[i].plci == 0x8000) {
509 card->bch[
i].plci =
plci;
516 find_plci(act2000_card *card,
__u16 plci)
519 for (i = 0; i < ACT2000_BCH; i++)
520 if (card->bch[i].plci == plci)
526 find_ncci(act2000_card *card,
__u16 ncci)
529 for (i = 0; i < ACT2000_BCH; i++)
530 if (card->bch[i].ncci == ncci)
536 find_dialing(act2000_card *card,
__u16 callref)
539 for (i = 0; i < ACT2000_BCH; i++)
540 if ((card->bch[i].callref == callref) &&
541 (card->bch[i].fsm_state == ACT2000_STATE_OCALL))
547 actcapi_data_b3_ind(act2000_card *card,
struct sk_buff *skb) {
556 chan = find_ncci(card, ncci);
559 if (card->bch[chan].fsm_state != ACT2000_STATE_ACTIVE)
561 if (card->bch[chan].plci != plci)
565 card->interface.rcvcallb_skb(card->myid, chan, skb);
575 msg->
hdr.
msgnum = actcapi_nextsmsg(card);
588 handle_ack(act2000_card *card, act2000_chan *chan,
__u8 blocknr) {
596 skb = skb_peek(&card->ackq);
597 spin_unlock_irqrestore(&card->lock, flags);
605 if ((((m->
msg.data_b3_req.
fakencci >> 8) & 0xff) == chan->ncci) &&
613 if (chan->queued < 0)
619 spin_unlock_irqrestore(&card->lock, flags);
620 if ((tmp == skb) || (tmp ==
NULL)) {
631 struct act2000_card *card =
649 if (actcapi_data_b3_ind(card, skb))
654 chan = find_ncci(card, msg->
msg.data_b3_conf.
ncci);
655 if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_ACTIVE)) {
656 if (msg->
msg.data_b3_conf.
info != 0)
659 len = handle_ack(card, &card->bch[chan],
666 card->interface.statcallb(&cmd);
672 chan = find_dialing(card, msg->
hdr.
msgnum);
675 card->bch[chan].fsm_state = ACT2000_STATE_NULL;
679 card->interface.statcallb(&cmd);
681 card->bch[chan].fsm_state = ACT2000_STATE_OWAIT;
688 chan = new_plci(card, msg->
msg.connect_ind.
plci);
690 ctmp = (act2000_chan *)tmp;
691 ctmp->plci = msg->
msg.connect_ind.
plci;
694 card->bch[chan].fsm_state = ACT2000_STATE_ICALL;
712 if (card->interface.statcallb(&cmd) == 2)
718 chan = find_plci(card, msg->
msg.connect_active_ind.
plci);
720 switch (card->bch[chan].fsm_state) {
721 case ACT2000_STATE_IWAIT:
722 actcapi_connect_active_resp(card, &card->bch[chan]);
724 case ACT2000_STATE_OWAIT:
725 actcapi_connect_active_resp(card, &card->bch[chan]);
732 chan = find_plci(card, msg->
msg.connect_b3_ind.
plci);
733 if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_IBWAIT)) {
734 card->bch[chan].ncci = msg->
msg.connect_b3_ind.
ncci;
735 actcapi_connect_b3_resp(card, &card->bch[chan], 0);
737 ctmp = (act2000_chan *)tmp;
738 ctmp->ncci = msg->
msg.connect_b3_ind.
ncci;
739 actcapi_connect_b3_resp(card, ctmp, 0x11);
744 chan = find_ncci(card, msg->
msg.connect_b3_active_ind.
ncci);
745 if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_BWAIT)) {
746 actcapi_connect_b3_active_resp(card, &card->bch[chan]);
750 card->interface.statcallb(&cmd);
755 chan = find_ncci(card, msg->
msg.disconnect_b3_ind.
ncci);
757 ctmp = &card->bch[chan];
758 actcapi_disconnect_b3_resp(card, ctmp);
759 switch (ctmp->fsm_state) {
760 case ACT2000_STATE_ACTIVE:
761 ctmp->fsm_state = ACT2000_STATE_DHWAIT2;
765 card->interface.statcallb(&cmd);
767 case ACT2000_STATE_BHWAIT2:
768 actcapi_disconnect_req(card, ctmp);
769 ctmp->fsm_state = ACT2000_STATE_DHWAIT;
773 card->interface.statcallb(&cmd);
782 ctmp = &card->bch[chan];
783 actcapi_disconnect_resp(card, ctmp);
784 ctmp->fsm_state = ACT2000_STATE_NULL;
788 card->interface.statcallb(&cmd);
790 ctmp = (act2000_chan *)tmp;
792 actcapi_disconnect_resp(card, ctmp);
799 switch (card->bch[chan].fsm_state) {
800 case ACT2000_STATE_ICALL:
801 case ACT2000_STATE_OWAIT:
802 ctmp = &card->bch[chan];
804 actcapi_select_b3_protocol_req(card, ctmp);
806 ctmp->fsm_state = ACT2000_STATE_NULL;
810 card->interface.statcallb(&cmd);
819 switch (card->bch[chan].fsm_state) {
820 case ACT2000_STATE_ICALL:
821 case ACT2000_STATE_OWAIT:
822 ctmp = &card->bch[chan];
824 actcapi_listen_b3_req(card, ctmp);
826 ctmp->fsm_state = ACT2000_STATE_NULL;
830 card->interface.statcallb(&cmd);
838 switch (card->bch[chan].fsm_state) {
839 case ACT2000_STATE_ICALL:
840 ctmp = &card->bch[chan];
844 ctmp->fsm_state = ACT2000_STATE_NULL;
848 card->interface.statcallb(&cmd);
851 case ACT2000_STATE_OWAIT:
852 ctmp = &card->bch[chan];
854 actcapi_connect_b3_req(card, ctmp);
855 ctmp->fsm_state = ACT2000_STATE_OBWAIT;
859 card->interface.statcallb(&cmd);
861 ctmp->fsm_state = ACT2000_STATE_NULL;
865 card->interface.statcallb(&cmd);
873 if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_OBWAIT)) {
874 ctmp = &card->bch[chan];
876 ctmp->fsm_state = ACT2000_STATE_NULL;
880 card->interface.statcallb(&cmd);
883 ctmp->fsm_state = ACT2000_STATE_BWAIT;
890 if ((chan >= 0) && (card->bch[chan].fsm_state == ACT2000_STATE_BHWAIT))
891 card->bch[chan].fsm_state = ACT2000_STATE_BHWAIT2;
895 chan = find_plci(card, msg->
msg.info_ind.
plci);
898 actcapi_info_resp(card, &card->bch[chan]);
910 memset(tmp, 0,
sizeof(tmp));
918 if ((!
strncmp(tmp,
"INFO: Trace buffer con", 22)) ||
919 (!
strncmp(tmp,
"INFO: Compile Date/Tim", 22))) {
920 card->flags |= ACT2000_FLAGS_RUNNING;
927 card->interface.statcallb(&cmd);
992 #ifdef DEBUG_DUMP_SKB
993 static void dump_skb(
struct sk_buff *skb) {
999 for (i = 0; i < skb->
len; i++) {
1000 t +=
sprintf(t,
"%02x ", *p++ & 0xff);
1001 if ((i & 0x0f) == 8) {
1019 #ifndef DEBUG_DATA_MSG
1024 #ifdef DEBUG_DUMP_SKB
1059 msg->
msg.connect_ind.
si1);
1061 msg->
msg.connect_ind.
si2);
1063 msg->
msg.connect_ind.
eaz);
1064 actcapi_debug_caddr(&msg->
msg.connect_ind.
addr);
1069 msg->
msg.connect_active_ind.
plci);
1070 actcapi_debug_caddr(&msg->
msg.connect_active_ind.
addr);
1089 for (j = 0; j <
l; j++)
1118 msg->
msg.connect_b3_ind.
ncci);
1120 msg->
msg.connect_b3_ind.
plci);
1121 actcapi_debug_ncpi(&msg->
msg.connect_b3_ind.
ncpi);
1126 msg->
msg.connect_b3_active_ind.
ncci);
1127 actcapi_debug_ncpi(&msg->
msg.connect_b3_active_ind.
ncpi);
1139 memset(tmp, 0,
sizeof(tmp));
1158 msg->
msg.select_b2_protocol_req.
plci);
1164 actcapi_debug_dlpd(&msg->
msg.select_b2_protocol_req.
dlpd);