3952 lines
200 KiB
Plaintext
3952 lines
200 KiB
Plaintext
<HTML>
|
|
|
|
<!-- Generated by c2html-1.0, Copyright 1998 by Dave Whittington -->
|
|
<HEAD>
|
|
<TITLE>isdn_tty.c</TITLE>
|
|
<!--#include virtual="/ssi/js.shtml" -->
|
|
<!--#include virtual="/ssi/buttondefs.shtml" -->
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF">
|
|
<TABLE WIDTH="100%">
|
|
<TR>
|
|
<TD ALIGN=LEFT WIDTH="90"><!--#include virtual="/ssi/b_home.shtml" --></TD>
|
|
<TD ALIGN=RIGHT WIDTH="90"><!--#include virtual="/ssi/b_index.shtml" --></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<CENTER><H1>isdn_tty.c</H1></CENTER>
|
|
|
|
<HR>
|
|
<PRE>
|
|
<FONT COLOR=#0000FF>/* $Id$
|
|
|
|
* Linux ISDN subsystem, tty functions and AT-command emulator (linklevel).
|
|
*
|
|
* Copyright 1994,95,96 by Fritz Elfert (fritz@wuemaus.franken.de)
|
|
* Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*
|
|
* $Log$
|
|
* Revision 1.57 1998/06/26 15:12:36 fritz
|
|
* Added handling of STAT_ICALL with incomplete CPN.
|
|
* Added AT&L for ttyI emulator.
|
|
* Added more locking stuff in tty_write.
|
|
*
|
|
* Revision 1.56 1998/06/18 23:31:51 fritz
|
|
* Replaced cli()/restore_flags() in isdn_tty_write() by locking.
|
|
* Removed direct-senddown feature in isdn_tty_write because it will
|
|
* never succeed with locking and is useless anyway.
|
|
*
|
|
* Revision 1.55 1998/06/17 19:50:55 he
|
|
* merged with 2.1.10[34] (cosmetics and udelay() -> mdelay())
|
|
* brute force fix to avoid Ugh's in isdn_tty_write()
|
|
* cleaned up some dead code
|
|
*
|
|
* Revision 1.54 1998/06/07 00:20:13 fritz
|
|
* abc cleanup.
|
|
*
|
|
* Revision 1.53 1998/06/02 12:10:16 detabc
|
|
* wegen einer einstweiliger verfuegung gegen DW ist zur zeit
|
|
* die abc-extension bis zur klaerung der rechtslage nicht verfuegbar
|
|
*
|
|
* Revision 1.52 1998/03/19 13:18:21 keil
|
|
* Start of a CAPI like interface for supplementary Service
|
|
* first service: SUSPEND
|
|
*
|
|
* Revision 1.51 1998/03/08 14:26:11 detabc
|
|
* change kfree_skb to dev_kfree_skb
|
|
* remove SET_SKB_FREE
|
|
*
|
|
* Revision 1.50 1998/03/08 13:14:28 detabc
|
|
* abc-extension support for kernels > 2.1.x
|
|
* first try (sorry experimental)
|
|
*
|
|
* Revision 1.49 1998/03/08 00:01:59 fritz
|
|
* Bugfix: Lowlevel module usage and channel usage were not
|
|
* reset on NO DCHANNEL.
|
|
*
|
|
* Revision 1.48 1998/03/07 12:28:15 tsbogend
|
|
* fixed kernel unaligned traps on Linux/Alpha
|
|
*
|
|
* Revision 1.47 1998/02/22 19:44:14 fritz
|
|
* Bugfixes and improvements regarding V.110, V.110 now running.
|
|
*
|
|
* Revision 1.46 1998/02/20 17:23:08 fritz
|
|
* Changes for recent kernels.
|
|
* Merged in contributions by Thomas Pfeiffer (V.110 T.70+ Extended FAX stuff)
|
|
* Added symbolic constants for Modem-Registers.
|
|
*
|
|
* Revision 1.45 1998/01/31 22:07:49 keil
|
|
* changes for newer kernels
|
|
*
|
|
* Revision 1.44 1998/01/31 19:30:02 calle
|
|
* Merged changes from and for 2.1.82, not tested only compiled ...
|
|
*
|
|
* Revision 1.43 1997/10/09 21:29:04 fritz
|
|
* New HL<->LL interface:
|
|
* New BSENT callback with nr. of bytes included.
|
|
* Sending without ACK.
|
|
* New L1 error status (not yet in use).
|
|
* Cleaned up obsolete structures.
|
|
* Implemented Cisco-SLARP.
|
|
* Changed local net-interface data to be dynamically allocated.
|
|
* Removed old 2.0 compatibility stuff.
|
|
*
|
|
* Revision 1.42 1997/10/01 09:20:49 fritz
|
|
* Removed old compatibility stuff for 2.0.X kernels.
|
|
* From now on, this code is for 2.1.X ONLY!
|
|
* Old stuff is still in the separate branch.
|
|
*
|
|
* Revision 1.41 1997/05/27 15:17:31 fritz
|
|
* Added changes for recent 2.1.x kernels:
|
|
* changed return type of isdn_close
|
|
* queue_task_* -> queue_task
|
|
* clear/set_bit -> test_and_... where apropriate.
|
|
* changed type of hard_header_cache parameter.
|
|
*
|
|
* Revision 1.40 1997/03/24 22:55:27 fritz
|
|
* Added debug code for status callbacks.
|
|
*
|
|
* Revision 1.39 1997/03/21 18:25:56 fritz
|
|
* Corrected CTS handling.
|
|
*
|
|
* Revision 1.38 1997/03/07 12:13:35 fritz
|
|
* Bugfix: Send audio in adpcm format was broken.
|
|
* Bugfix: CTS handling was wrong.
|
|
*
|
|
* Revision 1.37 1997/03/07 01:37:34 fritz
|
|
* Bugfix: Did not compile with CONFIG_ISDN_AUDIO disabled.
|
|
* Bugfix: isdn_tty_tint() did not handle lowlevel errors correctly.
|
|
* Bugfix: conversion was wrong when sending ulaw audio.
|
|
* Added proper ifdef's for CONFIG_ISDN_AUDIO
|
|
*
|
|
* Revision 1.36 1997/03/04 21:41:55 fritz
|
|
* Fix: Excessive stack usage of isdn_tty_senddown()
|
|
* and isdn_tty_end_vrx() could lead to problems.
|
|
*
|
|
* Revision 1.35 1997/03/02 19:05:52 fritz
|
|
* Bugfix: Avoid recursion.
|
|
*
|
|
* Revision 1.34 1997/03/02 14:29:22 fritz
|
|
* More ttyI related cleanup.
|
|
*
|
|
* Revision 1.33 1997/02/28 02:32:45 fritz
|
|
* Cleanup: Moved some tty related stuff from isdn_common.c
|
|
* to isdn_tty.c
|
|
* Bugfix: Bisync protocol did not behave like documented.
|
|
*
|
|
* Revision 1.32 1997/02/23 15:43:03 fritz
|
|
* Small change in handling of incoming calls
|
|
* documented in newest version of ttyI.4
|
|
*
|
|
* Revision 1.31 1997/02/21 13:05:57 fritz
|
|
* Bugfix: Remote hangup did not set location-info on ttyI's
|
|
*
|
|
* Revision 1.30 1997/02/18 09:41:05 fritz
|
|
* Added support for bitwise access to modem registers (ATSx.y=n, ATSx.y?).
|
|
* Beautified output of AT&V.
|
|
*
|
|
* Revision 1.29 1997/02/16 12:11:51 fritz
|
|
* Added S13,Bit4 option.
|
|
*
|
|
* Revision 1.28 1997/02/10 22:07:08 fritz
|
|
* Added 2 modem registers for numbering plan and screening info.
|
|
*
|
|
* Revision 1.27 1997/02/10 21:31:14 fritz
|
|
* Changed setup-interface (incoming and outgoing).
|
|
*
|
|
* Revision 1.26 1997/02/10 20:12:48 fritz
|
|
* Changed interface for reporting incoming calls.
|
|
*
|
|
* Revision 1.25 1997/02/03 23:04:30 fritz
|
|
* Reformatted according CodingStyle.
|
|
* skb->free stuff replaced by macro.
|
|
* Finished full-duplex audio.
|
|
*
|
|
* Revision 1.24 1997/01/14 01:32:42 fritz
|
|
* Changed audio receive not to rely on skb->users and skb->lock.
|
|
* Added ATI2 and related variables.
|
|
* Started adding full-duplex audio capability.
|
|
*
|
|
* Revision 1.23 1996/10/22 23:14:02 fritz
|
|
* Changes for compatibility to 2.0.X and 2.1.X kernels.
|
|
*
|
|
* Revision 1.22 1996/10/19 18:56:43 fritz
|
|
* ATZ did not change the xmitbuf size.
|
|
*
|
|
* Revision 1.21 1996/06/24 17:40:28 fritz
|
|
* Bugfix: Did not compile without CONFIG_ISDN_AUDIO
|
|
*
|
|
* Revision 1.20 1996/06/15 14:59:39 fritz
|
|
* Fixed isdn_tty_tint() to handle partially sent
|
|
* sk_buffs.
|
|
*
|
|
* Revision 1.19 1996/06/12 15:53:56 fritz
|
|
* Bugfix: AT+VTX and AT+VRX could be executed without
|
|
* having a connection.
|
|
* Missing check for NULL tty in isdn_tty_flush_buffer().
|
|
*
|
|
* Revision 1.18 1996/06/07 11:17:33 tsbogend
|
|
* added missing #ifdef CONFIG_ISDN_AUDIO to make compiling without
|
|
* audio support possible
|
|
*
|
|
* Revision 1.17 1996/06/06 14:55:47 fritz
|
|
* Changed to support DTMF decoding on audio playback also.
|
|
* Bugfix: Added check for invalid info->isdn_driver in
|
|
* isdn_tty_senddown().
|
|
* Clear ncarrier flag on last close() of a tty.
|
|
*
|
|
* Revision 1.16 1996/06/05 02:24:12 fritz
|
|
* Added DTMF decoder for audio mode.
|
|
*
|
|
* Revision 1.15 1996/06/03 20:35:01 fritz
|
|
* Fixed typos.
|
|
*
|
|
* Revision 1.14 1996/06/03 20:12:19 fritz
|
|
* Fixed typos.
|
|
* Added call to write_wakeup via isdn_tty_flush_buffer()
|
|
* in isdn_tty_modem_hup().
|
|
*
|
|
* Revision 1.13 1996/05/31 01:33:29 fritz
|
|
* Changed buffering due to bad performance with mgetty.
|
|
* Now sk_buff is delayed allocated in isdn_tty_senddown
|
|
* using xmit_buff like in standard serial driver.
|
|
* Fixed module locking.
|
|
* Added DLE-DC4 handling in voice mode.
|
|
*
|
|
* Revision 1.12 1996/05/19 01:34:40 fritz
|
|
* Bugfix: ATS returned error.
|
|
* Register 20 made readonly.
|
|
*
|
|
* Revision 1.11 1996/05/18 01:37:03 fritz
|
|
* Added spelling corrections and some minor changes
|
|
* to stay in sync with kernel.
|
|
*
|
|
* Revision 1.10 1996/05/17 03:51:49 fritz
|
|
* Changed DLE handling for audio receive.
|
|
*
|
|
* Revision 1.9 1996/05/11 21:52:07 fritz
|
|
* Changed queue management to use sk_buffs.
|
|
*
|
|
* Revision 1.8 1996/05/10 08:49:43 fritz
|
|
* Checkin before major changes of tty-code.
|
|
*
|
|
* Revision 1.7 1996/05/07 09:15:09 fritz
|
|
* Reorganized and general cleanup.
|
|
* Bugfixes:
|
|
* - Audio-transmit working now.
|
|
* - "NO CARRIER" now reported, when hanging up with DTR low.
|
|
* - Corrected CTS handling.
|
|
*
|
|
* Revision 1.6 1996/05/02 03:59:25 fritz
|
|
* Bugfixes:
|
|
* - On dialout, layer-2 setup had been incomplete
|
|
* when using new auto-layer2 feature.
|
|
* - On hangup, "NO CARRIER" message sometimes missing.
|
|
*
|
|
* Revision 1.5 1996/04/30 21:05:25 fritz
|
|
* Test commit
|
|
*
|
|
* Revision 1.4 1996/04/20 16:39:54 fritz
|
|
* Changed all io to go through generic routines in isdn_common.c
|
|
* Fixed a real ugly bug in modem-emulator: 'ATA' had been accepted
|
|
* even when a call has been cancelled from the remote machine.
|
|
*
|
|
* Revision 1.3 1996/02/11 02:12:32 fritz
|
|
* Bugfixes according to similar fixes in standard serial.c of kernel.
|
|
*
|
|
* Revision 1.2 1996/01/22 05:12:25 fritz
|
|
* replaced my_atoi by simple_strtoul
|
|
*
|
|
* Revision 1.1 1996/01/09 04:13:18 fritz
|
|
* Initial revision
|
|
*
|
|
*/</FONT>
|
|
<FONT COLOR=#A521F7>#undef</FONT> ISDN_TTY_STAT_DEBUG
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A HREF="isdn_audio.c.shtml#__NO_VERSION__">__NO_VERSION__</A>
|
|
<FONT COLOR=#A521F7>#include</FONT> <linux/config.h>
|
|
<FONT COLOR=#A521F7>#include</FONT> <linux/module.h>
|
|
<FONT COLOR=#A521F7>#include</FONT> <linux/isdn.h>
|
|
<FONT COLOR=#A521F7>#include</FONT> <FONT COLOR="#FF0000">"isdn_common.h"</FONT>
|
|
<FONT COLOR=#A521F7>#include</FONT> <FONT COLOR="#FF0000">"isdn_tty.h"</FONT>
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR=#A521F7>#include</FONT> <FONT COLOR="#FF0000">"isdn_audio.h"</FONT>
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="VBUF">VBUF</A> 0x3e0
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="VBUFX">VBUFX</A> (<A HREF="#VBUF">VBUF</A>/16)
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="FIX_FILE_TRANSFER">FIX_FILE_TRANSFER</A>
|
|
|
|
<FONT COLOR=#0000FF>/* Prototypes */</FONT>
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT> <A HREF="#isdn_tty_edit_at">isdn_tty_edit_at</A>(<FONT COLOR="#298C52">const</FONT> <FONT COLOR="#298C52">char</FONT> *, <FONT COLOR="#298C52">int</FONT>, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *, <FONT COLOR="#298C52">int</FONT>);
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT> <A HREF="#isdn_tty_check_esc">isdn_tty_check_esc</A>(<FONT COLOR="#298C52">const</FONT> u_char *, u_char, <FONT COLOR="#298C52">int</FONT>, <FONT COLOR="#298C52">int</FONT> *, <FONT COLOR="#298C52">int</FONT> *, <FONT COLOR="#298C52">int</FONT>);
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT> <A HREF="#isdn_tty_modem_reset_regs">isdn_tty_modem_reset_regs</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *, <FONT COLOR="#298C52">int</FONT>);
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT> <A HREF="#isdn_tty_cmd_ATA">isdn_tty_cmd_ATA</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *);
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT> <A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#298C52">char</FONT> *, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *);
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT> <A HREF="#isdn_tty_flush_buffer">isdn_tty_flush_buffer</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *);
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT> <A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(<FONT COLOR="#298C52">int</FONT>, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT> <A HREF="#isdn_tty_countDLE">isdn_tty_countDLE</A>(<FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">char</FONT> *, <FONT COLOR="#298C52">int</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
|
|
<FONT COLOR=#0000FF>/* Leave this unchanged unless you know what you do! */</FONT>
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="MODEM_PARANOIA_CHECK">MODEM_PARANOIA_CHECK</A>
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="MODEM_DO_RESTART">MODEM_DO_RESTART</A>
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">char</FONT> *isdn_ttyname_ttyI = <FONT COLOR="#FF0000">"ttyI"</FONT>;
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">char</FONT> *isdn_ttyname_cui = <FONT COLOR="#FF0000">"cui"</FONT>;
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT> bit2si[8] =
|
|
{1, 5, 7, 7, 7, 7, 7, 7};
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT> si2bit[8] =
|
|
{4, 1, 4, 4, 4, 4, 4, 4};
|
|
|
|
<FONT COLOR="#298C52">char</FONT> *isdn_tty_revision = <FONT COLOR="#FF0000">"$Revision$"</FONT>;
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A HREF="isdn_common.c.shtml#DLE">DLE</A> 0x10
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="ETX">ETX</A> 0x03
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="DC4">DC4</A> 0x14
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Definition of some special Registers of AT-Emulator
|
|
*/</FONT>
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_RINGATA">REG_RINGATA</A> 0
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_RINGCNT">REG_RINGCNT</A> 1
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_ESC">REG_ESC</A> 2
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_CR">REG_CR</A> 3
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_LF">REG_LF</A> 4
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_BS">REG_BS</A> 5
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_RESP">REG_RESP</A> 12
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_RESP">BIT_RESP</A> 1
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_RESPNUM">REG_RESPNUM</A> 12
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_RESPNUM">BIT_RESPNUM</A> 2
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_ECHO">REG_ECHO</A> 12
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_ECHO">BIT_ECHO</A> 4
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_DCD">REG_DCD</A> 12
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_DCD">BIT_DCD</A> 8
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_CTS">REG_CTS</A> 12
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_CTS">BIT_CTS</A> 16
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_DTRR">REG_DTRR</A> 12
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_DTRR">BIT_DTRR</A> 32
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_DSR">REG_DSR</A> 12
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_DSR">BIT_DSR</A> 64
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_CPPP">REG_CPPP</A> 12
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_CPPP">BIT_CPPP</A> 128
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_T70">REG_T70</A> 13
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_T70">BIT_T70</A> 2
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_T70_EXT">BIT_T70_EXT</A> 32
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_DTRHUP">REG_DTRHUP</A> 13
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_DTRHUP">BIT_DTRHUP</A> 4
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_RESPXT">REG_RESPXT</A> 13
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_RESPXT">BIT_RESPXT</A> 8
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_CIDONCE">REG_CIDONCE</A> 13
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_CIDONCE">BIT_CIDONCE</A> 16
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_RUNG">REG_RUNG</A> 13
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_RUNG">BIT_RUNG</A> 64
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_RESRXT">REG_RESRXT</A> 13
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="BIT_RESRXT">BIT_RESRXT</A> 128
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_L2PROT">REG_L2PROT</A> 14
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_L3PROT">REG_L3PROT</A> 15
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_PSIZE">REG_PSIZE</A> 16
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_WSIZE">REG_WSIZE</A> 17
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_SI1">REG_SI1</A> 18
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_SI2">REG_SI2</A> 19
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_SI1I">REG_SI1I</A> 20
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_PLAN">REG_PLAN</A> 21
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="REG_SCREEN">REG_SCREEN</A> 22
|
|
|
|
<FONT COLOR=#0000FF>/* isdn_tty_try_read() is called from within isdn_tty_rcv_skb()
|
|
* to stuff incoming data directly into a tty's flip-buffer. This
|
|
* is done to speed up tty-receiving if the receive-queue is empty.
|
|
* This routine MUST be called with interrupts off.
|
|
* Return:
|
|
* 1 = Success
|
|
* 0 = Failure, data has to be buffered and later processed by
|
|
* isdn_tty_readmodem().
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_try_read">isdn_tty_try_read</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, <FONT COLOR="#298C52">struct</FONT> sk_buff *skb)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> c;
|
|
<FONT COLOR="#298C52">int</FONT> len;
|
|
<FONT COLOR="#298C52">struct</FONT> tty_struct *tty;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (info->online) {
|
|
<FONT COLOR="#298C52">if</FONT> ((tty = info->tty)) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->mcr & UART_MCR_RTS) {
|
|
c = TTY_FLIPBUF_SIZE - tty->flip.count;
|
|
len = skb->len
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
+ <A HREF="../includes/isdn.h.shtml#ISDN_AUDIO_SKB_DLECOUNT">ISDN_AUDIO_SKB_DLECOUNT</A>(skb)
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
;
|
|
<FONT COLOR="#298C52">if</FONT> (c >= len) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="../includes/isdn.h.shtml#ISDN_AUDIO_SKB_DLECOUNT">ISDN_AUDIO_SKB_DLECOUNT</A>(skb))
|
|
<FONT COLOR="#298C52">while</FONT> (skb->len--) {
|
|
<FONT COLOR="#298C52">if</FONT> (*skb->data == <A HREF="isdn_common.c.shtml#DLE">DLE</A>)
|
|
tty_insert_flip_char(tty, <A HREF="isdn_common.c.shtml#DLE">DLE</A>, 0);
|
|
tty_insert_flip_char(tty, *skb->data++, 0);
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
memcpy(tty->flip.char_buf_ptr,
|
|
skb->data, len);
|
|
tty->flip.count += len;
|
|
tty->flip.char_buf_ptr += len;
|
|
memset(tty->flip.flag_buf_ptr, 0, len);
|
|
tty->flip.flag_buf_ptr += len;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (info->emu.mdmreg[<A HREF="#REG_CPPP">REG_CPPP</A>] & <A HREF="#BIT_CPPP">BIT_CPPP</A>)
|
|
tty->flip.flag_buf_ptr[len - 1] = 0xff;
|
|
queue_task(&tty->flip.tqueue, &tq_timer);
|
|
kfree_skb(skb);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* isdn_tty_readmodem() is called periodically from within timer-interrupt.
|
|
* It tries getting received data from the receive queue an stuff it into
|
|
* the tty's flip-buffer.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_readmodem">isdn_tty_readmodem</A>(<FONT COLOR="#298C52">void</FONT>)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> resched = 0;
|
|
<FONT COLOR="#298C52">int</FONT> midx;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
<FONT COLOR="#298C52">int</FONT> c;
|
|
<FONT COLOR="#298C52">int</FONT> r;
|
|
ulong flags;
|
|
<FONT COLOR="#298C52">struct</FONT> tty_struct *tty;
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info;
|
|
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>; i++) {
|
|
<FONT COLOR="#298C52">if</FONT> ((midx = dev->m_idx[i]) >= 0) {
|
|
info = &dev->mdm.info[midx];
|
|
<FONT COLOR="#298C52">if</FONT> (info->online) {
|
|
r = 0;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<A HREF="isdn_audio.c.shtml#isdn_audio_eval_dtmf">isdn_audio_eval_dtmf</A>(info);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((tty = info->tty)) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->mcr & UART_MCR_RTS) {
|
|
c = TTY_FLIPBUF_SIZE - tty->flip.count;
|
|
<FONT COLOR="#298C52">if</FONT> (c > 0) {
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
r = <A HREF="isdn_common.c.shtml#isdn_readbchan">isdn_readbchan</A>(info->isdn_driver, info->isdn_channel,
|
|
tty->flip.char_buf_ptr,
|
|
tty->flip.flag_buf_ptr, c, 0);
|
|
<FONT COLOR=#0000FF>/* CISCO AsyncPPP Hack */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (!(info->emu.mdmreg[<A HREF="#REG_CPPP">REG_CPPP</A>] & <A HREF="#BIT_CPPP">BIT_CPPP</A>))
|
|
memset(tty->flip.flag_buf_ptr, 0, r);
|
|
tty->flip.count += r;
|
|
tty->flip.flag_buf_ptr += r;
|
|
tty->flip.char_buf_ptr += r;
|
|
<FONT COLOR="#298C52">if</FONT> (r)
|
|
queue_task(&tty->flip.tqueue, &tq_timer);
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
}
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
r = 1;
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
r = 1;
|
|
<FONT COLOR="#298C52">if</FONT> (r) {
|
|
info->rcvsched = 0;
|
|
resched = 1;
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
info->rcvsched = 1;
|
|
}
|
|
}
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!resched)
|
|
<A HREF="isdn_common.c.shtml#isdn_timer_ctrl">isdn_timer_ctrl</A>(<A HREF="../includes/isdn.h.shtml#ISDN_TIMER_MODEMREAD">ISDN_TIMER_MODEMREAD</A>, 0);
|
|
}
|
|
|
|
<FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_rcv_skb">isdn_tty_rcv_skb</A>(<FONT COLOR="#298C52">int</FONT> i, <FONT COLOR="#298C52">int</FONT> di, <FONT COLOR="#298C52">int</FONT> channel, <FONT COLOR="#298C52">struct</FONT> sk_buff *skb)
|
|
{
|
|
ulong flags;
|
|
<FONT COLOR="#298C52">int</FONT> midx;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">int</FONT> ifmt;
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> ((midx = dev->m_idx[i]) < 0) {
|
|
<FONT COLOR=#0000FF>/* if midx is invalid, packet is not for tty */</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
info = &dev->mdm.info[midx];
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
ifmt = 1;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (info->vonline)
|
|
<A HREF="isdn_audio.c.shtml#isdn_audio_calc_dtmf">isdn_audio_calc_dtmf</A>(info, skb->data, skb->len, ifmt);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((info->online < 2)
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
&& (!(info->vonline & 1))
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
) {
|
|
<FONT COLOR=#0000FF>/* If Modem not listening, drop data */</FONT>
|
|
kfree_skb(skb);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (info->emu.mdmreg[<A HREF="#REG_T70">REG_T70</A>] & <A HREF="#BIT_T70">BIT_T70</A>) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->emu.mdmreg[<A HREF="#REG_T70">REG_T70</A>] & <A HREF="#BIT_T70_EXT">BIT_T70_EXT</A>) {
|
|
<FONT COLOR=#0000FF>/* T.70 decoding: throw away the T.70 header (2 or 4 bytes) */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (skb->data[0] == 3) <FONT COLOR=#0000FF>/* pure data packet -> 4 byte headers */</FONT>
|
|
skb_pull(skb, 4);
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (skb->data[0] == 1) <FONT COLOR=#0000FF>/* keepalive packet -> 2 byte hdr */</FONT>
|
|
skb_pull(skb, 2);
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
<FONT COLOR=#0000FF>/* T.70 decoding: Simply throw away the T.70 header (4 bytes) */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((skb->data[0] == 1) && ((skb->data[1] == 0) || (skb->data[1] == 1)))
|
|
skb_pull(skb, 4);
|
|
}
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (skb_headroom(skb) < <FONT COLOR="#298C52">sizeof</FONT>(<A HREF="../includes/isdn.h.shtml#isdn_audio_skb">isdn_audio_skb</A>)) {
|
|
printk(KERN_WARNING
|
|
<FONT COLOR="#FF0000">"isdn_audio: insufficient skb_headroom, dropping\n"</FONT>);
|
|
kfree_skb(skb);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<A HREF="../includes/isdn.h.shtml#ISDN_AUDIO_SKB_DLECOUNT">ISDN_AUDIO_SKB_DLECOUNT</A>(skb) = 0;
|
|
<A HREF="../includes/isdn.h.shtml#ISDN_AUDIO_SKB_LOCK">ISDN_AUDIO_SKB_LOCK</A>(skb) = 0;
|
|
<FONT COLOR="#298C52">if</FONT> (info->vonline & 1) {
|
|
<FONT COLOR=#0000FF>/* voice conversion/compression */</FONT>
|
|
<FONT COLOR="#298C52">switch</FONT> (info->emu.vpar[3]) {
|
|
<FONT COLOR="#298C52">case</FONT> 2:
|
|
<FONT COLOR="#298C52">case</FONT> 3:
|
|
<FONT COLOR="#298C52">case</FONT> 4:
|
|
<FONT COLOR=#0000FF>/* adpcm
|
|
* Since compressed data takes less
|
|
* space, we can overwrite the buffer.
|
|
*/</FONT>
|
|
skb_trim(skb, <A HREF="isdn_audio.c.shtml#isdn_audio_xlaw2adpcm">isdn_audio_xlaw2adpcm</A>(info->adpcmr,
|
|
ifmt,
|
|
skb->data,
|
|
skb->data,
|
|
skb->len));
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 5:
|
|
<FONT COLOR=#0000FF>/* a-law */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (!ifmt)
|
|
<A HREF="isdn_audio.c.shtml#isdn_audio_ulaw2alaw">isdn_audio_ulaw2alaw</A>(skb->data, skb->len);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 6:
|
|
<FONT COLOR=#0000FF>/* u-law */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (ifmt)
|
|
<A HREF="isdn_audio.c.shtml#isdn_audio_alaw2ulaw">isdn_audio_alaw2ulaw</A>(skb->data, skb->len);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<A HREF="../includes/isdn.h.shtml#ISDN_AUDIO_SKB_DLECOUNT">ISDN_AUDIO_SKB_DLECOUNT</A>(skb) =
|
|
<A HREF="#isdn_tty_countDLE">isdn_tty_countDLE</A>(skb->data, skb->len);
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR=#0000FF>/* Try to deliver directly via tty-flip-buf if queue is empty */</FONT>
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
<FONT COLOR="#298C52">if</FONT> (skb_queue_empty(&dev->drv[di]->rpqueue[channel]))
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_try_read">isdn_tty_try_read</A>(info, skb)) {
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<FONT COLOR=#0000FF>/* Direct deliver failed or queue wasn't empty.
|
|
* Queue up for later dequeueing via timer-irq.
|
|
*/</FONT>
|
|
__skb_queue_tail(&dev->drv[di]->rpqueue[channel], skb);
|
|
dev->drv[di]->rcvcount[channel] +=
|
|
(skb->len
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
+ <A HREF="../includes/isdn.h.shtml#ISDN_AUDIO_SKB_DLECOUNT">ISDN_AUDIO_SKB_DLECOUNT</A>(skb)
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
);
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR=#0000FF>/* Schedule dequeuing */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((dev->modempoll) && (info->rcvsched))
|
|
<A HREF="isdn_common.c.shtml#isdn_timer_ctrl">isdn_timer_ctrl</A>(<A HREF="../includes/isdn.h.shtml#ISDN_TIMER_MODEMREAD">ISDN_TIMER_MODEMREAD</A>, 1);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_cleanup_xmit">isdn_tty_cleanup_xmit</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<FONT COLOR="#298C52">struct</FONT> sk_buff *skb;
|
|
<FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">long</FONT> flags;
|
|
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
<FONT COLOR="#298C52">if</FONT> (skb_queue_len(&info->xmit_queue))
|
|
<FONT COLOR="#298C52">while</FONT> ((skb = skb_dequeue(&info->xmit_queue)))
|
|
kfree_skb(skb);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (skb_queue_len(&info->dtmf_queue))
|
|
<FONT COLOR="#298C52">while</FONT> ((skb = skb_dequeue(&info->dtmf_queue)))
|
|
kfree_skb(skb);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_tint">isdn_tty_tint</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<FONT COLOR="#298C52">struct</FONT> sk_buff *skb = skb_dequeue(&info->xmit_queue);
|
|
<FONT COLOR="#298C52">int</FONT> len,
|
|
slen;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (!skb)
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
len = skb->len;
|
|
<FONT COLOR="#298C52">if</FONT> ((slen = <A HREF="isdn_common.c.shtml#isdn_writebuf_skb_stub">isdn_writebuf_skb_stub</A>(info->isdn_driver,
|
|
info->isdn_channel, 1, skb)) == len) {
|
|
<FONT COLOR="#298C52">struct</FONT> tty_struct *tty = info->tty;
|
|
info->send_outstanding++;
|
|
info->msr &= ~UART_MSR_CTS;
|
|
info->lsr &= ~UART_LSR_TEMT;
|
|
<FONT COLOR="#298C52">if</FONT> ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
|
|
tty->ldisc.write_wakeup)
|
|
(tty->ldisc.write_wakeup) (tty);
|
|
wake_up_interruptible(&tty->write_wait);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (slen < 0) {
|
|
<FONT COLOR=#0000FF>/* Error: no channel, already shutdown, or wrong parameter */</FONT>
|
|
dev_kfree_skb(skb);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
skb_queue_head(&info->xmit_queue, skb);
|
|
}
|
|
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_countDLE">isdn_tty_countDLE</A>(<FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">char</FONT> *buf, <FONT COLOR="#298C52">int</FONT> len)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> count = 0;
|
|
|
|
<FONT COLOR="#298C52">while</FONT> (len--)
|
|
<FONT COLOR="#298C52">if</FONT> (*buf++ == <A HREF="isdn_common.c.shtml#DLE">DLE</A>)
|
|
count++;
|
|
<FONT COLOR="#298C52">return</FONT> count;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* This routine is called from within isdn_tty_write() to perform
|
|
* DLE-decoding when sending audio-data.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_handleDLEdown">isdn_tty_handleDLEdown</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, <A HREF="../includes/isdn.h.shtml#atemu">atemu</A> * m, <FONT COLOR="#298C52">int</FONT> len)
|
|
{
|
|
<FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">char</FONT> *p = &info->xmit_buf[info->xmit_count];
|
|
<FONT COLOR="#298C52">int</FONT> count = 0;
|
|
|
|
<FONT COLOR="#298C52">while</FONT> (len > 0) {
|
|
<FONT COLOR="#298C52">if</FONT> (m->lastDLE) {
|
|
m->lastDLE = 0;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p) {
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="isdn_common.c.shtml#DLE">DLE</A>:
|
|
<FONT COLOR=#0000FF>/* Escape code */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (len > 1)
|
|
memmove(p, p + 1, len - 1);
|
|
p--;
|
|
count++;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="#ETX">ETX</A>:
|
|
<FONT COLOR=#0000FF>/* End of data */</FONT>
|
|
info->vonline |= 4;
|
|
<FONT COLOR="#298C52">return</FONT> count;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="#DC4">DC4</A>:
|
|
<FONT COLOR=#0000FF>/* Abort RX */</FONT>
|
|
info->vonline &= ~1;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_VOICE
|
|
printk(KERN_DEBUG
|
|
<FONT COLOR="#FF0000">"DLEdown: got DLE-DC4, send DLE-ETX on ttyI%d\n"</FONT>,
|
|
info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\020\003"</FONT>, info);
|
|
<FONT COLOR="#298C52">if</FONT> (!info->vonline) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_VOICE
|
|
printk(KERN_DEBUG
|
|
<FONT COLOR="#FF0000">"DLEdown: send VCON on ttyI%d\n"</FONT>,
|
|
info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\nVCON\r\n"</FONT>, info);
|
|
}
|
|
<FONT COLOR=#0000FF>/* Fall through */</FONT>
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'q'</FONT>:
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'s'</FONT>:
|
|
<FONT COLOR=#0000FF>/* Silence */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (len > 1)
|
|
memmove(p, p + 1, len - 1);
|
|
p--;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
<FONT COLOR="#298C52">if</FONT> (*p == <A HREF="isdn_common.c.shtml#DLE">DLE</A>)
|
|
m->lastDLE = 1;
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
count++;
|
|
}
|
|
p++;
|
|
len--;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (len < 0) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: len<0 in DLEdown\n"</FONT>);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> count;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* This routine is called from within isdn_tty_write() when receiving
|
|
* audio-data. It interrupts receiving, if an character other than
|
|
* ^S or ^Q is sent.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_end_vrx">isdn_tty_end_vrx</A>(<FONT COLOR="#298C52">const</FONT> <FONT COLOR="#298C52">char</FONT> *buf, <FONT COLOR="#298C52">int</FONT> c, <FONT COLOR="#298C52">int</FONT> from_user)
|
|
{
|
|
<FONT COLOR="#298C52">char</FONT> ch;
|
|
|
|
<FONT COLOR="#298C52">while</FONT> (c--) {
|
|
<FONT COLOR="#298C52">if</FONT> (from_user)
|
|
get_user(ch, buf);
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
ch = *buf;
|
|
<FONT COLOR="#298C52">if</FONT> ((ch != 0x11) && (ch != 0x13))
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
buf++;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT> voice_cf[7] =
|
|
{0, 0, 4, 3, 2, 0, 0};
|
|
|
|
<FONT COLOR=#A521F7>#endif</FONT> <FONT COLOR=#0000FF>/* CONFIG_ISDN_AUDIO */</FONT>
|
|
|
|
<FONT COLOR=#0000FF>/* isdn_tty_senddown() is called either directly from within isdn_tty_write()
|
|
* or via timer-interrupt from within isdn_tty_modem_xmit(). It pulls
|
|
* outgoing data from the tty's xmit-buffer, handles voice-decompression or
|
|
* T.70 if necessary, and finally queues it up for sending via isdn_tty_tint.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_senddown">isdn_tty_senddown</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> buflen;
|
|
<FONT COLOR="#298C52">int</FONT> skb_res;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">int</FONT> audio_len;
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">struct</FONT> sk_buff *skb;
|
|
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (info->vonline & 4) {
|
|
info->vonline &= ~6;
|
|
<FONT COLOR="#298C52">if</FONT> (!info->vonline) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_VOICE
|
|
printk(KERN_DEBUG
|
|
<FONT COLOR="#FF0000">"senddown: send VCON on ttyI%d\n"</FONT>,
|
|
info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\nVCON\r\n"</FONT>, info);
|
|
}
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (!(buflen = info->xmit_count))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">if</FONT> ((info->emu.mdmreg[<A HREF="#REG_CTS">REG_CTS</A>] & <A HREF="#BIT_CTS">BIT_CTS</A>) != 0)
|
|
info->msr &= ~UART_MSR_CTS;
|
|
info->lsr &= ~UART_LSR_TEMT;
|
|
<FONT COLOR=#0000FF>/* info->xmit_count is modified here and in isdn_tty_write().
|
|
* So we return here if isdn_tty_write() is in the
|
|
* critical section.
|
|
*/</FONT>
|
|
atomic_inc(&info->xmit_lock);
|
|
<FONT COLOR="#298C52">if</FONT> (!(atomic_dec_and_test(&info->xmit_lock)))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">if</FONT> (info->isdn_driver < 0) {
|
|
info->xmit_count = 0;
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
skb_res = dev->drv[info->isdn_driver]->interface->hl_hdrlen + 4;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (info->vonline & 2)
|
|
audio_len = buflen * voice_cf[info->emu.vpar[3]];
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
audio_len = 0;
|
|
skb = dev_alloc_skb(skb_res + buflen + audio_len);
|
|
<FONT COLOR=#A521F7>#else</FONT>
|
|
skb = dev_alloc_skb(skb_res + buflen);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (!skb) {
|
|
printk(KERN_WARNING
|
|
<FONT COLOR="#FF0000">"isdn_tty: Out of memory in ttyI%d senddown\n"</FONT>,
|
|
info->line);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
skb_reserve(skb, skb_res);
|
|
memcpy(skb_put(skb, buflen), info->xmit_buf, buflen);
|
|
info->xmit_count = 0;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (info->vonline & 2) {
|
|
<FONT COLOR=#0000FF>/* For now, ifmt is fixed to 1 (alaw), since this
|
|
* is used with ISDN everywhere in the world, except
|
|
* US, Canada and Japan.
|
|
* Later, when US-ISDN protocols are implemented,
|
|
* this setting will depend on the D-channel protocol.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">int</FONT> ifmt = 1;
|
|
|
|
<FONT COLOR=#0000FF>/* voice conversion/decompression */</FONT>
|
|
<FONT COLOR="#298C52">switch</FONT> (info->emu.vpar[3]) {
|
|
<FONT COLOR="#298C52">case</FONT> 2:
|
|
<FONT COLOR="#298C52">case</FONT> 3:
|
|
<FONT COLOR="#298C52">case</FONT> 4:
|
|
<FONT COLOR=#0000FF>/* adpcm, compatible to ZyXel 1496 modem
|
|
* with ROM revision 6.01
|
|
*/</FONT>
|
|
audio_len = <A HREF="isdn_audio.c.shtml#isdn_audio_adpcm2xlaw">isdn_audio_adpcm2xlaw</A>(info->adpcms,
|
|
ifmt,
|
|
skb->data,
|
|
skb_put(skb, audio_len),
|
|
buflen);
|
|
skb_pull(skb, buflen);
|
|
skb_trim(skb, audio_len);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 5:
|
|
<FONT COLOR=#0000FF>/* a-law */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (!ifmt)
|
|
<A HREF="isdn_audio.c.shtml#isdn_audio_alaw2ulaw">isdn_audio_alaw2ulaw</A>(skb->data,
|
|
buflen);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 6:
|
|
<FONT COLOR=#0000FF>/* u-law */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (ifmt)
|
|
<A HREF="isdn_audio.c.shtml#isdn_audio_ulaw2alaw">isdn_audio_ulaw2alaw</A>(skb->data,
|
|
buflen);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT> <FONT COLOR=#0000FF>/* CONFIG_ISDN_AUDIO */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (info->emu.mdmreg[<A HREF="#REG_T70">REG_T70</A>] & <A HREF="#BIT_T70">BIT_T70</A>) {
|
|
<FONT COLOR=#0000FF>/* Add T.70 simplified header */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (info->emu.mdmreg[<A HREF="#REG_T70">REG_T70</A>] & <A HREF="#BIT_T70_EXT">BIT_T70_EXT</A>)
|
|
memcpy(skb_push(skb, 2), <FONT COLOR="#FF0000">"\1\0"</FONT>, 2);
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
memcpy(skb_push(skb, 4), <FONT COLOR="#FF0000">"\1\0\1\0"</FONT>, 4);
|
|
}
|
|
skb_queue_tail(&info->xmit_queue, skb);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/************************************************************
|
|
*
|
|
* Modem-functions
|
|
*
|
|
* mostly "stolen" from original Linux-serial.c and friends.
|
|
*
|
|
************************************************************/</FONT>
|
|
|
|
<FONT COLOR=#0000FF>/* The next routine is called once from within timer-interrupt
|
|
* triggered within isdn_tty_modem_ncarrier(). It calls
|
|
* isdn_tty_modem_result() to stuff a "NO CARRIER" Message
|
|
* into the tty's flip-buffer.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_modem_do_ncarrier">isdn_tty_modem_do_ncarrier</A>(<FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">long</FONT> data)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) data;
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(3, info);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* Next routine is called, whenever the DTR-signal is raised.
|
|
* It checks the ncarrier-flag, and triggers the above routine
|
|
* when necessary. The ncarrier-flag is set, whenever DTR goes
|
|
* low.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_modem_ncarrier">isdn_tty_modem_ncarrier</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<FONT COLOR="#298C52">if</FONT> (info->ncarrier) {
|
|
info->nc_timer.expires = jiffies + HZ;
|
|
info->nc_timer.function = <A HREF="#isdn_tty_modem_do_ncarrier">isdn_tty_modem_do_ncarrier</A>;
|
|
info->nc_timer.data = (<FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">long</FONT>) info;
|
|
add_timer(&info->nc_timer);
|
|
}
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* isdn_tty_dial() performs dialing of a tty an the necessary
|
|
* setup of the lower levels before that.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A HREF="#isdn_tty_dial">isdn_tty_dial</A>(<FONT COLOR="#298C52">char</FONT> *n, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, <A HREF="../includes/isdn.h.shtml#atemu">atemu</A> * m)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> usg = <A HREF="../includes/isdn.h.shtml#ISDN_USAGE_MODEM">ISDN_USAGE_MODEM</A>;
|
|
<FONT COLOR="#298C52">int</FONT> si = 7;
|
|
<FONT COLOR="#298C52">int</FONT> l2 = m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>];
|
|
<A HREF="../includes/isdnif.h.shtml#isdn_ctrl">isdn_ctrl</A> cmd;
|
|
ulong flags;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
<FONT COLOR="#298C52">int</FONT> j;
|
|
|
|
<FONT COLOR="#298C52">for</FONT> (j = 7; j >= 0; j--)
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] & (1 << j)) {
|
|
si = bit2si[j];
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (si == 1) {
|
|
l2 = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_TRANS">ISDN_PROTO_L2_TRANS</A>;
|
|
usg = <A HREF="../includes/isdn.h.shtml#ISDN_USAGE_VOICE">ISDN_USAGE_VOICE</A>;
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
m->mdmreg[<A HREF="#REG_SI1I">REG_SI1I</A>] = si2bit[si];
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
i = <A HREF="isdn_common.c.shtml#isdn_get_free_channel">isdn_get_free_channel</A>(usg, l2, m->mdmreg[<A HREF="#REG_L3PROT">REG_L3PROT</A>], -1, -1);
|
|
<FONT COLOR="#298C52">if</FONT> (i < 0) {
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(6, info);
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
info->isdn_driver = dev->drvmap[i];
|
|
info->isdn_channel = dev->chanmap[i];
|
|
info->drv_index = i;
|
|
dev->m_idx[i] = info->line;
|
|
dev->usage[i] |= <A HREF="../includes/isdn.h.shtml#ISDN_USAGE_OUTGOING">ISDN_USAGE_OUTGOING</A>;
|
|
info->last_dir = 1;
|
|
strcpy(info->last_num, n);
|
|
<A HREF="isdn_common.c.shtml#isdn_info_update">isdn_info_update</A>();
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.arg = info->isdn_channel;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_CLREAZ">ISDN_CMD_CLREAZ</A>;
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
strcpy(cmd.parm.num, <A HREF="isdn_common.c.shtml#isdn_map_eaz2msn">isdn_map_eaz2msn</A>(m->msn, info->isdn_driver));
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_SETEAZ">ISDN_CMD_SETEAZ</A>;
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_SETL2">ISDN_CMD_SETL2</A>;
|
|
info->last_l2 = l2;
|
|
cmd.arg = info->isdn_channel + (l2 << 8);
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_SETL3">ISDN_CMD_SETL3</A>;
|
|
cmd.arg = info->isdn_channel + (m->mdmreg[<A HREF="#REG_L3PROT">REG_L3PROT</A>] << 8);
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.arg = info->isdn_channel;
|
|
sprintf(cmd.parm.setup.<A HREF="isdn_common.c.shtml#phone">phone</A>, <FONT COLOR="#FF0000">"%s"</FONT>, n);
|
|
sprintf(cmd.parm.setup.eazmsn, <FONT COLOR="#FF0000">"%s"</FONT>,
|
|
<A HREF="isdn_common.c.shtml#isdn_map_eaz2msn">isdn_map_eaz2msn</A>(m->msn, info->isdn_driver));
|
|
cmd.parm.setup.si1 = si;
|
|
cmd.parm.setup.si2 = m->mdmreg[<A HREF="#REG_SI2">REG_SI2</A>];
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_DIAL">ISDN_CMD_DIAL</A>;
|
|
info->dialing = 1;
|
|
strcpy(dev->num[i], n);
|
|
<A HREF="isdn_common.c.shtml#isdn_info_update">isdn_info_update</A>();
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
}
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* isdn_tty_hangup() disassociates a tty from the real
|
|
* ISDN-line (hangup). The usage-status is cleared
|
|
* and some cleanup is done also.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_modem_hup">isdn_tty_modem_hup</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, <FONT COLOR="#298C52">int</FONT> local)
|
|
{
|
|
<A HREF="../includes/isdnif.h.shtml#isdn_ctrl">isdn_ctrl</A> cmd;
|
|
<FONT COLOR="#298C52">int</FONT> usage;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (!info)
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_HUP
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Mhup ttyI%d\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
info->rcvsched = 0;
|
|
<A HREF="#isdn_tty_flush_buffer">isdn_tty_flush_buffer</A>(info->tty);
|
|
<FONT COLOR="#298C52">if</FONT> (info->online) {
|
|
info->last_lhup = local;
|
|
info->online = 0;
|
|
<FONT COLOR=#0000FF>/* NO CARRIER message */</FONT>
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(3, info);
|
|
}
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
info->vonline = 0;
|
|
<FONT COLOR="#298C52">if</FONT> (info-><A HREF="isdn_audio.h.shtml#dtmf_state">dtmf_state</A>) {
|
|
kfree(info-><A HREF="isdn_audio.h.shtml#dtmf_state">dtmf_state</A>);
|
|
info-><A HREF="isdn_audio.h.shtml#dtmf_state">dtmf_state</A> = NULL;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (info->adpcms) {
|
|
kfree(info->adpcms);
|
|
info->adpcms = NULL;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (info->adpcmr) {
|
|
kfree(info->adpcmr);
|
|
info->adpcmr = NULL;
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((info->msr & UART_MSR_RI) &&
|
|
(info->emu.mdmreg[<A HREF="#REG_RUNG">REG_RUNG</A>] & <A HREF="#BIT_RUNG">BIT_RUNG</A>))
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(12, info);
|
|
info->msr &= ~(UART_MSR_DCD | UART_MSR_RI);
|
|
info->lsr |= UART_LSR_TEMT;
|
|
<FONT COLOR="#298C52">if</FONT> (info->isdn_driver >= 0) {
|
|
<FONT COLOR="#298C52">if</FONT> (local) {
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_HANGUP">ISDN_CMD_HANGUP</A>;
|
|
cmd.arg = info->isdn_channel;
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
}
|
|
<A HREF="isdn_common.c.shtml#isdn_all_eaz">isdn_all_eaz</A>(info->isdn_driver, info->isdn_channel);
|
|
info->emu.mdmreg[<A HREF="#REG_RINGCNT">REG_RINGCNT</A>] = 0;
|
|
usage = (info->emu.mdmreg[<A HREF="#REG_SI1I">REG_SI1I</A>] == 1) ?
|
|
<A HREF="../includes/isdn.h.shtml#ISDN_USAGE_VOICE">ISDN_USAGE_VOICE</A> : <A HREF="../includes/isdn.h.shtml#ISDN_USAGE_MODEM">ISDN_USAGE_MODEM</A>;
|
|
<A HREF="isdn_common.c.shtml#isdn_free_channel">isdn_free_channel</A>(info->isdn_driver, info->isdn_channel,
|
|
usage);
|
|
}
|
|
info->isdn_driver = -1;
|
|
info->isdn_channel = -1;
|
|
<FONT COLOR="#298C52">if</FONT> (info->drv_index >= 0) {
|
|
dev->m_idx[info->drv_index] = -1;
|
|
info->drv_index = -1;
|
|
}
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Begin of a CAPI like interface, currently used only for
|
|
* supplementary service (CAPI 2.0 part III)
|
|
*/</FONT>
|
|
<FONT COLOR=#A521F7>#include</FONT> <FONT COLOR="#FF0000">"avmb1/capicmd.h"</FONT> <FONT COLOR=#0000FF>/* this should be moved in a common place */</FONT>
|
|
|
|
<FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_capi_facility">isdn_tty_capi_facility</A>(<A HREF="../includes/isdnif.h.shtml#capi_msg">capi_msg</A> *cm) {
|
|
<FONT COLOR="#298C52">return</FONT>(-1); <FONT COLOR=#0000FF>/* dummy */</FONT>
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* isdn_tty_suspend() tries to suspend the current tty connection
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A HREF="#isdn_tty_suspend">isdn_tty_suspend</A>(<FONT COLOR="#298C52">char</FONT> *id, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, <A HREF="../includes/isdn.h.shtml#atemu">atemu</A> * m)
|
|
{
|
|
<A HREF="../includes/isdnif.h.shtml#isdn_ctrl">isdn_ctrl</A> cmd;
|
|
|
|
<FONT COLOR="#298C52">int</FONT> l;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (!info)
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_SERVICES
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Msusp ttyI%d\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
l = strlen(id);
|
|
<FONT COLOR="#298C52">if</FONT> ((info->isdn_driver >= 0) && l) {
|
|
cmd.parm.cmsg.Length = l+17;
|
|
cmd.parm.cmsg.Command = CAPI_FACILITY;
|
|
cmd.parm.cmsg.Subcommand = CAPI_REQ;
|
|
cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1;
|
|
cmd.parm.cmsg.para[0] = 3; <FONT COLOR=#0000FF>/* 16 bit 0x0003 suplementary service */</FONT>
|
|
cmd.parm.cmsg.para[1] = 0;
|
|
cmd.parm.cmsg.para[2] = l + 3;
|
|
cmd.parm.cmsg.para[3] = 4; <FONT COLOR=#0000FF>/* 16 bit 0x0004 Suspend */</FONT>
|
|
cmd.parm.cmsg.para[4] = 0;
|
|
cmd.parm.cmsg.para[5] = l;
|
|
strncpy(&cmd.parm.cmsg.para[6], id, l);
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#CAPI_PUT_MESSAGE">CAPI_PUT_MESSAGE</A>;
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.arg = info->isdn_channel;
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
}
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* isdn_tty_resume() tries to resume a suspended call
|
|
* setup of the lower levels before that. unfortunatly here is no
|
|
* checking for compatibility of used protocols implemented by Q931
|
|
* It does the same things like isdn_tty_dial, the last command
|
|
* is different, may be we can merge it.
|
|
*/</FONT>
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A HREF="#isdn_tty_resume">isdn_tty_resume</A>(<FONT COLOR="#298C52">char</FONT> *id, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, <A HREF="../includes/isdn.h.shtml#atemu">atemu</A> * m)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> usg = <A HREF="../includes/isdn.h.shtml#ISDN_USAGE_MODEM">ISDN_USAGE_MODEM</A>;
|
|
<FONT COLOR="#298C52">int</FONT> si = 7;
|
|
<FONT COLOR="#298C52">int</FONT> l2 = m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>];
|
|
<A HREF="../includes/isdnif.h.shtml#isdn_ctrl">isdn_ctrl</A> cmd;
|
|
ulong flags;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
<FONT COLOR="#298C52">int</FONT> j;
|
|
<FONT COLOR="#298C52">int</FONT> l;
|
|
|
|
l = strlen(id);
|
|
<FONT COLOR="#298C52">if</FONT> (!l) {
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(4, info);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">for</FONT> (j = 7; j >= 0; j--)
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] & (1 << j)) {
|
|
si = bit2si[j];
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (si == 1) {
|
|
l2 = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_TRANS">ISDN_PROTO_L2_TRANS</A>;
|
|
usg = <A HREF="../includes/isdn.h.shtml#ISDN_USAGE_VOICE">ISDN_USAGE_VOICE</A>;
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
m->mdmreg[<A HREF="#REG_SI1I">REG_SI1I</A>] = si2bit[si];
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
i = <A HREF="isdn_common.c.shtml#isdn_get_free_channel">isdn_get_free_channel</A>(usg, l2, m->mdmreg[<A HREF="#REG_L3PROT">REG_L3PROT</A>], -1, -1);
|
|
<FONT COLOR="#298C52">if</FONT> (i < 0) {
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(6, info);
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
info->isdn_driver = dev->drvmap[i];
|
|
info->isdn_channel = dev->chanmap[i];
|
|
info->drv_index = i;
|
|
dev->m_idx[i] = info->line;
|
|
dev->usage[i] |= <A HREF="../includes/isdn.h.shtml#ISDN_USAGE_OUTGOING">ISDN_USAGE_OUTGOING</A>;
|
|
info->last_dir = 1;
|
|
<FONT COLOR=#0000FF>// strcpy(info->last_num, n);</FONT>
|
|
<A HREF="isdn_common.c.shtml#isdn_info_update">isdn_info_update</A>();
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.arg = info->isdn_channel;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_CLREAZ">ISDN_CMD_CLREAZ</A>;
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
strcpy(cmd.parm.num, <A HREF="isdn_common.c.shtml#isdn_map_eaz2msn">isdn_map_eaz2msn</A>(m->msn, info->isdn_driver));
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_SETEAZ">ISDN_CMD_SETEAZ</A>;
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_SETL2">ISDN_CMD_SETL2</A>;
|
|
info->last_l2 = l2;
|
|
cmd.arg = info->isdn_channel + (l2 << 8);
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_SETL3">ISDN_CMD_SETL3</A>;
|
|
cmd.arg = info->isdn_channel + (m->mdmreg[<A HREF="#REG_L3PROT">REG_L3PROT</A>] << 8);
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.arg = info->isdn_channel;
|
|
cmd.parm.cmsg.Length = l+17;
|
|
cmd.parm.cmsg.Command = CAPI_FACILITY;
|
|
cmd.parm.cmsg.Subcommand = CAPI_REQ;
|
|
cmd.parm.cmsg.adr.Controller = info->isdn_driver + 1;
|
|
cmd.parm.cmsg.para[0] = 3; <FONT COLOR=#0000FF>/* 16 bit 0x0003 suplementary service */</FONT>
|
|
cmd.parm.cmsg.para[1] = 0;
|
|
cmd.parm.cmsg.para[2] = l+3;
|
|
cmd.parm.cmsg.para[3] = 5; <FONT COLOR=#0000FF>/* 16 bit 0x0005 Resume */</FONT>
|
|
cmd.parm.cmsg.para[4] = 0;
|
|
cmd.parm.cmsg.para[5] = l;
|
|
strncpy(&cmd.parm.cmsg.para[6], id, l);
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#CAPI_PUT_MESSAGE">CAPI_PUT_MESSAGE</A>;
|
|
<FONT COLOR=#0000FF>/* info->dialing = 1;
|
|
strcpy(dev->num[i], n);
|
|
isdn_info_update();
|
|
*/</FONT>
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
}
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">inline</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, kdev_t device, <FONT COLOR="#298C52">const</FONT> <FONT COLOR="#298C52">char</FONT> *routine)
|
|
{
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> <A HREF="#MODEM_PARANOIA_CHECK">MODEM_PARANOIA_CHECK</A>
|
|
<FONT COLOR="#298C52">if</FONT> (!info) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: null info_struct for (%d, %d) in %s\n"</FONT>,
|
|
MAJOR(device), MINOR(device), routine);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (info->magic != <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_MAGIC">ISDN_ASYNC_MAGIC</A>) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: bad magic for modem struct (%d, %d) in %s\n"</FONT>,
|
|
MAJOR(device), MINOR(device), routine);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* This routine is called to set the UART divisor registers to match
|
|
* the specified baud rate for a serial port.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_change_speed">isdn_tty_change_speed</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
uint cflag,
|
|
cval,
|
|
fcr,
|
|
quot;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (!info->tty || !info->tty->termios)
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
cflag = info->tty->termios->c_cflag;
|
|
|
|
quot = i = cflag & CBAUD;
|
|
<FONT COLOR="#298C52">if</FONT> (i & CBAUDEX) {
|
|
i &= ~CBAUDEX;
|
|
<FONT COLOR="#298C52">if</FONT> (i < 1 || i > 2)
|
|
info->tty->termios->c_cflag &= ~CBAUDEX;
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
i += 15;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (quot) {
|
|
info->mcr |= UART_MCR_DTR;
|
|
<A HREF="#isdn_tty_modem_ncarrier">isdn_tty_modem_ncarrier</A>(info);
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
info->mcr &= ~UART_MCR_DTR;
|
|
<FONT COLOR="#298C52">if</FONT> (info->emu.mdmreg[<A HREF="#REG_DTRHUP">REG_DTRHUP</A>] & <A HREF="#BIT_DTRHUP">BIT_DTRHUP</A>) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_HUP
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Mhup in changespeed\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (info->online)
|
|
info->ncarrier = 1;
|
|
<A HREF="#isdn_tty_modem_reset_regs">isdn_tty_modem_reset_regs</A>(info, 0);
|
|
<A HREF="#isdn_tty_modem_hup">isdn_tty_modem_hup</A>(info, 1);
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
<FONT COLOR=#0000FF>/* byte size and parity */</FONT>
|
|
cval = cflag & (CSIZE | CSTOPB);
|
|
cval >>= 4;
|
|
<FONT COLOR="#298C52">if</FONT> (cflag & PARENB)
|
|
cval |= UART_LCR_PARITY;
|
|
<FONT COLOR="#298C52">if</FONT> (!(cflag & PARODD))
|
|
cval |= UART_LCR_EPAR;
|
|
fcr = 0;
|
|
|
|
<FONT COLOR=#0000FF>/* CTS flow control flag and modem status interrupts */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (cflag & CRTSCTS) {
|
|
info->flags |= <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CTS_FLOW">ISDN_ASYNC_CTS_FLOW</A>;
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
info->flags &= ~<A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CTS_FLOW">ISDN_ASYNC_CTS_FLOW</A>;
|
|
<FONT COLOR="#298C52">if</FONT> (cflag & CLOCAL)
|
|
info->flags &= ~<A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CHECK_CD">ISDN_ASYNC_CHECK_CD</A>;
|
|
<FONT COLOR="#298C52">else</FONT> {
|
|
info->flags |= <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CHECK_CD">ISDN_ASYNC_CHECK_CD</A>;
|
|
}
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_startup">isdn_tty_startup</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
ulong flags;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_INITIALIZED">ISDN_ASYNC_INITIALIZED</A>)
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
<A HREF="isdn_common.c.shtml#isdn_MOD_INC_USE_COUNT">isdn_MOD_INC_USE_COUNT</A>();
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"starting up ttyi%d ...\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR=#0000FF>/*
|
|
* Now, initialize the UART
|
|
*/</FONT>
|
|
info->mcr = UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2;
|
|
<FONT COLOR="#298C52">if</FONT> (info->tty)
|
|
clear_bit(TTY_IO_ERROR, &info->tty->flags);
|
|
<FONT COLOR=#0000FF>/*
|
|
* and set the speed of the serial port
|
|
*/</FONT>
|
|
<A HREF="#isdn_tty_change_speed">isdn_tty_change_speed</A>(info);
|
|
|
|
info->flags |= <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_INITIALIZED">ISDN_ASYNC_INITIALIZED</A>;
|
|
info->msr |= (UART_MSR_DSR | UART_MSR_CTS);
|
|
info->send_outstanding = 0;
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* This routine will shutdown a serial port; interrupts are disabled, and
|
|
* DTR is dropped if the hangup on close termio flag is on.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_shutdown">isdn_tty_shutdown</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
ulong flags;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (!(info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_INITIALIZED">ISDN_ASYNC_INITIALIZED</A>))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Shutting down isdnmodem port %d ....\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>(); <FONT COLOR=#0000FF>/* Disable interrupts */</FONT>
|
|
<A HREF="isdn_common.c.shtml#isdn_MOD_DEC_USE_COUNT">isdn_MOD_DEC_USE_COUNT</A>();
|
|
info->msr &= ~UART_MSR_RI;
|
|
<FONT COLOR="#298C52">if</FONT> (!info->tty || (info->tty->termios->c_cflag & HUPCL)) {
|
|
info->mcr &= ~(UART_MCR_DTR | UART_MCR_RTS);
|
|
<FONT COLOR="#298C52">if</FONT> (info->emu.mdmreg[<A HREF="#REG_DTRHUP">REG_DTRHUP</A>] & <A HREF="#BIT_DTRHUP">BIT_DTRHUP</A>) {
|
|
<A HREF="#isdn_tty_modem_reset_regs">isdn_tty_modem_reset_regs</A>(info, 0);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_HUP
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Mhup in isdn_tty_shutdown\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_modem_hup">isdn_tty_modem_hup</A>(info, 1);
|
|
}
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (info->tty)
|
|
set_bit(TTY_IO_ERROR, &info->tty->flags);
|
|
|
|
info->flags &= ~<A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_INITIALIZED">ISDN_ASYNC_INITIALIZED</A>;
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* isdn_tty_write() is the main send-routine. It is called from the upper
|
|
* levels within the kernel to perform sending data. Depending on the
|
|
* online-flag it either directs output to the at-command-interpreter or
|
|
* to the lower level. Additional tasks done here:
|
|
* - If online, check for escape-sequence (+++)
|
|
* - If sending audio-data, call isdn_tty_DLEdown() to parse DLE-codes.
|
|
* - If receiving audio-data, call isdn_tty_end_vrx() to abort if needed.
|
|
* - If dialing, abort dial.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_write">isdn_tty_write</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty, <FONT COLOR="#298C52">int</FONT> from_user, <FONT COLOR="#298C52">const</FONT> u_char * buf, <FONT COLOR="#298C52">int</FONT> count)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> c;
|
|
<FONT COLOR="#298C52">int</FONT> total = 0;
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_write"</FONT>))
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">if</FONT> (!tty)
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">if</FONT> (from_user)
|
|
down(&info->write_sem);
|
|
<FONT COLOR=#0000FF>/* See isdn_tty_senddown() */</FONT>
|
|
atomic_inc(&info->xmit_lock);
|
|
<FONT COLOR="#298C52">while</FONT> (1) {
|
|
c = <A HREF="isdn_hybrid.c.shtml#MIN">MIN</A>(count, info->xmit_size - info->xmit_count);
|
|
<FONT COLOR="#298C52">if</FONT> (info->isdn_driver >= 0)
|
|
c = <A HREF="isdn_hybrid.c.shtml#MIN">MIN</A>(c, dev->drv[info->isdn_driver]->maxbufsize);
|
|
<FONT COLOR="#298C52">if</FONT> (c <= 0)
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">if</FONT> ((info->online > 1)
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
|| (info->vonline & 3)
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
) {
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (!info->vonline)
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_check_esc">isdn_tty_check_esc</A>(buf, m->mdmreg[<A HREF="#REG_ESC">REG_ESC</A>], c,
|
|
&(m->pluscount),
|
|
&(m->lastplus),
|
|
from_user);
|
|
<FONT COLOR="#298C52">if</FONT> (from_user)
|
|
copy_from_user(&(info->xmit_buf[info->xmit_count]), buf, c);
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
memcpy(&(info->xmit_buf[info->xmit_count]), buf, c);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (info->vonline) {
|
|
<FONT COLOR="#298C52">int</FONT> cc = <A HREF="#isdn_tty_handleDLEdown">isdn_tty_handleDLEdown</A>(info, m, c);
|
|
<FONT COLOR="#298C52">if</FONT> (info->vonline & 2) {
|
|
<FONT COLOR="#298C52">if</FONT> (!cc) {
|
|
<FONT COLOR=#0000FF>/* If DLE decoding results in zero-transmit, but
|
|
* c originally was non-zero, do a wakeup.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
|
|
tty->ldisc.write_wakeup)
|
|
(tty->ldisc.write_wakeup) (tty);
|
|
wake_up_interruptible(&tty->write_wait);
|
|
info->msr |= UART_MSR_CTS;
|
|
info->lsr |= UART_LSR_TEMT;
|
|
}
|
|
info->xmit_count += cc;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> ((info->vonline & 3) == 1) {
|
|
<FONT COLOR=#0000FF>/* Do NOT handle Ctrl-Q or Ctrl-S
|
|
* when in full-duplex audio mode.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_end_vrx">isdn_tty_end_vrx</A>(buf, c, from_user)) {
|
|
info->vonline &= ~1;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_VOICE
|
|
printk(KERN_DEBUG
|
|
<FONT COLOR="#FF0000">"got !^Q/^S, send DLE-ETX,VCON on ttyI%d\n"</FONT>,
|
|
info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\020\003\r\nVCON\r\n"</FONT>, info);
|
|
}
|
|
}
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
info->xmit_count += c;
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
info->msr |= UART_MSR_CTS;
|
|
info->lsr |= UART_LSR_TEMT;
|
|
<FONT COLOR="#298C52">if</FONT> (info->dialing) {
|
|
info->dialing = 0;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_HUP
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Mhup in isdn_tty_write\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(3, info);
|
|
<A HREF="#isdn_tty_modem_hup">isdn_tty_modem_hup</A>(info, 1);
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
c = <A HREF="#isdn_tty_edit_at">isdn_tty_edit_at</A>(buf, c, info, from_user);
|
|
}
|
|
buf += c;
|
|
count -= c;
|
|
total += c;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> ((info->xmit_count) || (skb_queue_len(&info->xmit_queue)))
|
|
<A HREF="isdn_common.c.shtml#isdn_timer_ctrl">isdn_timer_ctrl</A>(<A HREF="../includes/isdn.h.shtml#ISDN_TIMER_MODEMXMIT">ISDN_TIMER_MODEMXMIT</A>, 1);
|
|
atomic_dec(&info->xmit_lock);
|
|
<FONT COLOR="#298C52">if</FONT> (from_user)
|
|
up(&info->write_sem);
|
|
<FONT COLOR="#298C52">return</FONT> total;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_write_room">isdn_tty_write_room</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
<FONT COLOR="#298C52">int</FONT> ret;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_write_room"</FONT>))
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">if</FONT> (!info->online)
|
|
<FONT COLOR="#298C52">return</FONT> info->xmit_size;
|
|
ret = info->xmit_size - info->xmit_count;
|
|
<FONT COLOR="#298C52">return</FONT> (ret < 0) ? 0 : ret;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_chars_in_buffer">isdn_tty_chars_in_buffer</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_chars_in_buffer"</FONT>))
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">if</FONT> (!info->online)
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">return</FONT> (info->xmit_count);
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_flush_buffer">isdn_tty_flush_buffer</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info;
|
|
<FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">long</FONT> flags;
|
|
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
<FONT COLOR="#298C52">if</FONT> (!tty) {
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_flush_buffer"</FONT>)) {
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
<A HREF="#isdn_tty_cleanup_xmit">isdn_tty_cleanup_xmit</A>(info);
|
|
info->xmit_count = 0;
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
wake_up_interruptible(&tty->write_wait);
|
|
<FONT COLOR="#298C52">if</FONT> ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
|
|
tty->ldisc.write_wakeup)
|
|
(tty->ldisc.write_wakeup) (tty);
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_flush_chars">isdn_tty_flush_chars</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_flush_chars"</FONT>))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">if</FONT> ((info->xmit_count) || (skb_queue_len(&info->xmit_queue)))
|
|
<A HREF="isdn_common.c.shtml#isdn_timer_ctrl">isdn_timer_ctrl</A>(<A HREF="../includes/isdn.h.shtml#ISDN_TIMER_MODEMXMIT">ISDN_TIMER_MODEMXMIT</A>, 1);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* ------------------------------------------------------------
|
|
* isdn_tty_throttle()
|
|
*
|
|
* This routine is called by the upper-layer tty layer to signal that
|
|
* incoming characters should be throttled.
|
|
* ------------------------------------------------------------
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_throttle">isdn_tty_throttle</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_throttle"</FONT>))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">if</FONT> (I_IXOFF(tty))
|
|
info->x_char = STOP_CHAR(tty);
|
|
info->mcr &= ~UART_MCR_RTS;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_unthrottle">isdn_tty_unthrottle</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_unthrottle"</FONT>))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">if</FONT> (I_IXOFF(tty)) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->x_char)
|
|
info->x_char = 0;
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
info->x_char = START_CHAR(tty);
|
|
}
|
|
info->mcr |= UART_MCR_RTS;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* ------------------------------------------------------------
|
|
* isdn_tty_ioctl() and friends
|
|
* ------------------------------------------------------------
|
|
*/</FONT>
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* isdn_tty_get_lsr_info - get line status register info
|
|
*
|
|
* Purpose: Let user call ioctl() to get info when the UART physically
|
|
* is emptied. On bus types like RS485, the transmitter must
|
|
* release the bus after transmitting. This must be done when
|
|
* the transmit shift register is empty, not be done when the
|
|
* transmit holding register is empty. This functionality
|
|
* allows RS485 driver to be written in user space.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_get_lsr_info">isdn_tty_get_lsr_info</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, uint * value)
|
|
{
|
|
u_char status;
|
|
uint result;
|
|
ulong flags;
|
|
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
status = info->lsr;
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
result = ((status & UART_LSR_TEMT) ? TIOCSER_TEMT : 0);
|
|
put_user(result, (uint *) value);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_get_modem_info">isdn_tty_get_modem_info</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, uint * value)
|
|
{
|
|
u_char control,
|
|
status;
|
|
uint result;
|
|
ulong flags;
|
|
|
|
control = info->mcr;
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
status = info->msr;
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
result = ((control & UART_MCR_RTS) ? TIOCM_RTS : 0)
|
|
| ((control & UART_MCR_DTR) ? TIOCM_DTR : 0)
|
|
| ((status & UART_MSR_DCD) ? TIOCM_CAR : 0)
|
|
| ((status & UART_MSR_RI) ? TIOCM_RNG : 0)
|
|
| ((status & UART_MSR_DSR) ? TIOCM_DSR : 0)
|
|
| ((status & UART_MSR_CTS) ? TIOCM_CTS : 0);
|
|
put_user(result, (uint *) value);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_set_modem_info">isdn_tty_set_modem_info</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, uint cmd, uint * value)
|
|
{
|
|
uint arg;
|
|
<FONT COLOR="#298C52">int</FONT> pre_dtr;
|
|
|
|
get_user(arg, (uint *) value);
|
|
<FONT COLOR="#298C52">switch</FONT> (cmd) {
|
|
<FONT COLOR="#298C52">case</FONT> TIOCMBIS:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_IOCTL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"ttyI%d ioctl TIOCMBIS\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (arg & TIOCM_RTS) {
|
|
info->mcr |= UART_MCR_RTS;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (arg & TIOCM_DTR) {
|
|
info->mcr |= UART_MCR_DTR;
|
|
<A HREF="#isdn_tty_modem_ncarrier">isdn_tty_modem_ncarrier</A>(info);
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> TIOCMBIC:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_IOCTL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"ttyI%d ioctl TIOCMBIC\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (arg & TIOCM_RTS) {
|
|
info->mcr &= ~UART_MCR_RTS;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (arg & TIOCM_DTR) {
|
|
info->mcr &= ~UART_MCR_DTR;
|
|
<FONT COLOR="#298C52">if</FONT> (info->emu.mdmreg[<A HREF="#REG_DTRHUP">REG_DTRHUP</A>] & <A HREF="#BIT_DTRHUP">BIT_DTRHUP</A>) {
|
|
<A HREF="#isdn_tty_modem_reset_regs">isdn_tty_modem_reset_regs</A>(info, 0);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_HUP
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Mhup in TIOCMBIC\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (info->online)
|
|
info->ncarrier = 1;
|
|
<A HREF="#isdn_tty_modem_hup">isdn_tty_modem_hup</A>(info, 1);
|
|
}
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> TIOCMSET:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_IOCTL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"ttyI%d ioctl TIOCMSET\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
pre_dtr = (info->mcr & UART_MCR_DTR);
|
|
info->mcr = ((info->mcr & ~(UART_MCR_RTS | UART_MCR_DTR))
|
|
| ((arg & TIOCM_RTS) ? UART_MCR_RTS : 0)
|
|
| ((arg & TIOCM_DTR) ? UART_MCR_DTR : 0));
|
|
<FONT COLOR="#298C52">if</FONT> (pre_dtr |= (info->mcr & UART_MCR_DTR)) {
|
|
<FONT COLOR="#298C52">if</FONT> (!(info->mcr & UART_MCR_DTR)) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->emu.mdmreg[<A HREF="#REG_DTRHUP">REG_DTRHUP</A>] & <A HREF="#BIT_DTRHUP">BIT_DTRHUP</A>) {
|
|
<A HREF="#isdn_tty_modem_reset_regs">isdn_tty_modem_reset_regs</A>(info, 0);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_HUP
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Mhup in TIOCMSET\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (info->online)
|
|
info->ncarrier = 1;
|
|
<A HREF="#isdn_tty_modem_hup">isdn_tty_modem_hup</A>(info, 1);
|
|
}
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
<A HREF="#isdn_tty_modem_ncarrier">isdn_tty_modem_ncarrier</A>(info);
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<FONT COLOR="#298C52">return</FONT> -EINVAL;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_ioctl">isdn_tty_ioctl</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty, <FONT COLOR="#298C52">struct</FONT> file *file,
|
|
uint cmd, ulong arg)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
<FONT COLOR="#298C52">int</FONT> error;
|
|
<FONT COLOR="#298C52">int</FONT> retval;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_ioctl"</FONT>))
|
|
<FONT COLOR="#298C52">return</FONT> -ENODEV;
|
|
<FONT COLOR="#298C52">if</FONT> (tty->flags & (1 << TTY_IO_ERROR))
|
|
<FONT COLOR="#298C52">return</FONT> -EIO;
|
|
<FONT COLOR="#298C52">switch</FONT> (cmd) {
|
|
<FONT COLOR="#298C52">case</FONT> TCSBRK: <FONT COLOR=#0000FF>/* SVID version: non-zero arg --> no break */</FONT>
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_IOCTL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"ttyI%d ioctl TCSBRK\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
retval = tty_check_change(tty);
|
|
<FONT COLOR="#298C52">if</FONT> (retval)
|
|
<FONT COLOR="#298C52">return</FONT> retval;
|
|
tty_wait_until_sent(tty, 0);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">case</FONT> TCSBRKP: <FONT COLOR=#0000FF>/* support for POSIX tcsendbreak() */</FONT>
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_IOCTL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"ttyI%d ioctl TCSBRKP\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
retval = tty_check_change(tty);
|
|
<FONT COLOR="#298C52">if</FONT> (retval)
|
|
<FONT COLOR="#298C52">return</FONT> retval;
|
|
tty_wait_until_sent(tty, 0);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">case</FONT> TIOCGSOFTCAR:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_IOCTL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"ttyI%d ioctl TIOCGSOFTCAR\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
error = verify_area(VERIFY_WRITE, (<FONT COLOR="#298C52">void</FONT> *) arg, <FONT COLOR="#298C52">sizeof</FONT>(<FONT COLOR="#298C52">long</FONT>));
|
|
<FONT COLOR="#298C52">if</FONT> (error)
|
|
<FONT COLOR="#298C52">return</FONT> error;
|
|
put_user(C_CLOCAL(tty) ? 1 : 0, (ulong *) arg);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">case</FONT> TIOCSSOFTCAR:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_IOCTL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"ttyI%d ioctl TIOCSSOFTCAR\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
error = verify_area(VERIFY_READ, (<FONT COLOR="#298C52">void</FONT> *) arg, <FONT COLOR="#298C52">sizeof</FONT>(<FONT COLOR="#298C52">long</FONT>));
|
|
<FONT COLOR="#298C52">if</FONT> (error)
|
|
<FONT COLOR="#298C52">return</FONT> error;
|
|
get_user(arg, (ulong *) arg);
|
|
tty->termios->c_cflag =
|
|
((tty->termios->c_cflag & ~CLOCAL) |
|
|
(arg ? CLOCAL : 0));
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">case</FONT> TIOCMGET:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_IOCTL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"ttyI%d ioctl TIOCMGET\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
error = verify_area(VERIFY_WRITE, (<FONT COLOR="#298C52">void</FONT> *) arg, <FONT COLOR="#298C52">sizeof</FONT>(uint));
|
|
<FONT COLOR="#298C52">if</FONT> (error)
|
|
<FONT COLOR="#298C52">return</FONT> error;
|
|
<FONT COLOR="#298C52">return</FONT> <A HREF="#isdn_tty_get_modem_info">isdn_tty_get_modem_info</A>(info, (uint *) arg);
|
|
<FONT COLOR="#298C52">case</FONT> TIOCMBIS:
|
|
<FONT COLOR="#298C52">case</FONT> TIOCMBIC:
|
|
<FONT COLOR="#298C52">case</FONT> TIOCMSET:
|
|
error = verify_area(VERIFY_READ, (<FONT COLOR="#298C52">void</FONT> *) arg, <FONT COLOR="#298C52">sizeof</FONT>(uint));
|
|
<FONT COLOR="#298C52">if</FONT> (error)
|
|
<FONT COLOR="#298C52">return</FONT> error;
|
|
<FONT COLOR="#298C52">return</FONT> <A HREF="#isdn_tty_set_modem_info">isdn_tty_set_modem_info</A>(info, cmd, (uint *) arg);
|
|
<FONT COLOR="#298C52">case</FONT> TIOCSERGETLSR: <FONT COLOR=#0000FF>/* Get line status register */</FONT>
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_IOCTL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"ttyI%d ioctl TIOCSERGETLSR\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
error = verify_area(VERIFY_WRITE, (<FONT COLOR="#298C52">void</FONT> *) arg, <FONT COLOR="#298C52">sizeof</FONT>(uint));
|
|
<FONT COLOR="#298C52">if</FONT> (error)
|
|
<FONT COLOR="#298C52">return</FONT> error;
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> <A HREF="#isdn_tty_get_lsr_info">isdn_tty_get_lsr_info</A>(info, (uint *) arg);
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_IOCTL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"UNKNOWN ioctl 0x%08x on ttyi%d\n"</FONT>, cmd, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> -ENOIOCTLCMD;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A HREF="#isdn_tty_set_termios">isdn_tty_set_termios</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty, <FONT COLOR="#298C52">struct</FONT> termios *old_termios)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (!old_termios)
|
|
<A HREF="#isdn_tty_change_speed">isdn_tty_change_speed</A>(info);
|
|
<FONT COLOR="#298C52">else</FONT> {
|
|
<FONT COLOR="#298C52">if</FONT> (tty->termios->c_cflag == old_termios->c_cflag)
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<A HREF="#isdn_tty_change_speed">isdn_tty_change_speed</A>(info);
|
|
<FONT COLOR="#298C52">if</FONT> ((old_termios->c_cflag & CRTSCTS) &&
|
|
!(tty->termios->c_cflag & CRTSCTS)) {
|
|
tty->hw_stopped = 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* ------------------------------------------------------------
|
|
* isdn_tty_open() and friends
|
|
* ------------------------------------------------------------
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_block_til_ready">isdn_tty_block_til_ready</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty, <FONT COLOR="#298C52">struct</FONT> file *filp, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<FONT COLOR="#298C52">struct</FONT> wait_queue wait =
|
|
{current, NULL};
|
|
<FONT COLOR="#298C52">int</FONT> do_clocal = 0;
|
|
<FONT COLOR="#298C52">unsigned</FONT> <FONT COLOR="#298C52">long</FONT> flags;
|
|
<FONT COLOR="#298C52">int</FONT> retval;
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* If the device is in the middle of being closed, then block
|
|
* until it's done, and then try again.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (tty_hung_up_p(filp) ||
|
|
(info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CLOSING">ISDN_ASYNC_CLOSING</A>)) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CLOSING">ISDN_ASYNC_CLOSING</A>)
|
|
interruptible_sleep_on(&info->close_wait);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> <A HREF="#MODEM_DO_RESTART">MODEM_DO_RESTART</A>
|
|
<FONT COLOR="#298C52">if</FONT> (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_HUP_NOTIFY">ISDN_ASYNC_HUP_NOTIFY</A>)
|
|
<FONT COLOR="#298C52">return</FONT> -EAGAIN;
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> -ERESTARTSYS;
|
|
<FONT COLOR=#A521F7>#else</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> -EAGAIN;
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
}
|
|
<FONT COLOR=#0000FF>/*
|
|
* If this is a callout device, then just make sure the normal
|
|
* device isn't being used.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (tty-><A HREF="../includes/isdn.h.shtml#driver">driver</A>.subtype == <A HREF="../includes/isdn.h.shtml#ISDN_SERIAL_TYPE_CALLOUT">ISDN_SERIAL_TYPE_CALLOUT</A>) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_NORMAL_ACTIVE">ISDN_ASYNC_NORMAL_ACTIVE</A>)
|
|
<FONT COLOR="#298C52">return</FONT> -EBUSY;
|
|
<FONT COLOR="#298C52">if</FONT> ((info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A>) &&
|
|
(info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_SESSION_LOCKOUT">ISDN_ASYNC_SESSION_LOCKOUT</A>) &&
|
|
(info->session != current->session))
|
|
<FONT COLOR="#298C52">return</FONT> -EBUSY;
|
|
<FONT COLOR="#298C52">if</FONT> ((info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A>) &&
|
|
(info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_PGRP_LOCKOUT">ISDN_ASYNC_PGRP_LOCKOUT</A>) &&
|
|
(info->pgrp != current->pgrp))
|
|
<FONT COLOR="#298C52">return</FONT> -EBUSY;
|
|
info->flags |= <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A>;
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR=#0000FF>/*
|
|
* If non-blocking mode is set, then make the check up front
|
|
* and then exit.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((filp->f_flags & O_NONBLOCK) ||
|
|
(tty->flags & (1 << TTY_IO_ERROR))) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A>)
|
|
<FONT COLOR="#298C52">return</FONT> -EBUSY;
|
|
info->flags |= <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_NORMAL_ACTIVE">ISDN_ASYNC_NORMAL_ACTIVE</A>;
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A>) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->normal_termios.c_cflag & CLOCAL)
|
|
do_clocal = 1;
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
<FONT COLOR="#298C52">if</FONT> (tty->termios->c_cflag & CLOCAL)
|
|
do_clocal = 1;
|
|
}
|
|
<FONT COLOR=#0000FF>/*
|
|
* Block waiting for the carrier detect and the line to become
|
|
* free (i.e., not in use by the callout). While we are in
|
|
* this loop, info->count is dropped by one, so that
|
|
* isdn_tty_close() knows when to free things. We restore it upon
|
|
* exit, either normal or abnormal.
|
|
*/</FONT>
|
|
retval = 0;
|
|
add_wait_queue(&info->open_wait, &wait);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_block_til_ready before block: ttyi%d, count = %d\n"</FONT>,
|
|
info->line, info->count);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
<FONT COLOR="#298C52">if</FONT> (!(tty_hung_up_p(filp)))
|
|
info->count--;
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
info->blocked_open++;
|
|
<FONT COLOR="#298C52">while</FONT> (1) {
|
|
current->state = TASK_INTERRUPTIBLE;
|
|
<FONT COLOR="#298C52">if</FONT> (tty_hung_up_p(filp) ||
|
|
!(info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_INITIALIZED">ISDN_ASYNC_INITIALIZED</A>)) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> <A HREF="#MODEM_DO_RESTART">MODEM_DO_RESTART</A>
|
|
<FONT COLOR="#298C52">if</FONT> (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_HUP_NOTIFY">ISDN_ASYNC_HUP_NOTIFY</A>)
|
|
retval = -EAGAIN;
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
retval = -ERESTARTSYS;
|
|
<FONT COLOR=#A521F7>#else</FONT>
|
|
retval = -EAGAIN;
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!(info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A>) &&
|
|
!(info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CLOSING">ISDN_ASYNC_CLOSING</A>) &&
|
|
(do_clocal || (info->msr & UART_MSR_DCD))) {
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (signal_pending(current)) {
|
|
retval = -ERESTARTSYS;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_block_til_ready blocking: ttyi%d, count = %d\n"</FONT>,
|
|
info->line, info->count);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
schedule();
|
|
}
|
|
current->state = TASK_RUNNING;
|
|
remove_wait_queue(&info->open_wait, &wait);
|
|
<FONT COLOR="#298C52">if</FONT> (!tty_hung_up_p(filp))
|
|
info->count++;
|
|
info->blocked_open--;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_block_til_ready after blocking: ttyi%d, count = %d\n"</FONT>,
|
|
info->line, info->count);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (retval)
|
|
<FONT COLOR="#298C52">return</FONT> retval;
|
|
info->flags |= <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_NORMAL_ACTIVE">ISDN_ASYNC_NORMAL_ACTIVE</A>;
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* This routine is called whenever a serial port is opened. It
|
|
* enables interrupts for a serial port, linking in its async structure into
|
|
* the IRQ chain. It also performs the serial-specific
|
|
* initialization for the tty structure.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_open">isdn_tty_open</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty, <FONT COLOR="#298C52">struct</FONT> file *filp)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info;
|
|
<FONT COLOR="#298C52">int</FONT> retval,
|
|
line;
|
|
|
|
line = MINOR(tty->device) - tty-><A HREF="../includes/isdn.h.shtml#driver">driver</A>.minor_start;
|
|
<FONT COLOR="#298C52">if</FONT> (line < 0 || line > <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>)
|
|
<FONT COLOR="#298C52">return</FONT> -ENODEV;
|
|
info = &dev->mdm.info[line];
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_open"</FONT>))
|
|
<FONT COLOR="#298C52">return</FONT> -ENODEV;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_open %s%d, count = %d\n"</FONT>, tty-><A HREF="../includes/isdn.h.shtml#driver">driver</A>.<A HREF="isdn_common.c.shtml#name">name</A>,
|
|
info->line, info->count);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
info->count++;
|
|
tty->driver_data = info;
|
|
info->tty = tty;
|
|
<FONT COLOR=#0000FF>/*
|
|
* Start up serial port
|
|
*/</FONT>
|
|
retval = <A HREF="#isdn_tty_startup">isdn_tty_startup</A>(info);
|
|
<FONT COLOR="#298C52">if</FONT> (retval) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_open return after startup\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> retval;
|
|
}
|
|
retval = <A HREF="#isdn_tty_block_til_ready">isdn_tty_block_til_ready</A>(tty, filp, info);
|
|
<FONT COLOR="#298C52">if</FONT> (retval) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_open return after isdn_tty_block_til_ready \n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> retval;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> ((info->count == 1) && (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_SPLIT_TERMIOS">ISDN_ASYNC_SPLIT_TERMIOS</A>)) {
|
|
<FONT COLOR="#298C52">if</FONT> (tty-><A HREF="../includes/isdn.h.shtml#driver">driver</A>.subtype == <A HREF="../includes/isdn.h.shtml#ISDN_SERIAL_TYPE_NORMAL">ISDN_SERIAL_TYPE_NORMAL</A>)
|
|
*tty->termios = info->normal_termios;
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
*tty->termios = info->callout_termios;
|
|
<A HREF="#isdn_tty_change_speed">isdn_tty_change_speed</A>(info);
|
|
}
|
|
info->session = current->session;
|
|
info->pgrp = current->pgrp;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_open ttyi%d successful...\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
dev->modempoll++;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_open normal exit\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A HREF="#isdn_tty_close">isdn_tty_close</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty, <FONT COLOR="#298C52">struct</FONT> file *filp)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
ulong flags;
|
|
ulong timeout;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (!info || <A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_close"</FONT>))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
<FONT COLOR="#298C52">if</FONT> (tty_hung_up_p(filp)) {
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_close return after tty_hung_up_p\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> ((tty->count == 1) && (info->count != 1)) {
|
|
<FONT COLOR=#0000FF>/*
|
|
* Uh, oh. tty->count is 1, which means that the tty
|
|
* structure will be freed. Info->count should always
|
|
* be one in these conditions. If it's greater than
|
|
* one, we've got real problems, since it means the
|
|
* serial port won't be shutdown.
|
|
*/</FONT>
|
|
printk(KERN_ERR <FONT COLOR="#FF0000">"isdn_tty_close: bad port count; tty->count is 1, "</FONT>
|
|
<FONT COLOR="#FF0000">"info->count is %d\n"</FONT>, info->count);
|
|
info->count = 1;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (--info->count < 0) {
|
|
printk(KERN_ERR <FONT COLOR="#FF0000">"isdn_tty_close: bad port count for ttyi%d: %d\n"</FONT>,
|
|
info->line, info->count);
|
|
info->count = 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (info->count) {
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_close after info->count != 0\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
info->flags |= <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CLOSING">ISDN_ASYNC_CLOSING</A>;
|
|
<FONT COLOR=#0000FF>/*
|
|
* Save the termios structure, since this port may have
|
|
* separate termios for callout and dialin.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_NORMAL_ACTIVE">ISDN_ASYNC_NORMAL_ACTIVE</A>)
|
|
info->normal_termios = *tty->termios;
|
|
<FONT COLOR="#298C52">if</FONT> (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A>)
|
|
info->callout_termios = *tty->termios;
|
|
|
|
tty->closing = 1;
|
|
<FONT COLOR=#0000FF>/*
|
|
* At this point we stop accepting input. To do this, we
|
|
* disable the receive line status interrupts, and tell the
|
|
* interrupt driver to stop checking the data ready bit in the
|
|
* line status register.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_INITIALIZED">ISDN_ASYNC_INITIALIZED</A>) {
|
|
tty_wait_until_sent(tty, 3000); <FONT COLOR=#0000FF>/* 30 seconds timeout */</FONT>
|
|
<FONT COLOR=#0000FF>/*
|
|
* Before we drop DTR, make sure the UART transmitter
|
|
* has completely drained; this is especially
|
|
* important if there is a transmit FIFO!
|
|
*/</FONT>
|
|
timeout = jiffies + HZ;
|
|
<FONT COLOR="#298C52">while</FONT> (!(info->lsr & UART_LSR_TEMT)) {
|
|
current->state = TASK_INTERRUPTIBLE;
|
|
current->timeout = jiffies + 20;
|
|
schedule();
|
|
<FONT COLOR="#298C52">if</FONT> (jiffies > timeout)
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
}
|
|
dev->modempoll--;
|
|
<A HREF="#isdn_tty_shutdown">isdn_tty_shutdown</A>(info);
|
|
<FONT COLOR="#298C52">if</FONT> (tty-><A HREF="../includes/isdn.h.shtml#driver">driver</A>.flush_buffer)
|
|
tty-><A HREF="../includes/isdn.h.shtml#driver">driver</A>.flush_buffer(tty);
|
|
<FONT COLOR="#298C52">if</FONT> (tty->ldisc.flush_buffer)
|
|
tty->ldisc.flush_buffer(tty);
|
|
info->tty = 0;
|
|
info->ncarrier = 0;
|
|
tty->closing = 0;
|
|
<FONT COLOR="#298C52">if</FONT> (info->blocked_open) {
|
|
current->state = TASK_INTERRUPTIBLE;
|
|
current->timeout = jiffies + 50;
|
|
schedule();
|
|
wake_up_interruptible(&info->open_wait);
|
|
}
|
|
info->flags &= ~(<A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_NORMAL_ACTIVE">ISDN_ASYNC_NORMAL_ACTIVE</A> | <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A> |
|
|
<A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CLOSING">ISDN_ASYNC_CLOSING</A>);
|
|
wake_up_interruptible(&info->close_wait);
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_OPEN
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_close normal exit\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* isdn_tty_hangup() --- called by tty_hangup() when a hangup is signaled.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_hangup">isdn_tty_hangup</A>(<FONT COLOR="#298C52">struct</FONT> tty_struct *tty)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = (<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *) tty->driver_data;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_paranoia_check">isdn_tty_paranoia_check</A>(info, tty->device, <FONT COLOR="#FF0000">"isdn_tty_hangup"</FONT>))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<A HREF="#isdn_tty_shutdown">isdn_tty_shutdown</A>(info);
|
|
info->count = 0;
|
|
info->flags &= ~(<A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_NORMAL_ACTIVE">ISDN_ASYNC_NORMAL_ACTIVE</A> | <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A>);
|
|
info->tty = 0;
|
|
wake_up_interruptible(&info->open_wait);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* This routine initializes all emulator-data.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_reset_profile">isdn_tty_reset_profile</A>(<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> * m)
|
|
{
|
|
m->profile[0] = 0;
|
|
m->profile[1] = 0;
|
|
m->profile[2] = 43;
|
|
m->profile[3] = 13;
|
|
m->profile[4] = 10;
|
|
m->profile[5] = 8;
|
|
m->profile[6] = 3;
|
|
m->profile[7] = 60;
|
|
m->profile[8] = 2;
|
|
m->profile[9] = 6;
|
|
m->profile[10] = 7;
|
|
m->profile[11] = 70;
|
|
m->profile[12] = 0x45;
|
|
m->profile[13] = 4;
|
|
m->profile[14] = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75I">ISDN_PROTO_L2_X75I</A>;
|
|
m->profile[15] = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L3_TRANS">ISDN_PROTO_L3_TRANS</A>;
|
|
m->profile[16] = <A HREF="../includes/isdn.h.shtml#ISDN_SERIAL_XMIT_SIZE">ISDN_SERIAL_XMIT_SIZE</A> / 16;
|
|
m->profile[17] = <A HREF="../includes/isdn.h.shtml#ISDN_MODEM_WINSIZE">ISDN_MODEM_WINSIZE</A>;
|
|
m->profile[18] = 4;
|
|
m->profile[19] = 0;
|
|
m->profile[20] = 0;
|
|
m->pmsn[0] = <FONT COLOR="#FF0000">'\0'</FONT>;
|
|
m->plmsn[0] = <FONT COLOR="#FF0000">'\0'</FONT>;
|
|
}
|
|
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_modem_reset_vpar">isdn_tty_modem_reset_vpar</A>(<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> * m)
|
|
{
|
|
m->vpar[0] = 2; <FONT COLOR=#0000FF>/* Voice-device (2 = phone line) */</FONT>
|
|
m->vpar[1] = 0; <FONT COLOR=#0000FF>/* Silence detection level (0 = none ) */</FONT>
|
|
m->vpar[2] = 70; <FONT COLOR=#0000FF>/* Silence interval (7 sec. ) */</FONT>
|
|
m->vpar[3] = 2; <FONT COLOR=#0000FF>/* Compression type (1 = ADPCM-2 ) */</FONT>
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A HREF="#isdn_tty_modem_reset_regs">isdn_tty_modem_reset_regs</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, <FONT COLOR="#298C52">int</FONT> force)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<FONT COLOR="#298C52">if</FONT> ((m->mdmreg[<A HREF="#REG_DTRR">REG_DTRR</A>] & <A HREF="#BIT_DTRR">BIT_DTRR</A>) || force) {
|
|
memcpy(m->mdmreg, m->profile, <A HREF="../includes/isdn.h.shtml#ISDN_MODEM_ANZREG">ISDN_MODEM_ANZREG</A>);
|
|
memcpy(m->msn, m->pmsn, <A HREF="../includes/isdn.h.shtml#ISDN_MSNLEN">ISDN_MSNLEN</A>);
|
|
memcpy(m->lmsn, m->plmsn, <A HREF="../includes/isdn.h.shtml#ISDN_LMSNLEN">ISDN_LMSNLEN</A>);
|
|
info->xmit_size = m->mdmreg[<A HREF="#REG_PSIZE">REG_PSIZE</A>] * 16;
|
|
}
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<A HREF="#isdn_tty_modem_reset_vpar">isdn_tty_modem_reset_vpar</A>(m);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
m->mdmcmdl = 0;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="modem_write_profile">modem_write_profile</A>(<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> * m)
|
|
{
|
|
memcpy(m->profile, m->mdmreg, <A HREF="../includes/isdn.h.shtml#ISDN_MODEM_ANZREG">ISDN_MODEM_ANZREG</A>);
|
|
memcpy(m->pmsn, m->msn, <A HREF="../includes/isdn.h.shtml#ISDN_MSNLEN">ISDN_MSNLEN</A>);
|
|
memcpy(m->plmsn, m->lmsn, <A HREF="../includes/isdn.h.shtml#ISDN_LMSNLEN">ISDN_LMSNLEN</A>);
|
|
<FONT COLOR="#298C52">if</FONT> (dev->profd)
|
|
send_sig(SIGIO, dev->profd, 1);
|
|
}
|
|
|
|
<FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_modem_init">isdn_tty_modem_init</A>(<FONT COLOR="#298C52">void</FONT>)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#modem">modem</A> *m;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info;
|
|
|
|
m = &dev->mdm;
|
|
memset(&m->tty_modem, 0, <FONT COLOR="#298C52">sizeof</FONT>(<FONT COLOR="#298C52">struct</FONT> tty_driver));
|
|
m->tty_modem.magic = TTY_DRIVER_MAGIC;
|
|
m->tty_modem.<A HREF="isdn_common.c.shtml#name">name</A> = isdn_ttyname_ttyI;
|
|
m->tty_modem.major = <A HREF="../includes/isdn.h.shtml#ISDN_TTY_MAJOR">ISDN_TTY_MAJOR</A>;
|
|
m->tty_modem.minor_start = 0;
|
|
m->tty_modem.num = <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>;
|
|
m->tty_modem.type = TTY_DRIVER_TYPE_SERIAL;
|
|
m->tty_modem.subtype = <A HREF="../includes/isdn.h.shtml#ISDN_SERIAL_TYPE_NORMAL">ISDN_SERIAL_TYPE_NORMAL</A>;
|
|
m->tty_modem.init_termios = tty_std_termios;
|
|
m->tty_modem.init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
|
|
m->tty_modem.flags = TTY_DRIVER_REAL_RAW;
|
|
m->tty_modem.refcount = &m->refcount;
|
|
m->tty_modem.table = m->modem_table;
|
|
m->tty_modem.termios = m->modem_termios;
|
|
m->tty_modem.termios_locked = m->modem_termios_locked;
|
|
m->tty_modem.open = <A HREF="#isdn_tty_open">isdn_tty_open</A>;
|
|
m->tty_modem.close = <A HREF="#isdn_tty_close">isdn_tty_close</A>;
|
|
m->tty_modem.write = <A HREF="#isdn_tty_write">isdn_tty_write</A>;
|
|
m->tty_modem.put_char = NULL;
|
|
m->tty_modem.flush_chars = <A HREF="#isdn_tty_flush_chars">isdn_tty_flush_chars</A>;
|
|
m->tty_modem.write_room = <A HREF="#isdn_tty_write_room">isdn_tty_write_room</A>;
|
|
m->tty_modem.chars_in_buffer = <A HREF="#isdn_tty_chars_in_buffer">isdn_tty_chars_in_buffer</A>;
|
|
m->tty_modem.flush_buffer = <A HREF="#isdn_tty_flush_buffer">isdn_tty_flush_buffer</A>;
|
|
m->tty_modem.ioctl = <A HREF="#isdn_tty_ioctl">isdn_tty_ioctl</A>;
|
|
m->tty_modem.throttle = <A HREF="#isdn_tty_throttle">isdn_tty_throttle</A>;
|
|
m->tty_modem.unthrottle = <A HREF="#isdn_tty_unthrottle">isdn_tty_unthrottle</A>;
|
|
m->tty_modem.set_termios = <A HREF="#isdn_tty_set_termios">isdn_tty_set_termios</A>;
|
|
m->tty_modem.stop = NULL;
|
|
m->tty_modem.start = NULL;
|
|
m->tty_modem.hangup = <A HREF="#isdn_tty_hangup">isdn_tty_hangup</A>;
|
|
m->tty_modem.driver_name = <FONT COLOR="#FF0000">"isdn_tty"</FONT>;
|
|
<FONT COLOR=#0000FF>/*
|
|
* The callout device is just like normal device except for
|
|
* major number and the subtype code.
|
|
*/</FONT>
|
|
m->cua_modem = m->tty_modem;
|
|
m->cua_modem.<A HREF="isdn_common.c.shtml#name">name</A> = isdn_ttyname_cui;
|
|
m->cua_modem.major = <A HREF="../includes/isdn.h.shtml#ISDN_TTYAUX_MAJOR">ISDN_TTYAUX_MAJOR</A>;
|
|
m->tty_modem.minor_start = 0;
|
|
m->cua_modem.subtype = <A HREF="../includes/isdn.h.shtml#ISDN_SERIAL_TYPE_CALLOUT">ISDN_SERIAL_TYPE_CALLOUT</A>;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (tty_register_driver(&m->tty_modem)) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: Couldn't register modem-device\n"</FONT>);
|
|
<FONT COLOR="#298C52">return</FONT> -1;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (tty_register_driver(&m->cua_modem)) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: Couldn't register modem-callout-device\n"</FONT>);
|
|
<FONT COLOR="#298C52">return</FONT> -2;
|
|
}
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>; i++) {
|
|
info = &m->info[i];
|
|
info->write_sem = MUTEX;
|
|
sprintf(info->last_cause, <FONT COLOR="#FF0000">"0000"</FONT>);
|
|
sprintf(info->last_num, <FONT COLOR="#FF0000">"none"</FONT>);
|
|
info->last_dir = 0;
|
|
info->last_lhup = 1;
|
|
info->last_l2 = -1;
|
|
info->last_si = 0;
|
|
<A HREF="#isdn_tty_reset_profile">isdn_tty_reset_profile</A>(&info->emu);
|
|
<A HREF="#isdn_tty_modem_reset_regs">isdn_tty_modem_reset_regs</A>(info, 1);
|
|
info->magic = <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_MAGIC">ISDN_ASYNC_MAGIC</A>;
|
|
info->line = i;
|
|
info->tty = 0;
|
|
info->x_char = 0;
|
|
info->count = 0;
|
|
info->blocked_open = 0;
|
|
info->callout_termios = m->cua_modem.init_termios;
|
|
info->normal_termios = m->tty_modem.init_termios;
|
|
info->open_wait = 0;
|
|
info->close_wait = 0;
|
|
info->isdn_driver = -1;
|
|
info->isdn_channel = -1;
|
|
info->drv_index = -1;
|
|
info->xmit_size = <A HREF="../includes/isdn.h.shtml#ISDN_SERIAL_XMIT_SIZE">ISDN_SERIAL_XMIT_SIZE</A>;
|
|
skb_queue_head_init(&info->xmit_queue);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
skb_queue_head_init(&info->dtmf_queue);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (!(info->xmit_buf = kmalloc(<A HREF="../includes/isdn.h.shtml#ISDN_SERIAL_XMIT_MAX">ISDN_SERIAL_XMIT_MAX</A> + 5, GFP_KERNEL))) {
|
|
printk(KERN_ERR <FONT COLOR="#FF0000">"Could not allocate modem xmit-buffer\n"</FONT>);
|
|
<FONT COLOR="#298C52">return</FONT> -3;
|
|
}
|
|
<FONT COLOR=#0000FF>/* Make room for T.70 header */</FONT>
|
|
info->xmit_buf += 4;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_match_icall">isdn_tty_match_icall</A>(<FONT COLOR="#298C52">char</FONT> *cid, <A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *emu, <FONT COLOR="#298C52">int</FONT> di)
|
|
{
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_ICALL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"m_fi: msn=%s lmsn=%s mmsn=%s mreg[SI1]=%d mreg[SI2]=%d\n"</FONT>,
|
|
emu->msn, emu->lmsn, <A HREF="isdn_common.c.shtml#isdn_map_eaz2msn">isdn_map_eaz2msn</A>(emu->msn, di),
|
|
emu->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>], emu->mdmreg[<A HREF="#REG_SI2">REG_SI2</A>]);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (strlen(emu->lmsn)) {
|
|
<FONT COLOR="#298C52">char</FONT> *p = emu->lmsn;
|
|
<FONT COLOR="#298C52">char</FONT> *q;
|
|
<FONT COLOR="#298C52">int</FONT> tmp;
|
|
<FONT COLOR="#298C52">int</FONT> ret = 0;
|
|
|
|
<FONT COLOR="#298C52">while</FONT> (1) {
|
|
<FONT COLOR="#298C52">if</FONT> ((q = strchr(p, <FONT COLOR="#FF0000">';'</FONT>)))
|
|
*q = <FONT COLOR="#FF0000">'\0'</FONT>;
|
|
<FONT COLOR="#298C52">if</FONT> ((tmp = <A HREF="isdn_common.c.shtml#isdn_wildmat">isdn_wildmat</A>(cid, <A HREF="isdn_common.c.shtml#isdn_map_eaz2msn">isdn_map_eaz2msn</A>(p, di))) > ret)
|
|
ret = tmp;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_ICALL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"m_fi: lmsnX=%s mmsn=%s -> tmp=%d\n"</FONT>,
|
|
p, <A HREF="isdn_common.c.shtml#isdn_map_eaz2msn">isdn_map_eaz2msn</A>(emu->msn, di), tmp);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (q) {
|
|
*q = <FONT COLOR="#FF0000">';'</FONT>;
|
|
p = q;
|
|
p++;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!tmp)
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">if</FONT> (!q)
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> ret;
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> <A HREF="isdn_common.c.shtml#isdn_wildmat">isdn_wildmat</A>(cid, <A HREF="isdn_common.c.shtml#isdn_map_eaz2msn">isdn_map_eaz2msn</A>(emu->msn, di));
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* An incoming call-request has arrived.
|
|
* Search the tty-devices for an appropriate device and bind
|
|
* it to the ISDN-Channel.
|
|
* Return:
|
|
*
|
|
* 0 = No matching device found.
|
|
* 1 = A matching device found.
|
|
* 3 = No match found, but eventually would match, if
|
|
* CID is longer.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_find_icall">isdn_tty_find_icall</A>(<FONT COLOR="#298C52">int</FONT> di, <FONT COLOR="#298C52">int</FONT> ch, <A HREF="../includes/isdnif.h.shtml#setup_parm">setup_parm</A> setup)
|
|
{
|
|
<FONT COLOR="#298C52">char</FONT> *eaz;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
<FONT COLOR="#298C52">int</FONT> wret;
|
|
<FONT COLOR="#298C52">int</FONT> idx;
|
|
<FONT COLOR="#298C52">int</FONT> si1;
|
|
<FONT COLOR="#298C52">int</FONT> si2;
|
|
<FONT COLOR="#298C52">char</FONT> nr[32];
|
|
ulong flags;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (!setup.<A HREF="isdn_common.c.shtml#phone">phone</A>[0]) {
|
|
nr[0] = <FONT COLOR="#FF0000">'0'</FONT>;
|
|
nr[1] = <FONT COLOR="#FF0000">'\0'</FONT>;
|
|
printk(KERN_INFO <FONT COLOR="#FF0000">"isdn_tty: Incoming call without OAD, assuming '0'\n"</FONT>);
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
strcpy(nr, setup.<A HREF="isdn_common.c.shtml#phone">phone</A>);
|
|
si1 = (<FONT COLOR="#298C52">int</FONT>) setup.si1;
|
|
si2 = (<FONT COLOR="#298C52">int</FONT>) setup.si2;
|
|
<FONT COLOR="#298C52">if</FONT> (!setup.eazmsn[0]) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: Incoming call without CPN, assuming '0'\n"</FONT>);
|
|
eaz = <FONT COLOR="#FF0000">"0"</FONT>;
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
eaz = setup.eazmsn;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_ICALL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"m_fi: eaz=%s si1=%d si2=%d\n"</FONT>, eaz, si1, si2);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
wret = 0;
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>; i++) {
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = &dev->mdm.info[i];
|
|
|
|
<FONT COLOR="#298C52">if</FONT> ((info->emu.mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] & si2bit[si1]) && <FONT COLOR=#0000FF>/* SI1 is matching */</FONT>
|
|
(info->emu.mdmreg[<A HREF="#REG_SI2">REG_SI2</A>] == si2)) { <FONT COLOR=#0000FF>/* SI2 is matching */</FONT>
|
|
idx = <A HREF="isdn_common.c.shtml#isdn_dc2minor">isdn_dc2minor</A>(di, ch);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_ICALL
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"m_fi: match1\n"</FONT>);
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"m_fi: idx=%d flags=%08lx drv=%d ch=%d usg=%d\n"</FONT>, idx,
|
|
info->flags, info->isdn_driver, info->isdn_channel,
|
|
dev->usage[idx]);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (
|
|
<FONT COLOR=#A521F7>#ifndef</FONT> <A HREF="#FIX_FILE_TRANSFER">FIX_FILE_TRANSFER</A>
|
|
(info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_NORMAL_ACTIVE">ISDN_ASYNC_NORMAL_ACTIVE</A>) &&
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
(info->isdn_driver == -1) &&
|
|
(info->isdn_channel == -1) &&
|
|
(<A HREF="../includes/isdn.h.shtml#USG_NONE">USG_NONE</A>(dev->usage[idx]))) {
|
|
<FONT COLOR="#298C52">int</FONT> matchret;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> ((matchret = <A HREF="#isdn_tty_match_icall">isdn_tty_match_icall</A>(eaz, &info->emu, di)) > wret)
|
|
wret = matchret;
|
|
<FONT COLOR="#298C52">if</FONT> (!matchret) { <FONT COLOR=#0000FF>/* EAZ is matching */</FONT>
|
|
info->isdn_driver = di;
|
|
info->isdn_channel = ch;
|
|
info->drv_index = idx;
|
|
dev->m_idx[idx] = info->line;
|
|
dev->usage[idx] &= <A HREF="../includes/isdn.h.shtml#ISDN_USAGE_EXCLUSIVE">ISDN_USAGE_EXCLUSIVE</A>;
|
|
dev->usage[idx] |= (si1 == 1) ? <A HREF="../includes/isdn.h.shtml#ISDN_USAGE_VOICE">ISDN_USAGE_VOICE</A> : <A HREF="../includes/isdn.h.shtml#ISDN_USAGE_MODEM">ISDN_USAGE_MODEM</A>;
|
|
strcpy(dev->num[idx], nr);
|
|
strcpy(info->emu.cpn, eaz);
|
|
info->emu.mdmreg[<A HREF="#REG_SI1I">REG_SI1I</A>] = si2bit[si1];
|
|
info->emu.mdmreg[<A HREF="#REG_PLAN">REG_PLAN</A>] = setup.plan;
|
|
info->emu.mdmreg[<A HREF="#REG_SCREEN">REG_SCREEN</A>] = setup.screen;
|
|
<A HREF="isdn_common.c.shtml#isdn_info_update">isdn_info_update</A>();
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
printk(KERN_INFO <FONT COLOR="#FF0000">"isdn_tty: call from %s, -> RING on ttyI%d\n"</FONT>, nr,
|
|
info->line);
|
|
info->msr |= UART_MSR_RI;
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(2, info);
|
|
<A HREF="isdn_common.c.shtml#isdn_timer_ctrl">isdn_timer_ctrl</A>(<A HREF="../includes/isdn.h.shtml#ISDN_TIMER_MODEMRING">ISDN_TIMER_MODEMRING</A>, 1);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
printk(KERN_INFO <FONT COLOR="#FF0000">"isdn_tty: call from %s -> %s %s\n"</FONT>, nr, eaz,
|
|
(dev->drv[di]->reject_bus && (wret != 2))? <FONT COLOR="#FF0000">"rejected"</FONT> : <FONT COLOR="#FF0000">"ignored"</FONT>);
|
|
<FONT COLOR="#298C52">return</FONT> (wret == 2)?3:0;
|
|
}
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A HREF="#TTY_IS_ACTIVE">TTY_IS_ACTIVE</A>(info) \
|
|
(info->flags & (<A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_NORMAL_ACTIVE">ISDN_ASYNC_NORMAL_ACTIVE</A> | <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A>))
|
|
|
|
<FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_stat_callback">isdn_tty_stat_callback</A>(<FONT COLOR="#298C52">int</FONT> i, <A HREF="../includes/isdnif.h.shtml#isdn_ctrl">isdn_ctrl</A> * c)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> mi;
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info;
|
|
<FONT COLOR="#298C52">char</FONT> *e;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (i < 0)
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">if</FONT> ((mi = dev->m_idx[i]) >= 0) {
|
|
info = &dev->mdm.info[mi];
|
|
<FONT COLOR="#298C52">switch</FONT> (c->command) {
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_STAT_CINF">ISDN_STAT_CINF</A>:
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"CHARGEINFO on ttyI%d: %ld %s\n"</FONT>, info->line, c->arg, c->parm.num);
|
|
info->emu.charge = (<FONT COLOR="#298C52">unsigned</FONT>) simple_strtoul(c->parm.num, &e, 10);
|
|
<FONT COLOR="#298C52">if</FONT> (e == (<FONT COLOR="#298C52">char</FONT> *)c->parm.num)
|
|
info->emu.charge = 0;
|
|
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_STAT_BSENT">ISDN_STAT_BSENT</A>:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_TTY_STAT_DEBUG
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"tty_STAT_BSENT ttyI%d\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((info->isdn_driver == c-><A HREF="../includes/isdn.h.shtml#driver">driver</A>) &&
|
|
(info->isdn_channel == c->arg)) {
|
|
info->msr |= UART_MSR_CTS;
|
|
<FONT COLOR="#298C52">if</FONT> (info->send_outstanding)
|
|
<FONT COLOR="#298C52">if</FONT> (!(--info->send_outstanding))
|
|
info->lsr |= UART_LSR_TEMT;
|
|
<A HREF="#isdn_tty_tint">isdn_tty_tint</A>(info);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_STAT_CAUSE">ISDN_STAT_CAUSE</A>:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_TTY_STAT_DEBUG
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"tty_STAT_CAUSE ttyI%d\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR=#0000FF>/* Signal cause to tty-device */</FONT>
|
|
strncpy(info->last_cause, c->parm.num, 5);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_STAT_DCONN">ISDN_STAT_DCONN</A>:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_TTY_STAT_DEBUG
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"tty_STAT_DCONN ttyI%d\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#TTY_IS_ACTIVE">TTY_IS_ACTIVE</A>(info)) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->dialing == 1) {
|
|
info->dialing = 2;
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_STAT_DHUP">ISDN_STAT_DHUP</A>:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_TTY_STAT_DEBUG
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"tty_STAT_DHUP ttyI%d\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#TTY_IS_ACTIVE">TTY_IS_ACTIVE</A>(info)) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->dialing == 1) {
|
|
info->dialing = 0;
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(7, info);
|
|
}
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_HUP
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Mhup in ISDN_STAT_DHUP\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_modem_hup">isdn_tty_modem_hup</A>(info, 0);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_STAT_BCONN">ISDN_STAT_BCONN</A>:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_TTY_STAT_DEBUG
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"tty_STAT_BCONN ttyI%d\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR=#0000FF>/* Schedule CONNECT-Message to any tty
|
|
* waiting for it and
|
|
* set DCD-bit of its modem-status.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#TTY_IS_ACTIVE">TTY_IS_ACTIVE</A>(info)) {
|
|
info->msr |= UART_MSR_DCD;
|
|
info->emu.charge = 0;
|
|
<FONT COLOR="#298C52">if</FONT> (info->dialing) {
|
|
info->dialing = 0;
|
|
info->last_dir = 1;
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
info->last_dir = 0;
|
|
info->rcvsched = 1;
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="../includes/isdn.h.shtml#USG_MODEM">USG_MODEM</A>(dev->usage[i]))
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(5, info);
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="../includes/isdn.h.shtml#USG_VOICE">USG_VOICE</A>(dev->usage[i]))
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(11, info);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_STAT_BHUP">ISDN_STAT_BHUP</A>:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_TTY_STAT_DEBUG
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"tty_STAT_BHUP ttyI%d\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#TTY_IS_ACTIVE">TTY_IS_ACTIVE</A>(info)) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_HUP
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Mhup in ISDN_STAT_BHUP\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_modem_hup">isdn_tty_modem_hup</A>(info, 0);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_STAT_NODCH">ISDN_STAT_NODCH</A>:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_TTY_STAT_DEBUG
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"tty_STAT_NODCH ttyI%d\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#TTY_IS_ACTIVE">TTY_IS_ACTIVE</A>(info)) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->dialing) {
|
|
info->dialing = 0;
|
|
info->last_l2 = -1;
|
|
info->last_si = 0;
|
|
sprintf(info->last_cause, <FONT COLOR="#FF0000">"0000"</FONT>);
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(6, info);
|
|
}
|
|
<A HREF="#isdn_tty_modem_hup">isdn_tty_modem_hup</A>(info, 0);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_STAT_UNLOAD">ISDN_STAT_UNLOAD</A>:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_TTY_STAT_DEBUG
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"tty_STAT_UNLOAD ttyI%d\n"</FONT>, info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>; i++) {
|
|
info = &dev->mdm.info[i];
|
|
<FONT COLOR="#298C52">if</FONT> (info->isdn_driver == c-><A HREF="../includes/isdn.h.shtml#driver">driver</A>) {
|
|
<FONT COLOR="#298C52">if</FONT> (info->online)
|
|
<A HREF="#isdn_tty_modem_hup">isdn_tty_modem_hup</A>(info, 1);
|
|
}
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*********************************************************************
|
|
Modem-Emulator-Routines
|
|
*********************************************************************/</FONT>
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="cmdchar">cmdchar</A>(c) ((c><FONT COLOR="#FF0000">' '</FONT>)&&(c<=0x7f))
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Put a message from the AT-emulator into receive-buffer of tty,
|
|
* convert CR, LF, and BS to values in modem-registers 3, 4 and 5.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#298C52">char</FONT> *msg, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<FONT COLOR="#298C52">struct</FONT> tty_struct *tty;
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<FONT COLOR="#298C52">char</FONT> *p;
|
|
<FONT COLOR="#298C52">char</FONT> c;
|
|
ulong flags;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (!msg) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: Null-Message in isdn_tty_at_cout\n"</FONT>);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
tty = info->tty;
|
|
<FONT COLOR="#298C52">for</FONT> (p = msg; *p; p++) {
|
|
<FONT COLOR="#298C52">switch</FONT> (*p) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'\r'</FONT>:
|
|
c = m->mdmreg[<A HREF="#REG_CR">REG_CR</A>];
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'\n'</FONT>:
|
|
c = m->mdmreg[<A HREF="#REG_LF">REG_LF</A>];
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'\b'</FONT>:
|
|
c = m->mdmreg[<A HREF="#REG_BS">REG_BS</A>];
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
c = *p;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> ((info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CLOSING">ISDN_ASYNC_CLOSING</A>) || (!tty)) {
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (tty->flip.count >= TTY_FLIPBUF_SIZE)
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
tty_insert_flip_char(tty, c, 0);
|
|
}
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
queue_task(&tty->flip.tqueue, &tq_timer);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Perform ATH Hangup
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_on_hook">isdn_tty_on_hook</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<FONT COLOR="#298C52">if</FONT> (info->isdn_channel >= 0) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_HUP
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"Mhup in isdn_tty_on_hook\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_modem_hup">isdn_tty_modem_hup</A>(info, 1);
|
|
}
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_off_hook">isdn_tty_off_hook</A>(<FONT COLOR="#298C52">void</FONT>)
|
|
{
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty_off_hook\n"</FONT>);
|
|
}
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="PLUSWAIT1">PLUSWAIT1</A> (HZ/2) <FONT COLOR=#0000FF>/* 0.5 sec. */</FONT>
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="PLUSWAIT2">PLUSWAIT2</A> (HZ*3/2) <FONT COLOR=#0000FF>/* 1.5 sec */</FONT>
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Check Buffer for Modem-escape-sequence, activate timer-callback to
|
|
* isdn_tty_modem_escape() if sequence found.
|
|
*
|
|
* Parameters:
|
|
* p pointer to databuffer
|
|
* plus escape-character
|
|
* count length of buffer
|
|
* pluscount count of valid escape-characters so far
|
|
* lastplus timestamp of last character
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A HREF="#isdn_tty_check_esc">isdn_tty_check_esc</A>(<FONT COLOR="#298C52">const</FONT> u_char * p, u_char plus, <FONT COLOR="#298C52">int</FONT> count, <FONT COLOR="#298C52">int</FONT> *pluscount,
|
|
<FONT COLOR="#298C52">int</FONT> *lastplus, <FONT COLOR="#298C52">int</FONT> from_user)
|
|
{
|
|
<FONT COLOR="#298C52">char</FONT> cbuf[3];
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (plus > 127)
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">if</FONT> (count > 3) {
|
|
p += count - 3;
|
|
count = 3;
|
|
*pluscount = 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (from_user) {
|
|
copy_from_user(cbuf, p, count);
|
|
p = cbuf;
|
|
}
|
|
<FONT COLOR="#298C52">while</FONT> (count > 0) {
|
|
<FONT COLOR="#298C52">if</FONT> (*(p++) == plus) {
|
|
<FONT COLOR="#298C52">if</FONT> ((*pluscount)++) {
|
|
<FONT COLOR=#0000FF>/* Time since last '+' > 0.5 sec. ? */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((jiffies - *lastplus) > <A HREF="#PLUSWAIT1">PLUSWAIT1</A>)
|
|
*pluscount = 1;
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
<FONT COLOR=#0000FF>/* Time since last non-'+' < 1.5 sec. ? */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((jiffies - *lastplus) < <A HREF="#PLUSWAIT2">PLUSWAIT2</A>)
|
|
*pluscount = 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> ((*pluscount == 3) && (count = 1))
|
|
<A HREF="isdn_common.c.shtml#isdn_timer_ctrl">isdn_timer_ctrl</A>(<A HREF="../includes/isdn.h.shtml#ISDN_TIMER_MODEMPLUS">ISDN_TIMER_MODEMPLUS</A>, 1);
|
|
<FONT COLOR="#298C52">if</FONT> (*pluscount > 3)
|
|
*pluscount = 1;
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
*pluscount = 0;
|
|
*lastplus = jiffies;
|
|
count--;
|
|
}
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Return result of AT-emulator to tty-receive-buffer, depending on
|
|
* modem-register 12, bit 0 and 1.
|
|
* For CONNECT-messages also switch to online-mode.
|
|
* For RING-message handle auto-ATA if register 0 != 0
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(<FONT COLOR="#298C52">int</FONT> code, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">char</FONT> *msg[] =
|
|
{<FONT COLOR="#FF0000">"OK"</FONT>, <FONT COLOR="#FF0000">"CONNECT"</FONT>, <FONT COLOR="#FF0000">"RING"</FONT>, <FONT COLOR="#FF0000">"NO CARRIER"</FONT>, <FONT COLOR="#FF0000">"ERROR"</FONT>,
|
|
<FONT COLOR="#FF0000">"CONNECT 64000"</FONT>, <FONT COLOR="#FF0000">"NO DIALTONE"</FONT>, <FONT COLOR="#FF0000">"BUSY"</FONT>, <FONT COLOR="#FF0000">"NO ANSWER"</FONT>,
|
|
<FONT COLOR="#FF0000">"RINGING"</FONT>, <FONT COLOR="#FF0000">"NO MSN/EAZ"</FONT>, <FONT COLOR="#FF0000">"VCON"</FONT>, <FONT COLOR="#FF0000">"RUNG"</FONT>};
|
|
ulong flags;
|
|
<FONT COLOR="#298C52">char</FONT> s[<A HREF="../includes/isdn.h.shtml#ISDN_MSNLEN">ISDN_MSNLEN</A>+10];
|
|
|
|
<FONT COLOR="#298C52">switch</FONT> (code) {
|
|
<FONT COLOR="#298C52">case</FONT> 2:
|
|
m->mdmreg[<A HREF="#REG_RINGCNT">REG_RINGCNT</A>]++; <FONT COLOR=#0000FF>/* RING */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_RINGCNT">REG_RINGCNT</A>] == m->mdmreg[<A HREF="#REG_RINGATA">REG_RINGATA</A>])
|
|
<FONT COLOR=#0000FF>/* Automatically accept incoming call */</FONT>
|
|
<A HREF="#isdn_tty_cmd_ATA">isdn_tty_cmd_ATA</A>(info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 3:
|
|
<FONT COLOR=#0000FF>/* NO CARRIER */</FONT>
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_HUP
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"modem_result: NO CARRIER %d %d\n"</FONT>,
|
|
(info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CLOSING">ISDN_ASYNC_CLOSING</A>),
|
|
(!info->tty));
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
m->mdmreg[<A HREF="#REG_RINGCNT">REG_RINGCNT</A>] = 0;
|
|
del_timer(&info->nc_timer);
|
|
info->ncarrier = 0;
|
|
<FONT COLOR="#298C52">if</FONT> ((info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CLOSING">ISDN_ASYNC_CLOSING</A>) || (!info->tty)) {
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (info->vonline & 1) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_VOICE
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"res3: send DLE-ETX on ttyI%d\n"</FONT>,
|
|
info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR=#0000FF>/* voice-recording, add DLE-ETX */</FONT>
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\020\003"</FONT>, info);
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (info->vonline & 2) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_VOICE
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"res3: send DLE-DC4 on ttyI%d\n"</FONT>,
|
|
info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR=#0000FF>/* voice-playing, add DLE-DC4 */</FONT>
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\020\024"</FONT>, info);
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 1:
|
|
<FONT COLOR="#298C52">case</FONT> 5:
|
|
sprintf(info->last_cause, <FONT COLOR="#FF0000">"0000"</FONT>);
|
|
<FONT COLOR="#298C52">if</FONT> (!info->online)
|
|
info->online = 2;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 11:
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_MODEM_VOICE
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"res3: send VCON on ttyI%d\n"</FONT>,
|
|
info->line);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
sprintf(info->last_cause, <FONT COLOR="#FF0000">"0000"</FONT>);
|
|
<FONT COLOR="#298C52">if</FONT> (!info->online)
|
|
info->online = 1;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_RESP">REG_RESP</A>] & <A HREF="#BIT_RESP">BIT_RESP</A>) {
|
|
<FONT COLOR=#0000FF>/* Show results */</FONT>
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n"</FONT>, info);
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_RESPNUM">REG_RESPNUM</A>] & <A HREF="#BIT_RESPNUM">BIT_RESPNUM</A>) {
|
|
<FONT COLOR=#0000FF>/* Show numeric results */</FONT>
|
|
sprintf(s, <FONT COLOR="#FF0000">"%d"</FONT>, code);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(s, info);
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
<FONT COLOR="#298C52">if</FONT> ((code == 2) &&
|
|
(m->mdmreg[<A HREF="#REG_RUNG">REG_RUNG</A>] & <A HREF="#BIT_RUNG">BIT_RUNG</A>) &&
|
|
(m->mdmreg[<A HREF="#REG_RINGCNT">REG_RINGCNT</A>] > 1))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">if</FONT> ((code == 2) && (!(m->mdmreg[<A HREF="#REG_CIDONCE">REG_CIDONCE</A>] & <A HREF="#BIT_CIDONCE">BIT_CIDONCE</A>))) {
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"CALLER NUMBER: "</FONT>, info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(dev->num[info->drv_index], info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n"</FONT>, info);
|
|
}
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(msg[code], info);
|
|
<FONT COLOR="#298C52">switch</FONT> (code) {
|
|
<FONT COLOR="#298C52">case</FONT> 2:
|
|
<FONT COLOR=#0000FF>/* Append CPN, if enabled */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((m->mdmreg[<A HREF="#REG_RESRXT">REG_RESRXT</A>] & <A HREF="#BIT_RESRXT">BIT_RESRXT</A>)) {
|
|
sprintf(s, <FONT COLOR="#FF0000">"/%s"</FONT>, m->cpn);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(s, info);
|
|
}
|
|
<FONT COLOR=#0000FF>/* Print CID only once, _after_ 1.st RING */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((m->mdmreg[<A HREF="#REG_CIDONCE">REG_CIDONCE</A>] & <A HREF="#BIT_CIDONCE">BIT_CIDONCE</A>) &&
|
|
(m->mdmreg[<A HREF="#REG_RINGCNT">REG_RINGCNT</A>] == 1)) {
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n"</FONT>, info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"CALLER NUMBER: "</FONT>, info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(dev->num[info->drv_index], info);
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 3:
|
|
<FONT COLOR="#298C52">case</FONT> 6:
|
|
<FONT COLOR="#298C52">case</FONT> 7:
|
|
<FONT COLOR="#298C52">case</FONT> 8:
|
|
m->mdmreg[<A HREF="#REG_RINGCNT">REG_RINGCNT</A>] = 0;
|
|
<FONT COLOR=#0000FF>/* Append Cause-Message if enabled */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_RESPXT">REG_RESPXT</A>] & <A HREF="#BIT_RESPXT">BIT_RESPXT</A>) {
|
|
sprintf(s, <FONT COLOR="#FF0000">"/%s"</FONT>, info->last_cause);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(s, info);
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 5:
|
|
<FONT COLOR=#0000FF>/* Append Protocol to CONNECT message */</FONT>
|
|
<FONT COLOR="#298C52">switch</FONT> (m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>]) {
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75I">ISDN_PROTO_L2_X75I</A>:
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75UI">ISDN_PROTO_L2_X75UI</A>:
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75BUI">ISDN_PROTO_L2_X75BUI</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"/X.75"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_HDLC">ISDN_PROTO_L2_HDLC</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"/HDLC"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11096">ISDN_PROTO_L2_V11096</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"/V110/9600"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11019">ISDN_PROTO_L2_V11019</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"/V110/19200"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11038">ISDN_PROTO_L2_V11038</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"/V110/38400"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_T70">REG_T70</A>] & <A HREF="#BIT_T70">BIT_T70</A>) {
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"/T.70"</FONT>, info);
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_T70">REG_T70</A>] & <A HREF="#BIT_T70_EXT">BIT_T70_EXT</A>)
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"+"</FONT>, info);
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
}
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n"</FONT>, info);
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (code == 3) {
|
|
save_flags(flags);
|
|
<A HREF="kdebug.h.shtml#cli">cli</A>();
|
|
<FONT COLOR="#298C52">if</FONT> ((info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CLOSING">ISDN_ASYNC_CLOSING</A>) || (!info->tty)) {
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (info->tty->ldisc.flush_buffer)
|
|
info->tty->ldisc.flush_buffer(info->tty);
|
|
<FONT COLOR="#298C52">if</FONT> ((info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CHECK_CD">ISDN_ASYNC_CHECK_CD</A>) &&
|
|
(!((info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_ACTIVE">ISDN_ASYNC_CALLOUT_ACTIVE</A>) &&
|
|
(info->flags & <A HREF="../includes/isdn.h.shtml#ISDN_ASYNC_CALLOUT_NOHUP">ISDN_ASYNC_CALLOUT_NOHUP</A>)))) {
|
|
tty_hangup(info->tty);
|
|
}
|
|
<A HREF="kdebug.h.shtml#restore_flags">restore_flags</A>(flags);
|
|
}
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Display a modem-register-value.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A HREF="#isdn_tty_show_profile">isdn_tty_show_profile</A>(<FONT COLOR="#298C52">int</FONT> ridx, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<FONT COLOR="#298C52">char</FONT> v[6];
|
|
|
|
sprintf(v, <FONT COLOR="#FF0000">"\r\n%d"</FONT>, info->emu.mdmreg[ridx]);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(v, info);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Get MSN-string from char-pointer, set pointer to end of number
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_get_msnstr">isdn_tty_get_msnstr</A>(<FONT COLOR="#298C52">char</FONT> *n, <FONT COLOR="#298C52">char</FONT> **p)
|
|
{
|
|
<FONT COLOR="#298C52">while</FONT> ((*p[0] >= <FONT COLOR="#FF0000">'0'</FONT> && *p[0] <= <FONT COLOR="#FF0000">'9'</FONT>) ||
|
|
<FONT COLOR=#0000FF>/* Why a comma ??? */</FONT>
|
|
(*p[0] == <FONT COLOR="#FF0000">','</FONT>))
|
|
*n++ = *p[0]++;
|
|
*n = <FONT COLOR="#FF0000">'\0'</FONT>;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Get phone-number from modem-commandbuffer
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_getdial">isdn_tty_getdial</A>(<FONT COLOR="#298C52">char</FONT> *p, <FONT COLOR="#298C52">char</FONT> *q,<FONT COLOR="#298C52">int</FONT> cnt)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> first = 1;
|
|
<FONT COLOR="#298C52">int</FONT> limit=39; <FONT COLOR=#0000FF>/* MUST match the size in isdn_tty_parse to avoid
|
|
buffer overflow */</FONT>
|
|
|
|
<FONT COLOR="#298C52">while</FONT> (strchr(<FONT COLOR="#FF0000">"0123456789,#.*WPTS-"</FONT>, *p) && *p && --cnt>0) {
|
|
<FONT COLOR="#298C52">if</FONT> ((*p >= <FONT COLOR="#FF0000">'0'</FONT> && *p <= <FONT COLOR="#FF0000">'9'</FONT>) || ((*p == <FONT COLOR="#FF0000">'S'</FONT>) && first))
|
|
*q++ = *p;
|
|
p++;
|
|
<FONT COLOR="#298C52">if</FONT>(!--limit)
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
first = 0;
|
|
}
|
|
*q = 0;
|
|
}
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="PARSE_ERROR">PARSE_ERROR</A> { <A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(4, info); <FONT COLOR="#298C52">return</FONT>; }
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="PARSE_ERROR1">PARSE_ERROR1</A> { <A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(4, info); <FONT COLOR="#298C52">return</FONT> 1; }
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_report">isdn_tty_report</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<FONT COLOR="#298C52">char</FONT> s[80];
|
|
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\nStatistics of last connection:\r\n\r\n"</FONT>, info);
|
|
sprintf(s, <FONT COLOR="#FF0000">" Remote Number: %s\r\n"</FONT>, info->last_num);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(s, info);
|
|
sprintf(s, <FONT COLOR="#FF0000">" Direction: %s\r\n"</FONT>, info->last_dir ? <FONT COLOR="#FF0000">"outgoing"</FONT> : <FONT COLOR="#FF0000">"incoming"</FONT>);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(s, info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">" Layer-2 Protocol: "</FONT>, info);
|
|
<FONT COLOR="#298C52">switch</FONT> (info->last_l2) {
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75I">ISDN_PROTO_L2_X75I</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"X.75i"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75UI">ISDN_PROTO_L2_X75UI</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"X.75ui"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75BUI">ISDN_PROTO_L2_X75BUI</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"X.75bui"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_HDLC">ISDN_PROTO_L2_HDLC</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"HDLC"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11096">ISDN_PROTO_L2_V11096</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"V.110 9600 Baud"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11019">ISDN_PROTO_L2_V11019</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"V.110 19200 Baud"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11038">ISDN_PROTO_L2_V11038</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"V.110 38400 Baud"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_TRANS">ISDN_PROTO_L2_TRANS</A>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"transparent"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"unknown"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_T70">REG_T70</A>] & <A HREF="#BIT_T70">BIT_T70</A>) {
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"/T.70"</FONT>, info);
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_T70">REG_T70</A>] & <A HREF="#BIT_T70_EXT">BIT_T70_EXT</A>)
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"+"</FONT>, info);
|
|
}
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n"</FONT>, info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">" Service: "</FONT>, info);
|
|
<FONT COLOR="#298C52">switch</FONT> (info->last_si) {
|
|
<FONT COLOR="#298C52">case</FONT> 1:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"audio\r\n"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 5:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"btx\r\n"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 7:
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"data\r\n"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
sprintf(s, <FONT COLOR="#FF0000">"%d\r\n"</FONT>, info->last_si);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(s, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
sprintf(s, <FONT COLOR="#FF0000">" Hangup location: %s\r\n"</FONT>, info->last_lhup ? <FONT COLOR="#FF0000">"local"</FONT> : <FONT COLOR="#FF0000">"remote"</FONT>);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(s, info);
|
|
sprintf(s, <FONT COLOR="#FF0000">" Last cause: %s\r\n"</FONT>, info->last_cause);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(s, info);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Parse AT&.. commands.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_cmd_ATand">isdn_tty_cmd_ATand</A>(<FONT COLOR="#298C52">char</FONT> **p, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
<FONT COLOR="#298C52">char</FONT> rb[100];
|
|
|
|
<FONT COLOR=#A521F7>#define</FONT> <A NAME="MAXRB">MAXRB</A> (<FONT COLOR="#298C52">sizeof</FONT>(rb) - 1)
|
|
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'B'</FONT>:
|
|
<FONT COLOR=#0000FF>/* &B - Set Buffersize */</FONT>
|
|
p[0]++;
|
|
i = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">if</FONT> ((i < 0) || (i > <A HREF="../includes/isdn.h.shtml#ISDN_SERIAL_XMIT_MAX">ISDN_SERIAL_XMIT_MAX</A>))
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> ((m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] & 1) && (i > <A HREF="#VBUF">VBUF</A>))
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
m->mdmreg[<A HREF="#REG_PSIZE">REG_PSIZE</A>] = i / 16;
|
|
info->xmit_size = m->mdmreg[<A HREF="#REG_PSIZE">REG_PSIZE</A>] * 16;
|
|
<FONT COLOR="#298C52">switch</FONT> (m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>]) {
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11096">ISDN_PROTO_L2_V11096</A>:
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11019">ISDN_PROTO_L2_V11019</A>:
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11038">ISDN_PROTO_L2_V11038</A>:
|
|
info->xmit_size /= 10;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'D'</FONT>:
|
|
<FONT COLOR=#0000FF>/* &D - Set DCD-Low-behavior */</FONT>
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">switch</FONT> (<A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p)) {
|
|
<FONT COLOR="#298C52">case</FONT> 0:
|
|
m->mdmreg[<A HREF="#REG_DTRHUP">REG_DTRHUP</A>] &= ~<A HREF="#BIT_DTRHUP">BIT_DTRHUP</A>;
|
|
m->mdmreg[<A HREF="#REG_DTRR">REG_DTRR</A>] &= ~<A HREF="#BIT_DTRR">BIT_DTRR</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 2:
|
|
m->mdmreg[<A HREF="#REG_DTRHUP">REG_DTRHUP</A>] |= <A HREF="#BIT_DTRHUP">BIT_DTRHUP</A>;
|
|
m->mdmreg[<A HREF="#REG_DTRR">REG_DTRR</A>] &= ~<A HREF="#BIT_DTRR">BIT_DTRR</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 3:
|
|
m->mdmreg[<A HREF="#REG_DTRHUP">REG_DTRHUP</A>] |= <A HREF="#BIT_DTRHUP">BIT_DTRHUP</A>;
|
|
m->mdmreg[<A HREF="#REG_DTRR">REG_DTRR</A>] |= <A HREF="#BIT_DTRR">BIT_DTRR</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'E'</FONT>:
|
|
<FONT COLOR=#0000FF>/* &E -Set EAZ/MSN */</FONT>
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_get_msnstr">isdn_tty_get_msnstr</A>(m->msn, p);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'F'</FONT>:
|
|
<FONT COLOR=#0000FF>/* &F -Set Factory-Defaults */</FONT>
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_reset_profile">isdn_tty_reset_profile</A>(m);
|
|
<A HREF="#isdn_tty_modem_reset_regs">isdn_tty_modem_reset_regs</A>(info, 1);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'L'</FONT>:
|
|
<FONT COLOR=#0000FF>/* &L -Set Numbers to listen on */</FONT>
|
|
p[0]++;
|
|
i = 0;
|
|
<FONT COLOR="#298C52">while</FONT> ((strchr(<FONT COLOR="#FF0000">"0123456789,*[]?;"</FONT>, *p[0])) &&
|
|
(i < <A HREF="../includes/isdn.h.shtml#ISDN_LMSNLEN">ISDN_LMSNLEN</A>))
|
|
m->lmsn[i++] = *p[0]++;
|
|
m->lmsn[i] = <FONT COLOR="#FF0000">'\0'</FONT>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'R'</FONT>:
|
|
<FONT COLOR=#0000FF>/* &R - Set V.110 bitrate adaption */</FONT>
|
|
p[0]++;
|
|
i = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">switch</FONT> (i) {
|
|
<FONT COLOR="#298C52">case</FONT> 0:
|
|
<FONT COLOR=#0000FF>/* Switch off V.110, back to X.75 */</FONT>
|
|
m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>] = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75I">ISDN_PROTO_L2_X75I</A>;
|
|
m->mdmreg[<A HREF="#REG_SI2">REG_SI2</A>] = 0;
|
|
info->xmit_size = m->mdmreg[<A HREF="#REG_PSIZE">REG_PSIZE</A>] * 16;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 9600:
|
|
m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>] = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11096">ISDN_PROTO_L2_V11096</A>;
|
|
m->mdmreg[<A HREF="#REG_SI2">REG_SI2</A>] = 197;
|
|
info->xmit_size = m->mdmreg[<A HREF="#REG_PSIZE">REG_PSIZE</A>] * 16 / 10;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 19200:
|
|
m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>] = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11019">ISDN_PROTO_L2_V11019</A>;
|
|
m->mdmreg[<A HREF="#REG_SI2">REG_SI2</A>] = 199;
|
|
info->xmit_size = m->mdmreg[<A HREF="#REG_PSIZE">REG_PSIZE</A>] * 16 / 10;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 38400:
|
|
m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>] = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11038">ISDN_PROTO_L2_V11038</A>;
|
|
m->mdmreg[<A HREF="#REG_SI2">REG_SI2</A>] = 198; <FONT COLOR=#0000FF>/* no existing standard for this */</FONT>
|
|
info->xmit_size = m->mdmreg[<A HREF="#REG_PSIZE">REG_PSIZE</A>] * 16 / 10;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR=#0000FF>/* Switch off T.70 */</FONT>
|
|
m->mdmreg[<A HREF="#REG_T70">REG_T70</A>] &= ~(<A HREF="#BIT_T70">BIT_T70</A> | <A HREF="#BIT_T70_EXT">BIT_T70_EXT</A>);
|
|
<FONT COLOR=#0000FF>/* Set Service 7 */</FONT>
|
|
m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] |= 4;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'S'</FONT>:
|
|
<FONT COLOR=#0000FF>/* &S - Set Windowsize */</FONT>
|
|
p[0]++;
|
|
i = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">if</FONT> ((i > 0) && (i < 9))
|
|
m->mdmreg[<A HREF="#REG_WSIZE">REG_WSIZE</A>] = i;
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'V'</FONT>:
|
|
<FONT COLOR=#0000FF>/* &V - Show registers */</FONT>
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n"</FONT>, info);
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < <A HREF="../includes/isdn.h.shtml#ISDN_MODEM_ANZREG">ISDN_MODEM_ANZREG</A>; i++) {
|
|
sprintf(rb, <FONT COLOR="#FF0000">"S%02d=%03d%s"</FONT>, i,
|
|
m->mdmreg[i], ((i + 1) % 10) ? <FONT COLOR="#FF0000">" "</FONT> : <FONT COLOR="#FF0000">"\r\n"</FONT>);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(rb, info);
|
|
}
|
|
sprintf(rb, <FONT COLOR="#FF0000">"\r\nEAZ/MSN: %.50s\r\n"</FONT>,
|
|
strlen(m->msn) ? m->msn : <FONT COLOR="#FF0000">"None"</FONT>);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(rb, info);
|
|
<FONT COLOR="#298C52">if</FONT> (strlen(m->lmsn)) {
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\nListen: "</FONT>, info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(m->lmsn, info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n"</FONT>, info);
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'W'</FONT>:
|
|
<FONT COLOR=#0000FF>/* &W - Write Profile */</FONT>
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'0'</FONT>:
|
|
p[0]++;
|
|
<A HREF="#modem_write_profile">modem_write_profile</A>(m);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'X'</FONT>:
|
|
<FONT COLOR=#0000FF>/* &X - Switch to BTX-Mode and T.70 */</FONT>
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">switch</FONT> (<A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p)) {
|
|
<FONT COLOR="#298C52">case</FONT> 0:
|
|
m->mdmreg[<A HREF="#REG_T70">REG_T70</A>] &= ~(<A HREF="#BIT_T70">BIT_T70</A> | <A HREF="#BIT_T70_EXT">BIT_T70_EXT</A>);
|
|
info->xmit_size = m->mdmreg[<A HREF="#REG_PSIZE">REG_PSIZE</A>] * 16;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 1:
|
|
m->mdmreg[<A HREF="#REG_T70">REG_T70</A>] |= <A HREF="#BIT_T70">BIT_T70</A>;
|
|
m->mdmreg[<A HREF="#REG_T70">REG_T70</A>] &= ~<A HREF="#BIT_T70_EXT">BIT_T70_EXT</A>;
|
|
m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>] = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75I">ISDN_PROTO_L2_X75I</A>;
|
|
info->xmit_size = 112;
|
|
m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] = 4;
|
|
m->mdmreg[<A HREF="#REG_SI2">REG_SI2</A>] = 0;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 2:
|
|
m->mdmreg[<A HREF="#REG_T70">REG_T70</A>] |= (<A HREF="#BIT_T70">BIT_T70</A> | <A HREF="#BIT_T70_EXT">BIT_T70_EXT</A>);
|
|
m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>] = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75I">ISDN_PROTO_L2_X75I</A>;
|
|
info->xmit_size = 112;
|
|
m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] = 4;
|
|
m->mdmreg[<A HREF="#REG_SI2">REG_SI2</A>] = 0;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_check_ats">isdn_tty_check_ats</A>(<FONT COLOR="#298C52">int</FONT> mreg, <FONT COLOR="#298C52">int</FONT> mval, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, <A HREF="../includes/isdn.h.shtml#atemu">atemu</A> * m)
|
|
{
|
|
<FONT COLOR=#0000FF>/* Some plausibility checks */</FONT>
|
|
<FONT COLOR="#298C52">switch</FONT> (mreg) {
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="#REG_L2PROT">REG_L2PROT</A>:
|
|
<FONT COLOR="#298C52">if</FONT> (mval > <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_MAX">ISDN_PROTO_L2_MAX</A>)
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="#REG_PSIZE">REG_PSIZE</A>:
|
|
<FONT COLOR="#298C52">if</FONT> ((mval * 16) > <A HREF="../includes/isdn.h.shtml#ISDN_SERIAL_XMIT_MAX">ISDN_SERIAL_XMIT_MAX</A>)
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> ((m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] & 1) && (mval > <A HREF="#VBUFX">VBUFX</A>))
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
info->xmit_size = mval * 16;
|
|
<FONT COLOR="#298C52">switch</FONT> (m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>]) {
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11096">ISDN_PROTO_L2_V11096</A>:
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11019">ISDN_PROTO_L2_V11019</A>:
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_V11038">ISDN_PROTO_L2_V11038</A>:
|
|
info->xmit_size /= 10;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="#REG_SI1I">REG_SI1I</A>:
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="#REG_PLAN">REG_PLAN</A>:
|
|
<FONT COLOR="#298C52">case</FONT> <A HREF="#REG_SCREEN">REG_SCREEN</A>:
|
|
<FONT COLOR=#0000FF>/* readonly registers */</FONT>
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Perform ATS command
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_cmd_ATS">isdn_tty_cmd_ATS</A>(<FONT COLOR="#298C52">char</FONT> **p, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<FONT COLOR="#298C52">int</FONT> bitpos;
|
|
<FONT COLOR="#298C52">int</FONT> mreg;
|
|
<FONT COLOR="#298C52">int</FONT> mval;
|
|
<FONT COLOR="#298C52">int</FONT> bval;
|
|
|
|
mreg = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">if</FONT> (mreg < 0 || mreg > <A HREF="../includes/isdn.h.shtml#ISDN_MODEM_ANZREG">ISDN_MODEM_ANZREG</A>)
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'='</FONT>:
|
|
p[0]++;
|
|
mval = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">if</FONT> (mval < 0 || mval > 255)
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_check_ats">isdn_tty_check_ats</A>(mreg, mval, info, m))
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
m->mdmreg[mreg] = mval;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'.'</FONT>:
|
|
<FONT COLOR=#0000FF>/* Set/Clear a single bit */</FONT>
|
|
p[0]++;
|
|
bitpos = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">if</FONT> ((bitpos < 0) || (bitpos > 7))
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'='</FONT>:
|
|
p[0]++;
|
|
bval = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">if</FONT> (bval < 0 || bval > 1)
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR="#298C52">if</FONT> (bval)
|
|
mval = m->mdmreg[mreg] | (1 << bitpos);
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
mval = m->mdmreg[mreg] & ~(1 << bitpos);
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_check_ats">isdn_tty_check_ats</A>(mreg, mval, info, m))
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
m->mdmreg[mreg] = mval;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n"</FONT>, info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>((m->mdmreg[mreg] & (1 << bitpos)) ? <FONT COLOR="#FF0000">"1"</FONT> : <FONT COLOR="#FF0000">"0"</FONT>,
|
|
info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_show_profile">isdn_tty_show_profile</A>(mreg, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Perform ATA command
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_cmd_ATA">isdn_tty_cmd_ATA</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<A HREF="../includes/isdnif.h.shtml#isdn_ctrl">isdn_ctrl</A> cmd;
|
|
<FONT COLOR="#298C52">int</FONT> l2;
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (info->msr & UART_MSR_RI) {
|
|
<FONT COLOR=#0000FF>/* Accept incoming call */</FONT>
|
|
info->last_dir = 0;
|
|
strcpy(info->last_num, dev->num[info->drv_index]);
|
|
m->mdmreg[<A HREF="#REG_RINGCNT">REG_RINGCNT</A>] = 0;
|
|
info->msr &= ~UART_MSR_RI;
|
|
l2 = m->mdmreg[<A HREF="#REG_L2PROT">REG_L2PROT</A>];
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR=#0000FF>/* If more than one bit set in reg18, autoselect Layer2 */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] & m->mdmreg[<A HREF="#REG_SI1I">REG_SI1I</A>]) != m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>]) {
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_SI1I">REG_SI1I</A>] == 1)
|
|
l2 = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_TRANS">ISDN_PROTO_L2_TRANS</A>;
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
l2 = <A HREF="../includes/isdnif.h.shtml#ISDN_PROTO_L2_X75I">ISDN_PROTO_L2_X75I</A>;
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_SETL2">ISDN_CMD_SETL2</A>;
|
|
cmd.arg = info->isdn_channel + (l2 << 8);
|
|
info->last_l2 = l2;
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_SETL3">ISDN_CMD_SETL3</A>;
|
|
cmd.arg = info->isdn_channel + (m->mdmreg[<A HREF="#REG_L3PROT">REG_L3PROT</A>] << 8);
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
cmd.<A HREF="../includes/isdn.h.shtml#driver">driver</A> = info->isdn_driver;
|
|
cmd.arg = info->isdn_channel;
|
|
cmd.command = <A HREF="../includes/isdnif.h.shtml#ISDN_CMD_ACCEPTD">ISDN_CMD_ACCEPTD</A>;
|
|
<A HREF="isdn_common.c.shtml#isdn_command">isdn_command</A>(&cmd);
|
|
} <FONT COLOR="#298C52">else</FONT>
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(8, info);
|
|
}
|
|
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR=#0000FF>/*
|
|
* Parse AT+F.. commands
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_cmd_PLUSF">isdn_tty_cmd_PLUSF</A>(<FONT COLOR="#298C52">char</FONT> **p, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<FONT COLOR="#298C52">int</FONT> par;
|
|
<FONT COLOR="#298C52">char</FONT> rs[20];
|
|
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"CLASS"</FONT>, 5)) {
|
|
p[0] += 5;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
sprintf(rs, <FONT COLOR="#FF0000">"\r\n%d"</FONT>,
|
|
(m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] & 1) ? 8 : 0);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(rs, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'='</FONT>:
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'0'</FONT>:
|
|
p[0]++;
|
|
m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] = 4;
|
|
info->xmit_size =
|
|
m->mdmreg[<A HREF="#REG_PSIZE">REG_PSIZE</A>] * 16;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'2'</FONT>:
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: FCLASS=2\n"</FONT>);
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'8'</FONT>:
|
|
p[0]++;
|
|
m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] = 5;
|
|
info->xmit_size = <A HREF="#VBUF">VBUF</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n0,2,8"</FONT>,
|
|
info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"AA"</FONT>, 2)) {
|
|
p[0] += 2;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
sprintf(rs, <FONT COLOR="#FF0000">"\r\n%d"</FONT>,
|
|
m->mdmreg[<A HREF="#REG_RINGATA">REG_RINGATA</A>]);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(rs, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'='</FONT>:
|
|
p[0]++;
|
|
par = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">if</FONT> ((par < 0) || (par > 255))
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
m->mdmreg[<A HREF="#REG_RINGATA">REG_RINGATA</A>] = par;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"TBC="</FONT>, 4)) { <FONT COLOR=#0000FF>/* UNKLAR !! */</FONT>
|
|
p[0] += 4;
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: Fax FTBC=%c\n"</FONT>, *p[0]);
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'0'</FONT>:
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"BOR="</FONT>, 4)) { <FONT COLOR=#0000FF>/* UNKLAR !! */</FONT>
|
|
p[0] += 4;
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: Fax FBOR=%c\n"</FONT>, *p[0]);
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'0'</FONT>:
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"DCC="</FONT>, 4)) { <FONT COLOR=#0000FF>/* SETUP irgendwie !! */</FONT>
|
|
<FONT COLOR="#298C52">int</FONT> i, val[]={0,0,0,0,0,0,0,0};
|
|
|
|
p[0] += 4;
|
|
<FONT COLOR="#298C52">if</FONT> (*p[0] == <FONT COLOR="#FF0000">'?'</FONT>) {
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n(0,1),(0-5),(0-2),(0-2),(0,1),(0),(0),(0-7)"</FONT>,info);
|
|
p[0]++;
|
|
} <FONT COLOR="#298C52">else</FONT> {
|
|
<FONT COLOR="#298C52">for</FONT> (i=0; (*p[0]>=<FONT COLOR="#FF0000">'0'</FONT>) && (*p[0]<=<FONT COLOR="#FF0000">'9'</FONT>); i++) {
|
|
val[i] = *p[0] - 48;
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">if</FONT> (*p[0] == <FONT COLOR="#FF0000">','</FONT>)
|
|
p[0]++;
|
|
}
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: Fax Setup values=%d,%d,%d,%d,%d,%d,%d,%d\n"</FONT>,
|
|
val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7]);
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"LID="</FONT>, 4)) { <FONT COLOR=#0000FF>/* set sender ID !! */</FONT>
|
|
<FONT COLOR="#298C52">char</FONT> senderID[80];
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
|
|
p[0] += 4;
|
|
<FONT COLOR="#298C52">if</FONT> (*p[0] ==<FONT COLOR="#FF0000">'"'</FONT>)
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">for</FONT>(i=0; (*p[0]) && (*p[0] != <FONT COLOR="#FF0000">'"'</FONT>); i++)
|
|
senderID[i] = *p[0]++;
|
|
senderID[i] = 0;
|
|
<FONT COLOR="#298C52">if</FONT> (*p[0] ==<FONT COLOR="#FF0000">'"'</FONT>)
|
|
p[0]++;
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: Fax sender=>%s<\n"</FONT>, senderID);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"MFR?"</FONT>, 4)) {
|
|
p[0] += 4;
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: FMFR?\n"</FONT>);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\nISDNfax"</FONT>, info);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"MDL?"</FONT>, 4)) {
|
|
p[0] += 4;
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: FMDL?\n"</FONT>);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\nAVM-B1"</FONT>, info);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"AP=?"</FONT>, 4)) {
|
|
p[0] += 4;
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: FAP=?\n"</FONT>);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"PHCTO="</FONT>, 6)) {
|
|
<FONT COLOR=#0000FF>/* beim trace mit dem zyxel folgt der wert 30 ;*/</FONT>
|
|
p[0] += 6;
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: FPHCTO=%s\n"</FONT>, p[0]);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(p[0], <FONT COLOR="#FF0000">"CR="</FONT>, 3)) {
|
|
p[0] += 3;
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: FCR=%s\n"</FONT>, p[0]);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"isdn_tty: unknown token=>AT+F%s<\n"</FONT>, p[0]);
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Parse AT+V.. commands
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A NAME="isdn_tty_cmd_PLUSV">isdn_tty_cmd_PLUSV</A>(<FONT COLOR="#298C52">char</FONT> **p, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">char</FONT> *vcmd[] =
|
|
{<FONT COLOR="#FF0000">"NH"</FONT>, <FONT COLOR="#FF0000">"IP"</FONT>, <FONT COLOR="#FF0000">"LS"</FONT>, <FONT COLOR="#FF0000">"RX"</FONT>, <FONT COLOR="#FF0000">"SD"</FONT>, <FONT COLOR="#FF0000">"SM"</FONT>, <FONT COLOR="#FF0000">"TX"</FONT>, NULL};
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
<FONT COLOR="#298C52">int</FONT> par1;
|
|
<FONT COLOR="#298C52">int</FONT> par2;
|
|
<FONT COLOR="#298C52">char</FONT> rs[20];
|
|
|
|
i = 0;
|
|
<FONT COLOR="#298C52">while</FONT> (vcmd[i]) {
|
|
<FONT COLOR="#298C52">if</FONT> (!strncmp(vcmd[i], p[0], 2)) {
|
|
p[0] += 2;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
i++;
|
|
}
|
|
<FONT COLOR="#298C52">switch</FONT> (i) {
|
|
<FONT COLOR="#298C52">case</FONT> 0:
|
|
<FONT COLOR=#0000FF>/* AT+VNH - Auto hangup feature */</FONT>
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n1"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'='</FONT>:
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'1'</FONT>:
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n1"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 1:
|
|
<FONT COLOR=#0000FF>/* AT+VIP - Reset all voice parameters */</FONT>
|
|
<A HREF="#isdn_tty_modem_reset_vpar">isdn_tty_modem_reset_vpar</A>(m);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 2:
|
|
<FONT COLOR=#0000FF>/* AT+VLS - Select device, accept incoming call */</FONT>
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
sprintf(rs, <FONT COLOR="#FF0000">"\r\n%d"</FONT>, m->vpar[0]);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(rs, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'='</FONT>:
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'0'</FONT>:
|
|
p[0]++;
|
|
m->vpar[0] = 0;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'2'</FONT>:
|
|
p[0]++;
|
|
m->vpar[0] = 2;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n0,2"</FONT>, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 3:
|
|
<FONT COLOR=#0000FF>/* AT+VRX - Start recording */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (!m->vpar[0])
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR="#298C52">if</FONT> (info->online != 1) {
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(8, info);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
info-><A HREF="isdn_audio.h.shtml#dtmf_state">dtmf_state</A> = <A HREF="isdn_audio.c.shtml#isdn_audio_dtmf_init">isdn_audio_dtmf_init</A>(info-><A HREF="isdn_audio.h.shtml#dtmf_state">dtmf_state</A>);
|
|
<FONT COLOR="#298C52">if</FONT> (!info-><A HREF="isdn_audio.h.shtml#dtmf_state">dtmf_state</A>) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: Couldn't malloc dtmf state\n"</FONT>);
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (m->vpar[3] < 5) {
|
|
info->adpcmr = <A HREF="isdn_audio.c.shtml#isdn_audio_adpcm_init">isdn_audio_adpcm_init</A>(info->adpcmr, m->vpar[3]);
|
|
<FONT COLOR="#298C52">if</FONT> (!info->adpcmr) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: Couldn't malloc adpcm state\n"</FONT>);
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
}
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_AT
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"AT: +VRX\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
info->vonline |= 1;
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(1, info);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 4:
|
|
<FONT COLOR=#0000FF>/* AT+VSD - Silence detection */</FONT>
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
sprintf(rs, <FONT COLOR="#FF0000">"\r\n<%d>,<%d>"</FONT>,
|
|
m->vpar[1],
|
|
m->vpar[2]);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(rs, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'='</FONT>:
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'0'</FONT>:
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'1'</FONT>:
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'2'</FONT>:
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'3'</FONT>:
|
|
par1 = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">if</FONT> ((par1 < 0) || (par1 > 31))
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR="#298C52">if</FONT> (*p[0] != <FONT COLOR="#FF0000">','</FONT>)
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
p[0]++;
|
|
par2 = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">if</FONT> ((par2 < 0) || (par2 > 255))
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
m->vpar[1] = par1;
|
|
m->vpar[2] = par2;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n<0-31>,<0-255>"</FONT>,
|
|
info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 5:
|
|
<FONT COLOR=#0000FF>/* AT+VSM - Select compression */</FONT>
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
sprintf(rs, <FONT COLOR="#FF0000">"\r\n<%d>,<%d><8000>"</FONT>,
|
|
m->vpar[3],
|
|
m->vpar[1]);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(rs, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'='</FONT>:
|
|
p[0]++;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p[0]) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'2'</FONT>:
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'3'</FONT>:
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'4'</FONT>:
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'5'</FONT>:
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'6'</FONT>:
|
|
par1 = <A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(p);
|
|
<FONT COLOR="#298C52">if</FONT> ((par1 < 2) || (par1 > 6))
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
m->vpar[3] = par1;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'?'</FONT>:
|
|
p[0]++;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\n2;ADPCM;2;0;(8000)\r\n"</FONT>,
|
|
info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"3;ADPCM;3;0;(8000)\r\n"</FONT>,
|
|
info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"4;ADPCM;4;0;(8000)\r\n"</FONT>,
|
|
info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"5;ALAW;8;0;(8000)"</FONT>,
|
|
info);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"6;ULAW;8;0;(8000)"</FONT>,
|
|
info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 6:
|
|
<FONT COLOR=#0000FF>/* AT+VTX - Start sending */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> (!m->vpar[0])
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
<FONT COLOR="#298C52">if</FONT> (info->online != 1) {
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(8, info);
|
|
<FONT COLOR="#298C52">return</FONT> 1;
|
|
}
|
|
info-><A HREF="isdn_audio.h.shtml#dtmf_state">dtmf_state</A> = <A HREF="isdn_audio.c.shtml#isdn_audio_dtmf_init">isdn_audio_dtmf_init</A>(info-><A HREF="isdn_audio.h.shtml#dtmf_state">dtmf_state</A>);
|
|
<FONT COLOR="#298C52">if</FONT> (!info-><A HREF="isdn_audio.h.shtml#dtmf_state">dtmf_state</A>) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: Couldn't malloc dtmf state\n"</FONT>);
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (m->vpar[3] < 5) {
|
|
info->adpcms = <A HREF="isdn_audio.c.shtml#isdn_audio_adpcm_init">isdn_audio_adpcm_init</A>(info->adpcms, m->vpar[3]);
|
|
<FONT COLOR="#298C52">if</FONT> (!info->adpcms) {
|
|
printk(KERN_WARNING <FONT COLOR="#FF0000">"isdn_tty: Couldn't malloc adpcm state\n"</FONT>);
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
}
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_AT
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"AT: +VTX\n"</FONT>);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
m->lastDLE = 0;
|
|
info->vonline |= 2;
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(1, info);
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR1">PARSE_ERROR1</A>;
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> 0;
|
|
}
|
|
<FONT COLOR=#A521F7>#endif</FONT> <FONT COLOR=#0000FF>/* CONFIG_ISDN_AUDIO */</FONT>
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Parse and perform an AT-command-line.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_parse_at">isdn_tty_parse_at</A>(<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<FONT COLOR="#298C52">char</FONT> *p;
|
|
<FONT COLOR="#298C52">char</FONT> ds[40];
|
|
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> ISDN_DEBUG_AT
|
|
printk(KERN_DEBUG <FONT COLOR="#FF0000">"AT: '%s'\n"</FONT>, m->mdmcmd);
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<FONT COLOR="#298C52">for</FONT> (p = &m->mdmcmd[2]; *p;) {
|
|
<FONT COLOR="#298C52">switch</FONT> (*p) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'A'</FONT>:
|
|
<FONT COLOR=#0000FF>/* A - Accept incoming call */</FONT>
|
|
p++;
|
|
<A HREF="#isdn_tty_cmd_ATA">isdn_tty_cmd_ATA</A>(info);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'D'</FONT>:
|
|
<FONT COLOR=#0000FF>/* D - Dial */</FONT>
|
|
<A HREF="#isdn_tty_getdial">isdn_tty_getdial</A>(++p, ds, <FONT COLOR="#298C52">sizeof</FONT> ds);
|
|
p += strlen(p);
|
|
<FONT COLOR="#298C52">if</FONT> (!strlen(m->msn))
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(10, info);
|
|
<FONT COLOR="#298C52">else</FONT> <FONT COLOR="#298C52">if</FONT> (strlen(ds))
|
|
<A HREF="#isdn_tty_dial">isdn_tty_dial</A>(ds, info, m);
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
<A HREF="#PARSE_ERROR">PARSE_ERROR</A>;
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'E'</FONT>:
|
|
<FONT COLOR=#0000FF>/* E - Turn Echo on/off */</FONT>
|
|
p++;
|
|
<FONT COLOR="#298C52">switch</FONT> (<A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(&p)) {
|
|
<FONT COLOR="#298C52">case</FONT> 0:
|
|
m->mdmreg[<A HREF="#REG_ECHO">REG_ECHO</A>] &= ~<A HREF="#BIT_ECHO">BIT_ECHO</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 1:
|
|
m->mdmreg[<A HREF="#REG_ECHO">REG_ECHO</A>] |= <A HREF="#BIT_ECHO">BIT_ECHO</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR">PARSE_ERROR</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'H'</FONT>:
|
|
<FONT COLOR=#0000FF>/* H - On/Off-hook */</FONT>
|
|
p++;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'0'</FONT>:
|
|
p++;
|
|
<A HREF="#isdn_tty_on_hook">isdn_tty_on_hook</A>(info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'1'</FONT>:
|
|
p++;
|
|
<A HREF="#isdn_tty_off_hook">isdn_tty_off_hook</A>();
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#isdn_tty_on_hook">isdn_tty_on_hook</A>(info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'I'</FONT>:
|
|
<FONT COLOR=#0000FF>/* I - Information */</FONT>
|
|
p++;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\r\nLinux ISDN"</FONT>, info);
|
|
<FONT COLOR="#298C52">switch</FONT> (*p) {
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'0'</FONT>:
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'1'</FONT>:
|
|
p++;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'2'</FONT>:
|
|
p++;
|
|
<A HREF="#isdn_tty_report">isdn_tty_report</A>(info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'3'</FONT>:
|
|
p++;
|
|
sprintf(ds, <FONT COLOR="#FF0000">"\r\n%d"</FONT>, info->emu.charge);
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(ds, info);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'O'</FONT>:
|
|
<FONT COLOR=#0000FF>/* O - Go online */</FONT>
|
|
p++;
|
|
<FONT COLOR="#298C52">if</FONT> (info->msr & UART_MSR_DCD)
|
|
<FONT COLOR=#0000FF>/* if B-Channel is up */</FONT>
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(5, info);
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(3, info);
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'Q'</FONT>:
|
|
<FONT COLOR=#0000FF>/* Q - Turn Emulator messages on/off */</FONT>
|
|
p++;
|
|
<FONT COLOR="#298C52">switch</FONT> (<A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(&p)) {
|
|
<FONT COLOR="#298C52">case</FONT> 0:
|
|
m->mdmreg[<A HREF="#REG_RESP">REG_RESP</A>] |= <A HREF="#BIT_RESP">BIT_RESP</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 1:
|
|
m->mdmreg[<A HREF="#REG_RESP">REG_RESP</A>] &= ~<A HREF="#BIT_RESP">BIT_RESP</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR">PARSE_ERROR</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'S'</FONT>:
|
|
<FONT COLOR=#0000FF>/* S - Set/Get Register */</FONT>
|
|
p++;
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_cmd_ATS">isdn_tty_cmd_ATS</A>(&p, info))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'V'</FONT>:
|
|
<FONT COLOR=#0000FF>/* V - Numeric or ASCII Emulator-messages */</FONT>
|
|
p++;
|
|
<FONT COLOR="#298C52">switch</FONT> (<A HREF="isdn_common.c.shtml#isdn_getnum">isdn_getnum</A>(&p)) {
|
|
<FONT COLOR="#298C52">case</FONT> 0:
|
|
m->mdmreg[<A HREF="#REG_RESP">REG_RESP</A>] |= <A HREF="#BIT_RESPNUM">BIT_RESPNUM</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 1:
|
|
m->mdmreg[<A HREF="#REG_RESP">REG_RESP</A>] &= ~<A HREF="#BIT_RESPNUM">BIT_RESPNUM</A>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR">PARSE_ERROR</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'Z'</FONT>:
|
|
<FONT COLOR=#0000FF>/* Z - Load Registers from Profile */</FONT>
|
|
p++;
|
|
<A HREF="#isdn_tty_modem_reset_regs">isdn_tty_modem_reset_regs</A>(info, 1);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'+'</FONT>:
|
|
p++;
|
|
<FONT COLOR="#298C52">switch</FONT> (*p) {
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'F'</FONT>:
|
|
p++;
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_cmd_PLUSF">isdn_tty_cmd_PLUSF</A>(&p, info))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'V'</FONT>:
|
|
<FONT COLOR="#298C52">if</FONT> (!(m->mdmreg[<A HREF="#REG_SI1">REG_SI1</A>] & 1))
|
|
<A HREF="#PARSE_ERROR">PARSE_ERROR</A>;
|
|
p++;
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_cmd_PLUSV">isdn_tty_cmd_PLUSV</A>(&p, info))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR=#A521F7>#endif</FONT> <FONT COLOR=#0000FF>/* CONFIG_ISDN_AUDIO */</FONT>
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'S'</FONT>: <FONT COLOR=#0000FF>/* SUSPEND */</FONT>
|
|
p++;
|
|
<A HREF="#isdn_tty_get_msnstr">isdn_tty_get_msnstr</A>(ds, &p);
|
|
<A HREF="#isdn_tty_suspend">isdn_tty_suspend</A>(ds, info, m);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'R'</FONT>: <FONT COLOR=#0000FF>/* RESUME */</FONT>
|
|
<A HREF="#isdn_tty_get_msnstr">isdn_tty_get_msnstr</A>(ds, &p);
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR">PARSE_ERROR</A>;
|
|
}
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> <FONT COLOR="#FF0000">'&'</FONT>:
|
|
p++;
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#isdn_tty_cmd_ATand">isdn_tty_cmd_ATand</A>(&p, info))
|
|
<FONT COLOR="#298C52">return</FONT>;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
<A HREF="#PARSE_ERROR">PARSE_ERROR</A>;
|
|
}
|
|
}
|
|
<FONT COLOR=#A521F7>#ifdef</FONT> CONFIG_ISDN_AUDIO
|
|
<FONT COLOR="#298C52">if</FONT> (!info->vonline)
|
|
<FONT COLOR=#A521F7>#endif</FONT>
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(0, info);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/* Need own toupper() because standard-toupper is not available
|
|
* within modules.
|
|
*/</FONT>
|
|
<FONT COLOR=#A521F7>#define</FONT> <A HREF="#my_toupper">my_toupper</A>(c) (((c>=<FONT COLOR="#FF0000">'a'</FONT>)&&(c<=<FONT COLOR="#FF0000">'z'</FONT>))?(c&0xdf):c)
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Perform line-editing of AT-commands
|
|
*
|
|
* Parameters:
|
|
* p inputbuffer
|
|
* count length of buffer
|
|
* channel index to line (minor-device)
|
|
* user flag: buffer is in userspace
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">static</FONT> <FONT COLOR="#298C52">int</FONT>
|
|
<A HREF="#isdn_tty_edit_at">isdn_tty_edit_at</A>(<FONT COLOR="#298C52">const</FONT> <FONT COLOR="#298C52">char</FONT> *p, <FONT COLOR="#298C52">int</FONT> count, <A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> * info, <FONT COLOR="#298C52">int</FONT> user)
|
|
{
|
|
<A HREF="../includes/isdn.h.shtml#atemu">atemu</A> *m = &info->emu;
|
|
<FONT COLOR="#298C52">int</FONT> total = 0;
|
|
u_char c;
|
|
<FONT COLOR="#298C52">char</FONT> eb[2];
|
|
<FONT COLOR="#298C52">int</FONT> cnt;
|
|
|
|
<FONT COLOR="#298C52">for</FONT> (cnt = count; cnt > 0; p++, cnt--) {
|
|
<FONT COLOR="#298C52">if</FONT> (user)
|
|
get_user(c, p);
|
|
<FONT COLOR="#298C52">else</FONT>
|
|
c = *p;
|
|
total++;
|
|
<FONT COLOR="#298C52">if</FONT> (c == m->mdmreg[<A HREF="#REG_CR">REG_CR</A>] || c == m->mdmreg[<A HREF="#REG_LF">REG_LF</A>]) {
|
|
<FONT COLOR=#0000FF>/* Separator (CR oder LF) */</FONT>
|
|
m->mdmcmd[m->mdmcmdl] = 0;
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_ECHO">REG_ECHO</A>] & <A HREF="#BIT_ECHO">BIT_ECHO</A>) {
|
|
eb[0] = c;
|
|
eb[1] = 0;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(eb, info);
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmcmdl >= 2)
|
|
<A HREF="#isdn_tty_parse_at">isdn_tty_parse_at</A>(info);
|
|
m->mdmcmdl = 0;
|
|
<FONT COLOR="#298C52">continue</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (c == m->mdmreg[<A HREF="#REG_BS">REG_BS</A>] && m->mdmreg[<A HREF="#REG_BS">REG_BS</A>] < 128) {
|
|
<FONT COLOR=#0000FF>/* Backspace-Funktion */</FONT>
|
|
<FONT COLOR="#298C52">if</FONT> ((m->mdmcmdl > 2) || (!m->mdmcmdl)) {
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmcmdl)
|
|
m->mdmcmdl--;
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_ECHO">REG_ECHO</A>] & <A HREF="#BIT_ECHO">BIT_ECHO</A>)
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(<FONT COLOR="#FF0000">"\b"</FONT>, info);
|
|
}
|
|
<FONT COLOR="#298C52">continue</FONT>;
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="#cmdchar">cmdchar</A>(c)) {
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmreg[<A HREF="#REG_ECHO">REG_ECHO</A>] & <A HREF="#BIT_ECHO">BIT_ECHO</A>) {
|
|
eb[0] = c;
|
|
eb[1] = 0;
|
|
<A HREF="#isdn_tty_at_cout">isdn_tty_at_cout</A>(eb, info);
|
|
}
|
|
<FONT COLOR="#298C52">if</FONT> (m->mdmcmdl < 255) {
|
|
c = <A HREF="#my_toupper">my_toupper</A>(c);
|
|
<FONT COLOR="#298C52">switch</FONT> (m->mdmcmdl) {
|
|
<FONT COLOR="#298C52">case</FONT> 0:
|
|
<FONT COLOR="#298C52">if</FONT> (c == <FONT COLOR="#FF0000">'A'</FONT>)
|
|
m->mdmcmd[m->mdmcmdl++] = c;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">case</FONT> 1:
|
|
<FONT COLOR="#298C52">if</FONT> (c == <FONT COLOR="#FF0000">'T'</FONT>)
|
|
m->mdmcmd[m->mdmcmdl++] = c;
|
|
<FONT COLOR="#298C52">break</FONT>;
|
|
<FONT COLOR="#298C52">default</FONT>:
|
|
m->mdmcmd[m->mdmcmdl++] = c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
<FONT COLOR="#298C52">return</FONT> total;
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Switch all modem-channels who are online and got a valid
|
|
* escape-sequence 1.5 seconds ago, to command-mode.
|
|
* This function is called every second via timer-interrupt from within
|
|
* timer-dispatcher isdn_timer_function()
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_modem_escape">isdn_tty_modem_escape</A>(<FONT COLOR="#298C52">void</FONT>)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> ton = 0;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
<FONT COLOR="#298C52">int</FONT> midx;
|
|
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>; i++)
|
|
<FONT COLOR="#298C52">if</FONT> (<A HREF="../includes/isdn.h.shtml#USG_MODEM">USG_MODEM</A>(dev->usage[i]))
|
|
<FONT COLOR="#298C52">if</FONT> ((midx = dev->m_idx[i]) >= 0) {
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = &dev->mdm.info[midx];
|
|
<FONT COLOR="#298C52">if</FONT> (info->online) {
|
|
ton = 1;
|
|
<FONT COLOR="#298C52">if</FONT> ((info->emu.pluscount == 3) &&
|
|
((jiffies - info->emu.lastplus) > <A HREF="#PLUSWAIT2">PLUSWAIT2</A>)) {
|
|
info->emu.pluscount = 0;
|
|
info->online = 0;
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(0, info);
|
|
}
|
|
}
|
|
}
|
|
<A HREF="isdn_common.c.shtml#isdn_timer_ctrl">isdn_timer_ctrl</A>(<A HREF="../includes/isdn.h.shtml#ISDN_TIMER_MODEMPLUS">ISDN_TIMER_MODEMPLUS</A>, ton);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* Put a RING-message to all modem-channels who have the RI-bit set.
|
|
* This function is called every second via timer-interrupt from within
|
|
* timer-dispatcher isdn_timer_function()
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_modem_ring">isdn_tty_modem_ring</A>(<FONT COLOR="#298C52">void</FONT>)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> ton = 0;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>; i++) {
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = &dev->mdm.info[i];
|
|
<FONT COLOR="#298C52">if</FONT> (info->msr & UART_MSR_RI) {
|
|
ton = 1;
|
|
<A HREF="#isdn_tty_modem_result">isdn_tty_modem_result</A>(2, info);
|
|
}
|
|
}
|
|
<A HREF="isdn_common.c.shtml#isdn_timer_ctrl">isdn_timer_ctrl</A>(<A HREF="../includes/isdn.h.shtml#ISDN_TIMER_MODEMRING">ISDN_TIMER_MODEMRING</A>, ton);
|
|
}
|
|
|
|
<FONT COLOR=#0000FF>/*
|
|
* For all online tty's, try sending data to
|
|
* the lower levels.
|
|
*/</FONT>
|
|
<FONT COLOR="#298C52">void</FONT>
|
|
<A NAME="isdn_tty_modem_xmit">isdn_tty_modem_xmit</A>(<FONT COLOR="#298C52">void</FONT>)
|
|
{
|
|
<FONT COLOR="#298C52">int</FONT> ton = 1;
|
|
<FONT COLOR="#298C52">int</FONT> i;
|
|
|
|
<FONT COLOR="#298C52">for</FONT> (i = 0; i < <A HREF="../includes/isdn.h.shtml#ISDN_MAX_CHANNELS">ISDN_MAX_CHANNELS</A>; i++) {
|
|
<A HREF="../includes/isdn.h.shtml#modem_info">modem_info</A> *info = &dev->mdm.info[i];
|
|
<FONT COLOR="#298C52">if</FONT> (info->online) {
|
|
ton = 1;
|
|
<A HREF="#isdn_tty_senddown">isdn_tty_senddown</A>(info);
|
|
<A HREF="#isdn_tty_tint">isdn_tty_tint</A>(info);
|
|
}
|
|
}
|
|
<A HREF="isdn_common.c.shtml#isdn_timer_ctrl">isdn_timer_ctrl</A>(<A HREF="../includes/isdn.h.shtml#ISDN_TIMER_MODEMXMIT">ISDN_TIMER_MODEMXMIT</A>, ton);
|
|
}
|
|
</BODY>
|
|
|
|
</HTML>
|