summaryrefslogtreecommitdiff
path: root/kernel/xpp/utils/twinstar
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2009-05-27 10:01:24 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2009-05-27 10:01:24 +0000
commit18c6813f2c788b603dab363b9138d65d24252167 (patch)
tree92402484268f2bc1d5e4e55f7321b9204ad47c5f /kernel/xpp/utils/twinstar
parent2a73224819e867eaf56371d6055e2ca4d36396b6 (diff)
Big dump of newer xpp code.
For finer details and separate commits, you are advised to look into the commit log of dahdi-{linux,tools}. xpp.r7150 * 116x Astribanks: - Support for the TwinStar capability and for FXO and (BRI|PRI) on same device. - New control protocol ("MPP"). - astribank_hextool - a low-level firmware loading tool instead of fpga_load . - astribank_tool - Other MPP activities . - Can still reset (but just that) through older protocol. - astribank_hexload is required for loading FPGA firmware for USB_FW.hex rev > 6885. - USB_FW rev. 7071 . - More modular FPGA firmware (1161 only). - FPGA_1161.hex rev. 7131. PIC_TYPE_* rev. 7107. - software-settings of some capabilities with astribank_allow . * XPP: - init_card_* script are less verbose. - Reduced rate of "Is a DAHDI sync master" message. - Replace member bus_id with dev_name() and set_dev_name() for building with 2.6.30. - Conditionally remove 'owner' property of procfs was dropped in 2.6.30. - astribank_hook now enabled by default. - Has an optional hook for TwinStar. * BRI: - hardhdlc support: The bri_dchan patch is no longer needed. - If bri_dchan patch applied: old code is used, and "dchan" is used. - If not: new code and "hardhdlc" is used. - zapconf will generate the right configuration, depending on the new sysfs driver attribute bri_hardhdlc, but default to "dchan" as before if not explicitly told. - Bugfix: explicitly turn off leds on startup. * FXS: - Initialization and calibration fixes. - Notify the user just one about wrong VMWI config * Dahdi-perl: - Fix detection of empty slots in wctdm. - Fix working with ethmf's extra file in /proc/zaptel - Improved detection of Rhino cards. - dahdi_genconf's generated text better explains files are generated. - /etc/xpp_order - allow specifiying an explicit order for Astribanks to register with Zaptel. - Dahdi::Xpp::Mpp - A wrapper around astribank_tool . * dahdi.init: - A separate waitfor_xpds script. May now have a wait-loop in some cases. - xpp_sync needs to only be called after dahdi_cfg . (for the PRI module). git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4641 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'kernel/xpp/utils/twinstar')
-rwxr-xr-xkernel/xpp/utils/twinstar160
1 files changed, 160 insertions, 0 deletions
diff --git a/kernel/xpp/utils/twinstar b/kernel/xpp/utils/twinstar
new file mode 100755
index 0000000..1c4fe78
--- /dev/null
+++ b/kernel/xpp/utils/twinstar
@@ -0,0 +1,160 @@
+#! /usr/bin/perl -w
+#
+# Written by Oron Peled <oron@actcom.co.il>
+# Copyright (C) 2007, Xorcom
+# This program is free software; you can redistribute and/or
+# modify it under the same terms as Perl itself.
+#
+# $Id$
+#
+use strict;
+use File::Basename;
+use Getopt::Std;
+BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/zconf"); }
+
+use Zaptel;
+use Zaptel::Hardware;
+use Zaptel::Span;
+use Zaptel::Xpp;
+use Zaptel::Xpp::Xbus;
+use Zaptel::Xpp::Mpp;
+
+sub usage {
+ die "Usage: $0 {status|jump|enable-wd|disable-wd|ports}\n";
+}
+
+our ($opt_v, $opt_x);
+getopts('vx') || usage;
+@ARGV == 1 or usage;
+
+
+# Find USB bus toplevel
+my $usb_top;
+$usb_top = '/dev/bus/usb';
+$usb_top = '/proc/bus/usb' unless -d $usb_top;
+die "No USB toplevel found\n" unless -d $usb_top;
+
+sub tws_devs() {
+ my @devs;
+ foreach my $dev (Zaptel::Hardware->device_list) {
+ next unless $dev->is_astribank;
+ next unless $dev->product =~ /116./;
+ push(@devs, $dev->hardware_name);
+ }
+ return @devs;
+}
+
+sub tws_usb_devfile($) {
+ my $name = shift || die;
+ # Remove prefix
+ if($name !~ s/usb://) {
+ die "$name is not a USB name\n";
+ }
+ return "$usb_top/$name";
+}
+
+sub tws_show(@) {
+ my @usb_devs = @_;
+ my $format = "%-15s %-10s %-15s %-10s %-10s\n";
+
+ printf $format, 'DEVICE', 'PORT', 'WATCHDOG', 'POWER0', 'POWER1';
+ foreach my $dev (@usb_devs) {
+ my $mppinfo = $dev->mppinfo;
+ if(!defined $mppinfo) {
+ printf STDERR "%s: no MPP information\n", $dev->hardware_name;
+ next;
+ }
+ if(!defined $mppinfo->{TWINSTAR_PORT}) {
+ printf STDERR "%s: no TWINSTAR_PORT information\n", $dev->hardware_name;
+ next;
+ }
+ my $power = $mppinfo->twinstar_power;
+ printf $format,
+ $dev->hardware_name,
+ $mppinfo->twinstar_port,
+ ($mppinfo->twinstar_watchdog) ? "on" : "off",
+ ($power->[0]) ? "yes" : "no",
+ ($power->[1]) ? "yes" : "no";
+ }
+}
+
+sub tws_portnum($) {
+ my $dev = shift || die "Missing dev";
+ my $mppinfo = $dev->mppinfo;
+ if(!defined $mppinfo) {
+ printf STDERR "%s: no MPP information\n", $dev->hardware_name;
+ return undef;
+ }
+ return $mppinfo->twinstar_port;
+}
+
+sub tws_showports(@) {
+ my @usb_devs = @_;
+ foreach my $dev (@usb_devs) {
+ my $mppinfo = $dev->mppinfo;
+ if(!defined $mppinfo) {
+ printf STDERR "%s: no MPP information\n", $dev->hardware_name;
+ next;
+ }
+ if(!defined $mppinfo->{TWINSTAR_PORT}) {
+ printf STDERR "%s: no TWINSTAR_PORT information\n", $dev->hardware_name;
+ next;
+ }
+ printf "%s\n", $mppinfo->{TWINSTAR_PORT};
+ }
+}
+
+sub tws_watchdog($@) {
+ my $on = shift;
+ die "tws_watchdog() on/off?" unless defined $on;
+ my @usb_devs = @_;
+
+ foreach my $dev (@usb_devs) {
+ my $mppinfo = $dev->mppinfo;
+ if(!defined $mppinfo) {
+ printf STDERR "%s: no MPP information\n", $dev->hardware_name;
+ next;
+ }
+ $mppinfo->mpp_setwatchdog($on);
+ }
+}
+
+sub tws_jump(@) {
+ my @usb_devs = @_;
+
+ foreach my $dev (@usb_devs) {
+ my $mppinfo = $dev->mppinfo;
+ if(!defined $mppinfo) {
+ printf STDERR "%s: no MPP information\n", $dev->hardware_name;
+ next;
+ }
+ $mppinfo->mpp_jump;
+ }
+}
+
+sub dev_list() {
+ my @devs;
+ foreach my $dev (Zaptel::Hardware->device_list) {
+ next unless $dev->is_astribank;
+ next unless $dev->product =~ /116./;
+ Zaptel::Xpp::Mpp->mpp_addinfo($dev);
+ push(@devs, $dev);
+ }
+ return @devs;
+}
+
+my @usb_devices = dev_list();
+
+if($ARGV[0] eq 'status') {
+ tws_show(@usb_devices);
+} elsif($ARGV[0] eq 'jump') {
+ tws_jump(@usb_devices);
+} elsif($ARGV[0] eq 'disable-wd') {
+ tws_watchdog(0, @usb_devices);
+} elsif($ARGV[0] eq 'enable-wd') {
+ tws_watchdog(1, @usb_devices);
+} elsif($ARGV[0] eq 'ports') {
+ tws_showports(@usb_devices);
+}
+
+__END__