#! /bin/sh # # Written by Oron Peled # 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 LOGGER="logger -s -t $me" # Always redirect stderr somewhere, otherwise the shell script will die # when it tries to do I/O related stuff on closed file descriptor. # Our default is to throw it down the bit-bucket. exec 2> /dev/null ## If you wish to trace this script: #exec 2> /tmp/xpp_init_$XPD_NAME ## Altenativly, if you have multiple XBUS'es: #exec 2> /tmp/xpp_init_$XBUS_NAME_$XPD_NAME #set -x # redirect script output to the "slics" (registers command) file: exec 1> "$XPP_BASE/$XPD_BUS/$XPD_NAME/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 <