diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-03-06 22:54:16 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2008-03-06 22:54:16 +0000 |
commit | 3b3d8f7b1186f672e16cd7e4ded2f405ec43cb1c (patch) | |
tree | 5e592d92e3030b4eb28cab7585f769dbbeab2d74 /xpp/utils/xpp_fxloader | |
parent | 07b404b68141bc981adbc1f5a00cbe90116fb9c1 (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
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@3952 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/utils/xpp_fxloader')
-rw-r--r-- | xpp/utils/xpp_fxloader | 101 |
1 files changed, 74 insertions, 27 deletions
diff --git a/xpp/utils/xpp_fxloader b/xpp/utils/xpp_fxloader index dbe5b98..1cbd6b7 100644 --- a/xpp/utils/xpp_fxloader +++ b/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 |