From 68c35fa1ec23763fea236fb47c8dcd4cb073b415 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Fri, 26 Feb 2010 16:45:06 +0000 Subject: dahdi_cfg, dahdi_genconf: Add support for Hx8 series cards. git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@8125 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- dahdi_cfg.c | 28 ++++++++++++++-------------- xpp/perl_modules/Dahdi/Chans.pm | 3 ++- xpp/perl_modules/Dahdi/Config/Gen/System.pm | 10 ++++++++-- xpp/perl_modules/Dahdi/Span.pm | 11 +++++++++-- 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/dahdi_cfg.c b/dahdi_cfg.c index 9e6bb22..6c6ffad 100644 --- a/dahdi_cfg.c +++ b/dahdi_cfg.c @@ -310,8 +310,9 @@ int spanconfig(char *keyword, char *args) int argc; int span; int timing; - argc = res = parseargs(args, realargs, 7, ','); - if ((res < 5) || (res > 7)) { + int i; + argc = res = parseargs(args, realargs, 9, ','); + if ((res < 5) || (res > 9)) { error("Incorrect number of arguments to 'span' (should be ,,,,[, crc4 | yellow [, yellow]])\n"); return -1; } @@ -366,23 +367,22 @@ int spanconfig(char *keyword, char *args) error("Coding must be one of 'ami', 'b8zs' or 'hdb3', not '%s'\n", realargs[4]); return -1; } - if (argc > 5) { - if (!strcasecmp(realargs[5], "yellow")) + for (i = 5; i < argc; i++) { + if (!strcasecmp(realargs[i], "yellow")) lc[spans].lineconfig |= DAHDI_CONFIG_NOTOPEN; - else if (!strcasecmp(realargs[5], "crc4")) { + else if (!strcasecmp(realargs[i], "crc4")) lc[spans].lineconfig |= DAHDI_CONFIG_CRC4; - } else { - error("Only valid fifth arguments are 'yellow' or 'crc4', not '%s'\n", realargs[5]); - return -1; - } - } - if (argc > 6) { - if (!strcasecmp(realargs[6], "yellow")) - lc[spans].lineconfig |= DAHDI_CONFIG_NOTOPEN; + else if (!strcasecmp(realargs[i], "nt")) + lc[spans].lineconfig |= DAHDI_CONFIG_NTTE; + else if (!strcasecmp(realargs[i], "te")) + lc[spans].lineconfig &= ~DAHDI_CONFIG_NTTE; + else if (!strcasecmp(realargs[i], "term")) + lc[spans].lineconfig |= DAHDI_CONFIG_TERM; else { - error("Only valid sixth argument is 'yellow', not '%s'\n", realargs[6]); + error("Remaining arguments may be any of: 'yellow', 'crc4', 'nt', 'te', 'term', not '%s'\n", realargs[i]); return -1; } + } lc[spans].span = span; lc[spans].sync = timing; diff --git a/xpp/perl_modules/Dahdi/Chans.pm b/xpp/perl_modules/Dahdi/Chans.pm index 531eb8b..820deef 100644 --- a/xpp/perl_modules/Dahdi/Chans.pm +++ b/xpp/perl_modules/Dahdi/Chans.pm @@ -151,7 +151,8 @@ sub new($$$$$$) { # cwain: Junghanns E1 card. # R[124]: Rhino r1t1/rxt1 cards $type = "PRI"; - } elsif ($fqn =~ m{\b(B4|ZTHFC\d*|ztqoz\d*)/.*}) { + } elsif ($fqn =~ m{\b(WCBRI|B4|ZTHFC\d*|ztqoz\d*)/.*}) { + # WCBRI: The Digium Hx8 series cards with BRI module. # B4: The Digium wcb4xxp DAHDI driver # ZTHFC: HFC-s single-port card (zaphfc/vzaphfc) # ztqoz: qozap (Junghanns) multi-port HFC card diff --git a/xpp/perl_modules/Dahdi/Config/Gen/System.pm b/xpp/perl_modules/Dahdi/Config/Gen/System.pm index d1dfe40..d7c2523 100644 --- a/xpp/perl_modules/Dahdi/Config/Gen/System.pm +++ b/xpp/perl_modules/Dahdi/Config/Gen/System.pm @@ -112,6 +112,10 @@ sub gen_digital($$$) { $span_crc4 = (defined $span_crc4) ? ",$span_crc4" : ''; my $span_yellow = $span->yellow(); $span_yellow = (defined $span_yellow) ? ",$span_yellow" : ''; + my $span_termination = $span->termination(); + $span_termination = (defined $span_termination) ? ",$span_termination" : ''; + my $span_softntte = $span->softntte(); + $span_softntte = (defined $span_softntte) ? ",$span_softntte" : ''; # "MFC/R2 does not normally use CRC4" # FIXME: a finer way to override: if ($gconfig->{'pri_connection_type'} eq 'R2') { @@ -119,14 +123,16 @@ sub gen_digital($$$) { $framing = 'cas'; } $timing = ($termtype eq 'NT') ? 0 : $bri_te_last_timing++; - printf "span=%d,%d,%d,%s,%s%s%s\n", + printf "span=%d,%d,%d,%s,%s%s%s%s%s\n", $num, $timing, $lbo, $framing, $coding, $span_crc4, - $span_yellow; + $span_yellow, + $span_termination, + $span_softntte; printf "# termtype: %s\n", lc($termtype); my $dchan_type; if ($span->is_bri()) { diff --git a/xpp/perl_modules/Dahdi/Span.pm b/xpp/perl_modules/Dahdi/Span.pm index b7987e1..943ab2b 100644 --- a/xpp/perl_modules/Dahdi/Span.pm +++ b/xpp/perl_modules/Dahdi/Span.pm @@ -135,6 +135,7 @@ my @bri_strings = ( 'octoBRI \[(NT|TE)\] ', 'HFC-S PCI A ISDN.* \[(NT|TE)\] ', '(B4XXP) \(PCI\) Card', # Does not expose NT/TE type + '(WCBRI)', # has selectable NT/TE modes via dahdi_cfg ); my @pri_strings = ( @@ -194,7 +195,7 @@ sub new($$) { foreach my $cardtype (@bri_strings) { if($head =~ m/$cardtype/) { my $termtype = $1; - $termtype = 'TE' if ( $1 eq 'B4XXP' ); + $termtype = 'TE' if ( $1 eq 'B4XXP' or $1 eq 'WCBRI' ); $self->{IS_DIGITAL} = 1; $self->{IS_BRI} = 1; $self->{TERMTYPE} = $termtype; @@ -259,6 +260,8 @@ sub new($$) { $self->{CHANS} = \@channels; $self->{YELLOW} = undef; $self->{CRC4} = undef; + $self->{SOFTNTTE} = undef; + $self->{TERMINATION} = undef; if($self->is_bri()) { $self->{CODING} = 'ami'; $self->{DCHAN} = ($self->chans())[$self->{DCHAN_IDX}]; @@ -266,7 +269,11 @@ sub new($$) { # Infer some info from channel name: my $first_chan = ($self->chans())[0] || die "$0: No channels in span #$num\n"; my $chan_fqn = $first_chan->fqn(); - if($chan_fqn =~ m(ZTHFC.*/|ztqoz.*/|XPP_BRI_.*|B4/.*)) { # BRI + if($chan_fqn =~ m(ZTHFC.*/|ztqoz.*/|XPP_BRI_.*|B4/.*|WCBRI/.*)) { # BRI + if($chan_fqn =~ m(WCBRI/.*)) { # make sure to set termination resistors on hybrid cards + $self->{TERMINATION} = 'term'; + $self->{SOFTNTTE} = 'te'; + } $self->{FRAMING} = 'ccs'; $self->{SWITCHTYPE} = 'euroisdn'; $self->{SIGNALLING} = ($self->{TERMTYPE} eq 'NT') ? $DAHDI_BRI_NET : $DAHDI_BRI_CPE ; -- cgit v1.2.3