| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#ifndef _ADT_LEC_C |
| 26 |
#define _ADT_LEC_C |
| 27 |
|
| 28 |
#include <linux/ctype.h> |
| 29 |
|
| 30 |
static inline void adt_lec_init_defaults(struct adt_lec_params *params, __u32 tap_length) |
| 31 |
{ |
| 32 |
params->tap_length = tap_length; |
| 33 |
params->nlp_type = 0; |
| 34 |
params->nlp_max_suppress = 0; |
| 35 |
params->nlp_threshold = 0; |
| 36 |
} |
| 37 |
|
| 38 |
static int adt_lec_parse_params(struct adt_lec_params *params, |
| 39 |
struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p) |
| 40 |
{ |
| 41 |
unsigned int x; |
| 42 |
char *c; |
| 43 |
|
| 44 |
params->tap_length = ecp->tap_length; |
| 45 |
|
| 46 |
for (x = 0; x < ecp->param_count; x++) { |
| 47 |
for (c = p[x].name; *c; c++) |
| 48 |
*c = tolower(*c); |
| 49 |
if (!strcmp(p[x].name, "nlp_type")) { |
| 50 |
switch (p[x].value) { |
| 51 |
case ADT_LEC_NLP_OFF: |
| 52 |
case ADT_LEC_NLP_MUTE: |
| 53 |
case ADT_LEC_RANDOM_NOISE: |
| 54 |
case ADT_LEC_HOTH_NOISE: |
| 55 |
case ADT_LEC_SUPPRESS: |
| 56 |
params->nlp_type = p[x].value; |
| 57 |
break; |
| 58 |
default: |
| 59 |
return -EINVAL; |
| 60 |
} |
| 61 |
} else if (!strcmp(p[x].name, "nlp_thresh")) { |
| 62 |
params->nlp_threshold = p[x].value; |
| 63 |
} else if (!strcmp(p[x].name, "nlp_suppress")) { |
| 64 |
params->nlp_max_suppress = p[x].value; |
| 65 |
} else { |
| 66 |
return -EINVAL; |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
return 0; |
| 71 |
} |
| 72 |
|
| 73 |
#endif |