diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-11-06 21:18:42 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-11-06 21:18:42 +0000 |
commit | 4953605453a7f7f1da8c70c4c12a4b557cfc2c24 (patch) | |
tree | 0d1bd64cb09f75bf0c7aca3b17820738965a0f77 /xpp/init_card_4_23 | |
parent | 1148b31f800c4a280c9a26592a18d4478afc1a82 (diff) |
r1557@boole: tzafrir | 2006-11-06 20:12:16 +0200
Merging xpp driver release 1.2 (rev. 2569), originally team/tzafrir/xpp_1.2
* Should build well. Almost final.
* genzaptelconf: Also work when zap_autoreg=0
* README.Astribank updated for rev. 1.2.
* xpp/utils/Makefile: Use $< with cc -c
* Get xpp/utils configuration from autoconf (without changesin top dir)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1563 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/init_card_4_23')
-rwxr-xr-x | xpp/init_card_4_23 | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/xpp/init_card_4_23 b/xpp/init_card_4_23 new file mode 100755 index 0000000..a0e17bd --- /dev/null +++ b/xpp/init_card_4_23 @@ -0,0 +1,143 @@ +#! /bin/sh +# +# Written by Oron Peled <oron@actcom.co.il> +# Copyright (C) 2006, Xorcom +# +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# See the file LICENSE in the top level of this tarball. +# + +# +# $Id$ +# +# Data format: +# - A comment start with ';' or '#' until the end of line +# - Blank lines are ignored +# - Fields are whitespace separated (spaces or tabs) +# +# The fields are (in command line order): +# 1. DAA select in decimal (range 0-7). +# 31 is a special value which means ALL DAAs (only some registers +# accept settings for ALL DAAs). +# 2. Command word: +# - RD Read Direct register. +# - WD Write Direct register. +# 3. Register number in hexadecimal. +# 4. Data byte in hexadecimal. (for WD command). +# + +# ----------------------------------==== 8-channel FXO unit initialization ===----------------------------------------- + +set -e + +opermode='FCC' + +me=`basename $0` +INIT_DIR=`dirname $0` +XPP_BASE=/proc/xpp +export XPP_BASE +SLICS="$XPP_BASE/$XPD_BUS/$XPD_NAME/slics" +LOGGER="logger -s -t $me" + +# set -x +exec 2> /tmp/results #FIXME: temporary debugging file +# redirect script output to the "slics" (registers command) file: +exec 1> $SLICS + +$LOGGER -p kern.info "$XPD_BUS/$XPD_NAME: Initializing '$0'" + +set_daa_country_params() { + # based on fxo_modes from wctdm.c . TODO: more decent calculation? + reg16=00; reg26=00; reg30=00; reg31=A3; ring_osc=; ring_x=; + mode="$1" + # TODO: a saner fall-back in case of an unknown mode + if [ "$mode" = '' ]; then mode='FCC'; fi + if [ -r $INIT_DIR/init_fxo_modes ]; then + . $INIT_DIR/init_fxo_modes + fi + # Our register numbers are HEXADECIMAL! + cat <<EOF >$SLICS +31 WD 10 $reg16 +31 WD 1A $reg26 +31 WD 1E $reg30 +31 WD 1F $reg31 +EOF + # for the FXS: + #if [ "$ring_osc" != '' ]; then + # /bin/echo "31 WI __ $ring_osc" + #fi + #if [ "$ring_x" != '' ]; then + # /bin/echo "31 WI __ $ring_x" + #fi +} + +# Remove empty lines and commets. Not strictly necessary +# but works around some limitations of the proc interface: +sed -e 's/[;#].*$//' -e '/^[ ]*$/d' <<END_OF_FILE + + +31 WD 21 28 +31 WD 18 99 +31 WD 06 00 + +# ----------- DAA PCM start offset ---------- + +0 WD 22 00 +0 WD 23 00 +0 WD 24 00 +0 WD 25 00 + +1 WD 22 08 +1 WD 23 00 +1 WD 24 08 +1 WD 25 00 + +2 WD 22 10 +2 WD 23 00 +2 WD 24 10 +2 WD 25 00 + +3 WD 22 18 +3 WD 23 00 +3 WD 24 18 +3 WD 25 00 + +4 WD 22 20 +4 WD 23 00 +4 WD 24 20 +4 WD 25 00 + +5 WD 22 28 +5 WD 23 00 +5 WD 24 28 +5 WD 25 00 + +6 WD 22 30 +6 WD 23 00 +6 WD 24 30 +6 WD 25 00 + +7 WD 22 38 +7 WD 23 00 +7 WD 24 38 +7 WD 25 00 + +# ----------- DAA ONHOOK -------------------- +31 WD 05 00 + +# Set tip to ring voltage to 3.5 volts while off-hook +# instead of default of 3.1 +31 WD 1A C0 + +END_OF_FILE + +set_daa_country_params "$opermode" + +$LOGGER -p kern.info "$XPD_BUS/$XPD_NAME: Ending '$0'" +exit 0 |