summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-19 21:15:04 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-19 21:15:04 +0000
commit47c37e8fb66d3f61956efcc6154828e311f1f40f (patch)
tree40d1cce58f8b2a3b8be0ec3ae0207985e909ff14
parent0525730accbcf75ce41cd30f3bc36a6392763c3b (diff)
* A few more fixes to card_pri.
* Do use "crc4" for E1 by default when generating zaptel.conf . git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@3540 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r--xpp/.version2
-rw-r--r--xpp/Changelog_xpp4
-rw-r--r--xpp/card_pri.c49
-rwxr-xr-xxpp/init_card_9_299
-rwxr-xr-xxpp/utils/genzaptelconf13
-rwxr-xr-xxpp/utils/zapconf10
-rw-r--r--xpp/utils/zconf/Zaptel/Span.pm6
7 files changed, 63 insertions, 30 deletions
diff --git a/xpp/.version b/xpp/.version
index 1ab7164..61f8917 100644
--- a/xpp/.version
+++ b/xpp/.version
@@ -1 +1 @@
-trunk-r5151
+trunk-r5157
diff --git a/xpp/Changelog_xpp b/xpp/Changelog_xpp
index 9069a05..87e9b09 100644
--- a/xpp/Changelog_xpp
+++ b/xpp/Changelog_xpp
@@ -1,4 +1,4 @@
-Tue Dec 18 2007 Tzafrir Cohen <tzafrir.cohen@xorcom.com> - xpp.r5151
+Tue Dec 18 2007 Tzafrir Cohen <tzafrir.cohen@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 @@ Tue Dec 18 2007 Tzafrir Cohen <tzafrir.cohen@xorcom.com> - xpp.r5151
* 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.
diff --git a/xpp/card_pri.c b/xpp/card_pri.c
index 483fc47..c82eb6d 100644
--- a/xpp/card_pri.c
+++ b/xpp/card_pri.c
@@ -133,6 +133,7 @@ static int pri_linecompat(enum pri_protocol pri_protocol)
/* coding */
ZT_CONFIG_CCS |
// CAS |
+ ZT_CONFIG_CRC4 |
/* framing */
ZT_CONFIG_AMI | ZT_CONFIG_HDB3,
[PRI_PROTO_T1] =
@@ -185,6 +186,8 @@ struct pri_leds {
#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)
@@ -223,6 +226,14 @@ struct pri_leds {
#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_pri_proto(xpd_t *xpd, enum pri_protocol set_proto)
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_nt(const char *msg, xpd_t *xpd, bool is_nt)
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 @@ static int set_localloop(const char *msg, xpd_t *xpd, bool localloop)
}
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 @@ static void PRI_card_pcm_fromspan(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines, xp
}
} 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++;
}
}
diff --git a/xpp/init_card_9_29 b/xpp/init_card_9_29
index 43591ca..1e97877 100755
--- a/xpp/init_card_9_29
+++ b/xpp/init_card_9_29
@@ -251,12 +251,6 @@ if($subunit eq 0) {
# 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 @@ if($subunit eq 0) {
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
diff --git a/xpp/utils/genzaptelconf b/xpp/utils/genzaptelconf
index 8cbf3ed..1435e9f 100755
--- a/xpp/utils/genzaptelconf
+++ b/xpp/utils/genzaptelconf
@@ -699,7 +699,7 @@ detect_digital_channel() {
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 @@ write_digital_config() {
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 @@ write_digital_config() {
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 @@ EOF
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 @@ EOF
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 @@ EOF
*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)
diff --git a/xpp/utils/zapconf b/xpp/utils/zapconf
index 196e57a..8ddbb81 100755
--- a/xpp/utils/zapconf
+++ b/xpp/utils/zapconf
@@ -181,19 +181,23 @@ sub gen_zaptel_digital($) {
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();
diff --git a/xpp/utils/zconf/Zaptel/Span.pm b/xpp/utils/zconf/Zaptel/Span.pm
index eacac8b..951f603 100644
--- a/xpp/utils/zconf/Zaptel/Span.pm
+++ b/xpp/utils/zconf/Zaptel/Span.pm
@@ -101,9 +101,11 @@ sub new($$) {
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 @@ sub new($$) {
$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 @@ sub new($$) {
} else {
die "'$self->{PROTO}' unsupported yet";
}
- $self->{YELLOW} = undef;
$self->{SIGNALLING} = ($self->{TERMTYPE} eq 'NT') ? $ZAPPRI_NET : $ZAPPRI_CPE ;
}
return $self;