summaryrefslogtreecommitdiff
path: root/xpp/utils/xpp_fxloader
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-07-06 13:47:05 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-07-06 13:47:05 +0000
commit39a1812c1ef76b6a792f00087f1e507616bbbb25 (patch)
treee50633c999779c514ef16f4a2ce7a70fc7511c9e /xpp/utils/xpp_fxloader
parent70ef1183eba2d2fe4f00668fd3438b7f1c842c94 (diff)
Tons of updates to the Astribank (xpp) driver:
* xpd_fxo.ko (FXO span) is now operational * Remove obsolete .inc initialization files (we use user-space init) * Added an install target to the utils dir. * Updated README.Astribank accordingly. * Using RBS signalling, as caller ID did not work well otherwise. * Better handling of USB protocol errors. * Fixed some procfs-related races. * per-card-module ioctls. * fxotune support. * opermode support (set through /etc/default/zaptel for now) * Userspace initialization script can also read registers. * Power calibration works (and implemented in perl) * some fine-tuning to the regster initialization parameters. * Leds turn on before registration and turn off after it. git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1204 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/utils/xpp_fxloader')
-rw-r--r--xpp/utils/xpp_fxloader63
1 files changed, 34 insertions, 29 deletions
diff --git a/xpp/utils/xpp_fxloader b/xpp/utils/xpp_fxloader
index ef9f966..ca29fd2 100644
--- a/xpp/utils/xpp_fxloader
+++ b/xpp/utils/xpp_fxloader
@@ -63,7 +63,7 @@ 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="/sbin/fpga_load"
+FPGA_LOAD="/usr/sbin/fpga_load"
find_dev() {
v_id=$1
@@ -84,6 +84,7 @@ load_fw() {
devices=`find_dev $v_id $p_id`
for dev in $devices
do
+ $LOGGER "USB Firmware $FIRMWARE_DIR/$fw into $dev"
do_fxload -D $dev -I $FIRMWARE_DIR/$fw || exit 1
done
@@ -98,23 +99,24 @@ hexfile_version() {
}
load_fpga() {
- dev=$1
-
+ v_id=$1
+ p_id=$2
+ fw=$3
+
+ devices=`find_dev $v_id $p_id`
+ for dev in $devices
+ do
card_ver=`$FPGA_LOAD -d -D $dev`
- firm_ver=`hexfile_version $FIRM_FXS`
-
- $LOGGER "considering fpga firmware version '$firm_ver' for $dev with version $card_ver."
- case "$card_ver" in
- 1.001)
- $LOGGER "Loading firmware '$FIRM_FXS' (version $firm_ver) into '$dev'"
- $FPGA_LOAD -D "$dev" -I "$FIRM_FXS" 2>&1 >/dev/null | $LOGGER
- status=$PIPESTATUS
- if [ $status != 0 ]; then
- echo "fpga_load failed with status $status" | $LOGGER
- exit 77
- fi
- ;;
- esac
+ firm_ver=`hexfile_version $FIRMWARE_DIR/$fw`
+
+ $LOGGER "FPGA Firmware $FIRMWARE_DIR/$fw into $dev"
+ $FPGA_LOAD -D "$dev" -I "$FIRMWARE_DIR/$fw" 2>&1 >/dev/null | $LOGGER
+ status=$PIPESTATUS
+ if [ $status != 0 ]; then
+ echo "fpga_load failed with status $status" | $LOGGER
+ exit 77
+ fi
+ done
}
#########################
@@ -124,11 +126,13 @@ load_fpga() {
# to run manually, pass the parameter 'xppdetect'
if [ "$1" = 'xppdetect' ]; then
+ echo "--------- FIRMWARE LOADING"
load_fw 04b4 8613 USB_8613.hex
load_fw e4e4 1130 USB_1130.hex
- for dev in `find_dev e4e4 1131`; do
- load_fpga $dev
- done
+ load_fpga e4e4 1131 FPGA_FXS.hex
+
+ sleep 3 # Let it stabilize
+ echo "--------- FIRMWARE IS LOADED"
exit $?
fi
@@ -140,19 +144,20 @@ fi
if [ "$ACTION" = "add" ] && [ -f "$DEVICE" ]
then
$LOGGER "Trying to find what to do for product $PRODUCT, device $DEVICE"
+ prod_id=`echo "$PRODUCT" | cut -d/ -f2`
case "$PRODUCT" in
- 4b4/8613/*)
- FIRM_USB=$FIRMWARE_DIR/USB_8613.hex
+ 4b4/8613/*|e4e4/1130/*|e4e4/1140/*)
+ FIRM_USB="$FIRMWARE_DIR/USB_$prod_id.hex"
$LOGGER "Loading firmware '$FIRM_USB' into '$DEVICE'"
do_fxload -D "$DEVICE" -I "$FIRM_USB"
;;
- e4e4/1130/*)
- FIRM_USB=$FIRMWARE_DIR/USB_1130.hex
- $LOGGER "Loading firmware '$FIRM_USB' into '$DEVICE'"
- do_fxload -D "$DEVICE" -I "$FIRM_USB"
- ;;
- e4e4/1131/*)
- load_fpga $DEVICE
+ e4e4/1131/*|e4e4/1141/*)
+ if [ "$prod_id" = 1131 ]; then
+ FIRM_FPGA="$FIRMWARE_DIR/FPGA_FXS.hex" # Legacy
+ else
+ FIRM_FPGA="$FIRMWARE_DIR/FPGA_$prod_id.hex"
+ fi
+ $FPGA_LOAD -D "$DEVICE" -I "$FIRM_FPGA" 2>&1 >/dev/null | $LOGGER
;;
esac
fi