[Asterisk-bsd] Wildcard TDM400P + TDM11B = FXS not detectedonFreeBSD 5.4

Paul Belanger paul.belanger at pronexus.com
Thu Aug 4 16:29:18 CDT 2005


Ok,

Here is a patch to get it working!  I ported from the linux branch.  Feel free to test, use and commit it!  

========
diff -Nuar zaptel-freebsd-0.10.orig/wcfxs/proslic.h zaptel-freebsd-0.10/wcfxs/proslic.h
--- zaptel-freebsd-0.10.orig/wcfxs/proslic.h    Thu Aug  4 17:22:42 2005
+++ zaptel-freebsd-0.10/wcfxs/proslic.h Thu Aug  4 17:23:12 2005
@@ -2,6 +2,7 @@

 typedef struct {
        unsigned char address;
+       unsigned char altaddr;
        char *name;
        unsigned short initial;

 } alpha;
diff -Nuar zaptel-freebsd-0.10.orig/wcfxs/wcfxs.c zaptel-freebsd-0.10/wcfxs/wcfxs.c
--- zaptel-freebsd-0.10.orig/wcfxs/wcfxs.c      Thu Aug  4 17:22:42 2005
+++ zaptel-freebsd-0.10/wcfxs/wcfxs.c   Thu Aug  4 17:23:05 2005
@@ -94,52 +94,52 @@

 static alpha  indirect_regs[] =
 {
-{0,"DTMF_ROW_0_PEAK",0x55C2},
-{1,"DTMF_ROW_1_PEAK",0x51E6},
-{2,"DTMF_ROW2_PEAK",0x4B85},
-{3,"DTMF_ROW3_PEAK",0x4937},
-{4,"DTMF_COL1_PEAK",0x3333},
-{5,"DTMF_FWD_TWIST",0x0202},
-{6,"DTMF_RVS_TWIST",0x0202},
-{7,"DTMF_ROW_RATIO_TRES",0x0198},
-{8,"DTMF_COL_RATIO_TRES",0x0198},
-{9,"DTMF_ROW_2ND_ARM",0x0611},
-{10,"DTMF_COL_2ND_ARM",0x0202},
-{11,"DTMF_PWR_MIN_TRES",0x00E5},
-{12,"DTMF_OT_LIM_TRES",0x0A1C},
-{13,"OSC1_COEF",0x7B30},
-{14,"OSC1X",0x0063},
-{15,"OSC1Y",0x0000},
-{16,"OSC2_COEF",0x7870},
-{17,"OSC2X",0x007D},
-{18,"OSC2Y",0x0000},
-{19,"RING_V_OFF",0x0000},
-{20,"RING_OSC",0x7EF0},
-{21,"RING_X",0x0160},
-{22,"RING_Y",0x0000},
-{23,"PULSE_ENVEL",0x2000},
-{24,"PULSE_X",0x2000},
-{25,"PULSE_Y",0x0000},
-/* {26,"RECV_DIGITAL_GAIN",0x4000},    // playback volume set lower */
-{26,"RECV_DIGITAL_GAIN",0x2000},       /* playback volume set lower */
-{27,"XMIT_DIGITAL_GAIN",0x4000},
-/*/{27,"XMIT_DIGITAL_GAIN",0x2000}, */
-{28,"LOOP_CLOSE_TRES",0x1000},
-{29,"RING_TRIP_TRES",0x3600},
-{30,"COMMON_MIN_TRES",0x1000},
-{31,"COMMON_MAX_TRES",0x0200},
-{32,"PWR_ALARM_Q1Q2",0x07C0},
-{33,"PWR_ALARM_Q3Q4",0x2600},
-{34,"PWR_ALARM_Q5Q6",0x1B80},
-{35,"LOOP_CLOSURE_FILTER",0x8000},
-{36,"RING_TRIP_FILTER",0x0320},
-{37,"TERM_LP_POLE_Q1Q2",0x008C},
-{38,"TERM_LP_POLE_Q3Q4",0x0100},
-{39,"TERM_LP_POLE_Q5Q6",0x0010},
-{40,"CM_BIAS_RINGING",0x0C00},
-{41,"DCDC_MIN_V",0x0C00},
-{42,"DCDC_XTRA",0x1000},
-{43,"LOOP_CLOSE_TRES_LOW",0x1000},
+{0,255,"DTMF_ROW_0_PEAK",0x55C2},
+{1,255,"DTMF_ROW_1_PEAK",0x51E6},
+{2,255,"DTMF_ROW2_PEAK",0x4B85},
+{3,255,"DTMF_ROW3_PEAK",0x4937},
+{4,255,"DTMF_COL1_PEAK",0x3333},
+{5,255,"DTMF_FWD_TWIST",0x0202},
+{6,255,"DTMF_RVS_TWIST",0x0202},
+{7,255,"DTMF_ROW_RATIO_TRES",0x0198},
+{8,255,"DTMF_COL_RATIO_TRES",0x0198},
+{9,255,"DTMF_ROW_2ND_ARM",0x0611},
+{10,255,"DTMF_COL_2ND_ARM",0x0202},
+{11,255,"DTMF_PWR_MIN_TRES",0x00E5},
+{12,255,"DTMF_OT_LIM_TRES",0x0A1C},
+{13,0,"OSC1_COEF",0x7B30},
+{14,1,"OSC1X",0x0063},
+{15,2,"OSC1Y",0x0000},
+{16,3,"OSC2_COEF",0x7870},
+{17,4,"OSC2X",0x007D},
+{18,5,"OSC2Y",0x0000},
+{19,6,"RING_V_OFF",0x0000},
+{20,7,"RING_OSC",0x7EF0},
+{21,8,"RING_X",0x0160},
+{22,9,"RING_Y",0x0000},
+{23,255,"PULSE_ENVEL",0x2000},
+{24,255,"PULSE_X",0x2000},
+{25,255,"PULSE_Y",0x0000},
+//{26,13,"RECV_DIGITAL_GAIN",0x4000},  // playback volume set lower */
+{26,13,"RECV_DIGITAL_GAIN",0x2000},    /* playback volume set lower */
+{27,14,"XMIT_DIGITAL_GAIN",0x4000},
+//{27,14,"XMIT_DIGITAL_GAIN",0x2000}, */
+{28,15,"LOOP_CLOSE_TRES",0x1000},
+{29,16,"RING_TRIP_TRES",0x3600},
+{30,17,"COMMON_MIN_TRES",0x1000},
+{31,18,"COMMON_MAX_TRES",0x0200},
+{32,19,"PWR_ALARM_Q1Q2",0x07C0},
+{33,20,"PWR_ALARM_Q3Q4",0x2600},
+{34,21,"PWR_ALARM_Q5Q6",0x1B80},
+{35,22,"LOOP_CLOSURE_FILTER",0x8000},
+{36,23,"RING_TRIP_FILTER",0x0320},
+{37,24,"TERM_LP_POLE_Q1Q2",0x008C},
+{38,25,"TERM_LP_POLE_Q3Q4",0x0100},
+{39,26,"TERM_LP_POLE_Q5Q6",0x0010},
+{40,27,"CM_BIAS_RINGING",0x0C00},
+{41,64,"DCDC_MIN_V",0x0C00},
+{42,255,"DCDC_XTRA",0x1000},
+{43,66,"LOOP_CLOSE_TRES_LOW",0x1000},
 };

 static struct fxo_mode {
@@ -288,7 +288,8 @@

 #define OHT_TIMER              6000    /* How long after RING to retain OHT */

-#define FLAG_DOUBLE_CLOCK      (1 << 0)
+#define FLAG_3215      (1 << 0)
+

 #define NUM_CARDS 4

@@ -324,7 +325,7 @@
        int intcount;
        int dead;
        int pos;
-       int flags;
+       int flags[NUM_CARDS];
        int freeregion;
        int alt;
        int curcard;
@@ -783,9 +784,27 @@
        return 0;
 }

+static unsigned char translate_3215(unsigned char address)
+{
+       int x;
+       for (x=0;x<sizeof(indirect_regs)/sizeof(indirect_regs[0]);x++) {
+               if (indirect_regs[x].address == address) {
+                       address = indirect_regs[x].altaddr;
+                       break;
+               }
+       }
+       return address;
+}
+
 static int wcfxs_proslic_setreg_indirect(struct wcfxs_softc *sc, int card, unsigned char address, unsigned short data)
 {
        int res = -1;
+       /* Translate 3215 addresses */
+       if (sc->flags[card] & FLAG_3215) {
+               address = translate_3215(address);
+               if (address == 255)
+                       return 0;
+       }
        FXS_LOCK(sc->lock);
        if(!__wait_access(sc, card)) {
                __wcfxs_setreg(sc, card, IDA_LO,(unsigned char)(data & 0xFF));
@@ -801,6 +820,12 @@
 {
        int res = -1;
        char *p=NULL;
+       /* Translate 3215 addresses */
+       if (sc->flags[card] & FLAG_3215) {
+               address = translate_3215(address);
+               if (address == 255)
+                       return 0;
+       }
        FXS_LOCK(sc->lock);
        if (!__wait_access(sc, card)) {
                __wcfxs_setreg(sc, card, IAA, address);
@@ -846,7 +871,7 @@
                }
                initial= indirect_regs[i].initial;

-               if ( j != initial )
+               if ( j != initial && (!(sc->flags[card] & FLAG_3215) || (indirect_regs[i].altaddr != 255)))
                {
                         printf("!!!!!!! %s  iREG %X = %X  should be %X\n",
                                indirect_regs[i].name,indirect_regs[i].address,j,initial );
@@ -973,11 +998,16 @@
                /* SLIC not loaded */
                return -1;
        }
-       if ((blah & 0xf) < 3) {
+       if ((blah & 0xf) < 2) {
                printf("ProSLIC 3210 version %d is too old\n", blah & 0xf);
                return -1;
        }

+       if ((blah & 0xf) == 2) {
+               /* ProSLIC 3215, not a 3210 */
+               sc->flags[card] |= FLAG_3215;
+       }
+
        blah = wcfxs_getreg(sc, card, 8);
        if (blah != 0x2) {
                printf("ProSLIC on module %d insane (1) %d should be 2\n", card, blah);
@@ -1360,7 +1390,8 @@
                       (wcfxs_getreg(sc, card, 13) >> 2) & 0xf);

        /* Enable on-hook line monitor */
-       wcfxs_setreg(sc, card, 5, 0x08);
+       wcfxs_setreg(sc, card, 5, 0x09);
+       sc->mod.fxo.offhook[card] = 1;
        return 0;

 }
@@ -1910,8 +1941,8 @@
        sc->span.deflaw = ZT_LAW_MULAW;
        for (x=0;x<sc->cards;x++) {
                sprintf(sc->chans[x].name, "WCTDM/%d/%d", sc->pos, x);
-               sc->chans[x].sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_SF | ZT_SIG_EM;
-               sc->chans[x].sigcap |= ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF;
+               sc->chans[x].sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_SF | ZT_SIG_EM | ZT_SIG_CLEAR;
+               sc->chans[x].sigcap |= ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF | ZT_SIG_CLEAR;
                sc->chans[x].chanpos = x+1;
                sc->chans[x].pvt = sc;
        }
@@ -1940,9 +1971,9 @@
        for (x=0;x<sc->cards;x++) {
                if (sc->cardflag & (1 << x)) {
                        if (sc->modtype[x] == MOD_TYPE_FXO)
-                               sc->chans[x].sigcap = ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF;
+                               sc->chans[x].sigcap = ZT_SIG_FXSKS | ZT_SIG_FXSLS | ZT_SIG_SF | ZT_SIG_CLEAR;
                        else
-                               sc->chans[x].sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_SF | ZT_SIG_SF | ZT_SIG_EM;;
+                               sc->chans[x].sigcap = ZT_SIG_FXOKS | ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_SF | ZT_SIG_EM |
ZT_SIG_CLEAR;
                }
        }
 }
@@ -2330,6 +2361,7 @@
        u_int32_t                               command;
        struct wcfxs_softc              * sc;
        int                                     unit, rid, x;
+       int y;
        struct wcfxs_ident              *ident;
        uint16_t                                vid;
        uint16_t                                devid;
@@ -2419,7 +2451,9 @@
        sc->cards = 4;
        sc->pos = unit;
        sc->variety = ident->device_info->name;
-       sc->flags = ident->device_info->flags;
+       for (y=0;y<NUM_CARDS;y++)
+               sc->flags[y] = ident->device_info->flags;
+

        /* Alocate memory for two zt chunks - recieve and transmit */

analog#

-----Original Message-----
From: asterisk-bsd-bounces at lists.digium.com [mailto:asterisk-bsd-bounces at lists.digium.com] On Behalf Of Paul Belanger
Sent: Thursday, August 04, 2005 2:49 PM
To: 'Asterisk on BSD discussion'
Subject: RE: [Asterisk-bsd] Wildcard TDM400P + TDM11B = FXS not detectedonFreeBSD 5.4


Looks like Digium is not offering up any official support, a little sad.  But it maybe just as simple as the Rev H. is not support
under FreeBSD yet.  Checking out http://lists.digium.com/pipermail/asterisk-cvs/2005-February/005239.html seem to add support for
it.  I'm going to see how hard it is to port the code.  Or better yet contact the BSD maintainer. ;)

PB

-----Original Message-----
From: asterisk-bsd-bounces at lists.digium.com [mailto:asterisk-bsd-bounces at lists.digium.com] On Behalf Of Marc
Sent: Thursday, August 04, 2005 9:38 AM
To: asterisk-bsd at lists.digium.com
Subject: Re: [Asterisk-bsd] Wildcard TDM400P + TDM11B = FXS not detected onFreeBSD 5.4



> List,
>
> I have seen a few posts with success stories for getting an FXS module
> to wor

I had the card sorrta working under 1.0.3 and .07 driver set.   It would drop calls over a random interval of time.  The 1.0.7 and
.10 driver set of software failed out of the box as the .07 driver init script called ${PREFIX}/bin/ztcfg 2> /dev/null but the .10
set of inits did not.   No local man page:
man ztcfg
No manual entry for ztcfg
But the web man page at http://linux.com.hk/PenguinWeb/manpage.jsp?section=8&name=ztcfg
You generally need to run it with a valid configurations in order for zaptel modules to work properly. 
 
The card suffered the sanity check failure, then the card went to 'manual mode' and at some point the FXS died.


This has lead me back to re-activating the 2003 vintage MultiVOIP product (which claimed SIP modes, but claim and reality were not
ment with the orginal software.   I was on the 'software update of the bi-monthly club' for some time before I gave up and used it
in H.323 mode with OpenH323 code.)    With the 6.0.7 Multi-VOIP software and Asterisk 1.0.7+ I have a working system.

This product is the next to get working: http://store.voxilla.com/customer/product.php?productid=16144&cat=248&page=1
(Consider buying from Voxilla as they have support forums)


My direction is away from the digium hardware as I don't see them keeping the BSD drives up to date.    At least SIP is written to a
standard  - and that standard is the stick one can beat the vendors about the head.   I'm sick of buying cards that claim FreeBSD
support (The 1001 serial number Voicetronix card I have) and then being disapointed.  That, and the vendor I bought the product from
has removed the Digium products from their products offered for sale.

If I am going to run vendor unsupported equipment, I might as well make it hardware/software agnostic and hope they write to
standards.


> The 1 thing that concerns me is this line:
> kernel: ProSLIC 3210 version 2 is too old
>
> Looking at another issue on the lists, it looked to be a bad modules.
> What d$ now?

Email support at digium.com and ask them.   Now, they seem to want to test on some linux fork, but the port appears to keep error
messages consistant.

Good luck on a resolution.
 
_______________________________________________
Asterisk-BSD mailing list
Asterisk-BSD at lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-bsd

_______________________________________________
Asterisk-BSD mailing list
Asterisk-BSD at lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-bsd



More information about the Asterisk-BSD mailing list