[zaptel-commits] branch 1.2 r922 - /branches/1.2/wctdm24xxp.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Tue Jan 31 14:17:57 MST 2006


Author: markster
Date: Mon Jan 30 19:26:56 2006
New Revision: 922

URL: http://svn.digium.com/view/zaptel?rev=922&view=rev
Log:
Add support for VPM100M Rev B

Modified:
    branches/1.2/wctdm24xxp.c

Modified: branches/1.2/wctdm24xxp.c
URL: http://svn.digium.com/view/zaptel/branches/1.2/wctdm24xxp.c?rev=922&r1=921&r2=922&view=diff
==============================================================================
--- branches/1.2/wctdm24xxp.c (original)
+++ branches/1.2/wctdm24xxp.c Mon Jan 30 19:26:56 2006
@@ -2462,6 +2462,7 @@
 	unsigned char reg;
 	unsigned int mask;
 	unsigned int ver;
+	unsigned char vpmver;
 	unsigned int i, x, y;
 
 	if (!vpmsupport) {
@@ -2483,10 +2484,19 @@
 			return;
 		}	
 
+		if (!x) {
+			vpmver = wctdm_vpm_in(wc, x, 0x1a6) & 0xf;
+			printk("VPM Revision: %02x\n", vpmver);
+		}
+
+
 		/* Setup GPIO's */
 		for (y=0;y<4;y++) {
 			wctdm_vpm_out(wc, x, 0x1a8 + y, 0x00); /* GPIO out */
-			wctdm_vpm_out(wc, x, 0x1ac + y, 0x00); /* GPIO dir */
+			if (x != 3)
+				wctdm_vpm_out(wc, x, 0x1ac + y, 0x00); /* GPIO dir */
+			else
+				wctdm_vpm_out(wc, x, 0x1ac + y, 0xff); /* GPIO dir */
 			wctdm_vpm_out(wc, x, 0x1b0 + y, 0x00); /* GPIO sel */
 		}
 
@@ -2494,15 +2504,21 @@
 		reg = wctdm_vpm_in(wc, x, 0x1a3); /* misc_con */
 		wctdm_vpm_out(wc, x, 0x1a3, reg & ~2);
 
-		/* Setup timeslots */
-		wctdm_vpm_out(wc, x, 0x02f, 0x20 | (x << 3)); 
-
 		/* Setup Echo length (256 taps) */
 		wctdm_vpm_out(wc, x, 0x022, 0);
-		wctdm_vpm_out(wc, x, 0x023, 0x7f);
-		
+
+		/* Setup timeslots */
+		if (vpmver == 0x01) {
+			wctdm_vpm_out(wc, x, 0x02f, 0x00); 
+			wctdm_vpm_out(wc, x, 0x023, 0xff);
+			mask = 0x11111111 << x;
+		} else {
+			wctdm_vpm_out(wc, x, 0x02f, 0x20  | (x << 3)); 
+			wctdm_vpm_out(wc, x, 0x023, 0x3f);
+			mask = 0x0000003f;
+		}
+
 		/* Setup the tdm channel masks for all chips*/
-		mask = 0x0000003f;
 		for (i = 0; i < 4; i++)
 			wctdm_vpm_out(wc, x, 0x33 - i, (mask >> (i << 3)) & 0xff);
 
@@ -2544,7 +2560,10 @@
       
 		/* Enable DTMF detectors (always DTMF detect all spans) */
 		for (i = 0; i < 6; i++) {
-			wctdm_vpm_out(wc, x, 0x98 + i, 0x40 | i);
+			if (vpmver == 0x01) 
+				wctdm_vpm_out(wc, x, 0x98 + i, 0x40 | (i << 2) | x);
+			else
+				wctdm_vpm_out(wc, x, 0x98 + i, 0x40 | i);
 		}
 
 		for (i = 0xB8; i < 0xC0; i++)



More information about the zaptel-commits mailing list