aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/mISDN/dsp_dtmf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/mISDN/dsp_dtmf.c')
-rw-r--r--drivers/isdn/mISDN/dsp_dtmf.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/drivers/isdn/mISDN/dsp_dtmf.c b/drivers/isdn/mISDN/dsp_dtmf.c
index 5b484c3f4af6..887860bdc63b 100644
--- a/drivers/isdn/mISDN/dsp_dtmf.c
+++ b/drivers/isdn/mISDN/dsp_dtmf.c
@@ -61,31 +61,31 @@ void dsp_dtmf_hardware(struct dsp *dsp)
61 if (dsp->tx_volume) { 61 if (dsp->tx_volume) {
62 if (dsp_debug & DEBUG_DSP_DTMF) 62 if (dsp_debug & DEBUG_DSP_DTMF)
63 printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " 63 printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, "
64 "because tx_volume is changed\n", 64 "because tx_volume is changed\n",
65 __func__, dsp->name); 65 __func__, dsp->name);
66 hardware = 0; 66 hardware = 0;
67 } 67 }
68 if (dsp->rx_volume) { 68 if (dsp->rx_volume) {
69 if (dsp_debug & DEBUG_DSP_DTMF) 69 if (dsp_debug & DEBUG_DSP_DTMF)
70 printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " 70 printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, "
71 "because rx_volume is changed\n", 71 "because rx_volume is changed\n",
72 __func__, dsp->name); 72 __func__, dsp->name);
73 hardware = 0; 73 hardware = 0;
74 } 74 }
75 /* check if encryption is enabled */ 75 /* check if encryption is enabled */
76 if (dsp->bf_enable) { 76 if (dsp->bf_enable) {
77 if (dsp_debug & DEBUG_DSP_DTMF) 77 if (dsp_debug & DEBUG_DSP_DTMF)
78 printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " 78 printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, "
79 "because encryption is enabled\n", 79 "because encryption is enabled\n",
80 __func__, dsp->name); 80 __func__, dsp->name);
81 hardware = 0; 81 hardware = 0;
82 } 82 }
83 /* check if pipeline exists */ 83 /* check if pipeline exists */
84 if (dsp->pipeline.inuse) { 84 if (dsp->pipeline.inuse) {
85 if (dsp_debug & DEBUG_DSP_DTMF) 85 if (dsp_debug & DEBUG_DSP_DTMF)
86 printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, " 86 printk(KERN_DEBUG "%s dsp %s cannot do hardware DTMF, "
87 "because pipeline exists.\n", 87 "because pipeline exists.\n",
88 __func__, dsp->name); 88 __func__, dsp->name);
89 hardware = 0; 89 hardware = 0;
90 } 90 }
91 91
@@ -150,23 +150,23 @@ again:
150 if (len < 64) { 150 if (len < 64) {
151 if (len > 0) 151 if (len > 0)
152 printk(KERN_ERR "%s: coefficients have invalid " 152 printk(KERN_ERR "%s: coefficients have invalid "
153 "size. (is=%d < must=%d)\n", 153 "size. (is=%d < must=%d)\n",
154 __func__, len, 64); 154 __func__, len, 64);
155 return dsp->dtmf.digits; 155 return dsp->dtmf.digits;
156 } 156 }
157 hfccoeff = (s32 *)data; 157 hfccoeff = (s32 *)data;
158 for (k = 0; k < NCOEFF; k++) { 158 for (k = 0; k < NCOEFF; k++) {
159 sk2 = (*hfccoeff++)>>4; 159 sk2 = (*hfccoeff++) >> 4;
160 sk = (*hfccoeff++)>>4; 160 sk = (*hfccoeff++) >> 4;
161 if (sk > 32767 || sk < -32767 || sk2 > 32767 161 if (sk > 32767 || sk < -32767 || sk2 > 32767
162 || sk2 < -32767) 162 || sk2 < -32767)
163 printk(KERN_WARNING 163 printk(KERN_WARNING
164 "DTMF-Detection overflow\n"); 164 "DTMF-Detection overflow\n");
165 /* compute |X(k)|**2 */ 165 /* compute |X(k)|**2 */
166 result[k] = 166 result[k] =
167 (sk * sk) - 167 (sk * sk) -
168 (((cos2pik[k] * sk) >> 15) * sk2) + 168 (((cos2pik[k] * sk) >> 15) * sk2) +
169 (sk2 * sk2); 169 (sk2 * sk2);
170 } 170 }
171 data += 64; 171 data += 64;
172 len -= 64; 172 len -= 64;
@@ -188,7 +188,7 @@ again:
188 buf = dsp->dtmf.buffer; 188 buf = dsp->dtmf.buffer;
189 cos2pik_ = cos2pik[k]; 189 cos2pik_ = cos2pik[k];
190 for (n = 0; n < DSP_DTMF_NPOINTS; n++) { 190 for (n = 0; n < DSP_DTMF_NPOINTS; n++) {
191 sk = ((cos2pik_*sk1)>>15) - sk2 + (*buf++); 191 sk = ((cos2pik_ * sk1) >> 15) - sk2 + (*buf++);
192 sk2 = sk1; 192 sk2 = sk1;
193 sk1 = sk; 193 sk1 = sk;
194 } 194 }
@@ -224,14 +224,14 @@ coefficients:
224 224
225 if (dsp_debug & DEBUG_DSP_DTMFCOEFF) 225 if (dsp_debug & DEBUG_DSP_DTMFCOEFF)
226 printk(KERN_DEBUG "a %3d %3d %3d %3d %3d %3d %3d %3d" 226 printk(KERN_DEBUG "a %3d %3d %3d %3d %3d %3d %3d %3d"
227 " tr:%3d r %3d %3d %3d %3d %3d %3d %3d %3d\n", 227 " tr:%3d r %3d %3d %3d %3d %3d %3d %3d %3d\n",
228 result[0]/10000, result[1]/10000, result[2]/10000, 228 result[0] / 10000, result[1] / 10000, result[2] / 10000,
229 result[3]/10000, result[4]/10000, result[5]/10000, 229 result[3] / 10000, result[4] / 10000, result[5] / 10000,
230 result[6]/10000, result[7]/10000, tresh/10000, 230 result[6] / 10000, result[7] / 10000, tresh / 10000,
231 result[0]/(tresh/100), result[1]/(tresh/100), 231 result[0] / (tresh / 100), result[1] / (tresh / 100),
232 result[2]/(tresh/100), result[3]/(tresh/100), 232 result[2] / (tresh / 100), result[3] / (tresh / 100),
233 result[4]/(tresh/100), result[5]/(tresh/100), 233 result[4] / (tresh / 100), result[5] / (tresh / 100),
234 result[6]/(tresh/100), result[7]/(tresh/100)); 234 result[6] / (tresh / 100), result[7] / (tresh / 100));
235 235
236 /* calc digit (lowgroup/highgroup) */ 236 /* calc digit (lowgroup/highgroup) */
237 lowgroup = -1; 237 lowgroup = -1;
@@ -247,7 +247,7 @@ coefficients:
247 break; /* noise in between */ 247 break; /* noise in between */
248 } 248 }
249 /* good level found. This is allowed only one time per group */ 249 /* good level found. This is allowed only one time per group */
250 if (i < NCOEFF/2) { 250 if (i < NCOEFF / 2) {
251 /* lowgroup */ 251 /* lowgroup */
252 if (lowgroup >= 0) { 252 if (lowgroup >= 0) {
253 /* Bad. Another tone found. */ 253 /* Bad. Another tone found. */
@@ -262,7 +262,7 @@ coefficients:
262 highgroup = -1; 262 highgroup = -1;
263 break; 263 break;
264 } else 264 } else
265 highgroup = i-(NCOEFF/2); 265 highgroup = i - (NCOEFF / 2);
266 } 266 }
267 } 267 }
268 268
@@ -285,13 +285,13 @@ storedigit:
285 if (what) { 285 if (what) {
286 if (dsp_debug & DEBUG_DSP_DTMF) 286 if (dsp_debug & DEBUG_DSP_DTMF)
287 printk(KERN_DEBUG "DTMF digit: %c\n", 287 printk(KERN_DEBUG "DTMF digit: %c\n",
288 what); 288 what);
289 if ((strlen(dsp->dtmf.digits)+1) 289 if ((strlen(dsp->dtmf.digits) + 1)
290 < sizeof(dsp->dtmf.digits)) { 290 < sizeof(dsp->dtmf.digits)) {
291 dsp->dtmf.digits[strlen( 291 dsp->dtmf.digits[strlen(
292 dsp->dtmf.digits)+1] = '\0'; 292 dsp->dtmf.digits) + 1] = '\0';
293 dsp->dtmf.digits[strlen( 293 dsp->dtmf.digits[strlen(
294 dsp->dtmf.digits)] = what; 294 dsp->dtmf.digits)] = what;
295 } 295 }
296 } 296 }
297 } 297 }
@@ -302,5 +302,3 @@ storedigit:
302 302
303 goto again; 303 goto again;
304} 304}
305
306