diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-03-07 00:45:53 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-03-07 00:45:53 +0000 |
commit | 1a571d19740d87e24b92ef49a2d38b26256112ae (patch) | |
tree | 8490182ea096b25f977d73c8c7a89b286014b94c /kernel/xpp/utils | |
parent | 92d02c5fadec34a75c085e9f95eeab268c3683c8 (diff) |
xpp.r5512:
* Build:
- Zaptel >= 1.4.9 is migrating to storing kernel stuff in zaptel/kernel/*
- We conditionally use old/new directory scheme:
In xpp/Kbuild and xpp/utils/Makefile use ZAP_KERNEL variable, so it's
not confused with ZAPTEL_DIR (which appears in zaptel/Makefile as well).
- Fix compile warnings on 64 bit systems.
- Compile fixes for kernel-2.6.24
* UDEV:
- /etc/udev/rules.d/xpp.rules now uses XPP_INIT_DIR to find astribank_hook.
- astribank_hook: Modify to do nothing. Add some documentation.
* Autoconfiguration -- zapconf:
- Don't fail zapconf et.al. if no config file was found.
- Skip the 'IRQ Missing:' line in /proc/zaptel/nnn for wcte1xp(?).
- Add some newer Digium cards to our hardware inventory.
- Partially handle cases where the /proc/zaptel strings does not contain
info about E1/T1/J1 or NT/TE.
* Better SYNC:
- Finer tuning of PLL (New firmware).
- Change calculation algorithm of sync offset. It now copes better
with the variance in USB frame reception timing.
- Statistics:
. The view of results was moved from /proc/xpp/XBUS-*/summary to
a new /sys/bus/astribanks/devices/xbus-*/timing and enhanced.
. A new xpp_timing script shows all astribanks.
. A new write only /sys/bus/astribanks/devices/xbus-*/cls is
used to clear statistics. Eventually, clearing of XBUS related
statistics should be done here. One that was migrated is the
clearing of 'PCM [TR]X:' numbers currently appearing in
/proc/xpp/XBUS-*/summary (they should be moved too later).
- Shorten the strings representation sync_mode ("SYNC_MODE_AB" -> "AB")
adapted their use in printk and /proc so the text is clear.
- Added a command line parameter xpp.disable_pll_sync to stop all
adjustments command to AB (calculations still continue as usual).
* PRI:
- 4 port support
- set clocking master span via ztcfg, like other zaptel devices.
* FXO:
- Fix false hangups in some countries (voltage fluctuations).
- Some countries send caller-id before first ring.
Added code to handle caller-id PCM pass through according to
a new command line parameter (xpd_fxo.caller_id_style).
- No longer sends an event on zt_open. See #12160 .
* Misc:
- Adapt to zaptel-1.4.8 and above ztscan: added fields returend by
new ZT_SPANSTAT_V2 ioctl()
- Document sysfs and waitfor_xpds.
- Miscelaneous optimizations and bugfixes.
- Remove deprecated pcm_tasklet parameter. The rx_tasklet parameter has
replaced it a long time ago.
- Add RX_CMD counter to /proc/xpp/XBUS-*/summary
- Unclutter some of the usb disconnect messages.
- xpp_usb: minor preformance improvements in receive.
Expose the number of pending receive URB's in /proc/xpp/XBUS-*/xpp_usb
Merged revisions 3952 via svnmerge from
http://svn.digium.com/svn/zaptel/branches/1.2
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3957 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'kernel/xpp/utils')
-rw-r--r-- | kernel/xpp/utils/Makefile | 11 | ||||
-rwxr-xr-x | kernel/xpp/utils/astribank_hook | 22 | ||||
-rw-r--r-- | kernel/xpp/utils/xpp.rules | 3 | ||||
-rw-r--r-- | kernel/xpp/utils/xpp_fxloader | 101 | ||||
-rwxr-xr-x | kernel/xpp/utils/xpp_timing | 6 | ||||
-rwxr-xr-x | kernel/xpp/utils/zapconf | 29 | ||||
-rw-r--r-- | kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm | 3 | ||||
-rw-r--r-- | kernel/xpp/utils/zconf/Zaptel/Span.pm | 64 |
8 files changed, 186 insertions, 53 deletions
diff --git a/kernel/xpp/utils/Makefile b/kernel/xpp/utils/Makefile index 437b359..d880842 100644 --- a/kernel/xpp/utils/Makefile +++ b/kernel/xpp/utils/Makefile @@ -4,7 +4,14 @@ RANLIB = ranlib INSTALL = install INSTALL_DATA = install -m 644 -ZAPTEL_DIR ?= ../.. +# +# Ugly hack to find kernel directories before/after the split +# to kernel/user-space. +# +# These variables should be passed to us. But until then... +# +ZAPTEL_DIR ?= $(shell if [ -f "../../zaptel.h" ]; then echo "../.."; else echo "../../.."; fi) +ZAP_KERNEL ?= $(shell if [ -d "$(ZAPTEL_DIR)/kernel" ]; then echo "$(ZAPTEL_DIR)/kernel"; else echo "$(ZAPTEL_DIR)"; fi) -include $(ZAPTEL_DIR)/makeopts @@ -42,7 +49,7 @@ ifeq (,$(PBX_LIBUSB)) PBX_LIBUSB = $(shell if [ -r /usr/include/usb.h ]; then echo 1; else echo 0; fi) endif -WCTDM=$(ZAPTEL_DIR)/wctdm.c +WCTDM=$(ZAP_KERNEL)/wctdm.c CFLAGS = -g -Wall $(EXTRA_CFLAGS) diff --git a/kernel/xpp/utils/astribank_hook b/kernel/xpp/utils/astribank_hook index 351cd93..8dd13c9 100755 --- a/kernel/xpp/utils/astribank_hook +++ b/kernel/xpp/utils/astribank_hook @@ -4,19 +4,14 @@ # calls /usr/share/zaptel/astribank_hook after a new Astribank is ready # and after and old Astribank device has been destroyed. # -# This example script sets the sync source, and thus makes the call to -# xpp_sync in the init.d script unnecessary. set -e -xpp_sync="/usr/sbin/xpp_sync" - me=`basename $0` INIT_DIR=`dirname $0` XPP_BASE=/proc/xpp export XPP_BASE LOGGER="logger -s -t $me" -XPP_SYNC='auto' ZAPTEL_BOOT_DEBIAN=${ZAPTEL_BOOT_DEBIAN:-/etc/default/zaptel} ZAPTEL_BOOT_FEDORA=${ZAPTEL_BOOT_FEDORA:-/etc/sysconfig/zaptel} @@ -37,17 +32,26 @@ fi ## If you wish to trace this script: #exec 2> "/tmp/astribank_hook_$XBUS_NAME" -$LOGGER -p kern.info "$ACTION: $*. Setting sync to $XPP_SYNC." +# Maybe add some logging +#$LOGGER -p kern.info "$0: $ACTION: $*." case "$ACTION" in add) - "$xpp_sync" $XPP_SYNC + # An Astribank was added and is initialized and ready. + # Put your shell commands bellow + : ;; remove) - "$xpp_sync" $XPP_SYNC + # An Astribank was Removed. + # Put your shell commands bellow + # You should not access /proc/xpp/... or run related utilities + # like xpp_sync, since this is likely to cause very bad race + # conditions during driver removal. + : ;; *) ;; esac -"$xpp_sync" | $LOGGER -p kern.info +# Maybe add some logging +#$LOGGER -p kern.info "$0: Done: $ACTION: $*." diff --git a/kernel/xpp/utils/xpp.rules b/kernel/xpp/utils/xpp.rules index 794a9f0..d3cc226 100644 --- a/kernel/xpp/utils/xpp.rules +++ b/kernel/xpp/utils/xpp.rules @@ -9,5 +9,6 @@ SYSFS{idVendor}=="e4e4", SYSFS{idProduct}=="11[345][01]", \ LABEL="xpp_usb_add_end" # Hotplug hook for Astribank up/down -KERNEL=="xbus*" RUN+="/usr/share/zaptel/astribank_hook udev $kernel $sysfs{status} $sysfs{connector}" +# By default XPP_INIT_DIR="/usr/share/zaptel" +KERNEL=="xbus*" RUN+="%E{XPP_INIT_DIR}/astribank_hook udev $kernel $sysfs{status} $sysfs{connector}" diff --git a/kernel/xpp/utils/xpp_fxloader b/kernel/xpp/utils/xpp_fxloader index dbe5b98..1cbd6b7 100644 --- a/kernel/xpp/utils/xpp_fxloader +++ b/kernel/xpp/utils/xpp_fxloader @@ -53,7 +53,17 @@ PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin" export PATH me=`basename $0` -DEFAULTS="/etc/default/zaptel" +DEBIAN_DEFAULTS="/etc/default/zaptel" +REDHAT_DEFAULTS="/etc/sysconfig/zaptel" + +if [ -r "$DEBIAN_DEFAULTS" -a -r "$REDHAT_DEFAULTS" ]; then + echo 1>&2 "$0: Both '$DEBIAN_DEFAULTS' and '$REDHAT_DEFAULTS' exist" + exit 1 +elif [ -r "$DEBIAN_DEFAULTS" ]; then + DEFAULTS="$DEBIAN_DEFAULTS" +elif [ -r "$REDHAT_DEFAULTS" ]; then + DEFAULTS="$REDHAT_DEFAULTS" +fi if [ -t 2 ]; then LOGGER="logger -i -t '$me' -s" @@ -68,7 +78,6 @@ USB_PREFIX= FIRMWARE_DIR="${FIRMWARE_DIR:-/usr/share/zaptel}" FIRM_FXS=$FIRMWARE_DIR/FPGA_FXS.hex -REENUM_SLEEP_TIME=3 # only used on manual runs FPGA_LOAD=${FPGA_LOAD:-/usr/sbin/fpga_load} USB_FW="${USB_FW:-USB_FW.hex}" @@ -119,27 +128,6 @@ load_fw() { $LOGGER "USB Firmware $FIRMWARE_DIR/$fw into $dev" do_fxload -D $dev -I $FIRMWARE_DIR/$fw || exit 1 done - - # Allow time for reenumeration: This only matters in the manual case. - if [ "$devices" != '' ]; then sleep $REENUM_SLEEP_TIME; fi -} - -reset_fpga() { - v_id=$1 - p_id=$2 - - devices=`find_dev $v_id $p_id` - for dev in $devices - do - $LOGGER "Resetting FPGA Firmware on $dev" - sleep_if_race - $FPGA_LOAD -D "$dev" -r 2>&1 >/dev/null | $LOGGER - status=$PIPESTATUS - if [ "$status" != 0 ]; then - echo "fpga_load failed remoivng with status $status" | $LOGGER - exit 78 - fi - done } load_fpga() { @@ -150,6 +138,7 @@ load_fpga() { devices=`find_dev $v_id $p_id` for dev in $devices do + ( card_ver=`$FPGA_LOAD -g -D $dev | sed -n 's/^.*Release: *//'` $LOGGER "FPGA Firmware into $dev" @@ -160,7 +149,60 @@ load_fpga() { echo "fpga_load failed with status $status" | $LOGGER exit 77 fi + ) & + sleep 0.4 done + wait +} + +numdevs() { + v_ids="$1" + p_ids="$2" + + for v in $v_ids + do + ( + for p in $p_ids + do + find_dev $v $p + done + ) + done | wc -w +} + +wait_renumeration() { + num="$1" + v_ids="$2" + p_ids="$3" + + while + n=`numdevs "$v_ids" "$p_ids"` + [ "$num" -gt "$n" ] + do + echo -n "." + sleep 1 + done + echo "Got all $num devices" +} + +reset_fpga() { + totaldevs=`numdevs e4e4 '11[3456][012]'` + devices=`find_dev e4e4 '11[3456][12]'` + echo "Reseting devices [$totaldevs devices]" + for dev in $devices + do + $LOGGER "Resetting FPGA Firmware on $dev" + sleep_if_race + $FPGA_LOAD -D "$dev" -r 2>&1 >/dev/null | $LOGGER + status=$PIPESTATUS + if [ "$status" != 0 ]; then + echo "fpga_load failed removing with status $status" | $LOGGER + exit 78 + fi + done + if [ "$1" = 'wait' ]; then + wait_renumeration $totaldevs e4e4 '11[3456]0' + fi } ######################### @@ -176,23 +218,28 @@ udev) PRODUCT="$2" # skip on to the rest of the script. Don't exit. ;; +reset-wait) + reset_fpga wait + ;; reset) - # TODO: does the use of wildcards here work? - reset_fpga e4e4 '11[3456][12]' + reset_fpga ;; xppdetect|load|usb) - echo "--------- FIRMWARE LOADING: ($1)" - + numdevs=`numdevs e4e4 '11[3456][01]'` + echo "--------- FIRMWARE LOADING: ($1) [$numdevs devices]" + load_fw e4e4 1130 $USB_FW load_fw e4e4 1140 $USB_FW load_fw e4e4 1150 $USB_FW load_fw e4e4 1160 $USB_FW + wait_renumeration $numdevs e4e4 '11[3456]1' if [ "$1" != 'usb' ] then load_fpga e4e4 1131 FPGA_FXS.hex load_fpga e4e4 1141 FPGA_1141.hex load_fpga e4e4 1151 FPGA_1151.hex load_fpga e4e4 1161 FPGA_1161.hex + wait_renumeration $numdevs e4e4 '11[3456]2' fi sleep 3 # Let it stabilize diff --git a/kernel/xpp/utils/xpp_timing b/kernel/xpp/utils/xpp_timing new file mode 100755 index 0000000..f87215c --- /dev/null +++ b/kernel/xpp/utils/xpp_timing @@ -0,0 +1,6 @@ +#! /bin/sh +grep 'DRIFT:' /sys/bus/astribanks/devices/xbus-*/timing | sed \ + -e 's,/sys/bus/astribanks/devices/,,' \ + -e 's,/timing:,: ,' \ + -e 's,DRIFT: ,,' \ + -e 's/^[^:]*:/\U&/' diff --git a/kernel/xpp/utils/zapconf b/kernel/xpp/utils/zapconf index dd6ab1f..7f94f6b 100755 --- a/kernel/xpp/utils/zapconf +++ b/kernel/xpp/utils/zapconf @@ -67,6 +67,7 @@ my $lc_country = 'us'; my $loadzone = $lc_country; my $defaultzone = $lc_country; my $bri_sig_style = 'bri_ptmp'; +my $brint_overlap = 'no'; my %zaptel_default_vars = ( base_exten => \$base_exten, @@ -87,6 +88,7 @@ my %zaptel_default_vars = ( ], group_lines => \$default_group{FXO}, ZAPBRI_SIGNALLING => \$bri_sig_style, + brint_overlap => \$brint_overlap, ); sub map_zaptel_defaults { @@ -246,6 +248,25 @@ TAIL select $old; } +my %DefaultConfigs = ( + context => 'default', + group => '63', # FIXME: should not be needed. + overlapdial => 'no', + busydetect => 'no', + rxgain => 0, + txgain => 0, +); + +sub reset_zapata_values { + foreach my $arg (@_) { + if (exists $DefaultConfigs{$arg}) { + print "$arg = $DefaultConfigs{$arg}\n"; + } else { + print "$arg =\n"; + } + } +} + sub gen_zapata_digital($) { my $span = shift || die; my $num = $span->num() || die; @@ -254,6 +275,7 @@ sub gen_zapata_digital($) { my $termtype = $span->termtype() || die "$0: Span #$num -- unkown termtype [NT/TE]\n"; my $group = $default_group{"$type"}; my $context = $default_context{"$type"}; + my @to_reset = qw/context group/; die "$0: missing default group (termtype=$termtype)\n" unless defined($group); die "$0: missing default context\n" unless $context; @@ -263,13 +285,18 @@ sub gen_zapata_digital($) { if($span->is_bri() and $bri_sig_style eq 'bri_ptmp') { $sig .= '_ptmp'; } + if ($span->is_bri() && $termtype eq 'NT' && $brint_overlap eq 'yes') { + print "overlapdial = yes\n"; + push(@to_reset, qw/overlapdial/); + } + $group .= "," . (10 + $num); # Invent unique group per span printf "group=$group\n"; printf "context=$context\n"; printf "switchtype = %s\n", $span->switchtype; printf "signalling = %s\n", $sig; printf "channel => %s\n", bchan_range($span); - printf "group=\ncontext=default\n"; + reset_zapata_values(@to_reset); } sub gen_zapata_channel($) { diff --git a/kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm b/kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm index 45173d4..8ebddf0 100644 --- a/kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm +++ b/kernel/xpp/utils/zconf/Zaptel/Hardware/PCI.pm @@ -41,6 +41,7 @@ my %pci_ids = ( 'd161:0800' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard TDM800P' }, 'd161:8002' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard AEX800' }, 'd161:8003' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard AEX2400' }, + 'd161:8005' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard TDM410P' }, # from pciradio 'e159:0001/e16b' => { DRIVER => 'pciradio', DESCRIPTION => 'PCIRADIO' }, @@ -79,6 +80,8 @@ my %pci_ids = ( # from wcte12xp 'd161:0120' => { DRIVER => 'wcte12xp', DESCRIPTION => 'Wildcard TE12xP' }, + 'd161:8000' => { DRIVER => 'wcte12xp', DESCRIPTION => 'Wildcard TE121' }, + 'd161:8001' => { DRIVER => 'wcte12xp', DESCRIPTION => 'Wildcard TE122' }, # from tor2 '10b5:9030' => { DRIVER => 'tor2', DESCRIPTION => 'PLX 9030' }, diff --git a/kernel/xpp/utils/zconf/Zaptel/Span.pm b/kernel/xpp/utils/zconf/Zaptel/Span.pm index 7c08484..92dc4dd 100644 --- a/kernel/xpp/utils/zconf/Zaptel/Span.pm +++ b/kernel/xpp/utils/zconf/Zaptel/Span.pm @@ -36,7 +36,15 @@ my @bri_strings = ( ); my @pri_strings = ( - '(E1|T1|J1)_(NT|TE)' + '(E1|T1|J1)_(NT|TE)', + 'Tormenta 2 .*Quad (E1|T1)', # tor2. + 'Digium Wildcard .100P (T1|E1)/', # wct1xxp + 'ISA Tormenta Span 1', # torisa + 'TE110P T1/E1', # wcte11xp + 'Wildcard TE120P', # wcte12xp + 'Wildcard TE121', # wcte12xp + 'Wildcard TE122', # wcte12xp + 'T[24]XXP \(PCI\) Card ', # wct4xxp ); our $ZAPBRI_NET = 'bri_net'; @@ -45,6 +53,21 @@ our $ZAPBRI_CPE = 'bri_cpe'; our $ZAPPRI_NET = 'pri_net'; our $ZAPPRI_CPE = 'pri_cpe'; +sub init_proto($$) { + my $self = shift; + my $proto = shift; + + $self->{PROTO} = $proto; + if($proto eq 'E1') { + $self->{DCHAN_IDX} = 15; + $self->{BCHAN_LIST} = [ 0 .. 14, 16 .. 30 ]; + } elsif($proto eq 'T1') { + $self->{DCHAN_IDX} = 23; + $self->{BCHAN_LIST} = [ 0 .. 22 ]; + } + $self->{TYPE} = "${proto}_$self->{TERMTYPE}"; +} + sub new($$) { my $pack = shift or die "Wasn't called as a class method\n"; my $num = shift or die "Missing a span number parameter\n"; @@ -76,20 +99,19 @@ sub new($$) { } foreach my $cardtype (@pri_strings) { if($head =~ m/$cardtype/) { + my @info; + + push(@info, $1) if defined $1; + push(@info, $2) if defined $2; + my ($proto) = grep(/(E1|T1|J1)/, @info); + $proto = 'UNKNOWN' unless defined $proto; + my ($termtype) = grep(/(NT|TE)/, @info); + $termtype = 'TE' unless defined $termtype; + $self->{IS_DIGITAL} = 1; $self->{IS_PRI} = 1; - $self->{PROTO} = "$1"; - $self->{TERMTYPE} = $2; - $self->{TYPE} = "$1_$2"; - if($self->{PROTO} eq 'E1') { - $self->{DCHAN_IDX} = 15; - $self->{BCHAN_LIST} = [ 0 .. 14, 16 .. 30 ]; - } elsif($self->{PROTO} eq 'T1') { - $self->{DCHAN_IDX} = 23; - $self->{BCHAN_LIST} = [ 0 .. 22 ]; - } else { - die "'$self->{PROTO}' unsupported yet"; - } + $self->{TERMTYPE} = $termtype; + $self->init_proto($proto); last; } } @@ -112,6 +134,22 @@ sub new($$) { $index++; } close F; + if($self->is_pri()) { + # Check for PRI with unknown type strings + if($index == 31) { + if($self->{PROTO} eq 'UNKNOWN') { + $self->init_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? + } elsif($self->{PROTO} ne 'T1') { + die "$index channels in a $self->{PROTO} span"; + } + } + } @channels = sort { $a->num <=> $b->num } @channels; $self->{CHANS} = \@channels; $self->{YELLOW} = undef; |