summaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/callc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hisax/callc.c')
-rw-r--r--drivers/isdn/hisax/callc.c1074
1 files changed, 537 insertions, 537 deletions
diff --git a/drivers/isdn/hisax/callc.c b/drivers/isdn/hisax/callc.c
index c4897e1075d..a47637be0cc 100644
--- a/drivers/isdn/hisax/callc.c
+++ b/drivers/isdn/hisax/callc.c
@@ -2,7 +2,7 @@
*
* Author Karsten Keil
* Copyright by Karsten Keil <keil@isdn4linux.de>
- *
+ *
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
@@ -66,7 +66,7 @@ hisax_findcard(int driverid)
}
static __printf(3, 4) void
-link_debug(struct Channel *chanp, int direction, char *fmt, ...)
+ link_debug(struct Channel *chanp, int direction, char *fmt, ...)
{
va_list args;
char tmp[16];
@@ -91,9 +91,9 @@ enum {
ST_WAIT_DCOMMAND, /* 9 call clear. (receiver), awaiting DCHANNEL message */
ST_WAIT_DRELEASE, /* 10 DISCONNECT sent, awaiting RELEASE */
ST_WAIT_D_REL_CNF, /* 11 RELEASE sent, awaiting RELEASE confirm */
- ST_IN_PROCEED_SEND, /* 12 incoming call, proceeding send */
+ ST_IN_PROCEED_SEND, /* 12 incoming call, proceeding send */
};
-
+
#define STATE_COUNT (ST_IN_PROCEED_SEND + 1)
@@ -119,7 +119,7 @@ enum {
EV_SETUP_CNF, /* 1 */
EV_ACCEPTB, /* 2 */
EV_DISCONNECT_IND, /* 3 */
- EV_RELEASE, /* 4 */
+ EV_RELEASE, /* 4 */
EV_LEASED, /* 5 */
EV_LEASED_REL, /* 6 */
EV_SETUP_IND, /* 7 */
@@ -136,8 +136,8 @@ enum {
EV_SETUP_ERR, /* 18 */
EV_CONNECT_ERR, /* 19 */
EV_PROCEED, /* 20 */
- EV_ALERT, /* 21 */
- EV_REDIR, /* 22 */
+ EV_ALERT, /* 21 */
+ EV_REDIR, /* 22 */
};
#define EVENT_COUNT (EV_REDIR + 1)
@@ -232,8 +232,8 @@ lli_leased_in(struct FsmInst *fi, int event, void *arg)
ic.parm.setup.si2 = 0;
ic.parm.setup.plan = 0;
ic.parm.setup.screen = 0;
- sprintf(ic.parm.setup.eazmsn,"%d", chanp->chan + 1);
- sprintf(ic.parm.setup.phone,"LEASED%d", chanp->cs->myid);
+ sprintf(ic.parm.setup.eazmsn, "%d", chanp->chan + 1);
+ sprintf(ic.parm.setup.phone, "LEASED%d", chanp->cs->myid);
ret = chanp->cs->iif.statcallb(&ic);
if (chanp->debug & 1)
link_debug(chanp, 1, "statcallb ret=%d", ret);
@@ -356,33 +356,33 @@ lli_deliver_call(struct FsmInst *fi, int event, void *arg)
link_debug(chanp, 1, "statcallb ret=%d", ret);
switch (ret) {
- case 1: /* OK, someone likes this call */
- FsmDelTimer(&chanp->drel_timer, 61);
- FsmChangeState(fi, ST_IN_ALERT_SENT);
- chanp->d_st->lli.l4l3(chanp->d_st, CC_ALERTING | REQUEST, chanp->proc);
- break;
- case 5: /* direct redirect */
- case 4: /* Proceeding desired */
- FsmDelTimer(&chanp->drel_timer, 61);
- FsmChangeState(fi, ST_IN_PROCEED_SEND);
- chanp->d_st->lli.l4l3(chanp->d_st, CC_PROCEED_SEND | REQUEST, chanp->proc);
- if (ret == 5) {
- memcpy(&chanp->setup, &ic.parm.setup, sizeof(setup_parm));
- chanp->d_st->lli.l4l3(chanp->d_st, CC_REDIR | REQUEST, chanp->proc);
- }
- break;
- case 2: /* Rejecting Call */
- break;
- case 3: /* incomplete number */
- FsmDelTimer(&chanp->drel_timer, 61);
- chanp->d_st->lli.l4l3(chanp->d_st, CC_MORE_INFO | REQUEST, chanp->proc);
- break;
- case 0: /* OK, nobody likes this call */
- default: /* statcallb problems */
- chanp->d_st->lli.l4l3(chanp->d_st, CC_IGNORE | REQUEST, chanp->proc);
- chanp->cs->cardmsg(chanp->cs, MDL_INFO_REL, (void *) (long)chanp->chan);
- FsmChangeState(fi, ST_NULL);
- break;
+ case 1: /* OK, someone likes this call */
+ FsmDelTimer(&chanp->drel_timer, 61);
+ FsmChangeState(fi, ST_IN_ALERT_SENT);
+ chanp->d_st->lli.l4l3(chanp->d_st, CC_ALERTING | REQUEST, chanp->proc);
+ break;
+ case 5: /* direct redirect */
+ case 4: /* Proceeding desired */
+ FsmDelTimer(&chanp->drel_timer, 61);
+ FsmChangeState(fi, ST_IN_PROCEED_SEND);
+ chanp->d_st->lli.l4l3(chanp->d_st, CC_PROCEED_SEND | REQUEST, chanp->proc);
+ if (ret == 5) {
+ memcpy(&chanp->setup, &ic.parm.setup, sizeof(setup_parm));
+ chanp->d_st->lli.l4l3(chanp->d_st, CC_REDIR | REQUEST, chanp->proc);
+ }
+ break;
+ case 2: /* Rejecting Call */
+ break;
+ case 3: /* incomplete number */
+ FsmDelTimer(&chanp->drel_timer, 61);
+ chanp->d_st->lli.l4l3(chanp->d_st, CC_MORE_INFO | REQUEST, chanp->proc);
+ break;
+ case 0: /* OK, nobody likes this call */
+ default: /* statcallb problems */
+ chanp->d_st->lli.l4l3(chanp->d_st, CC_IGNORE | REQUEST, chanp->proc);
+ chanp->cs->cardmsg(chanp->cs, MDL_INFO_REL, (void *) (long)chanp->chan);
+ FsmChangeState(fi, ST_NULL);
+ break;
}
} else {
chanp->d_st->lli.l4l3(chanp->d_st, CC_IGNORE | REQUEST, chanp->proc);
@@ -487,7 +487,7 @@ lli_disconnect_req(struct FsmInst *fi, int event, void *arg)
if (chanp->proc)
chanp->proc->para.cause = 0x10; /* Normal Call Clearing */
chanp->d_st->lli.l4l3(chanp->d_st, CC_DISCONNECT | REQUEST,
- chanp->proc);
+ chanp->proc);
}
}
@@ -503,7 +503,7 @@ lli_disconnect_reject(struct FsmInst *fi, int event, void *arg)
if (chanp->proc)
chanp->proc->para.cause = 0x15; /* Call Rejected */
chanp->d_st->lli.l4l3(chanp->d_st, CC_DISCONNECT | REQUEST,
- chanp->proc);
+ chanp->proc);
}
}
@@ -579,7 +579,7 @@ static void
lli_bhup_disc(struct FsmInst *fi, int event, void *arg)
{
struct Channel *chanp = fi->userdata;
-
+
if (chanp->debug & 1)
link_debug(chanp, 0, "STAT_BHUP");
HL_LL(chanp, ISDN_STAT_BHUP);
@@ -639,7 +639,7 @@ lli_abort(struct FsmInst *fi, int event, void *arg)
chanp->b_st->lli.l4l3(chanp->b_st, DL_RELEASE | REQUEST, NULL);
lli_bhup_dhup(fi, event, arg);
}
-
+
static void
lli_release_req(struct FsmInst *fi, int event, void *arg)
{
@@ -650,7 +650,7 @@ lli_release_req(struct FsmInst *fi, int event, void *arg)
} else {
FsmChangeState(fi, ST_WAIT_D_REL_CNF);
chanp->d_st->lli.l4l3(chanp->d_st, CC_RELEASE | REQUEST,
- chanp->proc);
+ chanp->proc);
}
}
@@ -667,7 +667,7 @@ static void
lli_bhup_release_req(struct FsmInst *fi, int event, void *arg)
{
struct Channel *chanp = fi->userdata;
-
+
if (chanp->debug & 1)
link_debug(chanp, 0, "STAT_BHUP");
HL_LL(chanp, ISDN_STAT_BHUP);
@@ -698,7 +698,7 @@ lli_dchan_not_ready(struct FsmInst *fi, int event, void *arg)
if (chanp->debug & 1)
link_debug(chanp, 0, "STAT_DHUP");
- HL_LL(chanp, ISDN_STAT_DHUP);
+ HL_LL(chanp, ISDN_STAT_DHUP);
}
static void
@@ -709,7 +709,7 @@ lli_no_setup_rsp(struct FsmInst *fi, int event, void *arg)
if (chanp->debug & 1)
link_debug(chanp, 0, "STAT_DHUP");
HL_LL(chanp, ISDN_STAT_DHUP);
- lli_close(fi);
+ lli_close(fi);
}
static void
@@ -768,69 +768,69 @@ lli_failure_a(struct FsmInst *fi, int event, void *arg)
/* *INDENT-OFF* */
static struct FsmNode fnlist[] __initdata =
{
- {ST_NULL, EV_DIAL, lli_prep_dialout},
- {ST_NULL, EV_RESUME, lli_resume},
- {ST_NULL, EV_SETUP_IND, lli_deliver_call},
- {ST_NULL, EV_LEASED, lli_leased_in},
- {ST_OUT_DIAL, EV_SETUP_CNF, lli_init_bchan_out},
- {ST_OUT_DIAL, EV_HANGUP, lli_disconnect_req},
- {ST_OUT_DIAL, EV_DISCONNECT_IND, lli_release_req},
- {ST_OUT_DIAL, EV_RELEASE, lli_dhup_close},
- {ST_OUT_DIAL, EV_NOSETUP_RSP, lli_no_setup_rsp},
- {ST_OUT_DIAL, EV_SETUP_ERR, lli_error},
- {ST_IN_WAIT_LL, EV_LEASED_REL, lli_failure_l},
- {ST_IN_WAIT_LL, EV_ACCEPTD, lli_setup_rsp},
- {ST_IN_WAIT_LL, EV_HANGUP, lli_reject_req},
- {ST_IN_WAIT_LL, EV_DISCONNECT_IND, lli_release_req},
- {ST_IN_WAIT_LL, EV_RELEASE, lli_dhup_close},
- {ST_IN_WAIT_LL, EV_SETUP_IND, lli_deliver_call},
- {ST_IN_WAIT_LL, EV_SETUP_ERR, lli_error},
- {ST_IN_ALERT_SENT, EV_SETUP_CMPL_IND, lli_init_bchan_in},
- {ST_IN_ALERT_SENT, EV_ACCEPTD, lli_send_dconnect},
- {ST_IN_ALERT_SENT, EV_HANGUP, lli_disconnect_reject},
- {ST_IN_ALERT_SENT, EV_DISCONNECT_IND, lli_release_req},
- {ST_IN_ALERT_SENT, EV_RELEASE, lli_dhup_close},
+ {ST_NULL, EV_DIAL, lli_prep_dialout},
+ {ST_NULL, EV_RESUME, lli_resume},
+ {ST_NULL, EV_SETUP_IND, lli_deliver_call},
+ {ST_NULL, EV_LEASED, lli_leased_in},
+ {ST_OUT_DIAL, EV_SETUP_CNF, lli_init_bchan_out},
+ {ST_OUT_DIAL, EV_HANGUP, lli_disconnect_req},
+ {ST_OUT_DIAL, EV_DISCONNECT_IND, lli_release_req},
+ {ST_OUT_DIAL, EV_RELEASE, lli_dhup_close},
+ {ST_OUT_DIAL, EV_NOSETUP_RSP, lli_no_setup_rsp},
+ {ST_OUT_DIAL, EV_SETUP_ERR, lli_error},
+ {ST_IN_WAIT_LL, EV_LEASED_REL, lli_failure_l},
+ {ST_IN_WAIT_LL, EV_ACCEPTD, lli_setup_rsp},
+ {ST_IN_WAIT_LL, EV_HANGUP, lli_reject_req},
+ {ST_IN_WAIT_LL, EV_DISCONNECT_IND, lli_release_req},
+ {ST_IN_WAIT_LL, EV_RELEASE, lli_dhup_close},
+ {ST_IN_WAIT_LL, EV_SETUP_IND, lli_deliver_call},
+ {ST_IN_WAIT_LL, EV_SETUP_ERR, lli_error},
+ {ST_IN_ALERT_SENT, EV_SETUP_CMPL_IND, lli_init_bchan_in},
+ {ST_IN_ALERT_SENT, EV_ACCEPTD, lli_send_dconnect},
+ {ST_IN_ALERT_SENT, EV_HANGUP, lli_disconnect_reject},
+ {ST_IN_ALERT_SENT, EV_DISCONNECT_IND, lli_release_req},
+ {ST_IN_ALERT_SENT, EV_RELEASE, lli_dhup_close},
{ST_IN_ALERT_SENT, EV_REDIR, lli_send_redir},
{ST_IN_PROCEED_SEND, EV_REDIR, lli_send_redir},
{ST_IN_PROCEED_SEND, EV_ALERT, lli_send_alert},
{ST_IN_PROCEED_SEND, EV_ACCEPTD, lli_send_dconnect},
{ST_IN_PROCEED_SEND, EV_HANGUP, lli_disconnect_reject},
{ST_IN_PROCEED_SEND, EV_DISCONNECT_IND, lli_dhup_close},
- {ST_IN_ALERT_SENT, EV_RELEASE, lli_dhup_close},
- {ST_IN_WAIT_CONN_ACK, EV_SETUP_CMPL_IND, lli_init_bchan_in},
- {ST_IN_WAIT_CONN_ACK, EV_HANGUP, lli_disconnect_req},
- {ST_IN_WAIT_CONN_ACK, EV_DISCONNECT_IND, lli_release_req},
- {ST_IN_WAIT_CONN_ACK, EV_RELEASE, lli_dhup_close},
- {ST_IN_WAIT_CONN_ACK, EV_CONNECT_ERR, lli_error},
- {ST_WAIT_BCONN, EV_BC_EST, lli_go_active},
- {ST_WAIT_BCONN, EV_BC_REL, lli_rel_b_disc},
- {ST_WAIT_BCONN, EV_HANGUP, lli_rel_b_disc},
- {ST_WAIT_BCONN, EV_DISCONNECT_IND, lli_rel_b_release_req},
- {ST_WAIT_BCONN, EV_RELEASE, lli_rel_b_dhup},
- {ST_WAIT_BCONN, EV_LEASED_REL, lli_rel_b_fail},
- {ST_WAIT_BCONN, EV_CINF, lli_charge_info},
- {ST_ACTIVE, EV_CINF, lli_charge_info},
- {ST_ACTIVE, EV_BC_REL, lli_bhup_rel_b},
- {ST_ACTIVE, EV_SUSPEND, lli_suspend},
- {ST_ACTIVE, EV_HANGUP, lli_disconn_bchan},
- {ST_ACTIVE, EV_DISCONNECT_IND, lli_release_bchan},
- {ST_ACTIVE, EV_RELEASE, lli_abort},
- {ST_ACTIVE, EV_LEASED_REL, lli_failure_a},
- {ST_WAIT_BRELEASE, EV_BC_REL, lli_bhup_disc},
- {ST_WAIT_BRELEASE, EV_DISCONNECT_IND, lli_bhup_release_req},
- {ST_WAIT_BRELEASE, EV_RELEASE, lli_bhup_dhup},
- {ST_WAIT_BRELEASE, EV_LEASED_REL, lli_bhup_fail},
- {ST_WAIT_BREL_DISC, EV_BC_REL, lli_bhup_release_req},
- {ST_WAIT_BREL_DISC, EV_RELEASE, lli_bhup_dhup},
- {ST_WAIT_DCOMMAND, EV_HANGUP, lli_start_disc},
- {ST_WAIT_DCOMMAND, EV_DISCONNECT_IND, lli_release_req},
- {ST_WAIT_DCOMMAND, EV_RELEASE, lli_dhup_close},
- {ST_WAIT_DCOMMAND, EV_LEASED_REL, lli_failure_l},
- {ST_WAIT_DRELEASE, EV_RELEASE, lli_dhup_close},
- {ST_WAIT_DRELEASE, EV_DIAL, lli_dchan_not_ready},
- /* ETS 300-104 16.1 */
- {ST_WAIT_D_REL_CNF, EV_RELEASE, lli_dhup_close},
- {ST_WAIT_D_REL_CNF, EV_DIAL, lli_dchan_not_ready},
+ {ST_IN_ALERT_SENT, EV_RELEASE, lli_dhup_close},
+ {ST_IN_WAIT_CONN_ACK, EV_SETUP_CMPL_IND, lli_init_bchan_in},
+ {ST_IN_WAIT_CONN_ACK, EV_HANGUP, lli_disconnect_req},
+ {ST_IN_WAIT_CONN_ACK, EV_DISCONNECT_IND, lli_release_req},
+ {ST_IN_WAIT_CONN_ACK, EV_RELEASE, lli_dhup_close},
+ {ST_IN_WAIT_CONN_ACK, EV_CONNECT_ERR, lli_error},
+ {ST_WAIT_BCONN, EV_BC_EST, lli_go_active},
+ {ST_WAIT_BCONN, EV_BC_REL, lli_rel_b_disc},
+ {ST_WAIT_BCONN, EV_HANGUP, lli_rel_b_disc},
+ {ST_WAIT_BCONN, EV_DISCONNECT_IND, lli_rel_b_release_req},
+ {ST_WAIT_BCONN, EV_RELEASE, lli_rel_b_dhup},
+ {ST_WAIT_BCONN, EV_LEASED_REL, lli_rel_b_fail},
+ {ST_WAIT_BCONN, EV_CINF, lli_charge_info},
+ {ST_ACTIVE, EV_CINF, lli_charge_info},
+ {ST_ACTIVE, EV_BC_REL, lli_bhup_rel_b},
+ {ST_ACTIVE, EV_SUSPEND, lli_suspend},
+ {ST_ACTIVE, EV_HANGUP, lli_disconn_bchan},
+ {ST_ACTIVE, EV_DISCONNECT_IND, lli_release_bchan},
+ {ST_ACTIVE, EV_RELEASE, lli_abort},
+ {ST_ACTIVE, EV_LEASED_REL, lli_failure_a},
+ {ST_WAIT_BRELEASE, EV_BC_REL, lli_bhup_disc},
+ {ST_WAIT_BRELEASE, EV_DISCONNECT_IND, lli_bhup_release_req},
+ {ST_WAIT_BRELEASE, EV_RELEASE, lli_bhup_dhup},
+ {ST_WAIT_BRELEASE, EV_LEASED_REL, lli_bhup_fail},
+ {ST_WAIT_BREL_DISC, EV_BC_REL, lli_bhup_release_req},
+ {ST_WAIT_BREL_DISC, EV_RELEASE, lli_bhup_dhup},
+ {ST_WAIT_DCOMMAND, EV_HANGUP, lli_start_disc},
+ {ST_WAIT_DCOMMAND, EV_DISCONNECT_IND, lli_release_req},
+ {ST_WAIT_DCOMMAND, EV_RELEASE, lli_dhup_close},
+ {ST_WAIT_DCOMMAND, EV_LEASED_REL, lli_failure_l},
+ {ST_WAIT_DRELEASE, EV_RELEASE, lli_dhup_close},
+ {ST_WAIT_DRELEASE, EV_DIAL, lli_dchan_not_ready},
+ /* ETS 300-104 16.1 */
+ {ST_WAIT_D_REL_CNF, EV_RELEASE, lli_dhup_close},
+ {ST_WAIT_D_REL_CNF, EV_DIAL, lli_dchan_not_ready},
};
/* *INDENT-ON* */
@@ -855,21 +855,21 @@ release_b_st(struct Channel *chanp)
{
struct PStack *st = chanp->b_st;
- if(test_and_clear_bit(FLG_START_B, &chanp->Flags)) {
+ if (test_and_clear_bit(FLG_START_B, &chanp->Flags)) {
chanp->bcs->BC_Close(chanp->bcs);
switch (chanp->l2_active_protocol) {
- case (ISDN_PROTO_L2_X75I):
- releasestack_isdnl2(st);
- break;
- case (ISDN_PROTO_L2_HDLC):
- case (ISDN_PROTO_L2_HDLC_56K):
- case (ISDN_PROTO_L2_TRANS):
- case (ISDN_PROTO_L2_MODEM):
- case (ISDN_PROTO_L2_FAX):
- releasestack_transl2(st);
- break;
+ case (ISDN_PROTO_L2_X75I):
+ releasestack_isdnl2(st);
+ break;
+ case (ISDN_PROTO_L2_HDLC):
+ case (ISDN_PROTO_L2_HDLC_56K):
+ case (ISDN_PROTO_L2_TRANS):
+ case (ISDN_PROTO_L2_MODEM):
+ case (ISDN_PROTO_L2_FAX):
+ releasestack_transl2(st);
+ break;
}
- }
+ }
}
static struct Channel
@@ -880,9 +880,9 @@ static struct Channel
int i;
if (test_bit(FLG_TWO_DCHAN, &cs->HW_Flags))
- i=1;
+ i = 1;
else
- i=0;
+ i = 0;
if (!bch) {
i = 2; /* virtual channel */
@@ -912,10 +912,10 @@ static struct Channel
static void stat_redir_result(struct IsdnCardState *cs, int chan, ulong result)
{ isdn_ctrl ic;
-
+
ic.driver = cs->myid;
ic.command = ISDN_STAT_REDIR;
- ic.arg = chan;
+ ic.arg = chan;
ic.parm.num[0] = result;
cs->iif.statcallb(&ic);
} /* stat_redir_result */
@@ -927,7 +927,7 @@ dchan_l3l4(struct PStack *st, int pr, void *arg)
struct IsdnCardState *cs = st->l1.hardware;
struct Channel *chanp;
- if(!pc)
+ if (!pc)
return;
if (pr == (CC_SETUP | INDICATION)) {
@@ -945,63 +945,63 @@ dchan_l3l4(struct PStack *st, int pr, void *arg)
return;
switch (pr) {
- case (CC_MORE_INFO | INDICATION):
- FsmEvent(&chanp->fi, EV_SETUP_IND, NULL);
- break;
- case (CC_DISCONNECT | INDICATION):
- FsmEvent(&chanp->fi, EV_DISCONNECT_IND, NULL);
- break;
- case (CC_RELEASE | CONFIRM):
- FsmEvent(&chanp->fi, EV_RELEASE, NULL);
- break;
- case (CC_SUSPEND | CONFIRM):
- FsmEvent(&chanp->fi, EV_RELEASE, NULL);
- break;
- case (CC_RESUME | CONFIRM):
- FsmEvent(&chanp->fi, EV_SETUP_CNF, NULL);
- break;
- case (CC_RESUME_ERR):
- FsmEvent(&chanp->fi, EV_RELEASE, NULL);
- break;
- case (CC_RELEASE | INDICATION):
- FsmEvent(&chanp->fi, EV_RELEASE, NULL);
- break;
- case (CC_SETUP_COMPL | INDICATION):
- FsmEvent(&chanp->fi, EV_SETUP_CMPL_IND, NULL);
- break;
- case (CC_SETUP | CONFIRM):
- FsmEvent(&chanp->fi, EV_SETUP_CNF, NULL);
- break;
- case (CC_CHARGE | INDICATION):
- FsmEvent(&chanp->fi, EV_CINF, NULL);
- break;
- case (CC_NOSETUP_RSP):
- FsmEvent(&chanp->fi, EV_NOSETUP_RSP, NULL);
- break;
- case (CC_SETUP_ERR):
- FsmEvent(&chanp->fi, EV_SETUP_ERR, NULL);
- break;
- case (CC_CONNECT_ERR):
- FsmEvent(&chanp->fi, EV_CONNECT_ERR, NULL);
- break;
- case (CC_RELEASE_ERR):
- FsmEvent(&chanp->fi, EV_RELEASE, NULL);
- break;
- case (CC_PROCEED_SEND | INDICATION):
- case (CC_PROCEEDING | INDICATION):
- case (CC_ALERTING | INDICATION):
- case (CC_PROGRESS | INDICATION):
- case (CC_NOTIFY | INDICATION):
- break;
- case (CC_REDIR | INDICATION):
- stat_redir_result(cs, chanp->chan, pc->redir_result);
- break;
- default:
- if (chanp->debug & 0x800) {
- HiSax_putstatus(chanp->cs, "Ch",
+ case (CC_MORE_INFO | INDICATION):
+ FsmEvent(&chanp->fi, EV_SETUP_IND, NULL);
+ break;
+ case (CC_DISCONNECT | INDICATION):
+ FsmEvent(&chanp->fi, EV_DISCONNECT_IND, NULL);
+ break;
+ case (CC_RELEASE | CONFIRM):
+ FsmEvent(&chanp->fi, EV_RELEASE, NULL);
+ break;
+ case (CC_SUSPEND | CONFIRM):
+ FsmEvent(&chanp->fi, EV_RELEASE, NULL);
+ break;
+ case (CC_RESUME | CONFIRM):
+ FsmEvent(&chanp->fi, EV_SETUP_CNF, NULL);
+ break;
+ case (CC_RESUME_ERR):
+ FsmEvent(&chanp->fi, EV_RELEASE, NULL);
+ break;
+ case (CC_RELEASE | INDICATION):
+ FsmEvent(&chanp->fi, EV_RELEASE, NULL);
+ break;
+ case (CC_SETUP_COMPL | INDICATION):
+ FsmEvent(&chanp->fi, EV_SETUP_CMPL_IND, NULL);
+ break;
+ case (CC_SETUP | CONFIRM):
+ FsmEvent(&chanp->fi, EV_SETUP_CNF, NULL);
+ break;
+ case (CC_CHARGE | INDICATION):
+ FsmEvent(&chanp->fi, EV_CINF, NULL);
+ break;
+ case (CC_NOSETUP_RSP):
+ FsmEvent(&chanp->fi, EV_NOSETUP_RSP, NULL);
+ break;
+ case (CC_SETUP_ERR):
+ FsmEvent(&chanp->fi, EV_SETUP_ERR, NULL);
+ break;
+ case (CC_CONNECT_ERR):
+ FsmEvent(&chanp->fi, EV_CONNECT_ERR, NULL);
+ break;
+ case (CC_RELEASE_ERR):
+ FsmEvent(&chanp->fi, EV_RELEASE, NULL);
+ break;
+ case (CC_PROCEED_SEND | INDICATION):
+ case (CC_PROCEEDING | INDICATION):
+ case (CC_ALERTING | INDICATION):
+ case (CC_PROGRESS | INDICATION):
+ case (CC_NOTIFY | INDICATION):
+ break;
+ case (CC_REDIR | INDICATION):
+ stat_redir_result(cs, chanp->chan, pc->redir_result);
+ break;
+ default:
+ if (chanp->debug & 0x800) {
+ HiSax_putstatus(chanp->cs, "Ch",
"%d L3->L4 unknown primitiv %#x",
chanp->chan, pr);
- }
+ }
}
}
@@ -1069,7 +1069,7 @@ init_d_st(struct Channel *chanp)
}
static __printf(2, 3) void
-callc_debug(struct FsmInst *fi, char *fmt, ...)
+ callc_debug(struct FsmInst *fi, char *fmt, ...)
{
va_list args;
struct Channel *chanp = fi->userdata;
@@ -1129,8 +1129,8 @@ CallcNewChan(struct IsdnCardState *csta) {
return err;
printk(KERN_INFO "HiSax: 2 channels added\n");
- for (i = 0; i < MAX_WAITING_CALLS; i++) {
- err = init_chan(i+2,csta);
+ for (i = 0; i < MAX_WAITING_CALLS; i++) {
+ err = init_chan(i + 2, csta);
if (err)
return err;
}
@@ -1138,7 +1138,7 @@ CallcNewChan(struct IsdnCardState *csta) {
if (test_bit(FLG_PTP, &csta->channel->d_st->l2.flag)) {
printk(KERN_INFO "LAYER2 WATCHING ESTABLISH\n");
csta->channel->d_st->lli.l4l3(csta->channel->d_st,
- DL_ESTABLISH | REQUEST, NULL);
+ DL_ESTABLISH | REQUEST, NULL);
}
return (0);
}
@@ -1187,28 +1187,28 @@ lldata_handler(struct PStack *st, int pr, void *arg)
struct sk_buff *skb = arg;
switch (pr) {
- case (DL_DATA | INDICATION):
- if (chanp->data_open) {
- if (chanp->debug & 0x800)
- link_debug(chanp, 0, "lldata: %d", skb->len);
- chanp->cs->iif.rcvcallb_skb(chanp->cs->myid, chanp->chan, skb);
- } else {
- link_debug(chanp, 0, "lldata: channel not open");
- dev_kfree_skb(skb);
- }
- break;
- case (DL_ESTABLISH | INDICATION):
- case (DL_ESTABLISH | CONFIRM):
- FsmEvent(&chanp->fi, EV_BC_EST, NULL);
- break;
- case (DL_RELEASE | INDICATION):
- case (DL_RELEASE | CONFIRM):
- FsmEvent(&chanp->fi, EV_BC_REL, NULL);
- break;
- default:
- printk(KERN_WARNING "lldata_handler unknown primitive %#x\n",
- pr);
- break;
+ case (DL_DATA | INDICATION):
+ if (chanp->data_open) {
+ if (chanp->debug & 0x800)
+ link_debug(chanp, 0, "lldata: %d", skb->len);
+ chanp->cs->iif.rcvcallb_skb(chanp->cs->myid, chanp->chan, skb);
+ } else {
+ link_debug(chanp, 0, "lldata: channel not open");
+ dev_kfree_skb(skb);
+ }
+ break;
+ case (DL_ESTABLISH | INDICATION):
+ case (DL_ESTABLISH | CONFIRM):
+ FsmEvent(&chanp->fi, EV_BC_EST, NULL);
+ break;
+ case (DL_RELEASE | INDICATION):
+ case (DL_RELEASE | CONFIRM):
+ FsmEvent(&chanp->fi, EV_BC_REL, NULL);
+ break;
+ default:
+ printk(KERN_WARNING "lldata_handler unknown primitive %#x\n",
+ pr);
+ break;
}
}
@@ -1219,28 +1219,28 @@ lltrans_handler(struct PStack *st, int pr, void *arg)
struct sk_buff *skb = arg;
switch (pr) {
- case (PH_DATA | INDICATION):
- if (chanp->data_open) {
- if (chanp->debug & 0x800)
- link_debug(chanp, 0, "lltrans: %d", skb->len);
- chanp->cs->iif.rcvcallb_skb(chanp->cs->myid, chanp->chan, skb);
- } else {
- link_debug(chanp, 0, "lltrans: channel not open");
- dev_kfree_skb(skb);
- }
- break;
- case (PH_ACTIVATE | INDICATION):
- case (PH_ACTIVATE | CONFIRM):
- FsmEvent(&chanp->fi, EV_BC_EST, NULL);
- break;
- case (PH_DEACTIVATE | INDICATION):
- case (PH_DEACTIVATE | CONFIRM):
- FsmEvent(&chanp->fi, EV_BC_REL, NULL);
- break;
- default:
- printk(KERN_WARNING "lltrans_handler unknown primitive %#x\n",
- pr);
- break;
+ case (PH_DATA | INDICATION):
+ if (chanp->data_open) {
+ if (chanp->debug & 0x800)
+ link_debug(chanp, 0, "lltrans: %d", skb->len);
+ chanp->cs->iif.rcvcallb_skb(chanp->cs->myid, chanp->chan, skb);
+ } else {
+ link_debug(chanp, 0, "lltrans: channel not open");
+ dev_kfree_skb(skb);
+ }
+ break;
+ case (PH_ACTIVATE | INDICATION):
+ case (PH_ACTIVATE | CONFIRM):
+ FsmEvent(&chanp->fi, EV_BC_EST, NULL);
+ break;
+ case (PH_DEACTIVATE | INDICATION):
+ case (PH_DEACTIVATE | CONFIRM):
+ FsmEvent(&chanp->fi, EV_BC_REL, NULL);
+ break;
+ default:
+ printk(KERN_WARNING "lltrans_handler unknown primitive %#x\n",
+ pr);
+ break;
}
}
@@ -1272,22 +1272,22 @@ init_b_st(struct Channel *chanp, int incoming)
else
st->l1.bc = chanp->proc->para.bchannel - 1;
switch (chanp->l2_active_protocol) {
- case (ISDN_PROTO_L2_X75I):
- case (ISDN_PROTO_L2_HDLC):
- st->l1.mode = L1_MODE_HDLC;
- break;
- case (ISDN_PROTO_L2_HDLC_56K):
- st->l1.mode = L1_MODE_HDLC_56K;
- break;
- case (ISDN_PROTO_L2_TRANS):
- st->l1.mode = L1_MODE_TRANS;
- break;
- case (ISDN_PROTO_L2_MODEM):
- st->l1.mode = L1_MODE_V32;
- break;
- case (ISDN_PROTO_L2_FAX):
- st->l1.mode = L1_MODE_FAX;
- break;
+ case (ISDN_PROTO_L2_X75I):
+ case (ISDN_PROTO_L2_HDLC):
+ st->l1.mode = L1_MODE_HDLC;
+ break;
+ case (ISDN_PROTO_L2_HDLC_56K):
+ st->l1.mode = L1_MODE_HDLC_56K;
+ break;
+ case (ISDN_PROTO_L2_TRANS):
+ st->l1.mode = L1_MODE_TRANS;
+ break;
+ case (ISDN_PROTO_L2_MODEM):
+ st->l1.mode = L1_MODE_V32;
+ break;
+ case (ISDN_PROTO_L2_FAX):
+ st->l1.mode = L1_MODE_FAX;
+ break;
}
chanp->bcs->conmsg = NULL;
if (chanp->bcs->BC_SetStack(st, chanp->bcs))
@@ -1303,29 +1303,29 @@ init_b_st(struct Channel *chanp, int incoming)
st->l2.T203 = 5000; /* 5000 milliseconds */
st->l3.debug = 0;
switch (chanp->l2_active_protocol) {
- case (ISDN_PROTO_L2_X75I):
- sprintf(tmp, "Ch%d X.75", chanp->chan);
- setstack_isdnl2(st, tmp);
- setstack_l3bc(st, chanp);
- st->l2.l2l3 = lldata_handler;
- st->lli.userdata = chanp;
- test_and_clear_bit(FLG_LLI_L1WAKEUP, &st->lli.flag);
- test_and_set_bit(FLG_LLI_L2WAKEUP, &st->lli.flag);
- st->l2.l2m.debug = chanp->debug & 16;
- st->l2.debug = chanp->debug & 64;
- break;
- case (ISDN_PROTO_L2_HDLC):
- case (ISDN_PROTO_L2_HDLC_56K):
- case (ISDN_PROTO_L2_TRANS):
- case (ISDN_PROTO_L2_MODEM):
- case (ISDN_PROTO_L2_FAX):
- st->l1.l1l2 = lltrans_handler;
- st->lli.userdata = chanp;
- test_and_set_bit(FLG_LLI_L1WAKEUP, &st->lli.flag);
- test_and_clear_bit(FLG_LLI_L2WAKEUP, &st->lli.flag);
- setstack_transl2(st);
- setstack_l3bc(st, chanp);
- break;
+ case (ISDN_PROTO_L2_X75I):
+ sprintf(tmp, "Ch%d X.75", chanp->chan);
+ setstack_isdnl2(st, tmp);
+ setstack_l3bc(st, chanp);
+ st->l2.l2l3 = lldata_handler;
+ st->lli.userdata = chanp;
+ test_and_clear_bit(FLG_LLI_L1WAKEUP, &st->lli.flag);
+ test_and_set_bit(FLG_LLI_L2WAKEUP, &st->lli.flag);
+ st->l2.l2m.debug = chanp->debug & 16;
+ st->l2.debug = chanp->debug & 64;
+ break;
+ case (ISDN_PROTO_L2_HDLC):
+ case (ISDN_PROTO_L2_HDLC_56K):
+ case (ISDN_PROTO_L2_TRANS):
+ case (ISDN_PROTO_L2_MODEM):
+ case (ISDN_PROTO_L2_FAX):
+ st->l1.l1l2 = lltrans_handler;
+ st->lli.userdata = chanp;
+ test_and_set_bit(FLG_LLI_L1WAKEUP, &st->lli.flag);
+ test_and_clear_bit(FLG_LLI_L2WAKEUP, &st->lli.flag);
+ setstack_transl2(st);
+ setstack_l3bc(st, chanp);
+ break;
}
test_and_set_bit(FLG_START_B, &chanp->Flags);
return (0);
@@ -1338,19 +1338,19 @@ leased_l4l3(struct PStack *st, int pr, void *arg)
struct sk_buff *skb = arg;
switch (pr) {
- case (DL_DATA | REQUEST):
- link_debug(chanp, 0, "leased line d-channel DATA");
- dev_kfree_skb(skb);
- break;
- case (DL_ESTABLISH | REQUEST):
- st->l2.l2l1(st, PH_ACTIVATE | REQUEST, NULL);
- break;
- case (DL_RELEASE | REQUEST):
- break;
- default:
- printk(KERN_WARNING "transd_l4l3 unknown primitive %#x\n",
- pr);
- break;
+ case (DL_DATA | REQUEST):
+ link_debug(chanp, 0, "leased line d-channel DATA");
+ dev_kfree_skb(skb);
+ break;
+ case (DL_ESTABLISH | REQUEST):
+ st->l2.l2l1(st, PH_ACTIVATE | REQUEST, NULL);
+ break;
+ case (DL_RELEASE | REQUEST):
+ break;
+ default:
+ printk(KERN_WARNING "transd_l4l3 unknown primitive %#x\n",
+ pr);
+ break;
}
}
@@ -1359,32 +1359,32 @@ leased_l1l2(struct PStack *st, int pr, void *arg)
{
struct Channel *chanp = (struct Channel *) st->lli.userdata;
struct sk_buff *skb = arg;
- int i,event = EV_LEASED_REL;
+ int i, event = EV_LEASED_REL;
switch (pr) {
- case (PH_DATA | INDICATION):
- link_debug(chanp, 0, "leased line d-channel DATA");
- dev_kfree_skb(skb);
- break;
- case (PH_ACTIVATE | INDICATION):
- case (PH_ACTIVATE | CONFIRM):
- event = EV_LEASED;
- case (PH_DEACTIVATE | INDICATION):
- case (PH_DEACTIVATE | CONFIRM):
- if (test_bit(FLG_TWO_DCHAN, &chanp->cs->HW_Flags))
- i = 1;
- else
- i = 0;
- while (i < 2) {
- FsmEvent(&chanp->fi, event, NULL);
- chanp++;
- i++;
- }
- break;
- default:
- printk(KERN_WARNING
- "transd_l1l2 unknown primitive %#x\n", pr);
- break;
+ case (PH_DATA | INDICATION):
+ link_debug(chanp, 0, "leased line d-channel DATA");
+ dev_kfree_skb(skb);
+ break;
+ case (PH_ACTIVATE | INDICATION):
+ case (PH_ACTIVATE | CONFIRM):
+ event = EV_LEASED;
+ case (PH_DEACTIVATE | INDICATION):
+ case (PH_DEACTIVATE | CONFIRM):
+ if (test_bit(FLG_TWO_DCHAN, &chanp->cs->HW_Flags))
+ i = 1;
+ else
+ i = 0;
+ while (i < 2) {
+ FsmEvent(&chanp->fi, event, NULL);
+ chanp++;
+ i++;
+ }
+ break;
+ default:
+ printk(KERN_WARNING
+ "transd_l1l2 unknown primitive %#x\n", pr);
+ break;
}
}
@@ -1394,7 +1394,7 @@ distr_debug(struct IsdnCardState *csta, int debugflags)
int i;
struct Channel *chanp = csta->channel;
- for (i = 0; i < (2 + MAX_WAITING_CALLS) ; i++) {
+ for (i = 0; i < (2 + MAX_WAITING_CALLS); i++) {
chanp[i].debug = debugflags;
chanp[i].fi.debug = debugflags & 2;
chanp[i].d_st->l2.l2m.debug = debugflags & 8;
@@ -1421,9 +1421,9 @@ capi_debug(struct Channel *chanp, capi_msg *cm)
{
char *t = tmpbuf;
- t += QuickHex(t, (u_char *)cm, (cm->Length>50)? 50: cm->Length);
+ t += QuickHex(t, (u_char *)cm, (cm->Length > 50) ? 50 : cm->Length);
t--;
- *t= 0;
+ *t = 0;
HiSax_putstatus(chanp->cs, "Ch", "%d CAPIMSG %s", chanp->chan, tmpbuf);
}
@@ -1431,31 +1431,31 @@ static void
lli_got_fac_req(struct Channel *chanp, capi_msg *cm) {
if ((cm->para[0] != 3) || (cm->para[1] != 0))
return;
- if (cm->para[2]<3)
+ if (cm->para[2] < 3)
return;
if (cm->para[4] != 0)
return;
- switch(cm->para[3]) {
- case 4: /* Suspend */
- strncpy(chanp->setup.phone, &cm->para[5], cm->para[5] +1);
- FsmEvent(&chanp->fi, EV_SUSPEND, cm);
- break;
- case 5: /* Resume */
- strncpy(chanp->setup.phone, &cm->para[5], cm->para[5] +1);
- if (chanp->fi.state == ST_NULL) {
- FsmEvent(&chanp->fi, EV_RESUME, cm);
- } else {
- FsmDelTimer(&chanp->dial_timer, 72);
- FsmAddTimer(&chanp->dial_timer, 80, EV_RESUME, cm, 73);
- }
- break;
+ switch (cm->para[3]) {
+ case 4: /* Suspend */
+ strncpy(chanp->setup.phone, &cm->para[5], cm->para[5] + 1);
+ FsmEvent(&chanp->fi, EV_SUSPEND, cm);
+ break;
+ case 5: /* Resume */
+ strncpy(chanp->setup.phone, &cm->para[5], cm->para[5] + 1);
+ if (chanp->fi.state == ST_NULL) {
+ FsmEvent(&chanp->fi, EV_RESUME, cm);
+ } else {
+ FsmDelTimer(&chanp->dial_timer, 72);
+ FsmAddTimer(&chanp->dial_timer, 80, EV_RESUME, cm, 73);
+ }
+ break;
}
}
static void
lli_got_manufacturer(struct Channel *chanp, struct IsdnCardState *cs, capi_msg *cm) {
if ((cs->typ == ISDN_CTYPE_ELSA) || (cs->typ == ISDN_CTYPE_ELSA_PNP) ||
- (cs->typ == ISDN_CTYPE_ELSA_PCI)) {
+ (cs->typ == ISDN_CTYPE_ELSA_PCI)) {
if (cs->hw.elsa.MFlag) {
cs->cardmsg(cs, CARD_AUX_IND, cm->para);
}
@@ -1466,14 +1466,14 @@ lli_got_manufacturer(struct Channel *chanp, struct IsdnCardState *cs, capi_msg *
/***************************************************************/
/* Limit the available number of channels for the current card */
/***************************************************************/
-static int
+static int
set_channel_limit(struct IsdnCardState *cs, int chanmax)
{
isdn_ctrl ic;
int i, ii;
if ((chanmax < 0) || (chanmax > 2))
- return(-EINVAL);
+ return (-EINVAL);
cs->chanlimit = 0;
for (ii = 0; ii < 2; ii++) {
ic.driver = cs->myid;
@@ -1483,16 +1483,16 @@ set_channel_limit(struct IsdnCardState *cs, int chanmax)
ic.parm.num[0] = 0; /* disabled */
else
ic.parm.num[0] = 1; /* enabled */
- i = cs->iif.statcallb(&ic);
- if (i) return(-EINVAL);
- if (ii < chanmax)
+ i = cs->iif.statcallb(&ic);
+ if (i) return (-EINVAL);
+ if (ii < chanmax)
cs->chanlimit++;
}
- return(0);
+ return (0);
} /* set_channel_limit */
int
-HiSax_command(isdn_ctrl * ic)
+HiSax_command(isdn_ctrl *ic)
{
struct IsdnCardState *csta = hisax_findcard(ic->driver);
struct PStack *st;
@@ -1502,236 +1502,236 @@ HiSax_command(isdn_ctrl * ic)
if (!csta) {
printk(KERN_ERR
- "HiSax: if_command %d called with invalid driverId %d!\n",
- ic->command, ic->driver);
+ "HiSax: if_command %d called with invalid driverId %d!\n",
+ ic->command, ic->driver);
return -ENODEV;
}
switch (ic->command) {
- case (ISDN_CMD_SETEAZ):
- chanp = csta->channel + ic->arg;
+ case (ISDN_CMD_SETEAZ):
+ chanp = csta->channel + ic->arg;
+ break;
+ case (ISDN_CMD_SETL2):
+ chanp = csta->channel + (ic->arg & 0xff);
+ if (chanp->debug & 1)
+ link_debug(chanp, 1, "SETL2 card %d %ld",
+ csta->cardnr + 1, ic->arg >> 8);
+ chanp->l2_protocol = ic->arg >> 8;
+ break;
+ case (ISDN_CMD_SETL3):
+ chanp = csta->channel + (ic->arg & 0xff);
+ if (chanp->debug & 1)
+ link_debug(chanp, 1, "SETL3 card %d %ld",
+ csta->cardnr + 1, ic->arg >> 8);
+ chanp->l3_protocol = ic->arg >> 8;
+ break;
+ case (ISDN_CMD_DIAL):
+ chanp = csta->channel + (ic->arg & 0xff);
+ if (chanp->debug & 1)
+ link_debug(chanp, 1, "DIAL %s -> %s (%d,%d)",
+ ic->parm.setup.eazmsn, ic->parm.setup.phone,
+ ic->parm.setup.si1, ic->parm.setup.si2);
+ memcpy(&chanp->setup, &ic->parm.setup, sizeof(setup_parm));
+ if (!strcmp(chanp->setup.eazmsn, "0"))
+ chanp->setup.eazmsn[0] = '\0';
+ /* this solution is dirty and may be change, if
+ * we make a callreference based callmanager */
+ if (chanp->fi.state == ST_NULL) {
+ FsmEvent(&chanp->fi, EV_DIAL, NULL);
+ } else {
+ FsmDelTimer(&chanp->dial_timer, 70);
+ FsmAddTimer(&chanp->dial_timer, 50, EV_DIAL, NULL, 71);
+ }
+ break;
+ case (ISDN_CMD_ACCEPTB):
+ chanp = csta->channel + ic->arg;
+ if (chanp->debug & 1)
+ link_debug(chanp, 1, "ACCEPTB");
+ FsmEvent(&chanp->fi, EV_ACCEPTB, NULL);
+ break;
+ case (ISDN_CMD_ACCEPTD):
+ chanp = csta->channel + ic->arg;
+ memcpy(&chanp->setup, &ic->parm.setup, sizeof(setup_parm));
+ if (chanp->debug & 1)
+ link_debug(chanp, 1, "ACCEPTD");
+ FsmEvent(&chanp->fi, EV_ACCEPTD, NULL);
+ break;
+ case (ISDN_CMD_HANGUP):
+ chanp = csta->channel + ic->arg;
+ if (chanp->debug & 1)
+ link_debug(chanp, 1, "HANGUP");
+ FsmEvent(&chanp->fi, EV_HANGUP, NULL);
+ break;
+ case (CAPI_PUT_MESSAGE):
+ chanp = csta->channel + ic->arg;
+ if (chanp->debug & 1)
+ capi_debug(chanp, &ic->parm.cmsg);
+ if (ic->parm.cmsg.Length < 8)
break;
- case (ISDN_CMD_SETL2):
- chanp = csta->channel + (ic->arg & 0xff);
- if (chanp->debug & 1)
- link_debug(chanp, 1, "SETL2 card %d %ld",
- csta->cardnr + 1, ic->arg >> 8);
- chanp->l2_protocol = ic->arg >> 8;
+ switch (ic->parm.cmsg.Command) {
+ case CAPI_FACILITY:
+ if (ic->parm.cmsg.Subcommand == CAPI_REQ)
+ lli_got_fac_req(chanp, &ic->parm.cmsg);
break;
- case (ISDN_CMD_SETL3):
- chanp = csta->channel + (ic->arg & 0xff);
- if (chanp->debug & 1)
- link_debug(chanp, 1, "SETL3 card %d %ld",
- csta->cardnr + 1, ic->arg >> 8);
- chanp->l3_protocol = ic->arg >> 8;
+ case CAPI_MANUFACTURER:
+ if (ic->parm.cmsg.Subcommand == CAPI_REQ)
+ lli_got_manufacturer(chanp, csta, &ic->parm.cmsg);
break;
- case (ISDN_CMD_DIAL):
- chanp = csta->channel + (ic->arg & 0xff);
- if (chanp->debug & 1)
- link_debug(chanp, 1, "DIAL %s -> %s (%d,%d)",
- ic->parm.setup.eazmsn, ic->parm.setup.phone,
- ic->parm.setup.si1, ic->parm.setup.si2);
- memcpy(&chanp->setup, &ic->parm.setup, sizeof(setup_parm));
- if (!strcmp(chanp->setup.eazmsn, "0"))
- chanp->setup.eazmsn[0] = '\0';
- /* this solution is dirty and may be change, if
- * we make a callreference based callmanager */
- if (chanp->fi.state == ST_NULL) {
- FsmEvent(&chanp->fi, EV_DIAL, NULL);
- } else {
- FsmDelTimer(&chanp->dial_timer, 70);
- FsmAddTimer(&chanp->dial_timer, 50, EV_DIAL, NULL, 71);
- }
+ default:
break;
- case (ISDN_CMD_ACCEPTB):
- chanp = csta->channel + ic->arg;
- if (chanp->debug & 1)
- link_debug(chanp, 1, "ACCEPTB");
- FsmEvent(&chanp->fi, EV_ACCEPTB, NULL);
+ }
+ break;
+ case (ISDN_CMD_IOCTL):
+ switch (ic->arg) {
+ case (0):
+ num = *(unsigned int *) ic->parm.num;
+ HiSax_reportcard(csta->cardnr, num);
break;
- case (ISDN_CMD_ACCEPTD):
- chanp = csta->channel + ic->arg;
- memcpy(&chanp->setup, &ic->parm.setup, sizeof(setup_parm));
- if (chanp->debug & 1)
- link_debug(chanp, 1, "ACCEPTD");
- FsmEvent(&chanp->fi, EV_ACCEPTD, NULL);
+ case (1):
+ num = *(unsigned int *) ic->parm.num;
+ distr_debug(csta, num);
+ printk(KERN_DEBUG "HiSax: debugging flags card %d set to %x\n",
+ csta->cardnr + 1, num);
+ HiSax_putstatus(csta, "debugging flags ",
+ "card %d set to %x", csta->cardnr + 1, num);
break;
- case (ISDN_CMD_HANGUP):
- chanp = csta->channel + ic->arg;
- if (chanp->debug & 1)
- link_debug(chanp, 1, "HANGUP");
- FsmEvent(&chanp->fi, EV_HANGUP, NULL);
+ case (2):
+ num = *(unsigned int *) ic->parm.num;
+ csta->channel[0].b_st->l1.delay = num;
+ csta->channel[1].b_st->l1.delay = num;
+ HiSax_putstatus(csta, "delay ", "card %d set to %d ms",
+ csta->cardnr + 1, num);
+ printk(KERN_DEBUG "HiSax: delay card %d set to %d ms\n",
+ csta->cardnr + 1, num);
break;
- case (CAPI_PUT_MESSAGE):
- chanp = csta->channel + ic->arg;
- if (chanp->debug & 1)
- capi_debug(chanp, &ic->parm.cmsg);
- if (ic->parm.cmsg.Length < 8)
- break;
- switch(ic->parm.cmsg.Command) {
- case CAPI_FACILITY:
- if (ic->parm.cmsg.Subcommand == CAPI_REQ)
- lli_got_fac_req(chanp, &ic->parm.cmsg);
- break;
- case CAPI_MANUFACTURER:
- if (ic->parm.cmsg.Subcommand == CAPI_REQ)
- lli_got_manufacturer(chanp, csta, &ic->parm.cmsg);
- break;
- default:
- break;
+ case (5): /* set card in leased mode */
+ num = *(unsigned int *) ic->parm.num;
+ if ((num < 1) || (num > 2)) {
+ HiSax_putstatus(csta, "Set LEASED ",
+ "wrong channel %d", num);
+ printk(KERN_WARNING "HiSax: Set LEASED wrong channel %d\n",
+ num);
+ } else {
+ num--;
+ chanp = csta->channel + num;
+ chanp->leased = 1;
+ HiSax_putstatus(csta, "Card",
+ "%d channel %d set leased mode\n",
+ csta->cardnr + 1, num + 1);
+ chanp->d_st->l1.l1l2 = leased_l1l2;
+ chanp->d_st->lli.l4l3 = leased_l4l3;
+ chanp->d_st->lli.l4l3(chanp->d_st,
+ DL_ESTABLISH | REQUEST, NULL);
}
break;
- case (ISDN_CMD_IOCTL):
- switch (ic->arg) {
- case (0):
- num = *(unsigned int *) ic->parm.num;
- HiSax_reportcard(csta->cardnr, num);
- break;
- case (1):
- num = *(unsigned int *) ic->parm.num;
- distr_debug(csta, num);
- printk(KERN_DEBUG "HiSax: debugging flags card %d set to %x\n",
- csta->cardnr + 1, num);
- HiSax_putstatus(csta, "debugging flags ",
- "card %d set to %x", csta->cardnr + 1, num);
- break;
- case (2):
- num = *(unsigned int *) ic->parm.num;
- csta->channel[0].b_st->l1.delay = num;
- csta->channel[1].b_st->l1.delay = num;
- HiSax_putstatus(csta, "delay ", "card %d set to %d ms",
- csta->cardnr + 1, num);
- printk(KERN_DEBUG "HiSax: delay card %d set to %d ms\n",
- csta->cardnr + 1, num);
- break;
- case (5): /* set card in leased mode */
- num = *(unsigned int *) ic->parm.num;
- if ((num <1) || (num > 2)) {
- HiSax_putstatus(csta, "Set LEASED ",
- "wrong channel %d", num);
- printk(KERN_WARNING "HiSax: Set LEASED wrong channel %d\n",
- num);
- } else {
- num--;
- chanp = csta->channel +num;
- chanp->leased = 1;
- HiSax_putstatus(csta, "Card",
- "%d channel %d set leased mode\n",
- csta->cardnr + 1, num + 1);
- chanp->d_st->l1.l1l2 = leased_l1l2;
- chanp->d_st->lli.l4l3 = leased_l4l3;
- chanp->d_st->lli.l4l3(chanp->d_st,
- DL_ESTABLISH | REQUEST, NULL);
- }
- break;
- case (6): /* set B-channel test loop */
- num = *(unsigned int *) ic->parm.num;
- if (csta->stlist)
- csta->stlist->l2.l2l1(csta->stlist,
- PH_TESTLOOP | REQUEST, (void *) (long)num);
- break;
- case (7): /* set card in PTP mode */
- num = *(unsigned int *) ic->parm.num;
- if (test_bit(FLG_TWO_DCHAN, &csta->HW_Flags)) {
- printk(KERN_ERR "HiSax PTP mode only with one TEI possible\n");
- } else if (num) {
- test_and_set_bit(FLG_PTP, &csta->channel[0].d_st->l2.flag);
- test_and_set_bit(FLG_FIXED_TEI, &csta->channel[0].d_st->l2.flag);
- csta->channel[0].d_st->l2.tei = 0;
- HiSax_putstatus(csta, "set card ", "in PTP mode");
- printk(KERN_DEBUG "HiSax: set card in PTP mode\n");
- printk(KERN_INFO "LAYER2 WATCHING ESTABLISH\n");
- csta->channel[0].d_st->lli.l4l3(csta->channel[0].d_st,
- DL_ESTABLISH | REQUEST, NULL);
- } else {
- test_and_clear_bit(FLG_PTP, &csta->channel[0].d_st->l2.flag);
- test_and_clear_bit(FLG_FIXED_TEI, &csta->channel[0].d_st->l2.flag);
- HiSax_putstatus(csta, "set card ", "in PTMP mode");
- printk(KERN_DEBUG "HiSax: set card in PTMP mode\n");
- }
- break;
- case (8): /* set card in FIXED TEI mode */
- num = *(unsigned int *) ic->parm.num;
- chanp = csta->channel + (num & 1);
- num = num >>1;
- if (num == 127) {
- test_and_clear_bit(FLG_FIXED_TEI, &chanp->d_st->l2.flag);
- chanp->d_st->l2.tei = -1;
- HiSax_putstatus(csta, "set card ", "in VAR TEI mode");
- printk(KERN_DEBUG "HiSax: set card in VAR TEI mode\n");
- } else {
- test_and_set_bit(FLG_FIXED_TEI, &chanp->d_st->l2.flag);
- chanp->d_st->l2.tei = num;
- HiSax_putstatus(csta, "set card ", "in FIXED TEI (%d) mode", num);
- printk(KERN_DEBUG "HiSax: set card in FIXED TEI (%d) mode\n",
- num);
- }
- chanp->d_st->lli.l4l3(chanp->d_st,
- DL_ESTABLISH | REQUEST, NULL);
- break;
- case (11):
- num = csta->debug & DEB_DLOG_HEX;
- csta->debug = *(unsigned int *) ic->parm.num;
- csta->debug |= num;
- HiSax_putstatus(cards[0].cs, "l1 debugging ",
- "flags card %d set to %x",
- csta->cardnr + 1, csta->debug);
- printk(KERN_DEBUG "HiSax: l1 debugging flags card %d set to %x\n",
- csta->cardnr + 1, csta->debug);
- break;
- case (13):
- csta->channel[0].d_st->l3.debug = *(unsigned int *) ic->parm.num;
- csta->channel[1].d_st->l3.debug = *(unsigned int *) ic->parm.num;
- HiSax_putstatus(cards[0].cs, "l3 debugging ",
- "flags card %d set to %x\n", csta->cardnr + 1,
- *(unsigned int *) ic->parm.num);
- printk(KERN_DEBUG "HiSax: l3 debugging flags card %d set to %x\n",
- csta->cardnr + 1, *(unsigned int *) ic->parm.num);
- break;
- case (10):
- i = *(unsigned int *) ic->parm.num;
- return(set_channel_limit(csta, i));
- default:
- if (csta->auxcmd)
- return(csta->auxcmd(csta, ic));
- printk(KERN_DEBUG "HiSax: invalid ioclt %d\n",
- (int) ic->arg);
- return (-EINVAL);
- }
+ case (6): /* set B-channel test loop */
+ num = *(unsigned int *) ic->parm.num;
+ if (csta->stlist)
+ csta->stlist->l2.l2l1(csta->stlist,
+ PH_TESTLOOP | REQUEST, (void *) (long)num);
break;
-
- case (ISDN_CMD_PROCEED):
- chanp = csta->channel + ic->arg;
- if (chanp->debug & 1)
- link_debug(chanp, 1, "PROCEED");
- FsmEvent(&chanp->fi, EV_PROCEED, NULL);
+ case (7): /* set card in PTP mode */
+ num = *(unsigned int *) ic->parm.num;
+ if (test_bit(FLG_TWO_DCHAN, &csta->HW_Flags)) {
+ printk(KERN_ERR "HiSax PTP mode only with one TEI possible\n");
+ } else if (num) {
+ test_and_set_bit(FLG_PTP, &csta->channel[0].d_st->l2.flag);
+ test_and_set_bit(FLG_FIXED_TEI, &csta->channel[0].d_st->l2.flag);
+ csta->channel[0].d_st->l2.tei = 0;
+ HiSax_putstatus(csta, "set card ", "in PTP mode");
+ printk(KERN_DEBUG "HiSax: set card in PTP mode\n");
+ printk(KERN_INFO "LAYER2 WATCHING ESTABLISH\n");
+ csta->channel[0].d_st->lli.l4l3(csta->channel[0].d_st,
+ DL_ESTABLISH | REQUEST, NULL);
+ } else {
+ test_and_clear_bit(FLG_PTP, &csta->channel[0].d_st->l2.flag);
+ test_and_clear_bit(FLG_FIXED_TEI, &csta->channel[0].d_st->l2.flag);
+ HiSax_putstatus(csta, "set card ", "in PTMP mode");
+ printk(KERN_DEBUG "HiSax: set card in PTMP mode\n");
+ }
break;
-
- case (ISDN_CMD_ALERT):
- chanp = csta->channel + ic->arg;
- if (chanp->debug & 1)
- link_debug(chanp, 1, "ALERT");
- FsmEvent(&chanp->fi, EV_ALERT, NULL);
+ case (8): /* set card in FIXED TEI mode */
+ num = *(unsigned int *)ic->parm.num;
+ chanp = csta->channel + (num & 1);
+ num = num >> 1;
+ if (num == 127) {
+ test_and_clear_bit(FLG_FIXED_TEI, &chanp->d_st->l2.flag);
+ chanp->d_st->l2.tei = -1;
+ HiSax_putstatus(csta, "set card ", "in VAR TEI mode");
+ printk(KERN_DEBUG "HiSax: set card in VAR TEI mode\n");
+ } else {
+ test_and_set_bit(FLG_FIXED_TEI, &chanp->d_st->l2.flag);
+ chanp->d_st->l2.tei = num;
+ HiSax_putstatus(csta, "set card ", "in FIXED TEI (%d) mode", num);
+ printk(KERN_DEBUG "HiSax: set card in FIXED TEI (%d) mode\n",
+ num);
+ }
+ chanp->d_st->lli.l4l3(chanp->d_st,
+ DL_ESTABLISH | REQUEST, NULL);
break;
-
- case (ISDN_CMD_REDIR):
- chanp = csta->channel + ic->arg;
- if (chanp->debug & 1)
- link_debug(chanp, 1, "REDIR");
- memcpy(&chanp->setup, &ic->parm.setup, sizeof(setup_parm));
- FsmEvent(&chanp->fi, EV_REDIR, NULL);
+ case (11):
+ num = csta->debug & DEB_DLOG_HEX;
+ csta->debug = *(unsigned int *) ic->parm.num;
+ csta->debug |= num;
+ HiSax_putstatus(cards[0].cs, "l1 debugging ",
+ "flags card %d set to %x",
+ csta->cardnr + 1, csta->debug);
+ printk(KERN_DEBUG "HiSax: l1 debugging flags card %d set to %x\n",
+ csta->cardnr + 1, csta->debug);
break;
-
- /* protocol specific io commands */
- case (ISDN_CMD_PROT_IO):
- for (st = csta->stlist; st; st = st->next)
- if (st->protocol == (ic->arg & 0xFF))
- return(st->lli.l4l3_proto(st, ic));
- return(-EINVAL);
+ case (13):
+ csta->channel[0].d_st->l3.debug = *(unsigned int *) ic->parm.num;
+ csta->channel[1].d_st->l3.debug = *(unsigned int *) ic->parm.num;
+ HiSax_putstatus(cards[0].cs, "l3 debugging ",
+ "flags card %d set to %x\n", csta->cardnr + 1,
+ *(unsigned int *) ic->parm.num);
+ printk(KERN_DEBUG "HiSax: l3 debugging flags card %d set to %x\n",
+ csta->cardnr + 1, *(unsigned int *) ic->parm.num);
break;
+ case (10):
+ i = *(unsigned int *) ic->parm.num;
+ return (set_channel_limit(csta, i));
default:
if (csta->auxcmd)
- return(csta->auxcmd(csta, ic));
- return(-EINVAL);
+ return (csta->auxcmd(csta, ic));
+ printk(KERN_DEBUG "HiSax: invalid ioctl %d\n",
+ (int) ic->arg);
+ return (-EINVAL);
+ }
+ break;
+
+ case (ISDN_CMD_PROCEED):
+ chanp = csta->channel + ic->arg;
+ if (chanp->debug & 1)
+ link_debug(chanp, 1, "PROCEED");
+ FsmEvent(&chanp->fi, EV_PROCEED, NULL);
+ break;
+
+ case (ISDN_CMD_ALERT):
+ chanp = csta->channel + ic->arg;
+ if (chanp->debug & 1)
+ link_debug(chanp, 1, "ALERT");
+ FsmEvent(&chanp->fi, EV_ALERT, NULL);
+ break;
+
+ case (ISDN_CMD_REDIR):
+ chanp = csta->channel + ic->arg;
+ if (chanp->debug & 1)
+ link_debug(chanp, 1, "REDIR");
+ memcpy(&chanp->setup, &ic->parm.setup, sizeof(setup_parm));
+ FsmEvent(&chanp->fi, EV_REDIR, NULL);
+ break;
+
+ /* protocol specific io commands */
+ case (ISDN_CMD_PROT_IO):
+ for (st = csta->stlist; st; st = st->next)
+ if (st->protocol == (ic->arg & 0xFF))
+ return (st->lli.l4l3_proto(st, ic));
+ return (-EINVAL);
+ break;
+ default:
+ if (csta->auxcmd)
+ return (csta->auxcmd(csta, ic));
+ return (-EINVAL);
}
return (0);
}
@@ -1747,7 +1747,7 @@ HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb)
if (!csta) {
printk(KERN_ERR
- "HiSax: if_sendbuf called with invalid driverId!\n");
+ "HiSax: if_sendbuf called with invalid driverId!\n");
return -ENODEV;
}
chanp = csta->channel + chan;
@@ -1759,7 +1759,7 @@ HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb)
if (len > MAX_DATA_SIZE) {
link_debug(chanp, 1, "writebuf: packet too large (%d bytes)", len);
printk(KERN_WARNING "HiSax_writebuf: packet too large (%d bytes) !\n",
- len);
+ len);
return -EINVAL;
}
if (len) {
@@ -1771,7 +1771,7 @@ HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb)
link_debug(chanp, 1, "writebuf: no buffers for %d bytes", len);
return 0;
} else if (chanp->debug & 0x800)
- link_debug(chanp, 1, "writebuf %d/%d/%d", len, chanp->bcs->tx_cnt,MAX_DATA_MEM);
+ link_debug(chanp, 1, "writebuf %d/%d/%d", len, chanp->bcs->tx_cnt, MAX_DATA_MEM);
nskb = skb_clone(skb, GFP_ATOMIC);
if (nskb) {
nskb->truesize = nskb->len;