[zaptel-commits] mattf: branch 1.4 r3726 - in /branches/1.4: wctdm24xxp/base.c zaptel.h
SVN commits to the Zaptel project
zaptel-commits at lists.digium.com
Wed Jan 23 10:24:18 CST 2008
Author: mattf
Date: Wed Jan 23 10:24:18 2008
New Revision: 3726
URL: http://svn.digium.com/view/zaptel?view=rev&rev=3726
Log:
Let an echocan parameter be a signed value. Also, for convenience, add a place for echocan parameters in the zt_echocanparams structure
Modified:
branches/1.4/wctdm24xxp/base.c
branches/1.4/zaptel.h
Change Statistics:
0 files changed
Modified: branches/1.4/wctdm24xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/wctdm24xxp/base.c?view=diff&rev=3726&r1=3725&r2=3726
==============================================================================
--- branches/1.4/wctdm24xxp/base.c (original)
+++ branches/1.4/wctdm24xxp/base.c Wed Jan 23 10:24:18 2008
@@ -3296,6 +3296,68 @@
#ifdef VPM150M_SUPPORT
+void vpm150m_set_chanconfig_from_state(int channum, struct adt_lec_params * parms, GpakChannelConfig_t *chanconfig)
+{
+ chanconfig->PcmInPortA = 3;
+ chanconfig->PcmInSlotA = channum;
+ chanconfig->PcmOutPortA = SerialPortNull;
+ chanconfig->PcmOutSlotA = channum;
+ chanconfig->PcmInPortB = 2;
+ chanconfig->PcmInSlotB = channum;
+ chanconfig->PcmOutPortB = 3;
+ chanconfig->PcmOutSlotB = channum;
+ if (vpmdtmfsupport) {
+ chanconfig->ToneTypesA = DTMF_tone;
+ chanconfig->MuteToneA = Enabled;
+ chanconfig->FaxCngDetA = Enabled;
+ } else {
+ chanconfig->ToneTypesA = Null_tone;
+ chanconfig->MuteToneA = Disabled;
+ chanconfig->FaxCngDetA = Disabled;
+ }
+ chanconfig->ToneTypesB = Null_tone;
+ chanconfig->EcanEnableA = Enabled;
+ chanconfig->EcanEnableB = Disabled;
+ chanconfig->MuteToneB = Disabled;
+ chanconfig->FaxCngDetB = Disabled;
+
+ if (alawoverride)
+ chanconfig->SoftwareCompand = cmpPCMA;
+ else
+ chanconfig->SoftwareCompand = cmpPCMU;
+
+ chanconfig->FrameRate = rate2ms;
+ chanconfig->EcanParametersA.EcanTapLength = 1024;
+ chanconfig->EcanParametersA.EcanNlpType = parms->nlp_type;
+ chanconfig->EcanParametersA.EcanAdaptEnable = 1;
+ chanconfig->EcanParametersA.EcanG165DetEnable = 1;
+ chanconfig->EcanParametersA.EcanDblTalkThresh = 6;
+ chanconfig->EcanParametersA.EcanNlpThreshold = parms->nlp_threshold;
+ chanconfig->EcanParametersA.EcanNlpConv = 0;
+ chanconfig->EcanParametersA.EcanNlpUnConv = 0;
+ chanconfig->EcanParametersA.EcanNlpMaxSuppress = parms->nlp_max_suppress;
+ chanconfig->EcanParametersA.EcanCngThreshold = 43;
+ chanconfig->EcanParametersA.EcanAdaptLimit = 50;
+ chanconfig->EcanParametersA.EcanCrossCorrLimit = 15;
+ chanconfig->EcanParametersA.EcanNumFirSegments = 3;
+ chanconfig->EcanParametersA.EcanFirSegmentLen = 64;
+
+ chanconfig->EcanParametersB.EcanTapLength = 1024;
+ chanconfig->EcanParametersB.EcanNlpType = parms->nlp_type;
+ chanconfig->EcanParametersB.EcanAdaptEnable = 1;
+ chanconfig->EcanParametersB.EcanG165DetEnable = 1;
+ chanconfig->EcanParametersB.EcanDblTalkThresh = 6;
+ chanconfig->EcanParametersB.EcanNlpThreshold = parms->nlp_threshold;
+ chanconfig->EcanParametersB.EcanNlpConv = 0;
+ chanconfig->EcanParametersB.EcanNlpUnConv = 0;
+ chanconfig->EcanParametersB.EcanNlpMaxSuppress = parms->nlp_max_suppress;
+ chanconfig->EcanParametersB.EcanCngThreshold = 43;
+ chanconfig->EcanParametersB.EcanAdaptLimit = 50;
+ chanconfig->EcanParametersB.EcanCrossCorrLimit = 15;
+ chanconfig->EcanParametersB.EcanNumFirSegments = 3;
+ chanconfig->EcanParametersB.EcanFirSegmentLen = 64;
+}
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
static void vpm150m_bh(void *data)
{
@@ -3343,17 +3405,13 @@
GpakAsyncEventCode_t eventcode;
GpakAsyncEventData_t eventdata;
gpakReadEventFIFOMessageStat_t res;
-#if 1
unsigned int start = wc->intcount;
-#endif
do {
res = gpakReadEventFIFOMessage(vpm150m->dspid, &channel, &eventcode, &eventdata);
-#if 1
if (debug & DEBUG_ECHOCAN)
printk("ReadEventFIFOMessage took %d ms\n", wc->intcount - start);
-#endif
if (res == RefInvalidEvent || res == RefDspCommFailure) {
printk("Uh oh (%d)\n", res);
@@ -3408,25 +3466,47 @@
GPAK_AlgControlStat_t pstatus;
int res;
- if (!memcmp(&vpm150m->curecstate[i], &vpm150m->desiredecstate[i], sizeof(vpm150m->curecstate)))
- continue;
-
- if (vpm150m->desiredecstate[i].tap_length) {
- res = gpakAlgControl(vpm150m->dspid, i, EnableEcanA, &pstatus);
- if (debug & DEBUG_ECHOCAN)
- printk("Echocan enable took %d ms\n", wc->intcount - start);
+ if ((vpm150m->desiredecstate[i].nlp_type != vpm150m->curecstate[i].nlp_type)
+ || (vpm150m->desiredecstate[i].nlp_threshold != vpm150m->curecstate[i].nlp_threshold)
+ || (vpm150m->desiredecstate[i].nlp_max_suppress != vpm150m->curecstate[i].nlp_max_suppress)) {
+
+ GPAK_ChannelConfigStat_t cstatus;
+ GPAK_TearDownChanStat_t tstatus;
+ GpakChannelConfig_t chanconfig;
+
+
+ vpm150m_set_chanconfig_from_state(i, &vpm150m->desiredecstate[i], &chanconfig);
+
+ if ((res = gpakTearDownChannel(vpm150m->dspid, i, &tstatus)))
+ goto vpm_bh_out;
+
+ if ((res = gpakConfigureChannel(vpm150m->dspid, i, tdmToTdm, &chanconfig, &cstatus)))
+ goto vpm_bh_out;
+
+ if (!vpm150m->desiredecstate[i].tap_length)
+ res = gpakAlgControl(vpm150m->dspid, i, BypassEcanA, &pstatus);
+
} else {
- res = gpakAlgControl(vpm150m->dspid, i, BypassEcanA, &pstatus);
- if (debug & DEBUG_ECHOCAN)
- printk("Echocan disable took %d ms\n", wc->intcount - start);
- }
+
+ if (vpm150m->desiredecstate[i].tap_length) {
+ res = gpakAlgControl(vpm150m->dspid, i, EnableEcanA, &pstatus);
+ if (debug & DEBUG_ECHOCAN)
+ printk("Echocan enable took %d ms\n", wc->intcount - start);
+ } else {
+ res = gpakAlgControl(vpm150m->dspid, i, BypassEcanA, &pstatus);
+ if (debug & DEBUG_ECHOCAN)
+ printk("Echocan disable took %d ms\n", wc->intcount - start);
+ }
+ }
+
+vpm_bh_out:
if (!res)
vpm150m->curecstate[i] = vpm150m->desiredecstate[i];
}
return;
}
-
+
static int vpm150m_config_hw(struct wctdm *wc)
{
struct vpm150m *vpm150m = wc->vpm150m;
@@ -3521,66 +3601,17 @@
}
for (i = 0; i < wc->type; i++) {
- /* Let's configure a channel */
- chanconfig.PcmInPortA = 3;
- chanconfig.PcmInSlotA = i;
- chanconfig.PcmOutPortA = SerialPortNull;
- chanconfig.PcmOutSlotA = i;
- chanconfig.PcmInPortB = 2;
- chanconfig.PcmInSlotB = i;
- chanconfig.PcmOutPortB = 3;
- chanconfig.PcmOutSlotB = i;
- if (vpmdtmfsupport) {
- chanconfig.ToneTypesA = DTMF_tone;
- chanconfig.MuteToneA = Enabled;
- chanconfig.FaxCngDetA = Enabled;
- } else {
- chanconfig.ToneTypesA = Null_tone;
- chanconfig.MuteToneA = Disabled;
- chanconfig.FaxCngDetA = Disabled;
- }
- chanconfig.ToneTypesB = Null_tone;
- chanconfig.EcanEnableA = Enabled;
- chanconfig.EcanEnableB = Disabled;
- chanconfig.MuteToneB = Disabled;
- chanconfig.FaxCngDetB = Disabled;
-
- if (alawoverride)
- chanconfig.SoftwareCompand = cmpPCMA;
- else
- chanconfig.SoftwareCompand = cmpPCMU;
-
- chanconfig.FrameRate = rate2ms;
-
- chanconfig.EcanParametersA.EcanTapLength = 1024;
- chanconfig.EcanParametersA.EcanNlpType = 1;
- chanconfig.EcanParametersA.EcanAdaptEnable = 1;
- chanconfig.EcanParametersA.EcanG165DetEnable = 1;
- chanconfig.EcanParametersA.EcanDblTalkThresh = 6;
- chanconfig.EcanParametersA.EcanNlpThreshold = 24;
- chanconfig.EcanParametersA.EcanNlpConv = 0;
- chanconfig.EcanParametersA.EcanNlpUnConv = 0;
- chanconfig.EcanParametersA.EcanNlpMaxSuppress = 0;
- chanconfig.EcanParametersA.EcanCngThreshold = 43;
- chanconfig.EcanParametersA.EcanAdaptLimit = 50;
- chanconfig.EcanParametersA.EcanCrossCorrLimit = 15;
- chanconfig.EcanParametersA.EcanNumFirSegments = 3;
- chanconfig.EcanParametersA.EcanFirSegmentLen = 64;
-
- chanconfig.EcanParametersB.EcanTapLength = 1024;
- chanconfig.EcanParametersB.EcanNlpType = 1;
- chanconfig.EcanParametersB.EcanAdaptEnable = 1;
- chanconfig.EcanParametersB.EcanG165DetEnable = 1;
- chanconfig.EcanParametersB.EcanDblTalkThresh = 6;
- chanconfig.EcanParametersB.EcanNlpThreshold = 24;
- chanconfig.EcanParametersB.EcanNlpConv = 0;
- chanconfig.EcanParametersB.EcanNlpUnConv = 0;
- chanconfig.EcanParametersB.EcanNlpMaxSuppress = 0;
- chanconfig.EcanParametersB.EcanCngThreshold = 43;
- chanconfig.EcanParametersB.EcanAdaptLimit = 50;
- chanconfig.EcanParametersB.EcanCrossCorrLimit = 15;
- chanconfig.EcanParametersB.EcanNumFirSegments = 3;
- chanconfig.EcanParametersB.EcanFirSegmentLen = 64;
+ vpm150m->curecstate[i].tap_length = 0;
+ vpm150m->curecstate[i].nlp_type = ADT_LEC_NLP_MUTE;
+ vpm150m->curecstate[i].nlp_threshold = 24;
+ vpm150m->curecstate[i].nlp_max_suppress = 0;
+
+ vpm150m->desiredecstate[i].tap_length = 0;
+ vpm150m->desiredecstate[i].nlp_type = ADT_LEC_NLP_MUTE;
+ vpm150m->desiredecstate[i].nlp_threshold = 24;
+ vpm150m->desiredecstate[i].nlp_max_suppress = 0;
+
+ vpm150m_set_chanconfig_from_state(i, &vpm150m->curecstate[i], &chanconfig);
if ((res = gpakConfigureChannel(vpm150m->dspid, i, tdmToTdm, &chanconfig, &cstatus))) {
printk("Unable to configure channel (%d)\n", res);
Modified: branches/1.4/zaptel.h
URL: http://svn.digium.com/view/zaptel/branches/1.4/zaptel.h?view=diff&rev=3726&r1=3725&r2=3726
==============================================================================
--- branches/1.4/zaptel.h (original)
+++ branches/1.4/zaptel.h Wed Jan 23 10:24:18 2008
@@ -911,13 +911,14 @@
struct zt_echocanparam {
char name[16];
- __u32 value;
+ __s32 value;
};
struct zt_echocanparams {
__u32 tap_length; /* 8 taps per millisecond */
__u32 param_count; /* number of parameters supplied */
/* immediately follow this structure with zt_echocanparam structures */
+ struct zt_echocanparam params[0];
};
struct zt_tone_def_header {
More information about the zaptel-commits
mailing list