[svn-commits] sruffell: linux/trunk r9616 - in /linux/trunk: drivers/dahdi/ include/dahdi/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jan 5 15:52:10 UTC 2011


Author: sruffell
Date: Wed Jan  5 09:52:03 2011
New Revision: 9616

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9616
Log:
dahdi: Move the default tone lengths into include/dahdi/dahdi_config.h

The default tone lengths are compile time options and they were in
digits.h to make it easy for users to patch.  Most of these settings are
potentially overridden from user space via the DAHDI_SET_DIALPARAMS
ioctl currently regardless of these settings.

In r9597 I moved digits.h directly into dahdi-base.c since I thought it
was broken out for sharing between compilation units as opposed to
ease patching.

I also changed the units of the default options to ms instead of in
samples.  This way if the sampling frequency changes the user will not
need to update the defaults.

Signed-off-by: Shaun Ruffell <sruffell at digium.com>
asterisk-dev-reference: 4D236FD7.30707 at digium.com

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c
    linux/trunk/include/dahdi/dahdi_config.h
    linux/trunk/include/dahdi/kernel.h

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=9616&r1=9615&r2=9616
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Wed Jan  5 09:52:03 2011
@@ -287,35 +287,30 @@
 	DIGIT_MODE_MFR2_REV,
 };
 
-#define DEFAULT_DTMF_LENGTH	(100 * DAHDI_CHUNKSIZE)
-#define DEFAULT_MFR1_LENGTH	(68 * DAHDI_CHUNKSIZE)
-#define DEFAULT_MFR2_LENGTH	(100 * DAHDI_CHUNKSIZE)
-#define PAUSE_LENGTH		(500 * DAHDI_CHUNKSIZE)
-
 /* At the end of silence, the tone stops */
 static struct dahdi_tone dtmf_silence = {
-	.tonesamples = DEFAULT_DTMF_LENGTH,
+	.tonesamples = DAHDI_MS_TO_SAMPLES(DAHDI_CONFIG_DEFAULT_DTMF_LENGTH),
 };
 
 /* At the end of silence, the tone stops */
 static struct dahdi_tone mfr1_silence = {
-	.tonesamples = DEFAULT_MFR1_LENGTH,
+	.tonesamples = DAHDI_MS_TO_SAMPLES(DAHDI_CONFIG_DEFAULT_MFR1_LENGTH),
 };
 
 /* At the end of silence, the tone stops */
 static struct dahdi_tone mfr2_silence = {
-	.tonesamples = DEFAULT_MFR2_LENGTH,
+	.tonesamples = DAHDI_MS_TO_SAMPLES(DAHDI_CONFIG_DEFAULT_MFR2_LENGTH),
 };
 
 /* A pause in the dialing */
 static struct dahdi_tone tone_pause = {
-	.tonesamples = PAUSE_LENGTH,
+	.tonesamples = DAHDI_MS_TO_SAMPLES(DAHDI_CONFIG_PAUSE_LENGTH),
 };
 
 static struct dahdi_dialparams global_dialparams = {
-	.dtmf_tonelen = DEFAULT_DTMF_LENGTH,
-	.mfv1_tonelen = DEFAULT_MFR1_LENGTH,
-	.mfr2_tonelen = DEFAULT_MFR2_LENGTH,
+	.dtmf_tonelen = DAHDI_MS_TO_SAMPLES(DAHDI_CONFIG_DEFAULT_DTMF_LENGTH),
+	.mfv1_tonelen = DAHDI_MS_TO_SAMPLES(DAHDI_CONFIG_DEFAULT_MFR1_LENGTH),
+	.mfr2_tonelen = DAHDI_MS_TO_SAMPLES(DAHDI_CONFIG_DEFAULT_MFR2_LENGTH),
 };
 
 static int dahdi_chan_ioctl(struct file *file, unsigned int cmd, unsigned long data);

Modified: linux/trunk/include/dahdi/dahdi_config.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/include/dahdi/dahdi_config.h?view=diff&rev=9616&r1=9615&r2=9616
==============================================================================
--- linux/trunk/include/dahdi/dahdi_config.h (original)
+++ linux/trunk/include/dahdi/dahdi_config.h Wed Jan  5 09:52:03 2011
@@ -27,6 +27,12 @@
 #endif
 
 /* DAHDI compile time options */
+
+/* These default tone lengths are in units of milliseconds. */
+#define DAHDI_CONFIG_DEFAULT_DTMF_LENGTH	100
+#define DAHDI_CONFIG_DEFAULT_MFR1_LENGTH	68
+#define DAHDI_CONFIG_DEFAULT_MFR2_LENGTH	100
+#define DAHDI_CONFIG_PAUSE_LENGTH		500
 
 /*
  * Uncomment if you have a European phone, or any other phone with a 

Modified: linux/trunk/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/include/dahdi/kernel.h?view=diff&rev=9616&r1=9615&r2=9616
==============================================================================
--- linux/trunk/include/dahdi/kernel.h (original)
+++ linux/trunk/include/dahdi/kernel.h Wed Jan  5 09:52:03 2011
@@ -100,7 +100,10 @@
 #define DAHDI_MAX_CHUNKSIZE 	 DAHDI_CHUNKSIZE
 #define DAHDI_CB_SIZE		 2
 
-#define DAHDI_MSECS_PER_CHUNK	(DAHDI_CHUNKSIZE/8)
+/* DAHDI operates at 8Khz by default */
+#define DAHDI_MS_TO_SAMPLES(ms) ((ms) * 8)
+
+#define DAHDI_MSECS_PER_CHUNK	(DAHDI_CHUNKSIZE/DAHDI_MS_TO_SAMPLES(1))
 
 #define RING_DEBOUNCE_TIME	2000	/*!< 2000 ms ring debounce time */
 




More information about the svn-commits mailing list