├── .gitignore ├── LICENSE ├── LICENSE.LGPL ├── Makefile.am ├── Makefile.legacy ├── README ├── UPGRADE.txt ├── acinclude.m4 ├── assigned-spans.conf.sample ├── bittest.h ├── blacklist.sample ├── bootstrap.sh ├── build_tools ├── dahdi_svn_tarball ├── dahdi_sysfs_copy ├── dump_sys_state ├── make_firmware_object.in ├── make_tree ├── make_version ├── test_kernel_git └── uninstall-modules ├── configure.ac ├── dahdi-bash-completion ├── dahdi.init ├── dahdi.rules ├── dahdi.xml ├── dahdi_cfg.c ├── dahdi_diag.c ├── dahdi_maint.c ├── dahdi_monitor.c ├── dahdi_pcap.c ├── dahdi_scan.c ├── dahdi_span_assignments ├── dahdi_span_types ├── dahdi_speed.c ├── dahdi_test.c ├── dahdi_tool.c ├── dahdi_tools_version.h ├── dahdi_waitfor_span_assignments ├── doc ├── Makefile.am ├── dahdi_cfg.8 ├── dahdi_diag.8 ├── dahdi_maint.8 ├── dahdi_monitor.8 ├── dahdi_scan.8 ├── dahdi_span_assignments.8 ├── dahdi_span_types.8 ├── dahdi_test.8 ├── dahdi_tool.8 ├── dahdi_waitfor_span_assignments.8 ├── fxotune.8 ├── fxstest.8 ├── patgen.8 └── pattest.8 ├── fxotune.c ├── fxotune.h ├── fxstest.c ├── hdlcgen.c ├── hdlcstress.c ├── hdlctest.c ├── hdlcverify.c ├── hotplug ├── Makefile.am ├── dahdi_auto_assign_compat ├── dahdi_handle_device ├── dahdi_span_config ├── handle_device.d │ ├── 10-span-types │ ├── 20-span-assignments │ └── 30-xpp-sync └── span_config.d │ ├── 10-dahdi-cfg │ ├── 20-fxotune │ └── 50-asterisk ├── ifup-hdlc ├── init.conf.sample ├── install-sh ├── m4 └── .placeholder ├── makeopts.in ├── modprobe.conf.sample ├── modules.sample ├── patgen.c ├── patlooptest.c ├── pattest.c ├── ppp ├── Makefile.am └── dahdi.c ├── sethdlc.c ├── span-types.conf.sample ├── system.conf.sample ├── timertest.c ├── tonezone.c ├── tonezone.h ├── version.c.in ├── wavformat.h ├── xpp ├── 50-dahdi.conf ├── Makefile.am ├── README.Astribank ├── astribank.c ├── astribank.h ├── astribank_allow.8 ├── astribank_allow.c ├── astribank_hexload.8 ├── astribank_hexload.c ├── astribank_hook ├── astribank_is_starting.8 ├── astribank_is_starting.c ├── astribank_license.c ├── astribank_license.h ├── astribank_tool.8 ├── astribank_tool.c ├── astribank_upgrade ├── dahdi.cgi ├── dahdi_drivers ├── dahdi_genconf ├── dahdi_hardware ├── dahdi_registration ├── echo_loader.c ├── echo_loader.h ├── genconf_parameters ├── hexfile.c ├── hexfile.h ├── lsdahdi ├── mpptalk.c ├── mpptalk.h ├── oct612x │ ├── Makefile.am │ ├── apilib │ │ ├── bt │ │ │ ├── octapi_bt0.c │ │ │ └── octapi_bt0_private.h │ │ ├── largmath │ │ │ └── octapi_largmath.c │ │ └── llman │ │ │ ├── octapi_llman.c │ │ │ └── octapi_llman_private.h │ ├── get_discards │ ├── include │ │ ├── apilib │ │ │ ├── octapi_bt0.h │ │ │ ├── octapi_largmath.h │ │ │ └── octapi_llman.h │ │ ├── digium_unused.h │ │ ├── oct6100api │ │ │ ├── oct6100_adpcm_chan_inst.h │ │ │ ├── oct6100_adpcm_chan_pub.h │ │ │ ├── oct6100_api.h │ │ │ ├── oct6100_api_inst.h │ │ │ ├── oct6100_apimi.h │ │ │ ├── oct6100_apiud.h │ │ │ ├── oct6100_channel_inst.h │ │ │ ├── oct6100_channel_pub.h │ │ │ ├── oct6100_chip_open_inst.h │ │ │ ├── oct6100_chip_open_pub.h │ │ │ ├── oct6100_chip_stats_inst.h │ │ │ ├── oct6100_chip_stats_pub.h │ │ │ ├── oct6100_conf_bridge_inst.h │ │ │ ├── oct6100_conf_bridge_pub.h │ │ │ ├── oct6100_debug_inst.h │ │ │ ├── oct6100_debug_pub.h │ │ │ ├── oct6100_defines.h │ │ │ ├── oct6100_errors.h │ │ │ ├── oct6100_events_inst.h │ │ │ ├── oct6100_events_pub.h │ │ │ ├── oct6100_interrupts_inst.h │ │ │ ├── oct6100_interrupts_pub.h │ │ │ ├── oct6100_mixer_inst.h │ │ │ ├── oct6100_mixer_pub.h │ │ │ ├── oct6100_phasing_tsst_inst.h │ │ │ ├── oct6100_phasing_tsst_pub.h │ │ │ ├── oct6100_playout_buf_inst.h │ │ │ ├── oct6100_playout_buf_pub.h │ │ │ ├── oct6100_remote_debug_inst.h │ │ │ ├── oct6100_remote_debug_pub.h │ │ │ ├── oct6100_tlv_inst.h │ │ │ ├── oct6100_tone_detection_inst.h │ │ │ ├── oct6100_tone_detection_pub.h │ │ │ ├── oct6100_tsi_cnct_inst.h │ │ │ ├── oct6100_tsi_cnct_pub.h │ │ │ └── oct6100_tsst_inst.h │ │ ├── octdef.h │ │ ├── octmac.h │ │ ├── octosdependant.h │ │ ├── octrpc │ │ │ ├── oct6100_rpc_protocol.h │ │ │ └── rpc_protocol.h │ │ ├── octtype.h │ │ ├── octtypevx.h │ │ └── octtypewin.h │ ├── octasic-helper │ ├── octdeviceapi │ │ └── oct6100api │ │ │ ├── oct6100_adpcm_chan_priv.h │ │ │ ├── oct6100_api │ │ │ ├── oct6100_adpcm_chan.c │ │ │ ├── oct6100_channel.c │ │ │ ├── oct6100_chip_open.c │ │ │ ├── oct6100_chip_stats.c │ │ │ ├── oct6100_conf_bridge.c │ │ │ ├── oct6100_debug.c │ │ │ ├── oct6100_events.c │ │ │ ├── oct6100_interrupts.c │ │ │ ├── oct6100_memory.c │ │ │ ├── oct6100_miscellaneous.c │ │ │ ├── oct6100_mixer.c │ │ │ ├── oct6100_phasing_tsst.c │ │ │ ├── oct6100_playout_buf.c │ │ │ ├── oct6100_remote_debug.c │ │ │ ├── oct6100_tlv.c │ │ │ ├── oct6100_tone_detection.c │ │ │ ├── oct6100_tsi_cnct.c │ │ │ ├── oct6100_tsst.c │ │ │ └── oct6100_user.c │ │ │ ├── oct6100_apimi │ │ │ └── oct6100_mask_interrupts.c │ │ │ ├── oct6100_channel_priv.h │ │ │ ├── oct6100_chip_open_priv.h │ │ │ ├── oct6100_chip_stats_priv.h │ │ │ ├── oct6100_conf_bridge_priv.h │ │ │ ├── oct6100_debug_priv.h │ │ │ ├── oct6100_events_priv.h │ │ │ ├── oct6100_interrupts_priv.h │ │ │ ├── oct6100_memory_priv.h │ │ │ ├── oct6100_miscellaneous_priv.h │ │ │ ├── oct6100_mixer_priv.h │ │ │ ├── oct6100_phasing_tsst_priv.h │ │ │ ├── oct6100_playout_buf_priv.h │ │ │ ├── oct6100_remote_debug_priv.h │ │ │ ├── oct6100_tlv_priv.h │ │ │ ├── oct6100_tone_detection_priv.h │ │ │ ├── oct6100_tsi_cnct_priv.h │ │ │ ├── oct6100_tsst_priv.h │ │ │ └── oct6100_version.h │ └── test.c ├── parse_span_specs.c ├── parse_span_specs.h ├── perl_modules │ ├── Dahdi.pm │ ├── Dahdi │ │ ├── Chans.pm │ │ ├── Config │ │ │ ├── Gen.pm │ │ │ ├── Gen │ │ │ │ ├── Assignedspans.pm │ │ │ │ ├── Chandahdi.pm │ │ │ │ ├── Freepbxdb.pm │ │ │ │ ├── Modules.pm │ │ │ │ ├── Spantypes.pm │ │ │ │ ├── System.pm │ │ │ │ ├── Unicall.pm │ │ │ │ ├── Users.pm │ │ │ │ └── Xpporder.pm │ │ │ └── Params.pm │ │ ├── Hardware.pm │ │ ├── Hardware │ │ │ ├── PCI.pm │ │ │ └── USB.pm │ │ ├── Span.pm │ │ ├── Utils.pm │ │ ├── Xpp.pm │ │ └── Xpp │ │ │ ├── Line.pm │ │ │ ├── Mpp.pm │ │ │ ├── Xbus.pm │ │ │ └── Xpd.pm │ └── Makefile.am ├── pic_loader.c ├── pic_loader.h ├── test_parse.c ├── twinstar ├── twinstar_hook ├── twinstar_setup ├── waitfor_xpds ├── xpp.rules ├── xpp_blink ├── xpp_fxloader ├── xpp_modprobe ├── xpp_sync ├── xpp_timing └── xtalk │ ├── Makefile.am │ ├── debug.c │ ├── debug.h │ ├── include │ └── xtalk │ │ ├── api_defs.h │ │ ├── debug.h │ │ ├── firmware_defs.h │ │ ├── proto.h │ │ ├── proto_raw.h │ │ ├── proto_sync.h │ │ ├── xlist.h │ │ ├── xtalk_iface.h │ │ ├── xusb.h │ │ └── xusb_iface.h │ ├── xlist.c │ ├── xlist.h │ ├── xlist_test.c │ ├── xtalk-xusb.c │ ├── xtalk_base.c │ ├── xtalk_base.h │ ├── xtalk_raw.c │ ├── xtalk_raw_test.c │ ├── xtalk_send.8 │ ├── xtalk_send.c │ ├── xtalk_sync.c │ ├── xtalk_test.c │ ├── xusb_common.c │ ├── xusb_common.h │ ├── xusb_libusb.c │ ├── xusb_libusbx.c │ ├── xusb_test.c │ └── xusb_test_bypath.c └── zonedata.c /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.o 3 | *.lo 4 | *.a 5 | *.so 6 | *.la 7 | .*.o.d 8 | .*.lo.d 9 | *.asciidoc 10 | *.html 11 | .deps 12 | .libs 13 | .dirstamp 14 | .version 15 | /.pc 16 | Makefile 17 | Makefile.in 18 | auxdir/ 19 | build_tools/menuselect-deps 20 | aclocal.m4 21 | autom4te.cache/ 22 | autoconfig.h 23 | autoconfig.h.in 24 | config.log 25 | config.status 26 | config.guess 27 | config.ignore 28 | configure 29 | dahdi_cfg 30 | dahdi_diag 31 | dahdi_maint 32 | dahdi_monitor 33 | dahdi_pcap 34 | dahdi_scan 35 | dahdi_speed 36 | dahdi_test 37 | dahdi_tool 38 | fxotune 39 | fxstest 40 | genconf_parameters.sample 41 | hdlcgen 42 | hdlcstress 43 | hdlctest 44 | hdlcverify 45 | libtool 46 | m4/ 47 | makeopts 48 | patgen 49 | patlooptest 50 | pattest 51 | sethdlc 52 | stamp-h1 53 | timertest 54 | tonezone.lo 55 | tonezones.txt 56 | version.c 57 | xpp/*.check 58 | xpp/.depend 59 | xpp/.octasic.depend 60 | xpp/.perlcheck 61 | xpp/astribank_allow 62 | xpp/astribank_hexload 63 | xpp/astribank_is_starting 64 | xpp/astribank_tool 65 | xpp/dahdi_genconf.8 66 | xpp/dahdi_hardware.8 67 | xpp/dahdi_registration.8 68 | xpp/lsdahdi.8 69 | xpp/test_parse 70 | xpp/twinstar.8 71 | xpp/xpp_blink.8 72 | xpp/xpp_sync.8 73 | xpp/xtalk/xlist_test 74 | xpp/xtalk/xtalk_raw_test 75 | xpp/xtalk/xtalk_send 76 | xpp/xtalk/xtalk_test 77 | xpp/xtalk/xusb_test 78 | xpp/xtalk/xusb_test_bypath 79 | zonedata.lo 80 | -------------------------------------------------------------------------------- /assigned-spans.conf.sample: -------------------------------------------------------------------------------- 1 | # 2 | # /etc/dahdi/assigned-spans.conf: 3 | # 4 | # This file assigns span and channel numbers to dahdi devices 5 | # 6 | # Built as a table keyed by : 7 | # .... 8 | # 9 | # Where: 10 | # * The field may be either: 11 | # hardware_id 12 | # @location 13 | # devpath (in sysfs) 14 | # * Shell-style globbing is allowed for the field 15 | # * There may one or more of 16 | # * Each is composed as: 17 | # :: 18 | # 19 | # Examples: 20 | 21 | # Astribank with two spans: 22 | # FXS * 8 channels + 4 digital inputs 2 digital outputs 23 | # FXO * 8 channels 24 | #usb:QA-1 1:1:1 25 | #usb:QA-1 2:2:15 26 | 27 | # Same Astribank in one-liner 28 | #usb:QA-1 1:1:1 2:2:15 29 | 30 | # Astribank with 4*PRI spans and 3*FXS*8 spans 31 | # Note that channels are NOT globally contigous 32 | # each span get its own 50 numbers. Also, skip 33 | # Channel number 250... 34 | #usb:INT03165 1:1:1 # E1 35 | #usb:INT03165 2:2:51 # E1 36 | #usb:INT03165 3:3:151 # E1 37 | #usb:INT03165 4:4:201 # E1 38 | #usb:INT03165 5:5:301 # FXS * 8 channels 39 | #usb:INT03165 6:6:351 # FXS * 8 channels 40 | #usb:INT03165 7:7:401 # FXS * 8 channels 41 | 42 | # Alternatively -- all in one-line 43 | #usb:INT03165 1:1:1 2:2:51 3:3:151 4:4:201 5:5:301 6:6:351 7:7:401 44 | 45 | # Astribank with 4*BRI without hardware_id :-( 46 | # We use the location on the bus (ie: where it is physically 47 | # located). Note the '@' prefix that indicate the location key. 48 | #@usb-0000:00:1d.7-3 1:1:50 49 | #@usb-0000:00:1d.7-3 2:2:100 50 | #@usb-0000:00:1d.7-3 3:3:150 51 | #@usb-0000:00:1d.7-3 4:4:200 52 | 53 | # Same configuration with globbing: 54 | #/sys/*/usb1/1-6/* 1:1:50 55 | #/sys/*/usb1/1-6/* 2:2:100 56 | #/sys/*/usb1/1-6/* 3:3:150 57 | #/sys/*/usb1/1-6/* 4:4:200 58 | -------------------------------------------------------------------------------- /bittest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * See http://www.asterisk.org for more information about 3 | * the Asterisk project. Please do not directly contact 4 | * any of the maintainers of this project for assistance; 5 | * the project provides a web site, mailing lists and IRC 6 | * channels for your use. 7 | * 8 | * This program is free software, distributed under the terms of 9 | * the GNU General Public License Version 2 as published by the 10 | * Free Software Foundation. See the LICENSE file included with 11 | * this program for more details. 12 | */ 13 | 14 | static int bit_next(int prev) 15 | { 16 | return (prev + 1) % 256; 17 | } 18 | -------------------------------------------------------------------------------- /blacklist.sample: -------------------------------------------------------------------------------- 1 | # blacklist all the drivers by default in order to ensure that 2 | # /etc/init.d/dahdi installs them in the correct order so that the spans are 3 | # ordered consistently. 4 | 5 | blacklist wct4xxp 6 | blacklist wcte12xp 7 | blacklist wcte13xp 8 | blacklist wct1xxp 9 | blacklist wcte11xp 10 | blacklist wctdm24xxp 11 | blacklist wcfxo 12 | blacklist wctdm 13 | blacklist wctc4xxp 14 | blacklist wcb4xxp 15 | blacklist wcaxx 16 | blacklist wcte43x 17 | 18 | # Some mISDN drivers may try to attach to cards supported by DAHDI. If you 19 | # have a card which is *not* supported by DAHDI but supported by one of the 20 | # below drivers you should feel free to remove it from the blacklist below. 21 | blacklist hfcmulti 22 | blacklist netjet 23 | blacklist hfcpci 24 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | check_for_app() { 4 | $1 --version 2>&1 >/dev/null 5 | if [ $? != 0 ] 6 | then 7 | echo "Please install $1 and run bootstrap.sh again!" 8 | exit 1 9 | fi 10 | } 11 | 12 | # On FreeBSD and OpenBSD, multiple autoconf/automake versions have different names. 13 | # On linux, envitonment variables tell which one to use. 14 | 15 | uname -s | grep -q BSD 16 | if [ $? = 0 ] ; then # BSD case 17 | case `uname -sr` in 18 | 'FreeBSD 4'*) # FreeBSD 4.x has a different naming 19 | MY_AC_VER=259 20 | MY_AM_VER=19 21 | ;; 22 | *) 23 | MY_AC_VER=-2.62 24 | MY_AM_VER=-1.9 25 | ;; 26 | esac 27 | else # linux case 28 | MY_AC_VER= 29 | MY_AM_VER= 30 | AUTOCONF_VERSION=2.60 31 | AUTOMAKE_VERSION=1.9 32 | export AUTOCONF_VERSION 33 | export AUTOMAKE_VERSION 34 | fi 35 | 36 | check_for_app autoconf${MY_AC_VER} 37 | check_for_app autoheader${MY_AC_VER} 38 | check_for_app automake${MY_AM_VER} 39 | check_for_app aclocal${MY_AM_VER} 40 | 41 | echo "Generating the configure script ..." 42 | 43 | aclocal${MY_AM_VER} 44 | autoconf${MY_AC_VER} 45 | autoheader${MY_AC_VER} 46 | automake${MY_AM_VER} --add-missing --copy 2>/dev/null 47 | 48 | exit 0 49 | -------------------------------------------------------------------------------- /build_tools/dahdi_svn_tarball: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # upload_dahdi: upload a dahdi tarball to updates.xorcom.com 4 | # 5 | 6 | set -e 7 | 8 | BRANCH_NAME=1.4 9 | REV=HEAD 10 | DAHDI_BASE=http://svn.digium.com/svn/dahdi 11 | TARBALLS_DIR=$PWD 12 | 13 | me=`basename $0` 14 | 15 | say() { 16 | echo "$me: $@" 17 | } 18 | 19 | usage() { 20 | echo >&2 "$0: Generate snapshot from DAHDI SVN" 21 | echo >&2 ' ($Id$)' 22 | echo >&2 "" 23 | echo >&2 "$0 [-r REV] [-2] [-s]" 24 | echo >&2 "$0 <-h | --help>: This message" 25 | echo >&2 "" 26 | echo >&2 "Options:" 27 | echo >&2 " -2 --dahdi12: Use Asterisk 1.2. Implies -u." 28 | echo >&2 " -r --rev REV: extract xpp-dahdi from this revision ($REV)." 29 | echo >&2 " -s --show: Just show versions. Do nothing" 30 | 31 | } 32 | 33 | opt_showonly=no 34 | 35 | options=`getopt -o 2hr:s --long dahdi12,help,rev:,revision:,show -- "$@"` 36 | if [ $? != 0 ] ; then echo >&2 "Terminating..." ; exit 1 ; fi 37 | 38 | # Note the quotes around `$TEMP': they are essential! 39 | eval set -- "$options" 40 | 41 | while true ; do 42 | case "$1" in 43 | -2|--dahdi12) BRANCH_NAME=1.2;; 44 | -s|--show) opt_showonly=yes ;; 45 | -r|--rev|--revision) REV="$2"; shift ;; 46 | -h|--help) usage; exit 0;; 47 | --) shift ; break ;; 48 | esac 49 | shift; 50 | done 51 | 52 | BRANCH=branches/$BRANCH_NAME 53 | DAHDI_URL=$DAHDI_BASE/$BRANCH 54 | 55 | set -e 56 | 57 | # Get the name of the "previous version" for this release. 58 | # The idea is to look at the latest tag for that branhch. Tags are 59 | # global, and hence we filter tag names by branch name. 60 | # 61 | # Note: this strips any minor version number. 62 | # e.g: if last releast was 1.4.5.1, this will still return 1.4.5 . Here 63 | # we rely on the fact that the revision number will be added. 64 | dahdi_ver=`svn ls -r $REV $DAHDI_BASE/tags | grep "^$BRANCH_NAME" \ 65 | | sed -e "s/\($BRANCH_NAME\.[0-9]\+\)[/.-].*/\1/" \ 66 | | sort -nu -t . -k 3 | tail -n 1` 67 | 68 | real_rev=`svn info -r $REV $DAHDI_URL \ 69 | | awk '/^Last Changed Rev: /{print $4}'` 70 | 71 | ver_full="$dahdi_ver.9.svn.$real_rev" 72 | tar_name="dahdi-$ver_full" 73 | tar_ball_full="$TARBALLS_DIR/$tar_name.tar.gz" 74 | 75 | say "Version: $ver_full (ver: $dahdi_ver, rev: $real_rev)" 76 | say "Tarball: $tar_ball_full" 77 | 78 | if [ "$opt_showonly" = 'yes' ]; then 79 | exit 0; 80 | fi 81 | 82 | DAHDI_CHECKOUT_DIR=`mktemp -d dahdi_checkout_dir_XXXXXX` 83 | 84 | # Package a tarball from the subversion, using 'make dist': 85 | svn export -q -r $REV $DAHDI_URL $DAHDI_CHECKOUT_DIR/$tar_name 86 | echo "$ver_full" >$DAHDI_CHECKOUT_DIR/$tar_name/.version 87 | tar cz -C $DAHDI_CHECKOUT_DIR -f $tar_ball_full $tar_name 88 | 89 | rm -rf $DAHDI_CHECKOUT_DIR 90 | 91 | -------------------------------------------------------------------------------- /build_tools/dump_sys_state: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # dump_sys_state: dump some /sys and /proc files to a directory. 4 | # $Id$ 5 | # 6 | # Written by Tzafrir Cohen 7 | # Copyright (C) 2009, Xorcom 8 | # 9 | # All rights reserved. 10 | # 11 | # This program is free software; you can redistribute it and/or modify 12 | # it under the terms of the GNU General Public License as published by 13 | # the Free Software Foundation; either version 2 of the License, or 14 | # (at your option) any later version. 15 | # 16 | # This program is distributed in the hope that it will be useful, 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | # GNU General Public License for more details. 20 | # 21 | # You should have received a copy of the GNU General Public License 22 | # along with this program; if not, write to the Free Software 23 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 24 | # 02110-1301, USA 25 | 26 | # The DAHDI-perl modules will use such a dump instead of the files from 27 | # the real system if DAHDI_VIRT_TOP is set to the root. 28 | # 29 | # ./build_tools/dump_sys_state my_sys_state 30 | # 31 | # # And then later: 32 | # DAHDI_VIRT_TOP="$PWD/my_sys_state" dahdi_genconf 33 | 34 | mydir=`dirname $0` 35 | dahdi_sysfs_copy="$mydir/dahdi_sysfs_copy" 36 | 37 | # Give usage message on expected texts 38 | 39 | if [ "$#" -ne 0 ]; then 40 | echo >&2 "Usage: $0" 41 | exit 1 42 | fi 43 | 44 | id="sys_dump.`hostname`_`date +%F_%H.%M.%S`" 45 | tarball="$id.tar.gz" 46 | 47 | tmpdir=`mktemp -td 'dahdi_dump.XXXXXX'` 48 | echo -n >&2 "Creating ... " 49 | trap "[ -d '$tmpdir' ] && rm -rf '$tmpdir'" 0 1 2 15 50 | 51 | topdir="$tmpdir/$id" 52 | 53 | if [ -r /proc/bus/usb/devices ]; then 54 | mkdir -p "$topdir/proc/bus/usb" 55 | cp -a /proc/bus/usb/devices "$topdir/proc/bus/usb/" 56 | fi 57 | 58 | if [ -d /proc/dahdi ]; then 59 | mkdir -p "$topdir/proc/dahdi" 60 | if find /proc/dahdi -type f >/dev/null; then 61 | cp -a /proc/dahdi/* "$topdir/proc/dahdi/" 62 | fi 63 | fi 64 | 65 | if [ -d /proc/xpp ]; then 66 | mkdir -p "$topdir/proc/xpp" 67 | if find /proc/xpp -type f >/dev/null; then 68 | cp -a /proc/xpp/* "$topdir/proc/xpp/" 69 | find "$topdir/proc/xpp" -type f -name command -exec rm -f '{}' ';' 70 | fi 71 | fi 72 | 73 | "$dahdi_sysfs_copy" "$topdir" 74 | echo -n >&2 "tarball ... " 75 | ( cd "$tmpdir" && tar czf - . ) > "$tarball"; 76 | echo >&2 "ready in '$tarball'" 77 | -------------------------------------------------------------------------------- /build_tools/make_firmware_object.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # make an object file from a raw binary firmware file 4 | # arguments: 5 | # 1 - firmware file 6 | # 2 - output file 7 | 8 | bfdname=@BDFNAME@ 9 | bfdarch=@BDFARCH@ 10 | 11 | objcopy -I binary ${1} -B ${bfdarch} -O ${bfdname} ${2} --rename-section .data=.rodata,alloc,load,data,contents,readonly 12 | -------------------------------------------------------------------------------- /build_tools/make_tree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asterisk/dahdi-tools/40cfb7b0ed17890dc5b91edb514052dd3258a9d1/build_tools/make_tree -------------------------------------------------------------------------------- /build_tools/test_kernel_git: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | GIT_URL=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git 6 | CONF_FILE=build_tools/git_test.conf 7 | 8 | usage() { 9 | me=`basename $0` 10 | echo "$me: test building Zaptel vs. kernel from git" 11 | echo "Usage:" 12 | echo " $me checkout Pull a kernel version into " 13 | echo " $me update Update (pull) the kernel tree." 14 | echo " $me setver Set the kernel version" 15 | echo " $me test Test-build" 16 | echo "" 17 | echo " $me versions [pattern] List available versions." 18 | } 19 | 20 | # Set a variable in $CONF_FILE 21 | # The format of CONF_FILE is assumed to be: 22 | # VAR=value 23 | # in shell syntax. "value" may be quoted. 24 | # "value should not contain a '|' character. 25 | set_var() { 26 | var="$1" 27 | val="$2" 28 | if grep -q "^$var=" $CONF_FILE 2>/dev/null; then 29 | sed -i -e "s|^$var=.*|$var=\"$val\"|" $CONF_FILE 30 | else 31 | echo "$var=\"$val\"" >>$CONF_FILE 32 | fi 33 | } 34 | 35 | if [ -r "$CONF_FILE" ]; then . "$CONF_FILE"; fi 36 | 37 | if echo "$CONF_FILE" | grep -qv '^/'; then 38 | # make CONF_FILE an absolute path: 39 | CONF_FILE="$PWD/$CONF_FILE" 40 | fi 41 | 42 | command="$1" 43 | 44 | case "$command" in 45 | checkout) 46 | kernel_dir="$2" 47 | cd "$kernel_dir" 48 | git clone $GIT_URL 49 | set_var kernel_dir "$kernel_dir/linux-2.6" 50 | ;; 51 | update) 52 | cd "$kernel_dir" 53 | git pull 54 | ;; 55 | versions) 56 | cd "$kernel_dir" 57 | git tag -l $2 | cut -c2- 58 | ;; 59 | setver) 60 | kernel_ver="$2" 61 | tag="v$kernel_ver" 62 | cd "$kernel_dir" 63 | git-reset --hard "$tag" 64 | make defconfig prepare 65 | set_var kernel_ver "$kernel_ver" 66 | ;; 67 | test) 68 | # you can pass extra parameters to the make command in 69 | # two ways: 70 | # 1. Set th value of MAKE_PARAMS in git_test.conf . 71 | # 2. Any extra command-line parameter. 72 | shift 73 | make KSRC="$kernel_dir" KVERS=$kernel_ver $MAKE_PARAMS "$@" 74 | ;; 75 | *) 76 | echo "$0: no such command $command. Aborting." 77 | usage 78 | exit 1 79 | ;; 80 | esac 81 | -------------------------------------------------------------------------------- /build_tools/uninstall-modules: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # uninstall-modules 3 | # 4 | # Remove all the modules passed in on the command line from the modules 5 | # directory. This script is called by the makefile. 6 | 7 | KERNEL_MODULES_DIR=$1 8 | shift 9 | MODULES="$*" 10 | 11 | usage() { 12 | echo "$0: Used to delete kernel modules from the modules directory." 13 | echo "" 14 | echo "Usage:" 15 | echo " $0 MODULES_BASE_DIR mod1 [mod2 [...]]" 16 | echo "" 17 | echo " MODULES_BASE_DIR - typically /lib/modules/KVERS" 18 | echo " modN - (optionally partial) module name to remove." 19 | } 20 | 21 | if [ -z "$KERNEL_MODULES_DIR" ]; then 22 | echo "Missing kernel module directory." 23 | usage 24 | exit 1; 25 | fi 26 | 27 | if [ -z "$MODULES" ]; then 28 | echo "Missing one or more modules to delete." 29 | usage 30 | exit 1; 31 | fi 32 | for mod in $MODULES; do 33 | BASE=`basename $mod` 34 | for file in `cat $KERNEL_MODULES_DIR/modules.dep | cut -d : -f 1 | grep "$BASE$"`; do 35 | if [ -e "$file" ]; then 36 | #echo "Deleting $file." 37 | rm -f $file 38 | fi 39 | done 40 | done 41 | exit 0 42 | -------------------------------------------------------------------------------- /dahdi.rules: -------------------------------------------------------------------------------- 1 | 2 | ACTION!="add", GOTO="dahdi_add_end" 3 | 4 | # DAHDI devices with ownership/permissions for running as non-root 5 | SUBSYSTEM=="dahdi", OWNER="asterisk", GROUP="asterisk", MODE="0660" 6 | 7 | # Backward compat names: /dev/dahdi/ 8 | SUBSYSTEM=="dahdi_channels", SYMLINK+="dahdi/%m" 9 | 10 | # Add persistant names as well 11 | SUBSYSTEM=="dahdi_channels", ATTRS{hardware_id}!="", SYMLINK+="dahdi/devices/%s{hardware_id}/%s{local_spanno}/%n" 12 | SUBSYSTEM=="dahdi_channels", ATTRS{location}!="", SYMLINK+="dahdi/devices/@%s{location}/%s{local_spanno}/%n" 13 | 14 | LABEL="dahdi_add_end" 15 | 16 | # hotplug scripts 17 | SUBSYSTEM=="dahdi_devices", RUN+="%E{DAHDI_TOOLS_ROOTDIR}/usr/share/dahdi/dahdi_handle_device" 18 | SUBSYSTEM=="dahdi_spans", RUN+="%E{DAHDI_TOOLS_ROOTDIR}/usr/share/dahdi/dahdi_span_config" 19 | -------------------------------------------------------------------------------- /dahdi.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | no 6 | 7 | 8 | hdlc 9 | 10 | 11 | 12 | 13 | no 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | libnewt 25 | 26 | 27 | -------------------------------------------------------------------------------- /dahdi_diag.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Mark Spencer 3 | * Based on previous works, designs, and architectures conceived and 4 | * written by Jim Dixon . 5 | * 6 | * Copyright (C) 2001 Jim Dixon / Zapata Telephony. 7 | * Copyright (C) 2001-2008 Digium, Inc. 8 | * 9 | * All rights reserved. 10 | * 11 | * Primary Author: Mark Spencer 12 | * Radio Support by Jim Dixon 13 | */ 14 | 15 | /* 16 | * See http://www.asterisk.org for more information about 17 | * the Asterisk project. Please do not directly contact 18 | * any of the maintainers of this project for assistance; 19 | * the project provides a web site, mailing lists and IRC 20 | * channels for your use. 21 | * 22 | * This program is free software, distributed under the terms of 23 | * the GNU General Public License Version 2 as published by the 24 | * Free Software Foundation. See the LICENSE file included with 25 | * this program for more details. 26 | */ 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include "dahdi_tools_version.h" 36 | 37 | int main(int argc, char *argv[]) 38 | { 39 | int fd; 40 | int chan; 41 | if ((argc < 2) || (sscanf(argv[1], "%d", &chan) != 1)) { 42 | fprintf(stderr, "Usage: dahdi_diag \n"); 43 | exit(1); 44 | } 45 | fd = open("/dev/dahdi/ctl", O_RDWR); 46 | if (fd < 0) { 47 | perror("open(/dev/dahdi/ctl"); 48 | exit(1); 49 | } 50 | if (ioctl(fd, DAHDI_CHANDIAG, &chan)) { 51 | perror("ioctl(DAHDI_CHANDIAG)"); 52 | exit(1); 53 | } 54 | exit(0); 55 | } 56 | -------------------------------------------------------------------------------- /dahdi_speed.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Mark Spencer 3 | * Based on previous works, designs, and architectures conceived and 4 | * written by Jim Dixon . 5 | * 6 | * Copyright (C) 2001 Jim Dixon / Zapata Telephony. 7 | * Copyright (C) 2001-2008 Digium, Inc. 8 | * 9 | * All rights reserved. 10 | * 11 | * Primary Author: Mark Spencer 12 | * Radio Support by Jim Dixon 13 | */ 14 | 15 | /* 16 | * 17 | * Generic speed test -- Run an infinite loop and 18 | * see how high we can count (in 5 seconds). You 19 | * can use this to measure how much CPU DAHDI REALLY 20 | * is taking. 21 | * 22 | * MUST BE COMPILED WITHOUT OPTIMIZATION 23 | * 24 | */ 25 | 26 | /* 27 | * See http://www.asterisk.org for more information about 28 | * the Asterisk project. Please do not directly contact 29 | * any of the maintainers of this project for assistance; 30 | * the project provides a web site, mailing lists and IRC 31 | * channels for your use. 32 | * 33 | * This program is free software, distributed under the terms of 34 | * the GNU General Public License Version 2 as published by the 35 | * Free Software Foundation. See the LICENSE file included with 36 | * this program for more details. 37 | */ 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #include "dahdi_tools_version.h" 45 | 46 | static long count=0; 47 | 48 | static void alm(int sig) 49 | { 50 | printf("Count: %ld\n", count); 51 | exit(0); 52 | } 53 | 54 | 55 | int main(int argc, char *argv[]) 56 | { 57 | int a=0,b=0,c; 58 | signal(SIGALRM, alm); 59 | alarm(5); 60 | for (;;) { 61 | for (c=0;c<1000;c++) 62 | a = a * b; 63 | count++; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /dahdi_tools_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 Digium, Inc. 3 | * 4 | * All rights reserved. 5 | * 6 | */ 7 | 8 | /* 9 | * See http://www.asterisk.org for more information about 10 | * the Asterisk project. Please do not directly contact 11 | * any of the maintainers of this project for assistance; 12 | * the project provides a web site, mailing lists and IRC 13 | * channels for your use. 14 | * 15 | * This program is free software, distributed under the terms of 16 | * the GNU General Public License Version 2 as published by the 17 | * Free Software Foundation. See the LICENSE file included with 18 | * this program for more details. 19 | */ 20 | 21 | extern const char dahdi_tools_version[]; 22 | -------------------------------------------------------------------------------- /dahdi_waitfor_span_assignments: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | usage() { 4 | echo >&2 "Usage: $0 {assigned|unassigned}" 5 | echo >&2 "# wait until all spans known are assigned/unassigned" 6 | exit 1 7 | } 8 | 9 | TIMEOUT=5 # How much time to wait for spans 10 | 11 | if [ "$#" -lt 1 ]; then 12 | usage 13 | fi 14 | wanted_event="$1" 15 | shift 16 | 17 | case "$wanted_event" in 18 | assigned) 19 | ;; 20 | unassigned) 21 | ;; 22 | *) 23 | usage 24 | ;; 25 | esac 26 | 27 | devbase='/sys/bus/dahdi_devices/devices' 28 | 29 | spans_of() { 30 | dev="$1" 31 | wc -l < "$dev/spantype" 32 | } 33 | 34 | assigned_spans_of() { 35 | dev="$1" 36 | ls -d "$dev/span-"* 2>/dev/null | wc -l 37 | } 38 | 39 | 40 | waitfor_span_assignments() { 41 | wanted_state="$1" 42 | device_list=`ls -d "$devbase/"* 2> /dev/null` 43 | finished='' 44 | count="$TIMEOUT" 45 | echo -n "Waiting for spans to become $wanted_state: " 46 | while [ "$count" -gt 0 ]; do 47 | finished='yes' 48 | for dev in $device_list 49 | do 50 | spans=`spans_of "$dev"` 51 | assigned_spans=`assigned_spans_of "$dev"` 52 | if [ "$wanted_state" = 'assigned' -a "$assigned_spans" -ne "$spans" ]; then 53 | finished='no' 54 | elif [ "$wanted_state" = 'unassigned' -a "$assigned_spans" -ne 0 ]; then 55 | finished='no' 56 | fi 57 | done 58 | if [ "$finished" = 'yes' ]; then 59 | break 60 | else 61 | sleep 1 62 | echo -n "." 63 | fi 64 | count=`expr "$count" - 1` 65 | done 66 | if [ "$finished" = 'yes' ]; then 67 | echo "done" 68 | else 69 | echo "timeout" 70 | fi 71 | } 72 | 73 | waitfor_span_assignments "$wanted_event" 74 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | man_MANS = \ 2 | dahdi_cfg.8 \ 3 | dahdi_maint.8 \ 4 | dahdi_monitor.8 \ 5 | dahdi_scan.8 \ 6 | dahdi_span_assignments.8 \ 7 | dahdi_span_types.8 \ 8 | dahdi_test.8 \ 9 | dahdi_tool.8 \ 10 | dahdi_waitfor_span_assignments.8 \ 11 | fxotune.8 12 | 13 | noinst_MANS = \ 14 | dahdi_diag.8 \ 15 | fxstest.8 \ 16 | patgen.8 \ 17 | pattest.8 18 | 19 | EXTRA_DIST = $(man_MANS) $(noinst_MANS) 20 | -------------------------------------------------------------------------------- /doc/dahdi_cfg.8: -------------------------------------------------------------------------------- 1 | .TH "DAHDI_CFG" "8" "16 Jun 2008" "" "" 2 | 3 | .SH NAME 4 | dahdi_cfg \- configures DAHDI kernel modules from /etc/dahdi/system.conf 5 | .SH SYNOPSIS 6 | 7 | .B dahdi_cfg [\-c \fICFG_FILE\fB] [\-S\fINUM\fB [\-S\fICHANS\fB]] [\-s] [\-f] [\-t] [\-v [\-v ... ] ] 8 | 9 | .B dahdi_cfg \-h 10 | 11 | .SH DESCRIPTION 12 | .B dahdi_cfg 13 | configures DAHDI interface cards from a config file. 14 | 15 | You generally need to run it with a valid configurations 16 | in order for DAHDI modules to work properly. 17 | 18 | It must be run to configure every DAHDI span. Normally it is run from 19 | the DAHDI init script. 20 | 21 | .SH OPTIONS 22 | 23 | .B \-c \fICFG_FILE 24 | .RS 25 | Use an alternative configuration file instead of 26 | .I /etc/dahdi/system.conf 27 | 28 | If \fICFG_FILE\fR is '\fB\-\fR', it is read from stdin. 29 | .RE 30 | 31 | .B \-C \fICHANNELS 32 | .RS 33 | Only apply changes to channels in the specified range. Only 34 | applicable when \-S is in use. 35 | .RE 36 | 37 | .B \-s 38 | .RS 39 | Only shutdown spans. 40 | .RE 41 | 42 | .B \-S \fISPAN 43 | .RS 44 | Only apply changes to span no. \fISPAN\fR. You also need to specify the 45 | range of channels in the span explicitly with \-C. 46 | .RE 47 | 48 | .B \-f 49 | .RS 50 | Always configure every channel, even if it appears not to have changed. 51 | .RE 52 | 53 | .B \-t 54 | .RS 55 | Test mode. Don't do anything, just report what you wanted to do. 56 | .RE 57 | 58 | .B \-v 59 | .RS 60 | Be more verbose. Add extra v-s for extra verbosity. 61 | .RE 62 | 63 | .B \-h 64 | .RS 65 | Display a brief help message. 66 | .RE 67 | 68 | .SH FILES 69 | 70 | .I /etc/dahdi/system.conf 71 | .RS 72 | The default location for the configuration file. 73 | .RE 74 | 75 | .SH SEE ALSO 76 | dahdi_tool(8), dahdi_monitor(8), asterisk(8). 77 | 78 | .SH AUTHOR 79 | This manual page was written by Santiago Ruano Rinc\['o]n 80 | for 81 | the Debian system (but may be used by others). Permission is 82 | granted to copy, distribute and/or modify this document under 83 | the terms of the GNU General Public License, Version 2 any 84 | later version published by the Free Software Foundation. 85 | -------------------------------------------------------------------------------- /doc/dahdi_diag.8: -------------------------------------------------------------------------------- 1 | .TH dahdi_diag 8 "2008-01-07" 2 | .SH NAME 3 | dahdi_diag \(em Dump DAHDI channel parameters 4 | .SH SYNOPSIS 5 | .B dahdi_diag 6 | .I channel 7 | 8 | .SH DESCRIPTION 9 | .B dahdi_diag 10 | asks the kernel to dump parameters for DAHDI channel no. 11 | .I channel 12 | to the kernel logs. You will be able to see them using, e.g. dmesg(1). 13 | 14 | 15 | .SH OPTIONS 16 | .I channel 17 | .RS 18 | The number of the DAHDI channel whose parammeters should be dumped. 19 | May be any DAHDI channel (even if it is open). 20 | .RE 21 | 22 | .SH EXAMPLE 23 | 24 | # /tmp/dahdi_diag 5 25 | # dmesg | tail \-n 15 26 | Dump of DAHDI Channel 5 (XPP_BRI_TE/00/01/1,5,2): 27 | 28 | flags: 501 hex, writechunk: c5190948, readchunk: c5190954 29 | rxgain: ccad2e80, txgain: ccad2e80, gainalloc: 0 30 | span: c48a900c, sig: 80 hex, sigcap: 80 hex 31 | inreadbuf: \-1, outreadbuf: 0, inwritebuf: 0, outwritebuf: \-1 32 | blocksize: 160, numbufs: 4, txbufpolicy: 0, txbufpolicy: 0 33 | txdisable: 0, rxdisable: 0, iomask: 0 34 | curzone: c78e7000, tonezone: 0, curtone: 00000000, tonep: 0 35 | digitmode: 0, txdialbuf: , dialing: 0, aftdialtimer: 0, cadpos. 0 36 | confna: 0, confn: 0, confmode: 0, confmute: 0 37 | ec: 00000000, echocancel: 0, deflaw: 0, xlaw: ccab5e80 38 | echostate: 00, echotimer: 0, echolastupdate: 0 39 | itimer: 0, otimer: 0, ringdebtimer: 0 40 | 41 | .SH SEE ALSO 42 | dahdi_cfg(8), asterisk(8), dmesg(1). 43 | 44 | .SH AUTHOR 45 | 46 | This manual page was written by Tzafrir Cohen 47 | Permission is granted to copy, distribute and/or modify this document under 48 | the terms of the GNU General Public License, Version 2 any 49 | later version published by the Free Software Foundation. 50 | 51 | On Debian systems, the complete text of the GNU General Public 52 | License can be found in /usr/share/common\-licenses/GPL. 53 | -------------------------------------------------------------------------------- /doc/dahdi_maint.8: -------------------------------------------------------------------------------- 1 | .TH "DAHDI_MAINT" "8" "9 Sep 2011" "" "" 2 | 3 | .SH NAME 4 | dahdi_maint \- Sets Dahdi spans into maintenance mode, e.g.: loopback 5 | .SH SYNOPSIS 6 | 7 | .B dahdi_maint \-s \fInum\fB [options] 8 | .B dahdi_maint <\-h|\-\-help> 9 | 10 | .SH DESCRIPTION 11 | 12 | dahdi_maint uses the DAHDI_MAINT interface to set a Dahdi span (port 13 | of a Dahdi adapter card) into loopback mode or similar maintenance mode. 14 | 15 | .SH OPTIONS 16 | .B \-s \-\-span \fInum\fR 17 | .RS 18 | The span number. Required. 19 | .RE 20 | 21 | .B \-l \-\-loopback 22 | .RS 23 | Loopback type. One of: 24 | .IP localhost 4 25 | loop back towards host 26 | .IP networkline 4 27 | network line loopback 28 | .IP networkpayload 4 29 | network payload loopback 30 | .IP loopup 4 31 | transmit loopup signal 32 | .IP loopdown 4 33 | transmit loopdown signal 34 | .IP off 4 35 | end loopback mode 36 | .RE 37 | 38 | .B \-i \-\-insert 39 | .RS 40 | Insert an error of a specific type 41 | .RE 42 | 43 | .SH EXAMPLES 44 | Enable network line loopback on span 1: 45 | 46 | dahdi_maint \-s 1 \-\-loopback networkline 47 | 48 | Disable network line loopback on span 1: 49 | 50 | dahdi_maint \-s 1 \-\-loopback off 51 | 52 | 53 | .SH SEE ALSO 54 | .PP 55 | dahdi_tool(8), dahdi_cfg(8), asterisk(8). 56 | 57 | .SH AUTHOR 58 | .PP 59 | This manual page was written by Tzafrir Cohen . 60 | Permission is granted to copy, distribute and/or modify this document 61 | under the terms of the GNU General Public License, Version 2 any later 62 | version published by the Free Software Foundation. 63 | -------------------------------------------------------------------------------- /doc/dahdi_scan.8: -------------------------------------------------------------------------------- 1 | .TH dahdi_scan 8 "2008-03-18" 2 | .SH NAME 3 | dahdi_scan \(em Print Configuration of DAHDI Spans 4 | .SH SYNOPSIS 5 | .B dahdi_scan 6 | .I [spans] 7 | 8 | .SH DESCRIPTION 9 | .B dahdi_scan 10 | prints information about DAHDI spans in the system. For analog spans it 11 | also provides a list of channels. 12 | 13 | By default it prints information about all the spans in the system. 14 | However if parameters are provided, they will be considered to be a list 15 | of span numbers and information will be printed for them. 16 | 17 | Output is printed to the standard output. The format is that of an 18 | Asterisk configuration file (similar to a "ini" configuration file), 19 | where the name of the section is the number of the span. Note that the 20 | specifically for analog spans some keys may appear more than once, and 21 | hence you can not use a parser for an "ini" format and assume you have a 22 | dictionary. 23 | 24 | .SH EXAMPLES 25 | Printing information for spans 1, 2 and 4: 26 | 27 | dahdi_scan 1 2 4 28 | 29 | And to print all the spans: 30 | 31 | dahdi_scan 32 | 33 | Information about a certain analog span: 34 | 35 | [5] 36 | active=yes 37 | alarms=OK 38 | description=Xorcom XPD #00/10: FXS 39 | name=XBUS\-00/XPD\-10 40 | manufacturer=Xorcom Inc. 41 | devicetype=Astribank: Unit 1 Subunit 0: FXS 42 | location=usb\-0000:00:03.3\-4 43 | basechan=125 44 | totchans=8 45 | irq=0 46 | type=analog 47 | port=125,FXS 48 | port=126,FXS 49 | port=127,FXS 50 | port=128,FXS 51 | port=129,FXS 52 | port=130,FXS 53 | port=131,FXS 54 | port=132,FXS 55 | 56 | And an example of a digital span: 57 | 58 | [1] 59 | active=yes 60 | alarms=RED 61 | description=T2XXP (PCI) Card 0 Span 1 62 | name=TE2/0/1 63 | manufacturer=Digium 64 | devicetype=Wildcard TE205P (4th Gen) 65 | location=Board ID Switch 0 66 | basechan=1 67 | totchans=24 68 | irq=193 69 | type=digital\-T1 70 | syncsrc=0 71 | lbo=0 db (CSU)/0\-133 feet (DSX\-1) 72 | coding_opts=B8ZS,AMI 73 | framing_opts=ESF,D4 74 | coding=B8ZS 75 | framing=ESF 76 | 77 | The "type" field may contain: "analog", "digital\-T1", "digital\-E1", 78 | "digital\-J1" or "digital\-BRI". 79 | 80 | .SH FILES 81 | Requires read access to /dev/dahdi/ctl . 82 | 83 | .SH SEE ALSO 84 | dahdi_cfg(8), asterisk(8). 85 | 86 | .SH BUGS 87 | The program still does not do everything described in the man page. 88 | 89 | It also assumes that spans don't skip channel numbers, and that their 90 | channel numbers are "running". This is anyway almost always the case. 91 | And always the case in a normal boot process. 92 | 93 | .SH AUTHOR 94 | 95 | This manual page was written by Tzafrir Cohen 96 | Permission is granted to copy, distribute and/or modify this document under 97 | the terms of the GNU General Public License, Version 2 any 98 | later version published by the Free Software Foundation. 99 | 100 | On Debian systems, the complete text of the GNU General Public 101 | License can be found in /usr/share/common\-licenses/GPL. 102 | -------------------------------------------------------------------------------- /doc/dahdi_test.8: -------------------------------------------------------------------------------- 1 | .TH dahdi_test 8 "2005-06-25" 2 | .SH "NAME" 3 | dahdi_test \(em Test if the DAHDI timer provides timely response 4 | .SH "SYNOPSIS" 5 | .B dahdi_test 6 | .I [ \-v ] 7 | 8 | .SH DESCRIPTION 9 | .B dahdi_test 10 | dahdi_test runs a timing test in a loop and prints the result of each loop. 11 | The test is as follows: 12 | 13 | It reads 8192 bytes from the DAHDI timer device (\fI/dev/dahdi/pseudo\fR). 14 | This should take exactly 8000 ms . It uses calls to 15 | .I gettimeofday(2) 16 | before and after that read to check that indeed exactly 8000ms have passed. 17 | 18 | Values of 100% and 99.99% Are normally considered a definite 19 | .I pass. 20 | Values of 99.98% and 99.97% are probably OK as well. 21 | 22 | .SH OPTIONS 23 | .B \-v 24 | .RS 25 | Be more verbose: print one line per test. 26 | .RE 27 | 28 | .B \-c 29 | .I count 30 | .RS 31 | Run for 32 | .I count 33 | times instead of running forever. 34 | .RE 35 | 36 | .SH FILES 37 | .B /dev/dahdi/pseudo 38 | .RS 39 | .RE 40 | The device file used to access the DAHDI timer. 41 | 42 | .SH SEE ALSO 43 | dahdi_tool(8), dahdi_cfg(8), asterisk(8). gettimeofday(2) 44 | 45 | .SH AUTHOR 46 | This manual page was written by Tzafrir Cohen 47 | Permission is granted to copy, distribute and/or modify this document under 48 | the terms of the GNU General Public License, Version 2 any 49 | later version published by the Free Software Foundation. 50 | -------------------------------------------------------------------------------- /doc/dahdi_tool.8: -------------------------------------------------------------------------------- 1 | .TH "DAHDI_TOOL" "8" "16 June 2008" "" "" 2 | 3 | .SH NAME 4 | dahdi_tool \- Shows status of DAHDI interfaces 5 | .SH SYNOPSIS 6 | 7 | .B dahdi_tool 8 | 9 | .SH DESCRIPTION 10 | dahdi_tool shows the current status the DAHDI interface cards plugged 11 | to the computer. 12 | 13 | It displays values like Current Alarms, SyncSource, Tx/Rx 14 | Levels for each DAHDI interface. 15 | 16 | .SH SEE ALSO 17 | dahdi_monitor(8), asterisk (8). 18 | 19 | .SH AUTHOR 20 | This manual page was written by Santiago Ruano Rinc\['o]n 21 | for 22 | the Debian system (but may be used by others). Permission is 23 | granted to copy, distribute and/or modify this document under 24 | the terms of the GNU General Public License, Version 2 any 25 | later version published by the Free Software Foundation. 26 | -------------------------------------------------------------------------------- /doc/dahdi_waitfor_span_assignments.8: -------------------------------------------------------------------------------- 1 | .TH "DAHDI_WAITFOR_SPAN_ASSIGNMENTS" "8" "22 Jan 2014" "" "" 2 | 3 | .SH NAME 4 | dahdi_waitfor_span_assignments \- wait for DAHDI spans to get (un)assigned 5 | .SH SYNOPSIS 6 | 7 | .B dahdi_span_assignments assigned 8 | 9 | .B dahdi_span_assignments unassigned 10 | 11 | .SH DESCRIPTION 12 | DAHDI spans get assigned / unassigned asynchronously. 13 | 14 | .B dahdi_span_assignments 15 | is a helper script that allows running commands after all the spans have 16 | been assigned or unassigned. 17 | 18 | It takes a single command: \fBassigned\fR or \fBunassigned\fR and waits 19 | (up until a timeout of 5 seconds) for all the DAHDI spans in the system 20 | to do so. 21 | 22 | Note that if the system has a span that will not get assigned 23 | automatically (e.g.: it's not in assigned\-spans.conf), this program 24 | does not know and will wait until a timeout. 25 | 26 | .SH EXAMPLES 27 | 28 | modprobe wctdm24xxp 29 | dahdi_waitfor_span_assignments assigned 30 | do_something 31 | 32 | dahdi_span_assignments add 33 | dahdi_waitfor_span_assignments assigned 34 | do_something_else 35 | 36 | dahdi_span_assignments remove 37 | dahdi_span_assignments unassigned 38 | do_something_completely_different 39 | 40 | .SH SEE ALSO 41 | dahdi_span_assignments(8) 42 | 43 | .SH AUTHOR 44 | dahdi_waitfor_span_assignments was written by Oron Peled. This manual 45 | page was written by Tzafrir Cohen. Permission is granted to copy, 46 | distribute and/or modify this document under the terms of the GNU 47 | General Public License, Version 2 any later version published by the 48 | Free Software Foundation. 49 | 50 | -------------------------------------------------------------------------------- /doc/fxstest.8: -------------------------------------------------------------------------------- 1 | .TH "FXSTEST" "8" "9 June 2007" "asterisk" "System Manager's Manuals: Asterisk" 2 | 3 | .SH NAME 4 | fxstest \- Simple tests for DAHDI FXS adapters 5 | .SH SYNOPSIS 6 | 7 | .B fxstest /dev/dahdi/\fIN comand\fR 8 | 9 | .SH DESCRIPTION 10 | fxstest can be used to issue one of a number simple tests to FXS 11 | adapters (analog adapters intended to connect phones). 12 | 13 | .SH OPTIONS 14 | All of those tests operate on a single dahdi channel which has to be an 15 | FXS port, and must not be in use by Asterisk or any other program. 16 | 17 | The command has two mandatory parameters. 18 | The first parameter is the device file to operate on. It is typically 19 | /dev/dahdi/NN , a device file under /dev/dahdi . 20 | 21 | The second parameter is the name of the command to run on that channel: 22 | 23 | .I stats 24 | .RS 25 | Reports voltages 26 | .RE 27 | 28 | .I regdump 29 | .RS 30 | Dumps ProSLIC registers 31 | .RE 32 | 33 | .I tones 34 | .RS 35 | Plays a series of tones 36 | .RE 37 | 38 | .I polarity 39 | .RS 40 | Requests channel to reverse polarity. 41 | .RE 42 | 43 | .I ring 44 | .RS 45 | Rings phone 46 | .RE 47 | 48 | .SH "SEE ALSO" 49 | .PP 50 | dahdi_tool(8), dahdi_cfg(8), dahdi_monitor(8), asterisk(8). 51 | .SH BUGS 52 | Does not allow testing channels beyond 249. Should support opening 53 | channels through /dev/dahdi/channel . 54 | .SH AUTHOR 55 | .PP 56 | This manual page was written by Tzafrir Cohen . 57 | Permission is granted to copy, distribute and/or modify this document 58 | under the terms of the GNU General Public License, Version 2 any 59 | later version published by the Free Software Foundation. 60 | .PP 61 | -------------------------------------------------------------------------------- /doc/patgen.8: -------------------------------------------------------------------------------- 1 | .TH patgen 8 "2 Dec 2009" 2 | .SH NAME 3 | patgen \(em Generates a Pattern for a DAHDI Clear Channel Test 4 | .SH SYNOPSIS 5 | .B patgen 6 | .I dahdi-device 7 | 8 | .SH DESCRIPTION 9 | .B patgen 10 | Sends test data to a DAHDI channel. The channel should be of CLEAR 11 | signalling (e.g: B channel of a PRI line). pattest(8) is used to test 12 | the data at the other side. See its manual for more information. 13 | 14 | .B patgen 15 | Must be able to write to the channel. Hence this cannot be used for a 16 | channel used by Asterisk. 17 | 18 | .SH OPTIONS 19 | .I dahdi-device 20 | .RS 21 | A DAHDI device. Can be either a device number or an explicit device file 22 | name 23 | .RE 24 | 25 | .SH EXAMPLE 26 | patgen /dev/dahdi/5 27 | 28 | patgen 305 29 | 30 | .SH BUGS 31 | Waiting for you to report them at . 32 | 33 | .SH SEE ALSO 34 | pattest(8), dahdi_cfg(8), asterisk(8). 35 | 36 | .SH AUTHOR 37 | 38 | This manual page was written by Tzafrir Cohen 39 | Permission is granted to copy, distribute and/or modify this document under 40 | the terms of the GNU General Public License, Version 2 any 41 | later version published by the Free Software Foundation. 42 | 43 | On Debian systems, the complete text of the GNU General Public 44 | License can be found in /usr/share/common\-licenses/GPL. 45 | -------------------------------------------------------------------------------- /doc/pattest.8: -------------------------------------------------------------------------------- 1 | .TH pattest 8 "2 Dec 2009" 2 | .SH NAME 3 | pattest \(em Tests a Pattern for a DAHDI Clear Channel Test 4 | .SH SYNOPSIS 5 | .B pattest 6 | .I dahdi-device 7 | 8 | .SH DESCRIPTION 9 | .B pattest 10 | Receives test data from a DAHDI channel and checks if it matches the 11 | test pattern. The channel should be of CLEAR signalling (e.g: B channel 12 | of a PRI line). patgen(8) is used to generate the data at the other side. 13 | 14 | .B pattest 15 | Must be able to read from the channel. Hence this cannot be used for a 16 | channel used by Asterisk. 17 | 18 | The pattern is a simple series of values from 0 to 255. Hence it takes 19 | at most one sample to get in sync with the other side. If there is no 20 | output, all is well. Output is an error message. 21 | 22 | .SH OPTIONS 23 | .I dahdi-device 24 | .RS 25 | A DAHDI device. Can be either a device number or an explicit device file 26 | name 27 | .RE 28 | 29 | .SH EXAMPLE 30 | pattest /dev/dahdi/5 31 | 32 | pattest 305 33 | .RE 34 | 35 | .SH BUGS 36 | Gives way too many errors when does not get any input. 37 | 38 | .SH SEE ALSO 39 | patgen(8), dahdi_cfg(8), asterisk(8). 40 | 41 | .SH AUTHOR 42 | 43 | This manual page was written by Tzafrir Cohen 44 | Permission is granted to copy, distribute and/or modify this document under 45 | the terms of the GNU General Public License, Version 2 any 46 | later version published by the Free Software Foundation. 47 | 48 | On Debian systems, the complete text of the GNU General Public 49 | License can be found in /usr/share/common\-licenses/GPL. 50 | -------------------------------------------------------------------------------- /hotplug/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | nobase_dist_dahditools_SCRIPTS = \ 3 | dahdi_handle_device \ 4 | dahdi_span_config \ 5 | dahdi_auto_assign_compat \ 6 | span_config.d/10-dahdi-cfg \ 7 | span_config.d/20-fxotune \ 8 | span_config.d/50-asterisk \ 9 | handle_device.d/10-span-types \ 10 | handle_device.d/20-span-assignments \ 11 | # 12 | -------------------------------------------------------------------------------- /hotplug/dahdi_auto_assign_compat: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | devdir='/sys/bus/dahdi_devices/devices' 4 | 5 | # DAHDI is loaded? 6 | if [ ! -d "$devdir" ]; then 7 | exit 0 8 | fi 9 | 10 | devices_by_registration_time() { 11 | grep -H '' $devdir/*/registration_time 2>/dev/null | \ 12 | sed 's,/registration_time:,\t,' | \ 13 | sort -k 2,2 14 | } 15 | 16 | # First assign non-Astribank devices 17 | devices_by_registration_time | \ 18 | grep -v '/astribanks:' | \ 19 | while read devpath time; do 20 | echo >&2 "D: auto '$devpath'" 21 | dahdi_span_assignments auto "$devpath" 22 | done 23 | 24 | # Now handle Astribanks 25 | unmatched="`dahdi_span_assignments unmatched`" 26 | if [ -n "$unmatched" ]; then 27 | # Only if astribanks are not matched in span-assignments.conf 28 | # TODO: have dahdi_registration run only on "$unmatched" 29 | LC_ALL=C dahdi_registration -Rv on 30 | fi 31 | -------------------------------------------------------------------------------- /hotplug/dahdi_handle_device: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # /usr/share/dahdi/dahdi_handle_device 4 | # 5 | # Called by UDEV when a dahdi device is added/removed 6 | # 7 | 8 | me=`basename $0` 9 | dir=`dirname $0` 10 | LOGGER="logger -i -t '$me'" 11 | NAME=`basename "$DEVPATH" | tr -c 'A-Za-z0-9-' '_'` 12 | 13 | # Always redirect stderr somewhere, otherwise the shell script will die 14 | # when it tries to do I/O related stuff on closed file descriptor. 15 | # Our default is to throw it down the bit-bucket. 16 | exec 2> /dev/null 17 | # If you wish to trace this script: 18 | #exec 2> "/tmp/${me}.$NAME" 1>&2 19 | #exec 2> /dev/console 20 | 21 | # Our directory in the beginning, so we can use local lab setup 22 | PATH="$dir:/usr/sbin:/sbin:/usr/bin:/bin" 23 | export PATH 24 | 25 | set -e 26 | 27 | #echo >&2 "$0($ACTION): DEBUG($# args): '$*'" 28 | 29 | # Do we have a configuration? 30 | if [ -f /etc/dahdi/init.conf ]; then 31 | . /etc/dahdi/init.conf 32 | fi 33 | 34 | if [ "$DAHDI_UDEV_DISABLE_DEVICES" = 'yes' ]; then 35 | echo "DAHDI_UDEV_DISABLE_DEVICES=yes. Skip $DEVPATH" | $LOGGER 36 | exit 0 37 | fi 38 | 39 | # Can we pass a different value so we can use 40 | # alternate (testing) configuration? 41 | # Meanwhile, make it hard-coded. 42 | DAHDICONFDIR='/etc/dahdi' 43 | export DAHDICONFDIR 44 | 45 | run_parts() { 46 | # Have our internal "run-parts" (adapted from Fedora), 47 | # as implementations differ 48 | for i in `LC_ALL=C; ls -d $dir/handle_device.d/*[!~,] 2>/dev/null` ; do 49 | [ -d "$i" ] && continue 50 | [ ! -x "$i" ] && continue 51 | # Don't run *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} files 52 | case "$i" in 53 | *.cfsaved|*.rpmsave|*.rpmorig|*.rpmnew|*.swp|*,v) 54 | continue 55 | ;; 56 | esac 57 | echo "D: Running '$i'" 58 | "$i" 59 | done 60 | } 61 | 62 | case "$ACTION" in 63 | add) 64 | echo "$ACTION: $DEVPATH" | $LOGGER 65 | 66 | # Check if we can safely do our job 67 | if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then 68 | echo "Old driver (no auto_assign_spans parameter). Skip $DEVPATH" | $LOGGER 69 | exit 0 70 | fi 71 | if [ `cat /sys/module/dahdi/parameters/auto_assign_spans` -ne 0 ]; then 72 | echo "auto_assign_spans=1. Skip $DEVPATH" | $LOGGER 73 | exit 0 74 | fi 75 | 76 | # Background run -- don't block udev 77 | run_parts 2>&1 < /dev/null | $LOGGER & 78 | ;; 79 | remove) 80 | echo "$ACTION: $DEVPATH" | $LOGGER 81 | # Background run -- don't block udev 82 | run_parts 2>&1 < /dev/null | $LOGGER & 83 | ;; 84 | *) 85 | echo "UNHANDLED: $ACTION: $DEVPATH" | $LOGGER 86 | ;; 87 | esac 88 | -------------------------------------------------------------------------------- /hotplug/dahdi_span_config: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # /usr/share/dahdi/dahdi_span_config 4 | # 5 | # Called by UDEV when a dahdi span is added/removed 6 | # 7 | 8 | me=`basename $0` 9 | dir=`dirname $0` 10 | LOGGER="logger -i -t '$me'" 11 | NAME=`basename "$DEVPATH" | tr -c 'A-Za-z0-9-' '_'` 12 | 13 | exec 2> /dev/null 14 | # Always redirect stderr somewhere, otherwise the shell script will die 15 | # when it tries to do I/O related stuff on closed file descriptor. 16 | # Our default is to throw it down the bit-bucket. 17 | #exec 2> /dev/console 18 | ## If you wish to trace this script: 19 | #exec 2> "/tmp/${me}.$NAME" 1>&2 20 | 21 | # Our directory in the beginning, so we can use local lab setup 22 | PATH="$dir:/usr/sbin:/sbin:/usr/bin:/bin" 23 | export PATH 24 | 25 | set -e 26 | 27 | #echo >&2 "$0($ACTION): DEBUG($# args): '$*'" 28 | 29 | # Do we have a configuration? 30 | if [ -f /etc/dahdi/init.conf ]; then 31 | . /etc/dahdi/init.conf 32 | fi 33 | 34 | if [ "$DAHDI_UDEV_DISABLE_SPANS" = 'yes' ]; then 35 | echo "DAHDI_UDEV_DISABLE_SPANS=yes. Skip $DEVPATH" | $LOGGER 36 | exit 0 37 | fi 38 | 39 | # Can we pass a different value so we can use 40 | # alternate (testing) configuration? 41 | # Meanwhile, make it hard-coded. 42 | DAHDICONFDIR='/etc/dahdi' 43 | export DAHDICONFDIR 44 | 45 | run_parts() { 46 | # Have our internal "run-parts" (adapted from Fedora), 47 | # as implementations differ 48 | for i in `LC_ALL=C; ls -d $dir/span_config.d/*[!~,] 2>/dev/null` ; do 49 | [ -d "$i" ] && continue 50 | [ ! -x "$i" ] && continue 51 | # Don't run *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} files 52 | case "$i" in 53 | *.cfsaved|*.rpmsave|*.rpmorig|*.rpmnew|*.swp|*,v) 54 | continue 55 | ;; 56 | esac 57 | #echo "D: Running '$i'" 58 | "$i" 59 | done 60 | } 61 | 62 | case "$ACTION" in 63 | add) 64 | echo "$ACTION: $DEVPATH" | $LOGGER 65 | 66 | # Old driver. These scripts probably won't work anyway. 67 | if [ ! -f /sys/module/dahdi/parameters/auto_assign_spans ]; then 68 | if [ -f /sys/module/dahdi ]; then 69 | $LOGGER "Old driver (no auto_assign_spans parameter). Skip $DEVPATH" 70 | exit 0 71 | fi 72 | fi 73 | 74 | if [ $(cat /sys/module/dahdi/parameters/auto_assign_spans) -ne 0 ]; then 75 | $LOGGER "auto_assign_spans=1. Skip $DEVPATH" 76 | exit 0 77 | fi 78 | 79 | # Set variables 80 | span_devpath="/sys$DEVPATH" 81 | SPANNO=`echo "$span_devpath" | sed 's,.*/span-,,'` 82 | BASECHAN=`cat "$span_devpath/basechan"` 83 | CHANNELS=`cat "$span_devpath/channels"` 84 | ENDCHAN=`expr "$BASECHAN" + "$CHANNELS" - 1` 85 | export SPANNO BASECHAN CHANNELS ENDCHAN 86 | # Background run -- don't block udev 87 | run_parts 2>&1 < /dev/null | $LOGGER & 88 | ;; 89 | remove|online|offline) 90 | # Nothing to do yet... 91 | echo "$ACTION: $DEVPATH" | $LOGGER 92 | ;; 93 | *) 94 | echo "UNHANDLED: $ACTION: $DEVPATH" | $LOGGER 95 | ;; 96 | esac 97 | 98 | -------------------------------------------------------------------------------- /hotplug/handle_device.d/10-span-types: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | case "$ACTION" in 4 | add) 5 | ;; 6 | *) 7 | exit 0 8 | esac 9 | 10 | if [ -r "$DAHDICONFDIR/span-types.conf" ]; then 11 | dahdi_span_types set "/sys$DEVPATH" 12 | fi 13 | -------------------------------------------------------------------------------- /hotplug/handle_device.d/20-span-assignments: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | case "$ACTION" in 4 | add) 5 | ;; 6 | *) 7 | exit 0 8 | esac 9 | 10 | # For now, handle only spans in assigned-spans.conf 11 | # We leave other cases to /etc/init.d/dahdi, so 12 | # legacy ordering can be preserved. 13 | if [ -r "$DAHDICONFDIR/assigned-spans.conf" ]; then 14 | dahdi_span_assignments add "/sys$DEVPATH" 15 | fi 16 | -------------------------------------------------------------------------------- /hotplug/handle_device.d/30-xpp-sync: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # Run xpp_sync whenever an Astribank is connected. 4 | 5 | # May be set in /etc/dahdi/init.conf 6 | XPP_SYNC=${XPP_SYNC:-auto} 7 | 8 | case "$ACTION" in 9 | add) ;; 10 | *) exit 0 ;; 11 | esac 12 | 13 | case "${DEVPATH##*/}" in 14 | astribanks:*) ;; 15 | *) exit 0 ;; 16 | esac 17 | 18 | xpp_sync "$XPP_SYNC" 19 | -------------------------------------------------------------------------------- /hotplug/span_config.d/10-dahdi-cfg: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ "$ACTION" != 'add' ]; then 4 | # Nothing to do here 5 | exit 0 6 | fi 7 | 8 | # Sanity check 9 | checkit=`"dahdi_cfg" --help 2>&1 | grep -- '-S' | wc -l` 10 | if [ "$checkit" != 1 ]; then 11 | echo "Bad dahdi_cfg (no -S support). Skipping" 12 | exit 0 13 | fi 14 | 15 | run_dahdi_cfg() { 16 | echo "dahdi_cfg: span $SPANNO <$BASECHAN-$ENDCHAN> ($DEVPATH)" 17 | dahdi_cfg -c "$cfg_file" -S "$SPANNO" -C "$BASECHAN-$ENDCHAN" 18 | } 19 | 20 | # Configure DAHDI 21 | cfg_file="$DAHDICONFDIR/system.conf" 22 | if [ -r "$cfg_file" ]; then 23 | run_dahdi_cfg 24 | else 25 | echo "Using auto-generated config for dahdi_cfg" 26 | cfg_file='-' 27 | DAHDI_CONF_FILE="$cfg_file" dahdi_genconf system | run_dahdi_cfg 28 | fi 29 | -------------------------------------------------------------------------------- /hotplug/span_config.d/20-fxotune: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ "$ACTION" != 'add' ]; then 4 | # Nothing to do here 5 | exit 0 6 | fi 7 | 8 | fxotune_cfg='/etc/fxotune.conf' 9 | if [ -r "$fxotune_cfg" ]; then 10 | echo "fxotune: span $SPANNO <$BASECHAN-$ENDCHAN> ($DEVPATH)" 11 | fxotune -s -b "$BASECHAN" -e "$ENDCHAN" 12 | fi 13 | -------------------------------------------------------------------------------- /hotplug/span_config.d/50-asterisk: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # This file, if installed under /usr/share/dahdi/span_config.d/ , will 4 | # attempt to add a newly-generated span to a running copy of Asterisk. 5 | # Asterisk has to be running (if not: it will pick the span on its 6 | # startup), and has to have the channels already configured. 7 | 8 | if [ "$ACTION" != 'add' ]; then 9 | # Nothing to do here 10 | exit 0 11 | fi 12 | 13 | # Add to asterisk 14 | asterisk -rx "dahdi create channels $BASECHAN $ENDCHAN" 15 | -------------------------------------------------------------------------------- /ifup-hdlc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PATH=/sbin:/usr/sbin:/bin:/usr/bin 3 | 4 | cd /etc/sysconfig/network-scripts 5 | . network-functions 6 | 7 | CONFIG=$1 8 | source_config 9 | 10 | if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ] 11 | then 12 | exit 13 | fi 14 | 15 | if [ -z "${MODE}" ]; then 16 | echo "No mode specified!" 17 | exit 18 | fi 19 | 20 | sethdlc ${DEVICE} mode ${MODE} 21 | ifconfig ${DEVICE} ${IPADDR} pointopoint ${REMIP} 22 | route add -net ${NETWORK} netmask ${NETMASK} ${DEVICE} 23 | 24 | # this is broken! it's only here to keep compatibility with old RH sytstems 25 | if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" ] 26 | then 27 | route add default gw ${GATEWAY} metric 1 ${DEVICE} 28 | fi 29 | 30 | . /etc/sysconfig/network 31 | 32 | if [ "${GATEWAY}" != "" ]; then 33 | if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then 34 | # set up default gateway 35 | route add default gw ${GATEWAY} 36 | fi 37 | fi 38 | 39 | /etc/sysconfig/network-scripts/ifup-post $1 40 | -------------------------------------------------------------------------------- /init.conf.sample: -------------------------------------------------------------------------------- 1 | # 2 | # Shell settings for Dahdi initialization scripts. 3 | # This replaces the old/per-platform files (/etc/sysconfig/zaptel, 4 | # /etc/defaults/zaptel) 5 | # 6 | 7 | # The maximal timeout (seconds) to wait for udevd to finish generating 8 | # device nodes after the modules have loaded and before running dahdi_cfg. 9 | #DAHDI_DEV_TIMEOUT=40 10 | 11 | # A list of modules to unload when stopping. 12 | # All of their dependencies will be unloaded as well. 13 | #DAHDI_UNLOAD_MODULES="" # Disable module unloading 14 | #DAHDI_UNLOAD_MODULES="dahdi echo" # If you use OSLEC 15 | 16 | # Override settings for xpp_fxloader 17 | #XPP_FIRMWARE_DIR=/usr/share/dahdi 18 | #XPP_HOTPLUG_DISABLED=yes 19 | #XPP_HOTPLUG_DAHDI=yes 20 | #ASTERISK_SUPPORTS_DAHDI_HOTPLUG=yes 21 | 22 | # Disable udev handling: 23 | #DAHDI_UDEV_DISABLE_DEVICES=yes 24 | #DAHDI_UDEV_DISABLE_SPANS=yes 25 | -------------------------------------------------------------------------------- /m4/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asterisk/dahdi-tools/40cfb7b0ed17890dc5b91edb514052dd3258a9d1/m4/.placeholder -------------------------------------------------------------------------------- /makeopts.in: -------------------------------------------------------------------------------- 1 | CC=@CC@ 2 | LD=@LD@ 3 | HOSTCC=@HOSTCC@ 4 | CFLAGS=@CFLAGS@ 5 | LDFLAGS=@LDFLAGS@ 6 | 7 | INSTALL=@INSTALL@ 8 | GREP=@GREP@ 9 | SHELL=@SHELL@ 10 | LN=@LN@ 11 | 12 | prefix = @prefix@ 13 | exec_prefix = @exec_prefix@ 14 | 15 | bindir = @bindir@ 16 | datarootdir = @datarootdir@ 17 | datadir = @datadir@ 18 | includedir = @includedir@ 19 | infodir = @infodir@ 20 | libdir = @libdir@ 21 | libexecdir = @libexecdir@ 22 | localstatedir = @localstatedir@ 23 | mandir = @mandir@ 24 | sbindir = @sbindir@ 25 | sharedstatedir = @sharedstatedir@ 26 | sysconfdir = @sysconfdir@ 27 | 28 | DOWNLOAD=@DOWNLOAD@ 29 | 30 | DAHDI_DEVMODE=@DAHDI_DEVMODE@ 31 | DAHDI_DECLARATION_AFTER_STATEMENT=@DAHDI_DECLARATION_AFTER_STATEMENT@ 32 | 33 | PBX_NEWT=@PBX_NEWT@ 34 | NEWT_LIB=@NEWT_LIB@ 35 | NEWT_INCLUDE=@NEWT_INCLUDE@ 36 | 37 | PBX_USB=@PBX_USB@ 38 | USB_LIB=@USB_LIB@ 39 | USB_INCLUDE=@USB_INCLUDE@ 40 | 41 | PBX_HDLC=@PBX_HDLC@ 42 | 43 | DAHDI_INCLUDE=@DAHDI_INCLUDE@ 44 | 45 | USE_SELINUX=@USE_SELINUX@ 46 | 47 | PPPD_VERSION=@PPPD_VERSION@ 48 | 49 | ASCIIDOC=@ASCIIDOC@ 50 | -------------------------------------------------------------------------------- /modprobe.conf.sample: -------------------------------------------------------------------------------- 1 | # You should place any module parameters for your DAHDI modules here 2 | # Example: 3 | # 4 | # options wctdm24xxp latency=6 5 | -------------------------------------------------------------------------------- /modules.sample: -------------------------------------------------------------------------------- 1 | # Contains the list of modules to be loaded / unloaded by /etc/init.d/dahdi. 2 | # 3 | # NOTE: Please add/edit /etc/modprobe.d/dahdi or /etc/modprobe.conf if you 4 | # would like to add any module parameters. 5 | # 6 | # Format of this file: list of modules, each in its own line. 7 | # Anything after a '#' is ignore, likewise trailing and leading 8 | # whitespaces and empty lines. 9 | 10 | # Digium TE205P/TE207P/TE210P/TE212P: PCI dual-port T1/E1/J1 11 | # Digium TE405P/TE407P/TE410P/TE412P: PCI quad-port T1/E1/J1 12 | # Digium TE220: PCI-Express dual-port T1/E1/J1 13 | # Digium TE420: PCI-Express quad-port T1/E1/J1 14 | wct4xxp 15 | 16 | # Digium TE435 17 | # Digium TE235 18 | # Digium TE436 19 | # Digium TE236 20 | wcte43x 21 | 22 | # Digium TE120P: PCI single-port T1/E1/J1 23 | # Digium TE121: PCI-Express single-port T1/E1/J1 24 | # Digium TE122: PCI single-port T1/E1/J1 25 | wcte12xp 26 | 27 | # Digium TE131: PCI-Express single-port T1/E1/J1 28 | # Digium TE132: PCI single-port T1/E1/J1 29 | # Digium TE133: PCI-Express single-port T1/E1/J1 with hardware echocan 30 | # Digium TE134: PCI single-port T1/E1/J1 with hardware echocan 31 | wcte13xp 32 | 33 | # Digium T100P: PCI single-port T1 34 | # Digium E100P: PCI single-port E1 35 | wct1xxp 36 | 37 | # Digium TE110P: PCI single-port T1/E1/J1 38 | wcte11xp 39 | 40 | # Digium TDM2400P/AEX2400: up to 24 analog ports 41 | # Digium TDM800P/AEX800: up to 8 analog ports 42 | # Digium TDM410P/AEX410: up to 4 analog ports 43 | wctdm24xxp 44 | 45 | # Digium A4A/A4B/A8A/A8B 46 | wcaxx 47 | 48 | # X100P - Single port FXO interface 49 | # X101P - Single port FXO interface 50 | wcfxo 51 | 52 | # Digium TDM400P: up to 4 analog ports 53 | wctdm 54 | 55 | # Digium B410P: 4 NT/TE BRI ports 56 | # Digium B433P: 4 NT/TE BRI ports pci-e 57 | # Digium B434P: 4 NT/TE BRI ports 58 | # Digium B233P: 2 NT/TE BRI ports pci-e 59 | # Digium B234P: 2 NT/TE BRI ports 60 | wcb4xxp 61 | 62 | # Digium TC400B: G729 / G723 Transcoding Engine 63 | wctc4xxp 64 | 65 | # Xorcom Astribank Devices 66 | xpp_usb 67 | 68 | -------------------------------------------------------------------------------- /ppp/Makefile.am: -------------------------------------------------------------------------------- 1 | plugindir = $(libdir)/pppd/$(PPPD_VERSION) 2 | plugin_LTLIBRARIES = dahdi.la 3 | 4 | dahdi_la_CFLAGS = $(DAHDI_INCLUDE) 5 | dahdi_la_LDFLAGS = -module -avoid-version 6 | 7 | CLEANFILES = dahdi.so 8 | -------------------------------------------------------------------------------- /span-types.conf.sample: -------------------------------------------------------------------------------- 1 | # 2 | # /etc/dahdi/spantype.conf: Set E1/T1/J1 per-device 3 | # 4 | # Built as a table of two columns: 5 | # : 6 | # 7 | # Where: 8 | # * The field may be either: 9 | # hardware_id 10 | # @location 11 | # devpath (in sysfs) 12 | # * The is the relative span number 13 | # in the device (starting from 1) 14 | # In this filed globbing rules apply. E.g: 15 | # - * are all the spans in this device 16 | # - [12] are the first two spans in this device 17 | # * The may be E1, T1 or J1 18 | # 19 | # Examples: 20 | # Set the first two spans of a specific Astribank to T1 21 | #usb:000156 [12]:T1 22 | 23 | # Set all spans of another Astribank to T1 24 | #usb:INT03165 *:E1 25 | 26 | # Set the first two spans of an Astribank to T1. The 27 | # Astribanks is specified by its location instead of hardware_id 28 | #@usb-0000:00:1d.7-3 [12]:T1 29 | -------------------------------------------------------------------------------- /timertest.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Mark Spencer 3 | * Based on previous works, designs, and architectures conceived and 4 | * written by Jim Dixon . 5 | * 6 | * Copyright (C) 2001 Jim Dixon / Zapata Telephony. 7 | * Copyright (C) 2001-2008 Digium, Inc. 8 | * 9 | * All rights reserved. 10 | * 11 | * Primary Author: Mark Spencer 12 | * Radio Support by Jim Dixon 13 | */ 14 | 15 | /* 16 | * See http://www.asterisk.org for more information about 17 | * the Asterisk project. Please do not directly contact 18 | * any of the maintainers of this project for assistance; 19 | * the project provides a web site, mailing lists and IRC 20 | * channels for your use. 21 | * 22 | * This program is free software, distributed under the terms of 23 | * the GNU General Public License Version 2 as published by the 24 | * Free Software Foundation. See the LICENSE file included with 25 | * this program for more details. 26 | */ 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include 39 | #include "dahdi_tools_version.h" 40 | 41 | int main(int argc, char *argv[]) 42 | { 43 | int fd; 44 | int x = 8000; 45 | int res; 46 | fd_set fds; 47 | struct timeval orig, now; 48 | fd = open("/dev/dahdi/timer", O_RDWR); 49 | if (fd < 0) { 50 | fprintf(stderr, "Unable to open timer: %s\n", strerror(errno)); 51 | exit(1); 52 | } 53 | printf("Opened timer...\n"); 54 | if (ioctl(fd, DAHDI_TIMERCONFIG, &x)) { 55 | fprintf(stderr, "Unable to set timer: %s\n", strerror(errno)); 56 | exit(1); 57 | } 58 | printf("Set timer duration to %d samples (%d ms)\n", x, x/8); 59 | printf("Waiting...\n"); 60 | gettimeofday(&orig, NULL); 61 | for(;;) { 62 | FD_ZERO(&fds); 63 | FD_SET(fd, &fds); 64 | res = select(fd + 1, NULL, NULL, &fds, NULL); 65 | if (res != 1) { 66 | fprintf(stderr, "Unexpected result %d: %s\n", res, strerror(errno)); 67 | exit(1); 68 | } 69 | x = -1; 70 | if (ioctl(fd, DAHDI_TIMERACK, &x)) { 71 | fprintf(stderr, "Unable to ack timer: %s\n", strerror(errno)); 72 | exit(1); 73 | } 74 | gettimeofday(&now, NULL); 75 | printf("Timer Expired (%ld ms)!\n", (now.tv_sec - orig.tv_sec) * 1000 + (now.tv_usec - orig.tv_usec) / 1000); 76 | } 77 | exit(0); 78 | } 79 | -------------------------------------------------------------------------------- /tonezone.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BSD Telephony Of Mexico "Tormenta" Tone Zone Support 2/22/01 3 | * 4 | * Working with the "Tormenta ISA" Card 5 | * 6 | * Copyright (C) 2001-2008, Digium, Inc. 7 | * 8 | * Primary Author: Mark Spencer 9 | * 10 | */ 11 | 12 | /* 13 | * See http://www.asterisk.org for more information about 14 | * the Asterisk project. Please do not directly contact 15 | * any of the maintainers of this project for assistance; 16 | * the project provides a web site, mailing lists and IRC 17 | * channels for your use. 18 | * 19 | * This program is free software, distributed under the terms of 20 | * the GNU Lesser General Public License Version 2.1 as published 21 | * by the Free Software Foundation. See the LICENSE.LGPL file 22 | * included with this program for more details. 23 | * 24 | * In addition, when this program is distributed with Asterisk in 25 | * any form that would qualify as a 'combined work' or as a 26 | * 'derivative work' (but not mere aggregation), you can redistribute 27 | * and/or modify the combination under the terms of the license 28 | * provided with that copy of Asterisk, instead of the license 29 | * terms granted here. 30 | */ 31 | 32 | #ifndef _TONEZONE_H 33 | #define _TONEZONE_H 34 | 35 | #include 36 | 37 | struct tone_zone_sound { 38 | int toneid; 39 | char data[256]; /* Actual zone description */ 40 | /* Description is a series of tones of the format: 41 | [!]freq1[+freq2][/time] separated by commas. There 42 | are no spaces. The sequence is repeated back to the 43 | first tone description not preceeded by !. time is 44 | specified in milliseconds */ 45 | }; 46 | 47 | struct tone_zone { 48 | int zone; /* Zone number */ 49 | char country[10]; /* Country code */ 50 | char description[40]; /* Description */ 51 | int ringcadence[DAHDI_MAX_CADENCE]; /* Ring cadence */ 52 | struct tone_zone_sound tones[DAHDI_TONE_MAX]; 53 | int dtmf_high_level; /* Power level of high frequency component 54 | of DTMF, expressed in dBm0. */ 55 | int dtmf_low_level; /* Power level of low frequency component 56 | of DTMF, expressed in dBm0. */ 57 | int mfr1_level; /* Power level of MFR1, expressed in dBm0. */ 58 | int mfr2_level; /* Power level of MFR2, expressed in dBm0. */ 59 | }; 60 | 61 | extern struct tone_zone builtin_zones[]; 62 | 63 | /* Register a given two-letter tone zone if we can */ 64 | int tone_zone_register(int fd, char *country); 65 | 66 | /* Register a given two-letter tone zone if we can */ 67 | int tone_zone_register_zone(int fd, struct tone_zone *z); 68 | 69 | /* Retrieve a raw tone zone structure */ 70 | struct tone_zone *tone_zone_find(char *country); 71 | 72 | /* Retrieve a raw tone zone structure by id instead of country*/ 73 | struct tone_zone *tone_zone_find_by_num(int id); 74 | 75 | /* Retrieve a string name for a given tone id */ 76 | char *tone_zone_tone_name(int id); 77 | 78 | /* Set a given file descriptor into a given country -- USE THIS 79 | INTERFACE INSTEAD OF THE IOCTL ITSELF. Auto-loads tone 80 | zone if necessary */ 81 | int tone_zone_set_zone(int fd, char *country); 82 | 83 | /* Get the current tone zone */ 84 | int tone_zone_get_zone(int fd); 85 | 86 | /* Play a given tone, loading tone zone automatically 87 | if necessary */ 88 | int tone_zone_play_tone(int fd, int toneid); 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /version.c.in: -------------------------------------------------------------------------------- 1 | /* 2 | * version.c.in 3 | */ 4 | 5 | const char dahdi_tools_version[] = "DAHDI Tools Version - @TOOLSVERSION@"; 6 | 7 | -------------------------------------------------------------------------------- /wavformat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * wavformat.h -- data structures and associated definitions for wav files 3 | * 4 | * By Michael Spiceland (mspiceland@digium.com) 5 | * 6 | * (C) 2009 Digium, Inc. 7 | */ 8 | 9 | /* 10 | * See http://www.asterisk.org for more information about 11 | * the Asterisk project. Please do not directly contact 12 | * any of the maintainers of this project for assistance; 13 | * the project provides a web site, mailing lists and IRC 14 | * channels for your use. 15 | * 16 | * This program is free software, distributed under the terms of 17 | * the GNU General Public License Version 2 as published by the 18 | * Free Software Foundation. See the LICENSE file included with 19 | * this program for more details. 20 | */ 21 | 22 | #ifndef WAVFORMAT_H 23 | #define WAVFORMAT_H 24 | 25 | #include 26 | 27 | struct wavheader { 28 | /* riff type chunk */ 29 | char riff_chunk_id[4]; 30 | uint32_t riff_chunk_size; 31 | char riff_type[4]; 32 | 33 | /* format chunk */ 34 | char fmt_chunk_id[4]; 35 | uint32_t fmt_data_size; 36 | uint16_t fmt_compression_code; 37 | uint16_t fmt_num_channels; 38 | uint32_t fmt_sample_rate; 39 | uint32_t fmt_avg_bytes_per_sec; 40 | uint16_t fmt_block_align; 41 | uint16_t fmt_significant_bps; 42 | 43 | /* data chunk */ 44 | char data_chunk_id[4]; 45 | uint32_t data_data_size; 46 | } __attribute__((packed)); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /xpp/50-dahdi.conf: -------------------------------------------------------------------------------- 1 | # A dracut.conf(5) snippet 2 | # Disable loading the Astribank (xpp_usb) drivers. This is because 3 | # it relies on files in the root filesystem: 4 | # See https://issues.asterisk.org/jira/browse/DAHLIN-352 5 | omit_drivers+=" xpp_usb " 6 | -------------------------------------------------------------------------------- /xpp/astribank.h: -------------------------------------------------------------------------------- 1 | #ifndef ASTRIBANK_H 2 | #define ASTRIBANK_H 3 | 4 | #include 5 | 6 | struct astribank *astribank_new(const char *path); 7 | void astribank_destroy(struct astribank *ab); 8 | void show_astribank_info(const struct astribank *ab); 9 | 10 | struct xusb_iface *astribank_xpp_open(struct astribank *ab); 11 | struct mpp_device *astribank_mpp_open(struct astribank *ab); 12 | 13 | struct xusb_device *xusb_dev_of_astribank(const struct astribank *ab); 14 | const char *astribank_devpath(const struct astribank *ab); 15 | const char *astribank_serial(const struct astribank *ab); 16 | 17 | int astribank_send(struct astribank *ab, int interface_num, const char *buf, int len, int timeout); 18 | int astribank_recv(struct astribank *ab, int interface_num, char *buf, size_t len, int timeout); 19 | 20 | 21 | #define AB_REPORT(report_type, astribank, fmt, ...) \ 22 | report_type("%s [%s]: " fmt, \ 23 | astribank_devpath(astribank), \ 24 | astribank_serial(astribank), \ 25 | ## __VA_ARGS__) 26 | 27 | #define AB_INFO(astribank, fmt, ...) \ 28 | AB_REPORT(INFO, astribank, fmt, ## __VA_ARGS__) 29 | 30 | #define AB_ERR(astribank, fmt, ...) \ 31 | AB_REPORT(ERR, astribank, fmt, ## __VA_ARGS__) 32 | 33 | #endif /* ASTRIBANK_H */ 34 | -------------------------------------------------------------------------------- /xpp/astribank_allow.8: -------------------------------------------------------------------------------- 1 | .TH "ASTRIBANK_ALLOW" "8" "29 March 2009" "" "" 2 | 3 | .SH NAME 4 | astribank_allow \- License Xorcom Astribank (xpp) capabilities. 5 | .SH SYNOPSIS 6 | .B astribank_allow \-D \fIdevice-path\fR [ options ] 7 | 8 | .B astribank_allow [\-h] 9 | 10 | .SH DESCRIPTION 11 | Modern Astribanks (with USB product id's 116x) contain capabilities 12 | that may be licensed. 13 | 14 | .B astribank_allow 15 | is used to upload/download the licensing information to/from the device. 16 | 17 | Uploading a valid license file to an Astribank, changes its capabilities. 18 | The change becomes effective after a firmware reset (either by powering 19 | the device off and on again, or via the \fBastribank_tool\fR full reset option). 20 | 21 | Downloading license from the device, produces a valid license file for its 22 | current capabilities. This may be backed up, so the device may be later 23 | restored to its previous capabilities. 24 | 25 | The license file contains both a human readable description of the 26 | device capabilities for the end user and a hash of the licensing 27 | information used by Xorcom to generate/modify licensed capabilities. 28 | 29 | .SH OPTIONS 30 | .B \-D 31 | .I device-path 32 | .RS 33 | Required. The device to read from/write to. This is 34 | \fIbus_num\fR/\fIdevice_num\fR, where \fIbus_num\fR and \fIdevice_num\fR 35 | are the first two numbers in the output of lsusb(8) or dahdi_hardware(8). 36 | On older versions of this tool you needed a complete path to the device, 37 | which would be /dev/bus/usb/\fIbus_num\fR/\fIdevice_num\fR, or 38 | /proc/bus/usb/\fIbus_num\fR/\fIdevice_num\fR. 39 | .RE 40 | 41 | .B \-w 42 | .RS 43 | Write capabilities to EEPROM, otherwise read capabilities 44 | .RE 45 | 46 | .B \-f \fIfilename\fR 47 | .RS 48 | License filename (stdin/stdout if not specified) 49 | .RE 50 | 51 | .B \-m \fInum\fR 52 | .RS 53 | Choose the numeric code of license markers to generate. 54 | This code select the type of \fIBEGIN\fR.../\fIEND\fR... strings 55 | that delimit the license body. 56 | 57 | Valid marker codes are listed with the \fB-h\fR option. 58 | The default (and first) code is \fB1\fR. Zero is illegal value. 59 | .RE 60 | 61 | .B \-v 62 | .RS 63 | Increase verbosity. May be used multiple times. 64 | .RE 65 | 66 | .B \-d \fImask\fR 67 | .RS 68 | Set debug mask to \fImask\fR. Default is 0, 0xFF is "everything". 69 | .RE 70 | 71 | .B \-h 72 | .RS 73 | Displays usage message. 74 | .RE 75 | 76 | .SH SEE ALSO 77 | fxload(8), lsusb(8), astribank_hexload(8), astribank_tool(8) 78 | 79 | .SH AUTHOR 80 | Alex Landau 81 | -------------------------------------------------------------------------------- /xpp/astribank_is_starting.8: -------------------------------------------------------------------------------- 1 | .TH "ASTRIBANK_IS_STARTING" "8" "16 August 2009" "" "" 2 | 3 | .SH NAME 4 | astribank_is_starting \- Mark / check is a Xorcom Astribank (xpp) is starting 5 | .SH SYNOPSIS 6 | .B astribank_is_starting [\-d] [\-v] [\-t \fItimeout\fB] <\-a|\-r|\-w> 7 | 8 | .B astribank_is_starting [\-d] [\-v] 9 | 10 | .B astribank_is_starting \-h 11 | 12 | .SH DESCRIPTION 13 | .B astribank_is_starting 14 | is an internal tool used by various xpp scripts to mark that there may 15 | be an Astribank device currently initializing, and to check for that mark. 16 | 17 | Technically the mark is a SysV semaphore. 18 | 19 | .SH OPTIONS 20 | .B \-a 21 | .RS 22 | .B Add. 23 | Set the mark. Should return 0 unless there's an error. 24 | .RE 25 | 26 | .B \-r 27 | .RS 28 | .B Remove. 29 | Reset the mark. Should return 0 unless there's an error. 30 | .RE 31 | 32 | .BI \-t timeout 33 | .RS 34 | .B Timeout. 35 | Set the timeout value for the \fB\-w\fR option. Default is 60 seconds. 36 | .RE 37 | 38 | .B \-w 39 | .RS 40 | .B Wait. 41 | Wait for mark to be reset. Should return 0 unless there's an error. 42 | .RE 43 | 44 | Without \-a or \-r: return 0 if the mark has been set, or a non-zero value 45 | otherwise. 46 | 47 | .B \-d 48 | .RS 49 | Print debug information to stderr. 50 | .RE 51 | 52 | .B \-v 53 | .RS 54 | Verbose execution. 55 | .RE 56 | 57 | .B \-h 58 | .RS 59 | Displays usage message. 60 | .RE 61 | 62 | .SH FILES 63 | .B /proc/sysvipc/sem 64 | .RS 65 | If set, the astribank should appear there with the ID 11211168 (0xAB11A0). 66 | Naturally the ID (or rather, the usage of a semaphore in the first place) 67 | is an implementation detail that may change. 68 | .RE 69 | 70 | .SH NOTES 71 | .B astribank_is_starting 72 | is used to mark the fact that an Astribank may be currently reenumerating 73 | (technically: distonnecting and connecting as a new USB device) after 74 | loading the firmware. Thus the script that loads the firmware 75 | (/usr/share/dahdi/xpp_fxloader) uses this utility to set the mark. 76 | 77 | The mark is reset by /usr/share/dahdi/waitfor_xpds , which is typically 78 | run by the DAHDI init script and waits for all Astribanks to finish 79 | loading. 80 | 81 | Q: Why do you use a semaphore? 82 | 83 | A: because, unlike the filesystem, it is writable at any given time. 84 | 85 | .SH BUGS 86 | Option ordering matter. The \fB\-v\fR and \fB\-d\fR options should precede 87 | the actions (\fB\-a\fR, \fB\-r\fR and \fB\-w\fR). 88 | The \fB\-t\fItimeout\fR option should preceed the \fB\-w\fR option. 89 | 90 | .SH SEE ALSO 91 | semctl(3) 92 | 93 | .SH AUTHOR 94 | This manual page was written by Tzafrir Cohen . 95 | Permission is granted to copy, distribute and/or modify this document under 96 | the terms of the GNU General Public License, Version 2 any 97 | later version published by the Free Software Foundation. 98 | 99 | On Debian systems, the complete text of the GNU General Public 100 | License can be found in /usr/share/common\-licenses/GPL. 101 | -------------------------------------------------------------------------------- /xpp/astribank_license.h: -------------------------------------------------------------------------------- 1 | #ifndef ASTRIBANK_ALLOW_H 2 | #define ASTRIBANK_ALLOW_H 3 | 4 | #include "mpptalk.h" 5 | 6 | enum license_markers { 7 | LICENSE_MARKER_NONE = 0, 8 | LICENSE_MARKER_XORCOM = 1, 9 | LICENSE_MARKER_GENERIC = 2, 10 | }; 11 | 12 | int license_marker_valid(unsigned int which); 13 | void license_markers_help(const char *prefix, FILE *fp); 14 | 15 | int write_to_file( 16 | struct eeprom_table *eeprom_table, 17 | struct capabilities *caps, 18 | struct capkey *key, 19 | unsigned int marker, 20 | FILE *f); 21 | 22 | int read_from_file( 23 | struct eeprom_table *eeprom_table, 24 | struct capabilities *caps, 25 | struct capkey *capkey, 26 | unsigned int *used_marker, 27 | FILE *f); 28 | 29 | #endif /* ASTRIBANK_ALLOW_H */ 30 | -------------------------------------------------------------------------------- /xpp/astribank_tool.8: -------------------------------------------------------------------------------- 1 | .TH "ASTRIBANK_TOOL" "8" "29 March 2009" "" "" 2 | 3 | .SH NAME 4 | astribank_tool \- Xorcom Astribank (xpp) control tool 5 | .SH SYNOPSIS 6 | .B astribank_tool [ options ] [ operation... ] \-D \fIdevice-path\fR 7 | 8 | .B astribank_tool [\-h] 9 | 10 | .SH DESCRIPTION 11 | .B astribank_tool 12 | is a tool to control the USB-level functionality of an Astribank. 13 | The tool operates on a single Astribank at a time (given as parameter 14 | to the \-D command line option). 15 | 16 | .SH OPTIONS 17 | .B \-D 18 | .I device-path 19 | .RS 20 | Required. The device to read from/write to. This is 21 | \fIbus_num\fR/\fIdevice_num\fR, where \fIbus_num\fR and \fIdevice_num\fR 22 | are the first two numbers in the output of lsusb(8) or dahdi_hardware(8). 23 | On older versions of this tool you needed a complete path to the device, 24 | which would be /dev/bus/usb/\fIbus_num\fR/\fIdevice_num\fR, or 25 | /proc/bus/usb/\fIbus_num\fR/\fIdevice_num\fR. 26 | .RE 27 | 28 | .B \-p \fInum\fR 29 | .RS 30 | Set the TwinStar port number. Either 0 or 1. 31 | 32 | (TODO: explain). 33 | .RE 34 | 35 | .B \-r \fItype\fR 36 | .RS 37 | Reset the Astribank and renumerate its USB connection to power on product ID. 38 | 39 | Tyep can be: \fBhalf\fR or \fBfull\fR. 40 | 41 | (TODO: explain those). 42 | .RE 43 | 44 | .B \-w 0|1 45 | .RS 46 | Enable (1) or disable (0) the TwinStar watchdog. When enabled, the 47 | Astribank will jump to the second port if this system is "not working" 48 | and the system on the second port is available. 49 | .RE 50 | 51 | .B \-Q 52 | .RS 53 | Query astribank properties via MPP protocol. 54 | .RE 55 | 56 | .B \-n 57 | .RS 58 | Renumerate the Astribank product number (e.g: from 1161 to 1162). 59 | .RE 60 | 61 | .B \-v 62 | .RS 63 | Increase verbosity. May be used multiple times. 64 | .RE 65 | 66 | .B \-d \fImask\fR 67 | .RS 68 | Set debug mask to \fImask\fR. Default is 0, 0xFF is "everything". 69 | .RE 70 | 71 | .B \-h 72 | .RS 73 | Displays usage message. 74 | .RE 75 | 76 | .SH SEE ALSO 77 | fxload(8), lsusb(8), astribank_hexload(8) 78 | 79 | .SH AUTHOR 80 | This manual page was written by Tzafrir Cohen . 81 | Permission is granted to copy, distribute and/or modify this document under 82 | the terms of the GNU General Public License, Version 2 any 83 | later version published by the Free Software Foundation. 84 | 85 | On Debian systems, the complete text of the GNU General Public 86 | License can be found in /usr/share/common\-licenses/GPL. 87 | -------------------------------------------------------------------------------- /xpp/dahdi_drivers: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl -w 2 | use strict; 3 | use File::Basename; 4 | BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/perl_modules"); } 5 | 6 | use Dahdi::Hardware; 7 | 8 | my @drivers = Dahdi::Hardware->drivers; 9 | print join("\n", @drivers),"\n"; 10 | __END__ 11 | 12 | =head1 NAME 13 | 14 | dahdi_drivers - Show drivers required for installed dahdi devices. 15 | 16 | =head1 SYNOPSIS 17 | 18 | dahdi_drivers 19 | 20 | =head1 DESCRIPTION 21 | 22 | This script shows by default the list of drivers required for currently 23 | installed dahdi devices. 24 | -------------------------------------------------------------------------------- /xpp/echo_loader.h: -------------------------------------------------------------------------------- 1 | #ifndef ECHO_LOADER_H 2 | #define ECHO_LOADER_H 3 | /* 4 | * Written by Oron Peled 5 | * Copyright (C) 2008, Xorcom 6 | * 7 | * All rights reserved. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #include 26 | #include "astribank.h" 27 | 28 | int spi_send(struct astribank *astribank, uint16_t addr, uint16_t data, int recv_answer, int ver); 29 | int load_echo(struct astribank *astribank, char *filename, int is_alaw, const char *span_spec); 30 | int echo_ver(struct astribank *astribank); 31 | 32 | #endif /* ECHO_LOADER_H */ 33 | -------------------------------------------------------------------------------- /xpp/hexfile.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Oron Peled 3 | * Copyright (C) 2006, 2007, 2008, Xorcom 4 | * 5 | * All rights reserved. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | */ 22 | 23 | #ifndef PARSE_HEXFILE_H 24 | #define PARSE_HEXFILE_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #define PACKED __attribute__((packed)) 32 | #define ZERO_SIZE 0 33 | 34 | /* Record types in hexfile */ 35 | enum { 36 | TT_DATA = 0, 37 | TT_EOF = 1, 38 | TT_EXT_SEG = 2, 39 | TT_START_SEG = 3, 40 | TT_EXT_LIN = 4, 41 | TT_START_LIN = 5, 42 | TT_NO_SUCH_TT 43 | }; 44 | 45 | #pragma pack(1) 46 | struct hexline { 47 | union { 48 | uint8_t raw[ZERO_SIZE]; 49 | struct content { 50 | struct header { 51 | uint8_t ll; /* len */ 52 | uint16_t offset; /* offset */ 53 | uint8_t tt; /* type */ 54 | } PACKED header; 55 | struct tt_data { 56 | uint8_t data[ZERO_SIZE]; 57 | } tt_data; 58 | } PACKED content; 59 | } d; 60 | } PACKED; 61 | #pragma pack() 62 | 63 | struct hexdata { 64 | unsigned int maxlines; 65 | unsigned int last_line; 66 | int got_eof; 67 | char fname[PATH_MAX]; 68 | char version_info[BUFSIZ]; 69 | struct hexline *lines[ZERO_SIZE]; 70 | }; 71 | 72 | 73 | __BEGIN_DECLS 74 | 75 | typedef void (*parse_hexfile_report_func_t)(int level, const char *msg, ...) 76 | #ifdef __GNUC__ 77 | __attribute__((format(printf,2,3))); 78 | #endif 79 | ; 80 | 81 | parse_hexfile_report_func_t parse_hexfile_set_reporting(parse_hexfile_report_func_t rf); 82 | void free_hexdata(struct hexdata *hexdata); 83 | struct hexdata *parse_hexfile(const char *fname, unsigned int maxlines); 84 | int dump_hexfile(struct hexdata *hexdata, const char *outfile); 85 | int dump_hexfile2(struct hexdata *hexdata, const char *outfile, uint8_t maxwidth); 86 | void dump_binary(struct hexdata *hexdata, const char *outfile); 87 | void gen_hexline(const uint8_t *data, uint16_t addr, size_t len, FILE *output); 88 | int bsd_checksum(struct hexdata *hexdata); 89 | __END_DECLS 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /xpp/oct612x/get_discards: -------------------------------------------------------------------------------- 1 | #!/usr/bin/php 2 | 3 | 52 | -------------------------------------------------------------------------------- /xpp/oct612x/include/apilib/octapi_largmath.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: octapi_largmath.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | Library used to perform arithmetic on integer values of an integer multiple 10 | of 32-bits. 11 | 12 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 13 | free software; you can redistribute it and/or modify it under the terms of 14 | the GNU General Public License as published by the Free Software Foundation; 15 | either version 2 of the License, or (at your option) any later version. 16 | 17 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 18 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 19 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20 | for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with the OCT6100 GPL API; if not, write to the Free Software 24 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25 | 26 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 27 | 28 | $Octasic_Revision: 6 $ 29 | 30 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 31 | #ifndef __OCTAPI_LARGMATH_H__ 32 | #define __OCTAPI_LARGMATH_H__ 33 | 34 | #include "octdef.h" 35 | 36 | #define OCTAPI_LM_DIVISION_BY_ZERO 0xFFFF 37 | #define OCTAPI_LM_OVERFLOW 0xFFFE 38 | #define OCTAPI_LM_ARRAY_SIZE_MISMATCH 0xFFFD 39 | 40 | #define OCTAPI_LM_MAX_OPTIMIZE_MUL 10 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif /* __cplusplus */ 45 | 46 | #define octapi_lm_add( a, alen, b, blen, z, zlen ) OctApiLmAdd( (PUINT32) a, (USHORT) alen, (PUINT32) b, (USHORT) blen, (PUINT32) z, (USHORT) zlen ) 47 | #define octapi_lm_subtract( a, alen, bneg, blen, z, zlen, neg ) OctApiLmSubtract( (PUINT32) a, (USHORT) alen, (PUINT32) bneg, (USHORT) blen, (PUINT32) z, (USHORT) zlen, (USHORT*) neg ) 48 | #define octapi_lm_compare( a, alen, bneg, blen, neg ) OctApiLmCompare( (PUINT32) a, (USHORT) alen, (PUINT32) bneg, (USHORT) blen, (USHORT*) neg ) 49 | #define octapi_lm_multiply( a, b, ablen, z ) OctApiLmMultiply( (PUINT32) a, (PUINT32) b, (USHORT) ablen, (PUINT32) z ) 50 | #define octapi_lm_divide( n, d, q, r, ndqrlen ) OctApiLmDivide( (PUINT32) n, (PUINT32) d, (PUINT32) q, (PUINT32) r, (USHORT) ndqrlen ) 51 | #define octapi_lm_shiftright1( a, alen ) OctApiLmShiftRight1( (PUINT32) a, (USHORT) alen ) 52 | #define octapi_lm_shiftn( a, alen, shiftleft, shiftn ) OctApiLmShiftn( (PUINT32) a, (USHORT) alen, (USHORT) shiftleft, (USHORT) shiftn ) 53 | #define octapi_lm_getmsb( a, alen, msb_pos ) OctApiLmGetMsb( (PUINT32) a, (USHORT) alen, (USHORT*) msb_pos ) 54 | 55 | 56 | UINT32 OctApiLmAdd( PUINT32 a, USHORT alen, PUINT32 b, USHORT blen, PUINT32 z, USHORT zlen ); 57 | UINT32 OctApiLmSubtract( PUINT32 a, USHORT alen, PUINT32 bneg, USHORT blen, PUINT32 z, USHORT zlen, PUSHORT neg ); 58 | UINT32 OctApiLmCompare( PUINT32 a, USHORT alen, PUINT32 bneg, USHORT blen, PUSHORT neg ); 59 | UINT32 OctApiLmMultiply( PUINT32 a, PUINT32 b, USHORT ablen, PUINT32 z ); 60 | UINT32 OctApiLmDivide( PUINT32 n, PUINT32 d, PUINT32 q, PUINT32 r, USHORT ndqrlen ); 61 | UINT32 OctApiLmShiftRight1( PUINT32 a, USHORT alen ); 62 | UINT32 OctApiLmShiftn( PUINT32 a, USHORT alen, USHORT shiftleft, USHORT shiftn ); 63 | UINT32 OctApiLmGetMsb( PUINT32 a, USHORT alen, PUSHORT msb_pos ); 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif /* __cplusplus */ 68 | 69 | #endif /* __OCTAPI_LARGMATH_H__ */ 70 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_adpcm_chan_inst.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_adpcm_chan_inst.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_adpcm_chan.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_adpcm_chan_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 6 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_ADPCM_CHAN_INST_H__ 35 | #define __OCT6100_ADPCM_CHAN_INST_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | /***************************** DEFINES *************************************/ 40 | 41 | /***************************** TYPES ***************************************/ 42 | 43 | typedef struct _OCT6100_API_ADPCM_CHAN_ 44 | { 45 | /* Flag specifying whether the entry is used or not. */ 46 | UINT8 fReserved; 47 | 48 | /* Count used to manage entry handles allocated to user. */ 49 | UINT8 byEntryOpenCnt; 50 | 51 | /* TSI chariot memory entry. */ 52 | UINT16 usTsiMemIndex; 53 | 54 | /* ADPCM memory entry. */ 55 | UINT16 usAdpcmMemIndex; 56 | 57 | /* Input and output timeslot information. */ 58 | UINT16 usInputTimeslot; 59 | UINT16 usInputStream; 60 | UINT8 byInputNumTssts; 61 | UINT8 byInputPcmLaw; 62 | 63 | UINT16 usOutputTimeslot; 64 | UINT16 usOutputStream; 65 | UINT8 byOutputNumTssts; 66 | UINT8 byOutputPcmLaw; 67 | 68 | /* Internal info for quick access to structures associated to this TSI cnct. */ 69 | UINT16 usInputTsstIndex; 70 | UINT16 usOutputTsstIndex; 71 | 72 | } tOCT6100_API_ADPCM_CHAN, *tPOCT6100_API_ADPCM_CHAN; 73 | 74 | #endif /* __OCT6100_ADPCM_CHAN_INST_H__ */ 75 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_adpcm_chan_pub.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_adpcm_chan_pub.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_adpcm_chan.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_adpcm_chan_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 5 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_ADPCM_CHAN_PUB_H__ 35 | #define __OCT6100_ADPCM_CHAN_PUB_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_ADPCM_CHAN_OPEN_ 46 | { 47 | PUINT32 pulChanHndl; 48 | 49 | UINT32 ulInputTimeslot; 50 | UINT32 ulInputStream; 51 | UINT32 ulInputNumTssts; 52 | UINT32 ulInputPcmLaw; 53 | 54 | UINT32 ulOutputTimeslot; 55 | UINT32 ulOutputStream; 56 | UINT32 ulOutputNumTssts; 57 | UINT32 ulOutputPcmLaw; 58 | 59 | UINT32 ulChanMode; /* Encoding or decoding. */ 60 | 61 | UINT32 ulEncodingRate; 62 | UINT32 ulDecodingRate; 63 | 64 | UINT32 ulAdpcmNibblePosition; 65 | 66 | } tOCT6100_ADPCM_CHAN_OPEN, *tPOCT6100_ADPCM_CHAN_OPEN; 67 | 68 | typedef struct _OCT6100_ADPCM_CHAN_CLOSE_ 69 | { 70 | UINT32 ulChanHndl; 71 | 72 | } tOCT6100_ADPCM_CHAN_CLOSE, *tPOCT6100_ADPCM_CHAN_CLOSE; 73 | 74 | 75 | /************************** FUNCTION PROTOTYPES *****************************/ 76 | 77 | 78 | UINT32 Oct6100AdpcmChanOpenDef( 79 | OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ); 80 | UINT32 Oct6100AdpcmChanOpen( 81 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 82 | IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ); 83 | 84 | UINT32 Oct6100AdpcmChanCloseDef( 85 | OUT tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ); 86 | UINT32 Oct6100AdpcmChanClose( 87 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 88 | IN OUT tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ); 89 | 90 | #endif /* __OCT6100_ADPCM_CHAN_PUB_H__ */ 91 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_api.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_api.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | Header file containing all definitions used throughout the API. 10 | 11 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 12 | free software; you can redistribute it and/or modify it under the terms of 13 | the GNU General Public License as published by the Free Software Foundation; 14 | either version 2 of the License, or (at your option) any later version. 15 | 16 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 17 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 18 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 | for more details. 20 | 21 | You should have received a copy of the GNU General Public License 22 | along with the OCT6100 GPL API; if not, write to the Free Software 23 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24 | 25 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 26 | 27 | $Octasic_Revision: 23 $ 28 | 29 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 30 | 31 | #ifndef __OCT6100_API_H__ 32 | #define __OCT6100_API_H__ 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /***************************** INCLUDE FILES *******************************/ 39 | 40 | #include "octdef.h" 41 | 42 | #include "oct6100_defines.h" 43 | #include "oct6100_errors.h" 44 | 45 | #include "oct6100_apiud.h" 46 | #include "oct6100_tlv_inst.h" 47 | #include "oct6100_chip_stats_inst.h" 48 | #include "oct6100_tsi_cnct_inst.h" 49 | #include "oct6100_mixer_inst.h" 50 | #include "oct6100_events_inst.h" 51 | #include "oct6100_tone_detection_inst.h" 52 | #include "oct6100_conf_bridge_inst.h" 53 | #include "oct6100_playout_buf_inst.h" 54 | 55 | #include "oct6100_adpcm_chan_inst.h" 56 | #include "oct6100_phasing_tsst_inst.h" 57 | #include "oct6100_channel_inst.h" 58 | #include "oct6100_interrupts_inst.h" 59 | #include "oct6100_remote_debug_inst.h" 60 | #include "oct6100_debug_inst.h" 61 | #include "oct6100_chip_open_inst.h" 62 | #include "oct6100_api_inst.h" 63 | 64 | #include "oct6100_interrupts_pub.h" 65 | #include "oct6100_tsi_cnct_pub.h" 66 | #include "oct6100_events_pub.h" 67 | #include "oct6100_tone_detection_pub.h" 68 | #include "oct6100_mixer_pub.h" 69 | #include "oct6100_conf_bridge_pub.h" 70 | #include "oct6100_playout_buf_pub.h" 71 | 72 | #include "oct6100_channel_pub.h" 73 | #include "oct6100_remote_debug_pub.h" 74 | #include "oct6100_debug_pub.h" 75 | #include "oct6100_chip_open_pub.h" 76 | #include "oct6100_chip_stats_pub.h" 77 | #include "oct6100_adpcm_chan_pub.h" 78 | #include "oct6100_phasing_tsst_pub.h" 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | #endif /* __OCT6100_API_H__ */ 85 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_apimi.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_apimi.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | This file contains the declaration of all functions exported from the 10 | APIMI block. The APIMI block contains only one function: 11 | Oct6100InterruptMask. 12 | The function is used to mask out the interrupt pin of the chip. This 13 | function is used when a deferred procedure call treats the interrupt (new 14 | interrupts must not be generated until the signalled interrupt is treated). 15 | 16 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 17 | free software; you can redistribute it and/or modify it under the terms of 18 | the GNU General Public License as published by the Free Software Foundation; 19 | either version 2 of the License, or (at your option) any later version. 20 | 21 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 22 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 23 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24 | for more details. 25 | 26 | You should have received a copy of the GNU General Public License 27 | along with the OCT6100 GPL API; if not, write to the Free Software 28 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 29 | 30 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 31 | 32 | $Octasic_Revision: 6 $ 33 | 34 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 35 | 36 | #ifndef __OCT6100_APIMI_H__ 37 | #define __OCT6100_APIMI_H__ 38 | 39 | #ifdef __cplusplus 40 | extern "C" 41 | { 42 | #endif /* __cplusplus */ 43 | 44 | /***************************** INCLUDE FILES *******************************/ 45 | 46 | #include "octdef.h" 47 | 48 | /***************************** TYPES ***************************************/ 49 | 50 | typedef struct _OCT6100_INTERRUPT_MASK_ 51 | { 52 | UINT32 ulUserChipIndex; 53 | PVOID pProcessContext; 54 | 55 | 56 | } tOCT6100_INTERRUPT_MASK, *tPOCT6100_INTERRUPT_MASK; 57 | 58 | /************************** FUNCTION PROTOTYPES *****************************/ 59 | 60 | UINT32 Oct6100InterruptMaskDef( 61 | OUT tPOCT6100_INTERRUPT_MASK f_pInterruptMask ); 62 | UINT32 Oct6100InterruptMask( 63 | IN tPOCT6100_INTERRUPT_MASK f_pInterruptMask ); 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif /* __cplusplus */ 68 | 69 | #endif /* __OCT6100_APIMI_H__ */ 70 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_chip_stats_inst.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_chip_stats_inst.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_chip_stats.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_chip_stats_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 21 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_CHIP_STATS_INST_H__ 35 | #define __OCT6100_CHIP_STATS_INST_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_API_CHIP_ERROR_STATS_ 46 | { 47 | UINT8 fFatalChipError; 48 | 49 | UINT32 ulInternalReadTimeoutCnt; 50 | UINT32 ulSdramRefreshTooLateCnt; 51 | UINT32 ulPllJitterErrorCnt; 52 | 53 | /* Internal tone detector error counter. */ 54 | UINT32 ulToneDetectorErrorCnt; 55 | 56 | UINT32 ulOverflowToneEventsCnt; 57 | 58 | UINT32 ulH100OutOfSyncCnt; 59 | UINT32 ulH100ClkABadCnt; 60 | UINT32 ulH100ClkBBadCnt; 61 | UINT32 ulH100FrameABadCnt; 62 | 63 | 64 | 65 | } tOCT6100_API_CHIP_ERROR_STATS, *tPOCT6100_API_CHIP_ERROR_STATS; 66 | 67 | typedef struct _OCT6100_API_CHIP_STATS_ 68 | { 69 | UINT16 usNumberChannels; 70 | UINT16 usNumberBiDirChannels; 71 | UINT16 usNumberTsiCncts; 72 | UINT16 usNumberConfBridges; 73 | UINT16 usNumberPlayoutBuffers; 74 | UINT16 usNumEcChanUsingMixer; 75 | 76 | UINT32 ulPlayoutMemUsed; 77 | UINT16 usNumberActiveBufPlayoutPorts; 78 | 79 | UINT16 usNumberPhasingTssts; 80 | UINT16 usNumberAdpcmChans; 81 | 82 | } tOCT6100_API_CHIP_STATS, *tPOCT6100_API_CHIP_STATS; 83 | 84 | #endif /* __OCT6100_CHIP_STATS_INST_H__ */ 85 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_debug_pub.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_debug_pub.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_debug.c. All elements defined in this file are for public 11 | usage of the API. 12 | 13 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 14 | free software; you can redistribute it and/or modify it under the terms of 15 | the GNU General Public License as published by the Free Software Foundation; 16 | either version 2 of the License, or (at your option) any later version. 17 | 18 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 19 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 20 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21 | for more details. 22 | 23 | You should have received a copy of the GNU General Public License 24 | along with the OCT6100 GPL API; if not, write to the Free Software 25 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26 | 27 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 28 | 29 | $Octasic_Revision: 14 $ 30 | 31 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 32 | 33 | #ifndef __OCT6100_DEBUG_PUB_H__ 34 | #define __OCT6100_DEBUG_PUB_H__ 35 | 36 | /***************************** INCLUDE FILES *******************************/ 37 | 38 | 39 | /***************************** DEFINES *************************************/ 40 | 41 | 42 | /***************************** TYPES ***************************************/ 43 | 44 | typedef struct _OCT6100_DEBUG_SELECT_CHANNEL_ 45 | { 46 | UINT32 ulChannelHndl; 47 | 48 | } tOCT6100_DEBUG_SELECT_CHANNEL, *tPOCT6100_DEBUG_SELECT_CHANNEL; 49 | 50 | typedef struct _OCT6100_DEBUG_GET_DATA_ 51 | { 52 | UINT32 ulGetDataMode; 53 | UINT32 ulGetDataContent; 54 | UINT32 ulRemainingNumBytes; 55 | UINT32 ulTotalNumBytes; 56 | UINT32 ulMaxBytes; 57 | UINT32 ulValidNumBytes; 58 | PUINT8 pbyData; 59 | 60 | } tOCT6100_DEBUG_GET_DATA, *tPOCT6100_DEBUG_GET_DATA; 61 | 62 | /************************** FUNCTION PROTOTYPES *****************************/ 63 | 64 | UINT32 Oct6100DebugSelectChannelDef( 65 | OUT tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan ); 66 | UINT32 Oct6100DebugSelectChannel( 67 | IN OUT tPOCT6100_INSTANCE_API f_pApiInst, 68 | IN OUT tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan ); 69 | 70 | UINT32 Oct6100DebugGetDataDef( 71 | OUT tPOCT6100_DEBUG_GET_DATA f_pGetData ); 72 | UINT32 Oct6100DebugGetData( 73 | IN OUT tPOCT6100_INSTANCE_API f_pApiInst, 74 | IN OUT tPOCT6100_DEBUG_GET_DATA f_pGetData ); 75 | 76 | #endif /* __OCT6100_DEBUG_PUB_H__ */ 77 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_events_inst.h: -------------------------------------------------------------------------------- 1 | 2 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 3 | 4 | File: oct6100_events_inst.h 5 | 6 | Copyright (c) 2001-2007 Octasic Inc. 7 | 8 | Description: 9 | 10 | File containing all defines, macros, and structures pertaining to the file 11 | oct6100_events.c. All elements defined in this file are for public 12 | usage of the API. All private elements are defined in the 13 | oct6100_events_priv.h file. 14 | 15 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 16 | free software; you can redistribute it and/or modify it under the terms of 17 | the GNU General Public License as published by the Free Software Foundation; 18 | either version 2 of the License, or (at your option) any later version. 19 | 20 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received a copy of the GNU General Public License 26 | along with the OCT6100 GPL API; if not, write to the Free Software 27 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 28 | 29 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 30 | 31 | $Octasic_Revision: 12 $ 32 | 33 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 34 | 35 | #ifndef __OCT6100_EVENTS_INST_H__ 36 | #define __OCT6100_EVENTS_INST_H__ 37 | 38 | /***************************** INCLUDE FILES *******************************/ 39 | 40 | 41 | /***************************** DEFINES *************************************/ 42 | 43 | 44 | /***************************** TYPES ***************************************/ 45 | 46 | typedef struct _OCT6100_API_TONE_EVENT_ 47 | { 48 | UINT32 ulChannelHandle; 49 | UINT32 ulUserChanId; 50 | UINT32 ulToneDetected; /* Tone number of the tone detected. */ 51 | UINT32 ulTimestamp; 52 | UINT32 ulEventType; 53 | UINT32 ulExtToneDetectionPort; 54 | 55 | } tOCT6100_API_TONE_EVENT, *tPOCT6100_API_TONE_EVENT; 56 | 57 | typedef struct _OCT6100_API_BUFFER_PLAYOUT_EVENT_ 58 | { 59 | UINT32 ulChannelHandle; 60 | UINT32 ulUserChanId; 61 | UINT32 ulChannelPort; 62 | UINT32 ulTimestamp; 63 | UINT32 ulUserEventId; 64 | UINT32 ulEventType; 65 | 66 | } tOCT6100_API_BUFFER_PLAYOUT_EVENT, *tPOCT6100_API_BUFFER_PLAYOUT_EVENT; 67 | 68 | #endif /* __OCT6100_EVENTS_INST_H__ */ 69 | 70 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_interrupts_pub.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_interrupts_pub.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_interrupts.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_interrupts_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 23 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_INTERRUPTS_PUB_H__ 35 | #define __OCT6100_INTERRUPTS_PUB_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_INTERRUPT_CONFIGURE_ 46 | { 47 | UINT32 ulFatalGeneralConfig; 48 | UINT32 ulFatalMemoryConfig; 49 | 50 | UINT32 ulErrorMemoryConfig; 51 | UINT32 ulErrorOverflowToneEventsConfig; 52 | UINT32 ulErrorH100Config; 53 | 54 | UINT32 ulFatalMemoryTimeout; 55 | UINT32 ulErrorMemoryTimeout; 56 | UINT32 ulErrorOverflowToneEventsTimeout; 57 | UINT32 ulErrorH100Timeout; 58 | 59 | } tOCT6100_INTERRUPT_CONFIGURE, *tPOCT6100_INTERRUPT_CONFIGURE; 60 | 61 | typedef struct _OCT6100_INTERRUPT_FLAGS_ 62 | { 63 | BOOL fFatalGeneral; 64 | UINT32 ulFatalGeneralFlags; 65 | 66 | BOOL fFatalReadTimeout; 67 | 68 | BOOL fErrorRefreshTooLate; 69 | BOOL fErrorPllJitter; 70 | 71 | BOOL fErrorOverflowToneEvents; 72 | 73 | BOOL fErrorH100OutOfSync; 74 | BOOL fErrorH100ClkA; 75 | BOOL fErrorH100ClkB; 76 | BOOL fErrorH100FrameA; 77 | 78 | BOOL fToneEventsPending; 79 | BOOL fBufferPlayoutEventsPending; 80 | 81 | BOOL fApiSynch; 82 | 83 | 84 | 85 | } tOCT6100_INTERRUPT_FLAGS, *tPOCT6100_INTERRUPT_FLAGS; 86 | 87 | /************************** FUNCTION PROTOTYPES *****************************/ 88 | 89 | UINT32 Oct6100InterruptConfigureDef( 90 | OUT tPOCT6100_INTERRUPT_CONFIGURE f_pConfigInts ); 91 | UINT32 Oct6100InterruptConfigure( 92 | IN tPOCT6100_INSTANCE_API f_pApiInst, 93 | IN OUT tPOCT6100_INTERRUPT_CONFIGURE f_pConfigInts ); 94 | 95 | UINT32 Oct6100InterruptServiceRoutineDef( 96 | OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); 97 | UINT32 Oct6100InterruptServiceRoutine( 98 | IN tPOCT6100_INSTANCE_API f_pApiInst, 99 | IN OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); 100 | 101 | #endif /* __OCT6100_INTERRUPTS_PUB_H__ */ 102 | 103 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_mixer_inst.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_mixer_inst.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_mixer.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_mixer_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 13 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_MIXER_INST_H__ 35 | #define __OCT6100_MIXER_INST_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_API_MIXER_EVENT_ 46 | { 47 | /* Flag specifying whether the entry is used or not. */ 48 | UINT8 fReserved; 49 | 50 | /* Type of the event.*/ 51 | UINT16 usEventType; 52 | 53 | /* Source channel index */ 54 | UINT16 usSourceChanIndex; 55 | 56 | /* Destination channel index */ 57 | UINT16 usDestinationChanIndex; 58 | 59 | /* Pointer to the next entry.*/ 60 | UINT16 usNextEventPtr; 61 | 62 | } tOCT6100_API_MIXER_EVENT, *tPOCT6100_API_MIXER_EVENT; 63 | 64 | 65 | typedef struct _OCT6100_API_COPY_EVENT_ 66 | { 67 | /* Flag specifying whether the entry is used or not. */ 68 | UINT8 fReserved; 69 | 70 | /* Count used to manage entry handles allocated to user. */ 71 | UINT8 byEntryOpenCnt; 72 | 73 | /* Source + destination ports. */ 74 | UINT8 bySourcePort; 75 | UINT8 byDestinationPort; 76 | 77 | /* Index of the channels associated to this event.*/ 78 | UINT16 usSourceChanIndex; 79 | UINT16 usDestinationChanIndex; 80 | 81 | UINT16 usMixerEventIndex; 82 | 83 | } tOCT6100_API_COPY_EVENT, *tPOCT6100_API_COPY_EVENT; 84 | 85 | 86 | #endif /* __OCT6100_MIXER_INST_H__ */ 87 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_mixer_pub.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_mixer_pub.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_mixer.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_mixer_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 7 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_MIXER_PUB_H__ 35 | #define __OCT6100_MIXER_PUB_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_COPY_EVENT_CREATE_ 46 | { 47 | PUINT32 pulCopyEventHndl; 48 | 49 | UINT32 ulSourceChanHndl; 50 | UINT32 ulSourcePort; 51 | 52 | UINT32 ulDestinationChanHndl; 53 | UINT32 ulDestinationPort; 54 | 55 | } tOCT6100_COPY_EVENT_CREATE, *tPOCT6100_COPY_EVENT_CREATE; 56 | 57 | typedef struct _OCT6100_COPY_EVENT_DESTROY_ 58 | { 59 | UINT32 ulCopyEventHndl; 60 | 61 | } tOCT6100_COPY_EVENT_DESTROY, *tPOCT6100_COPY_EVENT_DESTROY; 62 | 63 | /************************** FUNCTION PROTOTYPES *****************************/ 64 | 65 | UINT32 Oct6100MixerCopyEventCreateDef( 66 | OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ); 67 | UINT32 Oct6100MixerCopyEventCreate( 68 | IN OUT tPOCT6100_INSTANCE_API f_pApiInst, 69 | IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ); 70 | 71 | UINT32 Oct6100MixerCopyEventDestroyDef( 72 | OUT tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ); 73 | UINT32 Oct6100MixerCopyEventDestroy( 74 | IN OUT tPOCT6100_INSTANCE_API f_pApiInst, 75 | IN OUT tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ); 76 | 77 | #endif /* __OCT6100_MIXER_PUB_H__ */ 78 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_phasing_tsst_inst.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_phasing_tsst_inst.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_phasing_tsst.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_phasing_tsst_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 11 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_PHASING_TSST_INST_H__ 35 | #define __OCT6100_PHASING_TSST_INST_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_API_PHASING_TSST_ 46 | { 47 | /* Flag specifying whether the entry is used or not. */ 48 | UINT8 fReserved; 49 | 50 | /* Count used to manage entry handles allocated to user. */ 51 | UINT8 byEntryOpenCnt; 52 | 53 | /* Count of number of resources connected in some way to this buffer. */ 54 | UINT16 usDependencyCnt; 55 | 56 | /* TDM timeslot and stream where the counter is read. */ 57 | UINT16 usStream; 58 | UINT16 usTimeslot; 59 | 60 | /* Length of the phasing TSST counter. */ 61 | UINT16 usPhasingLength; 62 | 63 | /* TSST control index where the counter comes from. */ 64 | UINT16 usPhasingTsstIndex; 65 | 66 | } tOCT6100_API_PHASING_TSST, *tPOCT6100_API_PHASING_TSST; 67 | 68 | #endif /* __OCT6100_PHASING_TSST_INST_H__ */ 69 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_phasing_tsst_pub.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_phasing_tsst_pub.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_phasing_tsst.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_phasing_tsst_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 10 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_PHASING_TSST_PUB_H__ 35 | #define __OCT6100_PHASING_TSST_PUB_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_PHASING_TSST_OPEN_ 46 | { 47 | PUINT32 pulPhasingTsstHndl; 48 | 49 | UINT32 ulPhasingLength; 50 | UINT32 ulTimeslot; 51 | UINT32 ulStream; 52 | 53 | 54 | 55 | } tOCT6100_PHASING_TSST_OPEN, *tPOCT6100_PHASING_TSST_OPEN; 56 | 57 | typedef struct _OCT6100_PHASING_TSST_CLOSE_ 58 | { 59 | UINT32 ulPhasingTsstHndl; 60 | 61 | } tOCT6100_PHASING_TSST_CLOSE, *tPOCT6100_PHASING_TSST_CLOSE; 62 | 63 | /************************** FUNCTION PROTOTYPES *****************************/ 64 | 65 | UINT32 Oct6100PhasingTsstOpenDef( 66 | OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ); 67 | UINT32 Oct6100PhasingTsstOpen( 68 | IN tPOCT6100_INSTANCE_API f_pApiInstance, 69 | IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ); 70 | 71 | UINT32 Oct6100PhasingTsstCloseDef( 72 | OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ); 73 | UINT32 Oct6100PhasingTsstClose( 74 | IN tPOCT6100_INSTANCE_API f_pApiInstance, 75 | IN OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ); 76 | 77 | #endif /* __OCT6100_PHASING_TSST_PUB_H__ */ 78 | 79 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_playout_buf_inst.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_playout_buf_inst.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_playout_buf.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_playout_buf_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 10 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_PLAYOUT_BUF_INST_H__ 35 | #define __OCT6100_PLAYOUT_BUF_INST_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | #define mOCT6100_GET_BUFFER_MEMORY_NODE_LIST_PNT( pSharedInfo, pList ) \ 43 | pList = ( tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufMemoryNodeListOfst ); 44 | 45 | #define mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ 46 | pEntry = (( tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufMemoryNodeListOfst)) + ulIndex; 47 | 48 | /***************************** TYPES ***************************************/ 49 | 50 | typedef struct _OCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE_ 51 | { 52 | /* Next node. */ 53 | UINT32 ulNext; 54 | 55 | /* Previous node. */ 56 | UINT32 ulPrevious; 57 | 58 | /* Start address of this node. */ 59 | UINT32 ulStartAddress; 60 | 61 | /* Size of this node. */ 62 | UINT32 ulSize; 63 | 64 | /* Allocated node? Free node? */ 65 | UINT8 fAllocated; 66 | 67 | } tOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE, *tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE; 68 | 69 | typedef struct _OCT6100_API_BUFFER_ 70 | { 71 | /* Flag specifying whether the entry is used or not. */ 72 | UINT8 fReserved; 73 | 74 | /* Pcm law of the buffer. */ 75 | UINT8 byBufferPcmLaw; 76 | 77 | /* Number of channels currently playing this buffer.*/ 78 | UINT16 usDependencyCnt; 79 | 80 | /* Length of the buffer ( in bytes ).*/ 81 | UINT32 ulBufferSize; 82 | 83 | /* Address in external memory of the buffer. */ 84 | UINT32 ulBufferBase; 85 | 86 | } tOCT6100_API_BUFFER, *tPOCT6100_API_BUFFER; 87 | 88 | #endif /* __OCT6100_PLAYOUT_BUF_INST_H__ */ 89 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_remote_debug_inst.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_remote_debug_inst.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_remote_debug.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_remote_debug_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 6 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_REMOTE_DEBUG_INST_H__ 35 | #define __OCT6100_REMOTE_DEBUG_INST_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_API_REMOTE_DEBUG_INFO_ 46 | { 47 | UINT32 ulSessionTreeOfst; 48 | UINT32 ulSessionListOfst; 49 | UINT32 ulSessionListHead; 50 | UINT32 ulSessionListTail; 51 | 52 | UINT32 ulPktCacheOfst; 53 | UINT32 ulDataBufOfst; 54 | 55 | UINT32 ulNumSessionsOpen; 56 | UINT32 ulMaxSessionsOpen; 57 | 58 | } tOCT6100_API_REMOTE_DEBUG_INFO, *tPOCT6100_API_REMOTE_DEBUG_INFO; 59 | 60 | typedef struct _OCT6100_API_REMOTE_DEBUG_SESSION_ 61 | { 62 | UINT32 ulSessionNum; 63 | UINT32 ulTransactionNum; 64 | UINT32 ulPktRetryNum; 65 | UINT32 ulPktByteSize; 66 | 67 | UINT32 aulLastPktTime[ 2 ]; 68 | UINT32 ulForwardLink; 69 | UINT32 ulBackwardLink; 70 | 71 | } tOCT6100_API_REMOTE_DEBUG_SESSION, *tPOCT6100_API_REMOTE_DEBUG_SESSION; 72 | 73 | #endif /* __OCT6100_REMOTE_DEBUG_INST_H__ */ 74 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_remote_debug_pub.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_remote_debug_pub.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_remote_debug.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_remote_debug_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 6 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_REMOTE_DEBUG_PUB_H__ 35 | #define __OCT6100_REMOTE_DEBUG_PUB_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_REMOTE_DEBUG_ 46 | { 47 | PUINT32 pulReceivedPktPayload; 48 | UINT32 ulReceivedPktLength; 49 | 50 | PUINT32 pulResponsePktPayload; 51 | UINT32 ulMaxResponsePktLength; 52 | UINT32 ulResponsePktLength; 53 | 54 | } tOCT6100_REMOTE_DEBUG, *tPOCT6100_REMOTE_DEBUG; 55 | 56 | /************************** FUNCTION PROTOTYPES *****************************/ 57 | 58 | UINT32 Oct6100RemoteDebugDef( 59 | OUT tPOCT6100_REMOTE_DEBUG f_pRemoteDebug ); 60 | UINT32 Oct6100RemoteDebug( 61 | IN OUT tPOCT6100_INSTANCE_API f_pApiInst, 62 | IN OUT tPOCT6100_REMOTE_DEBUG f_pRemoteDebug ); 63 | 64 | #endif /* __OCT6100_REMOTE_DEBUG_PUB_H__ */ 65 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_tlv_inst.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_tlv_inst.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_tlv.c. All elements defined in this file are for public 11 | usage of the API. All instate elements are defined in the 12 | oct6100_tlv_inst.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 7 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_TLV_INST_H__ 35 | #define __OCT6100_TLV_INST_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | /***************************** DEFINES *************************************/ 40 | 41 | /***************************** TYPES ***************************************/ 42 | 43 | typedef struct _OCT6100_TLV_OFFSET_ 44 | { 45 | /* The dword offset contain the number of dword from a base address to reach the desired dword. 46 | 47 | i.e. usDwordOffset = (total bit offset) / 32; */ 48 | 49 | UINT16 usDwordOffset; 50 | 51 | /* The bit offset will contain the bit offset required to right shift the DWORD read and obtain 52 | the desired value. This field is depend on the field size. 53 | 54 | i.e. byBitOffset = 31 - ((total bit offset) % 32) - byFieldSize; */ 55 | 56 | UINT8 byBitOffset; 57 | UINT8 byFieldSize; 58 | 59 | } tOCT6100_TLV_OFFSET, *tPOCT6100_TLV_OFFSET; 60 | 61 | typedef struct _OCT6100_TLV_TONE_INFO_ 62 | { 63 | UINT32 ulToneID; 64 | UINT32 ulDetectionPort; 65 | 66 | UINT8 aszToneName[ cOCT6100_TLV_MAX_TONE_NAME_SIZE ]; 67 | 68 | 69 | 70 | } tOCT6100_TLV_TONE_INFO, *tPOCT6100_TLV_TONE_INFO; 71 | 72 | #endif /* __OCT6100_TLV_INST_H__ */ 73 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_tone_detection_inst.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_tone_detection_inst.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_tone_detection_buf.c. All elements defined in this file are for 11 | public usage of the API. All private elements are defined in the 12 | oct6100_tone_detection_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 8 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_TONE_DETECTION_INST_H__ 35 | #define __OCT6100_TONE_DETECTION_INST_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | 46 | #endif /* __OCT6100_TONE_DETECTION_INST_H__ */ 47 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_tone_detection_pub.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_tone_detection_pub.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_tone_detection.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_tone_detection_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 10 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_TONE_DETECTION_PUB_H__ 35 | #define __OCT6100_TONE_DETECTION_PUB_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_TONE_DETECTION_ENABLE_ 46 | { 47 | UINT32 ulChannelHndl; 48 | UINT32 ulToneNumber; 49 | 50 | } tOCT6100_TONE_DETECTION_ENABLE, *tPOCT6100_TONE_DETECTION_ENABLE; 51 | 52 | typedef struct _OCT6100_TONE_DETECTION_DISABLE_ 53 | { 54 | UINT32 ulChannelHndl; 55 | UINT32 ulToneNumber; 56 | BOOL fDisableAll; 57 | 58 | } tOCT6100_TONE_DETECTION_DISABLE, *tPOCT6100_TONE_DETECTION_DISABLE; 59 | 60 | /************************** FUNCTION PROTOTYPES *****************************/ 61 | 62 | UINT32 Oct6100ToneDetectionEnableDef( 63 | OUT tPOCT6100_TONE_DETECTION_ENABLE f_pBufferLoad ); 64 | UINT32 Oct6100ToneDetectionEnable( 65 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 66 | IN OUT tPOCT6100_TONE_DETECTION_ENABLE f_pBufferLoad ); 67 | 68 | UINT32 Oct6100ToneDetectionDisableDef( 69 | OUT tPOCT6100_TONE_DETECTION_DISABLE f_pBufferUnload ); 70 | UINT32 Oct6100ToneDetectionDisable( 71 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 72 | IN OUT tPOCT6100_TONE_DETECTION_DISABLE f_pBufferUnload ); 73 | 74 | #endif /* __OCT6100_TONE_DETECTION_PUB_H__ */ 75 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_tsi_cnct_inst.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_tsi_cnct_inst.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_tsi_cnct.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_tsi_cnct_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 9 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_TSI_CNCT_INST_H__ 35 | #define __OCT6100_TSI_CNCT_INST_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | /***************************** DEFINES *************************************/ 40 | 41 | /***************************** TYPES ***************************************/ 42 | 43 | typedef struct _OCT6100_API_TSI_CNCT_ 44 | { 45 | /* Flag specifying whether the entry is used or not. */ 46 | UINT8 fReserved; 47 | 48 | /* Count used to manage entry handles allocated to user. */ 49 | UINT8 byEntryOpenCnt; 50 | 51 | /* Input PCM law. */ 52 | UINT8 byInputPcmLaw; 53 | 54 | /* TSI chariot memory entry. */ 55 | UINT16 usTsiMemIndex; 56 | 57 | /* Input and output timeslot information. */ 58 | UINT16 usInputTimeslot; 59 | UINT16 usInputStream; 60 | 61 | UINT16 usOutputTimeslot; 62 | UINT16 usOutputStream; 63 | 64 | /* Internal info for quick access to structures associated to this TSI cnct. */ 65 | UINT16 usInputTsstIndex; 66 | UINT16 usOutputTsstIndex; 67 | 68 | } tOCT6100_API_TSI_CNCT, *tPOCT6100_API_TSI_CNCT; 69 | 70 | #endif /* __OCT6100_TSI_CNCT_INST_H__ */ 71 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_tsi_cnct_pub.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_tsi_cnct_pub.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_tsi_cnct.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_tsi_cnct_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 11 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_TSI_CNCT_PUB_H__ 35 | #define __OCT6100_TSI_CNCT_PUB_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_TSI_CNCT_OPEN_ 46 | { 47 | PUINT32 pulTsiCnctHndl; 48 | 49 | UINT32 ulInputTimeslot; 50 | UINT32 ulInputStream; 51 | UINT32 ulOutputTimeslot; 52 | UINT32 ulOutputStream; 53 | 54 | } tOCT6100_TSI_CNCT_OPEN, *tPOCT6100_TSI_CNCT_OPEN; 55 | 56 | typedef struct _OCT6100_TSI_CNCT_CLOSE_ 57 | { 58 | UINT32 ulTsiCnctHndl; 59 | 60 | } tOCT6100_TSI_CNCT_CLOSE, *tPOCT6100_TSI_CNCT_CLOSE; 61 | 62 | /************************** FUNCTION PROTOTYPES *****************************/ 63 | 64 | UINT32 Oct6100TsiCnctOpenDef( 65 | OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ); 66 | UINT32 Oct6100TsiCnctOpen( 67 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 68 | IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ); 69 | 70 | UINT32 Oct6100TsiCnctCloseDef( 71 | OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ); 72 | UINT32 Oct6100TsiCnctClose( 73 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 74 | IN OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ); 75 | 76 | #endif /* __OCT6100_TSI_CNCT_PUB_H__ */ 77 | -------------------------------------------------------------------------------- /xpp/oct612x/include/oct6100api/oct6100_tsst_inst.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_tsst_inst.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all defines, macros, and structures pertaining to the file 10 | oct6100_tsst.c. All elements defined in this file are for public 11 | usage of the API. All private elements are defined in the 12 | oct6100_tsst_priv.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 5 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_TSST_INST_H__ 35 | #define __OCT6100_TSST_INST_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | typedef struct _OCT6100_API_TSST_ENTRY_ 46 | { 47 | UINT16 usTsstMemoryIndex; /* Index in the TSST memory of the TSST */ 48 | UINT16 usTsstValue; /* Tsst value given by the user. */ 49 | /* bit 5:0 = stream value, bit 13:6 = timeslot value. */ 50 | 51 | UINT16 usNextEntry; /* Pointer to the next entry in the list. */ 52 | 53 | } tOCT6100_API_TSST_ENTRY, *tPOCT6100_API_TSST_ENTRY; 54 | 55 | #endif /* __OCT6100_TSST_INST_H__ */ 56 | -------------------------------------------------------------------------------- /xpp/oct612x/include/octtypewin.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: octtypewin.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | This file defines the base storage types for the Windows environment. 10 | Includes the Windows definition file and add the missing ones here. 11 | 12 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 13 | free software; you can redistribute it and/or modify it under the terms of 14 | the GNU General Public License as published by the Free Software Foundation; 15 | either version 2 of the License, or (at your option) any later version. 16 | 17 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 18 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 19 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20 | for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with the OCT6100 GPL API; if not, write to the Free Software 24 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25 | 26 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 27 | 28 | $Octasic_Revision: 16 $ 29 | 30 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 31 | 32 | #ifndef __OCTTYPEWIN_H__ 33 | #define __OCTTYPEWIN_H__ 34 | 35 | /*-------------------------------------------------------------------------- 36 | C language 37 | ----------------------------------------------------------------------------*/ 38 | #define WIN32_LEAN_AND_MEAN /* just get the base type definition from Windows */ 39 | #include 40 | 41 | /* Disable argument not used warning */ 42 | #pragma warning( disable : 4100 ) 43 | /* Disable Level 4 warning: nonstandard extension used : translation unit is empty */ 44 | #pragma warning( disable : 4206 ) 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | /* 16-bit integer */ 51 | typedef unsigned short UINT16; 52 | typedef signed short INT16; 53 | typedef unsigned short *PUINT16; 54 | typedef signed short *PINT16; 55 | 56 | /* 8-bit integer */ 57 | typedef unsigned char UINT8; 58 | typedef signed char INT8; 59 | typedef signed char OCT_INT8; 60 | typedef unsigned char *PUINT8; 61 | typedef signed char *PINT8; 62 | 63 | typedef double DOUBLE; 64 | 65 | 66 | /* 32 bit integer */ 67 | #if ( defined( _MSC_VER ) && _MSC_VER == 1100 ) 68 | /* MFC5 compiler does not define UINT32 */ 69 | typedef unsigned int UINT32; 70 | typedef signed int INT32; 71 | typedef INT32 * PINT32; 72 | typedef UINT32 * PUINT32; 73 | #endif /* _MSC_VER */ 74 | 75 | /* LONG LONG */ 76 | #define LLONG signed __int64 77 | #define PLLONG signed __int64 * 78 | #define ULLONG unsigned __int64 79 | #define PULLONG unsigned __int64 * 80 | 81 | /* Double integers */ 82 | typedef double DOUBLE; 83 | typedef double * PDOUBLE; 84 | typedef float FLOAT; 85 | typedef float * PFLOAT; 86 | 87 | #ifndef OPT 88 | #define OPT /* OPT param */ 89 | #endif 90 | 91 | typedef PSZ * PPSZ; 92 | 93 | /*-------------------------------------------------------------------------- 94 | C language 95 | ----------------------------------------------------------------------------*/ 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | 100 | #endif /* __OCTTYPEWIN_H__ */ 101 | -------------------------------------------------------------------------------- /xpp/oct612x/octasic-helper: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Jeffrey C. Ollie 5 | # 6 | # $1 == information requested 7 | # $2 == path to octasic directory 8 | # 9 | 10 | APIDIR=$2/octdeviceapi/oct6100api/oct6100_api 11 | 12 | case $1 in 13 | objects) 14 | echo $APIDIR/oct6100_adpcm_chan.o \ 15 | $APIDIR/oct6100_channel.o \ 16 | $APIDIR/oct6100_chip_open.o \ 17 | $APIDIR/oct6100_chip_stats.o \ 18 | $APIDIR/oct6100_conf_bridge.o \ 19 | $APIDIR/oct6100_debug.o \ 20 | $APIDIR/oct6100_events.o \ 21 | $APIDIR/oct6100_interrupts.o \ 22 | $APIDIR/oct6100_memory.o \ 23 | $APIDIR/oct6100_miscellaneous.o \ 24 | $APIDIR/oct6100_mixer.o \ 25 | $APIDIR/oct6100_phasing_tsst.o \ 26 | $APIDIR/oct6100_playout_buf.o \ 27 | $APIDIR/oct6100_remote_debug.o \ 28 | $APIDIR/oct6100_tlv.o \ 29 | $APIDIR/oct6100_tone_detection.o \ 30 | $APIDIR/oct6100_tsi_cnct.o \ 31 | $APIDIR/oct6100_tsst.o \ 32 | $2/apilib/bt/octapi_bt0.o \ 33 | $2/apilib/largmath/octapi_largmath.o \ 34 | $2/apilib/llman/octapi_llman.o 35 | ;; 36 | cflags) 37 | echo -I$2/include -I$2/octdeviceapi -I$2/octdeviceapi/oct6100api 38 | ;; 39 | esac 40 | -------------------------------------------------------------------------------- /xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asterisk/dahdi-tools/40cfb7b0ed17890dc5b91edb514052dd3258a9d1/xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c -------------------------------------------------------------------------------- /xpp/oct612x/octdeviceapi/oct6100api/oct6100_chip_stats_priv.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_chip_stats_priv.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all private defines, macros, structures and prototypes 10 | pertaining to the file oct6100_chip_stats.c. All elements defined in this 11 | file are for private usage of the API. All public elements are defined 12 | in the oct6100_chip_stats_pub.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 8 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_CHIP_STATS_PRIV_H__ 35 | #define __OCT6100_CHIP_STATS_PRIV_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | 46 | /************************** FUNCTION PROTOTYPES *****************************/ 47 | 48 | UINT32 Oct6100ApiChipStatsSwInit( 49 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); 50 | 51 | UINT32 Oct6100ChipGetStatsSer( 52 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 53 | OUT tPOCT6100_CHIP_STATS f_pChipStats ); 54 | 55 | #endif /* __OCT6100_CHIP_STATS_PRIV_H__ */ 56 | -------------------------------------------------------------------------------- /xpp/oct612x/octdeviceapi/oct6100api/oct6100_debug_priv.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_debug_priv.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all private defines, macros, structures and prototypes 10 | pertaining to the file oct6100_debug.c. All elements defined in this 11 | file are for private usage of the API. All public elements are defined 12 | in the oct6100_debug_pub.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 12 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_DEBUG_PRIV_H__ 35 | #define __OCT6100_DEBUG_PRIV_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | 43 | /***************************** TYPES ***************************************/ 44 | 45 | 46 | /************************** FUNCTION PROTOTYPES *****************************/ 47 | 48 | 49 | UINT32 Oct6100DebugSelectChannelSer( 50 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 51 | IN tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan, 52 | IN BOOL f_fCheckChannelRecording ); 53 | 54 | UINT32 Oct6100DebugGetDataSer( 55 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 56 | IN OUT tPOCT6100_DEBUG_GET_DATA f_pGetData ); 57 | 58 | #endif /* __OCT6100_DEBUG_PRIV_H__ */ 59 | -------------------------------------------------------------------------------- /xpp/oct612x/octdeviceapi/oct6100api/oct6100_events_priv.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_events_priv.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | File containing all private defines, macros, structures and prototypes 10 | pertaining to the file oct6100_events.c. All elements defined in this 11 | file are for private usage of the API. All public elements are defined 12 | in the oct6100_events_pub.h file. 13 | 14 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 15 | free software; you can redistribute it and/or modify it under the terms of 16 | the GNU General Public License as published by the Free Software Foundation; 17 | either version 2 of the License, or (at your option) any later version. 18 | 19 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 20 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 21 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22 | for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with the OCT6100 GPL API; if not, write to the Free Software 26 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27 | 28 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 29 | 30 | $Octasic_Revision: 14 $ 31 | 32 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 33 | 34 | #ifndef __OCT6100_EVENTS_PRIV_H__ 35 | #define __OCT6100_EVENTS_PRIV_H__ 36 | 37 | /***************************** INCLUDE FILES *******************************/ 38 | 39 | 40 | /***************************** DEFINES *************************************/ 41 | 42 | #define mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftBuf ) \ 43 | pSoftBuf = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->SoftBufs.ulToneEventBufferMemOfst ); 44 | 45 | #define mOCT6100_GET_BUFFER_PLAYOUT_EVENT_BUF_PNT( pSharedInfo, pSoftBuf ) \ 46 | pSoftBuf = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->SoftBufs.ulBufPlayoutEventBufferMemOfst ); 47 | 48 | /***************************** TYPES ***************************************/ 49 | 50 | 51 | /************************** FUNCTION PROTOTYPES *****************************/ 52 | 53 | UINT32 Oct6100ApiGetEventsSwSizes( 54 | IN tPOCT6100_CHIP_OPEN f_pOpenChip, 55 | OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); 56 | 57 | UINT32 Oct6100EventGetToneSer( 58 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 59 | IN OUT tPOCT6100_EVENT_GET_TONE f_pEventGetTone ); 60 | 61 | UINT32 Oct6100ApiTransferToneEvents( 62 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 63 | IN UINT32 f_ulResetBuf ); 64 | 65 | 66 | 67 | UINT32 Oct6100BufferPlayoutGetEventSer( 68 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 69 | IN OUT tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ); 70 | 71 | UINT32 Oct6100BufferPlayoutTransferEvents( 72 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 73 | IN UINT32 f_ulResetBuf ); 74 | 75 | UINT32 Oct6100BufferPlayoutCheckForSpecificEvent( 76 | IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, 77 | IN UINT32 f_ulChannelIndex, 78 | IN UINT32 f_ulChannelPort, 79 | IN BOOL f_fSaveToSoftBuffer, 80 | OUT PBOOL f_pfEventDetected ); 81 | 82 | #endif /* __OCT6100_EVENTS_PRIV_H__ */ 83 | -------------------------------------------------------------------------------- /xpp/oct612x/octdeviceapi/oct6100api/oct6100_version.h: -------------------------------------------------------------------------------- 1 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ 2 | 3 | File: oct6100_version.h 4 | 5 | Copyright (c) 2001-2007 Octasic Inc. 6 | 7 | Description: 8 | 9 | This file contains the version of API. To obtain that version 10 | number, the user must call the API function Oct6100ApiGetVersion(). 11 | 12 | This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is 13 | free software; you can redistribute it and/or modify it under the terms of 14 | the GNU General Public License as published by the Free Software Foundation; 15 | either version 2 of the License, or (at your option) any later version. 16 | 17 | The OCT6100 GPL API is distributed in the hope that it will be useful, but 18 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 19 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20 | for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with the OCT6100 GPL API; if not, write to the Free Software 24 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25 | 26 | $Octasic_Release: OCT612xAPI-01.00-PR49 $ 27 | 28 | $Octasic_Revision: 52 $ 29 | 30 | \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 31 | 32 | #ifndef __OCT6100_VERSION_H__ 33 | #define __OCT6100_VERSION_H__ 34 | 35 | /* String version of the OCT6100 API.*/ 36 | 37 | #define cOCT6100_API_VERSION "OCT6100API-01.00-PR49" 38 | 39 | #endif /* __OCT6100_VERSION_H__ */ 40 | -------------------------------------------------------------------------------- /xpp/oct612x/test.c: -------------------------------------------------------------------------------- 1 | /* 2 | NOTE: This is not intended to be a functional program. Its only purpose 3 | is to act as a tool to find out what portions of the Octasic API kit we 4 | actually need to link into our drivers. As such, it references every API 5 | call that the actual drivers use, and we let the compiler and linker tell 6 | us what parts of each API module are actually needed to successfully 7 | build this program. 8 | */ 9 | #include "oct6100api/oct6100_api.h" 10 | 11 | int main(int argc, char **argv) 12 | { 13 | tPOCT6100_INSTANCE_API pApiInstance; 14 | UINT32 ulResult; 15 | tOCT6100_CHANNEL_MODIFY modify; 16 | tOCT6100_INTERRUPT_FLAGS InterruptFlags; 17 | tOCT6100_TONE_EVENT tonefound; 18 | tOCT6100_EVENT_GET_TONE tonesearch; 19 | tOCT6100_CHIP_OPEN ChipOpen; 20 | tOCT6100_GET_INSTANCE_SIZE InstanceSize; 21 | tOCT6100_CHANNEL_OPEN ChannelOpen; 22 | tOCT6100_TONE_DETECTION_ENABLE enable; 23 | tOCT6100_CHIP_CLOSE ChipClose; 24 | tOCT6100_API_GET_CAPACITY_PINS CapacityPins; 25 | 26 | Oct6100ChannelModifyDef(&modify); 27 | ulResult = Oct6100ChannelModify(pApiInstance, &modify); 28 | Oct6100InterruptServiceRoutineDef(&InterruptFlags); 29 | Oct6100InterruptServiceRoutine(pApiInstance, &InterruptFlags); 30 | Oct6100EventGetToneDef(&tonesearch); 31 | ulResult = Oct6100EventGetTone(pApiInstance, &tonesearch); 32 | Oct6100ChipOpenDef(&ChipOpen); 33 | Oct6100GetInstanceSizeDef(&InstanceSize); 34 | ulResult = Oct6100GetInstanceSize(&ChipOpen, &InstanceSize); 35 | ulResult = Oct6100ChipOpen(pApiInstance, &ChipOpen); 36 | Oct6100ChannelOpenDef(&ChannelOpen); 37 | ulResult = Oct6100ChannelOpen(pApiInstance, &ChannelOpen); 38 | Oct6100ToneDetectionEnableDef(&enable); 39 | Oct6100ToneDetectionEnable(pApiInstance, &enable); 40 | Oct6100ChipCloseDef(&ChipClose); 41 | ulResult = Oct6100ChipClose(pApiInstance, &ChipClose); 42 | Oct6100ApiGetCapacityPinsDef(&CapacityPins); 43 | ulResult = Oct6100ApiGetCapacityPins(&CapacityPins); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /xpp/parse_span_specs.h: -------------------------------------------------------------------------------- 1 | #ifndef PARSE_SPAN_SPECS_H 2 | #define PARSE_SPAN_SPECS_H 3 | 4 | /* 5 | * Written by Oron Peled 6 | * Copyright (C) 2014, Xorcom 7 | * 8 | * All rights reserved. 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License as published by 12 | * the Free Software Foundation; either version 2 of the License, or 13 | * (at your option) any later version. 14 | * 15 | * This program is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU General Public License 21 | * along with this program; if not, write to the Free Software 22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 | * 24 | */ 25 | 26 | #define MAX_SPANNO 4 /* E1/T1 spans -- always in first unit. 1-based */ 27 | 28 | enum tdm_codec { 29 | TDM_CODEC_UNKNOWN, 30 | TDM_CODEC_ULAW, 31 | TDM_CODEC_ALAW, 32 | }; 33 | 34 | struct span_specs { 35 | char *buf; 36 | enum tdm_codec span_is_alaw[MAX_SPANNO]; 37 | }; 38 | 39 | struct span_specs *parse_span_specifications(const char *spec_string, int default_is_alaw); 40 | void free_span_specifications(struct span_specs *span_specs); 41 | void print_span_specifications(struct span_specs *span_specs, FILE *output); 42 | 43 | #endif /* PARSE_SPAN_SPECS_H */ 44 | -------------------------------------------------------------------------------- /xpp/perl_modules/Dahdi.pm: -------------------------------------------------------------------------------- 1 | package Dahdi; 2 | # 3 | # Written by Oron Peled 4 | # Copyright (C) 2007, Xorcom 5 | # This program is free software; you can redistribute and/or 6 | # modify it under the same terms as Perl itself. 7 | # 8 | # $Id$ 9 | # 10 | use strict; 11 | use Dahdi::Span; 12 | 13 | =head1 NAME 14 | 15 | Dahdi - Perl interface to Dahdi information 16 | 17 | This package allows access from Perl to information about Dahdi 18 | hardware and loaded Dahdi devices. 19 | 20 | =head1 SYNOPSIS 21 | 22 | # Listing channels in analog spans: 23 | use Dahdi; 24 | # scans system: 25 | my @spans = Dahdi::spans(); 26 | for my $span (@spans) { 27 | next if ($span->is_digital); 28 | $span->num. " - [". $span->type ."] ". $span->name. "\n"; 29 | for my $chan ($span->chans) { 30 | print " - ".$chan->num . " - [". $chan->type. "] ". $chan->fqn". \n"; 31 | } 32 | } 33 | =cut 34 | 35 | our $virt_base; 36 | our $proc_dahdi_base; 37 | our $proc_usb_base; 38 | our $sys_base; 39 | 40 | =head1 spans() 41 | 42 | Returns a list of span objects, ordered by span number. 43 | 44 | =cut 45 | 46 | sub spans() { 47 | my @spans; 48 | 49 | -d $proc_dahdi_base or return (); 50 | foreach my $zfile (glob "$proc_dahdi_base/*") { 51 | next unless ($zfile =~ m{^$proc_dahdi_base/\d+$}); 52 | my $span = Dahdi::Span->new($zfile); 53 | push(@spans, $span); 54 | } 55 | @spans = sort { $a->num <=> $b->num } @spans; 56 | return @spans; 57 | } 58 | 59 | =head1 ENVIRONMENT 60 | 61 | If C is set in the environment, it will be considered 62 | as a path to a directory that holds a dump (copy) of all the required 63 | files from /proc and /sys . You can generate that directory using the 64 | script C . 65 | 66 | =head1 SEE ALSO 67 | 68 | Span objects: L. 69 | 70 | Dahdi channels objects: L. 71 | 72 | Dahdi hardware devices information: L. 73 | 74 | Xorcom Astribank -specific information: L. 75 | 76 | =cut 77 | 78 | 1; 79 | -------------------------------------------------------------------------------- /xpp/perl_modules/Dahdi/Config/Gen/Assignedspans.pm: -------------------------------------------------------------------------------- 1 | package Dahdi::Config::Gen::Assignedspans; 2 | use strict; 3 | 4 | use Dahdi::Config::Gen qw(is_true); 5 | 6 | sub new($$$) { 7 | my $pack = shift || die; 8 | my $gconfig = shift || die; 9 | my $genopts = shift || die; 10 | my $file = $ENV{ASSIGNED_SPANS_CONF_FILE} || "/etc/dahdi/assigned-spans.conf"; 11 | my $self = { 12 | FILE => $file, 13 | GCONFIG => $gconfig, 14 | GENOPTS => $genopts, 15 | }; 16 | bless $self, $pack; 17 | return $self; 18 | } 19 | 20 | sub generate($$$) { 21 | my $self = shift || die; 22 | my $file = $self->{FILE}; 23 | my $gconfig = $self->{GCONFIG}; 24 | my $genopts = $self->{GENOPTS}; 25 | my @spans = @_; 26 | 27 | # If the span_types utilities were not installed we do not want to run 28 | # this generator or report any errors. 29 | system "which dahdi_span_assignments > /dev/null 2>&1"; 30 | return if $?; 31 | 32 | warn "Empty configuration -- no spans\n" unless @spans; 33 | rename "$file", "$file.bak" 34 | or $! == 2 # ENOENT (No dependency on Errno.pm) 35 | or die "Failed to backup old config: $!\n"; 36 | #$gconfig->dump; 37 | print "Generating $file\n" if $genopts->{verbose}; 38 | my $cmd = "dahdi_span_assignments dumpconfig > $file"; 39 | system $cmd; 40 | die "Command failed (status=$?): '$cmd'" if $?; 41 | } 42 | 43 | 1; 44 | 45 | __END__ 46 | 47 | =head1 NAME 48 | 49 | dahdi - Generate configuration for dahdi drivers. 50 | 51 | =head1 SYNOPSIS 52 | 53 | use Dahdi::Config::Gen::Dahdi; 54 | 55 | my $cfg = new Dahdi::Config::Gen::Dahdi(\%global_config, \%genopts); 56 | $cfg->generate(@span_list); 57 | 58 | =head1 DESCRIPTION 59 | 60 | Generate the F. 61 | This is the configuration for dahdi_span_assignments. 62 | 63 | Its location may be overriden via the environment variable F. 64 | -------------------------------------------------------------------------------- /xpp/perl_modules/Dahdi/Config/Gen/Freepbxdb.pm: -------------------------------------------------------------------------------- 1 | package Dahdi::Config::Gen::Freepbxdb; 2 | 3 | # Written by Tzafrir Cohen 4 | # Copyright (C) 2011, Xorcom 5 | # This program is free software; you can redistribute and/or 6 | # modify it under the same terms as Perl itself. 7 | 8 | use strict; 9 | use Socket; 10 | use Dahdi::Config::Gen qw(is_true); 11 | 12 | sub new($$$) { 13 | my $pack = shift || die; 14 | my $gconfig = shift || die; 15 | my $genopts = shift || die; 16 | my $self = { 17 | GCONFIG => $gconfig, 18 | GENOPTS => $genopts, 19 | }; 20 | bless $self, $pack; 21 | return $self; 22 | } 23 | 24 | sub gen_channel($$) { 25 | my $self = shift || die; 26 | my $chan = shift || die; 27 | my $gconfig = $self->{GCONFIG}; 28 | my $type = $chan->type; 29 | my $num = $chan->num; 30 | die "channel $num type $type is not an analog channel\n" if $chan->span->is_digital(); 31 | my $exten = $gconfig->{'base_exten'} + $num; 32 | my $callerid = sprintf "\"Channel %d\" <%04d>", $num, $exten; 33 | my @cmds = (); 34 | #push @cmds, "database put DEVICE/$exten default_user $exten"; 35 | #push @cmds, "database put DEVICE/$exten dial ZAP/$num"; 36 | push @cmds, "database put DEVICE/$exten dial DAHDI/$num"; 37 | #push @cmds, "database put DEVICE/$exten type fixed"; 38 | push @cmds, "database put DEVICE/$exten user $exten"; 39 | push @cmds, "database put AMPUSER/$exten device $exten"; 40 | push @cmds, "database put AMPUSER/$exten cidname $callerid"; 41 | return @cmds; 42 | } 43 | 44 | sub generate($) { 45 | my $self = shift || die; 46 | my $gconfig = $self->{GCONFIG}; 47 | my $genopts = $self->{GENOPTS}; 48 | #$gconfig->dump; 49 | my $ast_sock = '/var/run/asterisk/asterisk.ctl'; 50 | my @spans = @_; 51 | my @cmds = (); 52 | warn "Empty configuration -- no spans\n" unless @spans; 53 | print "Configuring FXSs for FreePBX\n" if $genopts->{verbose}; 54 | foreach my $span (@spans) { 55 | next if $span->is_digital; 56 | foreach my $chan ($span->chans()) { 57 | next unless ($chan->type eq 'FXS'); 58 | push @cmds, $self->gen_channel($chan); 59 | } 60 | } 61 | #open(CMDS,"|$command >/dev/null") or 62 | socket(SOCK, PF_UNIX, SOCK_STREAM, 0) || die "socket: $!"; 63 | connect(SOCK, sockaddr_un($ast_sock)) || 64 | die "$0: Freepbxdb: Failed connecting to $ast_sock\n: $!"; 65 | foreach (@cmds) { 66 | # Note: commands are NULL-terminated: 67 | print SOCK "$_\0"; 68 | sleep 0.001; 69 | } 70 | close(SOCK) or 71 | die "$0: Freepbxdb: Failed sending commands ($ast_sock): $!\n"; 72 | } 73 | 74 | 1; 75 | 76 | __END__ 77 | 78 | =head1 NAME 79 | 80 | freepbxdb - Generate astdb configuration required by FreePBX 81 | 82 | =head1 SYNOPSIS 83 | 84 | use Dahdi::Config::Gen::Freepbxdb; 85 | 86 | my $cfg = new Dahdi::Config::Gen::Freepbxdb(\%global_config, \%genopts); 87 | $cfg->generate(@span_list); 88 | 89 | =head1 DESCRIPTION 90 | 91 | Updates the Asterisk DB entries for FXS channels detected. Requires 92 | Asterisk running. 93 | 94 | The configuration generated here bypasses FreePBX's standard configuration 95 | and allows using a simple dialplan snippet such as: 96 | 97 | [from-internal-custom](+) 98 | exten => _4XXX,1,Dial(DAHDI/${EXTEN:1}) 99 | 100 | This may come in handy in testing. At least until FreePBX will provide a 101 | simple automated interface to do the same. 102 | 103 | =head1 OPTIONS 104 | 105 | None, so far. 106 | 107 | =head1 FILES 108 | 109 | =over 110 | 111 | =item C 112 | 113 | The socket to which commands are sent. FIXME: make this a parameter. 114 | 115 | =back 116 | 117 | -------------------------------------------------------------------------------- /xpp/perl_modules/Dahdi/Config/Gen/Modules.pm: -------------------------------------------------------------------------------- 1 | package Dahdi::Config::Gen::Modules; 2 | use strict; 3 | 4 | use Dahdi::Config::Gen qw(is_true); 5 | 6 | sub new($$$) { 7 | my $pack = shift || die; 8 | my $gconfig = shift || die; 9 | my $genopts = shift || die; 10 | my $file = $ENV{DAHDI_MODULES_FILE} || "/etc/dahdi/modules"; 11 | my $self = { 12 | FILE => $file, 13 | GCONFIG => $gconfig, 14 | GENOPTS => $genopts, 15 | }; 16 | bless $self, $pack; 17 | return $self; 18 | } 19 | 20 | sub generate($$$) { 21 | my $self = shift || die; 22 | my $file = $self->{FILE}; 23 | my $gconfig = $self->{GCONFIG}; 24 | my $genopts = $self->{GENOPTS}; 25 | rename "$file", "$file.bak" 26 | or $! == 2 # ENOENT (No dependency on Errno.pm) 27 | or die "Failed to backup old config: $!\n"; 28 | #$gconfig->dump; 29 | print "Generating $file\n" if $genopts->{verbose}; 30 | open(F, ">$file") || die "$0: Failed to open $file: $!\n"; 31 | my $old = select F; 32 | printf "# Autogenerated by $0 (%s) on %s\n", __PACKAGE__, scalar(localtime); 33 | print "# If you edit this file and execute $0 again,\n"; 34 | print "# your manual changes will be LOST.\n"; 35 | my @drivers = Dahdi::Hardware->drivers; 36 | print join("\n", @drivers),"\n"; 37 | close F; 38 | select $old; 39 | } 40 | 41 | 1; 42 | 43 | __END__ 44 | 45 | =head1 NAME 46 | 47 | modules - Generate list of dahdi drivers to load at startup 48 | 49 | =head1 SYNOPSIS 50 | 51 | use Dahdi::Config::Gen::Dahdi; 52 | 53 | my $cfg = new Dahdi::Config::Gen::Modules(\%global_config, \%genopts); 54 | $cfg->generate(@span_list); 55 | 56 | =head1 DESCRIPTION 57 | 58 | Generate the F. This is a list of modules, one per 59 | line. This list is normally used by F. 60 | 61 | Its location may be overriden via the environment variable 62 | F. 63 | -------------------------------------------------------------------------------- /xpp/perl_modules/Dahdi/Config/Gen/Spantypes.pm: -------------------------------------------------------------------------------- 1 | package Dahdi::Config::Gen::Spantypes; 2 | use strict; 3 | 4 | use Dahdi::Config::Gen qw(is_true); 5 | 6 | sub new($$$) { 7 | my $pack = shift || die; 8 | my $gconfig = shift || die; 9 | my $genopts = shift || die; 10 | my $file = $ENV{SPAN_TYPES_CONF_FILE} || "/etc/dahdi/span-types.conf"; 11 | my $self = { 12 | FILE => $file, 13 | GCONFIG => $gconfig, 14 | GENOPTS => $genopts, 15 | }; 16 | bless $self, $pack; 17 | return $self; 18 | } 19 | 20 | sub generate($$$) { 21 | my $self = shift || die; 22 | my $file = $self->{FILE}; 23 | my $gconfig = $self->{GCONFIG}; 24 | my $genopts = $self->{GENOPTS}; 25 | my @spans = @_; 26 | 27 | # If the dahdi_span_types utilities were not installed we do not want to run 28 | # this generator or report any errors. 29 | system "which dahdi_span_types > /dev/null 2>&1"; 30 | return if $?; 31 | 32 | my $line_mode = $genopts->{'line-mode'}; 33 | my $cmd; 34 | if (defined $line_mode) { 35 | $line_mode =~ /^[ETJ]1$/ or die "Bad line-mode='$line_mode'\n"; 36 | $cmd = "dahdi_span_types --line-mode=$line_mode dumpconfig > $file"; 37 | printf("Generating $file (with default line-mode %s)\n", $line_mode) 38 | if $genopts->{verbose}; 39 | } else { 40 | $cmd = "dahdi_span_types dumpconfig > $file"; 41 | printf("Generating $file (no --line-mode override)\n") 42 | if $genopts->{verbose}; 43 | } 44 | rename "$file", "$file.bak" 45 | or $! == 2 # ENOENT (No dependency on Errno.pm) 46 | or die "Failed to backup old config: $!\n"; 47 | #$gconfig->dump; 48 | system $cmd; 49 | die "Command failed (status=$?): '$cmd'" if $?; 50 | } 51 | 52 | 1; 53 | 54 | __END__ 55 | 56 | =head1 NAME 57 | 58 | dahdi - Generate configuration for dahdi drivers. 59 | 60 | =head1 SYNOPSIS 61 | 62 | use Dahdi::Config::Gen::Dahdi; 63 | 64 | my $cfg = new Dahdi::Config::Gen::Dahdi(\%global_config, \%genopts); 65 | $cfg->generate(@span_list); 66 | 67 | =head1 DESCRIPTION 68 | 69 | Generate the F. 70 | This is the configuration for dahdi_span_types. 71 | 72 | Its location may be overriden via the environment variable F. 73 | 74 | You would normally run: 75 | 76 | dahdi_genconf --line-mode= 77 | 78 | which is a short for: 79 | 80 | dahdi_genconf spantypes=line-mode= 81 | 82 | This is done by running: 83 | dahdi_span_types dumpconfig --line-mode=line_mode> 84 | 85 | where I is the module parameter, and defaults to B if not 86 | given (running C). 87 | -------------------------------------------------------------------------------- /xpp/perl_modules/Dahdi/Config/Gen/Unicall.pm: -------------------------------------------------------------------------------- 1 | package Dahdi::Config::Gen::Unicall; 2 | use strict; 3 | 4 | use Dahdi::Config::Gen qw(is_true); 5 | 6 | sub new($$$) { 7 | my $pack = shift || die; 8 | my $gconfig = shift || die; 9 | my $genopts = shift || die; 10 | my $file = $ENV{UNICALL_CHANNELS_FILE} || "/etc/asterisk/unicall-channels.conf"; 11 | my $self = { 12 | FILE => $file, 13 | GCONFIG => $gconfig, 14 | GENOPTS => $genopts, 15 | }; 16 | bless $self, $pack; 17 | return $self; 18 | } 19 | 20 | sub generate($) { 21 | my $self = shift || die; 22 | my $file = $self->{FILE}; 23 | my $gconfig = $self->{GCONFIG}; 24 | my $genopts = $self->{GENOPTS}; 25 | #$gconfig->dump; 26 | my @spans = @_; 27 | warn "Empty configuration -- no spans\n" unless @spans; 28 | die "Only for R2" unless $gconfig->{'pri_connection_type'} eq 'R2'; 29 | rename "$file", "$file.bak" 30 | or $! == 2 # ENOENT (No dependency on Errno.pm) 31 | or die "Failed to backup old config: $!\n"; 32 | print "Generating $file\n" if $genopts->{verbose}; 33 | open(F, ">$file") || die "$0: Failed to open $file: $!\n"; 34 | my $old = select F; 35 | printf "; Autogenerated by $0 on %s\n", scalar(localtime); 36 | print "; If you edit this file and execute $0 again,\n"; 37 | print "; your manual changes will be LOST.\n"; 38 | print "; This file should be #included in unicall.conf\n\n"; 39 | foreach my $span (@spans) { 40 | next unless $span->is_digital(); 41 | printf "; Span %d: %s %s\n", $span->num, $span->name, $span->description; 42 | my $idle_bits = $gconfig->{'r2_idle_bits'}; 43 | printf "protocolend=%s\n", ($span->termtype() eq 'TE') ? 'cpe' : 'co'; 44 | printf "channel=%s\n", Dahdi::Config::Gen::bchan_range($span); 45 | print "\n"; 46 | } 47 | close F; 48 | select $old; 49 | } 50 | 51 | 1; 52 | 53 | __END__ 54 | 55 | =head1 NAME 56 | 57 | unicall - Generate configuration for unicall channels. 58 | 59 | =head1 SYNOPSIS 60 | 61 | use Dahdi::Config::Gen::Unicall; 62 | 63 | my $cfg = new Dahdi::Config::Gen::Unicall(\%global_config, \%genopts); 64 | $cfg->generate(@span_list); 65 | 66 | =head1 DESCRIPTION 67 | 68 | Generate the F to be included in 69 | F 70 | 71 | Its location may be overriden via the environment variable 72 | C. 73 | -------------------------------------------------------------------------------- /xpp/perl_modules/Dahdi/Utils.pm: -------------------------------------------------------------------------------- 1 | package Dahdi::Utils; 2 | 3 | # Accessors (miniperl does not have Class:Accessor) 4 | our $AUTOLOAD; 5 | sub AUTOLOAD { 6 | my $self = shift; 7 | my $name = $AUTOLOAD; 8 | $name =~ s/.*://; # strip fully-qualified portion 9 | return if $name =~ /^[A-Z_]+$/; # ignore special methods (DESTROY) 10 | my $key = uc($name); 11 | my $val = shift; 12 | if (defined $val) { 13 | #print STDERR "set: $key = $val\n"; 14 | return $self->{$key} = $val; 15 | } else { 16 | if(!exists $self->{$key}) { 17 | #$self->xpp_dump; 18 | #die "Trying to get uninitialized '$key'"; 19 | } 20 | my $val = $self->{$key}; 21 | #print STDERR "get: $key ($val)\n"; 22 | return $val; 23 | } 24 | } 25 | 26 | # Initialize ProcFS and SysFS pathes, in case the user set 27 | # DAHDI_VIRT_TOP 28 | BEGIN { 29 | if (exists $ENV{DAHDI_VIRT_TOP}) { 30 | $Dahdi::virt_base = $ENV{DAHDI_VIRT_TOP}; 31 | } else { 32 | $Dahdi::virt_base = ''; 33 | } 34 | $Dahdi::proc_dahdi_base = "$Dahdi::virt_base/proc/dahdi"; 35 | $Dahdi::proc_usb_base = "$Dahdi::virt_base/proc/bus/usb"; 36 | $Dahdi::sys_base = "$Dahdi::virt_base/sys"; 37 | } 38 | 39 | sub xpp_dump($) { 40 | my $self = shift || die; 41 | printf STDERR "Dump a %s\n", ref($self); 42 | foreach my $k (sort keys %{$self}) { 43 | my $val = $self->{$k}; 44 | $val = '**UNDEF**' if !defined $val; 45 | printf STDERR " %-20s %s\n", $k, $val; 46 | } 47 | } 48 | 49 | # Based on Autoloader 50 | 51 | sub import { 52 | my $pkg = shift; 53 | my $callpkg = caller; 54 | 55 | #print STDERR "import: $pkg, $callpkg\n"; 56 | # 57 | # Export symbols, but not by accident of inheritance. 58 | # 59 | die "Sombody inherited Dahdi::Utils" if $pkg ne 'Dahdi::Utils'; 60 | no strict 'refs'; 61 | *{ $callpkg . '::AUTOLOAD' } = \&AUTOLOAD; 62 | *{ $callpkg . '::xpp_dump' } = \&xpp_dump; 63 | } 64 | 65 | 1; 66 | -------------------------------------------------------------------------------- /xpp/perl_modules/Dahdi/Xpp/Line.pm: -------------------------------------------------------------------------------- 1 | package Dahdi::Xpp::Line; 2 | # 3 | # Written by Oron Peled 4 | # Copyright (C) 2008, Xorcom 5 | # This program is free software; you can redistribute and/or 6 | # modify it under the same terms as Perl itself. 7 | # 8 | # $Id$ 9 | # 10 | use strict; 11 | use Dahdi::Utils; 12 | 13 | sub new($$$) { 14 | my $pack = shift or die "Wasn't called as a class method\n"; 15 | my $xpd = shift or die; 16 | my $index = shift; 17 | defined $index or die; 18 | my $self = {}; 19 | bless $self, $pack; 20 | $self->{XPD} = $xpd; 21 | $self->{INDEX} = $index; 22 | return $self; 23 | } 24 | 25 | sub blink($$) { 26 | my $self = shift; 27 | my $on = shift; 28 | my $xpd = $self->xpd; 29 | my $result = $xpd->xpd_getattr("blink"); 30 | $result = hex($result); 31 | if(defined($on)) { # Now change 32 | my $onbitmask = 1 << $self->index; 33 | my $offbitmask = $result & ~$onbitmask; 34 | 35 | $result = $offbitmask; 36 | $result |= $onbitmask if $on; 37 | $result = $xpd->xpd_setattr("blink", $result); 38 | } 39 | return $result; 40 | } 41 | 42 | sub create_all($$) { 43 | my $pack = shift or die "Wasn't called as a class method\n"; 44 | my $xpd = shift || die; 45 | local $/ = "\n"; 46 | my @lines; 47 | for(my $i = 0; $i < $xpd->{CHANNELS}; $i++) { 48 | my $line = Dahdi::Xpp::Line->new($xpd, $i); 49 | push(@lines, $line); 50 | } 51 | $xpd->{LINES} = \@lines; 52 | if($xpd->type eq 'FXO') { 53 | my $battery = $xpd->xpd_getattr("fxo_battery"); 54 | die "Missing '$battery' attribute\n" unless defined $battery; 55 | my @batt = split(/\s+/, $battery); 56 | foreach my $l (@lines) { 57 | die unless @batt; 58 | my $state = shift @batt; 59 | $l->{BATTERY} = ($state eq '+') ? 1 : 0; 60 | } 61 | } 62 | } 63 | 64 | 65 | 1; 66 | -------------------------------------------------------------------------------- /xpp/perl_modules/Makefile.am: -------------------------------------------------------------------------------- 1 | perllibdir = @perllibdir@ 2 | nobase_perllib_DATA = \ 3 | Dahdi.pm \ 4 | Dahdi/Hardware.pm \ 5 | Dahdi/Xpp/Line.pm \ 6 | Dahdi/Xpp/Xbus.pm \ 7 | Dahdi/Xpp/Xpd.pm \ 8 | Dahdi/Xpp/Mpp.pm \ 9 | Dahdi/Span.pm \ 10 | Dahdi/Utils.pm \ 11 | Dahdi/Chans.pm \ 12 | Dahdi/Xpp.pm \ 13 | Dahdi/Config/Params.pm \ 14 | Dahdi/Config/Gen/Xpporder.pm \ 15 | Dahdi/Config/Gen/Spantypes.pm \ 16 | Dahdi/Config/Gen/Modules.pm \ 17 | Dahdi/Config/Gen/Users.pm \ 18 | Dahdi/Config/Gen/Freepbxdb.pm \ 19 | Dahdi/Config/Gen/Unicall.pm \ 20 | Dahdi/Config/Gen/Chandahdi.pm \ 21 | Dahdi/Config/Gen/Assignedspans.pm \ 22 | Dahdi/Config/Gen/System.pm \ 23 | Dahdi/Config/Gen.pm \ 24 | Dahdi/Hardware/USB.pm \ 25 | Dahdi/Hardware/PCI.pm 26 | 27 | EXTRA_DIST = $(nobase_perllib_DATA) 28 | -------------------------------------------------------------------------------- /xpp/pic_loader.h: -------------------------------------------------------------------------------- 1 | #ifndef PIC_LOADER_H 2 | #define PIC_LOADER_H 3 | /* 4 | * Written by Oron Peled 5 | * Copyright (C) 2008, Xorcom 6 | * 7 | * All rights reserved. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #include 26 | #include "astribank.h" 27 | 28 | /* 29 | * Astribank PIC loading 30 | */ 31 | 32 | enum pic_command { 33 | PIC_DATA_FLAG = 0x00, 34 | PIC_START_FLAG = 0x01, 35 | PIC_END_FLAG = 0x02, 36 | PIC_ENDS_FLAG = 0x04, 37 | }; 38 | 39 | #define PIC_PACK_LEN 0x0B 40 | #define PIC_LINE_LEN 0x03 41 | 42 | int send_picline(struct astribank *astribank, uint8_t card_type, 43 | enum pic_command pcmd, int offs, uint8_t *data, int data_len); 44 | int load_pic(struct astribank *astribank, int numfiles, char *filelist[]); 45 | 46 | #endif /* PIC_LOADER_H */ 47 | -------------------------------------------------------------------------------- /xpp/test_parse.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Oron Peled 3 | * Copyright (C) 2006, 2007, 2008, 2009 Xorcom 4 | * 5 | * All rights reserved. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | */ 22 | 23 | #include 24 | #include 25 | #include "hexfile.h" 26 | 27 | static void default_report_func(int level, const char *msg, ...) 28 | { 29 | va_list ap; 30 | 31 | va_start(ap, msg); 32 | vfprintf(stderr, msg, ap); 33 | va_end(ap); 34 | } 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | struct hexdata *hd; 39 | int i; 40 | 41 | if(argc < 2) { 42 | fprintf(stderr, "Usage: program hexfile...\n"); 43 | return 1; 44 | } 45 | parse_hexfile_set_reporting(default_report_func); 46 | for(i = 1; i < argc; i++) { 47 | hd = parse_hexfile(argv[i], 2000); 48 | if(!hd) { 49 | fprintf(stderr, "Parsing failed\n"); 50 | return 1; 51 | } 52 | fprintf(stderr, "=== %s === (version: %s)\n", argv[i], hd->version_info); 53 | dump_hexfile2(hd, "-", 60 ); 54 | free_hexdata(hd); 55 | } 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /xpp/twinstar_hook: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # twinstar_hook: Example twinstar-specific hook script 4 | # $Id$ 5 | # 6 | # Written by Oron Peled 7 | # Copyright (C) 2009, Xorcom 8 | # 9 | # All rights reserved. 10 | # 11 | # This program is free software; you can redistribute it and/or modify 12 | # it under the terms of the GNU General Public License as published by 13 | # the Free Software Foundation; either version 2 of the License, or 14 | # (at your option) any later version. 15 | # 16 | # This program is distributed in the hope that it will be useful, 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | # GNU General Public License for more details. 20 | # 21 | # You should have received a copy of the GNU General Public License 22 | # along with this program; if not, write to the Free Software 23 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 | # 25 | 26 | # 27 | # This is an experimental script to activate an Astribank TwinStar 28 | # during failover. 29 | # 30 | # The script assume that there is an /etc/dahdi/xpp_order file 31 | # specifying the Astribanks' labels according to the required 32 | # registration order. 33 | # 34 | # This file can be easily generated by running: 35 | # dahdi_genconf xpporder 36 | # after the system is configured and working. 37 | # 38 | 39 | me=`basename $0` 40 | dir=`dirname $0` 41 | LOGGER="logger -i -t '$me'" 42 | 43 | # Always redirect stderr somewhere, otherwise the shell script will die 44 | # when it tries to do I/O related stuff on closed file descriptor. 45 | # Our default is to throw it down the bit-bucket. 46 | #exec 2> /dev/console 47 | ## If you wish to trace this script: 48 | #exec 2> "/tmp/${me}_$XBUS_NAME" 1>&2 49 | 50 | # Our directory in the beginning, so we can use local lab setup 51 | PATH="$dir:/usr/sbin:/sbin:/usr/bin:/bin" 52 | 53 | set -e 54 | 55 | export XBUS_SORT='SORT_LABEL' 56 | 57 | case "$ACTION" in 58 | online) 59 | echo "$ACTION($XBUS_NAME): " | $LOGGER 60 | twinstar enable-wd 61 | sleep 1 # Just for visual effect 62 | asterisk -rx 'module load chan_dahdi.so' 2>&1 | $LOGGER 63 | xpp_blink bzzt xpd "$XBUS_NUM" 64 | ports=`twinstar ports` 65 | if [ "$ports" = 0 ]; then 66 | play /usr/share/dahdi/primary-pbx-is-ready.wav || : 67 | elif [ "$ports" = 1 ]; then 68 | play /usr/share/dahdi/backup-pbx-is-ready.wav || : 69 | fi 70 | echo "online: READY" | $LOGGER 71 | ;; 72 | offline) 73 | echo "$ACTION($XBUS_NAME): " | $LOGGER 74 | twinstar disable-wd 75 | # If we want to disconnect everybody 76 | twinstar jump 77 | asterisk -rx 'module unload chan_dahdi.so' 78 | ;; 79 | *) 80 | echo "$0: Unknown ACTION='$ACTION'" | $LOGGER 81 | echo "$0: ARGS='$*'" | $LOGGER 82 | echo "$0: ENV:" | $LOGGER 83 | env | $LOGGER 84 | exit 1 85 | esac 86 | 87 | -------------------------------------------------------------------------------- /xpp/xpp.rules: -------------------------------------------------------------------------------- 1 | # Load firmware into the Xorcom Astribank device: 2 | SUBSYSTEM=="usb", ACTION=="add", \ 3 | ENV{PRODUCT}=="e4e4/11[3456][013]/*", ENV{DEVTYPE}!="usb_interface", \ 4 | OPTIONS+="event_timeout=180" \ 5 | RUN+="/usr/share/dahdi/xpp_fxloader udev $env{PRODUCT}" 6 | 7 | # Hotplug hook for Astribank up/down 8 | # If you need this functionality, copy the astribank_hook.sample 9 | # to $XPP_INIT_DIR/astribank_hook 10 | # 11 | # By default XPP_INIT_DIR="/usr/share/dahdi" 12 | KERNEL=="xbus*", RUN+="%E{XPP_INIT_DIR}/astribank_hook udev $kernel $sysfs{status} $sysfs{connector}" 13 | -------------------------------------------------------------------------------- /xpp/xpp_modprobe: -------------------------------------------------------------------------------- 1 | # Some debugging options for the brave of heart: 2 | #options dahdi debug=1 3 | #options wcfxo debug=1 4 | #options xpp debug=1 5 | #options xpp_usb debug=1 6 | #options xpd_fxs debug=1 7 | #options xpd_fxo debug=1 8 | 9 | # For pre-loading of card modules (e.g: xpp_fxs) 10 | #install xpp_usb /sbin/modprobe xpd_fxs && /sbin/modprobe --ignore-install xpp_usb 11 | -------------------------------------------------------------------------------- /xpp/xpp_timing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | grep 'DRIFT:' /sys/bus/astribanks/devices/xbus-*/timing | sed \ 3 | -e 's,/sys/bus/astribanks/devices/,,' \ 4 | -e 's,/timing:,: ,' \ 5 | -e 's,DRIFT: ,,' \ 6 | -e 's/^[^:]*:/\U&/' 7 | -------------------------------------------------------------------------------- /xpp/xtalk/Makefile.am: -------------------------------------------------------------------------------- 1 | VISIBILITY_DEFS = -DXTALK_DLL -DXTALK_DLL_EXPORTS 2 | COMMON_CFLAGS = \ 3 | -Wall \ 4 | -Wno-unknown-pragmas \ 5 | -Werror \ 6 | $(VISIBILITY_DEFS) \ 7 | $(CFLAG_VISIBILITY) 8 | 9 | AM_CFLAGS = $(COMMON_CFLAGS) 10 | 11 | 12 | if LIBUSBX 13 | USB_CFLAGS = $(LIBUSBX_CFLAGS) 14 | USB_LIBS = $(LIBUSBX_LIBS) 15 | USB_NAME = libusbx 16 | else 17 | if LIBUSB 18 | USB_CFLAGS = $(LIBUSB_CFLAGS) 19 | USB_LIBS = $(LIBUSB_LIBS) 20 | USB_NAME = libusb 21 | endif 22 | endif 23 | 24 | noinst_PROGRAMS = xlist_test xusb_test xusb_test_bypath xtalk_test xtalk_raw_test xtalk_send 25 | noinst_LTLIBRARIES = libxtalk.la 26 | dist_noinst_HEADERS = \ 27 | xtalk_base.h \ 28 | xusb_common.h \ 29 | include/xtalk/proto_raw.h \ 30 | include/xtalk/api_defs.h \ 31 | include/xtalk/xlist.h \ 32 | include/xtalk/proto_sync.h \ 33 | include/xtalk/xusb_iface.h \ 34 | include/xtalk/proto.h \ 35 | include/xtalk/debug.h \ 36 | include/xtalk/xusb.h \ 37 | include/xtalk/firmware_defs.h \ 38 | include/xtalk/xtalk_iface.h \ 39 | # 40 | 41 | libxtalk_la_CFLAGS = \ 42 | $(COMMON_CFLAGS) \ 43 | -I$(srcdir)/include \ 44 | -I$(srcdir) \ 45 | $(USB_CFLAGS) \ 46 | -DXTALK_OPTIONS_FILE=\"/etc/dahdi/xpp.conf\" 47 | 48 | libxtalk_la_LDFLAGS = # 49 | libxtalk_la_LIBADD = $(USB_LIBS) 50 | libxtalk_la_SOURCES = \ 51 | $(dist_noinst_HEADERS) \ 52 | xtalk_sync.c \ 53 | xtalk_raw.c \ 54 | xtalk_base.c \ 55 | xlist.c \ 56 | debug.c \ 57 | xtalk-xusb.c \ 58 | xusb_common.c 59 | if LIBUSBX 60 | libxtalk_la_SOURCES += xusb_libusbx.c 61 | else 62 | if LIBUSB 63 | libxtalk_la_SOURCES += xusb_libusb.c 64 | endif 65 | endif 66 | libxtalk_la_DEPENDENCIES = $(libxtalk_la_SOURCES) 67 | 68 | xtalk_send_CFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/include -I$(srcdir) 69 | xtalk_send_LDADD = libxtalk.la $(USB_LIBS) 70 | 71 | xtalk_test_CFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/include -I$(srcdir) 72 | xtalk_test_LDADD = libxtalk.la $(USB_LIBS) 73 | 74 | xtalk_raw_test_CFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/include -I$(srcdir) 75 | xtalk_raw_test_LDADD = libxtalk.la $(USB_LIBS) 76 | 77 | xusb_test_CFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/include -I$(srcdir) 78 | xusb_test_LDADD = libxtalk.la $(USB_LIBS) 79 | 80 | xusb_test_bypath_CFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/include -I$(srcdir) 81 | xusb_test_bypath_LDADD = libxtalk.la $(USB_LIBS) 82 | 83 | xlist_test_CFLAGS = $(COMMON_CFLAGS) -I$(srcdir)/include -I$(srcdir) 84 | xlist_test_LDADD = libxtalk.la $(USB_LIBS) 85 | 86 | DISTCLEANFILES = xtalk.pc xtalk-uninstalled.pc 87 | 88 | EXTRA_DIST = $(man_MANS) 89 | -------------------------------------------------------------------------------- /xpp/xtalk/debug.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Oron Peled 3 | * Copyright (C) 2008, Xorcom 4 | * 5 | * All rights reserved. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | int verbose = LOG_INFO; 34 | int debug_mask; 35 | 36 | void log_function(int level, int mask, const char *msg, ...) 37 | { 38 | va_list ap; 39 | 40 | va_start(ap, msg); 41 | if (verbose >= level) { 42 | if (level < LOG_DEBUG || (mask & debug_mask)) 43 | vfprintf(stderr, msg, ap); 44 | } 45 | va_end(ap); 46 | } 47 | 48 | void dump_packet(int loglevel, int mask, const char *msg, 49 | const char *buf, int len) 50 | { 51 | int i; 52 | 53 | if (!mask || (mask & debug_mask)) { 54 | log_function(loglevel, ~0, "%-15s:", msg); 55 | for (i = 0; i < len; i++) 56 | log_function(loglevel, ~0, " %02X", (uint8_t)buf[i]); 57 | log_function(loglevel, ~0, "\n"); 58 | } 59 | } 60 | 61 | /* from glibc info(1) */ 62 | void print_backtrace(FILE *fp) 63 | { 64 | void *array[10]; 65 | size_t size; 66 | char **strings; 67 | size_t i; 68 | 69 | size = backtrace(array, 10); 70 | strings = backtrace_symbols(array, size); 71 | for (i = 0; i < size; i++) 72 | fprintf(fp, "%s\n", strings[i]); 73 | free(strings); 74 | } 75 | -------------------------------------------------------------------------------- /xpp/xtalk/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef DEBUG_H 2 | #define DEBUG_H 3 | /* 4 | * Written by Oron Peled 5 | * Copyright (C) 2008, Xorcom 6 | * 7 | * All rights reserved. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #include 26 | #include 27 | 28 | /* 29 | * Each module should define a unique DBG_MASK 30 | */ 31 | 32 | extern int verbose; 33 | extern int debug_mask; 34 | 35 | /* 36 | * Logging 37 | */ 38 | void log_function(int level, int mask, const char *msg, ...) 39 | __attribute__((format(printf, 3, 4))); 40 | 41 | #define ERR(fmt, arg...) log_function(LOG_ERR, 0, "%s:%d: ERROR(%s): " fmt, \ 42 | __FILE__, __LINE__, __func__, ## arg) 43 | #define WARN(fmt, arg...) log_function(LOG_WARNING, 0, "WARNING: " fmt, ## arg) 44 | #define INFO(fmt, arg...) log_function(LOG_INFO, 0, "INFO: " fmt, ## arg) 45 | #define DBG(fmt, arg...) log_function(LOG_DEBUG, DBG_MASK, \ 46 | "%s:%d: DBG(%s): " fmt, __FILE__, __LINE__, __func__, ## arg) 47 | 48 | void dump_packet(int loglevel, int mask, const char *msg, 49 | const char *buf, int len); 50 | void print_backtrace(FILE *fp); 51 | 52 | #endif /* DEBUG_H */ 53 | -------------------------------------------------------------------------------- /xpp/xtalk/include/xtalk/api_defs.h: -------------------------------------------------------------------------------- 1 | #ifndef XTALK_API_DEFS_H 2 | #define XTALK_API_DEFS_H 3 | 4 | /* 5 | * Visibility settings: taken from: 6 | * http://gcc.gnu.org/wiki/Visibility 7 | */ 8 | 9 | /* Generic helper definitions for shared library support */ 10 | #if __GNUC__ >= 4 11 | #define XTALK_HELPER_DLL_IMPORT __attribute__ ((visibility ("default"))) 12 | #define XTALK_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) 13 | #define XTALK_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden"))) 14 | #else 15 | #define XTALK_HELPER_DLL_IMPORT 16 | #define XTALK_HELPER_DLL_EXPORT 17 | #define XTALK_HELPER_DLL_LOCAL 18 | #endif 19 | 20 | /* 21 | * Now we use the generic helper definitions above to define XTALK_API and XTALK_LOCAL. 22 | * XTALK_API is used for the public API symbols. It either DLL imports or DLL exports (or does nothing for static build) 23 | * XTALK_LOCAL is used for non-api symbols. 24 | */ 25 | 26 | #ifdef XTALK_DLL /* defined if XTALK is compiled as a DLL */ 27 | #ifdef XTALK_DLL_EXPORTS /* defined if we are building the XTALK DLL (instead of using it) */ 28 | #define XTALK_API XTALK_HELPER_DLL_EXPORT 29 | #else 30 | #define XTALK_API XTALK_HELPER_DLL_IMPORT 31 | #endif /* XTALK_DLL_EXPORTS */ 32 | #define XTALK_LOCAL XTALK_HELPER_DLL_LOCAL 33 | #else /* XTALK_DLL is not defined: this means XTALK is a static lib. */ 34 | #define XTALK_API 35 | #define XTALK_LOCAL 36 | #endif /* XTALK_DLL */ 37 | 38 | #endif /* XTALK_API_DEFS_H */ 39 | -------------------------------------------------------------------------------- /xpp/xtalk/include/xtalk/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef DEBUG_H 2 | #define DEBUG_H 3 | /* 4 | * Written by Oron Peled 5 | * Copyright (C) 2008, Xorcom 6 | * 7 | * All rights reserved. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | /* 30 | * Each module should define a unique DBG_MASK 31 | */ 32 | 33 | XTALK_API extern int verbose; 34 | XTALK_API extern int debug_mask; 35 | 36 | /* 37 | * Logging 38 | */ 39 | XTALK_API void log_function(int level, int mask, const char *msg, ...) 40 | __attribute__((format(printf, 3, 4))); 41 | 42 | #define ERR(fmt, arg...) log_function(LOG_ERR, 0, "%s:%d: ERROR(%s): " fmt, \ 43 | __FILE__, __LINE__, __func__, ## arg) 44 | #define WARN(fmt, arg...) log_function(LOG_WARNING, 0, "WARNING: " fmt, ## arg) 45 | #define INFO(fmt, arg...) log_function(LOG_INFO, 0, "INFO: " fmt, ## arg) 46 | #define DBG(fmt, arg...) log_function(LOG_DEBUG, DBG_MASK, \ 47 | "%s:%d: DBG(%s): " fmt, __FILE__, __LINE__, __func__, ## arg) 48 | 49 | XTALK_API void dump_packet(int loglevel, int mask, const char *msg, 50 | const char *buf, int len); 51 | XTALK_API void print_backtrace(FILE *fp); 52 | 53 | #endif /* DEBUG_H */ 54 | -------------------------------------------------------------------------------- /xpp/xtalk/include/xtalk/firmware_defs.h: -------------------------------------------------------------------------------- 1 | #ifndef XTALK_FIRMWARE_DEFS_H 2 | #define XTALK_FIRMWARE_DEFS_H 3 | 4 | #define MAX_OPS 256 /* single byte */ 5 | #define MAX_STATUS 256 /* single byte */ 6 | 7 | #define XTALK_REPLY_MASK 0x80 /* Every reply has this bit */ 8 | 9 | #define PRIVATE_OP_FIRST 0x05 10 | #define PRIVATE_OP_LAST 0x7F 11 | #define IS_PRIVATE_OP(x) ( \ 12 | (((x) & ~(XTALK_REPLY_MASK)) >= PRIVATE_OP_FIRST) && \ 13 | (((x) & ~(XTALK_REPLY_MASK)) <= PRIVATE_OP_LAST) \ 14 | ) 15 | 16 | #define XTALK_ACK 0x80 17 | #define XTALK_PROTO_GET 0x01 18 | #define XTALK_PROTO_GET_REPLY (XTALK_PROTO_GET | XTALK_REPLY_MASK) 19 | #define XTALK_FWVERS_GET 0x11 20 | #define XTALK_FWVERS_GET_REPLY (XTALK_FWVERS_GET | XTALK_REPLY_MASK) 21 | #define XTALK_CAPS_GET 0x0E /* Get EEPROM table contents Product/Vendor Id ... */ 22 | #define XTALK_CAPS_GET_REPLY (XTALK_CAPS_GET | XTALK_REPLY_MASK) 23 | 24 | /*------------- XTALK: statuses in ACK ---------------------------------------*/ 25 | #define STAT_OK 0x00 /* OK */ 26 | #define STAT_FAIL 0x01 /* last command failed */ 27 | #define STAT_RESET_FAIL 0x02 /* reset failed */ 28 | #define STAT_NODEST 0x03 /* No destination is selected */ 29 | #define STAT_MISMATCH 0x04 /* Data mismatch */ 30 | #define STAT_NOACCESS 0x05 /* No access */ 31 | #define STAT_BAD_CMD 0x06 /* Bad command */ 32 | #define STAT_TOO_SHORT 0x07 /* Packet is too short */ 33 | #define STAT_ERROFFS 0x08 /* Offset error (not used) */ 34 | #define STAT_NO_LEEPROM 0x0A /* Large EEPROM was not found */ 35 | #define STAT_NO_EEPROM 0x0B /* No EEPROM was found */ 36 | #define STAT_WRITE_FAIL 0x0C /* Writing to device failed */ 37 | #define STAT_NOPWR_ERR 0x10 /* No power on USB connector */ 38 | 39 | 40 | #endif /* XTALK_FIRMWARE_DEFS_H */ 41 | -------------------------------------------------------------------------------- /xpp/xtalk/include/xtalk/proto_raw.h: -------------------------------------------------------------------------------- 1 | #ifndef XTALK_PROTO_RAW_H 2 | #define XTALK_PROTO_RAW_H 3 | /* 4 | * Written by Oron Peled 5 | * Copyright (C) 2009, Xorcom 6 | * 7 | * All rights reserved. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #ifdef __cplusplus 26 | extern "C" 27 | { 28 | #endif /* __cplusplus */ 29 | 30 | /* 31 | * XTALKSYNC - Base synchronous protocol for our USB devices 32 | * It is meant to provide a common base for layered 33 | * protocols (dialects) 34 | */ 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #ifdef __GNUC__ 43 | #define PACKED __attribute__((packed)) 44 | #else 45 | #error "We do not know how your compiler packs structures" 46 | #endif 47 | 48 | /* 49 | * Base XTALK device. A pointer to this struct 50 | * should be included in the struct representing 51 | * the dialect. 52 | */ 53 | struct xtalk_raw; 54 | struct xusb; 55 | 56 | XTALK_API struct xtalk_raw *xtalk_raw_new(struct xtalk_base *xtalk_base); 57 | XTALK_API void xtalk_raw_delete(struct xtalk_raw *xraw); 58 | XTALK_API int xtalk_raw_set_protocol(struct xtalk_raw *xtalk_base, 59 | const struct xtalk_protocol *xproto); 60 | XTALK_API int xtalk_raw_cmd_recv(struct xtalk_raw *xraw, 61 | struct xtalk_command **reply_ref); 62 | XTALK_API int xtalk_raw_cmd_send(struct xtalk_raw *xraw, const char *buf, int len, 63 | uint16_t *tx_seq); 64 | 65 | /* 66 | * These are low-level interfaces that receive/send arbitrary buffers 67 | * Be carefull, as that allow to send illegal Xtalk packets 68 | */ 69 | XTALK_API int xtalk_raw_buffer_recv(struct xtalk_raw *xraw, char *buf, int len); 70 | XTALK_API int xtalk_raw_buffer_send(struct xtalk_raw *xraw, const char *buf, int len); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif /* __cplusplus */ 75 | 76 | #endif /* XTALK_PROTO_RAW_H */ 77 | -------------------------------------------------------------------------------- /xpp/xtalk/include/xtalk/proto_sync.h: -------------------------------------------------------------------------------- 1 | #ifndef XTALK_PROTO_SYNC_H 2 | #define XTALK_PROTO_SYNC_H 3 | /* 4 | * Written by Oron Peled 5 | * Copyright (C) 2009, Xorcom 6 | * 7 | * All rights reserved. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #include 26 | #include 27 | 28 | #ifdef __cplusplus 29 | extern "C" 30 | { 31 | #endif /* __cplusplus */ 32 | 33 | /* 34 | * XTALKSYNC - Base synchronous protocol for our USB devices 35 | * It is meant to provide a common base for layered 36 | * protocols (dialects) 37 | */ 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | #ifdef __GNUC__ 44 | #define PACKED __attribute__((packed)) 45 | #else 46 | #error "We do not know how your compiler packs structures" 47 | #endif 48 | 49 | /* 50 | * Base XTALK device. A pointer to this struct 51 | * should be included in the struct representing 52 | * the dialect. 53 | */ 54 | struct xtalk_sync; 55 | struct xusb; 56 | 57 | /* high-level */ 58 | XTALK_API struct xtalk_sync *xtalk_sync_new(struct xtalk_base *xtalk_base); 59 | XTALK_API void xtalk_sync_delete(struct xtalk_sync *xtalk_sync); 60 | XTALK_API int xtalk_sync_set_protocol(struct xtalk_sync *xtalk_base, 61 | const struct xtalk_protocol *xproto); 62 | XTALK_API int xtalk_proto_query(struct xtalk_sync *dev); 63 | 64 | /* low-level */ 65 | XTALK_API int process_command( 66 | struct xtalk_sync *dev, 67 | struct xtalk_command *cmd, 68 | struct xtalk_command **reply_ref, 69 | uint16_t *sequence_number); 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif /* __cplusplus */ 74 | 75 | #endif /* XTALK_PROTO_SYNC_H */ 76 | -------------------------------------------------------------------------------- /xpp/xtalk/include/xtalk/xlist.h: -------------------------------------------------------------------------------- 1 | #ifndef XLIST_H 2 | #define XLIST_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" 8 | { 9 | #endif /* __cplusplus */ 10 | 11 | struct xlist_node { 12 | void *data; 13 | struct xlist_node *next; 14 | struct xlist_node *prev; 15 | }; 16 | 17 | typedef void (*xlist_destructor_t)(void *data); 18 | 19 | XTALK_API struct xlist_node *xlist_new(void *data); 20 | XTALK_API void xlist_destroy(struct xlist_node *list, xlist_destructor_t destructor); 21 | XTALK_API void xlist_append_list(struct xlist_node *list1, struct xlist_node *list2); 22 | XTALK_API void xlist_append_item(struct xlist_node *list, struct xlist_node *item); 23 | XTALK_API void xlist_remove_item(struct xlist_node *item); 24 | XTALK_API struct xlist_node *xlist_shift(struct xlist_node *list); 25 | XTALK_API int xlist_empty(const struct xlist_node *list); 26 | XTALK_API size_t xlist_length(const struct xlist_node *list); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif /* __cplusplus */ 31 | 32 | #endif /* XLIST_H */ 33 | -------------------------------------------------------------------------------- /xpp/xtalk/include/xtalk/xtalk_iface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Wrappers for swig/python integration 3 | */ 4 | 5 | struct Command { 6 | struct xtalk_command *command; 7 | }; 8 | 9 | struct Xtalksync { 10 | struct xtalk_base *xtalk_base; 11 | struct xtalk_sync *xtalk_sync; 12 | struct XusbIface *py_xusb_iface; 13 | }; 14 | 15 | struct Xtalkraw { 16 | struct xtalk_base *xtalk_base; 17 | struct xtalk_raw *xtalk_raw; 18 | struct XusbIface *py_xusb_iface; 19 | }; 20 | -------------------------------------------------------------------------------- /xpp/xtalk/include/xtalk/xusb_iface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Wrappers for swig/python integration 3 | */ 4 | 5 | #ifdef SWIG 6 | %feature("docstring", "Represents the specification of wanted USB device") Spec; 7 | #endif 8 | struct Spec { 9 | #ifdef SWIG 10 | %immutable spec; 11 | %immutable ref_count; 12 | #endif 13 | struct xusb_spec *spec; 14 | int ref_count; 15 | }; 16 | 17 | #ifdef SWIG 18 | %feature("docstring", "Represents a single USB device") XusbDev; 19 | #endif 20 | struct XusbDev { 21 | #ifdef SWIG 22 | %immutable spec; 23 | %immutable xusb_device; 24 | %immutable ref_count; 25 | #endif 26 | struct Spec *spec_wrapper; 27 | struct xusb_device *xusb_device; 28 | int ref_count; 29 | }; 30 | 31 | #ifdef SWIG 32 | %feature("docstring", "Represents a single USB interface") XusbIface; 33 | #endif 34 | struct XusbIface { 35 | #ifdef SWIG 36 | %immutable dev_wrapper; 37 | %immutable iface; 38 | #endif 39 | struct XusbDev *dev_wrapper; /* for ref-counting */ 40 | struct xusb_iface *iface; 41 | }; 42 | 43 | 44 | -------------------------------------------------------------------------------- /xpp/xtalk/xlist.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | struct xlist_node *xlist_new(void *data) 8 | { 9 | struct xlist_node *list; 10 | 11 | list = malloc(sizeof(*list)); 12 | if (!list) 13 | return NULL; 14 | list->next = list; 15 | list->prev = list; 16 | list->data = data; 17 | return list; 18 | } 19 | 20 | void xlist_destroy(struct xlist_node *list, xlist_destructor_t destructor) 21 | { 22 | struct xlist_node *curr; 23 | struct xlist_node *next; 24 | 25 | if (!list) 26 | return; 27 | curr = list->next; 28 | while (curr != list) { 29 | next = curr->next; 30 | if (destructor) 31 | destructor(curr->data); 32 | memset(curr, 0, sizeof(*curr)); 33 | free(curr); 34 | curr = next; 35 | } 36 | memset(list, 0, sizeof(*list)); 37 | free(list); 38 | } 39 | 40 | void xlist_append_list(struct xlist_node *list1, struct xlist_node *list2) 41 | { 42 | struct xlist_node *curr; 43 | 44 | assert(list1); 45 | assert(list2); 46 | 47 | while ((curr = xlist_shift(list2)) != NULL) 48 | xlist_append_item(list1, curr); 49 | } 50 | 51 | void xlist_append_item(struct xlist_node *list, struct xlist_node *item) 52 | { 53 | assert(list); 54 | assert(xlist_empty(item)); 55 | item->next = list; 56 | item->prev = list->prev; 57 | list->prev->next = item; 58 | list->prev = item; 59 | } 60 | 61 | void xlist_prepend_item(struct xlist_node *list, struct xlist_node *item) 62 | { 63 | assert(list); 64 | assert(xlist_empty(item)); 65 | item->prev = list; 66 | item->next = list->next; 67 | list->next->prev = item; 68 | list->next = item; 69 | } 70 | 71 | void xlist_remove_item(struct xlist_node *item) 72 | { 73 | assert(item); 74 | item->prev->next = item->next; 75 | item->next->prev = item->prev; 76 | item->next = item->prev = item; 77 | } 78 | 79 | struct xlist_node *xlist_shift(struct xlist_node *list) 80 | { 81 | struct xlist_node *item; 82 | 83 | if (!list) 84 | return NULL; 85 | if (xlist_empty(list)) 86 | return NULL; 87 | item = list->next; 88 | xlist_remove_item(item); 89 | return item; 90 | } 91 | 92 | int xlist_empty(const struct xlist_node *list) 93 | { 94 | assert(list); 95 | return list->next == list && list->prev == list; 96 | } 97 | 98 | size_t xlist_length(const struct xlist_node *list) 99 | { 100 | struct xlist_node *curr; 101 | size_t count = 0; 102 | 103 | for (curr = list->next; curr != list; curr = curr->next) 104 | count++; 105 | return count; 106 | } 107 | -------------------------------------------------------------------------------- /xpp/xtalk/xlist.h: -------------------------------------------------------------------------------- 1 | #ifndef XLIST_H 2 | #define XLIST_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif /* __cplusplus */ 8 | 9 | struct xlist_node { 10 | void *data; 11 | struct xlist_node *next; 12 | struct xlist_node *prev; 13 | }; 14 | 15 | typedef void (*xlist_destructor_t)(void *data); 16 | 17 | struct xlist_node *xlist_new(void *data); 18 | void xlist_destroy(struct xlist_node *list, xlist_destructor_t destructor); 19 | void xlist_append_item(struct xlist_node *list, struct xlist_node *item); 20 | void xlist_remove_item(struct xlist_node *item); 21 | struct xlist_node *xlist_shift(struct xlist_node *list); 22 | int xlist_empty(const struct xlist_node *list); 23 | size_t xlist_length(const struct xlist_node *list); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif /* __cplusplus */ 28 | 29 | #endif /* XLIST_H */ 30 | -------------------------------------------------------------------------------- /xpp/xtalk/xlist_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void dump_list(const struct xlist_node *list) 7 | { 8 | struct xlist_node *curr; 9 | const char *p; 10 | int len; 11 | 12 | len = xlist_length(list); 13 | p = list->data; 14 | printf("dumping list: %s[%d]\n", p, len); 15 | for (curr = list->next; curr != list; curr = curr->next) { 16 | p = curr->data; 17 | printf("> %s\n", p); 18 | } 19 | } 20 | 21 | void string_destructor(void *data) 22 | { 23 | const char *p = data; 24 | 25 | printf("destroy: '%s'\n", p); 26 | } 27 | 28 | int main() 29 | { 30 | struct xlist_node *list1; 31 | struct xlist_node *list2; 32 | struct xlist_node *list3; 33 | struct xlist_node *item1; 34 | struct xlist_node *item2; 35 | struct xlist_node *item3; 36 | 37 | list1 = xlist_new("list1"); 38 | list2 = xlist_new("list2"); 39 | list3 = xlist_new("list3"); 40 | item1 = xlist_new("item1"); 41 | item2 = xlist_new("item2"); 42 | item3 = xlist_new("item3"); 43 | assert(xlist_empty(list1)); 44 | assert(xlist_empty(list2)); 45 | assert(xlist_empty(list3)); 46 | assert(xlist_empty(item1)); 47 | assert(xlist_empty(item2)); 48 | assert(xlist_empty(item3)); 49 | dump_list(list1); 50 | dump_list(list2); 51 | xlist_append_item(list1, item1); 52 | assert(!xlist_empty(list1)); 53 | xlist_append_item(list1, item2); 54 | xlist_append_item(list1, item3); 55 | dump_list(list1); 56 | xlist_remove_item(item2); 57 | assert(!xlist_empty(list1)); 58 | xlist_append_item(list2, item2); 59 | assert(!xlist_empty(list2)); 60 | dump_list(list1); 61 | dump_list(list2); 62 | xlist_shift(list1); 63 | dump_list(list1); 64 | xlist_append_list(list1, list2); 65 | dump_list(list1); 66 | xlist_append_item(list3, item1); 67 | xlist_append_list(list1, list3); 68 | dump_list(list1); 69 | xlist_destroy(list1, string_destructor); 70 | xlist_destroy(list2, string_destructor); 71 | xlist_destroy(list3, string_destructor); 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /xpp/xtalk/xtalk-xusb.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Oron Peled 3 | * Copyright (C) 2012, Xorcom 4 | * 5 | * All rights reserved. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | */ 22 | 23 | /* 24 | * Convenience wrappers for xtalk_base over xusb 25 | */ 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include "xtalk_base.h" 31 | 32 | static inline int close_func(void *priv) 33 | { 34 | struct xusb_iface *iface = (struct xusb_iface *)priv; 35 | xusb_release(iface); 36 | return 0; 37 | } 38 | 39 | static inline int send_func(void *priv, const char *data, size_t len, int timeout) 40 | { 41 | return xusb_send((struct xusb_iface *)priv, data, len, timeout); 42 | } 43 | 44 | static inline int recv_func(void *priv, char *data, size_t maxlen, int timeout) 45 | { 46 | return xusb_recv((struct xusb_iface *)priv, data, maxlen, timeout); 47 | } 48 | 49 | 50 | static struct xtalk_ops xtalk_ops = { 51 | .send_func = send_func, 52 | .recv_func = recv_func, 53 | .close_func = close_func, 54 | }; 55 | 56 | struct xtalk_base *xtalk_base_new_on_xusb(struct xusb_iface *xusb_iface) 57 | { 58 | struct xtalk_base *xtalk_base; 59 | int packet_size; 60 | 61 | assert(xusb_iface); 62 | packet_size = xusb_packet_size(xusb_deviceof(xusb_iface)); 63 | 64 | xtalk_base = xtalk_base_new(&xtalk_ops, packet_size, xusb_iface); 65 | if (!xtalk_base) { 66 | ERR("Failed creating the xtalk device abstraction\n"); 67 | return NULL; 68 | } 69 | return xtalk_base; 70 | } 71 | -------------------------------------------------------------------------------- /xpp/xtalk/xtalk_base.h: -------------------------------------------------------------------------------- 1 | #ifndef XTALK_BASE_H 2 | #define XTALK_BASE_H 3 | /* 4 | * Written by Oron Peled 5 | * Copyright (C) 2009, Xorcom 6 | * 7 | * All rights reserved. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #ifdef __cplusplus 31 | extern "C" 32 | { 33 | #endif /* __cplusplus */ 34 | 35 | /* 36 | * Base XTALK device. A pointer to this struct 37 | * should be included in the struct representing 38 | * the dialect. 39 | */ 40 | struct xtalk_base { 41 | void *transport_priv; /* e.g: struct xusb */ 42 | struct xtalk_ops ops; 43 | struct xtalk_protocol xproto; 44 | xtalk_cmd_callback_t callbacks[MAX_OPS]; 45 | uint8_t xtalk_proto_version; 46 | uint8_t status; 47 | size_t packet_size; 48 | uint16_t tx_sequenceno; 49 | int default_timeout; /* in millies */ 50 | }; 51 | 52 | int xtalk_set_protocol(struct xtalk_base *xtalk_base, 53 | const struct xtalk_protocol *xproto_base, 54 | const struct xtalk_protocol *xproto); 55 | const struct xtalk_command_desc *get_command_desc( 56 | const struct xtalk_protocol *xproto, uint8_t op); 57 | int send_command(struct xtalk_base *xtalk_base, 58 | struct xtalk_command *cmd, uint16_t *tx_seq); 59 | int recv_command(struct xtalk_base *xtalk_base, 60 | struct xtalk_command **reply_ref); 61 | 62 | /* 63 | * These are low-level interfaces that receive/send arbitrary buffers 64 | * Be carefull, as that allow to send illegal Xtalk packets 65 | */ 66 | int send_buffer(struct xtalk_base *xtalk_base, const char *buf, int len); 67 | int recv_buffer(struct xtalk_base *xtalk_base, char *buf, int len); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif /* __cplusplus */ 72 | 73 | #endif /* XTALK_BASE_H */ 74 | -------------------------------------------------------------------------------- /xpp/xtalk/xtalk_send.8: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .\" (C) Copyright 2013 Oron Peled , 3 | .\" 4 | .TH XTALK_SEND 8 "March 14, 2013" 5 | .\" 6 | .\" Some roff macros, for reference: 7 | .\" .nh disable hyphenation 8 | .\" .hy enable hyphenation 9 | .\" .ad l left justify 10 | .\" .ad b justify to both left and right margins 11 | .\" .nf disable filling 12 | .\" .fi enable filling 13 | .\" .br insert line break 14 | .\" .sp insert n+1 empty lines 15 | .\" for manpage-specific macros, see man(7) 16 | .SH NAME 17 | xtalk_send \- send arbitrary packets to XTALK devices 18 | .SH SYNOPSIS 19 | .B xtalk_send 20 | .RI [ options ] " hexnum" ... 21 | .br 22 | .SH DESCRIPTION 23 | This manual page documents briefly the \fBxtalk_send\fP command. 24 | .PP 25 | \fBxtalk_send\fP is a program that send arbitrary packets to Xorcom devices 26 | that use the XTALK protocol. 27 | .SH OPTIONS 28 | A summary of options is included below: 29 | .TP 30 | .B \-I 31 | Specify USB interface number (default 1). 32 | .TP 33 | .B \-t 34 | Timeout from send until an answer is received (default 500). 35 | .TP 36 | .B \-Q 37 | Query protocol version. This is only valid for synchronous XTALK protocols. 38 | Usually, these protocols are bound to USB interface 1. 39 | .TP 40 | .B \-h 41 | Show summary of options. 42 | .TP 43 | .B \-v 44 | Increase output verbosity. 45 | .TP 46 | .B \-d 47 | Debug mask. Use 0xFF for everything. 48 | .SH AUTHOR 49 | Oron Peled 50 | -------------------------------------------------------------------------------- /xpp/xtalk/xusb_test_bypath.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | static char *progname; 9 | 10 | static void usage() 11 | { 12 | fprintf(stderr, "Usage: %s [options...] / ...\n", progname); 13 | fprintf(stderr, "\tOptions:\n"); 14 | fprintf(stderr, "\t\t[-v] # Increase verbosity\n"); 15 | fprintf(stderr, 16 | "\t\t[-d mask] # Debug mask (0xFF for everything)\n"); 17 | exit(1); 18 | } 19 | 20 | static int check_devpath(const char *devpath) 21 | { 22 | const struct xusb_spec *spec; 23 | struct xusb_device *xusb_dev; 24 | struct xusb_iface *iface; 25 | int ret; 26 | 27 | printf("Checking %s: ", devpath); 28 | fflush(stdout); 29 | xusb_dev = xusb_find_bypath(devpath); 30 | if (!xusb_dev) { 31 | ERR("missing %s\n", devpath); 32 | return 1; 33 | } 34 | spec = xusb_device_spec(xusb_dev); 35 | printf("Found: %04x:%04x\n", spec->vendor_id, spec->product_id); 36 | ret = xusb_claim(xusb_dev, 1, &iface); 37 | if (ret < 0) { 38 | ERR("%s: xusb_claim() failed (ret = %d)\n", 39 | xusb_devpath(xusb_dev), ret); 40 | return 1; 41 | } 42 | xusb_showinfo(xusb_dev); 43 | xusb_release(iface); 44 | return 1; 45 | } 46 | 47 | int main(int argc, char *argv[]) 48 | { 49 | const char options[] = "vd:"; 50 | int i; 51 | 52 | progname = argv[0]; 53 | while (1) { 54 | int c; 55 | 56 | c = getopt(argc, argv, options); 57 | if (c == -1) 58 | break; 59 | 60 | switch (c) { 61 | case 'v': 62 | verbose++; 63 | break; 64 | case 'd': 65 | debug_mask = strtoul(optarg, NULL, 0); 66 | break; 67 | case 'h': 68 | default: 69 | ERR("Unknown option '%c'\n", c); 70 | usage(); 71 | } 72 | } 73 | for (i = optind; i < argc; i++) 74 | check_devpath(argv[i]); 75 | return 0; 76 | } 77 | --------------------------------------------------------------------------------