diff options
-rw-r--r-- | drivers/dahdi/dahdi-base.c | 19 | ||||
-rw-r--r-- | include/dahdi/dahdi_config.h | 6 | ||||
-rw-r--r-- | include/dahdi/kernel.h | 5 |
3 files changed, 17 insertions, 13 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index b86cd97..1ff5089 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -287,35 +287,30 @@ enum dahdi_digit_mode { 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); diff --git a/include/dahdi/dahdi_config.h b/include/dahdi/dahdi_config.h index 59896af..56902e1 100644 --- a/include/dahdi/dahdi_config.h +++ b/include/dahdi/dahdi_config.h @@ -28,6 +28,12 @@ /* 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 * short flash time. diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 6a069b5..bfda765 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -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 */ |