diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-12-18 14:31:07 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-12-18 14:31:07 +0000 |
commit | cfd61537b47387b0fb5c8228baad6cec16d8f6e6 (patch) | |
tree | 108deea65c09c7c273a9b981f8783efcd433eaea /xpp/utils/zconf/Zaptel/Xpp/Xbus.pm | |
parent | 4391b4a6ee42bdfd8e097c5ee5485e9eb13f19a0 (diff) |
xpp r5151:
* xpd_pri: Basically ready.
* PCM synchronization changes:
- Each Astribank unit ticks independently. Each with its own PLL.
- HOST synchronization is gone. Loading of xpp will no longer cause
useless 250 ticks per second if you have no Astribank.
- Synchronization from the zaptel sync master requires setting
ZAPTEL as sync source (xpp_sync ZAPTEL).
* 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.
* perl module and utilities:
- Modules no longer magically scan system on initialization.
- Scanning is by calling explicit methods.
- "Serial" has been renamed "Label". It is basically unique, but
should be modifieble.
- Some basic documentation of zaptel perl modules.
* Default sort order of zt_registration is back to SORT_CONNCTOR.
* zt_registration proc file now shows the number of span registered to
if registered. Try: grep . /proc/xpp/XBUS-*/XPD-*/zt_registration
* genzaptelconf: Allow using a custom command instead of
/etc/init.d/asterisk to start/stop asterisk.
* Fixed the typo "Slagish".
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@3506 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/utils/zconf/Zaptel/Xpp/Xbus.pm')
-rw-r--r-- | xpp/utils/zconf/Zaptel/Xpp/Xbus.pm | 80 |
1 files changed, 53 insertions, 27 deletions
diff --git a/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm b/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm index 7951d98..57c93f5 100644 --- a/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm +++ b/xpp/utils/zconf/Zaptel/Xpp/Xbus.pm @@ -8,23 +8,11 @@ package Zaptel::Xpp::Xbus; # $Id$ # use strict; +use XppUtils; use Zaptel::Xpp::Xpd; my $proc_base = "/proc/xpp"; -# Accessors (miniperl does not have Class:Accessor) -our $AUTOLOAD; -sub AUTOLOAD { - my $self = shift; - my $name = uc($AUTOLOAD); - $name =~ s/.*://; # strip fully-qualified portion - if (@_) { - return $self->{$name} = shift; - } else { - return $self->{$name}; - } -} - sub xpds($) { my $xbus = shift; return @{$xbus->{XPDS}}; @@ -39,17 +27,27 @@ sub by_number($) { return $xbus; } +sub by_label($) { + my $label = shift; + die "Missing xbus label parameter" unless defined $label; + my @xbuses = Zaptel::Xpp::xbuses(); + + my ($xbus) = grep { $_->label eq $label } @xbuses; + return $xbus; +} + sub get_xpd_by_number($$) { my $xbus = shift; - my $xpdnum = shift; - die "Missing XPD number parameter" unless defined $xpdnum; + my $xpdid = shift; + die "Missing XPD id parameter" unless defined $xpdid; my @xpds = $xbus->xpds; - return $xpds[$xpdnum]; + return $xpds[$xpdid]; } sub new($$) { my $pack = shift or die "Wasn't called as a class method\n"; my $self = {}; + bless $self, $pack; while(@_) { my ($k, $v) = @_; shift; shift; @@ -61,7 +59,13 @@ sub new($$) { } $self->{$k} = $v; } - bless $self, $pack; + # backward compat for drivers without labels. + if(!defined $self->{LABEL}) { + $self->{LABEL} = '[]'; + } + $self->{LABEL} =~ s/^\[(.*)\]$/$1/ or die "$self->{NAME}: Bad label"; + # Fix badly burned labels. + $self->{LABEL} =~ s/[[:^print:]]/_/g; $self->{NAME} or die "Missing xbus name"; my $prefix = "$proc_base/" . $self->{NAME}; my $usbfile = "$prefix/xpp_usb"; @@ -73,19 +77,41 @@ sub new($$) { $self->{USB_DEVNAME} = $head; } @{$self->{XPDS}} = (); - foreach my $fqn (glob "$prefix/XPD-??") { - $fqn =~ s:$proc_base/::; - $fqn =~ /(\d+)$/; - my $num = $1; - my $xpd = Zaptel::Xpp::Xpd->new( - FQN => $fqn, - NUM =>, $num, - XBUS => $self - ); + foreach my $dir (glob "$prefix/XPD-??") { + my $xpd = Zaptel::Xpp::Xpd->new($self, $dir); push(@{$self->{XPDS}}, $xpd); } - @{$self->{XPDS}} = sort { $a->num <=> $b->num } @{$self->{XPDS}}; + @{$self->{XPDS}} = sort { $a->id <=> $b->id } @{$self->{XPDS}}; return $self; } +sub pretty_xpds($) { + my $xbus = shift; + my @xpds = sort { $a->id <=> $b->id } $xbus->xpds(); + my @xpd_types = map { $_->type } @xpds; + my $last_type = ''; + my $mult = 0; + my $xpdstr = ''; + foreach my $curr (@xpd_types) { + if(!$last_type || ($curr eq $last_type)) { + $mult++; + } else { + if($mult == 1) { + $xpdstr .= "$last_type "; + } elsif($mult) { + $xpdstr .= "$last_type*$mult "; + } + $mult = 1; + } + $last_type = $curr; + } + if($mult == 1) { + $xpdstr .= "$last_type "; + } elsif($mult) { + $xpdstr .= "$last_type*$mult "; + } + $xpdstr =~ s/\s*$//; # trim trailing space + return $xpdstr; +} + 1; |