[zaptel-commits] tzafrir: branch 1.4 r3541 - in /branches/1.4: ./ xpp/ xpp/utils/ xpp/utils/zc...

SVN commits to the Zaptel project zaptel-commits at lists.digium.com
Wed Dec 19 16:48:03 CST 2007


Author: tzafrir
Date: Wed Dec 19 16:48:03 2007
New Revision: 3541

URL: http://svn.digium.com/view/zaptel?view=rev&rev=3541
Log:
* A few more fixes to card_pri.
* Do use "crc4" for E1 by default when generating zaptel.conf .

Merged revisions 3540 via svnmerge from 
http://svn.digium.com/svn/zaptel/branches/1.2

Modified:
    branches/1.4/   (props changed)
    branches/1.4/xpp/.version
    branches/1.4/xpp/Changelog_xpp
    branches/1.4/xpp/card_pri.c
    branches/1.4/xpp/init_card_9_29
    branches/1.4/xpp/utils/genzaptelconf
    branches/1.4/xpp/utils/zapconf
    branches/1.4/xpp/utils/zconf/Zaptel/Span.pm

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/xpp/.version
URL: http://svn.digium.com/view/zaptel/branches/1.4/xpp/.version?view=diff&rev=3541&r1=3540&r2=3541
==============================================================================
--- branches/1.4/xpp/.version (original)
+++ branches/1.4/xpp/.version Wed Dec 19 16:48:03 2007
@@ -1,1 +1,1 @@
-trunk-r5151
+trunk-r5157

Modified: branches/1.4/xpp/Changelog_xpp
URL: http://svn.digium.com/view/zaptel/branches/1.4/xpp/Changelog_xpp?view=diff&rev=3541&r1=3540&r2=3541
==============================================================================
--- branches/1.4/xpp/Changelog_xpp (original)
+++ branches/1.4/xpp/Changelog_xpp Wed Dec 19 16:48:03 2007
@@ -1,4 +1,4 @@
-Tue Dec 18 2007 Tzafrir Cohen <tzafrir.cohen at xorcom.com> - xpp.r5151
+Tue Dec 18 2007 Tzafrir Cohen <tzafrir.cohen at xorcom.com> - xpp.r5157
   * xpd_pri: Basically ready.
   * PCM synchronization changes:
     - Each Astribank unit ticks independently. Each with its own PLL.
@@ -9,7 +9,7 @@
   * rx_tasklet is now a parameter of the module xpp, rather than of xpp_usb.
   * New FPGA firmware: 5128 (1151) / 5122 (1141, 1131):
     - Fixes synchronization issues.
-    - PRI module: E1 should now work.
+    - PRI module: E1/T1 should now work.
   * perl module and utilities:
     - Modules no longer magically scan system on initialization.
     - Scanning is by calling explicit methods.

Modified: branches/1.4/xpp/card_pri.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/xpp/card_pri.c?view=diff&rev=3541&r1=3540&r2=3541
==============================================================================
--- branches/1.4/xpp/card_pri.c (original)
+++ branches/1.4/xpp/card_pri.c Wed Dec 19 16:48:03 2007
@@ -133,6 +133,7 @@
 			/* coding */
 			ZT_CONFIG_CCS |
 			// CAS |
+			ZT_CONFIG_CRC4 |
 			/* framing */
 			ZT_CONFIG_AMI | ZT_CONFIG_HDB3,
 		[PRI_PROTO_T1] =
@@ -185,6 +186,8 @@
 #define	REG_FRS1	0x4D	/* Framer Receive Status Register 1 */
 
 #define	REG_LIM0	0x36
+#define	REG_LIM0_MAS	BIT(0)	/* Master Mode, DCO-R circuitry is frequency
+                                                                                          synchronized to the clock supplied by SYNC */
 #define	REG_LIM0_RTRS	BIT(5)	/*
 				 * Receive Termination Resistance Selection:
 				 * integrated resistor to create 75 Ohm termination (100 || 300 = 75)
@@ -222,6 +225,14 @@
 
 #define	REG_FMR4	0x20
 #define	REG_FMR4_FM1	BIT(1)
+
+#define REG_XSP_E	0x21
+#define REG_FMR5_T	0x21
+#define	REG_XSP_E_XSIF	BIT(2)	/* Transmit Spare Bit For International Use (FAS Word)  */
+#define	REG_FMR5_T_XTM	BIT(2)	/* Transmit Transparent Mode  */
+#define	REG_XSP_E_AXS	BIT(3)	/* Automatic Transmission of Submultiframe Status  */
+#define	REG_XSP_E_EBP	BIT(4)	/* E-Bit Polarity, Si-bit position of every outgoing CRC multiframe  */
+#define	REG_XSP_E_CASEN	BIT(7)	/* Channel Associated Signaling Enable  */
 
 #define	REG_RC0		0x24
 #define	REG_RC0_SJR	BIT(7)	/* T1 = 0, J1 = 1 */
@@ -435,17 +446,27 @@
 static int set_master_mode(const char *msg, xpd_t *xpd, bool is_master_mode)
 {
 	struct PRI_priv_data	*priv;
-	byte			lim0 = REG_LIM0_RTRS;
+	byte			lim0 = 0;
+	byte			xsp  = 0;
 
 	BUG_ON(!xpd);
 	priv = xpd->priv;
 	lim0 |= (priv->local_loopback) ? REG_LIM0_LL : 0;
 	if(is_master_mode)
-		lim0 |= 0x01;
+		lim0 |=  REG_LIM0_MAS;
 	else
-		lim0 &= ~0x01;
+		lim0 &= ~REG_LIM0_MAS;
+	if(priv->pri_protocol == PRI_PROTO_E1)
+	{
+		lim0 |= REG_LIM0_RTRS; /*  Receive termination: Integrated resistor is switched on (100 Ohm || 300 Ohm = 75 Ohm) */
+		xsp  |= REG_XSP_E_EBP | REG_XSP_E_AXS | REG_XSP_E_XSIF;
+	} else if(priv->pri_protocol == PRI_PROTO_T1) { 
+		lim0 &= ~REG_LIM0_RTRS; /*  Receive termination: Integrated resistor is switched off (100 Ohm, no internal 300 Ohm)  */;
+		xsp  |=  REG_FMR5_T_XTM;
+	}
 	XPD_DBG(SIGNAL, xpd, "%s(%s): %s\n", __FUNCTION__, msg, (is_master_mode) ? "MASTER" : "SLAVE");
-	write_subunit(xpd, REG_LIM0, lim0);
+	write_subunit(xpd, REG_LIM0 , lim0);
+	write_subunit(xpd, REG_XSP_E, xsp);
 	return 0;
 }
 
@@ -471,7 +492,8 @@
 static int set_localloop(const char *msg, xpd_t *xpd, bool localloop)
 {
 	struct PRI_priv_data	*priv;
-	byte			lim0 = REG_LIM0_RTRS;
+	byte			lim0 = 0;
+	byte			xsp  = 0;
 
 	BUG_ON(!xpd);
 	priv = xpd->priv;
@@ -482,12 +504,21 @@
 	}
 	lim0 |= (localloop) ? REG_LIM0_LL : 0;
 	if(priv->is_nt)
-		lim0 |= 0x01;
+		lim0 |=  REG_LIM0_MAS;
 	else
-		lim0 &= ~0x01;
+		lim0 &= ~REG_LIM0_MAS;
+	if(priv->pri_protocol == PRI_PROTO_E1)
+	{
+		lim0 |= REG_LIM0_RTRS; /*  Receive termination: Integrated resistor is switched on (100 Ohm || 300 Ohm = 75 Ohm) */
+		xsp  |= REG_XSP_E_EBP | REG_XSP_E_AXS | REG_XSP_E_XSIF;
+	} else if(priv->pri_protocol == PRI_PROTO_T1) { 
+		lim0 &= ~REG_LIM0_RTRS ; /*  Receive termination: Integrated resistor is switched off (100 Ohm, no internal 300 Ohm)  */;
+		xsp  |=  REG_FMR5_T_XTM;
+	}
 	priv->local_loopback = localloop;
 	XPD_DBG(SIGNAL, xpd, "%s(%s): %s\n", __FUNCTION__, msg, (localloop) ? "LOCALLOOP" : "NO");
-	write_subunit(xpd, REG_LIM0, lim0);
+	write_subunit(xpd, REG_LIM0 , lim0);
+	write_subunit(xpd, REG_XSP_E, xsp);
 	return 0;
 }
 
@@ -1017,7 +1048,7 @@
 			}
 		} else if(priv->pri_protocol == PRI_PROTO_T1) {
 			/* In T1 - Every 4'th channel is unused */
-			if((i % 4) == 0) {
+			if((i % 3) == 0) {
 				physical_chan++;
 			}
 		}

Modified: branches/1.4/xpp/init_card_9_29
URL: http://svn.digium.com/view/zaptel/branches/1.4/xpp/init_card_9_29?view=diff&rev=3541&r1=3540&r2=3541
==============================================================================
--- branches/1.4/xpp/init_card_9_29 (original)
+++ branches/1.4/xpp/init_card_9_29 Wed Dec 19 16:48:03 2007
@@ -251,12 +251,6 @@
 						#  	cas = 0x1c;
 						#	if (!(lineconfig & ZT_CONFIG_CCS))
 						#		cas |= 0x40;
-		PRI::gen "0 WS 21 $i 1C"; 	# XSP: 
-						#	EBP  (E bits =1 in asynchronous state Important for ETS300 011
-						#	AXS  (Automatic Transmisson of Submultiframe Status),
-						#	XSIF (Spare Bit For International Use fixed to 1),
-						#      ~CASEN (Channel Assotiated Signalling enable, send CAS information 
-						#             in the corresponding time slot)
 
 		PRI::gen "0 WS 22 $i 00"; 	# XC0: (Transmit Counter Offset = 497/T=2)
 		PRI::gen "0 WS 23 $i 04"; 	# XC1: 
@@ -264,7 +258,8 @@
 		PRI::gen "0 WS 24 $i 00"; 	# RC0: (Receive  Counter Offset = 497/T=2)
 		PRI::gen "0 WS 25 $i 05"; 	# RC1: 
 
-		my $sic2 = $i << 1;
+		my $sic2 = sprintf("%x", 0x00 | ($i << 1));
+
 		PRI::gen "0 WS 3F $i $sic2";	# SIC2: No FFS, no center receive elastic buffer, data active at phase ($sic >> 1)
 			
 		# enable the following interrupt sources

Modified: branches/1.4/xpp/utils/genzaptelconf
URL: http://svn.digium.com/view/zaptel/branches/1.4/xpp/utils/genzaptelconf?view=diff&rev=3541&r1=3540&r2=3541
==============================================================================
--- branches/1.4/xpp/utils/genzaptelconf (original)
+++ branches/1.4/xpp/utils/genzaptelconf Wed Dec 19 16:48:03 2007
@@ -699,7 +699,7 @@
 		echo 'gsm'          >$tmp_dir/span_signalling
 		;;
 	*TE[24]/* | *WCT1/* | *Tor2/* | *TorISA/* | *WP[TE]1/* | \
-		*R[124]T1/* | *XPP_PRI*)
+		*R[124]T1/* | *XPP_[TEJ]1_*)
 		# FIXME: handle cwain around here.  
 		# name: *cwain[12]/* . Always E1.
 
@@ -755,7 +755,6 @@
 		eval span_$suffix=`cat $tmp_dir/span_$suffix 2>/dev/null`
 	done
 
-	if [ "$span_yellow" != '' ]; then span_yellow=",$span_yellow"; fi
 	# exactly the same logic is used in asterisk's chan_zap.c.
 	# also not that $(( )) is bash-specific
 	case "$((1+ $span_end - $span_begin))" in
@@ -771,9 +770,11 @@
 			span_framing=ccs
 			span_coding=hdb3
 			span_switchtype=euroisdn
+			span_yellow=crc4
 		fi
 		;;
 	esac
+	if [ "$span_yellow" != '' ]; then span_yellow=",$span_yellow"; fi
 	# Let's assume that a TE span should get the clock from the remote unit,
 	# and NT spans should provide timing. Just as a sane default.
 	# If we have several TE spans, the first will have priority 1, 
@@ -933,7 +934,7 @@
 		echo '-1'  >$tmp_dir/span_begin
 		echo '-1'  >$tmp_dir/span_end
 		echo '0'   >$tmp_dir/span_timing
-		echo '1'   >$tmp_dir/span_lbo
+		echo '0'   >$tmp_dir/span_lbo
 		echo ''    >$tmp_dir/span_framing
 		echo 'ami' >$tmp_dir/span_coding
 		echo ''    >$tmp_dir/span_switchtype
@@ -944,10 +945,10 @@
 		fi
 
 		# Check if ZapBRI cards are in TE or NT mode
-		if   echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[NT\]\ |octoBRI \[NT\] |HFC-S PCI A ISDN.* \[NT\] |Xorcom .* [PB]RI_NT)'
+		if   echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[NT\]\ |octoBRI \[NT\] |HFC-S PCI A ISDN.* \[NT\] |Xorcom .* (BRI|T1|E1)_NT)'
 		then
 			echo 'nt' >$tmp_dir/span_termtype
-		elif echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[TE\]\ |octoBRI \[TE\] |HFC-S PCI A ISDN.* \[TE\] |Xorcom .* [PB]RI_TE)'
+		elif echo $title | egrep -q '((quad|octo)BRI PCI ISDN Card.* \[TE\]\ |octoBRI \[TE\] |HFC-S PCI A ISDN.* \[TE\] |Xorcom .* (BRI|T1|E1)_TE)'
 		then
 			echo 'te' >$tmp_dir/span_termtype
 		fi
@@ -1018,7 +1019,7 @@
 			*ZTHFC*/* | *ztqoz*/* |*ztgsm/* |*TE[24]/* | \
 				*WCT1/*|*Tor2/* | *TorISA/* | \
 				*XPP_BRI_*/* | *WP[TE]1/* | *R[124]T1/* | \
-				*XPP_[PB]RI*)
+				*XPP_[TE]1*/* )
 				detect_digital_channel "$line" "$chan_num" "$span_num"
 				;;
 			'') ;;		# Empty line (after span header)

Modified: branches/1.4/xpp/utils/zapconf
URL: http://svn.digium.com/view/zaptel/branches/1.4/xpp/utils/zapconf?view=diff&rev=3541&r1=3540&r2=3541
==============================================================================
--- branches/1.4/xpp/utils/zapconf (original)
+++ branches/1.4/xpp/utils/zapconf Wed Dec 19 16:48:03 2007
@@ -181,19 +181,23 @@
 	die "Span #$num is analog" unless $span->is_digital();
 	my $termtype = $span->termtype() || die "$0: Span #$num -- unkown termtype [NT/TE]\n";
 	my $timing;
-	my $lbo = 1;
+	my $lbo = 0;
 	my $framing = $span->framing() || die "$0: No framing information for span #$num\n";
 	my $coding =  $span->coding() || die "$0: No coding information for span #$num\n";
+	my $span_crc4 = $span->crc4();
+	$span_crc4 = (defined $span_crc4) ? ",$span_crc4" : '';
 	my $span_yellow = $span->yellow();
 	$span_yellow = (defined $span_yellow) ? ",$span_yellow" : '';
 
 	$timing = ($termtype eq 'NT') ? 0 : $bri_te_last_timing++;
-	printf "span=%d,%d,%d,%s,%s\n",
+	printf "span=%d,%d,%d,%s,%s%s%s\n",
 			$num,
 			$timing,
 			$lbo,
 			$framing,
-			"$coding$span_yellow";
+			$coding,
+			$span_crc4,
+			$span_yellow;
 	printf "# termtype: %s\n", lc($termtype);
 	printf "bchan=%s\n", bchan_range($span);
 	my $dchan = $span->dchan();

Modified: branches/1.4/xpp/utils/zconf/Zaptel/Span.pm
URL: http://svn.digium.com/view/zaptel/branches/1.4/xpp/utils/zconf/Zaptel/Span.pm?view=diff&rev=3541&r1=3540&r2=3541
==============================================================================
--- branches/1.4/xpp/utils/zconf/Zaptel/Span.pm (original)
+++ branches/1.4/xpp/utils/zconf/Zaptel/Span.pm Wed Dec 19 16:48:03 2007
@@ -101,9 +101,11 @@
 		push(@{$self->{CHANS}}, $c);
 	}
 	close F;
+
+	$self->{YELLOW} = undef;
+	$self->{CRC4} = undef;
 	if($self->is_bri()) {
 		$self->{CODING} = 'ami';
-		$self->{YELLOW} = undef;
 		$self->{DCHAN} = ($self->chans())[$self->{DCHAN_IDX}];
 		$self->{BCHANS} = [ ($self->chans())[@{$self->{BCHAN_LIST}}] ];
 		# Infer some info from channel name:
@@ -125,6 +127,7 @@
 			$self->{CODING} = 'hdb3';
 			$self->{FRAMING} = 'ccs';
 			$self->{SWITCHTYPE} = 'euroisdn';
+			$self->{CRC4} = 'crc4';
 		} elsif($self->{PROTO} eq 'T1') {
 			$self->{CODING} = 'b8zs';
 			$self->{FRAMING} = 'esf';
@@ -132,7 +135,6 @@
 		} else {
 			die "'$self->{PROTO}' unsupported yet";
 		}
-		$self->{YELLOW} = undef;
 		$self->{SIGNALLING} = ($self->{TERMTYPE} eq 'NT') ? $ZAPPRI_NET : $ZAPPRI_CPE ;
 	}
 	return $self;




More information about the zaptel-commits mailing list