[Asterisk-cvs] zaptel wctdm.c,1.95,1.96 wctdm.h,1.4,1.5
mattf at lists.digium.com
mattf at lists.digium.com
Thu Dec 30 13:12:53 CST 2004
Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv27436
Modified Files:
wctdm.c wctdm.h
Log Message:
Adding FXO module support for onboard echo cancellation
Index: wctdm.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wctdm.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- wctdm.c 22 Dec 2004 19:30:45 -0000 1.95
+++ wctdm.c 30 Dec 2004 18:07:34 -0000 1.96
@@ -119,86 +119,115 @@
int acim;
int ring_osc;
int ring_x;
+ int echoentry;
} fxo_modes[] =
{
- { "FCC", 0, 0, 0, 0, 0, 0x3, 0, 0 }, /* US, Canada */
- { "TBR21", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0x7e6c, 0x023a },
+ { "FCC", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 }, /* US, Canada */
+ { "TBR21", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0x7e6c, 0x023a, 0 },
/* Austria, Belgium, Denmark, Finland, France, Germany,
Greece, Iceland, Ireland, Italy, Luxembourg, Netherlands,
Norway, Portugal, Spain, Sweden, Switzerland, and UK */
- { "ARGENTINA", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "AUSTRALIA", 1, 0, 0, 0, 0, 0, 0x3, 0x3 },
- { "AUSTRIA", 0, 1, 0, 0, 1, 0x3, 0, 0x3 },
- { "BAHRAIN", 0, 0, 0, 0, 1, 0x3, 0, 0x2 },
- { "BELGIUM", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "BRAZIL", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "BULGARIA", 0, 0, 0, 0, 1, 0x3, 0x0, 0x3 },
- { "CANADA", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "CHILE", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "CHINA", 0, 0, 0, 0, 0, 0, 0x3, 0xf },
- { "COLUMBIA", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "CROATIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2 },
- { "CYRPUS", 0, 0, 0, 0, 1, 0x3, 0, 0x2 },
- { "CZECH", 0, 0, 0, 0, 1, 0x3, 0, 0x2 },
- { "DENMARK", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "ECUADOR", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "EGYPT", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "ELSALVADOR", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "FINLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "FRANCE", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "GERMANY", 0, 1, 0, 0, 1, 0x3, 0, 0x3 },
- { "GREECE", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "GUAM", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "HONGKONG", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "HUNGARY", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "ICELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "INDIA", 0, 0, 0, 0, 0, 0x3, 0, 0x4 },
- { "INDONESIA", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "IRELAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "ISRAEL", 0, 0, 0, 0, 1, 0x3, 0, 0x2 },
- { "ITALY", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "JAPAN", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "JORDAN", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "KAZAKHSTAN", 0, 0, 0, 0, 0, 0x3, 0 },
- { "KUWAIT", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "LATVIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2 },
- { "LEBANON", 0, 0, 0, 0, 1, 0x3, 0, 0x2 },
- { "LUXEMBOURG", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "MACAO", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "MALAYSIA", 0, 0, 0, 0, 0, 0, 0x3, 0 }, /* Current loop >= 20ma */
- { "MALTA", 0, 0, 0, 0, 1, 0x3, 0, 0x2 },
- { "MEXICO", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "MOROCCO", 0, 0, 0, 0, 1, 0x3, 0, 0x2 },
- { "NETHERLANDS", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "NEWZEALAND", 0, 0, 0, 0, 0, 0x3, 0, 0x4 },
- { "NIGERIA", 0, 0, 0, 0, 0x1, 0x3, 0, 0x2 },
- { "NORWAY", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "OMAN", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "PAKISTAN", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "PERU", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "PHILIPPINES", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "POLAND", 0, 0, 1, 1, 0, 0x3, 0, 0 },
- { "PORTUGAL", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "ROMANIA", 0, 0, 0, 0, 0, 3, 0, 0 },
- { "RUSSIA", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "SAUDIARABIA", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "SINGAPORE", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "SLOVAKIA", 0, 0, 0, 0, 0, 0x3, 0, 0x3 },
- { "SLOVENIA", 0, 0, 0, 0, 0, 0x3, 0, 0x2 },
- { "SOUTHAFRICA", 1, 0, 1, 0, 0, 0x3, 0, 0x3 },
- { "SOUTHKOREA", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "SPAIN", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "SWEDEN", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "SWITZERLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2 },
- { "SYRIA", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "TAIWAN", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "THAILAND", 0, 0, 0, 0, 0, 0, 0x3, 0 },
- { "UAE", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "UK", 0, 1, 0, 0, 1, 0x3, 0, 0x5 },
- { "USA", 0, 0, 0, 0, 0, 0x3, 0, 0 },
- { "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0 },
+ { "ARGENTINA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "AUSTRALIA", 1, 0, 0, 0, 0, 0, 0x3, 0x3, 0 },
+ { "AUSTRIA", 0, 1, 0, 0, 1, 0x3, 0, 0x3, 0 },
+ { "BAHRAIN", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "BELGIUM", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "BRAZIL", 0, 0, 0, 0, 0, 0, 0x3, 0, 0 },
+ { "BULGARIA", 0, 0, 0, 0, 1, 0x3, 0x0, 0x3, 0 },
+ { "CANADA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "CHILE", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "CHINA", 0, 0, 0, 0, 0, 0, 0x3, 0xf, 0 },
+ { "COLUMBIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "CROATIA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "CYRPUS", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "CZECH", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "DENMARK", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "ECU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0, 0, 0, 0, 0, 0, 0x3, 0, 0 }, /* Current loop >= 20ma */
+ { "MALTA", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "MEXICO", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "MOROCCO", 0, 0, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "NETHERLANDS", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "NEWZEALAND", 0, 0, 0, 0, 0, 0x3, 0, 0x4, 0 },
+ { "NIGERIA", 0, 0, 0, 0, 0x1, 0x3, 0, 0x2, 0 },
+ { "NORWAY", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "OMAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0 },
+ { "PAKISTAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0 },
+ { "PERU", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "PHILIPPINES", 0, 0, 0, 0, 0, 0, 0x3, 0, 0 },
+ { "POLAND", 0, 0, 1, 1, 0, 0x3, 0, 0, 0 },
+ { "PORTUGAL", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "ROMANIA", 0, 0, 0, 0, 0, 3, 0, 0, 0 },
+ { "RUSSIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 0 },
+ { "SAUDIARABIA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "SINGAPORE", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "SLOVAKIA", 0, 0, 0, 0, 0, 0x3, 0, 0x3, 0 },
+ { "SLOVENIA", 0, 0, 0, 0, 0, 0x3, 0, 0x2, 0 },
+ { "SOUTHAFRICA", 1, 0, 1, 0, 0, 0x3, 0, 0x3, 0 },
+ { "SOUTHKOREA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "SPAIN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "SWEDEN", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "SWITZERLAND", 0, 1, 0, 0, 1, 0x3, 0, 0x2, 0 },
+ { "SYRIA", 0, 0, 0, 0, 0, 0, 0x3, 0, 0 },
+ { "TAIWAN", 0, 0, 0, 0, 0, 0, 0x3, 0, 0 },
+ { "THAILAND", 0, 0, 0, 0, 0, 0, 0x3, 0, 0 },
+ { "UAE", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "UK", 0, 1, 0, 0, 1, 0x3, 0, 0x5, 0 },
+ { "USA", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+ { "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, 0 },
+};
+
+struct echo_zone {
+ struct regs {
+ int acim;
+ int coef1;
+ int coef2;
+ int coef3;
+ int coef4;
+ int coef5;
+ int coef6;
+ int coef7;
+ int coef8;
+ } vals[8];
+} echo_zones[] =
+{
+ {{
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ { 10, 0, 6, 1, 254, 2, 255, 0, 0},
+ { 3, 255, 255, 0, 1, 0, 0, 0, 0},
+ { 3, 1, 253, 253, 2, 255, 0, 0, 0},
+ { 9, 254, 251, 255, 2, 0, 1, 0, 0},
+ { 5, 3, 251, 250, 2, 254, 0, 0, 255},
+ { 8, 253, 2, 244, 255, 10, 244, 3, 253},
+ { 10, 249, 244, 8, 12, 245, 252, 0, 1},
+ }}
};
+
+
#ifdef STANDALONE_ZAPATA
#include "zaptel.h"
#else
@@ -1590,6 +1619,7 @@
struct wctdm_regop regop;
struct wctdm *wc = chan->pvt;
int x;
+ int whichecho = -1;
switch (cmd) {
case ZT_ONHOOKTRANSFER:
if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXS)
@@ -1646,6 +1676,34 @@
wctdm_setreg(wc, chan->chanpos - 1, regop.reg, regop.val);
}
break;
+ case WCTDM_SET_ECHOZONE:
+ whichecho = fxo_modes[_opermode].echoentry;
+
+ if (wc->modtype[chan->chanpos - 1] != MOD_TYPE_FXO)
+ return -EINVAL;
+
+ if (get_user(x, (int *)data))
+ return -EFAULT;
+
+ if (x > -1 && x < 8) {
+ /* Set the ACIM register */
+ wctdm_setreg(wc, chan->chanpos - 1, 30, echo_zones[whichecho].vals[x].acim);
+
+ /* Set the digital echo canceller registers */
+ wctdm_setreg(wc, chan->chanpos - 1, 45, echo_zones[whichecho].vals[x].coef1);
+ wctdm_setreg(wc, chan->chanpos - 1, 46, echo_zones[whichecho].vals[x].coef2);
+ wctdm_setreg(wc, chan->chanpos - 1, 47, echo_zones[whichecho].vals[x].coef3);
+ wctdm_setreg(wc, chan->chanpos - 1, 48, echo_zones[whichecho].vals[x].coef4);
+ wctdm_setreg(wc, chan->chanpos - 1, 49, echo_zones[whichecho].vals[x].coef5);
+ wctdm_setreg(wc, chan->chanpos - 1, 50, echo_zones[whichecho].vals[x].coef6);
+ wctdm_setreg(wc, chan->chanpos - 1, 51, echo_zones[whichecho].vals[x].coef7);
+ wctdm_setreg(wc, chan->chanpos - 1, 52, echo_zones[whichecho].vals[x].coef8);
+
+ break;
+ } else {
+ return -EINVAL;
+ }
+ break;
default:
return -ENOTTY;
}
Index: wctdm.h
===================================================================
RCS file: /usr/cvsroot/zaptel/wctdm.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- wctdm.h 6 Nov 2004 16:40:42 -0000 1.4
+++ wctdm.h 30 Dec 2004 18:07:34 -0000 1.5
@@ -48,4 +48,5 @@
#define WCTDM_GET_STATS _IOR (ZT_CODE, 60, struct wctdm_stats)
#define WCTDM_GET_REGS _IOR (ZT_CODE, 61, struct wctdm_regs)
#define WCTDM_SET_REG _IOW (ZT_CODE, 62, struct wctdm_regop)
+#define WCTDM_SET_ECHOZONE _IOW (ZT_CODE, 63, int)
More information about the svn-commits
mailing list