summaryrefslogtreecommitdiff
path: root/xpp/initialize_registers
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/initialize_registers')
-rwxr-xr-xxpp/initialize_registers39
1 files changed, 39 insertions, 0 deletions
diff --git a/xpp/initialize_registers b/xpp/initialize_registers
new file mode 100755
index 0000000..35386ce
--- /dev/null
+++ b/xpp/initialize_registers
@@ -0,0 +1,39 @@
+#! /bin/sh
+# XPD_BUS - bus name
+# XPD_NAME - xpd name
+# XPD_TYPE - xpd type number (from protocol reply):
+# 3 - FXS
+# 4 - FXO
+# XPD_REVISION - xpd revision number
+
+set -e
+
+LOGGER="logger -i -t `basename $0`"
+
+INIT_DIR=`dirname $0`
+BASE=/proc/xpp
+
+SLICS="$BASE/$XPD_BUS/$XPD_NAME/slics"
+FILE="$INIT_DIR/init_data_${XPD_TYPE}_${XPD_REVISION}.cmd"
+
+if [ ! -f "$SLICS" ]; then
+ $LOGGER "missing slics file '$SLICS'"
+ exit 1
+fi
+
+if [ ! -f "$FILE" ]; then
+ $LOGGER "missing register initialization file '$FILE'"
+ exit 1
+fi
+
+case "$XPD_TYPE" in
+3|4)
+ cat "$FILE" > "$SLICS"
+ ;;
+*)
+ $LOGGER "Unknown type '$XPD_TYPE'"
+ exit 2
+esac
+$LOGGER "Wrote '$FILE' into '$SLICS'"
+
+exit 0