[svn-commits] tzafrir: branch tools/tzafrir/sysfs r8696 - /tools/team/tzafrir/sysfs/xpp/per...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed May 26 13:10:11 CDT 2010
Author: tzafrir
Date: Wed May 26 13:10:09 2010
New Revision: 8696
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8696
Log:
initial perl_modules fixes for PRI:
* Refactor common code into set_pri_parameters():
- So we can call it also from Dahdi::Span->new() and not only
from old new_procfs() code.
* Initialize BCHANS and DCHAN for PRI just like BRI (maybe we should
merge them in the future)
* rename init_proto() to set_pri_proto()
Modified:
tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm
Modified: tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm?view=diff&rev=8696&r1=8695&r2=8696
==============================================================================
--- tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm (original)
+++ tools/team/tzafrir/sysfs/xpp/perl_modules/Dahdi/Span.pm Wed May 26 13:10:09 2010
@@ -232,7 +232,7 @@
our $DAHDI_PRI_NET = 'pri_net';
our $DAHDI_PRI_CPE = 'pri_cpe';
-sub init_proto($$) {
+sub set_pri_proto($) {
my $self = shift;
my $proto = shift;
@@ -245,6 +245,22 @@
$self->{BCHAN_LIST} = [ 0 .. 22 ];
}
$self->{TYPE} = "${proto}_$self->{TERMTYPE}";
+}
+
+sub set_pri_parameters() {
+ my $self = shift;
+ if($self->{PROTO} eq 'E1') {
+ $self->{CODING} = 'hdb3';
+ $self->{FRAMING} = 'ccs';
+ $self->{SWITCHTYPE} = 'euroisdn';
+ $self->{CRC4} = 'crc4';
+ } elsif($self->{PROTO} eq 'T1') {
+ $self->{CODING} = 'b8zs';
+ $self->{FRAMING} = 'esf';
+ $self->{SWITCHTYPE} = 'national';
+ } else {
+ die "'$self->{PROTO}' unsupported yet";
+ }
}
sub _get_dev_attr($$) {
@@ -351,7 +367,7 @@
# FIXME: BRI modules of wct24xxp?
$self->{IS_DIGITAL} = 1;
$self->{IS_BRI} = 1;
- # Fixme: figure out termtype for Astribanks and such
+ # FIXME: figure out termtype for Astribanks and such
#$self->{TERMTYPE} = $1 || $2;
$self->{TERMTYPE} = 'TE';
$self->{FRAMING} = 'ccs';
@@ -366,6 +382,10 @@
} elsif ($self->spantype =~ /^(E1|J1|T1)$/) {
$self->{IS_DIGITAL} = 1;
$self->{IS_PRI} = 1;
+ # FIXME: figure out termtype for Astribanks and such
+ $self->{TERMTYPE} = 'TE';
+ $self->set_pri_proto($self->spantype);
+ $self->set_pri_parameters;
}
$self->{CHANS} = [];
@@ -380,7 +400,10 @@
$self->{DCHAN} = ($self->chans())[$self->{DCHAN_IDX}];
$self->{BCHANS} = [ ($self->chans())[@{$self->{BCHAN_LIST}}] ];
}
-
+ if ($self->is_pri()) {
+ $self->{DCHAN} = ($self->chans())[$self->{DCHAN_IDX}];
+ $self->{BCHANS} = [ ($self->chans())[@{$self->{BCHAN_LIST}}] ];
+ }
return $self;
}
@@ -424,7 +447,7 @@
$self->{IS_DIGITAL} = 1;
$self->{IS_PRI} = 1;
$self->{TERMTYPE} = $termtype;
- $self->init_proto($proto);
+ $self->set_pri_proto($proto);
last;
}
}
@@ -449,13 +472,13 @@
# Check for PRI with unknown type strings
if($index == 31) {
if($self->{PROTO} eq 'UNKNOWN') {
- $self->init_proto('E1');
+ $self->set_pri_proto('E1');
} elsif($self->{PROTO} ne 'E1') {
die "$index channels in a $self->{PROTO} span";
}
} elsif($index == 24) {
if($self->{PROTO} eq 'UNKNOWN') {
- $self->init_proto('T1'); # FIXME: J1?
+ $self->set_pri_proto('T1'); # FIXME: J1?
} elsif($self->{PROTO} ne 'T1') {
die "$index channels in a $self->{PROTO} span";
}
@@ -490,18 +513,7 @@
if($self->is_pri()) {
$self->{DCHAN} = ($self->chans())[$self->{DCHAN_IDX}];
$self->{BCHANS} = [ ($self->chans())[@{$self->{BCHAN_LIST}}] ];
- if($self->{PROTO} eq 'E1') {
- $self->{CODING} = 'hdb3';
- $self->{FRAMING} = 'ccs';
- $self->{SWITCHTYPE} = 'euroisdn';
- $self->{CRC4} = 'crc4';
- } elsif($self->{PROTO} eq 'T1') {
- $self->{CODING} = 'b8zs';
- $self->{FRAMING} = 'esf';
- $self->{SWITCHTYPE} = 'national';
- } else {
- die "'$self->{PROTO}' unsupported yet";
- }
+ $self->set_pri_parameters;
}
return $self;
}
More information about the svn-commits
mailing list