patch-2.2.18 linux/drivers/isdn/isdn_audio.c

Next file: linux/drivers/isdn/isdn_audio.h
Previous file: linux/drivers/isdn/icn/icn.h
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/drivers/isdn/isdn_audio.c linux/drivers/isdn/isdn_audio.c
@@ -1,4 +1,4 @@
-/* $Id: isdn_audio.c,v 1.17 1999/08/17 11:10:52 paul Exp $
+/* $Id: isdn_audio.c,v 1.21 2000/06/20 18:01:55 keil Exp $
 
  * Linux ISDN subsystem, audio conversion and compression (linklevel).
  *
@@ -20,73 +20,6 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Log: isdn_audio.c,v $
- * Revision 1.17  1999/08/17 11:10:52  paul
- * don't try to use x86 assembler on non-x86!
- *
- * Revision 1.16  1999/08/06 12:47:35  calle
- * Using __GNUC__ == 2 && __GNUC_MINOR__ < 95 how to define
- *   ISDN_AUDIO_OPTIMIZE_ON_X386_WITH_ASM_IF_GCC_ALLOW_IT
- *
- * Revision 1.15  1999/08/06 12:02:52  calle
- * egcs 2.95 complain about invalid asm statement:
- *    "fixed or forbidden register 2 (cx) was spilled for class CREG."
- * Using ISDN_AUDIO_OPTIMIZE_ON_X386_WITH_ASM_IF_GCC_ALLOW_IT and not
- * define it at the moment.
- *
- * Revision 1.14  1999/07/11 17:14:06  armin
- * Added new layer 2 and 3 protocols for Fax and DSP functions.
- * Moved "Add CPN to RING message" to new register S23,
- * "Display message" is now correct on register S13 bit 7.
- * New audio command AT+VDD implemented (deactivate DTMF decoder and
- * activate possible existing hardware/DSP decoder).
- * Moved some tty defines to .h file.
- * Made whitespace possible in AT command line.
- * Some AT-emulator output bugfixes.
- * First Fax G3 implementations.
- *
- * Revision 1.13  1999/04/12 12:33:09  fritz
- * Changes from 2.0 tree.
- *
- * Revision 1.12  1998/07/26 18:48:43  armin
- * Added silence detection in voice receive mode.
- *
- * Revision 1.11  1998/04/10 10:35:10  paul
- * fixed (silly?) warnings from egcs on Alpha.
- *
- * Revision 1.10  1998/02/20 17:09:40  fritz
- * Changes for recent kernels.
- *
- * Revision 1.9  1997/10/01 09:20:25  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.8  1997/03/02 14:29:16  fritz
- * More ttyI related cleanup.
- *
- * Revision 1.7  1997/02/03 22:44:11  fritz
- * Reformatted according CodingStyle
- *
- * Revision 1.6  1996/06/06 14:43:31  fritz
- * Changed to support DTMF decoding on audio playback also.
- *
- * Revision 1.5  1996/06/05 02:24:08  fritz
- * Added DTMF decoder for audio mode.
- *
- * Revision 1.4  1996/05/17 03:48:01  fritz
- * Removed some test statements.
- * Added revision string.
- *
- * Revision 1.3  1996/05/10 08:48:11  fritz
- * Corrected adpcm bugs.
- *
- * Revision 1.2  1996/04/30 09:31:17  fritz
- * General rewrite.
- *
- * Revision 1.1.1.1  1996/04/28 12:25:40  fritz
- * Taken under CVS control
- *
  */
 
 #define __NO_VERSION__
@@ -95,7 +28,7 @@
 #include "isdn_audio.h"
 #include "isdn_common.h"
 
-char *isdn_audio_revision = "$Revision: 1.17 $";
+char *isdn_audio_revision = "$Revision: 1.21 $";
 
 /*
  * Misc. lookup-tables.
@@ -250,9 +183,9 @@
 };
 
 #define NCOEFF           16     /* number of frequencies to be analyzed       */
-#define DTMF_TRESH    50000     /* above this is dtmf                         */
-#define SILENCE_TRESH   100     /* below this is silence                      */
-#define H2_TRESH      10000     /* 2nd harmonic                               */
+#define DTMF_TRESH    25000     /* above this is dtmf                         */
+#define SILENCE_TRESH   200     /* below this is silence                      */
+#define H2_TRESH      20000     /* 2nd harmonic                               */
 #define AMP_BITS          9     /* bits per sample, reduced to avoid overflow */
 #define LOGRP             0
 #define HIGRP             1
@@ -292,38 +225,25 @@
 	{'*', '0', '#', 'D'}
 };
 
-
-/*
- * egcs 2.95 complain about invalid asm statement:
- * "fixed or forbidden register 2 (cx) was spilled for class CREG."
- */
-#if ((CPU == 386) || (CPU == 486) || (CPU == 586)) && defined(__GNUC__)
-#if __GNUC__ == 2 && __GNUC_MINOR__ < 95
-#define ISDN_AUDIO_OPTIMIZE_ON_X386_WITH_ASM_IF_GCC_ALLOW_IT
-#endif
-#endif
-
-#ifdef ISDN_AUDIO_OPTIMIZE_ON_X386_WITH_ASM_IF_GCC_ALLOW_IT
 static inline void
-isdn_audio_tlookup(const void *table, void *buff, unsigned long n)
+isdn_audio_tlookup(const u_char *table, u_char *buff, unsigned long n)
 {
-	__asm__("cld\n"
+#ifdef __i386__
+	unsigned long d0, d1, d2, d3;
+	__asm__ __volatile__(
+		"cld\n"
 		"1:\tlodsb\n\t"
 		"xlatb\n\t"
 		"stosb\n\t"
 		"loop 1b\n\t"
-      : :  "b"((long) table), "c"(n), "D"((long) buff), "S"((long) buff)
-      :        "bx", "cx", "di", "si", "ax");
-}
-
+	:	"=&b"(d0), "=&c"(d1), "=&D"(d2), "=&S"(d3)
+	:	"0"((long) table), "1"(n), "2"((long) buff), "3"((long) buff)
+	:	"memory", "ax");
 #else
-static inline void
-isdn_audio_tlookup(const char *table, char *buff, unsigned long n)
-{
 	while (n--)
 		*buff++ = table[*(unsigned char *)buff];
-}
 #endif
+}
 
 void
 isdn_audio_ulaw2alaw(unsigned char *buff, unsigned long len)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)