patch-2.0.36 linux/drivers/isdn/isdn_tty.c
Next file: linux/drivers/isdn/isdn_tty.h
Previous file: linux/drivers/isdn/isdn_syms.c
Back to the patch index
Back to the overall index
- Lines: 347
- Date:
Sun Nov 15 10:33:00 1998
- Orig file:
v2.0.35/linux/drivers/isdn/isdn_tty.c
- Orig date:
Thu Aug 14 11:19:48 1997
diff -u --recursive --new-file v2.0.35/linux/drivers/isdn/isdn_tty.c linux/drivers/isdn/isdn_tty.c
@@ -1,8 +1,8 @@
-/* $Id: isdn_tty.c,v 1.41 1997/05/27 15:17:31 fritz Exp $
+/* $Id: isdn_tty.c,v 1.41.2.11 1998/11/05 22:12:12 fritz Exp $
* Linux ISDN subsystem, tty functions and AT-command emulator (linklevel).
*
- * Copyright 1994,95,96 by Fritz Elfert (fritz@wuemaus.franken.de)
+ * Copyright 1994-1998 by Fritz Elfert (fritz@isdn4linux.de)
* Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg
*
* This program is free software; you can redistribute it and/or modify
@@ -20,6 +20,48 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdn_tty.c,v $
+ * Revision 1.41.2.11 1998/11/05 22:12:12 fritz
+ * Changed mail-address.
+ *
+ * Revision 1.41.2.10 1998/11/03 14:31:35 fritz
+ * Reduced stack usage in various functions.
+ * Adapted statemachine to work with certified HiSax.
+ * Some fixes in callback handling.
+ *
+ * Revision 1.41.2.9 1998/10/25 15:48:32 fritz
+ * Misc bugfixes and adaptions to new HiSax
+ *
+ * Revision 1.41.2.8 1998/08/22 16:43:07 armin
+ * Added silence detection in audio receive mode (AT+VSD).
+ *
+ * Revision 1.41.2.7 1998/06/07 13:48:08 fritz
+ * ABC cleanup
+ *
+ * Revision 1.41.2.5 1998/04/08 21:42:35 keil
+ * Blocksize default 1024
+ *
+ * Revision 1.41.2.4 1998/03/19 17:58:55 detabc
+ * remove 2 debug-messages (no longer needed) bug was fixed
+ *
+ * Revision 1.41.2.3 1998/03/07 23:35:20 detabc
+ * added the abc-extension to the linux isdn-kernel
+ * for kernel-version 2.0.xx
+ * DO NOT USE FOR HIGHER KERNELS-VERSIONS
+ * all source-lines are switched with the define CONFIG_ISDN_WITH_ABC
+ * (make config and answer ABC-Ext. Support (Compress,TCP-Keepalive ...) with yes
+ *
+ * you need also a modified isdnctrl-source the switch on the
+ * features of the abc-extension
+ *
+ * please use carefully. more detail will be follow.
+ * thanks
+ *
+ * Revision 1.41.2.2 1998/03/07 23:02:51 tsbogend
+ * fixed kernel unaligned traps on Linux/Alpha
+ *
+ * Revision 1.41.2.1 1997/08/21 15:56:11 fritz
+ * Synchronized 2.0.X branch with 2.0.31-pre7
+ *
* Revision 1.41 1997/05/27 15:17:31 fritz
* Added changes for recent 2.1.x kernels:
* changed return type of isdn_close
@@ -199,6 +241,7 @@
#define VBUFX (VBUF/16)
#endif
+
/* Prototypes */
static int isdn_tty_edit_at(const char *, int, modem_info *, int);
@@ -223,7 +266,7 @@
static int si2bit[8] =
{4, 1, 4, 4, 4, 4, 4, 4};
-char *isdn_tty_revision = "$Revision: 1.41 $";
+char *isdn_tty_revision = "$Revision: 1.41.2.11 $";
#define DLE 0x10
#define ETX 0x03
@@ -308,6 +351,8 @@
r = 0;
#ifdef CONFIG_ISDN_AUDIO
isdn_audio_eval_dtmf(info);
+ if ((info->vonline & 1) && (info->emu.vpar[1]))
+ isdn_audio_eval_silence(info);
#endif
if ((tty = info->tty)) {
if (info->mcr & UART_MCR_RTS) {
@@ -364,6 +409,8 @@
if (info->vonline)
isdn_audio_calc_dtmf(info, skb->data, skb->len, ifmt);
+ if ((info->vonline & 1) && (info->emu.vpar[1]))
+ isdn_audio_calc_silence(info, skb->data, skb->len, ifmt);
#endif
if ((info->online < 2)
#ifdef CONFIG_ISDN_AUDIO
@@ -798,20 +845,20 @@
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.command = ISDN_CMD_CLREAZ;
- dev->drv[info->isdn_driver]->interface->command(&cmd);
+ isdn_command(&cmd);
strcpy(cmd.parm.num, isdn_map_eaz2msn(m->msn, info->isdn_driver));
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETEAZ;
- dev->drv[info->isdn_driver]->interface->command(&cmd);
+ isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL2;
info->last_l2 = l2;
cmd.arg = info->isdn_channel + (l2 << 8);
- dev->drv[info->isdn_driver]->interface->command(&cmd);
+ isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL3;
cmd.arg = info->isdn_channel + (m->mdmreg[15] << 8);
- dev->drv[info->isdn_driver]->interface->command(&cmd);
+ isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
sprintf(cmd.parm.setup.phone, "%s", n);
@@ -823,7 +870,7 @@
info->dialing = 1;
strcpy(dev->num[i], n);
isdn_info_update();
- dev->drv[info->isdn_driver]->interface->command(&cmd);
+ isdn_command(&cmd);
}
}
@@ -872,7 +919,7 @@
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_HANGUP;
cmd.arg = info->isdn_channel;
- dev->drv[info->isdn_driver]->interface->command(&cmd);
+ isdn_command(&cmd);
}
isdn_all_eaz(info->isdn_driver, info->isdn_channel);
info->emu.mdmreg[1] = 0;
@@ -1270,7 +1317,7 @@
status = info->lsr;
restore_flags(flags);
result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0);
- put_user(result, (ulong *) value);
+ put_user(result, (uint *) value);
return 0;
}
@@ -1294,7 +1341,7 @@
| ((status & UART_MSR_RI) ? TIOCM_RNG : 0)
| ((status & UART_MSR_DSR) ? TIOCM_DSR : 0)
| ((status & UART_MSR_CTS) ? TIOCM_CTS : 0);
- put_user(result, (ulong *) value);
+ put_user(result, (uint *) value);
return 0;
}
@@ -1443,7 +1490,6 @@
return error;
else
return isdn_tty_get_lsr_info(info, (uint *) arg);
-
default:
#ifdef ISDN_DEBUG_MODEM_IOCTL
printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on ttyi%d\n", cmd, info->line);
@@ -1927,7 +1973,7 @@
#ifdef CONFIG_ISDN_AUDIO
skb_queue_head_init(&info->dtmf_queue);
#endif
- if (!(info->xmit_buf = kmalloc(ISDN_SERIAL_XMIT_SIZE + 5, GFP_KERNEL))) {
+ if (!(info->xmit_buf = kmalloc(ISDN_SERIAL_XMIT_MAX + 5, GFP_KERNEL))) {
printk(KERN_ERR "Could not allocate modem xmit-buffer\n");
return -3;
}
@@ -1944,9 +1990,11 @@
* Return Index to dev->mdm or -1 if none found.
*/
int
-isdn_tty_find_icall(int di, int ch, setup_parm setup)
+isdn_tty_find_icall(int di, isdn_ctrl *c)
{
char *eaz;
+ int ch = c->arg;
+ setup_parm *setup = &c->parm.setup;
int i;
int idx;
int si1;
@@ -1956,19 +2004,19 @@
save_flags(flags);
cli();
- if (!setup.phone[0]) {
+ if (!setup->phone[0]) {
nr[0] = '0';
nr[1] = '\0';
printk(KERN_INFO "isdn_tty: Incoming call without OAD, assuming '0'\n");
} else
- strcpy(nr, setup.phone);
- si1 = (int) setup.si1;
- si2 = (int) setup.si2;
- if (!setup.eazmsn[0]) {
+ strcpy(nr, setup->phone);
+ si1 = (int) setup->si1;
+ si2 = (int) setup->si2;
+ if (!setup->eazmsn[0]) {
printk(KERN_WARNING "isdn_tty: Incoming call without CPN, assuming '0'\n");
eaz = "0";
} else
- eaz = setup.eazmsn;
+ eaz = setup->eazmsn;
#ifdef ISDN_DEBUG_MODEM_ICALL
printk(KERN_DEBUG "m_fi: eaz=%s si1=%d si2=%d\n", eaz, si1, si2);
#endif
@@ -2002,8 +2050,8 @@
dev->usage[idx] |= (si1 == 1) ? ISDN_USAGE_VOICE : ISDN_USAGE_MODEM;
strcpy(dev->num[idx], nr);
info->emu.mdmreg[20] = si2bit[si1];
- info->emu.mdmreg[21] = setup.plan;
- info->emu.mdmreg[22] = setup.screen;
+ info->emu.mdmreg[21] = setup->plan;
+ info->emu.mdmreg[22] = setup->screen;
isdn_info_update();
restore_flags(flags);
printk(KERN_INFO "isdn_tty: call from %s, -> RING on ttyI%d\n", nr,
@@ -2016,7 +2064,7 @@
}
}
printk(KERN_INFO "isdn_tty: call from %s -> %s %s\n", nr, eaz,
- dev->drv[di]->reject_bus ? "rejected" : "ignored");
+ (dev->drv[di]->flags & DRV_FLAG_REJBUS) ? "rejected" : "ignored");
restore_flags(flags);
return -1;
}
@@ -2534,7 +2582,7 @@
/* &B - Set Buffersize */
p[0]++;
i = isdn_getnum(p);
- if ((i < 0) || (i > ISDN_SERIAL_XMIT_SIZE))
+ if ((i < 0) || (i > ISDN_SERIAL_XMIT_MAX))
PARSE_ERROR1;
#ifdef CONFIG_ISDN_AUDIO
if ((m->mdmreg[18] & 1) && (i > VBUF))
@@ -2643,7 +2691,7 @@
return 1;
break;
case 16:
- if ((mval * 16) > ISDN_SERIAL_XMIT_SIZE)
+ if ((mval * 16) > ISDN_SERIAL_XMIT_MAX)
return 1;
#ifdef CONFIG_ISDN_AUDIO
if ((m->mdmreg[18] & 1) && (mval > VBUFX))
@@ -2756,15 +2804,15 @@
cmd.command = ISDN_CMD_SETL2;
cmd.arg = info->isdn_channel + (l2 << 8);
info->last_l2 = l2;
- dev->drv[info->isdn_driver]->interface->command(&cmd);
+ isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.command = ISDN_CMD_SETL3;
cmd.arg = info->isdn_channel + (m->mdmreg[15] << 8);
- dev->drv[info->isdn_driver]->interface->command(&cmd);
+ isdn_command(&cmd);
cmd.driver = info->isdn_driver;
cmd.arg = info->isdn_channel;
cmd.command = ISDN_CMD_ACCEPTD;
- dev->drv[info->isdn_driver]->interface->command(&cmd);
+ isdn_command(&cmd);
} else
isdn_tty_modem_result(8, info);
}
@@ -2937,6 +2985,11 @@
printk(KERN_WARNING "isdn_tty: Couldn't malloc dtmf state\n");
PARSE_ERROR1;
}
+ info->silence_state = isdn_audio_silence_init(info->silence_state);
+ if (!info->silence_state) {
+ printk(KERN_WARNING "isdn_tty: Couldn't malloc silence state\n");
+ PARSE_ERROR1;
+ }
if (m->vpar[3] < 5) {
info->adpcmr = isdn_audio_adpcm_init(info->adpcmr, m->vpar[3]);
if (!info->adpcmr) {
@@ -2962,33 +3015,29 @@
isdn_tty_at_cout(rs, info);
break;
case '=':
- p[0]++;
- switch (*p[0]) {
- case '0':
- case '1':
- case '2':
- case '3':
- par1 = isdn_getnum(p);
- if ((par1 < 0) || (par1 > 31))
- PARSE_ERROR1;
- if (*p[0] != ',')
- PARSE_ERROR1;
- p[0]++;
- par2 = isdn_getnum(p);
- if ((par2 < 0) || (par2 > 255))
- PARSE_ERROR1;
- m->vpar[1] = par1;
- m->vpar[2] = par2;
- break;
- case '?':
- p[0]++;
- isdn_tty_at_cout("\r\n<0-31>,<0-255>",
- info);
- break;
- default:
- PARSE_ERROR1;
- }
- break;
+ p[0]++;
+ if ((*p[0]>='0') && (*p[0]<='9')) {
+ par1 = isdn_getnum(p);
+ if ((par1 < 0) || (par1 > 31))
+ PARSE_ERROR1;
+ if (*p[0] != ',')
+ PARSE_ERROR1;
+ p[0]++;
+ par2 = isdn_getnum(p);
+ if ((par2 < 0) || (par2 > 255))
+ PARSE_ERROR1;
+ m->vpar[1] = par1;
+ m->vpar[2] = par2;
+ break;
+ } else
+ if (*p[0] == '?') {
+ p[0]++;
+ isdn_tty_at_cout("\r\n<0-31>,<0-255>",
+ info);
+ break;
+ } else
+ PARSE_ERROR1;
+ break;
default:
PARSE_ERROR1;
}
@@ -3095,7 +3144,7 @@
break;
case 'D':
/* D - Dial */
- isdn_tty_getdial(++p, ds, sizeof(ds));
+ isdn_tty_getdial(++p, ds,sizeof(ds));
p += strlen(p);
if (!strlen(m->msn))
isdn_tty_modem_result(10, info);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov