wanpipe-3.2.4.tgz
This commit is contained in:
parent
19bdb88fbc
commit
4b660421c5
|
@ -7,12 +7,47 @@ Author: Nenad Corbic <ncorbic@sangoma.com>
|
|||
Copyright (c) 1995-2008 Sangoma Technologies Inc.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
* Thu Jan 24 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.2.1
|
||||
|
||||
* Thu Mar 6 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.4
|
||||
========================================================================
|
||||
|
||||
- Fixed a compile bug that occured on some kernels due to inlining.
|
||||
- Updates Setup script
|
||||
- Updated for 2.6.24 kernels
|
||||
TDM Voice (Zaptel) tested with 2.6.24 kernel.
|
||||
Known issues: WAN protocols are broken for 2.6.24 kernels.
|
||||
Its a compilation issue that will be fixed ASAP.
|
||||
|
||||
- TDM API bug fix
|
||||
Check for max frame size on audio stream
|
||||
|
||||
- Updated for Zaptel 1.4.9
|
||||
|
||||
- AFT IRQ Throttling feature
|
||||
This feature is use to protect the server from
|
||||
terrible lines. In some cases a bad hdlc line can
|
||||
cause thousands of interrupts per sec. Rx errors are now
|
||||
throttled so that system does not get compromized.
|
||||
|
||||
- AFT RTP TAP Feature
|
||||
RTP TAP Feature allows user to tap voice channels during
|
||||
Asterisk-Zaptel/TMD API operation at the driver/kernel level.
|
||||
Each voice stream is encapsulated in UDP/RTP header and transmitted over
|
||||
neghbouring ethernet address directly from kenrel space.
|
||||
Tapping 4E1s worth of voice channels adds estra 2% system load :)
|
||||
http://wiki.sangoma.com/wanpipe-voice-rtp-tap
|
||||
|
||||
- AFT Software Ring Buffers on A200/A400 Analog Cards
|
||||
This feature improves analog preformance under Asterisk/TDM API
|
||||
mode. In particualr it improves faxing reliability and
|
||||
minimizes frame slippage due to system load or bad incoming
|
||||
clock from the line.
|
||||
Note: All AFT T1/E1 cards have this feature in hardare :)
|
||||
|
||||
|
||||
* Thu Jan 18 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.3
|
||||
========================================================================
|
||||
|
||||
- No changes from 3.2.2
|
||||
Version updated for versioning sake.
|
||||
|
||||
* Thu Jan 18 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.2
|
||||
========================================================================
|
||||
|
|
58
Makefile
58
Makefile
|
@ -19,6 +19,29 @@ ifndef ZAPDIR
|
|||
ZAPDIR=/usr/src/zaptel
|
||||
endif
|
||||
|
||||
#Check if zaptel exists
|
||||
ifneq (,$(wildcard $(ZAPDIR)/zaptel.h))
|
||||
ZAPDIR_PRIV=$(ZAPDIR)
|
||||
ENABLE_WANPIPEMON_ZAP=YES
|
||||
EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE
|
||||
ZAP_OPTS= --zaptel-path=$(ZAPDIR)
|
||||
ZAP_PROT=TDM
|
||||
else
|
||||
ifneq (,$(wildcard $(ZAPDIR)/kernel/zaptel.h))
|
||||
ZAPDIR=/usr/src/zaptel/kernel
|
||||
ZAPDIR_PRIV=$(ZAPDIR)
|
||||
ENABLE_WANPIPEMON_ZAP=YES
|
||||
EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE
|
||||
ZAP_OPTS= --zaptel-path=$(ZAPDIR)
|
||||
ZAP_PROT=TDM
|
||||
else
|
||||
ZAP_OPTS=
|
||||
ZAP_PROT=
|
||||
ZAPDIR_PRIV=
|
||||
ENABLE_WANPIPEMON_ZAP=NO
|
||||
endif
|
||||
endif
|
||||
|
||||
#Kernel version and location
|
||||
ifndef KVER
|
||||
KVER=$(shell uname -r)
|
||||
|
@ -65,18 +88,27 @@ RM = @rm -rf
|
|||
JUNK = *~ *.bak DEADJOE
|
||||
|
||||
#Check if zaptel exists
|
||||
ifneq (,$(wildcard $(ZAPDIR)/zaptel.h))
|
||||
ZAPDIR_PRIV=$(ZAPDIR)
|
||||
ENABLE_WANPIPEMON_ZAP=YES
|
||||
EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE
|
||||
ZAP_OPTS= --zaptel-path=$(ZAPDIR)
|
||||
ZAP_PROT=TDM
|
||||
else
|
||||
ZAP_OPTS=
|
||||
ZAP_PROT=
|
||||
ZAPDIR_PRIV=
|
||||
ENABLE_WANPIPEMON_ZAP=NO
|
||||
endif
|
||||
#ifneq (,$(wildcard $(ZAPDIR)/zaptel.h))
|
||||
# ZAPDIR_PRIV=$(ZAPDIR)
|
||||
# ENABLE_WANPIPEMON_ZAP=YES
|
||||
# EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE
|
||||
# ZAP_OPTS= --zaptel-path=$(ZAPDIR)
|
||||
# ZAP_PROT=TDM
|
||||
#else
|
||||
# ifneq (,$(wildcard $(ZAPDIR)/kernel/zaptel.h))
|
||||
# ZAPDIR=/usr/src/zaptel/kernel
|
||||
# ZAPDIR_PRIV=$(ZAPDIR)
|
||||
# ENABLE_WANPIPEMON_ZAP=YES
|
||||
# EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE
|
||||
# ZAP_OPTS= --zaptel-path=$(ZAPDIR)
|
||||
# ZAP_PROT=TDM
|
||||
# else
|
||||
# ZAP_OPTS=
|
||||
# ZAP_PROT=
|
||||
# ZAPDIR_PRIV=
|
||||
# ENABLE_WANPIPEMON_ZAP=NO
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -151,7 +183,7 @@ _check_kver:
|
|||
_checkzap:
|
||||
@echo
|
||||
@echo " +--------- Wanpipe Build Info --------------+"
|
||||
@echo
|
||||
@echo
|
||||
@if [ ! -e $(ZAPDIR)/zaptel.h ]; then \
|
||||
echo " Compiling Wanpipe without ZAPTEL Support!"; \
|
||||
ZAPDIR_PRIV=; \
|
||||
|
|
182
Setup
182
Setup
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Setup WANPIPE WAN Router Installation/Removal Script.
|
||||
#
|
||||
# Copyright (c) 1996-2007, Sangoma Technologies Inc.
|
||||
# Copyright (c) 1996-2008, Sangoma Technologies Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -543,15 +543,9 @@ prepare()
|
|||
eval "type bison 2> /dev/null > /dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo -n "Checking for yacc..."
|
||||
eval "type yacc 2> /dev/null > /dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Failed!"
|
||||
missing_packages=$missing_packages"bison "
|
||||
fi
|
||||
else
|
||||
echo "Failed!"
|
||||
missing_packages=$missing_packages"bison "
|
||||
fi
|
||||
|
||||
echo
|
||||
|
@ -606,10 +600,10 @@ prepare()
|
|||
echo -e " Required for Wancfg configuration utility."
|
||||
echo -e " Install flex package (e.g yum install flex)."
|
||||
;;
|
||||
yacc)
|
||||
echo -e "\n Yacc."
|
||||
bison)
|
||||
echo -e "\n Bison."
|
||||
echo -e " Required for Wanpipe Utilities."
|
||||
echo -e " Install byacc package (e.g yum install byacc)."
|
||||
echo -e " Install bison package (e.g yum install bison)."
|
||||
;;
|
||||
|
||||
esac
|
||||
|
@ -1944,7 +1938,7 @@ WARNING: The Linux source in $SOURCEDIR has not been configured.
|
|||
|
||||
WANCFG_DEFS=
|
||||
if [ "$TDM_PROT" = "YES" ]; then
|
||||
WANCFG_DEFS=$WANCFG_DEFS" ENABLE_ZAPTEL_PARSER=YES ZAPINC=$ZAPTEL_INSTALL_DIR"
|
||||
WANCFG_DEFS=$WANCFG_DEFS" ENABLE_ZAPTEL_PARSER=YES ZAPINC=$ZAPTEL_SOURCE_DIR"
|
||||
fi
|
||||
eval "make -C wancfg all CC=$CC SYSINC=$SOURCEDIR/include $WANCFG_DEFS >> $CMP_LOG 2>> $CMP_LOG"
|
||||
|
||||
|
@ -3728,7 +3722,7 @@ WANPIPE_OBJS=
|
|||
\cp $DRIVER_UPDATE_DIR/src/net/sdla_tdmv.c .
|
||||
\cp $DRIVER_UPDATE_DIR/src/net/sdla_remora_tdmv.c .
|
||||
WANPIPE_OBJS=$WANPIPE_OBJS"sdla_tdmv sdla_remora_tdmv "
|
||||
WANPIPE_EXTRA_CFLAGS=$WANPIPE_EXTRA_CFLAGS"-I$ZAPTEL_INSTALL_DIR "
|
||||
WANPIPE_EXTRA_CFLAGS=$WANPIPE_EXTRA_CFLAGS"-I$ZAPTEL_SOURCE_DIR "
|
||||
fi
|
||||
|
||||
if [ "$AFT_TE1_PROT" = "YES" ]; then
|
||||
|
@ -4847,44 +4841,55 @@ search_and_replace()
|
|||
}
|
||||
function tdmv_get_zaptel_path ()
|
||||
{
|
||||
|
||||
if [ $ZAPTEL_PATH_OP != "YES" ]; then
|
||||
find_zap_dirs
|
||||
fi
|
||||
|
||||
if [ 0 ]; then
|
||||
if [ $ZAPTEL_PATH_OP != "YES" ]; then
|
||||
echo
|
||||
echo -e "\nPlease specify absolute path to Zaptel source directory"
|
||||
echo -e "\n[default:$ZAPTEL_INSTALL_DIR]\n"
|
||||
echo -n "<specify path:> "
|
||||
if [ ! -d $ZAPTEL_INSTALL_DIR ]; then
|
||||
echo -e "Warning: $ZAPTEL_INSTALL_DIR does not exist\n"
|
||||
if [ 0 ]; then
|
||||
if [ $ZAPTEL_PATH_OP != "YES" ]; then
|
||||
echo
|
||||
echo -e "\nPlease specify absolute path to Zaptel source directory"
|
||||
echo -e "\n[default:$ZAPTEL_SOURCE_DIR]\n"
|
||||
echo -n "<specify path:> "
|
||||
if [ ! -d $ZAPTEL_SOURCE_DIR ]; then
|
||||
echo -e "Warning: $ZAPTEL_SOURCE_DIR does not exist\n"
|
||||
fi
|
||||
if test -z $NONINTERACTIVE; then
|
||||
read response
|
||||
|
||||
[ $response ] && {
|
||||
ZAPTEL_SOURCE_DIR=$response
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
#Check if this post Zaptel-1.4.9
|
||||
if [ -d $ZAPTEL_SOURCE_DIR/kernel ]; then
|
||||
ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR
|
||||
ZAPTEL_SOURCE_DIR=$ZAPTEL_SOURCE_DIR/kernel
|
||||
else
|
||||
if [ -z $ZAPTEL_INSTALL_DIR ]; then
|
||||
ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR
|
||||
fi
|
||||
fi
|
||||
if test -z $NONINTERACTIVE; then
|
||||
read response
|
||||
|
||||
[ $response ] && {
|
||||
ZAPTEL_INSTALL_DIR=$response
|
||||
}
|
||||
fi
|
||||
fi
|
||||
if [ ! -f $ZAPTEL_INSTALL_DIR/zaptel.h ]; then
|
||||
echo " Zaptel source not found in $ZAPTEL_INSTALL_DIR"
|
||||
ZAPTEL_INSTALL_DIR="/usr/src/zaptel"
|
||||
if test $NONINTERACTIVE; then
|
||||
return 1
|
||||
else
|
||||
getyn " Press Y to specify another Zaptel source directory, N to exit"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1;
|
||||
fi
|
||||
tdmv_get_zaptel_path
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f $ZAPTEL_SOURCE_DIR/zaptel.h ]; then
|
||||
echo " Zaptel source not found in $ZAPTEL_INSTALL_DIR"
|
||||
ZAPTEL_SOURCE_DIR="/usr/src/zaptel"
|
||||
ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR
|
||||
if test $NONINTERACTIVE; then
|
||||
return 1
|
||||
else
|
||||
getyn " Press Y to specify another Zaptel source directory, N to exit"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1;
|
||||
fi
|
||||
tdmv_get_zaptel_path
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
#zaptel.c renamed to zaptel-base.c in zaptel v1.2.13 and later
|
||||
if [ -e $ZAPTEL_INSTALL_DIR/zaptel-base.c ]; then
|
||||
if [ -e $ZAPTEL_SOURCE_DIR/zaptel-base.c ]; then
|
||||
ZAPTEL_C_FILE="zaptel-base.c";
|
||||
fi
|
||||
return 0;
|
||||
|
@ -4903,7 +4908,7 @@ function tdmv_apply_zaptel_dchan_patch_old ()
|
|||
|
||||
lhome=`pwd`
|
||||
|
||||
cd $ZAPTEL_INSTALL_DIR
|
||||
cd $ZAPTEL_SOURCE_DIR
|
||||
|
||||
|
||||
if [ ! -e CVS ]; then
|
||||
|
@ -4927,7 +4932,7 @@ function tdmv_apply_zaptel_dchan_patch_old ()
|
|||
cd $lhome
|
||||
return 0
|
||||
else
|
||||
echo "ERROR: Old Zaptel DCHAN patch detected in $ZAPTEL_INSTALL_DIR"
|
||||
echo "ERROR: Old Zaptel DCHAN patch detected in $ZAPTEL_SOURCE_DIR"
|
||||
echo
|
||||
echo " Please install a fresh version of Zaptel source and"
|
||||
echo " run ./Setup again."
|
||||
|
@ -4965,8 +4970,8 @@ function tdmv_apply_zaptel_dchan_patch_old ()
|
|||
function tdmv_apply_zaptel_chunk_patch () {
|
||||
lhome=`pwd`
|
||||
TEMP=tmp
|
||||
cd $ZAPTEL_INSTALL_DIR
|
||||
echo "Applying Zaptel Chunk patch..."
|
||||
cd $ZAPTEL_SOURCE_DIR
|
||||
echo "Applying Zaptel Chunk patch..."
|
||||
echo " "
|
||||
#modify zaptel.h
|
||||
eval "cat zaptel.h | sed '/^#define ZT_CHUNKSIZE/c\#define ZT_CHUNKSIZE $ZAP_CHUNK' >$TEMP 2>/dev/null"
|
||||
|
@ -4984,6 +4989,7 @@ function tdmv_apply_zaptel_chunk_patch () {
|
|||
fi
|
||||
fi
|
||||
|
||||
cd $ZAPTEL_INSTALL_DIR
|
||||
#remove wct4xxp module from Makefile
|
||||
eval "cat Makefile |sed 's/wct1xxp wct4xxp wcte11xp/wct1xxp wcte11xp/g'>$TEMP 2>/dev/null "
|
||||
if [ $? -ne 0 ]; then
|
||||
|
@ -5052,7 +5058,7 @@ function tdmv_apply_zaptel_echo_debug_patch ()
|
|||
|
||||
#######################################################################################
|
||||
lhome=`pwd`
|
||||
cd $ZAPTEL_INSTALL_DIR
|
||||
cd $ZAPTEL_SOURCE_DIR
|
||||
|
||||
#check if some version of the patch is already installed in $ZAPTEL_C_FILE
|
||||
eval "grep \"GET_ECHO_SPIKE_SAMPLE\" $ZAPTEL_C_FILE > /dev/null 2> /dev/null"
|
||||
|
@ -5126,7 +5132,7 @@ function tdmv_apply_zaptel_edac_patch ()
|
|||
|
||||
lhome=`pwd`
|
||||
|
||||
cd $ZAPTEL_INSTALL_DIR
|
||||
cd $ZAPTEL_SOURCE_DIR
|
||||
|
||||
#check if some version of the patch is already installed
|
||||
eval "grep \"SANGOMA_GET_ED_STATE\" $ZAPTEL_C_FILE > /dev/null 2> /dev/null"
|
||||
|
@ -5139,7 +5145,7 @@ function tdmv_apply_zaptel_edac_patch ()
|
|||
|
||||
cp $PROD_HOME/edac/$EDAC_ZAP_PATCH_FILE .
|
||||
|
||||
#eval "patch -F 3 -c -d $ZAPTEL_INSTALL_DIR < $EDAC_ZAP_PATCH_FILE"
|
||||
#eval "patch -F 3 -c -d $ZAPTEL_SOURCE_DIR < $EDAC_ZAP_PATCH_FILE"
|
||||
eval "patch -p1 < $EDAC_ZAP_PATCH_FILE"
|
||||
rc=$?
|
||||
|
||||
|
@ -5417,7 +5423,7 @@ function find_zap_dirs ()
|
|||
continue
|
||||
fi
|
||||
|
||||
if [ ! -f $dir/zaptel.h ];then
|
||||
if [ ! -f $dir/zaptel.h ] && [ ! -f $dir/kernel/zaptel.h ];then
|
||||
continue;
|
||||
fi
|
||||
|
||||
|
@ -5481,9 +5487,9 @@ function find_zap_dirs ()
|
|||
read response
|
||||
|
||||
if [ "$response" = "" ]; then
|
||||
ZAPTEL_INSTALL_DIR=$ZAPTEL_DFLT_INSTALL_DIR
|
||||
ZAPTEL_SOURCE_DIR=$ZAPTEL_DFLT_INSTALL_DIR
|
||||
else
|
||||
ZAPTEL_INSTALL_DIR=$response
|
||||
ZAPTEL_SOURCE_DIR=$response
|
||||
fi
|
||||
|
||||
zapdir_manual=1
|
||||
|
@ -5493,14 +5499,22 @@ function find_zap_dirs ()
|
|||
# return 1;
|
||||
|
||||
elif [ $response -gt 0 ] && [ $response -lt $cnt ]; then
|
||||
ZAPTEL_INSTALL_DIR=${zapdir_array[$response]}
|
||||
ZAPTEL_SOURCE_DIR=${zapdir_array[$response]}
|
||||
else
|
||||
find_zap_dirs_invalid "$zapdirs"
|
||||
fi
|
||||
|
||||
if [ ! -f $ZAPTEL_INSTALL_DIR/zaptel.h ]; then
|
||||
#Check if this post Zaptel-1.4.9
|
||||
if [ -d $ZAPTEL_SOURCE_DIR/kernel ]; then
|
||||
ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR
|
||||
ZAPTEL_SOURCE_DIR=$ZAPTEL_SOURCE_DIR/kernel
|
||||
else
|
||||
ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR
|
||||
fi
|
||||
|
||||
if [ ! -f $ZAPTEL_SOURCE_DIR/zaptel.h ]; then
|
||||
echo
|
||||
echo "Error: zaptel.h not found in $ZAPTEL_INSTALL_DIR"
|
||||
echo "Error: zaptel.h not found in $ZAPTEL_SOURCE_DIR"
|
||||
echo
|
||||
echo
|
||||
zapdir_manual=0
|
||||
|
@ -5510,26 +5524,25 @@ function find_zap_dirs ()
|
|||
fi
|
||||
|
||||
if [ $find_zap_dir_quit -eq 1 ] ; then
|
||||
ZAPTEL_INSTALL_DIR=$ZAPTEL_DFLT_INSTALL_DIR
|
||||
ZAPTEL_SOURCE_DIR=$ZAPTEL_DFLT_INSTALL_DIR
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $zapdir_manual -eq 1 ]; then
|
||||
eval "grep \"$ZAPTEL_INSTALL_DIR\" $PROD_HOME/zaptel/zaptel.path 2> /dev/null > /dev/null "
|
||||
eval "grep \"$ZAPTEL_SOURCE_DIR\" $PROD_HOME/zaptel/zaptel.path 2> /dev/null > /dev/null "
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$ZAPTEL_INSTALL_DIR" >> $PROD_HOME/zaptel/zaptel.path
|
||||
echo "$ZAPTEL_SOURCE_DIR" >> $PROD_HOME/zaptel/zaptel.path
|
||||
fi
|
||||
fi
|
||||
|
||||
#echo "GO AUTOMATIC ZAPDIR= $ZAPTEL_INSTALL_DIR"
|
||||
#echo "GO AUTOMATIC ZAPDIR= $ZAPTEL_SOURCE_DIR"
|
||||
|
||||
ZAPTEL_PATH_OP="YES";
|
||||
|
||||
#zaptel.c renamed to zaptel-base.c in zaptel v1.2.13 and later
|
||||
if [ -e $ZAPTEL_INSTALL_DIR/zaptel-base.c ]; then
|
||||
if [ -e $ZAPTEL_SOURCE_DIR/zaptel-base.c ]; then
|
||||
ZAPTEL_C_FILE="zaptel-base.c";
|
||||
fi
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
@ -5844,7 +5857,7 @@ ENDOFTEXT
|
|||
echo "$PROTOCOL" | grep "TDM" > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
tdmv_get_zaptel_path
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ $? -eq 0 ]; then
|
||||
ZAP_MOD_DIR=/lib/modules/$(uname -r)
|
||||
|
||||
if [ $KERN_VER -eq 24 ]; then
|
||||
|
@ -5886,14 +5899,14 @@ ENDOFTEXT
|
|||
if [ $TDM_PROT != YES ]; then
|
||||
echo "Enabling the TDM Voice Asterisk Support"
|
||||
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE "
|
||||
ASTERISK_IFLAGS="-I$ZAPTEL_INSTALL_DIR"
|
||||
ASTERISK_IFLAGS="-I$ZAPTEL_SOURCE_DIR"
|
||||
WANCFG_ZAPTEL_CFG=YES
|
||||
fi
|
||||
|
||||
|
||||
#Check for new zaptel hw hdlc option
|
||||
if [ -f $ZAPTEL_INSTALL_DIR/zaptel-base.c ]; then
|
||||
eval "grep hdlc_hard_xmit $ZAPTEL_INSTALL_DIR/zaptel-base.c > /dev/null 2> /dev/null"
|
||||
if [ -f $ZAPTEL_SOURCE_DIR/zaptel-base.c ]; then
|
||||
eval "grep hdlc_hard_xmit $ZAPTEL_SOURCE_DIR/zaptel-base.c > /dev/null 2> /dev/null"
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo
|
||||
echo "Native Zaptel HW HDLC Support Detected - No patch required"
|
||||
|
@ -5911,7 +5924,7 @@ ENDOFTEXT
|
|||
|
||||
#Check if dchan patch is already enabled
|
||||
if [ "$TDM_DCHAN" = "" ]; then
|
||||
eval "grep ZT_DCHAN_TX_V2 $ZAPTEL_INSTALL_DIR/* 2> /dev/null > /dev/null"
|
||||
eval "grep ZT_DCHAN_TX_V2 $ZAPTEL_SOURCE_DIR/* 2> /dev/null > /dev/null"
|
||||
if [ $? -eq 0 ]; then
|
||||
TDM_DCHAN="(DCHAN)"
|
||||
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN"
|
||||
|
@ -5928,7 +5941,7 @@ ENDOFTEXT
|
|||
|
||||
PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN"
|
||||
echo
|
||||
eval "$PROD_HOME/patches/sangoma-zaptel-patch.sh $ZAPTEL_INSTALL_DIR"
|
||||
eval "$PROD_HOME/patches/sangoma-zaptel-patch.sh $ZAPTEL_SOURCE_DIR"
|
||||
result=$?
|
||||
if [ $result -eq 0 ]; then
|
||||
TDM_DCHAN="(DCHAN)"
|
||||
|
@ -5954,7 +5967,7 @@ ENDOFTEXT
|
|||
fi
|
||||
fi
|
||||
if [ $ZAP_CHUNK_OP == "YES" ] ; then
|
||||
tdmv_apply_zaptel_chunk_patch
|
||||
tdmv_apply_zaptel_chunk_patch
|
||||
fi
|
||||
|
||||
####################################################################
|
||||
|
@ -6328,7 +6341,7 @@ KERNEL_UNAME=`uname -r`
|
|||
PKG_NAME=wanpipe
|
||||
DISTR_NAME="WANPIPE"
|
||||
PROD=wanrouter
|
||||
PROD_VER=3.2.3
|
||||
PROD_VER=3.2.4
|
||||
PROD_HOME=`pwd`
|
||||
WAN_CONF_DIR=/etc/wanpipe
|
||||
META_CONF=$PROD_HOME/$PROD.rc
|
||||
|
@ -6413,7 +6426,8 @@ ANNEXG_LOAD=NO
|
|||
SCTP_LOAD=NO
|
||||
|
||||
ZAPTEL_DFLT_INSTALL_DIR="/usr/src/zaptel"
|
||||
ZAPTEL_INSTALL_DIR=$ZAPTEL_DFLT_INSTALL_DIR
|
||||
ZAPTEL_SOURCE_DIR=$ZAPTEL_DFLT_INSTALL_DIR #Location of Zaptel Source Files
|
||||
ZAPTEL_INSTALL_DIR="" #Location of Zaptel Install Files
|
||||
ZAPTEL_C_FILE="zaptel.c"
|
||||
ASTERISK_IFLAGS=
|
||||
EDAC_ZAP_PATCH_FILE=ed_zaptel.patch
|
||||
|
@ -6687,10 +6701,7 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then
|
|||
echo "Error invalid --zaptel-path option";
|
||||
exit 1;
|
||||
fi
|
||||
if [ ! -d "$ZAPTEL_INSTALL_DIR" ]; then
|
||||
echo "Error: Zaptel source directory not found: $ZAPTEL_INSTALL_DIR";
|
||||
exit 1;
|
||||
fi
|
||||
ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR
|
||||
if [ ! -f "$ZAPTEL_INSTALL_DIR/Makefile" ]; then
|
||||
echo "Error: Invalid zaptel source found in $ZAPTEL_INSTALL_DIR";
|
||||
exit 1;
|
||||
|
@ -6705,10 +6716,7 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then
|
|||
echo "Error invalid --with-zaptel option";
|
||||
exit 1;
|
||||
fi
|
||||
if [ ! -d "$ZAPTEL_INSTALL_DIR" ]; then
|
||||
echo "Error: Zaptel source directory not found: $ZAPTEL_INSTALL_DIR";
|
||||
exit 1;
|
||||
fi
|
||||
ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR
|
||||
if [ ! -f "$ZAPTEL_INSTALL_DIR/Makefile" ]; then
|
||||
echo "Error: Invalid zaptel source found in $ZAPTEL_INSTALL_DIR";
|
||||
exit 1;
|
||||
|
@ -6716,8 +6724,8 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then
|
|||
ZAPTEL_PATH_OP="YES";
|
||||
echo "Zaptel path defined as: $ZAPTEL_INSTALL_DIR"
|
||||
;;
|
||||
|
||||
--no-zaptel-compile*)
|
||||
|
||||
--no-zaptel-compile*)
|
||||
ZAPTEL_COMPILE_DISABLE="YES";
|
||||
;;
|
||||
|
||||
|
@ -6928,7 +6936,7 @@ following Environment variables.
|
|||
"
|
||||
|
||||
if [ $TDM_PROT = "YES" ]; then
|
||||
echo " 7. Zaptel Build Dir : $ZAPTEL_INSTALL_DIR "
|
||||
echo " 7. Zaptel Build Dir : $ZAPTEL_SOURCE_DIR "
|
||||
fi
|
||||
echo
|
||||
echo
|
||||
|
@ -6952,7 +6960,7 @@ you know what you are doing :)
|
|||
fi
|
||||
|
||||
if [ $TDM_PROT = "YES" ]; then
|
||||
$PROD_HOME/Setup install --silent --builddir=$PROD_HOME/$build_dir --with-linux=$SOURCEDIR --arch=$ARCH --protocol=$PROTS --ss7_user_id=$SS7_USER_ID --noautostart --no-zaptel-compile --zaptel-path=$ZAPTEL_INSTALL_DIR --usr-cc=$CC
|
||||
$PROD_HOME/Setup install --silent --builddir=$PROD_HOME/$build_dir --with-linux=$SOURCEDIR --arch=$ARCH --protocol=$PROTS --ss7_user_id=$SS7_USER_ID --noautostart --no-zaptel-compile --zaptel-path=$ZAPTEL_SOURCE_DIR --usr-cc=$CC
|
||||
else
|
||||
$PROD_HOME/Setup install --silent --builddir=$PROD_HOME/$build_dir --with-linux=$SOURCEDIR --arch=$ARCH --protocol=$PROTS --ss7_user_id=$SS7_USER_ID --noautostart --usr-cc=$CC
|
||||
fi
|
||||
|
|
|
@ -14,10 +14,11 @@ SYSINC=$(shell if [ -f ../../.sysinclude ]; then cat ../../.sysinclude; else ec
|
|||
ifeq "$(SYSINC)" ""
|
||||
SYSINC=/lib/modules/$(shell uname -r)/build/include
|
||||
endif
|
||||
SRCINC=../../patches/kdrivers/include
|
||||
VPATH = $(SYSINC)
|
||||
|
||||
# Tools options.
|
||||
CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I../lib/hdlc -I../lib -I$(SYSINC)
|
||||
CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I../lib/hdlc -I../lib -I$(SYSINC) -I$(SRCINC)
|
||||
|
||||
TARGETS = aft_tdm_voice_api
|
||||
TARGETS += aft_tdm_hdlc_test
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#define MAX_NUM_OF_TIMESLOTS 31*16
|
||||
|
||||
#define LGTH_CRC_BYTES 2
|
||||
#define MAX_TX_DATA 1000 //MAX_NUM_OF_TIMESLOTS*10 /* Size of tx data */
|
||||
#define MAX_TX_DATA 5000 //MAX_NUM_OF_TIMESLOTS*10 /* Size of tx data */
|
||||
#define MAX_TX_FRAMES 1000000 /* Number of frames to transmit */
|
||||
|
||||
#define WRITE 1
|
||||
|
@ -126,6 +126,7 @@ int MakeConnection(timeslot_t *slot, char *router_name )
|
|||
|
||||
int span,chan;
|
||||
sangoma_span_chan_fromif(slot->if_name,&span,&chan);
|
||||
printf("Socket bound %s to Span=%i Chan=%i\n\n",slot->if_name,span,chan);
|
||||
|
||||
if (span > 0 && chan > 0) {
|
||||
wanpipe_tdm_api_t tdm_api;
|
||||
|
@ -274,6 +275,8 @@ void process_con_rx(void)
|
|||
&Rx_data[sizeof(wp_tdm_api_rx_hdr_t)],
|
||||
sizeof(Rx_data), 0);
|
||||
|
||||
//printf("RX DATA HDLC: Len=%i\n",err-sizeof(wp_tdm_api_tx_hdr_t));
|
||||
//print_packet(&Rx_data[sizeof(wp_tdm_api_tx_hdr_t)],err-sizeof(wp_tdm_api_tx_hdr_t));
|
||||
/* err indicates bytes received */
|
||||
if(err > 0) {
|
||||
unsigned char *rx_frame =
|
||||
|
@ -390,7 +393,7 @@ void process_con_rx(void)
|
|||
|
||||
void process_con_tx(timeslot_t *slot)
|
||||
{
|
||||
unsigned int Tx_count, max_tx_len, Tx_length,Tx_hdlc_len;
|
||||
unsigned int Tx_count, max_tx_len, Tx_offset=0, Tx_length,Tx_hdlc_len, Tx_encoded_hdlc_len;
|
||||
fd_set write;
|
||||
int err=0,i,tx_ok=1;
|
||||
unsigned char Tx_data[MAX_TX_DATA + sizeof(wp_tdm_api_tx_hdr_t)];
|
||||
|
@ -415,9 +418,12 @@ void process_con_tx(timeslot_t *slot)
|
|||
}else{
|
||||
Tx_length = max_tx_len = sangoma_tdm_get_usr_mtu_mru(slot->sock, &tdm_api);
|
||||
}
|
||||
Tx_length=max_tx_len*0.75;
|
||||
|
||||
printf("MAX TX PACKET IS %i Tx Len = %i\n",max_tx_len,Tx_length);
|
||||
/* Send double of max so that a single big frame gets separated into two actual packets */
|
||||
Tx_hdlc_len=(max_tx_len*2);
|
||||
Tx_hdlc_len*= 0.75;
|
||||
|
||||
printf("MAX TX PACKET IS %i Tx Len = %i \n",max_tx_len,Tx_hdlc_len);
|
||||
|
||||
/* If running HDLC_STREAMING then the received CRC bytes
|
||||
* will be passed to the application as part of the
|
||||
|
@ -427,7 +433,7 @@ void process_con_tx(timeslot_t *slot)
|
|||
|
||||
memset(&Tx_data[0],0,MAX_TX_DATA + sizeof(wp_tdm_api_tx_hdr_t));
|
||||
slot->data=1;
|
||||
for (i=0;i<Tx_length;i++){
|
||||
for (i=0;i<Tx_hdlc_len;i++){
|
||||
if (slot->data){
|
||||
Tx_data[i+sizeof(wp_tdm_api_tx_hdr_t)] = slot->data;
|
||||
}else{
|
||||
|
@ -446,7 +452,7 @@ void process_con_tx(timeslot_t *slot)
|
|||
*/
|
||||
|
||||
printf("%s: Tx Starting to write on sock %i data (0x%X) f=%x l=%x hdr_sz=%i\n",
|
||||
slot->if_name,slot->sock,slot->data,Tx_data[16],Tx_data[Tx_length+sizeof(wp_tdm_api_tx_hdr_t)-1],
|
||||
slot->if_name,slot->sock,slot->data,Tx_data[16],Tx_data[Tx_hdlc_len+sizeof(wp_tdm_api_tx_hdr_t)-1],
|
||||
sizeof(wp_tdm_api_tx_hdr_t));
|
||||
|
||||
|
||||
|
@ -471,42 +477,44 @@ void process_con_tx(timeslot_t *slot)
|
|||
/* If we got busy on last frame repeat the frame */
|
||||
if (tx_ok == 1){
|
||||
#if 0
|
||||
printf("TX DATA ORIG: Len=%i\n",Tx_length);
|
||||
print_packet(&Tx_data[sizeof(wp_tdm_api_tx_hdr_t)],Tx_length);
|
||||
printf("TX DATA ORIG: Len=%i\n",Tx_hdlc_len);
|
||||
print_packet(&Tx_data[sizeof(wp_tdm_api_tx_hdr_t)],Tx_hdlc_len);
|
||||
#endif
|
||||
wanpipe_hdlc_encode(hdlc_eng,&Tx_data[16],Tx_length,&Tx_hdlc_data[16],&Tx_hdlc_len,&next_idle);
|
||||
wanpipe_hdlc_encode(hdlc_eng,&Tx_data[16],Tx_hdlc_len,&Tx_hdlc_data[16],(int*)&Tx_encoded_hdlc_len,&next_idle);
|
||||
if (Tx_encoded_hdlc_len < (max_tx_len*2)){
|
||||
int j;
|
||||
for (j=0;j<((max_tx_len*2) - Tx_encoded_hdlc_len);j++){
|
||||
Tx_hdlc_data[16+Tx_encoded_hdlc_len+j]=next_idle;
|
||||
}
|
||||
Tx_encoded_hdlc_len+=j;
|
||||
}
|
||||
#if 0
|
||||
printf("TX DATA HDLC: Olen=%i Len=%i\n",Tx_length,Tx_hdlc_len);
|
||||
print_packet(&Tx_hdlc_data[sizeof(wp_tdm_api_tx_hdr_t)],Tx_hdlc_len);
|
||||
printf("TX DATA HDLC: Olen=%i Len=%i\n",Tx_hdlc_len,Tx_encoded_hdlc_len);
|
||||
print_packet(&Tx_hdlc_data[sizeof(wp_tdm_api_tx_hdr_t)],Tx_encoded_hdlc_len);
|
||||
#endif
|
||||
if (Tx_hdlc_len < max_tx_len){
|
||||
int j;
|
||||
for (j=0;j<(max_tx_len - Tx_hdlc_len);j++){
|
||||
Tx_hdlc_data[16+Tx_hdlc_len+j]=next_idle;
|
||||
if (Tx_encoded_hdlc_len > (max_tx_len*2)){
|
||||
printf("Tx hdlc len > max %i\n",Tx_encoded_hdlc_len);
|
||||
continue;
|
||||
}
|
||||
Tx_hdlc_len+=j;
|
||||
}else if (Tx_hdlc_len > max_tx_len) {
|
||||
/* Skip this frame only happends on very first tx
|
||||
Something is weird with the hdlc engine... otherwise
|
||||
rest of the frames are good */
|
||||
tx_ok=1;
|
||||
continue;
|
||||
}
|
||||
|
||||
Tx_length=max_tx_len;
|
||||
Tx_offset=0;
|
||||
//printf("INITIAL Fragment Chunk tx! %i Tx_encoded =%i \n", Tx_offset,Tx_encoded_hdlc_len);
|
||||
|
||||
#if 0
|
||||
if ((Tx_count % 60) == 0){
|
||||
Tx_hdlc_len++; /* Introduce Error */
|
||||
}
|
||||
if ((Tx_count % 60) == 0){
|
||||
Tx_hdlc_len++; /* Introduce Error */
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
printf("Data %i\n",Tx_hdlc_len);
|
||||
for (i=0;i<Tx_hdlc_len;i++){
|
||||
printf(" 0x%X",Tx_hdlc_data[16+i]);
|
||||
}
|
||||
printf("\n");
|
||||
printf("Data %i\n",Tx_hdlc_len);
|
||||
for (i=0;i<Tx_hdlc_len;i++){
|
||||
printf(" 0x%X",Tx_hdlc_data[16+i]);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
tx_ok=0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(select(slot->sock + 1,NULL, &write, NULL, NULL)){
|
||||
|
||||
|
@ -516,18 +524,36 @@ void process_con_tx(timeslot_t *slot)
|
|||
#if 1
|
||||
err=sangoma_writemsg_tdm(slot->sock,
|
||||
Tx_hdlc_data, sizeof(wp_tdm_api_tx_hdr_t),
|
||||
&Tx_hdlc_data[sizeof(wp_tdm_api_tx_hdr_t)],
|
||||
Tx_hdlc_len,0);
|
||||
&Tx_hdlc_data[sizeof(wp_tdm_api_tx_hdr_t)+Tx_offset],
|
||||
Tx_length,0);
|
||||
#endif
|
||||
if (err > 0){
|
||||
/* Packet sent ok */
|
||||
//printf("\t\t%s:Packet sent: Len=%i Data=0x%x : %i\n",
|
||||
// slot->if_name,err,slot->data,++Tx_count);
|
||||
//putchar('T');
|
||||
|
||||
Tx_offset+=Tx_length;
|
||||
|
||||
if (Tx_offset >= Tx_encoded_hdlc_len){
|
||||
//printf("LAST Chunk tx! %i \n", Tx_offset);
|
||||
Tx_offset=0;
|
||||
Tx_length=max_tx_len;
|
||||
/* Last fragment transmitted */
|
||||
/* pass throught */
|
||||
} else {
|
||||
Tx_length = Tx_encoded_hdlc_len - Tx_length;
|
||||
if (Tx_length > max_tx_len) {
|
||||
Tx_length=max_tx_len;
|
||||
}
|
||||
// printf("MIDDLE Fragment Chunk tx! %i \n", Tx_offset);
|
||||
continue;
|
||||
}
|
||||
|
||||
#if RAND_FRAME
|
||||
if (Tx_count%10 == 0){
|
||||
Tx_length=myrand(max_tx_len*0.75);
|
||||
for (i=0;i<Tx_length;i++){
|
||||
Tx_hdlc_len=myrand(max_tx_len*2*0.75);
|
||||
for (i=0;i<Tx_hdlc_len;i++){
|
||||
Tx_data[i+sizeof(wp_tdm_api_tx_hdr_t)] = myrand(255);
|
||||
}
|
||||
mysrand(myrand(255));
|
||||
|
|
|
@ -0,0 +1,368 @@
|
|||
/*****************************************************************************
|
||||
* bstrm_hdlc_test_multi.c: Multiple Bstrm Test Receive Module
|
||||
*
|
||||
* Author(s): Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 1995-2006 Sangoma Technologies Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
* Description:
|
||||
*
|
||||
* The chdlc_api.c utility will bind to a socket to a chdlc network
|
||||
* interface, and continously tx and rx packets to an from the sockets.
|
||||
*
|
||||
* This example has been written for a single interface in mind,
|
||||
* where the same process handles tx and rx data.
|
||||
*
|
||||
* A real world example, should use different processes to handle
|
||||
* tx and rx spearately.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if_wanpipe.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <wait.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
#include <linux/wanpipe.h>
|
||||
#include <linux/wanpipe_tdm_api.h>
|
||||
#include <libsangoma.h>
|
||||
#include <wanpipe_hdlc.h>
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
/* Enable/Disable tx of random frames */
|
||||
#define RAND_FRAME 1
|
||||
|
||||
#define MAX_NUM_OF_TIMESLOTS 31*16
|
||||
|
||||
#define LGTH_CRC_BYTES 2
|
||||
#define MAX_TX_DATA 1000 //MAX_NUM_OF_TIMESLOTS*10 /* Size of tx data */
|
||||
#define MAX_TX_FRAMES 1000000 /* Number of frames to transmit */
|
||||
|
||||
#define WRITE 1
|
||||
#define MAX_IF_NAME 20
|
||||
typedef struct {
|
||||
|
||||
int sock;
|
||||
int rx_cnt;
|
||||
int tx_cnt;
|
||||
int data;
|
||||
int last_error;
|
||||
int frames;
|
||||
char if_name[MAX_IF_NAME+1];
|
||||
|
||||
} timeslot_t;
|
||||
|
||||
|
||||
timeslot_t tslot_array[MAX_NUM_OF_TIMESLOTS];
|
||||
|
||||
int tx_change_data=0, tx_change_data_cnt=0;
|
||||
int end=0;
|
||||
|
||||
|
||||
void print_packet(unsigned char *buf, int len)
|
||||
{
|
||||
int x;
|
||||
printf("{ | ");
|
||||
for (x=0;x<len;x++){
|
||||
if (x && x%24 == 0){
|
||||
printf("\n ");
|
||||
}
|
||||
if (x && x%8 == 0)
|
||||
printf(" | ");
|
||||
printf("%02x ",buf[x]);
|
||||
}
|
||||
printf("}\n");
|
||||
}
|
||||
|
||||
void sig_end(int sigid)
|
||||
{
|
||||
printf("%d: Got Signal %i\n",getpid(),sigid);
|
||||
end=1;
|
||||
}
|
||||
|
||||
|
||||
static unsigned long next = 1;
|
||||
|
||||
/* RAND_MAX assumed to be 32767 */
|
||||
int myrand(int max_rand) {
|
||||
next = next * 1103515245 + 12345;
|
||||
return((unsigned)(next/65536) % max_rand);
|
||||
}
|
||||
|
||||
void mysrand(unsigned seed) {
|
||||
next = seed;
|
||||
}
|
||||
|
||||
|
||||
/*===================================================
|
||||
* MakeConnection
|
||||
*
|
||||
* o Create a Socket
|
||||
* o Bind a socket to a wanpipe network interface
|
||||
* (Interface name is supplied by the user)
|
||||
*==================================================*/
|
||||
|
||||
int MakeConnection(timeslot_t *slot, char *router_name )
|
||||
{
|
||||
|
||||
int span,chan;
|
||||
sangoma_span_chan_fromif(slot->if_name,&span,&chan);
|
||||
|
||||
if (span > 0 && chan > 0) {
|
||||
wanpipe_tdm_api_t tdm_api;
|
||||
slot->sock = sangoma_open_tdmapi_span_chan(span,chan);
|
||||
if( slot->sock < 0 ) {
|
||||
perror("Open Span Chan: ");
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
sangoma_tdm_set_codec(slot->sock,&tdm_api,WP_NONE);
|
||||
|
||||
|
||||
printf("Socket bound to Span=%i Chan=%i\n\n",span,chan);
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
int api_tdm_fe_alarms_callback(int fd, unsigned char alarm)
|
||||
{
|
||||
int fd_found=0;
|
||||
int i;
|
||||
for (i=0;i<MAX_NUM_OF_TIMESLOTS;i++){
|
||||
if (tslot_array[i].sock == fd) {
|
||||
fd_found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (fd_found) {
|
||||
printf ("FE ALARMS Call back found device %i Alarm=%i \n",
|
||||
fd,alarm);
|
||||
|
||||
} else {
|
||||
printf ("FE ALARMS Call back no device Alarm=%i\n",alarm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ALL_OK 0
|
||||
#define BOARD_UNDERRUN 1
|
||||
#define TX_ISR_UNDERRUN 2
|
||||
#define UNKNOWN_ERROR 4
|
||||
|
||||
void process_con_rx(void)
|
||||
{
|
||||
unsigned int Rx_count;
|
||||
fd_set oob,ready;
|
||||
int err,serr,i,slots=0;
|
||||
unsigned char Rx_data[1600];
|
||||
int error_bit=0, error_crc=0, error_abort=0, error_frm=0;
|
||||
struct timeval tv;
|
||||
int frame=0;
|
||||
int max_fd=0, packets=0;
|
||||
timeslot_t *slot=NULL;
|
||||
wanpipe_tdm_api_t tdm_api;
|
||||
|
||||
memset(&tdm_api,0,sizeof(tdm_api));
|
||||
|
||||
tdm_api.wp_tdm_event.wp_fe_alarm_event = &api_tdm_fe_alarms_callback;
|
||||
|
||||
|
||||
i=0;
|
||||
for (i=0;i<MAX_NUM_OF_TIMESLOTS;i++){
|
||||
|
||||
if (tslot_array[i].sock < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tslot_array[i].sock > max_fd){
|
||||
max_fd=tslot_array[i].sock;
|
||||
}
|
||||
}
|
||||
i=0;
|
||||
|
||||
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = 10;
|
||||
|
||||
Rx_count = 0;
|
||||
|
||||
for(;;) {
|
||||
|
||||
FD_ZERO(&ready);
|
||||
FD_ZERO(&oob);
|
||||
max_fd=0;
|
||||
for (i=0;i<MAX_NUM_OF_TIMESLOTS;i++){
|
||||
|
||||
if (tslot_array[i].sock < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FD_SET(tslot_array[i].sock,&ready);
|
||||
FD_SET(tslot_array[i].sock,&oob);
|
||||
if (tslot_array[i].sock > max_fd){
|
||||
max_fd=tslot_array[i].sock;
|
||||
}
|
||||
}
|
||||
|
||||
tv.tv_usec = 0;
|
||||
tv.tv_sec = 10;
|
||||
|
||||
if (end){
|
||||
break;
|
||||
}
|
||||
|
||||
/* The select function must be used to implement flow control.
|
||||
* WANPIPE socket will block the user if the socket cannot send
|
||||
* or there is nothing to receive.
|
||||
*
|
||||
* By using the last socket file descriptor +1 select will wait
|
||||
* for all active sockets.
|
||||
*/
|
||||
slots=0;
|
||||
if((serr=select(max_fd + 1, &ready, NULL, &oob, &tv))){
|
||||
|
||||
for (i=0;i<MAX_NUM_OF_TIMESLOTS;i++){
|
||||
|
||||
if (tslot_array[i].sock < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
slots++;
|
||||
slot=&tslot_array[i];
|
||||
|
||||
if (FD_ISSET(slot->sock,&oob)){
|
||||
sangoma_tdm_read_event(slot->sock,&tdm_api);
|
||||
}
|
||||
|
||||
|
||||
/* Check for rx packets */
|
||||
if (FD_ISSET(slot->sock,&ready)){
|
||||
|
||||
err = sangoma_readmsg_tdm(slot->sock,
|
||||
Rx_data,sizeof(wp_tdm_api_rx_hdr_t),
|
||||
&Rx_data[sizeof(wp_tdm_api_rx_hdr_t)],
|
||||
sizeof(Rx_data), 0);
|
||||
|
||||
/* err indicates bytes received */
|
||||
if(err > 0) {
|
||||
sangoma_writemsg_tdm(tslot_array[i==1?2:1].sock,
|
||||
Rx_data,sizeof(wp_tdm_api_rx_hdr_t),
|
||||
&Rx_data[sizeof(wp_tdm_api_rx_hdr_t)],
|
||||
err, 0);
|
||||
|
||||
} else {
|
||||
printf("\n%s: Error receiving data\n",slot->if_name);
|
||||
}
|
||||
|
||||
} /* If rx */
|
||||
|
||||
} /* for all slots */
|
||||
|
||||
|
||||
} else {
|
||||
printf("\n: Error selecting rx socket rc=0x%x errno=0x%x\n",
|
||||
serr,errno);
|
||||
perror("Select: ");
|
||||
//break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
printf("\nRx Unloading HDLC\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************************
|
||||
* Main:
|
||||
*
|
||||
* o Make a socket connection to the driver.
|
||||
* o Call process_con() to read/write the socket
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int proceed;
|
||||
char router_name[20];
|
||||
int x,i;
|
||||
|
||||
if (argc < 3){
|
||||
printf("Usage: rec_wan_sock <router name> <interface name> <data> ...\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
nice(-11);
|
||||
|
||||
signal(SIGINT,&sig_end);
|
||||
signal(SIGTERM,&sig_end);
|
||||
|
||||
memset(&tslot_array,0,sizeof(tslot_array));
|
||||
for (i=0;i<MAX_NUM_OF_TIMESLOTS;i++){
|
||||
tslot_array[i].sock=-1;
|
||||
}
|
||||
|
||||
strncpy(router_name,argv[1],(sizeof(router_name)-1));
|
||||
|
||||
|
||||
for (x=1;x<argc-1;x++) {
|
||||
|
||||
strncpy(tslot_array[x].if_name, argv[x+1], MAX_IF_NAME);
|
||||
printf("Connecting to IF=%s\n",tslot_array[x].if_name);
|
||||
|
||||
#if 1
|
||||
proceed = MakeConnection(&tslot_array[x],router_name);
|
||||
if( proceed == TRUE ){
|
||||
|
||||
printf("Creating %s with tx data 0x%x : Sock=%i : x=%i\n",
|
||||
tslot_array[x].if_name,
|
||||
tslot_array[x].data,
|
||||
tslot_array[x].sock,
|
||||
x);
|
||||
}else{
|
||||
if (tslot_array[x].sock){
|
||||
close(tslot_array[x].sock);
|
||||
}
|
||||
tslot_array[x].sock=-1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
process_con_rx();
|
||||
|
||||
for (x=0;x<MAX_NUM_OF_TIMESLOTS;x++){
|
||||
if (tslot_array[x].sock){
|
||||
close(tslot_array[x].sock);
|
||||
tslot_array[x].sock=0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Wait for the clear call children */
|
||||
return 0;
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
Package: wanpipe
|
||||
Version: 3.2.3-0
|
||||
Version: 3.2.4-0
|
||||
Section: networking
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
|
|
Binary file not shown.
|
@ -1,774 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* sdla_adccp.h Sangoma HDLC LAPB firmware API definitions.
|
||||
*
|
||||
* Author: Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 1995-2003 Sangoma Technologies Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
* Apr 30, 2003 Nenad Corbic Initial Version
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _SDLA_ADCCP_H
|
||||
#define _SDLA_ADCCP_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Notes:
|
||||
* ------
|
||||
* 1. All structures defined in this file are byte-alined.
|
||||
* Compiler Platform
|
||||
* -------- --------
|
||||
* GNU C Linux
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma pack(1)
|
||||
/****** CONSTANTS DEFINITIONS ***********************************************/
|
||||
|
||||
#define X25_MAX_CHAN 255 /* max number of open X.25 circuits */
|
||||
#define X25_MAX_DATA 1024 /* max length of X.25 data buffer */
|
||||
/*
|
||||
* X.25 shared memory layout.
|
||||
*/
|
||||
#define X25_MBOX_OFFS 0x16B0 /* general mailbox block */
|
||||
#define X25_RXMBOX_OFFS 0x1AD0 /* receive mailbox */
|
||||
#define X25_STATUS_OFFS 0x1EF8 /* X.25 status structure */
|
||||
|
||||
#define X25_MB_VECTOR 0xE000 /* S514 mailbox window vecotr */
|
||||
#define X25_MISC_HDLC_BITS 0x1EFF /*X.25 miscallaneous HDLC bits */
|
||||
|
||||
/* code levels */
|
||||
#define HDLC_LEVEL 0x01
|
||||
#define X25_LEVEL 0x02
|
||||
#define X25_AND_HDLC_LEVEL 0x03
|
||||
#define DO_HDLC_LEVEL_ERROR_CHECKING 0x04
|
||||
|
||||
/****** DATA STRUCTURES *****************************************************/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X.25 Command Block.
|
||||
*/
|
||||
typedef struct X25Cmd
|
||||
{
|
||||
unsigned char command PACKED; /* command code */
|
||||
unsigned short length PACKED; /* transfer data length */
|
||||
unsigned char result PACKED; /* return code */
|
||||
unsigned char pf PACKED; /* P/F bit */
|
||||
unsigned short lcn PACKED; /* logical channel */
|
||||
unsigned char qdm PACKED; /* Q/D/M bits */
|
||||
unsigned char cause PACKED; /* cause field */
|
||||
unsigned char diagn PACKED; /* diagnostics */
|
||||
unsigned char pktType PACKED; /* packet type */
|
||||
unsigned char resrv[4] PACKED; /* reserved */
|
||||
} TX25Cmd;
|
||||
|
||||
/*
|
||||
* Defines for the 'command' field.
|
||||
*/
|
||||
/*----- General commands --------------*/
|
||||
#define X25_SET_GLOBAL_VARS 0x0B /* set global variables */
|
||||
#define X25_READ_MODEM_STATUS 0x0C /* read modem status */
|
||||
#define X25_READ_CODE_VERSION 0x15 /* read firmware version number */
|
||||
#define X25_TRACE_CONFIGURE 0x14 /* configure trace facility */
|
||||
#define X25_READ_TRACE_DATA 0x16 /* read trace data */
|
||||
#define X25_SET_INTERRUPT_MODE 0x17 /* set interrupt generation mode */
|
||||
#define X25_READ_INTERRUPT_MODE 0x18 /* read interrupt generation mode */
|
||||
/*----- HDLC-level commands -----------*/
|
||||
#define X25_HDLC_LINK_CONFIGURE 0x01 /* configure HDLC link level */
|
||||
#define X25_HDLC_LINK_OPEN 0x02 /* open HDLC link */
|
||||
#define X25_HDLC_LINK_CLOSE 0x03 /* close HDLC link */
|
||||
#define X25_HDLC_LINK_SETUP 0x04 /* set up HDLC link */
|
||||
#define X25_HDLC_LINK_DISC 0x05 /* disconnect DHLC link */
|
||||
#define X25_HDLC_LINK_STATUS 0x06 /* read DHLC link status */
|
||||
#define X25_HDLC_READ_STATS 0x07 /* read operational statistics */
|
||||
#define X25_HDLC_FLUSH_STATS 0x08 /* flush operational statistics */
|
||||
#define X25_HDLC_READ_COMM_ERR 0x09 /* read error statistics */
|
||||
#define X25_HDLC_FLUSH_COMM_ERR 0x0A /* flush error statistics */
|
||||
#define X25_HDLC_FLUSH_BUFFERS 0x0D /* flush HDLC-level data buffers */
|
||||
#define X25_HDLC_SPRVS_CNT_STAT 0x0F /* read surervisory count status */
|
||||
#define X25_HDLC_SEND_UI_FRAME 0x10 /* send unnumbered information frame */
|
||||
#define X25_HDLC_WRITE 0x11 /* send HDLC information frame */
|
||||
#define X25_HDLC_READ 0x21 /* read HDLC information frame */
|
||||
#define X25_HDLC_READ_CONFIG 0x12 /* read HDLC configuration */
|
||||
#define X25_HDLC_SET_CONFIG 0x13 /* set HDLC configuration */
|
||||
#define SET_PROTOCOL_LEVEL 0x1F /* set protocol level */
|
||||
/*----- X.25-level commands -----------*/
|
||||
#define X25_READ 0x22 /* read X.25 packet */
|
||||
#define X25_WRITE 0x23 /* send X.25 packet */
|
||||
#define X25_PLACE_CALL 0x30 /* place a call on SVC */
|
||||
#define X25_ACCEPT_CALL 0x31 /* accept incomming call */
|
||||
#define X25_CLEAR_CALL 0x32 /* clear call */
|
||||
#define X25_CLEAR_CONFRM 0x33 /* send clear confirmation packet */
|
||||
#define X25_RESET 0x34 /* send reset request packet */
|
||||
#define X25_RESET_CONFRM 0x35 /* send reset confirmation packet */
|
||||
#define X25_RESTART 0x36 /* send restart request packet */
|
||||
#define X25_RESTART_CONFRM 0x37 /* send restart confirmation packet */
|
||||
#define X25_WP_INTERRUPT 0x38 /* send interrupt request packet */
|
||||
#define X25_INTERRUPT_CONFRM 0x39 /* send interrupt confirmation pkt */
|
||||
#define X25_REGISTRATION_RQST 0x3A /* send registration request packet */
|
||||
#define X25_REGISTRATION_CONFRM 0x3B /* send registration confirmation */
|
||||
#define X25_IS_DATA_AVAILABLE 0x40 /* querry receive queue */
|
||||
#define X25_INCOMMING_CALL_CTL 0x41 /* select incomming call options */
|
||||
#define X25_CONFIGURE_PVC 0x42 /* configure PVC */
|
||||
#define X25_GET_ACTIVE_CHANNELS 0x43 /* get a list of active circuits */
|
||||
#define X25_READ_CHANNEL_CONFIG 0x44 /* read virt. circuit configuration */
|
||||
#define X25_FLUSH_DATA_BUFFERS 0x45 /* flush X.25-level data buffers */
|
||||
#define X25_READ_HISTORY_TABLE 0x46 /* read asynchronous event log */
|
||||
#define X25_HISTORY_TABLE_CTL 0x47 /* control asynchronous event log */
|
||||
#define X25_GET_TX_D_BIT_STATUS 0x48 /* is packet with D-bit acknowleged */
|
||||
#define X25_READ_STATISTICS 0x49 /* read X.25-level statistics */
|
||||
#define X25_FLUSH_STATISTICS 0x4A /* flush X.25-level statistics */
|
||||
#define X25_READ_CONFIGURATION 0x50 /* read HDLC & X.25 configuration */
|
||||
#define X25_SET_CONFIGURATION 0x51 /* set HDLC & X.25 configuration */
|
||||
|
||||
/*
|
||||
* Defines for the 'result' field.
|
||||
*/
|
||||
/*----- General results ---------------*/
|
||||
#define X25RES_OK 0x00
|
||||
#define X25RES_ERROR 0x01
|
||||
#define X25RES_LINK_NOT_IN_ABM 0x02 /* link is not in ABM mode */
|
||||
#define X25RES_LINK_CLOSED 0x03
|
||||
#define X25RES_INVAL_LENGTH 0x04
|
||||
#define X25RES_INVAL_CMD 0x05
|
||||
#define X25RES_UNNUMBERED_FRAME 0x06 /* unnunbered frame received */
|
||||
#define X25RES_FRM_REJECT_MODE 0x07 /* link is in Frame Reject mode */
|
||||
#define X25RES_MODEM_FAILURE 0x08 /* DCD and/or CTS dropped */
|
||||
#define X25RES_N2_RETRY_LIMIT 0x09 /* N2 retry limit has been exceeded */
|
||||
#define X25RES_INVAL_LCN 0x30 /* invalid logical channel number */
|
||||
#define X25RES_INVAL_STATE 0x31 /* channel is not in data xfer mode */
|
||||
#define X25RES_INVAL_DATA_LEN 0x32 /* invalid data length */
|
||||
#define X25RES_NOT_READY 0x33 /* no data available / buffers full */
|
||||
#define X25RES_NETWORK_DOWN 0x34
|
||||
#define X25RES_CHANNEL_IN_USE 0x35 /* there is data queued on this LCN */
|
||||
#define X25RES_REGST_NOT_SUPPRT 0x36 /* registration not supported */
|
||||
#define X25RES_INVAL_FORMAT 0x37 /* invalid packet format */
|
||||
#define X25RES_D_BIT_NOT_SUPPRT 0x38 /* D-bit pragmatics not supported */
|
||||
#define X25RES_FACIL_NOT_SUPPRT 0x39 /* Call facility not supported */
|
||||
#define X25RES_INVAL_CALL_ARG 0x3A /* errorneous call arguments */
|
||||
#define X25RES_INVAL_CALL_DATA 0x3B /* errorneous call user data */
|
||||
#define X25RES_ASYNC_PACKET 0x40 /* asynchronous packet received */
|
||||
#define X25RES_PROTO_VIOLATION 0x41 /* protocol violation occured */
|
||||
#define X25RES_PKT_TIMEOUT 0x42 /* X.25 packet time out */
|
||||
#define X25RES_PKT_RETRY_LIMIT 0x43 /* X.25 packet retry limit exceeded */
|
||||
/*----- Command-dependant results -----*/
|
||||
#define X25RES_LINK_DISC 0x00 /* HDLC_LINK_STATUS */
|
||||
#define X25RES_LINK_IN_ABM 0x01 /* HDLC_LINK_STATUS */
|
||||
#define X25RES_NO_DATA 0x01 /* HDLC_READ/READ_TRACE_DATA*/
|
||||
#define X25RES_TRACE_INACTIVE 0x02 /* READ_TRACE_DATA */
|
||||
#define X25RES_LINK_IS_OPEN 0x01 /* HDLC_LINK_OPEN */
|
||||
#define X25RES_LINK_IS_DISC 0x02 /* HDLC_LINK_DISC */
|
||||
#define X25RES_LINK_IS_CLOSED 0x03 /* HDLC_LINK_CLOSE */
|
||||
#define X25RES_INVAL_PARAM 0x31 /* INCOMMING_CALL_CTL */
|
||||
#define X25RES_INVAL_CONFIG 0x35 /* REGISTR_RQST/CONFRM */
|
||||
|
||||
/*
|
||||
* Defines for the 'qdm_bits' field.
|
||||
*/
|
||||
#define X25CMD_Q_BIT_MASK 0x04
|
||||
#define X25CMD_D_BIT_MASK 0x02
|
||||
#define X25CMD_M_BIT_MASK 0x01
|
||||
|
||||
/*
|
||||
* Defines for the 'pkt_type' field.
|
||||
*/
|
||||
/*----- Asynchronous events ------*/
|
||||
#define ASE_CLEAR_RQST 0x02
|
||||
#define ASE_RESET_RQST 0x04
|
||||
#define ASE_RESTART_RQST 0x08
|
||||
#define ASE_INTERRUPT 0x10
|
||||
#define ASE_DTE_REGISTR_RQST 0x20
|
||||
#define ASE_CALL_RQST 0x30
|
||||
#define ASE_CALL_ACCEPTED 0x31
|
||||
#define ASE_CLEAR_CONFRM 0x32
|
||||
#define ASE_RESET_CONFRM 0x33
|
||||
#define ASE_RESTART_CONFRM 0x34
|
||||
#define ASE_INTERRUPT_CONFRM 0x35
|
||||
#define ASE_DCE_REGISTR_CONFRM 0x36
|
||||
#define ASE_DIAGNOSTIC 0x37
|
||||
#define ASE_CALL_AUTO_CLEAR 0x38
|
||||
#define AUTO_RESPONSE_FLAG 0x80
|
||||
/*----- Time-Out events ----------*/
|
||||
#define TOE_RESTART_RQST 0x03
|
||||
#define TOE_CALL_RQST 0x05
|
||||
#define TOE_CLEAR_RQST 0x08
|
||||
#define TOE_RESET_RQST 0x0A
|
||||
/*----- Protocol Violation events */
|
||||
#define PVE_CLEAR_RQST 0x32
|
||||
#define PVE_RESET_RQST 0x33
|
||||
#define PVE_RESTART_RQST 0x34
|
||||
#define PVE_DIAGNOSTIC 0x37
|
||||
|
||||
#define INTR_ON_RX_FRAME 0x01
|
||||
#define INTR_ON_TX_FRAME 0x02
|
||||
#define INTR_ON_MODEM_STATUS_CHANGE 0x04
|
||||
#define INTR_ON_COMMAND_COMPLETE 0x08
|
||||
#define INTR_ON_X25_ASY_TRANSACTION 0x10
|
||||
#define INTR_ON_TIMER 0x40
|
||||
#define DIRECT_RX_INTR_USAGE 0x80
|
||||
|
||||
#define NO_INTR_PENDING 0x00
|
||||
#define RX_INTR_PENDING 0x01
|
||||
#define TX_INTR_PENDING 0x02
|
||||
#define MODEM_INTR_PENDING 0x04
|
||||
#define COMMAND_COMPLETE_INTR_PENDING 0x08
|
||||
#define X25_ASY_TRANS_INTR_PENDING 0x10
|
||||
#define TIMER_INTR_PENDING 0x40
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X.25 Mailbox.
|
||||
* This structure is located at offsets X25_MBOX_OFFS and X25_RXMBOX_OFFS
|
||||
* into shared memory window.
|
||||
*/
|
||||
typedef struct X25Mbox
|
||||
{
|
||||
unsigned char opflag PACKED; /* 00h: execution flag */
|
||||
TX25Cmd cmd PACKED; /* 01h: command block */
|
||||
unsigned char data[1] PACKED; /* 10h: data buffer */
|
||||
} TX25Mbox;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X.25 Time Stamp Structure.
|
||||
*/
|
||||
typedef struct X25TimeStamp
|
||||
{
|
||||
unsigned char month PACKED;
|
||||
unsigned char date PACKED;
|
||||
unsigned char sec PACKED;
|
||||
unsigned char min PACKED;
|
||||
unsigned char hour PACKED;
|
||||
} TX25TimeStamp;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X.25 Status Block.
|
||||
* This structure is located at offset X25_STATUS_OFF into shared memory
|
||||
* window.
|
||||
*/
|
||||
typedef struct X25Status
|
||||
{
|
||||
TX25TimeStamp tstamp PACKED; /* 08h: timestamp (BCD) */
|
||||
unsigned char iflags PACKED; /* 0Dh: interrupt flags */
|
||||
unsigned char imask PACKED; /* 0Eh: interrupt mask */
|
||||
unsigned char hdlc_status PACKED; /* 10h: misc. HDLC/X25 flags */
|
||||
unsigned char ghdlc_status PACKED; /* channel status bytes */
|
||||
} TX25Status;
|
||||
|
||||
/*
|
||||
* Bitmasks for the 'iflags' field.
|
||||
*/
|
||||
#define X25_RX_INTR 0x01 /* receive interrupt */
|
||||
#define X25_TX_INTR 0x02 /* transmit interrupt */
|
||||
#define X25_MODEM_INTR 0x04 /* modem status interrupt (CTS/DCD) */
|
||||
#define X25_EVENT_INTR 0x10 /* asyncronous event encountered */
|
||||
#define X25_CMD_INTR 0x08 /* interface command complete */
|
||||
|
||||
/*
|
||||
* Bitmasks for the 'gflags' field.
|
||||
*/
|
||||
#define X25_HDLC_ABM 0x01 /* HDLC is in ABM mode */
|
||||
#define X25_RX_READY 0x02 /* X.25 data available */
|
||||
#define X25_TRACE_READY 0x08 /* trace data available */
|
||||
#define X25_EVENT_IND 0x20 /* asynchronous event indicator */
|
||||
#define X25_TX_READY 0x40 /* space is available in Tx buf.*/
|
||||
|
||||
/*
|
||||
* Bitmasks for the 'cflags' field.
|
||||
*/
|
||||
#define X25_XFER_MODE 0x80 /* channel is in data transfer mode */
|
||||
#define X25_TXWIN_OPEN 0x40 /* transmit window open */
|
||||
#define X25_RXBUF_MASK 0x3F /* number of data buffers available */
|
||||
|
||||
/*****************************************************************************
|
||||
* Following definitions structurize contents of the TX25Mbox.data field for
|
||||
* different X.25 interface commands.
|
||||
****************************************************************************/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_SET_GLOBAL_VARS Command.
|
||||
*/
|
||||
typedef struct X25GlobalVars
|
||||
{
|
||||
unsigned char resrv PACKED; /* 00h: reserved */
|
||||
unsigned char dtrCtl PACKED; /* 01h: DTR control code */
|
||||
unsigned char resErr PACKED; /* 01h: '1' - reset modem error */
|
||||
} TX25GlobalVars;
|
||||
|
||||
/*
|
||||
* Defines for the 'dtrCtl' field.
|
||||
*/
|
||||
#define X25_RAISE_DTR 0x01
|
||||
#define X25_DROP_DTR 0x02
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_READ_MODEM_STATUS Command.
|
||||
*/
|
||||
typedef struct X25ModemStatus
|
||||
{
|
||||
unsigned char status PACKED; /* 00h: modem status */
|
||||
} TX25ModemStatus;
|
||||
|
||||
/*
|
||||
* Defines for the 'status' field.
|
||||
*/
|
||||
#define X25_CTS_MASK 0x20
|
||||
#define X25_DCD_MASK 0x08
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_HDLC_LINK_STATUS Command.
|
||||
*/
|
||||
typedef struct X25LinkStatus
|
||||
{
|
||||
unsigned char txQueued PACKED; /* 00h: queued Tx I-frames*/
|
||||
unsigned char rxQueued PACKED; /* 01h: queued Rx I-frames*/
|
||||
unsigned char station PACKED; /* 02h: DTE/DCE config. */
|
||||
unsigned char reserved PACKED; /* 03h: reserved */
|
||||
unsigned char sfTally PACKED; /* 04h: supervisory frame tally */
|
||||
} TX25LinkStatus;
|
||||
|
||||
/*
|
||||
* Defines for the 'station' field.
|
||||
*/
|
||||
#define X25_STATION_DTE 0x01 /* station configured as DTE */
|
||||
#define X25_STATION_DCE 0x02 /* station configured as DCE */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_HDLC_READ_STATS Command.
|
||||
*/
|
||||
typedef struct HdlcStats
|
||||
{ /* a number of ... */
|
||||
unsigned short rxIFrames PACKED; /* 00h: ready Rx I-frames */
|
||||
unsigned short rxNoseq PACKED; /* 02h: frms out-of-sequence */
|
||||
unsigned short rxNodata PACKED; /* 04h: I-frms without data */
|
||||
unsigned short rxDiscarded PACKED; /* 06h: discarded frames */
|
||||
unsigned short rxTooLong PACKED; /* 08h: frames too long */
|
||||
unsigned short rxBadAddr PACKED; /* 0Ah: frms with inval.addr*/
|
||||
unsigned short txAcked PACKED; /* 0Ch: acknowledged I-frms */
|
||||
unsigned short txRetransm PACKED; /* 0Eh: re-transmit. I-frms */
|
||||
unsigned short t1Timeout PACKED; /* 10h: T1 timeouts */
|
||||
unsigned short rxSABM PACKED; /* 12h: received SABM frames */
|
||||
unsigned short rxDISC PACKED; /* 14h: received DISC frames */
|
||||
unsigned short rxDM PACKED; /* 16h: received DM frames */
|
||||
unsigned short rxFRMR PACKED; /* 18h: FRMR frames received */
|
||||
unsigned short txSABM PACKED; /* 1Ah: transm. SABM frames*/
|
||||
unsigned short txDISC PACKED; /* 1Ch: transm. DISC frames*/
|
||||
unsigned short txDM PACKED; /* 1Eh: transm. DM frames */
|
||||
unsigned short txFRMR PACKED; /* 20h: transm. FRMR frames*/
|
||||
} THdlcStats;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_HDLC_READ_COMM_ERR Command.
|
||||
*/
|
||||
typedef struct HdlcCommErr
|
||||
{ /* a number of ... */
|
||||
unsigned char rxOverrun PACKED; /* 00h: Rx overrun errors */
|
||||
unsigned char rxBadCrc PACKED; /* 01h: Rx CRC errors */
|
||||
unsigned char rxAborted PACKED; /* 02h: Rx aborted frames */
|
||||
unsigned char rxDropped PACKED; /* 03h: frames lost */
|
||||
unsigned char txAborted PACKED; /* 04h: Tx aborted frames */
|
||||
unsigned char txUnderrun PACKED; /* 05h: Tx underrun errors */
|
||||
unsigned char txMissIntr PACKED; /* 06h: missed underrun ints */
|
||||
unsigned char reserved PACKED; /* 07h: reserved */
|
||||
unsigned char droppedDCD PACKED; /* 08h: times DCD dropped */
|
||||
unsigned char droppedCTS PACKED; /* 09h: times CTS dropped */
|
||||
} THdlcCommErr;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_SET_CONFIGURATION & X25_READ_CONFIGURATION Commands.
|
||||
*/
|
||||
typedef struct X25Config
|
||||
{
|
||||
unsigned char baudRate PACKED; /* 00h: */
|
||||
unsigned char t1 PACKED; /* 01h: */
|
||||
unsigned char t2 PACKED; /* 02h: */
|
||||
unsigned char n2 PACKED; /* 03h: */
|
||||
unsigned short hdlcMTU PACKED; /* 04h: */
|
||||
unsigned char hdlcWindow PACKED; /* 06h: */
|
||||
unsigned char t4 PACKED; /* 07h: */
|
||||
unsigned char autoModem PACKED; /* 08h: */
|
||||
unsigned char autoHdlc PACKED; /* 09h: */
|
||||
unsigned char hdlcOptions PACKED; /* 0Ah: */
|
||||
unsigned char station PACKED; /* 0Bh: */
|
||||
unsigned char local_station_address PACKED;
|
||||
|
||||
#if 0
|
||||
unsigned char pktWindow PACKED; /* 0Ch: */
|
||||
unsigned short defPktSize PACKED; /* 0Dh: */
|
||||
unsigned short pktMTU PACKED; /* 0Fh: */
|
||||
unsigned short loPVC PACKED; /* 11h: */
|
||||
unsigned short hiPVC PACKED; /* 13h: */
|
||||
unsigned short loIncommingSVC PACKED; /* 15h: */
|
||||
unsigned short hiIncommingSVC PACKED; /* 17h: */
|
||||
unsigned short loTwoWaySVC PACKED; /* 19h: */
|
||||
unsigned short hiTwoWaySVC PACKED; /* 1Bh: */
|
||||
unsigned short loOutgoingSVC PACKED; /* 1Dh: */
|
||||
unsigned short hiOutgoingSVC PACKED; /* 1Fh: */
|
||||
unsigned short options PACKED; /* 21h: */
|
||||
unsigned char responseOpt PACKED; /* 23h: */
|
||||
unsigned short facil1 PACKED; /* 24h: */
|
||||
unsigned short facil2 PACKED; /* 26h: */
|
||||
unsigned short ccittFacil PACKED; /* 28h: */
|
||||
unsigned short otherFacil PACKED; /* 2Ah: */
|
||||
unsigned short ccittCompat PACKED; /* 2Ch: */
|
||||
unsigned char t10t20 PACKED; /* 2Eh: */
|
||||
unsigned char t11t21 PACKED; /* 2Fh: */
|
||||
unsigned char t12t22 PACKED; /* 30h: */
|
||||
unsigned char t13t23 PACKED; /* 31h: */
|
||||
unsigned char t16t26 PACKED; /* 32H: */
|
||||
unsigned char t28 PACKED; /* 33h: */
|
||||
unsigned char r10r20 PACKED; /* 34h: */
|
||||
unsigned char r12r22 PACKED; /* 35h: */
|
||||
unsigned char r13r23 PACKED; /* 36h: */
|
||||
#endif
|
||||
} TX25Config;
|
||||
|
||||
#define X25_PACKET_WINDOW 0x02 /* Default value for Window Size */
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_READ_CHANNEL_CONFIG Command.
|
||||
*/
|
||||
typedef struct X25ChanAlloc /*----- Channel allocation -*/
|
||||
{
|
||||
unsigned short loPVC PACKED; /* 00h: lowest PVC number */
|
||||
unsigned short hiPVC PACKED; /* 02h: highest PVC number */
|
||||
unsigned short loIncommingSVC PACKED; /* 04h: lowest incoming SVC */
|
||||
unsigned short hiIncommingSVC PACKED; /* 06h: highest incoming SVC */
|
||||
unsigned short loTwoWaySVC PACKED; /* 08h: lowest two-way SVC */
|
||||
unsigned short hiTwoWaySVC PACKED; /* 0Ah: highest two-way SVC */
|
||||
unsigned short loOutgoingSVC PACKED; /* 0Ch: lowest outgoing SVC */
|
||||
unsigned short hiOutgoingSVC PACKED; /* 0Eh: highest outgoing SVC */
|
||||
} TX25ChanAlloc;
|
||||
|
||||
typedef struct X25ChanCfg /*------ Channel configuration -----*/
|
||||
{
|
||||
unsigned char type PACKED; /* 00h: channel type */
|
||||
unsigned char txConf PACKED; /* 01h: Tx packet and window sizes */
|
||||
unsigned char rxConf PACKED; /* 01h: Rx packet and window sizes */
|
||||
} TX25ChanCfg;
|
||||
|
||||
/*
|
||||
* Defines for the 'type' field.
|
||||
*/
|
||||
#define X25_PVC 0x01 /* PVC */
|
||||
#define X25_SVC_IN 0x03 /* Incoming SVC */
|
||||
#define X25_SVC_TWOWAY 0x07 /* Two-way SVC */
|
||||
#define X25_SVC_OUT 0x0B /* Outgoing SVC */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X25_READ_STATISTICS Command.
|
||||
*/
|
||||
typedef struct X25Stats
|
||||
{ /* number of packets Tx/Rx'ed */
|
||||
unsigned short txRestartRqst PACKED; /* 00h: Restart Request */
|
||||
unsigned short rxRestartRqst PACKED; /* 02h: Restart Request */
|
||||
unsigned short txRestartConf PACKED; /* 04h: Restart Confirmation */
|
||||
unsigned short rxRestartConf PACKED; /* 06h: Restart Confirmation */
|
||||
unsigned short txResetRqst PACKED; /* 08h: Reset Request */
|
||||
unsigned short rxResetRqst PACKED; /* 0Ah: Reset Request */
|
||||
unsigned short txResetConf PACKED; /* 0Ch: Reset Confirmation */
|
||||
unsigned short rxResetConf PACKED; /* 0Eh: Reset Confirmation */
|
||||
unsigned short txCallRequest PACKED; /* 10h: Call Request */
|
||||
unsigned short rxCallRequest PACKED; /* 12h: Call Request */
|
||||
unsigned short txCallAccept PACKED; /* 14h: Call Accept */
|
||||
unsigned short rxCallAccept PACKED; /* 16h: Call Accept */
|
||||
unsigned short txClearRqst PACKED; /* 18h: Clear Request */
|
||||
unsigned short rxClearRqst PACKED; /* 1Ah: Clear Request */
|
||||
unsigned short txClearConf PACKED; /* 1Ch: Clear Confirmation */
|
||||
unsigned short rxClearConf PACKED; /* 1Eh: Clear Confirmation */
|
||||
unsigned short txDiagnostic PACKED; /* 20h: Diagnostic */
|
||||
unsigned short rxDiagnostic PACKED; /* 22h: Diagnostic */
|
||||
unsigned short txRegRqst PACKED; /* 24h: Registration Request */
|
||||
unsigned short rxRegRqst PACKED; /* 26h: Registration Request */
|
||||
unsigned short txRegConf PACKED; /* 28h: Registration Confirm.*/
|
||||
unsigned short rxRegConf PACKED; /* 2Ah: Registration Confirm.*/
|
||||
unsigned short txInterrupt PACKED; /* 2Ch: Interrupt */
|
||||
unsigned short rxInterrupt PACKED; /* 2Eh: Interrupt */
|
||||
unsigned short txIntrConf PACKED; /* 30h: Interrupt Confirm. */
|
||||
unsigned short rxIntrConf PACKED; /* 32h: Interrupt Confirm. */
|
||||
unsigned short txData PACKED; /* 34h: Data */
|
||||
unsigned short rxData PACKED; /* 36h: Data */
|
||||
unsigned short txRR PACKED; /* 38h: RR */
|
||||
unsigned short rxRR PACKED; /* 3Ah: RR */
|
||||
unsigned short txRNR PACKED; /* 3Ch: RNR */
|
||||
unsigned short rxRNR PACKED; /* 3Eh: RNR */
|
||||
} TX25Stats;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X25_READ_HISTORY_TABLE Command.
|
||||
*/
|
||||
typedef struct X25EventLog
|
||||
{
|
||||
unsigned char type PACKED; /* 00h: transaction type */
|
||||
unsigned short lcn PACKED; /* 01h: logical channel num */
|
||||
unsigned char packet PACKED; /* 03h: async packet type */
|
||||
unsigned char cause PACKED; /* 04h: X.25 cause field */
|
||||
unsigned char diag PACKED; /* 05h: X.25 diag field */
|
||||
TX25TimeStamp ts PACKED; /* 06h: time stamp */
|
||||
} TX25EventLog;
|
||||
|
||||
/*
|
||||
* Defines for the 'type' field.
|
||||
*/
|
||||
#define X25LOG_INCOMMING 0x00
|
||||
#define X25LOG_APPLICATION 0x01
|
||||
#define X25LOG_AUTOMATIC 0x02
|
||||
#define X25LOG_ERROR 0x04
|
||||
#define X25LOG_TIMEOUT 0x08
|
||||
#define X25LOG_RECOVERY 0x10
|
||||
|
||||
/*
|
||||
* Defines for the 'packet' field.
|
||||
*/
|
||||
#define X25LOG_CALL_RQST 0x0B
|
||||
#define X25LOG_CALL_ACCEPTED 0x0F
|
||||
#define X25LOG_CLEAR_RQST 0x13
|
||||
#define X25LOG_CLEAR_CONFRM 0x17
|
||||
#define X25LOG_RESET_RQST 0x1B
|
||||
#define X25LOG_RESET_CONFRM 0x1F
|
||||
#define X25LOG_RESTART_RQST 0xFB
|
||||
#define X25LOG_RESTART_COMFRM 0xFF
|
||||
#define X25LOG_DIAGNOSTIC 0xF1
|
||||
#define X25LOG_DTE_REG_RQST 0xF3
|
||||
#define X25LOG_DTE_REG_COMFRM 0xF7
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_TRACE_CONFIGURE Command.
|
||||
*/
|
||||
typedef struct X25TraceCfg
|
||||
{
|
||||
unsigned char flags PACKED; /* 00h: trace configuration flags */
|
||||
unsigned char timeout PACKED; /* 01h: timeout for trace delay mode*/
|
||||
} TX25TraceCfg;
|
||||
|
||||
/*
|
||||
* Defines for the 'flags' field.
|
||||
*/
|
||||
#define X25_TRC_ENABLE 0x01 /* bit0: '1' - trace enabled */
|
||||
#define X25_TRC_TIMESTAMP 0x02 /* bit1: '1' - time stamping enabled*/
|
||||
#define X25_TRC_DELAY 0x04 /* bit2: '1' - trace delay enabled */
|
||||
#define X25_TRC_DATA 0x08 /* bit3: '1' - trace data packets */
|
||||
#define X25_TRC_SUPERVISORY 0x10 /* bit4: '1' - trace suprvisory pkts*/
|
||||
#define X25_TRC_ASYNCHRONOUS 0x20 /* bit5: '1' - trace asynch. packets*/
|
||||
#define X25_TRC_HDLC 0x40 /* bit6: '1' - trace all packets */
|
||||
#define X25_TRC_READ 0x80 /* bit7: '1' - get current config. */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_READ_TRACE_DATA Command.
|
||||
*/
|
||||
typedef struct X25Trace /*----- Trace data structure -------*/
|
||||
{
|
||||
unsigned short length PACKED; /* 00h: trace data length */
|
||||
unsigned char type PACKED; /* 02h: trace type */
|
||||
unsigned char lost_cnt PACKED; /* 03h: N of traces lost */
|
||||
TX25TimeStamp tstamp PACKED; /* 04h: mon/date/sec/min/hour */
|
||||
unsigned short millisec PACKED; /* 09h: ms time stamp */
|
||||
unsigned char data[0] PACKED; /* 0Bh: traced frame */
|
||||
} TX25Trace;
|
||||
|
||||
/*
|
||||
* Defines for the 'type' field.
|
||||
*/
|
||||
#define X25_TRC_TYPE_MASK 0x0F /* bits 0..3: trace type */
|
||||
#define X25_TRC_TYPE_RX_FRAME 0x00 /* received frame trace */
|
||||
#define X25_TRC_TYPE_TX_FRAME 0x01 /* transmitted frame */
|
||||
#define X25_TRC_TYPE_ERR_FRAME 0x02 /* error frame */
|
||||
|
||||
#define X25_TRC_ERROR_MASK 0xF0 /* bits 4..7: error code */
|
||||
#define X25_TRCERR_RX_ABORT 0x10 /* receive abort error */
|
||||
#define X25_TRCERR_RX_BADCRC 0x20 /* receive CRC error */
|
||||
#define X25_TRCERR_RX_OVERRUN 0x30 /* receiver overrun error */
|
||||
#define X25_TRCERR_RX_TOO_LONG 0x40 /* excessive frame length error */
|
||||
#define X25_TRCERR_TX_ABORT 0x70 /* aborted frame transmittion error */
|
||||
#define X25_TRCERR_TX_UNDERRUN 0x80 /* transmit underrun error */
|
||||
|
||||
/*****************************************************************************
|
||||
* Following definitions describe HDLC frame and X.25 packet formats.
|
||||
****************************************************************************/
|
||||
|
||||
typedef struct HDLCFrame /*----- DHLC Frame Format ----------*/
|
||||
{
|
||||
unsigned char addr PACKED; /* address field */
|
||||
unsigned char cntl PACKED; /* control field */
|
||||
unsigned char data[0] PACKED;
|
||||
} THDLCFrame;
|
||||
|
||||
typedef struct X25Pkt /*----- X.25 Paket Format ----------*/
|
||||
{
|
||||
unsigned char lcn_hi PACKED; /* 4 MSB of Logical Channel Number */
|
||||
unsigned char lcn_lo PACKED; /* 8 LSB of Logical Channel Number */
|
||||
unsigned char type PACKED;
|
||||
unsigned char data[0] PACKED;
|
||||
} TX25Pkt;
|
||||
|
||||
/*
|
||||
* Defines for the 'lcn_hi' field.
|
||||
*/
|
||||
#define X25_Q_BIT_MASK 0x80 /* Data Qualifier Bit mask */
|
||||
#define X25_D_BIT_MASK 0x40 /* Delivery Confirmation Bit mask */
|
||||
#define X25_M_BITS_MASK 0x30 /* Modulo Bits mask */
|
||||
#define X25_LCN_MSB_MASK 0x0F /* LCN most significant bits mask */
|
||||
|
||||
/*
|
||||
* Defines for the 'type' field.
|
||||
*/
|
||||
#define X25PKT_DATA 0x01 /* Data packet mask */
|
||||
#define X25PKT_SUPERVISORY 0x02 /* Supervisory packet mask */
|
||||
#define X25PKT_CALL_RQST 0x0B /* Call Request/Incoming */
|
||||
#define X25PKT_CALL_ACCEPTED 0x0F /* Call Accepted/Connected */
|
||||
#define X25PKT_CLEAR_RQST 0x13 /* Clear Request/Indication */
|
||||
#define X25PKT_CLEAR_CONFRM 0x17 /* Clear Confirmation */
|
||||
#define X25PKT_RESET_RQST 0x1B /* Reset Request/Indication */
|
||||
#define X25PKT_RESET_CONFRM 0x1F /* Reset Confirmation */
|
||||
#define X25PKT_RESTART_RQST 0xFB /* Restart Request/Indication */
|
||||
#define X25PKT_RESTART_CONFRM 0xFF /* Restart Confirmation */
|
||||
#define X25PKT_INTERRUPT 0x23 /* Interrupt */
|
||||
#define X25PKT_INTERRUPT_CONFRM 0x27 /* Interrupt Confirmation */
|
||||
#define X25PKT_DIAGNOSTIC 0xF1 /* Diagnostic */
|
||||
#define X25PKT_REGISTR_RQST 0xF3 /* Registration Request */
|
||||
#define X25PKT_REGISTR_CONFRM 0xF7 /* Registration Confirmation */
|
||||
#define X25PKT_RR_MASKED 0x01 /* Receive Ready packet after masking */
|
||||
#define X25PKT_RNR_MASKED 0x05 /* Receive Not Ready after masking */
|
||||
|
||||
|
||||
typedef struct {
|
||||
TX25Cmd cmd PACKED;
|
||||
char data[X25_MAX_DATA] PACKED;
|
||||
} mbox_cmd_t;
|
||||
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
unsigned char qdm PACKED; /* Q/D/M bits */
|
||||
unsigned char cause PACKED; /* cause field */
|
||||
unsigned char diagn PACKED; /* diagnostics */
|
||||
unsigned char pktType PACKED;
|
||||
unsigned short length PACKED;
|
||||
unsigned char result PACKED;
|
||||
unsigned short lcn PACKED;
|
||||
char reserved[7] PACKED;
|
||||
}x25api_hdr_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
x25api_hdr_t hdr PACKED;
|
||||
char data[X25_MAX_DATA] PACKED;
|
||||
}x25api_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XPIPEMON Definitions
|
||||
*/
|
||||
|
||||
/* valid ip_protocol for UDP management */
|
||||
#define UDPMGMT_UDP_PROTOCOL 0x11
|
||||
#define UDPMGMT_XPIPE_SIGNATURE "XLINK8ND"
|
||||
#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS"
|
||||
|
||||
/* values for request/reply byte */
|
||||
#define UDPMGMT_REQUEST 0x01
|
||||
#define UDPMGMT_REPLY 0x02
|
||||
#define UDP_OFFSET 12
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
unsigned char opp_flag PACKED; /* the opp flag */
|
||||
unsigned char command PACKED; /* command code */
|
||||
unsigned short length PACKED; /* transfer data length */
|
||||
unsigned char result PACKED; /* return code */
|
||||
unsigned char pf PACKED; /* P/F bit */
|
||||
unsigned short lcn PACKED; /* logical channel */
|
||||
unsigned char qdm PACKED; /* Q/D/M bits */
|
||||
unsigned char cause PACKED; /* cause field */
|
||||
unsigned char diagn PACKED; /* diagnostics */
|
||||
unsigned char pktType PACKED; /* packet type */
|
||||
unsigned char resrv[4] PACKED; /* reserved */
|
||||
} cblock_t;
|
||||
|
||||
typedef struct {
|
||||
ip_pkt_t ip_pkt PACKED;
|
||||
udp_pkt_t udp_pkt PACKED;
|
||||
wp_mgmt_t wp_mgmt PACKED;
|
||||
cblock_t cblock PACKED;
|
||||
unsigned char data[4080] PACKED;
|
||||
} x25_udp_pkt_t;
|
||||
#endif
|
||||
|
||||
typedef struct read_hdlc_stat {
|
||||
unsigned short inf_frames_rx_ok PACKED;
|
||||
unsigned short inf_frames_rx_out_of_seq PACKED;
|
||||
unsigned short inf_frames_rx_no_data PACKED;
|
||||
unsigned short inf_frames_rx_dropped PACKED;
|
||||
unsigned short inf_frames_rx_data_too_long PACKED;
|
||||
unsigned short inf_frames_rx_invalid_addr PACKED;
|
||||
unsigned short inf_frames_tx_ok PACKED;
|
||||
unsigned short inf_frames_tx_retransmit PACKED;
|
||||
unsigned short T1_timeouts PACKED;
|
||||
unsigned short SABM_frames_rx PACKED;
|
||||
unsigned short DISC_frames_rx PACKED;
|
||||
unsigned short DM_frames_rx PACKED;
|
||||
unsigned short FRMR_frames_rx PACKED;
|
||||
unsigned short SABM_frames_tx PACKED;
|
||||
unsigned short DISC_frames_tx PACKED;
|
||||
unsigned short DM_frames_tx PACKED;
|
||||
unsigned short FRMR_frames_tx PACKED;
|
||||
} read_hdlc_stat_t;
|
||||
|
||||
typedef struct read_comms_err_stats{
|
||||
unsigned char overrun_err_rx PACKED;
|
||||
unsigned char CRC_err PACKED;
|
||||
unsigned char abort_frames_rx PACKED;
|
||||
unsigned char frames_dropped_buf_full PACKED;
|
||||
unsigned char abort_frames_tx PACKED;
|
||||
unsigned char transmit_underruns PACKED;
|
||||
unsigned char missed_tx_underruns_intr PACKED;
|
||||
unsigned char reserved PACKED;
|
||||
unsigned char DCD_drop PACKED;
|
||||
unsigned char CTS_drop PACKED;
|
||||
} read_comms_err_stats_t;
|
||||
|
||||
typedef struct trace_data {
|
||||
unsigned short length PACKED;
|
||||
unsigned char type PACKED;
|
||||
unsigned char trace_dropped PACKED;
|
||||
unsigned char reserved[5] PACKED;
|
||||
unsigned short timestamp PACKED;
|
||||
unsigned char data PACKED;
|
||||
} trace_data_t;
|
||||
|
||||
enum {UDP_XPIPE_TYPE};
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#define XPIPE_ENABLE_TRACING 0x14
|
||||
#define XPIPE_DISABLE_TRACING 0x14
|
||||
#define XPIPE_GET_TRACE_INFO 0x16
|
||||
#define XPIPE_FT1_READ_STATUS 0x74
|
||||
#define XPIPE_DRIVER_STAT_IFSEND 0x75
|
||||
#define XPIPE_DRIVER_STAT_INTR 0x76
|
||||
#define XPIPE_DRIVER_STAT_GEN 0x77
|
||||
#define XPIPE_FLUSH_DRIVER_STATS 0x78
|
||||
#define XPIPE_ROUTER_UP_TIME 0x79
|
||||
#define XPIPE_SET_FT1_MODE 0x81
|
||||
#define XPIPE_FT1_STATUS_CTRL 0x80
|
||||
|
||||
|
||||
/* error messages */
|
||||
#define NO_BUFFS_OR_CLOSED_WIN 0x33
|
||||
#define DATA_LENGTH_TOO_BIG 0x32
|
||||
#define NO_DATA_AVAILABLE 0x33
|
||||
#define Z80_TIMEOUT_ERROR 0x0a
|
||||
#define NO_BUFFS 0x08
|
||||
|
||||
|
||||
/* Trace options */
|
||||
#define TRACE_DEFAULT 0x03
|
||||
#define TRACE_SUPERVISOR_FRMS 0x10
|
||||
#define TRACE_ASYNC_FRMS 0x20
|
||||
#define TRACE_ALL_HDLC_FRMS 0x40
|
||||
#define TRACE_DATA_FRMS 0x08
|
||||
|
||||
|
||||
#endif /* _SDLA_X25_H */
|
|
@ -1374,6 +1374,9 @@ enum {
|
|||
|
||||
#define AFT_MIN_ANALOG_FRMW_VER 0x05
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct aft_dma_chain
|
||||
{
|
||||
unsigned long init;
|
||||
|
@ -1408,6 +1411,21 @@ typedef struct dma_history{
|
|||
#define AFT_DMA_INDEX_OFFSET 0x200
|
||||
|
||||
|
||||
typedef struct aft_dma_ring
|
||||
{
|
||||
unsigned char rxdata[128];
|
||||
unsigned char txdata[128];
|
||||
}aft_dma_ring_t;
|
||||
|
||||
#define AFT_DMA_RING_MAX 4
|
||||
|
||||
typedef struct aft_dma_swring {
|
||||
int tx_toggle;
|
||||
int rx_toggle;
|
||||
aft_dma_ring_t rbuf[AFT_DMA_RING_MAX];
|
||||
}aft_dma_swring_t;
|
||||
|
||||
|
||||
typedef struct private_area
|
||||
{
|
||||
wanpipe_common_t common;
|
||||
|
@ -1541,10 +1559,114 @@ typedef struct private_area
|
|||
netskb_t *tx_rtp_skb;
|
||||
u32 tdm_call_status;
|
||||
struct private_area *next;
|
||||
|
||||
|
||||
aft_dma_swring_t swring;
|
||||
|
||||
}private_area_t;
|
||||
|
||||
|
||||
static __inline int aft_decode_dma_status(sdla_t *card, private_area_t *chan, u32 reg)
|
||||
{
|
||||
u32 dma_status=aft_rxdma_hi_get_dma_status(reg);
|
||||
u32 data_error=0;
|
||||
|
||||
if (dma_status){
|
||||
|
||||
if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_M_ABRT,&dma_status)){
|
||||
if (WAN_NET_RATELIMIT()){
|
||||
DEBUG_EVENT("%s:%s: Rx Error: Abort from Master: pci fatal error 0x%X!\n",
|
||||
card->devname,chan->if_name,reg);
|
||||
}
|
||||
}
|
||||
if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_T_ABRT,&dma_status)){
|
||||
if (WAN_NET_RATELIMIT()){
|
||||
DEBUG_EVENT("%s:%s: Rx Error: Abort from Target: pci fatal error 0x%X!\n",
|
||||
card->devname,chan->if_name,reg);
|
||||
}
|
||||
}
|
||||
if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_DS_TOUT,&dma_status)){
|
||||
if (WAN_NET_RATELIMIT()){
|
||||
DEBUG_EVENT("%s:%s: Rx Error: No 'DeviceSelect' from target: pci fatal error 0x%X!\n",
|
||||
card->devname,chan->if_name,reg);
|
||||
}
|
||||
}
|
||||
if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_RETRY,&dma_status)){
|
||||
if (WAN_NET_RATELIMIT()){
|
||||
DEBUG_EVENT("%s:%s: Rx Error: 'Retry' exceeds maximum (64k): pci fatal error 0x%X!\n",
|
||||
card->devname,chan->if_name,reg);
|
||||
}
|
||||
}
|
||||
|
||||
chan->errstats.Rx_pci_errors++;
|
||||
chan->if_stats.rx_errors++;
|
||||
card->wandev.stats.rx_errors++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (chan->hdlc_eng){
|
||||
|
||||
/* Checking Rx DMA Frame start bit. (information for api) */
|
||||
if (!wan_test_bit(AFT_RXDMA_HI_START_BIT,®)){
|
||||
DEBUG_TEST("%s:%s RxDMA Intr: Start flag missing: MTU Mismatch! Reg=0x%X\n",
|
||||
card->devname,chan->if_name,reg);
|
||||
chan->if_stats.rx_frame_errors++;
|
||||
chan->opstats.Rx_Data_discard_long_count++;
|
||||
chan->errstats.Rx_hdlc_corrupiton++;
|
||||
card->wandev.stats.rx_errors++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Checking Rx DMA Frame end bit. (information for api) */
|
||||
if (!wan_test_bit(AFT_RXDMA_HI_EOF_BIT,®)){
|
||||
DEBUG_TEST("%s:%s: RxDMA Intr: End flag missing: MTU Mismatch! Reg=0x%X\n",
|
||||
card->devname,chan->if_name,reg);
|
||||
chan->if_stats.rx_frame_errors++;
|
||||
chan->opstats.Rx_Data_discard_long_count++;
|
||||
chan->errstats.Rx_hdlc_corrupiton++;
|
||||
card->wandev.stats.rx_errors++;
|
||||
return 1;
|
||||
|
||||
} else { /* Check CRC error flag only if this is the end of Frame */
|
||||
|
||||
if (wan_test_bit(AFT_RXDMA_HI_FCS_ERR_BIT,®)){
|
||||
DEBUG_TEST("%s:%s: RxDMA Intr: CRC Error! Reg=0x%X Len=%d\n",
|
||||
card->devname,chan->if_name,reg,
|
||||
(reg&AFT_RXDMA_HI_DMA_LENGTH_MASK)>>2);
|
||||
chan->if_stats.rx_frame_errors++;
|
||||
chan->errstats.Rx_crc_err_count++;
|
||||
card->wandev.stats.rx_crc_errors++;
|
||||
data_error = 1;
|
||||
}
|
||||
|
||||
/* Check if this frame is an abort, if it is
|
||||
* drop it and continue receiving */
|
||||
if (wan_test_bit(AFT_RXDMA_HI_FRM_ABORT_BIT,®)){
|
||||
DEBUG_TEST("%s:%s: RxDMA Intr: Abort! Reg=0x%X\n",
|
||||
card->devname,chan->if_name,reg);
|
||||
chan->if_stats.rx_frame_errors++;
|
||||
chan->errstats.Rx_hdlc_corrupiton++;
|
||||
card->wandev.stats.rx_frame_errors++;
|
||||
data_error = 1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (chan->common.usedby != API && data_error){
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
if (data_error) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void aft_free_logical_channel_num (sdla_t *card, int logic_ch);
|
||||
void aft_dma_max_logic_ch(sdla_t *card);
|
||||
void aft_fe_intr_ctrl(sdla_t *card, int status);
|
||||
|
@ -1553,6 +1675,7 @@ void aft_wdt_set(sdla_t *card, unsigned char val);
|
|||
void aft_wdt_reset(sdla_t *card);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,228 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* sdla_asy.h Header file for the Sangoma S508/S514 asynchronous code API
|
||||
*
|
||||
* Author: Gideon Hack
|
||||
*
|
||||
* Copyright: (c) 2000 Sangoma Technologies Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
*
|
||||
* Jan 28, 2000 Gideon Hack Initial Version
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef _WANPIPE_ASYNC_H
|
||||
#define _WANPIPE_ASYNC_H
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Interface commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
#define SET_ASY_CONFIGURATION 0xE2 /* set the asychronous operational configuration */
|
||||
#define READ_ASY_CONFIGURATION 0xE3 /* read the current asychronous operational configuration */
|
||||
#define ENABLE_ASY_COMMUNICATIONS 0xE4 /* enable asychronous communications */
|
||||
#define DISABLE_ASY_COMMUNICATIONS 0xE5 /* disable asychronous communications */
|
||||
#define READ_ASY_OPERATIONAL_STATS 0xE7 /* retrieve the asychronous operational statistics */
|
||||
#define FLUSH_ASY_OPERATIONAL_STATS 0xE8 /* flush the asychronous operational statistics */
|
||||
#define TRANSMIT_ASY_BREAK_SIGNAL 0xEC /* transmit an asychronous break signal */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Return codes from interface commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
#define COMMAND_INVALID_FOR_PORT 0x50 /* the command is invalid for the selected port */
|
||||
#define DISABLE_ASY_COMMS_BEFORE_CFG 0xE1 /* communications must be disabled before setting the configuration */
|
||||
#define ASY_COMMS_ENABLED 0xE1 /* communications are currently enabled */
|
||||
#define ASY_COMMS_DISABLED 0xE1 /* communications are currently disabled */
|
||||
#define ASY_CFG_BEFORE_COMMS_ENABLED 0xE2 /* perform a SET_ASY_CONFIGURATION before enabling comms */
|
||||
#define LGTH_ASY_CFG_DATA_INVALID 0xE2 /* the length of the passed configuration data is invalid */
|
||||
#define INVALID_ASY_CFG_DATA 0xE3 /* the passed configuration data is invalid */
|
||||
#define ASY_BREAK_SIGNAL_BUSY 0xEC /* a break signal is being transmitted */
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the SET_ASY_CONFIGURATION/READ_ASY_CONFIGURATION command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the asynchronous configuration structure */
|
||||
typedef struct {
|
||||
unsigned long baud_rate PACKED; /* the baud rate */
|
||||
unsigned short line_config_options PACKED; /* line configuration options */
|
||||
unsigned short modem_config_options PACKED; /* modem configuration options */
|
||||
unsigned short asy_API_options PACKED; /* asynchronous API options */
|
||||
unsigned short asy_protocol_options PACKED; /* asynchronous protocol options */
|
||||
unsigned short Tx_bits_per_char PACKED; /* number of bits per tx character */
|
||||
unsigned short Rx_bits_per_char PACKED; /* number of bits per received character */
|
||||
unsigned short stop_bits PACKED; /* number of stop bits per character */
|
||||
unsigned short parity PACKED; /* parity definition */
|
||||
unsigned short break_timer PACKED; /* the break signal timer */
|
||||
unsigned short asy_Rx_inter_char_timer PACKED; /* the receive inter-character timer */
|
||||
unsigned short asy_Rx_complete_length PACKED; /* the receive 'buffer complete' length */
|
||||
unsigned short XON_char PACKED; /* the XON character */
|
||||
unsigned short XOFF_char PACKED; /* the XOFF character */
|
||||
unsigned short asy_statistics_options PACKED; /* async operational stat options */
|
||||
unsigned long ptr_shared_mem_info_struct PACKED;/* ptr to the shared memory area information structure */
|
||||
unsigned long ptr_asy_Tx_stat_el_cfg_struct PACKED;/* ptr to the transmit status element configuration structure */
|
||||
unsigned long ptr_asy_Rx_stat_el_cfg_struct PACKED;/* ptr to the receive status element configuration structure */
|
||||
} ASY_CONFIGURATION_STRUCT;
|
||||
|
||||
/* permitted minimum and maximum values for setting the asynchronous configuration */
|
||||
#define MIN_ASY_BAUD_RATE 50 /* maximum baud rate */
|
||||
#define MAX_ASY_BAUD_RATE 250000 /* minimum baud rate */
|
||||
#define MIN_ASY_BITS_PER_CHAR 5 /* minimum number of bits per character */
|
||||
#define MAX_ASY_BITS_PER_CHAR 8 /* maximum number of bits per character */
|
||||
#define MIN_BREAK_TMR_VAL 0 /* minimum break signal timer */
|
||||
#define MAX_BREAK_TMR_VAL 5000 /* maximum break signal timer */
|
||||
#define MIN_ASY_RX_INTER_CHAR_TMR 0 /* minimum receive inter-character timer */
|
||||
#define MAX_ASY_RX_INTER_CHAR_TMR 30000 /* maximum receive inter-character timer */
|
||||
#define MIN_ASY_RX_CPLT_LENGTH 0 /* minimum receive 'length complete' value */
|
||||
#define MAX_ASY_RX_CPLT_LENGTH 2000 /* maximum receive 'length complete' value */
|
||||
|
||||
/* bit settings for the 'asy_API_options' */
|
||||
#define ASY_RX_DATA_TRANSPARENT 0x0001 /* do not strip parity and unused bits from received characters */
|
||||
|
||||
/* bit settings for the 'asy_protocol_options' */
|
||||
#define ASY_RTS_HS_FOR_RX 0x0001 /* RTS handshaking is used for reception control */
|
||||
#define ASY_XON_XOFF_HS_FOR_RX 0x0002 /* XON/XOFF handshaking is used for reception control */
|
||||
#define ASY_XON_XOFF_HS_FOR_TX 0x0004 /* XON/XOFF handshaking is used for transmission control */
|
||||
#define ASY_DCD_HS_FOR_TX 0x0008 /* DCD handshaking is used for transmission control */
|
||||
#define ASY_CTS_HS_FOR_TX 0x0020 /* CTS handshaking is used for transmission control */
|
||||
|
||||
/* bit settings for the 'stop_bits' definition */
|
||||
#define ONE_STOP_BIT 1 /* representation for 1 stop bit */
|
||||
#define TWO_STOP_BITS 2 /* representation for 2 stop bits */
|
||||
#define ONE_AND_A_HALF_STOP_BITS 3 /* representation for 1.5 stop bits */
|
||||
|
||||
/* bit settings for the 'parity' definition */
|
||||
#define NO_PARITY 0 /* representation for no parity */
|
||||
#define ODD_PARITY 1 /* representation for odd parity */
|
||||
#define EVEN_PARITY 2 /* representation for even parity */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_COMMS_ERROR_STATS command (asynchronous mode)
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the communications error statistics structure */
|
||||
typedef struct {
|
||||
unsigned short Rx_overrun_err_count PACKED; /* receiver overrun error count */
|
||||
unsigned short Rx_parity_err_count PACKED; /* parity errors received count */
|
||||
unsigned short Rx_framing_err_count PACKED; /* framing errors received count */
|
||||
unsigned short comms_err_stat_reserved_1 PACKED;/* reserved for later use */
|
||||
unsigned short comms_err_stat_reserved_2 PACKED;/* reserved for later use */
|
||||
unsigned short comms_err_stat_reserved_3 PACKED;/* reserved for later use */
|
||||
unsigned short comms_err_stat_reserved_4 PACKED;/* reserved for later use */
|
||||
unsigned short comms_err_stat_reserved_5 PACKED;/* reserved for later use */
|
||||
unsigned short DCD_state_change_count PACKED; /* DCD state change count */
|
||||
unsigned short CTS_state_change_count PACKED; /* CTS state change count */
|
||||
} ASY_COMMS_ERROR_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_ASY_OPERATIONAL_STATS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the asynchronous operational statistics structure */
|
||||
typedef struct {
|
||||
|
||||
/* Data transmission statistics */
|
||||
unsigned long Data_blocks_Tx_count PACKED;/* number of blocks transmitted */
|
||||
unsigned long Data_bytes_Tx_count PACKED;/* number of bytes transmitted */
|
||||
unsigned long Data_Tx_throughput PACKED;/* transmit throughput */
|
||||
unsigned long no_ms_for_Data_Tx_thruput_comp PACKED;/* millisecond time used for the Tx throughput computation */
|
||||
unsigned long Tx_Data_discard_lgth_err_count PACKED;/* number of Data blocks discarded (length error) */
|
||||
unsigned long reserved_Data_frm_Tx_stat1 PACKED;/* reserved for later use */
|
||||
unsigned long reserved_Data_frm_Tx_stat2 PACKED;/* reserved for later use */
|
||||
unsigned long reserved_Data_frm_Tx_stat3 PACKED;/* reserved for later use */
|
||||
|
||||
/* Data reception statistics */
|
||||
unsigned long Data_blocks_Rx_count PACKED;/* number of blocks received */
|
||||
unsigned long Data_bytes_Rx_count PACKED;/* number of bytes received */
|
||||
unsigned long Data_Rx_throughput PACKED;/* receive throughput */
|
||||
unsigned long no_ms_for_Data_Rx_thruput_comp PACKED;/* millisecond time used for the Rx throughput computation */
|
||||
unsigned long Rx_Data_bytes_discard_count PACKED;/* received Data bytes discarded */
|
||||
unsigned long reserved_Data_frm_Rx_stat1 PACKED;/* reserved for later use */
|
||||
|
||||
/* handshaking protocol statistics */
|
||||
unsigned short XON_chars_Tx_count PACKED; /* number of XON characters transmitted */
|
||||
unsigned short XOFF_chars_Tx_count PACKED; /* number of XOFF characters transmitted */
|
||||
unsigned short XON_chars_Rx_count PACKED; /* number of XON characters received */
|
||||
unsigned short XOFF_chars_Rx_count PACKED; /* number of XOFF characters received */
|
||||
unsigned short Tx_halt_modem_low_count PACKED; /* number of times Tx halted (modem line low) */
|
||||
unsigned short Rx_halt_RTS_low_count PACKED; /* number of times Rx halted by setting RTS low */
|
||||
unsigned long reserved_handshaking_stat1 PACKED;/* reserved for later use */
|
||||
|
||||
/* break statistics */
|
||||
unsigned short break_Tx_count PACKED; /* number of break sequences transmitted */
|
||||
unsigned short break_Rx_count PACKED; /* number of break sequences received */
|
||||
unsigned long reserved_break_stat1 PACKED;/* reserved for later use */
|
||||
|
||||
/* miscellaneous statistics */
|
||||
unsigned long reserved_misc_stat1 PACKED; /* reserved for later use */
|
||||
unsigned long reserved_misc_stat2 PACKED; /* reserved for later use */
|
||||
|
||||
} ASY_OPERATIONAL_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for Data transmission
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the Data block transmit status element configuration structure */
|
||||
typedef struct {
|
||||
unsigned short number_Tx_status_elements PACKED; /* number of transmit status elements */
|
||||
unsigned long base_addr_Tx_status_elements PACKED; /* base address of the transmit element list */
|
||||
unsigned long next_Tx_status_element_to_use PACKED; /* pointer to the next transmit element to be used */
|
||||
} ASY_TX_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
|
||||
/* the Data block transmit status element structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag PACKED; /* opp flag */
|
||||
unsigned short data_length PACKED; /* length of the block to be transmitted */
|
||||
unsigned char reserved_1 PACKED; /* reserved for internal use */
|
||||
unsigned long reserved_2 PACKED; /* reserved for internal use */
|
||||
unsigned long reserved_3 PACKED; /* reserved for internal use */
|
||||
unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
|
||||
} ASY_DATA_TX_STATUS_EL_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for Data reception
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the Data block receive status element configuration structure */
|
||||
typedef struct {
|
||||
unsigned short number_Rx_status_elements PACKED;/* number of receive status elements */
|
||||
unsigned long base_addr_Rx_status_elements PACKED;/* base address of the receive element list */
|
||||
unsigned long next_Rx_status_element_to_use PACKED;/* pointer to the next receive element to be used */
|
||||
unsigned long base_addr_Rx_buffer PACKED;/* base address of the receive data buffer */
|
||||
unsigned long end_addr_Rx_buffer PACKED;/* end address of the receive data buffer */
|
||||
} ASY_RX_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/* the Data block receive status element structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag PACKED; /* opp flag */
|
||||
unsigned short data_length PACKED; /* length of the received data block */
|
||||
unsigned char reserved_1 PACKED; /* reserved for internal use */
|
||||
unsigned short time_stamp PACKED; /* receive time stamp (HDLC_STREAMING_MODE) */
|
||||
unsigned short data_buffered PACKED; /* the number of data bytes still buffered */
|
||||
unsigned long reserved_2 PACKED; /* reserved for internal use */
|
||||
unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
|
||||
} ASY_DATA_RX_STATUS_EL_STRUCT;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
|
@ -1,579 +0,0 @@
|
|||
/*
|
||||
***********************************************************************************
|
||||
* *
|
||||
* ASYAPI.H - the 'C' header file for the Sangoma S508/S514 asynchronous code API. *
|
||||
* *
|
||||
***********************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _SDLA_ASYHDLC_H_
|
||||
#define _SDLA_ASYHDLC_H_
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants defining the shared memory control block (mailbox)
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
#define PRI_BASE_ADDR_MB_STRUCT 0xE000 /* the base address of the mailbox structure (primary port) */
|
||||
#define SEC_BASE_ADDR_MB_STRUCT 0xE800 /* the base address of the mailbox structure (secondary port) */
|
||||
#define NUMBER_MB_RESERVED_BYTES 0x0B /* the number of reserved bytes in the mailbox header area */
|
||||
#define SIZEOF_MB_DATA_BFR 2032 /* the size of the actual mailbox data area */
|
||||
|
||||
/* the control block mailbox structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag; /* the opp flag */
|
||||
unsigned char command; /* the user command */
|
||||
unsigned short buffer_length; /* the data length */
|
||||
unsigned char return_code; /* the return code */
|
||||
char MB_reserved[NUMBER_MB_RESERVED_BYTES]; /* reserved for later use */
|
||||
char data[SIZEOF_MB_DATA_BFR]; /* the data area */
|
||||
} ASY_MAILBOX_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Interface commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* interface commands */
|
||||
#define READ_GLOBAL_EXCEPTION_CONDITION 0x01 /* read a global exception condition from the adapter */
|
||||
#define SET_GLOBAL_CONFIGURATION 0x02 /* set the global operational configuration */
|
||||
#define READ_GLOBAL_CONFIGURATION 0x03 /* read the global configuration */
|
||||
#define READ_GLOBAL_STATISTICS 0x04 /* retrieve the global statistics */
|
||||
#define FLUSH_GLOBAL_STATISTICS 0x05 /* flush the global statistics */
|
||||
#define SET_MODEM_STATUS 0x06 /* set the status of DTR and/or RTS */
|
||||
#define READ_MODEM_STATUS 0x07 /* read the current status of CTS and DCD */
|
||||
#define READ_COMMS_ERROR_STATS 0x08 /* read the communication error statistics */
|
||||
#define FLUSH_COMMS_ERROR_STATS 0x09 /* flush the communication error statistics */
|
||||
#define READ_ASY_CODE_VERSION 0x20 /* read the code version */
|
||||
#define SET_ASY_INTERRUPT_TRIGGERS 0x30 /* set the application interrupt triggers */
|
||||
#define READ_ASY_INTERRUPT_TRIGGERS 0x31 /* read the application interrupt trigger configuration */
|
||||
#define SET_ASY_CONFIGURATION 0xE2 /* set the asychronous operational configuration */
|
||||
#define READ_ASY_CONFIGURATION 0xE3 /* read the current asychronous operational configuration */
|
||||
#define ENABLE_ASY_COMMUNICATIONS 0xE4 /* enable asychronous communications */
|
||||
#define DISABLE_ASY_COMMUNICATIONS 0xE5 /* disable asychronous communications */
|
||||
#define READ_ASY_OPERATIONAL_STATS 0xE7 /* retrieve the asychronous operational statistics */
|
||||
#define FLUSH_ASY_OPERATIONAL_STATS 0xE8 /* flush the asychronous operational statistics */
|
||||
#define TRANSMIT_ASY_BREAK_SIGNAL 0xEC /* transmit an asychronous break signal */
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Return codes from interface commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
#define OK 0x00 /* the interface command was successful */
|
||||
#define COMMAND_OK 0x00 /* the interface command was successful */
|
||||
|
||||
/* return codes from global interface commands */
|
||||
#define NO_GLOBAL_EXCEP_COND_TO_REPORT 0x01 /* there is no global exception condition to report */
|
||||
#define LGTH_GLOBAL_CFG_DATA_INVALID 0x01 /* the length of the passed global configuration data is invalid */
|
||||
#define IRQ_TIMEOUT_VALUE_INVALID 0x02 /* an invalid application IRQ timeout value was selected */
|
||||
#define ADAPTER_OPERATING_FREQ_INVALID 0x03 /* an invalid adapter operating frequency was selected */
|
||||
#define TRANSMIT_TIMEOUT_INVALID 0x04 /* the frame transmit timeout is invalid */
|
||||
|
||||
|
||||
/* return codes from command READ_GLOBAL_EXCEPTION_CONDITION */
|
||||
#define EXCEP_MODEM_STATUS_CHANGE 0x10 /* a modem status change occurred */
|
||||
#define EXCEP_APP_IRQ_TIMEOUT 0x12 /* an application IRQ timeout has occurred */
|
||||
#define EXCEP_ASY_BREAK_RECEIVED 0x17 /* a break sequence has been received (asynchronous mode only) */
|
||||
|
||||
/* return codes from interface commands */
|
||||
#define xxxCOMMS_DISABLED 0x21 /* communications are not currently enabled */
|
||||
#define xxxCOMMS_ENABLED 0x21 /* communications are currently enabled */
|
||||
#define LGTH_INT_TRIGGERS_DATA_INVALID 0x22 /* the length of the passed interrupt trigger data is invalid */
|
||||
#define INVALID_IRQ_SELECTED 0x23 /* an invalid IRQ was selected in the SET_ASY_INTERRUPT_TRIGGERS */
|
||||
#define IRQ_TMR_VALUE_INVALID 0x24 /* an invalid application IRQ timer value was selected */
|
||||
#define DISABLE_ASY_COMMS_BEFORE_CFG 0xE1 /* communications must be disabled before setting the configuration */
|
||||
#define ASY_COMMS_ENABLED 0xE1 /* communications are currently enabled */
|
||||
#define ASY_COMMS_DISABLED 0xE1 /* communications are currently disabled */
|
||||
#define ASY_CFG_BEFORE_COMMS_ENABLED 0xE2 /* perform a SET_ASY_CONFIGURATION before enabling comms */
|
||||
#define LGTH_ASY_CFG_DATA_INVALID 0xE2 /* the length of the passed configuration data is invalid */
|
||||
#define INVALID_ASY_CFG_DATA 0xE3 /* the passed configuration data is invalid */
|
||||
#define ASY_BREAK_SIGNAL_BUSY 0xEC /* a break signal is being transmitted */
|
||||
#define INVALID_COMMAND 0xFF /* the defined interface command is invalid */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_GLOBAL_EXCEPTION_CONDITION command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global exception condition structure for handling a modem status change */
|
||||
typedef struct {
|
||||
unsigned char modem_status_change; /* the modem status change */
|
||||
} GLOBAL_EX_MODEM_STRUCT;
|
||||
|
||||
/* settings for the 'modem_status_change' */
|
||||
#define CHANGE_IN_DCD 0x04 /* a change in DCD occured */
|
||||
#define CHANGE_IN_CTS 0x10 /* a change in CTS occured */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the SET_GLOBAL_CONFIGURATION/READ_GLOBAL_CONFIGURATION commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global configuration structure */
|
||||
typedef struct {
|
||||
unsigned short adapter_config_options; /* adapter configuration options */
|
||||
unsigned short app_IRQ_timeout; /* application IRQ timeout */
|
||||
unsigned long adapter_operating_frequency; /* adapter operating frequency */
|
||||
unsigned short frame_transmit_timeout; /* frame transmission timeout */
|
||||
} GLOBAL_CONFIGURATION_STRUCT;
|
||||
|
||||
/* settings for the 'adapter_config_options' */
|
||||
#define ADPTR_CFG_S514 0x0001 /* S514 adapter */
|
||||
|
||||
/* settings for the 'app_IRQ_timeout' */
|
||||
#define MAX_APP_IRQ_TIMEOUT_VALUE 5000 /* the maximum permitted IRQ timeout */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_GLOBAL_STATISTICS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global statistics structure */
|
||||
typedef struct {
|
||||
unsigned short app_IRQ_timeout_count; /* application IRQ timeout count */
|
||||
unsigned short FT1_INS_alarm_count; /* FT1 in-service/alarm condition count */
|
||||
} GLOBAL_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the SET_MODEM_STATUS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the set modem status structure */
|
||||
typedef struct {
|
||||
unsigned char output_modem_status; /* the output modem status */
|
||||
} SET_MODEM_STATUS_STRUCT;
|
||||
|
||||
/* settings for the 'output_modem_status' */
|
||||
#define SET_DTR_HIGH 0x01 /* set DTR high */
|
||||
#define SET_RTS_HIGH 0x02 /* set RTS high */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_MODEM_STATUS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the read modem status structure */
|
||||
typedef struct {
|
||||
unsigned char input_modem_status; /* the input modem status */
|
||||
} READ_MODEM_STATUS_STRUCT;
|
||||
|
||||
/* settings for the 'input_modem_status' */
|
||||
#define DCD_HIGH 0x08 /* DCD is high */
|
||||
#define CTS_HIGH 0x20 /* CTS is high */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_COMMS_ERROR_STATS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the communications error statistics structure */
|
||||
typedef struct {
|
||||
unsigned short Rx_overrun_err_count; /* receiver overrun error count */
|
||||
unsigned short Rx_parity_err_count; /* receiver parity error count */
|
||||
unsigned short Rx_framing_err_count; /* framing errors received count */
|
||||
unsigned short DCD_state_change_count; /* DCD state change count */
|
||||
unsigned short CTS_state_change_count; /* CTS state change count */
|
||||
} COMMS_ERROR_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for using application interrupts
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the structure used for the SET_ASY_INTERRUPT_TRIGGERS/READ_ASY_INTERRUPT_TRIGGERS command */
|
||||
typedef struct {
|
||||
unsigned char interrupt_triggers; /* interrupt trigger configuration */
|
||||
unsigned char IRQ; /* IRQ to be used */
|
||||
unsigned short interrupt_timer; /* interrupt timer */
|
||||
unsigned short misc_interrupt_bits; /* miscellaneous interrupt bits */
|
||||
} ASY_INT_TRIGGERS_STRUCT;
|
||||
|
||||
/* 'interrupt_triggers' bit settings */
|
||||
#define APP_INT_ON_RX 0x01 /* interrupt on reception */
|
||||
#define APP_INT_ON_RX_FRAME APP_INT_ON_RX
|
||||
#define APP_INT_ON_TX 0x02 /* interrupt when data may be transmitted */
|
||||
#define APP_INT_ON_COMMAND_COMPLETE 0x04 /* interrupt when an interface command is complete */
|
||||
#define APP_INT_ON_TIMER 0x08 /* interrupt on a defined millisecond timeout */
|
||||
#define APP_INT_ON_GLOBAL_EXCEP_COND 0x10 /* interrupt on a global exception condition */
|
||||
|
||||
/* 'interrupt_timer' limitation */
|
||||
#define MAX_INTERRUPT_TIMER_VALUE 60000 /* the maximum permitted timer interrupt value */
|
||||
|
||||
/* interrupt types indicated at 'interrupt_type' byte of the INTERRUPT_INFORMATION_STRUCT */
|
||||
#define NO_APP_INTS_PEND 0x00 /* no interrups are pending */
|
||||
#define RX_APP_INT_PEND 0x01 /* a receive interrupt is pending */
|
||||
#define TX_APP_INT_PEND 0x02 /* a transmit interrupt is pending */
|
||||
#define COMMAND_COMPLETE_APP_INT_PEND 0x04 /* a 'command complete' interrupt is pending */
|
||||
#define TIMER_APP_INT_PEND 0x08 /* a timer interrupt is pending */
|
||||
#define GLOBAL_EXCEP_COND_APP_INT_PEND 0x10 /* a global exception condition interrupt is pending */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the SET_ASY_CONFIGURATION/READ_ASY_CONFIGURATION command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the asynchronous configuration structure */
|
||||
typedef struct {
|
||||
unsigned long baud_rate; /* the baud rate */
|
||||
unsigned short line_config_options; /* line configuration options */
|
||||
unsigned short modem_config_options; /* modem configuration options */
|
||||
unsigned short API_options; /* asynchronous API options */
|
||||
unsigned short protocol_options; /* asynchronous protocol options */
|
||||
unsigned short Tx_bits_per_char; /* number of bits per transmitted character */
|
||||
unsigned short Rx_bits_per_char; /* number of bits per received character */
|
||||
unsigned short stop_bits; /* number of stop bits per character */
|
||||
unsigned short parity; /* parity definition */
|
||||
unsigned short break_timer; /* the break signal timer */
|
||||
unsigned short Rx_inter_char_timer; /* the receive inter-character timer */
|
||||
unsigned short Rx_complete_length; /* the receive 'buffer complete' length */
|
||||
unsigned short XON_char; /* the XON character */
|
||||
unsigned short XOFF_char; /* the XOFF character */
|
||||
unsigned short statistics_options; /* operational statistics options */
|
||||
unsigned long ptr_shared_mem_info_struct; /* a pointer to the shared memory area information structure */
|
||||
unsigned long ptr_asy_Tx_stat_el_cfg_struct; /* a pointer to the transmit status element configuration structure */
|
||||
unsigned long ptr_asy_Rx_stat_el_cfg_struct; /* a pointer to the receive status element configuration structure */
|
||||
} ASY_CONFIGURATION_STRUCT;
|
||||
|
||||
/* settings for the 'line_config_options' */
|
||||
#define INTERFACE_LEVEL_V35 0x0000 /* V.35 interface level */
|
||||
#define INTERFACE_LEVEL_RS232 0x0001 /* RS-232 interface level */
|
||||
|
||||
/* settings for the 'modem_config_options' */
|
||||
#define DONT_RAISE_DTR_RTS_ON_EN_COMMS 0x0001 /* don't automatically raise DTR and RTS when performing an */
|
||||
/* ENABLE_ASY_COMMUNICATIONS command */
|
||||
#define DONT_REPORT_CHG_IN_MODEM_STAT 0x0002 /* don't report changes in modem status to the application */
|
||||
|
||||
/* settings for the 'asy_statistics_options' */
|
||||
#define ASY_TX_THROUGHPUT_STAT 0x0004 /* compute the transmit throughput */
|
||||
#define ASY_RX_THROUGHPUT_STAT 0x0008 /* compute the receive throughput */
|
||||
|
||||
/* permitted minimum and maximum values for setting the asynchronous configuration */
|
||||
#define MIN_ASY_BAUD_RATE 50 /* maximum baud rate */
|
||||
#define MAX_ASY_BAUD_RATE 250000 /* minimum baud rate */
|
||||
#define MIN_ASY_BITS_PER_CHAR 5 /* minimum number of bits per character */
|
||||
#define MAX_ASY_BITS_PER_CHAR 8 /* maximum number of bits per character */
|
||||
#define MAX_BREAK_TMR_VAL 5000 /* maximum break signal timer */
|
||||
#define MAX_ASY_RX_INTER_CHAR_TMR 30000 /* maximum receive inter-character timer */
|
||||
#define MAX_ASY_RX_CPLT_LENGTH 2000 /* maximum receive 'length complete' value */
|
||||
|
||||
/* bit settings for the 'asy_API_options' */
|
||||
#define ASY_RX_DATA_TRANSPARENT 0x0001 /* do not strip parity and unused bits from received characters */
|
||||
|
||||
/* bit settings for the 'asy_protocol_options' */
|
||||
#define ASY_RTS_HS_FOR_RX 0x0001 /* RTS handshaking is used for reception control */
|
||||
#define ASY_XON_XOFF_HS_FOR_RX 0x0002 /* XON/XOFF handshaking is used for reception control */
|
||||
#define ASY_XON_XOFF_HS_FOR_TX 0x0004 /* XON/XOFF handshaking is used for transmission control */
|
||||
#define ASY_DCD_HS_FOR_TX 0x0008 /* DCD handshaking is used for transmission control */
|
||||
#define ASY_CTS_HS_FOR_TX 0x0020 /* CTS handshaking is used for transmission control */
|
||||
#define ASY_HDLC_FRAMING 0x0100 /* use HDLC framing */
|
||||
#define ASY_HDLC_PASS_RX_CRC_TO_APP 0x0200 /* pass received HDLC CRC bytes to the application */
|
||||
#define ASY_HDLC_PASS_RX_BAD_TO_APP 0x0400 /* pass received bad frames to the application */
|
||||
#define ASY_DIS_RX_WHEN_TX 0x1000 /* disable the receiver when transmitting */
|
||||
|
||||
/* bit settings for the 'stop_bits' definition */
|
||||
#define ONE_STOP_BIT 1 /* representation for 1 stop bit */
|
||||
#define TWO_STOP_BITS 2 /* representation for 2 stop bits */
|
||||
#define ONE_AND_A_HALF_STOP_BITS 3 /* representation for 1.5 stop bits */
|
||||
|
||||
/* bit settings for the 'parity' definition */
|
||||
#define NO_PARITY 0 /* representation for no parity */
|
||||
#define ODD_PARITY 1 /* representation for odd parity */
|
||||
#define EVEN_PARITY 2 /* representation for even parity */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_COMMS_ERROR_STATS command (asynchronous mode)
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the communications error statistics structure */
|
||||
typedef struct {
|
||||
unsigned short Rx_overrun_err_count; /* receiver overrun error count */
|
||||
unsigned short Rx_parity_err_count; /* parity errors received count */
|
||||
unsigned short Rx_framing_err_count; /* framing errors received count */
|
||||
unsigned short DCD_state_change_count; /* DCD state change count */
|
||||
unsigned short CTS_state_change_count; /* CTS state change count */
|
||||
} ASY_COMMS_ERROR_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_ASY_OPERATIONAL_STATS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the asynchronous operational statistics structure */
|
||||
typedef struct {
|
||||
|
||||
/* transmission statistics */
|
||||
unsigned long blocks_Tx_count; /* number of blocks transmitted */
|
||||
unsigned long bytes_Tx_count; /* number of bytes transmitted */
|
||||
unsigned long Tx_throughput; /* transmit throughput */
|
||||
unsigned long no_ms_for_Tx_thruput_comp; /* millisecond time used for the Tx throughput computation */
|
||||
unsigned long Tx_block_discard_lgth_err_count;/* number of blocks discarded (length error) */
|
||||
|
||||
/* reception statistics */
|
||||
unsigned long blocks_Rx_count; /* number of blocks received */
|
||||
unsigned long bytes_Rx_count; /* number of bytes received */
|
||||
unsigned long Rx_throughput; /* receive throughput */
|
||||
unsigned long no_ms_for_Rx_thruput_comp; /* millisecond time used for the Rx throughput computation */
|
||||
unsigned long Rx_bytes_discard_count; /* received Data bytes discarded */
|
||||
|
||||
/* handshaking protocol statistics */
|
||||
unsigned short XON_chars_Tx_count; /* number of XON characters transmitted */
|
||||
unsigned short XOFF_chars_Tx_count; /* number of XOFF characters transmitted */
|
||||
unsigned short XON_chars_Rx_count; /* number of XON characters received */
|
||||
unsigned short XOFF_chars_Rx_count; /* number of XOFF characters received */
|
||||
unsigned short Tx_halt_modem_low_count; /* number of times Tx halted (modem line low) */
|
||||
unsigned short Rx_halt_RTS_low_count; /* number of times Rx halted by setting RTS low */
|
||||
|
||||
/* break statistics */
|
||||
unsigned short break_Tx_count; /* number of break sequences transmitted */
|
||||
unsigned short break_Rx_count; /* number of break sequences received */
|
||||
|
||||
} ASY_OPERATIONAL_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for data transmission
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the data block transmit status element configuration structure */
|
||||
typedef struct {
|
||||
unsigned short number_Tx_status_elements; /* number of transmit status elements */
|
||||
unsigned long base_addr_Tx_status_elements; /* base address of the transmit element list */
|
||||
unsigned long next_Tx_status_element_to_use; /* pointer to the next transmit element to be used */
|
||||
} ASY_TX_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
|
||||
/* the data block transmit status element structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag; /* opp flag */
|
||||
unsigned short data_length; /* length of the block to be transmitted */
|
||||
unsigned char misc_bits; /* miscellaneous transmit bits */
|
||||
unsigned char reserved[8]; /* reserved for internal use */
|
||||
unsigned long ptr_data_bfr; /* pointer to the data area */
|
||||
} ASY_DATA_TX_STATUS_EL_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for data reception
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the data block receive status element configuration structure */
|
||||
typedef struct {
|
||||
unsigned short number_Rx_status_elements; /* number of receive status elements */
|
||||
unsigned long base_addr_Rx_status_elements; /* base address of the receive element list */
|
||||
unsigned long next_Rx_status_element_to_use; /* pointer to the next receive element to be used */
|
||||
unsigned long base_addr_Rx_buffer; /* base address of the receive data buffer */
|
||||
unsigned long end_addr_Rx_buffer; /* end address of the receive data buffer */
|
||||
} ASY_RX_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/* the data block receive status element structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag; /* opp flag */
|
||||
unsigned short data_length; /* length of the received data block */
|
||||
unsigned char misc_bits; /* miscellaneous receive bits */
|
||||
unsigned short time_stamp; /* receive time stamp (HDLC_STREAMING_MODE) */
|
||||
unsigned short data_buffered; /* the number of data bytes still buffered */
|
||||
unsigned char reserved[4]; /* reserved for internal use */
|
||||
unsigned long ptr_data_bfr; /* pointer to the data area */
|
||||
} ASY_DATA_RX_STATUS_EL_STRUCT;
|
||||
|
||||
/* settings for the 'misc_bits' */
|
||||
#define RX_HDLC_FRM_ABORT 0x01 /* the incoming frame was aborted */
|
||||
#define RX_HDLC_FRM_CRC_ERROR 0x02 /* the incoming frame has a CRC error */
|
||||
#define RX_FRM_OVERRUN_ERROR 0x04 /* the incoming frame has an overrun error */
|
||||
#define RX_HDLC_FRM_SHORT_ERROR 0x10 /* the incoming frame was too short */
|
||||
#define RX_HDLC_FRM_LONG_ERROR 0x20 /* the incoming frame was too long */
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants defining the shared memory information area
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global information structure */
|
||||
typedef struct {
|
||||
unsigned char global_status; /* global status */
|
||||
unsigned char modem_status; /* current modem status */
|
||||
unsigned char global_excep_conditions; /* global exception conditions */
|
||||
unsigned char glob_info_reserved[5]; /* reserved */
|
||||
unsigned char code_name[4]; /* code name */
|
||||
unsigned char code_version[4]; /* code version */
|
||||
} GLOBAL_INFORMATION_STRUCT;
|
||||
|
||||
/* the ASY information structure */
|
||||
typedef struct {
|
||||
unsigned char asy_rx_avail;
|
||||
unsigned char asy_info_reserved[15]; /* reserved */
|
||||
} ASY_INFORMATION_STRUCT;
|
||||
|
||||
/* the interrupt information structure */
|
||||
typedef struct {
|
||||
unsigned char interrupt_type; /* type of interrupt triggered */
|
||||
unsigned char interrupt_permission; /* interrupt permission mask */
|
||||
unsigned char int_info_reserved[14]; /* reserved */
|
||||
} INTERRUPT_INFORMATION_STRUCT;
|
||||
|
||||
/* the FT1 information structure */
|
||||
typedef struct {
|
||||
unsigned char parallel_port_A_input; /* input - parallel port A */
|
||||
unsigned char parallel_port_B_input; /* input - parallel port B */
|
||||
unsigned char FT1_INS_alarm_condition; /* the current FT1 in-service/alarm condition */
|
||||
unsigned char FT1_info_reserved[13]; /* reserved */
|
||||
} FT1_INFORMATION_STRUCT;
|
||||
|
||||
|
||||
/* the shared memory area information structure */
|
||||
typedef struct {
|
||||
GLOBAL_INFORMATION_STRUCT global_info_struct; /* the global information structure */
|
||||
ASY_INFORMATION_STRUCT async_info_struct; /* the asynchronous information structure */
|
||||
INTERRUPT_INFORMATION_STRUCT interrupt_info_struct;/* the interrupt information structure */
|
||||
FT1_INFORMATION_STRUCT FT1_info_struct; /* the FT1 information structure */
|
||||
} SHARED_MEMORY_INFO_STRUCT;
|
||||
|
||||
|
||||
#define MAX_LGTH_HDLC_FRAME 2048 /* the maximum permitted length of an HDLC frame */
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* HDLC Interface commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
#define READ_HDLC_OPERATIONAL_STATS 0xF0 /* retrieve the HDLC operational statistics */
|
||||
#define FLUSH_HDLC_OPERATIONAL_STATS 0xF1 /* flush the HDLC operational statistics */
|
||||
|
||||
/* the HDLC operational statistics structure (returned on READ_HDLC_OPERATIONAL_STATS command) */
|
||||
typedef struct {
|
||||
/* frame transmission statistics */
|
||||
unsigned long frames_Tx_count; /* number of frames transmitted */
|
||||
unsigned long bytes_Tx_count; /* number of bytes transmitted */
|
||||
unsigned long Tx_frame_discard_lgth_err_count;/* number of frames discarded (length error) */
|
||||
|
||||
/* frame reception statistics */
|
||||
unsigned long frames_Rx_count; /* number of frames received */
|
||||
unsigned long bytes_Rx_count; /* number of bytes received */
|
||||
unsigned long Rx_frame_short_count; /* received frames too short */
|
||||
unsigned long Rx_frame_long_count; /* received frames too long */
|
||||
unsigned long Rx_frame_discard_full_count; /* received frames discarded (buffer full) */
|
||||
unsigned long CRC_error_count; /* receiver CRC error count */
|
||||
unsigned long Rx_abort_count; /* abort frames received count */
|
||||
} HDLC_OPERATIONAL_STATS_STRUCT;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
|
||||
|
||||
#define UDPMGMT_SIGNATURE "CTPIPEAB"
|
||||
#define UDPMGMT_SIGNATURE_LEN 8
|
||||
|
||||
|
||||
/* UDP/IP packet (for UDP management) layout */
|
||||
/*
|
||||
typedef struct {
|
||||
unsigned char reserved[2] PACKED;
|
||||
unsigned short ip_length PACKED;
|
||||
unsigned char reserved2[4] PACKED;
|
||||
unsigned char ip_ttl PACKED;
|
||||
unsigned char ip_protocol PACKED;
|
||||
unsigned short ip_checksum PACKED;
|
||||
unsigned long ip_src_address PACKED;
|
||||
unsigned long ip_dst_address PACKED;
|
||||
unsigned short udp_src_port PACKED;
|
||||
unsigned short udp_dst_port PACKED;
|
||||
unsigned short udp_length PACKED;
|
||||
unsigned short udp_checksum PACKED;
|
||||
udp_management_packet_t um_packet PACKED;
|
||||
} ip_packet_t;
|
||||
*/
|
||||
|
||||
/* valid ip_protocol for UDP management */
|
||||
#define UDPMGMT_UDP_PROTOCOL 0x11
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
unsigned char status PACKED;
|
||||
unsigned char data_avail PACKED;
|
||||
unsigned short real_length PACKED;
|
||||
unsigned short time_stamp PACKED;
|
||||
unsigned char data[1] PACKED;
|
||||
} trace_pkt_t;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
unsigned char error_flag PACKED;
|
||||
unsigned short time_stamp PACKED;
|
||||
unsigned char reserved[13] PACKED;
|
||||
} api_rx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_rx_hdr_t api_rx_hdr PACKED;
|
||||
unsigned char data[1] PACKED;
|
||||
} api_rx_element_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char attr PACKED;
|
||||
unsigned char misc_Tx_bits PACKED;
|
||||
unsigned char reserved[14] PACKED;
|
||||
} api_tx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_tx_hdr_t api_tx_hdr PACKED;
|
||||
unsigned char data[1] PACKED;
|
||||
} api_tx_element_t;
|
||||
|
||||
/* Special UDP drivers management commands */
|
||||
#define CPIPE_ENABLE_TRACING 0x50
|
||||
#define CPIPE_DISABLE_TRACING 0x51
|
||||
#define CPIPE_GET_TRACE_INFO 0x52
|
||||
#define CPIPE_GET_IBA_DATA 0x53
|
||||
#define CPIPE_FT1_READ_STATUS 0x54
|
||||
#define CPIPE_DRIVER_STAT_IFSEND 0x55
|
||||
#define CPIPE_DRIVER_STAT_INTR 0x56
|
||||
#define CPIPE_DRIVER_STAT_GEN 0x57
|
||||
#define CPIPE_FLUSH_DRIVER_STATS 0x58
|
||||
#define CPIPE_ROUTER_UP_TIME 0x59
|
||||
|
||||
#if 0
|
||||
#define CPIPE_MPPP_TRACE_ENABLE 0x60
|
||||
#define CPIPE_MPPP_TRACE_DISABLE 0x61
|
||||
#define CPIPE_TE1_56K_STAT 0x62 /* TE1_56K */
|
||||
#define CPIPE_GET_MEDIA_TYPE 0x63 /* TE1_56K */
|
||||
#define CPIPE_FLUSH_TE1_PMON 0x64 /* TE1 */
|
||||
#define CPIPE_READ_REGISTER 0x65 /* TE1_56K */
|
||||
#define CPIPE_TE1_CFG 0x66 /* TE1 */
|
||||
#endif
|
||||
|
||||
/* Driver specific commands for API */
|
||||
#define CHDLC_READ_TRACE_DATA 0xE4 /* read trace data */
|
||||
#define TRACE_ALL 0x00
|
||||
#define TRACE_PROT 0x01
|
||||
#define TRACE_DATA 0x02
|
||||
|
||||
#define SIOC_ASYHDLC_RX_AVAIL_CMD SIOC_WANPIPE_DEVPRIVATE
|
||||
#define SIOC_GET_HDLC_RECEIVER_STATUS SIOC_ASYHDLC_RX_AVAIL_CMD
|
||||
|
||||
/* Return codes for SIOC_GET_HDLC_RECEIVER_STATUS cmd */
|
||||
enum {
|
||||
HDLC_RX_IN_PROCESS,
|
||||
NO_HDLC_RX_IN_PROCESS
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -1,794 +0,0 @@
|
|||
/************************************************************************************
|
||||
* *
|
||||
* PHYAPI.H - the 'C' header file for the Sangoma S508/S514 PHY-level ATM code API. *
|
||||
* *
|
||||
************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __SDLA_ATM_H_
|
||||
#define __SDLA_ATM_H_
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants defining the shared memory control block (mailbox)
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
#define BASE_ADDR_MB_STRUCT 0xE000 /* the base address of the mailbox structure */
|
||||
#define NUMBER_MB_RESERVED_BYTES 0x0B /* the number of reserved bytes in the mailbox header area */
|
||||
#define SIZEOF_MB_DATA_BFR 240 /* the size of the actual mailbox data area */
|
||||
|
||||
/* the control block mailbox structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag; /* the opp flag */
|
||||
unsigned char command; /* the user command */
|
||||
unsigned short buffer_length; /* the data length */
|
||||
unsigned char return_code; /* the return code */
|
||||
char MB_reserved[NUMBER_MB_RESERVED_BYTES]; /* reserved for later use */
|
||||
char data[SIZEOF_MB_DATA_BFR]; /* the data area */
|
||||
} ATM_MAILBOX_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Interface commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* global interface commands */
|
||||
#define READ_GLOBAL_EXCEPTION_CONDITION 0x01 /* read a global exception condition from the adapter */
|
||||
#define SET_GLOBAL_CONFIGURATION 0x02 /* set the global operational configuration */
|
||||
#define READ_GLOBAL_CONFIGURATION 0x03 /* read the global configuration */
|
||||
#define READ_GLOBAL_STATISTICS 0x04 /* retrieve the global statistics */
|
||||
#define FLUSH_GLOBAL_STATISTICS 0x05 /* flush the global statistics */
|
||||
#define SET_MODEM_STATUS 0x06 /* set the status of DTR and/or RTS */
|
||||
#define READ_MODEM_STATUS 0x07 /* read the current status of CTS and DCD */
|
||||
#define READ_COMMS_ERROR_STATS 0x08 /* read the communication error statistics */
|
||||
#define FLUSH_COMMS_ERROR_STATS 0x09 /* flush the communication error statistics */
|
||||
#define SET_TRACE_CONFIGURATION 0x0A /* set the line trace configuration */
|
||||
#define READ_TRACE_CONFIGURATION 0x0B /* read the line trace configuration */
|
||||
#define READ_TRACE_STATISTICS 0x0C /* read the trace statistics */
|
||||
#define FLUSH_TRACE_STATISTICS 0x0D /* flush the trace statistics */
|
||||
|
||||
/* PHY-level interface commands */
|
||||
#define PHY_READ_CODE_VERSION 0x20 /* read the ATM code version */
|
||||
#define PHY_READ_EXCEPTION_CONDITION 0x21 /* read a PHY-level exception condition from the adapter */
|
||||
#define PHY_SET_CONFIGURATION 0x22 /* set the PHY-level configuration */
|
||||
#define PHY_READ_CONFIGURATION 0x23 /* read the PHY-level configuration */
|
||||
#define PHY_ENABLE_COMMUNICATIONS 0x24 /* enable PHY-level communications */
|
||||
#define PHY_DISABLE_COMMUNICATIONS 0x25 /* disable PHY-level communications */
|
||||
#define PHY_READ_STATUS 0x26 /* read the PHY-level status */
|
||||
#define PHY_READ_OPERATIONAL_STATS 0x27 /* retrieve the PHY-level operational statistics */
|
||||
#define PHY_FLUSH_OPERATIONAL_STATS 0x28 /* flush the PHY-level operational statistics */
|
||||
#define PHY_RESYNCHRONIZE_RECEIVER 0x29 /* resynchronize the receiver */
|
||||
#define PHY_SET_TX_UNDERRUN_CONFIG 0x2A /* set the transmit underrun cell configuration */
|
||||
#define PHY_READ_TX_UNDERRUN_CONFIG 0x2B /* read the transmit underrun cell configuration */
|
||||
#define PHY_SET_INTERRUPT_TRIGGERS 0x30 /* set the PHY-level application interrupt triggers */
|
||||
#define PHY_READ_INTERRUPT_TRIGGERS 0x31 /* read the PHY-level application interrupt trigger configuration */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Return codes from interface commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
#define OK 0x00 /* the interface command was successful */
|
||||
|
||||
/* return codes from global interface commands */
|
||||
#define NO_GLOBAL_EXCEP_COND_TO_REPORT 0x01 /* there is no global exception condition to report */
|
||||
#define LGTH_GLOBAL_CFG_DATA_INVALID 0x01 /* the length of the passed global configuration data is invalid */
|
||||
#define LGTH_TRACE_CFG_DATA_INVALID 0x01 /* the length of the passed trace configuration data is invalid */
|
||||
#define IRQ_TIMEOUT_VALUE_INVALID 0x02 /* an invalid application IRQ timeout value was selected */
|
||||
#define TRACE_CONFIG_INVALID 0x02 /* the passed line trace configuration is invalid */
|
||||
#define ADAPTER_OPERATING_FREQ_INVALID 0x03 /* an invalid adapter operating frequency was selected */
|
||||
|
||||
/* return codes from command READ_GLOBAL_EXCEPTION_CONDITION */
|
||||
#define EXCEP_MODEM_STATUS_CHANGE 0x10 /* a modem status change occurred */
|
||||
#define EXCEP_APP_IRQ_TIMEOUT 0x12 /* an application IRQ timeout has occurred */
|
||||
|
||||
/* return codes from PHY-level interface commands */
|
||||
#define PHY_NO_EXCEP_COND_TO_REPORT 0x21 /* there is no PHY-level exception condition to report */
|
||||
#define PHY_COMMS_DISABLED 0x21 /* communications are not currently enabled */
|
||||
#define PHY_COMMS_ENABLED 0x21 /* communications are currently enabled */
|
||||
#define PHY_DISABLE_COMMS_BEFORE_CFG 0x21 /* communications must be disabled before setting the configuration */
|
||||
#define PHY_CFG_BEFORE_COMMS_ENABLED 0x22 /* perform a PHY_SET_CONFIGURATION before enabling comms */
|
||||
#define PHY_LGTH_CFG_DATA_INVALID 0x22 /* the length of the passed configuration data is invalid */
|
||||
#define PHY_LGTH_INT_TRIG_DATA_INVALID 0x22 /* the length of the passed interrupt trigger data is invalid */
|
||||
#define PHY_LGTH_TX_UND_DATA_INVALID 0x22 /* the length of the passed transmit underrun data is invalid */
|
||||
#define PHY_RX_NOT_SYNCHRONIZED 0x22 /* the receiver is not synchronized */
|
||||
#define PHY_INVALID_IRQ_SELECTED 0x23 /* an invalid IRQ was selected in the PHY_SET_INTERRUPT_TRIGGERS */
|
||||
#define PHY_INVALID_CFG_DATA 0x23 /* the passed configuration data is invalid */
|
||||
#define PHY_IRQ_TMR_VALUE_INVALID 0x24 /* an invalid application IRQ timer value was selected */
|
||||
#define PHY_INVALID_COMMAND 0x2F /* the defined interface command is invalid */
|
||||
|
||||
/* return codes from command PHY_READ_EXCEPTION_CONDITION */
|
||||
#define PHY_EXCEP_RX_SYNC_STATE_CHANGE 0x30 /* the PHY receiver has changed state */
|
||||
#define PHY_EXCEP_INVALID_HEC 0x32 /* the Rx consecutive incorrect HEC counter has expired */
|
||||
#define PHY_EXCEP_RECEP_LOSS 0x33 /* the cell reception sync loss timer has expired */
|
||||
#define PHY_EXCEP_RX_DISCARD 0x36 /* incoming cells were discarded */
|
||||
#define PHY_EXCEP_TX_LENGTH_ERROR 0x37 /* a transmit buffer of invalid length was detected */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_GLOBAL_EXCEPTION_CONDITION command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global exception condition structure for handling a modem status change */
|
||||
typedef struct {
|
||||
unsigned char modem_status_change; /* the modem status change */
|
||||
} GLOBAL_EX_MODEM_STRUCT;
|
||||
|
||||
/* settings for the 'modem_status_change' */
|
||||
#define CHANGE_IN_DCD 0x04 /* a change in DCD occured */
|
||||
#define CHANGE_IN_CTS 0x10 /* a change in CTS occured */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the SET_GLOBAL_CONFIGURATION/READ_GLOBAL_CONFIGURATION commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global configuration structure */
|
||||
typedef struct {
|
||||
unsigned short adapter_config_options; /* adapter configuration options */
|
||||
unsigned short app_IRQ_timeout; /* application IRQ timeout */
|
||||
unsigned long adapter_operating_frequency; /* adapter operating frequency */
|
||||
} GLOBAL_CONFIGURATION_STRUCT;
|
||||
|
||||
/* settings for the 'adapter_config_options' */
|
||||
#define ADPTR_CFG_S514 0x0001 /* S514 adapter */
|
||||
|
||||
/* settings for the 'app_IRQ_timeout' */
|
||||
#define MAX_APP_IRQ_TIMEOUT_VALUE 5000 /* the maximum permitted IRQ timeout */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_GLOBAL_STATISTICS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global statistics structure */
|
||||
typedef struct {
|
||||
unsigned short app_IRQ_timeout_count; /* application IRQ timeout count */
|
||||
} GLOBAL_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the SET_MODEM_STATUS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the set modem status structure */
|
||||
typedef struct {
|
||||
unsigned char output_modem_status; /* the output modem status */
|
||||
} SET_MODEM_STATUS_STRUCT;
|
||||
|
||||
/* settings for the 'output_modem_status' */
|
||||
#define SET_DTR_HIGH 0x01 /* set DTR high */
|
||||
#define SET_RTS_HIGH 0x02 /* set RTS high */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_MODEM_STATUS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the read modem status structure */
|
||||
typedef struct {
|
||||
unsigned char input_modem_status; /* the input modem status */
|
||||
} READ_MODEM_STATUS_STRUCT;
|
||||
|
||||
/* settings for the 'input_modem_status' */
|
||||
#define DCD_HIGH 0x08 /* DCD is high */
|
||||
#define CTS_HIGH 0x20 /* CTS is high */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_COMMS_ERROR_STATS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the communications error statistics structure */
|
||||
typedef struct {
|
||||
unsigned short Rx_overrun_err_count; /* receiver overrun error count */
|
||||
unsigned short reserved_0; /* reserved for later use */
|
||||
unsigned short reserved_1; /* reserved for later use */
|
||||
unsigned short DCD_state_change_count; /* DCD state change count */
|
||||
unsigned short CTS_state_change_count; /* CTS state change count */
|
||||
} COMMS_ERROR_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants used for line tracing
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the trace configuration structure (SET_TRACE_CONFIGURATION/READ_TRACE_CONFIGURATION commands) */
|
||||
typedef struct {
|
||||
unsigned char trace_config; /* trace configuration */
|
||||
unsigned long ptr_trace_stat_el_cfg_struct; /* a pointer to the line trace element configuration structure */
|
||||
} LINE_TRACE_CONFIG_STRUCT;
|
||||
|
||||
/* 'trace_config' bit settings */
|
||||
#define TRACE_INACTIVE 0x00 /* trace is inactive */
|
||||
#define TRACE_ACTIVE 0x01 /* trace is active */
|
||||
#define TRACE_LIMIT_REPEAT_CELLS 0x08 /* limit the tracing of repeated Physical Layer and Idle Cells */
|
||||
#define TRACE_PHY_UNASSIGNED_CELLS 0x10 /* trace Unassigned Cells */
|
||||
#define TRACE_PHY_IDLE_CELLS 0x20 /* trace Idle Cells */
|
||||
#define TRACE_PHY_PHYS_LAYER_CELLS 0x40 /* trace Physical Layer Cells */
|
||||
#define TRACE_PHY_NON_UNAS_PHYS_CELLS 0x80 /* trace cells other than Physical Layer and Idle Cells */
|
||||
|
||||
/* the line trace status element configuration structure */
|
||||
typedef struct {
|
||||
unsigned short number_trace_status_els; /* number of line trace elements */
|
||||
unsigned long base_addr_trace_status_els; /* base address of the trace element list */
|
||||
unsigned long next_trace_el_to_use; /* pointer to the next trace element to be used */
|
||||
} TRACE_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/* the line trace status element structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag; /* opp flag */
|
||||
unsigned short trace_length; /* trace length */
|
||||
unsigned char trace_type; /* trace type */
|
||||
unsigned short trace_time_stamp; /* time stamp */
|
||||
unsigned short trace_reserved_1; /* reserved for later use */
|
||||
unsigned long trace_reserved_2; /* reserved for later use */
|
||||
unsigned long ptr_data_bfr; /* pointer to the trace data buffer */
|
||||
} TRACE_STATUS_ELEMENT_STRUCT;
|
||||
|
||||
/* settings for the 'trace_type' */
|
||||
#define TRACE_INCOMING 0x00 /* an incoming block/cell has been traced */
|
||||
#define TRACE_OUTGOING 0x01 /* an outgoing block/cell has been traced */
|
||||
#define TRACE_HEC_ERROR 0x80 /* the traced cell has a HEC error */
|
||||
|
||||
/* the line trace statistics structure */
|
||||
typedef struct {
|
||||
unsigned long blocks_traced_count; /* number of blocks traced */
|
||||
unsigned long trc_blocks_discarded_count; /* number of trace blocks discarded */
|
||||
} LINE_TRACE_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the PHY_READ_EXCEPTION_CONDITION command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the structure returned on a return code PHY_EXCEP_RX_SYNC_STATE_CHANGE */
|
||||
/* Note that the definitions for the 'Rx_sync_status' are as per the PHY_READ_STATUS command */
|
||||
typedef struct {
|
||||
unsigned char Rx_sync_status; /* receiver synchronization status */
|
||||
} PHY_RX_SYNC_EXCEP_STRUCT;
|
||||
|
||||
/* the structure returned on a return code PHY_EXCEP_RX_DISCARD */
|
||||
typedef struct {
|
||||
unsigned long Rx_discard_count; /* number of incoming blocks discarded */
|
||||
} PHY_RX_DISC_EXCEP_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the PHY_SET_CONFIGURATION/PHY_READ_CONFIGURATION command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the PHY-level configuration structure */
|
||||
typedef struct {
|
||||
unsigned long baud_rate; /* the baud rate */
|
||||
unsigned short line_config_options; /* line configuration options */
|
||||
unsigned short modem_config_options; /* modem configuration options */
|
||||
unsigned short modem_status_timer; /* timer for monitoring modem status changes */
|
||||
unsigned short API_options; /* API options */
|
||||
unsigned short protocol_options; /* protocol options */
|
||||
unsigned short HEC_options; /* HEC options */
|
||||
unsigned char custom_Rx_COSET; /* the custom COSET value used when checking the HEC value in received cells */
|
||||
unsigned char custom_Tx_COSET; /* the custom COSET value used when setting the HEC value in transmitted cells */
|
||||
unsigned short buffer_options; /* Tx/Rx buffer options */
|
||||
unsigned short max_cells_in_Tx_block; /* the maximum number of cells in an outgoing block */
|
||||
unsigned char Tx_underrun_cell_GFC; /* the GFC value in a Tx underrun cell */
|
||||
unsigned char Tx_underrun_cell_PT; /* the PT value in a Tx underrun cell */
|
||||
unsigned char Tx_underrun_cell_CLP; /* the CLP value in a Tx underrun cell */
|
||||
unsigned char Tx_underrun_cell_payload; /* the payload character in a Tx underrun cell */
|
||||
unsigned short max_cells_in_Rx_block; /* the maximum number of cells in an incoming block */
|
||||
unsigned short Rx_hunt_timer; /* receiver hunt timer */
|
||||
unsigned short Rx_sync_bytes; /* receiver synchronization bytes */
|
||||
unsigned short Rx_sync_offset; /* offset of the receiver synchronization bytes */
|
||||
unsigned short cell_Rx_sync_loss_timer; /* cell reception synchronization loss timer */
|
||||
unsigned short Rx_HEC_check_timer; /* the Rx HEC check timer */
|
||||
unsigned short Rx_bad_HEC_timer; /* the time period for monitoring cells with bad HEC values */
|
||||
unsigned short Rx_max_bad_HEC_count; /* the maximum number of bad HEC count */
|
||||
unsigned short statistics_options; /* operational statistics options */
|
||||
unsigned long ptr_shared_mem_info_struct; /* a pointer to the shared memory area information structure */
|
||||
unsigned long ptr_Tx_stat_el_cfg_struct; /* a pointer to the transmit status element configuration structure */
|
||||
unsigned long ptr_Rx_stat_el_cfg_struct; /* a pointer to the receive status element configuration structure */
|
||||
} PHY_CONFIGURATION_STRUCT;
|
||||
|
||||
/* settings for the 'line_config_options' */
|
||||
#define PHY_INTERFACE_LEVEL_V35 0x0001 /* V.35 interface level */
|
||||
#define PHY_INTERFACE_LEVEL_RS232 0x0002 /* RS-232 interface level */
|
||||
|
||||
/* settings for the 'modem_config_options' */
|
||||
#define PHY_MANUAL_DTR_RTS 0x0001 /* don't automatically raise DTR and RTS when performing an */
|
||||
/* PHY_ENABLE_COMMUNICATIONS command */
|
||||
#define PHY_IGNORE_CHG_MODEM_STATUS 0x0002 /* don't report changes in modem status to the application */
|
||||
|
||||
/* settings for the 'API_options' */
|
||||
#define PHY_DISCARD_RX_UNASSIGNED_CELLS 0x0001 /* discard incoming Unassigned Cells */
|
||||
#define PHY_DISCARD_RX_IDLE_CELLS 0x0002 /* discard incoming Idle Cells */
|
||||
#define PHY_DISCARD_RX_PHYS_LAYER_CELLS 0x0004 /* discard incoming Physical Layer Cells */
|
||||
#define PHY_TRANSPARENT_TX_RX_CELLS 0x0010 /* cells passed to and from the application transparently */
|
||||
#define PHY_DECODED_TX_RX_CELLS 0x0020 /* cells decoded and formatted by the PHY firmware */
|
||||
|
||||
/* settings for the 'protocol_options' */
|
||||
#define PHY_UNI 0x0001 /* configure as a User-Network Interface */
|
||||
#define PHY_NNI 0x0002 /* configure as a Network Node Interface */
|
||||
#define PHY_MANUAL_RX_SYNC 0x0100 /* use user-defined Rx synchronization parameters */
|
||||
|
||||
/* settings for the 'HEC_options' */
|
||||
#define PHY_DISABLE_RX_HEC_CHECK 0x0001 /* disable the checking of the HEC value in received cells */
|
||||
#define PHY_DISABLE_AUTO_SYNC_BAD_HEC 0x0002 /* disable automatic resynchronization on receipt of cells with bad HEC values */
|
||||
#define PHY_DISABLE_RX_COSET 0x0010 /* disable XOR with COSET when checking the HEC value in received cells */
|
||||
#define PHY_DISABLE_TX_COSET 0x0020 /* disable XOR with COSET when setting the HEC value in transmitted cells */
|
||||
#define PHY_CUSTOM_RX_COSET 0x0040 /* use a custom COSET when checking the HEC value in received cells */
|
||||
#define PHY_CUSTOM_TX_COSET 0x0080 /* use a custom COSET when setting the HEC value in transmitted cells */
|
||||
|
||||
/* bit settings for the 'buffer_options' */
|
||||
#define PHY_TX_ONLY 0x0001 /* transmit only (no reception) */
|
||||
#define PHY_RX_ONLY 0x0002 /* receive only (no transmission) */
|
||||
#define PHY_SINGLE_TX_BUFFER 0x0010 /* configure a single transmit buffer */
|
||||
|
||||
/* settings for the 'statistics_options' */
|
||||
#define PHY_TX_BYTE_COUNT_STAT 0x0001 /* record the number of bytes transmitted */
|
||||
#define PHY_RX_BYTE_COUNT_STAT 0x0002 /* record the number of bytes received */
|
||||
#define PHY_TX_THROUGHPUT_STAT 0x0004 /* compute the transmit throughput */
|
||||
#define PHY_RX_THROUGHPUT_STAT 0x0008 /* compute the receive throughput */
|
||||
#define PHY_INCL_UNDERRUN_TX_THRUPUT 0x0010 /* include Tx underrun cells in Tx throughput */
|
||||
#define PHY_INCL_DISC_RX_THRUPUT 0x0020 /* include discarded (idle/unassigned) Rx cells in Rx throughput */
|
||||
|
||||
/* permitted minimum and maximum values for setting the PHY configuration */
|
||||
#define PHY_MAX_BAUD_RATE_S508 2666666 /* maximum baud rate (S508) */
|
||||
#define PHY_MAX_BAUD_RATE_S514 2750000 /* maximum baud rate (S514) */
|
||||
#define PHY_MIN_MODEM_TIMER 0 /* minimum modem status timer */
|
||||
#define PHY_MAX_MODEM_TIMER 6000 /* maximum modem status timer */
|
||||
#define PHY_MIN_RX_HUNT_TIMER 1 /* minimum receiver hunt timer */
|
||||
#define PHY_MAX_RX_HUNT_TIMER 6000 /* maximum receiver hunt timer */
|
||||
#define PHY_MIN_RX_SYNC_OFFSET 0 /* minimum offset of receiver synchronization bytes */
|
||||
#define PHY_MAX_RX_SYNC_OFFSET 50 /* maximum offset of receiver synchronization bytes */
|
||||
#define PHY_MIN_CELLS_IN_TX_BLOCK 1 /* minimum number of cells in an outgoing block */
|
||||
#define PHY_MAX_CELLS_IN_TX_BLOCK 38 /* maximum number of cells in an outgoing block */
|
||||
#define PHY_MIN_CELLS_IN_RX_BLOCK 1 /* minimum number of cells in an incoming block */
|
||||
#define PHY_MAX_CELLS_IN_RX_BLOCK 38 /* maximum number of cells in an incoming block */
|
||||
#define PHY_MAX_RX_SYNC_LOSS_TIMER 6000 /* maximum cell reception sync loss timer */
|
||||
#define PHY_MAX_RX_HEC_CHECK_TIMER 6000 /* maximum receive HEC check timer */
|
||||
#define PHY_MIN_RX_BAD_HEC_TIMER 5 /* minimum time for monitoring cells with bad HEC values */
|
||||
#define PHY_MAX_RX_BAD_HEC_TIMER 60000 /* maximum time for monitoring cells with bad HEC values */
|
||||
#define PHY_MIN_RX_BAD_HEC_COUNT 1 /* the minimum bad HEC counter */
|
||||
#define PHY_MAX_RX_BAD_HEC_COUNT 10000 /* the maximum bad HEC counter */
|
||||
#define PHY_MAX_RX_INCORRECT_HEC_COUNT 100 /* maximum receive consecutive incorrect HEC counter */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the PHY_READ_STATUS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the PHY-level status structure */
|
||||
typedef struct {
|
||||
unsigned char Rx_sync_status; /* receiver synchronization status */
|
||||
unsigned char excep_conditions; /* PHY exception conditions */
|
||||
unsigned char no_Rx_blocks_avail; /* number of Rx blocks available for the application */
|
||||
unsigned short Rx_sync_time; /* receiver synchronization time */
|
||||
unsigned short Rx_sync_bytes; /* receiver synchronization bytes */
|
||||
unsigned short Rx_sync_offset; /* offset of the receiver synchronization bytes */
|
||||
} PHY_STATUS_STRUCT;
|
||||
|
||||
/* settings for the 'Rx_sync_status' variable */
|
||||
#define PHY_RX_SYNC_LOST 0x00 /* synchronization has been lost */
|
||||
#define PHY_RX_HUNT 0x01 /* receiver in hunt state */
|
||||
#define PHY_RX_PRESYNC 0x02 /* receiver in presync state */
|
||||
#define PHY_RX_SYNCHRONIZED 0x80 /* receiver synchronized */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the PHY_READ_OPERATIONAL_STATS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the PHY-level operational statistics structure */
|
||||
typedef struct {
|
||||
|
||||
/* transmission statistics */
|
||||
unsigned long blocks_Tx_count; /* number of blocks transmitted */
|
||||
unsigned long bytes_Tx_count; /* number of bytes transmitted */
|
||||
unsigned long Tx_throughput; /* transmit throughput */
|
||||
unsigned long no_ms_for_Tx_thruput_comp; /* millisecond time used for the Tx throughput computation */
|
||||
unsigned long Tx_underrun_cell_count; /* number of underrun cells transmitted */
|
||||
unsigned long Tx_length_error_count; /* number of blocks transmitted with a length error */
|
||||
unsigned long reserved_Tx_stat0; /* reserved for later use */
|
||||
unsigned long reserved_Tx_stat1; /* reserved for later use */
|
||||
|
||||
/* reception statistics */
|
||||
unsigned long blocks_Rx_count; /* number of blocks received */
|
||||
unsigned long bytes_Rx_count; /* number of bytes received */
|
||||
unsigned long Rx_throughput; /* receive throughput */
|
||||
unsigned long no_ms_for_Rx_thruput_comp; /* millisecond time used for the Rx throughput computation */
|
||||
unsigned long Rx_blocks_discard_count; /* number of incoming blocks discarded */
|
||||
unsigned long Rx_Idle_Cell_discard_count; /* number of incoming Idle Cells discarded */
|
||||
unsigned long Rx_Unas_Cell_discard_count; /* number of incoming Unassigned Cells discarded */
|
||||
unsigned long Rx_Phys_Lyr_Cell_discard_count;/* number of incoming Physical Layer Cells discarded */
|
||||
unsigned long Rx_bad_HEC_count; /* number of incoming cells with a bad HEC */
|
||||
unsigned long reserved_Rx_stat0; /* reserved for later use */
|
||||
unsigned long reserved_Rx_stat1; /* reserved for later use */
|
||||
|
||||
/* synchronization statistics */
|
||||
unsigned long Rx_sync_attempt_count; /* receiver synchronization attempt count */
|
||||
unsigned long Rx_sync_achieved_count; /* receiver synchronization achieved count */
|
||||
unsigned long Rx_sync_failure_count; /* receiver synchronization failure count */
|
||||
unsigned long Rx_hunt_attempt_count; /* Rx hunt attempt count */
|
||||
unsigned long Rx_hunt_char_sync_count; /* Rx hunt character synchronization count */
|
||||
unsigned long Rx_hunt_timeout_count; /* Rx hunt timeout count */
|
||||
unsigned long Rx_hunt_achieved_count; /* Rx hunt achieved count */
|
||||
unsigned long Rx_hunt_failure_count; /* Rx hunt failure count */
|
||||
unsigned long Rx_presync_attempt_count; /* Rx presync attempt count */
|
||||
unsigned long Rx_presync_achieved_count; /* Rx presync achieved count */
|
||||
unsigned long Rx_presync_failure_count; /* Rx presync failure count */
|
||||
unsigned long Rx_resync_bad_HEC_count; /* Rx re-synchronization due to cells received with a bad HEC */
|
||||
unsigned long Rx_resync_reception_loss_count;/* Rx re-synchronization due to loss of reception */
|
||||
unsigned long Rx_resync_overrun_count; /* Rx re-synchronization due receiver overrun */
|
||||
unsigned long reserved_Rx_sync_stat0; /* reserved for later use */
|
||||
unsigned long reserved_Rx_sync_stat1; /* reserved for later use */
|
||||
} PHY_OPERATIONAL_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the PHY_SET_TX_UNDERRUN_CONFIG command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the PHY transmit underrun cell structure */
|
||||
typedef struct {
|
||||
unsigned char Tx_underrun_cell_GFC; /* the GFC value in a Tx underrun cell */
|
||||
unsigned char Tx_underrun_cell_PT; /* the PT value in a Tx underrun cell */
|
||||
unsigned char Tx_underrun_cell_CLP; /* the CLP value in a Tx underrun cell */
|
||||
unsigned char Tx_underrun_cell_payload; /* the payload character in a Tx underrun cell */
|
||||
} PHY_TX_UNDERRUN_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for using application interrupts
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the structure used for the PHY_SET_INTERRUPT_TRIGGERS/PHY_READ_INTERRUPT_TRIGGERS command */
|
||||
typedef struct {
|
||||
unsigned char interrupt_triggers; /* interrupt trigger configuration */
|
||||
unsigned char IRQ; /* IRQ to be used */
|
||||
unsigned short interrupt_timer; /* interrupt timer */
|
||||
unsigned short misc_interrupt_bits; /* miscellaneous interrupt bits */
|
||||
} PHY_INT_TRIGGERS_STRUCT;
|
||||
|
||||
/* 'interrupt_triggers' bit settings */
|
||||
#define PHY_INT_RX 0x01 /* interrupt on reception */
|
||||
#define PHY_INT_TX 0x02 /* interrupt on transmission */
|
||||
#define PHY_INT_COMMAND_COMPLETE 0x04 /* interrupt when an interface command is complete */
|
||||
#define PHY_INT_TIMER 0x08 /* interrupt on a defined 1/100th second timeout */
|
||||
#define PHY_INT_GLOBAL_EXCEP_COND 0x10 /* interrupt on a global exception condition */
|
||||
#define PHY_INT_PHY_EXCEP_COND 0x20 /* interrupt on a PHY-level exception condition */
|
||||
#define PHY_INT_TRACE 0x80 /* interrupt when trace data is available */
|
||||
|
||||
/* 'interrupt_timer' limitation */
|
||||
#define MAX_INTERRUPT_TIMER_VALUE 60000 /* the maximum permitted timer interrupt value */
|
||||
|
||||
/* interrupt types indicated at 'interrupt_type' byte of the INTERRUPT_INFORMATION_STRUCT */
|
||||
#define PHY_NO_INT_PEND 0x00 /* no interrups are pending */
|
||||
#define PHY_RX_INT_PEND 0x01 /* a receive interrupt is pending */
|
||||
#define PHY_TX_INT_PEND 0x02 /* a transmit interrupt is pending */
|
||||
#define PHY_COMMAND_COMPLETE_INT_PEND 0x04 /* a 'command complete' interrupt is pending */
|
||||
#define PHY_TIMER_INT_PEND 0x08 /* a timer interrupt is pending */
|
||||
#define PHY_GLOBAL_EXCEP_COND_INT_PEND 0x10 /* a global exception condition interrupt is pending */
|
||||
#define PHY_PHY_EXCEP_COND_INT_PEND 0x20 /* a PHY exception condition interrupt is pending */
|
||||
#define PHY_TRACE_INT_PEND 0x80 /* a trace data interrupt is pending */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for block transmission
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the block transmit status element configuration structure */
|
||||
typedef struct {
|
||||
unsigned short number_Tx_status_els; /* number of transmit status elements */
|
||||
unsigned long base_addr_Tx_status_els; /* base address of the transmit element list */
|
||||
unsigned long next_Tx_status_el_to_use; /* pointer to the next transmit element to be used */
|
||||
} PHY_TX_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/* the block transmit status element structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag; /* opp flag */
|
||||
unsigned short block_length; /* length of the block to be transmitted */
|
||||
unsigned char misc_Tx_bits; /* miscellaneous Tx bits */
|
||||
unsigned char Tx_underrun_cell_GFC; /* the GFC value in a Tx underrun cell */
|
||||
unsigned char Tx_underrun_cell_PT; /* the PT value in a Tx underrun cell */
|
||||
unsigned char Tx_underrun_cell_CLP; /* the CLP value in a Tx underrun cell */
|
||||
unsigned char Tx_underrun_cell_payload; /* the payload character in a Tx underrun cell */
|
||||
unsigned char reserved[4]; /* reserved for internal use */
|
||||
unsigned long ptr_data_bfr; /* pointer to the data area */
|
||||
} PHY_TX_STATUS_EL_STRUCT;
|
||||
|
||||
/* settings for the 'misc_Tx_bits' */
|
||||
#define PHY_UPDATE_TX_UNDERRUN_CONFIG 0x01 /* update the transmit underrun cell configuration */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for block reception
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the block receive status element configuration structure */
|
||||
typedef struct {
|
||||
unsigned short number_Rx_status_els; /* number of receive status elements */
|
||||
unsigned long base_addr_Rx_status_els; /* base address of the receive element list */
|
||||
unsigned long next_Rx_status_el_to_use; /* pointer to the next receive element to be used */
|
||||
} PHY_RX_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/* the block receive status element structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag; /* opp flag */
|
||||
unsigned short block_length; /* length of the received block */
|
||||
unsigned char misc_Rx_bits; /* miscellaneous Rx bits */
|
||||
unsigned short time_stamp; /* receive time stamp */
|
||||
unsigned char reserved[6]; /* reserved for internal use */
|
||||
unsigned long ptr_data_bfr; /* pointer to the data area */
|
||||
} PHY_RX_STATUS_EL_STRUCT;
|
||||
|
||||
/* settings for the 'misc_Rx_bits' */
|
||||
#define RX_OVERRUN_ERROR 0x04 /* the incoming block has an overrun error */
|
||||
#define HEC_ERROR 0x08 /* the received cell has a HEC error */
|
||||
|
||||
/* structure used for transmitting and receiving cells that are decoded and formatted by the PHY firmware */
|
||||
typedef struct {
|
||||
unsigned char reserved[5]; /* reserved for internal use */
|
||||
unsigned char payload[48]; /* information payload */
|
||||
unsigned short GFC_VPI; /* GFC (Generic Flow Control)/VPI (Virtual Path Identifier) */
|
||||
unsigned short VCI; /* VCI (Virtual Channel Identifier) */
|
||||
unsigned char PT; /* PT (Payload Type) */
|
||||
unsigned char CLP; /* CLP (Cell Loss Priority) */
|
||||
unsigned char HEC; /* HEC (Header Error Control) */
|
||||
} PHY_TX_RX_DECODE_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants defining the shared memory information area
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global information structure */
|
||||
typedef struct {
|
||||
unsigned char global_status; /* global status */
|
||||
unsigned char modem_status; /* current modem status */
|
||||
unsigned char global_excep_conditions; /* global exception conditions */
|
||||
unsigned char glob_info_reserved[5]; /* reserved */
|
||||
unsigned char code_name[4]; /* code name */
|
||||
unsigned char code_version[4]; /* code version */
|
||||
} GLOBAL_INFORMATION_STRUCT;
|
||||
|
||||
/* the PHY information structure */
|
||||
typedef struct {
|
||||
unsigned char Rx_sync_status; /* receiver synchronization status */
|
||||
unsigned char PHY_excep_conditions; /* PHY exception conditions */
|
||||
unsigned char no_Rx_blocks_avail; /* number of Rx blocks available for the application */
|
||||
unsigned char PHY_info_reserved[13]; /* reserved */
|
||||
} PHY_INFORMATION_STRUCT;
|
||||
|
||||
/* the interrupt information structure */
|
||||
typedef struct {
|
||||
unsigned char interrupt_type; /* type of interrupt triggered */
|
||||
unsigned char interrupt_permission; /* interrupt permission mask */
|
||||
unsigned char int_info_reserved[14]; /* reserved */
|
||||
} INTERRUPT_INFORMATION_STRUCT;
|
||||
|
||||
/* the front-end information structure */
|
||||
typedef struct {
|
||||
unsigned char parallel_port_A_input; /* input - parallel port A */
|
||||
unsigned char parallel_port_B_input; /* input - parallel port B */
|
||||
unsigned char FT1_INS_alarm_condition; /* the current FT1 in-service/alarm condition */
|
||||
unsigned char FT1_info_reserved[13]; /* reserved */
|
||||
} FE_INFORMATION_STRUCT;
|
||||
|
||||
/* the shared memory area information structure */
|
||||
typedef struct {
|
||||
GLOBAL_INFORMATION_STRUCT global_info_struct; /* the global information structure */
|
||||
PHY_INFORMATION_STRUCT PHY_info_struct; /* the PHY information structure */
|
||||
INTERRUPT_INFORMATION_STRUCT interrupt_info_struct;/* the interrupt information structure */
|
||||
FE_INFORMATION_STRUCT FE_info_struct; /* the front-end information structure */
|
||||
} SHARED_MEMORY_INFO_STRUCT;
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#undef wan_udphdr_data
|
||||
#define wan_udphdr_data wan_udphdr_u.atm.data
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#undef wan_udp_data
|
||||
#define wan_udp_data wan_udp_hdr.wan_udphdr_u.atm.data
|
||||
#endif
|
||||
|
||||
|
||||
//#define SHARED_MEMORY_INFO_STRUCT void
|
||||
//#define CONFIGURATION_STRUCT PHY_CONFIGURATION_STRUCT
|
||||
//#define INTERRUPT_INFORMATION_STRUCT void
|
||||
#define DATA_RX_STATUS_EL_STRUCT PHY_RX_STATUS_EL_STRUCT
|
||||
#define DATA_TX_STATUS_EL_STRUCT PHY_TX_STATUS_EL_STRUCT
|
||||
#define INT_TRIGGERS_STRUCT PHY_INT_TRIGGERS_STRUCT
|
||||
#define TX_STATUS_EL_CFG_STRUCT PHY_TX_STATUS_EL_CFG_STRUCT
|
||||
#define RX_STATUS_EL_CFG_STRUCT PHY_RX_STATUS_EL_CFG_STRUCT
|
||||
//#define TRACE_STATUS_EL_CFG_STRUCT void
|
||||
//#define TRACE_STATUS_ELEMENT_STRUCT void
|
||||
//#define LINE_TRACE_CONFIG_STRUCT void
|
||||
//#define COMMS_ERROR_STATS_STRUCT void
|
||||
#define OPERATIONAL_STATS_STRUCT PHY_OPERATIONAL_STATS_STRUCT
|
||||
|
||||
#define DFLT_TEMPLATE_VALUE ...
|
||||
|
||||
#define WANCONFIG_FRMW WANCONFIG_ATM
|
||||
|
||||
#define COMMAND_OK OK
|
||||
|
||||
#define APP_INT_ON_TIMER PHY_INT_TIMER
|
||||
#define APP_INT_ON_TX_FRAME PHY_INT_TX
|
||||
#define APP_INT_ON_RX_FRAME PHY_INT_RX
|
||||
#define APP_INT_ON_GLOBAL_EXCEP_COND PHY_INT_GLOBAL_EXCEP_COND
|
||||
#define APP_INT_ON_EXCEP_COND PHY_INT_PHY_EXCEP_COND
|
||||
#define APP_INT_ON_COMMAND_COMPLETE PHY_INT_COMMAND_COMPLETE
|
||||
|
||||
|
||||
#define COMMAND_COMPLETE_APP_INT_PEND PHY_COMMAND_COMPLETE_INT_PEND
|
||||
#define RX_APP_INT_PEND PHY_RX_INT_PEND
|
||||
#define TX_APP_INT_PEND PHY_TX_INT_PEND
|
||||
#define EXCEP_COND_APP_INT_PEND PHY_PHY_EXCEP_COND_INT_PEND
|
||||
#define GLOBAL_EXCEP_COND_APP_INT_PEND PHY_GLOBAL_EXCEP_COND_INT_PEND
|
||||
#define TIMER_APP_INT_PEND PHY_TIMER_INT_PEND
|
||||
#define TRACE_APP_INT_PEND PHY_TRACE_INT_PEND
|
||||
|
||||
|
||||
#define READ_CODE_VERSION PHY_READ_CODE_VERSION
|
||||
|
||||
#define READ_CONFIGURATION PHY_READ_CONFIGURATION
|
||||
#define SET_CONFIGURATION PHY_SET_CONFIGURATION
|
||||
|
||||
#define DISABLE_COMMUNICATIONS PHY_DISABLE_COMMUNICATIONS
|
||||
#define ENABLE_COMMUNICATIONS PHY_ENABLE_COMMUNICATIONS
|
||||
|
||||
#define SET_INTERRUPT_TRIGGERS PHY_SET_INTERRUPT_TRIGGERS
|
||||
#define READ_INTERRUPT_TRIGGERS PHY_READ_INTERRUPT_TRIGGERS
|
||||
|
||||
#define UDPMGMT_SIGNATURE "ATMPIPEA"
|
||||
|
||||
//#define FT1_MONITOR_STATUS_CTRL DFLT_TEMPLATE_VALUE
|
||||
//#define ENABLE_READ_FT1_STATUS DFLT_TEMPLATE_VALUE
|
||||
//#define ENABLE_READ_FT1_OP_STATS DFLT_TEMPLATE_VALUE
|
||||
//#define CPIPE_FT1_READ_STATUS DFLT_TEMPLATE_VALUE
|
||||
//#define TRACE_INACTIVE DFLT_TEMPLATE_VALUE
|
||||
|
||||
//#define READ_GLOBAL_STATISTICS DFLT_TEMPLATE_VALUE
|
||||
//#define READ_MODEM_STATUS DFLT_TEMPLATE_VALUE
|
||||
//#define READ_LINK_STATUS DFLT_TEMPLATE_VALUE
|
||||
//#define READ_COMMS_ERROR_STATS DFLT_TEMPLATE_VALUE
|
||||
//#define READ_TRACE_CONFIGURATION DFLT_TEMPLATE_VALUE
|
||||
//#define GET_TRACE_INFO DFLT_TEMPLATE_VALUE
|
||||
|
||||
enum {
|
||||
ROUTER_UP_TIME = 0x50,
|
||||
FT1_READ_STATUS,
|
||||
SET_FT1_MODE,
|
||||
ENABLE_TRACING,
|
||||
DISABLE_TRACING,
|
||||
GET_TRACE_INFO,
|
||||
FT1_MONITOR_STATUS_CTRL,
|
||||
ENABLE_READ_FT1_STATUS,
|
||||
ENABLE_READ_FT1_OP_STATS,
|
||||
READ_FT1_OPERATIONAL_STATS,
|
||||
ATM_LINK_STATUS
|
||||
};
|
||||
|
||||
#define ATM_TRACE_CELL 0x01
|
||||
#define ATM_TRACE_PDU 0x02
|
||||
#define ATM_TRACE_DATA 0x04
|
||||
|
||||
|
||||
#define READ_OPERATIONAL_STATS PHY_READ_OPERATIONAL_STATS
|
||||
//#define SET_TRACE_CONFIGURATION DFLT_TEMPLATE_VALUE
|
||||
//#define TRACE_ACTIVE DFLT_TEMPLATE_VALUE
|
||||
|
||||
#define EXCEP_IRQ_TIMEOUT EXCEP_APP_IRQ_TIMEOUT
|
||||
#define READ_EXCEPTION_CONDITION PHY_READ_EXCEPTION_CONDITION
|
||||
#define EXCEP_LINK_ACTIVE DFLT_TEMPLATE_VALUE
|
||||
#define EXCEP_LINK_INACTIVE_MODEM DFLT_TEMPLATE_VALUE
|
||||
#define EXCEP_LINK_INACTIVE_KPALV DFLT_TEMPLATE_VALUE
|
||||
#define EXCEP_IP_ADDRESS_DISCOVERED DFLT_TEMPLATE_VALUE
|
||||
#define EXCEP_LOOPBACK_CONDITION DFLT_TEMPLATE_VALUE
|
||||
#define NO_EXCEP_COND_TO_REPORT DFLT_TEMPLATE_VALUE
|
||||
|
||||
//#define READ_GLOBAL_EXCEPTION_CONDITION DFLT_TEMPLATE_VALUE
|
||||
//#define EXCEP_MODEM_STATUS_CHANGE DFLT_TEMPLATE_VALUE
|
||||
#define DCD_HIGH 0x08
|
||||
#define CTS_HIGH 0x20
|
||||
|
||||
#define INTERFACE_LEVEL_RS232 PHY_INTERFACE_LEVEL_RS232
|
||||
#define INTERFACE_LEVEL_V35 PHY_INTERFACE_LEVEL_V35
|
||||
|
||||
|
||||
#define MIN_WP_PRI_MTU 1500
|
||||
#define MAX_WP_PRI_MTU MIN_WP_PRI_MTU
|
||||
#define DEFAULT_WP_PRI_MTU MIN_WP_PRI_MTU
|
||||
|
||||
#define ATM_CELL_SIZE 53
|
||||
#define ATM_OVERHEAD 1.1
|
||||
#define MIN_WP_SEC_MTU 50
|
||||
#define MAX_WP_SEC_MTU PHY_MAX_CELLS_IN_RX_BLOCK*ATM_CELL_SIZE/ATM_OVERHEAD
|
||||
#define DEFAULT_WP_SEC_MTU 1500
|
||||
|
||||
|
||||
/* reasons for enabling the timer interrupt on the adapter */
|
||||
#define TMR_INT_ENABLED_UDP 0x01
|
||||
#define TMR_INT_ENABLED_UPDATE 0x02
|
||||
#define TMR_INT_ENABLED_CONFIG 0x10
|
||||
#define TMR_INT_ENABLED_TE 0x20
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define PRI_BASE_ADDR_MB_STRUCT BASE_ADDR_MB_STRUCT
|
||||
static __inline void init_card_mailbox(sdla_t *card)
|
||||
{
|
||||
/* Initialize protocol-specific fields */
|
||||
if(card->hw.type != SDLA_S514){
|
||||
card->mbox = (void *) card->hw.dpmbase;
|
||||
}else{
|
||||
/* for a S514 adapter, set a pointer to the actual mailbox in the */
|
||||
/* allocated virtual memory area */
|
||||
card->mbox = (void *) card->hw.dpmbase + PRI_BASE_ADDR_MB_STRUCT;
|
||||
}
|
||||
}
|
||||
|
||||
static __inline wan_mbox_t *get_card_mailbox(sdla_t *card)
|
||||
{
|
||||
return (wan_mbox_t*)card->mbox;
|
||||
}
|
||||
|
||||
static __inline void *get_card_flags(sdla_t *card)
|
||||
{
|
||||
return card->flags;
|
||||
}
|
||||
|
||||
static __inline void set_card_flags(sdla_t *card, void *ptr)
|
||||
{
|
||||
card->flags = ptr;
|
||||
}
|
||||
static __inline void *get_card_rxmb(sdla_t *card)
|
||||
{
|
||||
return card->u.atm.rxmb;
|
||||
}
|
||||
|
||||
static __inline void set_card_rxmb(sdla_t *card, void *ptr)
|
||||
{
|
||||
card->u.atm.rxmb = ptr;
|
||||
if((void*)ptr > card->u.atm.rxbuf_last){
|
||||
card->u.atm.rxmb = card->u.atm.rxbuf_base;
|
||||
}
|
||||
}
|
||||
|
||||
static __inline void *get_card_txbuf(sdla_t *card)
|
||||
{
|
||||
return card->u.atm.txbuf;
|
||||
}
|
||||
|
||||
static __inline void set_card_txbuf(sdla_t *card, void *ptr)
|
||||
{
|
||||
card->u.atm.txbuf = ptr;
|
||||
if ((void*)ptr > card->u.atm.txbuf_last){
|
||||
card->u.atm.txbuf = card->u.atm.txbuf_base;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -1,142 +0,0 @@
|
|||
|
||||
#ifndef _BSC_HEADER_
|
||||
#define _BSC_HEADER_
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/*========== MAILBOX COMMANDS AND RETURN CODES ==========*/
|
||||
#define BSC_READ 0x00
|
||||
#define BSC_WRITE 0x01
|
||||
#define OPEN_LINK 0x02
|
||||
#define CLOSE_LINK 0x03
|
||||
#define CAM_WRITE 0x04
|
||||
#define CAM_READ 0x05
|
||||
#define LINK_STATUS 0x06
|
||||
#define READ_OPERATIONAL_STATISTICS 0x07
|
||||
#define FLUSH_OPERATIONAL_STATISTICS 0x08
|
||||
#define READ_COMMS_ERROR_STATISTICS 0x09
|
||||
#define FLUSH_COMMS_ERROR_STATISTICS 0x0A
|
||||
#define READ_BSC_ERROR_STATISTICS 0x0B
|
||||
#define FLUSH_BSC_ERROR_STATISTICS 0x0C
|
||||
#define FLUSH_BSC_TEXT_BUFFERS 0x0D
|
||||
#define SET_CONFIGURATION 0x0E
|
||||
#define READ_CONFIGURATION 0x0F
|
||||
#define SET_MODEM_STATUS 0x10
|
||||
#define READ_MODEM_STATUS 0x11
|
||||
#define READ_CODE_VERSION 0x12
|
||||
#define ADD_STATION 0x20
|
||||
#define DELETE_STATION 0x21
|
||||
#define DELETE_ALL_STATIONS 0x22
|
||||
#define LIST_STATIONS 0x23
|
||||
#define SET_GENERAL_OR_SPECIFIC_POLL 0x24
|
||||
#define SET_STATION_STATUS 0x25
|
||||
|
||||
#define READ_STATE_DIAGNOSTICS 0x30
|
||||
|
||||
#define UNUSED_CMD_FOR_EVENTS 0x7e
|
||||
|
||||
#define Z80_TIMEOUT_ERROR 0x0a
|
||||
#define DATA_LENGTH_TOO_BIG 0x03
|
||||
|
||||
#define BSC_SENDBOX 0xF000 /* send mailbox */
|
||||
|
||||
#define MDATALEN 4000
|
||||
#define MBOX_HEADER_SZ 15
|
||||
|
||||
/* for point-to-point, ignore station_number and address fields in CBLOCK */
|
||||
|
||||
/* note: structure must be packed on 1-byte boundaries
|
||||
and for a block this size, it is not wise to allocate it on
|
||||
the stack - should be a static global
|
||||
*/
|
||||
/* control block */
|
||||
typedef struct {
|
||||
unsigned char opp_flag PACKED;
|
||||
unsigned char command PACKED;
|
||||
unsigned short buffer_length PACKED;
|
||||
unsigned char return_code PACKED;
|
||||
unsigned char misc_tx_rx_bits PACKED;
|
||||
unsigned short heading_length PACKED;
|
||||
unsigned short notify PACKED;
|
||||
unsigned char station PACKED;
|
||||
unsigned char poll_address PACKED;
|
||||
unsigned char select_address PACKED;
|
||||
unsigned char device_address PACKED;
|
||||
unsigned char notify_extended PACKED;
|
||||
unsigned char reserved PACKED;
|
||||
unsigned char data[MDATALEN] PACKED;
|
||||
} BSC_MAILBOX_STRUCT;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char line_speed_number PACKED;
|
||||
unsigned short max_data_frame_size PACKED;
|
||||
unsigned char secondary_station PACKED;
|
||||
unsigned char num_consec_PAD_eof PACKED;
|
||||
unsigned char num_add_lead_SYN PACKED;
|
||||
unsigned char conversational_mode PACKED;
|
||||
unsigned char pp_dial_up_operation PACKED;
|
||||
unsigned char switched_CTS_RTS PACKED;
|
||||
unsigned char EBCDIC_encoding PACKED;
|
||||
unsigned char auto_open PACKED;
|
||||
unsigned char misc_bits PACKED;
|
||||
unsigned char protocol_options1 PACKED;
|
||||
unsigned char protocol_options2 PACKED;
|
||||
unsigned short reserved_pp PACKED;
|
||||
unsigned char max_retransmissions PACKED;
|
||||
unsigned short fast_poll_retries PACKED;
|
||||
unsigned short TTD_retries PACKED;
|
||||
unsigned short restart_timer PACKED;
|
||||
unsigned short pp_slow_restart_timer PACKED;
|
||||
unsigned short TTD_timer PACKED;
|
||||
unsigned short pp_delay_between_EOT_ENQ PACKED;
|
||||
unsigned short response_timer PACKED;
|
||||
unsigned short rx_data_timer PACKED;
|
||||
unsigned short NAK_retrans_delay_timer PACKED;
|
||||
unsigned short wait_CTS_timer PACKED;
|
||||
unsigned char mp_max_consec_ETX PACKED;
|
||||
unsigned char mp_general_poll_address PACKED;
|
||||
unsigned short sec_poll_timeout PACKED;
|
||||
unsigned char pri_poll_skips_inactive PACKED;
|
||||
unsigned char sec_additional_stn_send_gpoll PACKED;
|
||||
unsigned char pri_select_retries PACKED;
|
||||
unsigned char mp_multipoint_options PACKED;
|
||||
unsigned short reserved PACKED;
|
||||
} BSC_CONFIG_STRUCT;
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char max_tx_queue PACKED;
|
||||
unsigned char max_rx_queue PACKED;
|
||||
unsigned char station_flags PACKED;
|
||||
}ADD_STATION_STRUCT;
|
||||
|
||||
typedef struct {
|
||||
unsigned char station PACKED;
|
||||
unsigned short time_stamp PACKED;
|
||||
unsigned char reserved[13] PACKED;
|
||||
} api_rx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_rx_hdr_t api_rx_hdr PACKED;
|
||||
void * data PACKED;
|
||||
} api_rx_element_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char station PACKED;
|
||||
unsigned char misc_tx_rx_bits PACKED;
|
||||
unsigned char reserved[14] PACKED;
|
||||
} api_tx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_tx_hdr_t api_tx_hdr PACKED;
|
||||
void * data PACKED;
|
||||
} api_tx_element_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#define SIOC_WANPIPE_EXEC_CMD SIOC_WANPIPE_DEVPRIVATE
|
||||
|
||||
#endif
|
|
@ -1,262 +0,0 @@
|
|||
/* $Header: /usr/local/cvsroot/wanpipe_linux/code/include/sdla_bscstrm.h,v 1.3 2004/09/28 21:47:30 sangoma Exp $ */
|
||||
|
||||
|
||||
/*
|
||||
***********************************************************************************
|
||||
* *
|
||||
* BSTRMAPI.H is the 'C' API header file for the Sangoma BSC Tx/Rx streaming code. *
|
||||
* *
|
||||
***********************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* $Log: sdla_bscstrm.h,v $
|
||||
* Revision 1.3 2004/09/28 21:47:30 sangoma
|
||||
* *** empty log message ***
|
||||
*
|
||||
* Revision 1.2 2004/04/21 21:11:20 sangoma
|
||||
* *** empty log message ***
|
||||
*
|
||||
* Revision 1.1.1.1 2002/11/25 09:20:00 ncorbic
|
||||
* Wanpipe Linux Development
|
||||
*
|
||||
* Revision 1.2 2002/06/05 09:32:55 ncorbic
|
||||
* *** empty log message ***
|
||||
*
|
||||
* Revision 1.1 2002/03/20 20:58:43 ncorbic
|
||||
* *** empty log message ***
|
||||
*
|
||||
*
|
||||
* Rev 1.2 24 Nov 1998 12:08:54 gideon
|
||||
* Added definitions to handle the inclusion of timer interrupt logic.
|
||||
* The code version is now 1.03.
|
||||
*
|
||||
*
|
||||
* Rev 1.1 30 Jan 1998 17:29:54 gideon
|
||||
* Modifications made to improve error handling when receiving Type 3 blocks as
|
||||
* follows:
|
||||
* 1) The 'comms_err_res_Rx' in the COMMUNICATIONS_ERROR_STRUCT was changed to
|
||||
* 'Rx_invalid_block_count'.
|
||||
* 2) Added the definition RX_INVALID_BLOCK for the 'Rx_error_bits' in the
|
||||
* RECEIVE mailbox.
|
||||
* The code version is now 1.02.
|
||||
*
|
||||
*
|
||||
* Rev 1.0 10 Dec 1997 11:19:48 gideon
|
||||
* Initial revision.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BSCSTRM_HEADER_
|
||||
#define _BSCSTRM_HEADER_
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* physical addresses on the adapter */
|
||||
#define BASE_ADDR_SEND_MB 0xE000 /* the base address of the SEND mailbox area */
|
||||
#define BASE_ADDR_RECEIVE_MB 0xF000 /* the base address of the RECEIVE mailbox area */
|
||||
#define PTR_INTERRUPT_REPORT_IB 0xFFF0 /* a pointer to the interrupt reporting interface byte */
|
||||
#define PTR_INTERRUPT_PERMIT_IB 0xFFF1 /* a pointer to the interrupt permission interface byte */
|
||||
#define PTR_MODEM_STATUS_IB 0xFFF4 /* a pointer to the modem status interface byte */
|
||||
|
||||
|
||||
|
||||
/* BSC streaming commands */
|
||||
#define BSC_WRITE 0x01 /* transmit a BSC block */
|
||||
#define ENABLE_COMMUNICATIONS 0x02 /* enable communications */
|
||||
#define DISABLE_COMMUNICATIONS 0x03 /* disable communications */
|
||||
#define READ_OPERATIONAL_STATS 0x07 /* retrieve the operational statistics */
|
||||
#define FLUSH_OPERATIONAL_STATS 0x08 /* flush the operational statistics */
|
||||
#define READ_COMMS_ERR_STATS 0x09 /* read the communication error statistics */
|
||||
#define FLUSH_COMMS_ERR_STATS 0x0A /* flush the communication error statistics */
|
||||
#define SET_MODEM_STATUS 0x0B /* set the modem status */
|
||||
#define READ_MODEM_STATUS 0x0C /* read the current modem status (CTS and DCD status) */
|
||||
#define FLUSH_BSC_BUFFERS 0x0D /* flush any queued transmit and receive buffers */
|
||||
#define READ_CONFIGURATION 0x10 /* read the current operational configuration */
|
||||
#define SET_CONFIGURATION 0x11 /* set the operational configuration */
|
||||
#define READ_CODE_VERSION 0x15 /* read the code version */
|
||||
#define SET_INTERRUPT_TRIGGERS 0x20 /* set the interrupt triggers */
|
||||
#define READ_INTERRUPT_TRIGGERS 0x21 /* read the interrupt trigger configuration */
|
||||
//#define READ_ADAPTER_CONFIGURATION 0xA0 /* find out what type of adapter is being used */
|
||||
|
||||
|
||||
|
||||
/* return code from BSC streaming commands */
|
||||
#define COMMAND_SUCCESSFULL 0x00 /* the command was successfull */
|
||||
#define COMMUNICATIONS_DISABLED 0x01 /* communications are currently disabled */
|
||||
#define COMMUNICATIONS_ENABLED 0x02 /* communications are currently enabled */
|
||||
#define SET_CONFIG_BEFORE_ENABLE_COMMS 0x03 /* SET_CONFIGURATION before ENABLE_COMMUNICATIONS */
|
||||
#define SET_CONFIG_BEFORE_INT_TRIGGERS 0x03 /* SET_CONFIGURATION before SET_INTERRUPT_TRIGGERS */
|
||||
#define INVALID_CONFIGURATION_DATA 0x03 /* the passed configuration data is invalid */
|
||||
#define INVALID_TX_DATA_LGTH 0x03 /* the length of the data to be transmitted is invalid */
|
||||
#define CANT_FLUSH_BUSY_SENDING 0x03 /* the BSC buffers cannot be flushed as a block is being transmitted */
|
||||
#define TX_BUFFERS_FULL 0x04 /* the transmit buffers are full */
|
||||
#define INVALID_INTERRUPT_TIMER 0x04 /* the interrupt timer interval value is invalid */
|
||||
#define ILLEGAL_COMMAND 0x05 /* the defined HDLC command is invalid */
|
||||
#define MODEM_STATUS_CHANGE 0x10 /* a modem (DCD/CTS) status change ocurred */
|
||||
|
||||
|
||||
|
||||
/* mailbox definitions */
|
||||
/*
|
||||
The two mailboxes take up a total of 8192 bytes, so each is 4096 bytes in size. However, we reserve the last 16 bytes
|
||||
in the receive mailbox for miscellaneous interface bytes, so each mailbox is now 4080 bytes. If we subtract 16 bytes
|
||||
for the mailbox header area, we are left with a mailbox data size of 4064 bytes.
|
||||
*/
|
||||
#define SIZEOF_MB_DATA_BFR 4064
|
||||
|
||||
/* the mailbox structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag; /* the opp flag */
|
||||
unsigned char command; /* the user command */
|
||||
unsigned short buffer_length; /* the data length */
|
||||
unsigned char return_code; /* the return code */
|
||||
unsigned char misc_Tx_Rx_bits; /* miscellaneous transmit and receive bits */
|
||||
unsigned char Rx_error_bits; /* an indication of a block received with an error */
|
||||
unsigned short Rx_time_stamp; /* a millisecond receive time stamp */
|
||||
unsigned char reserved[7]; /* reserved for later use */
|
||||
char data[SIZEOF_MB_DATA_BFR]; /* the data area */
|
||||
} MAILBOX_STRUCT;
|
||||
|
||||
|
||||
#define MBOX_HEADER_SZ 16
|
||||
|
||||
|
||||
/* definitions for setting the configuration */
|
||||
#define MAXIMUM_BAUD_RATE 112000 /* the maximum permitted baud rate */
|
||||
#define MIN_BLOCK_LENGTH 2 /* the minimum permitted block length */
|
||||
#define MAX_BLOCK_LENGTH 2200 /* the maximum permitted block length */
|
||||
#define MIN_NO_CONSEC_PADs_EOB 1 /* the minimum number of consecutive PADs defining the end-of-block */
|
||||
#define MAX_NO_CONSEC_PADs_EOB 50 /* the maximum number of consecutive PADs defining the end-of-block */
|
||||
#define MIN_ADD_LEAD_TX_SYN_CHARS 0 /* the minimum number of additional leading SYN characters */
|
||||
#define MAX_ADD_LEAD_TX_SYN_CHARS 50 /* the maximum number of additional leading SYN characters */
|
||||
#define MIN_NO_BITS_PER_CHAR 8 /* the minimum number of bits per character */
|
||||
#define MAX_NO_BITS_PER_CHAR 8 /* the maximum number of bits per character */
|
||||
|
||||
/* definitions for the 'Rx_block_type' */
|
||||
#define RX_BLOCK_TYPE_1 1
|
||||
#define RX_BLOCK_TYPE_2 2
|
||||
#define RX_BLOCK_TYPE_3 3
|
||||
|
||||
/* definitions for 'parity' */
|
||||
#define NO_PARITY 0 /* no parity */
|
||||
#define ODD_PARITY 1 /* odd parity */
|
||||
#define EVEN_PARITY 2 /* even parity */
|
||||
|
||||
/* definitions for the 'statistics_options' */
|
||||
#define RX_STATISTICS 0x0001 /* enable receiver statistics */
|
||||
#define RX_TIME_STAMP 0x0002 /* enable the receive time stamp */
|
||||
#define TX_STATISTICS 0x0100 /* enable transmitter statistics */
|
||||
|
||||
/* definitions for the 'misc_config_options' */
|
||||
#define STRIP_PARITY_BIT_FROM_DATA 0x0001 /* strip the parity bit from the data for block types 1 & 3 */
|
||||
|
||||
/* definitions for the 'modem_config_options' */
|
||||
#define DONT_RAISE_DTR_RTS_EN_COMMS 0x0001 /* don't raise DTR and RTS when enabling communications */
|
||||
|
||||
/* the configuration structure */
|
||||
typedef struct {
|
||||
unsigned long baud_rate; /* the baud rate */
|
||||
unsigned long adapter_frequency; /* the adapter frequecy */
|
||||
unsigned short max_data_length; /* the maximum length of a BSC data block */
|
||||
unsigned short EBCDIC_encoding; /* EBCDIC/ASCII encoding */
|
||||
unsigned short Rx_block_type; /* the type of BSC block to be received */
|
||||
unsigned short no_consec_PADs_EOB; /* the number of consecutive PADs indicating the end of the block */
|
||||
unsigned short no_add_lead_Tx_SYN_chars; /* the number of additional leading transmit SYN characters */
|
||||
unsigned short no_bits_per_char; /* the number of bits per character */
|
||||
unsigned short parity; /* parity */
|
||||
unsigned short misc_config_options; /* miscellaneous configuration options */
|
||||
unsigned short statistics_options; /* statistic options */
|
||||
unsigned short modem_config_options; /* modem configuration options */
|
||||
} CONFIGURATION_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* definitions for reading the communications errors */
|
||||
/* the communications error structure */
|
||||
typedef struct {
|
||||
unsigned short Rx_overrun_err_count; /* the number of receiver overrun errors */
|
||||
unsigned short BCC_err_count; /* the number of receiver BCC errors */
|
||||
unsigned short nxt_Rx_bfr_occupied_count; /* the number of times a block had to be discarded due to buffering */
|
||||
/* limitations */
|
||||
unsigned short Rx_too_long_int_lvl_count; /* the number of blocks received which exceeded the maximum permitted */
|
||||
/* block size (interrupt level) */
|
||||
unsigned short Rx_too_long_app_lvl_count; /* the number of blocks received which exceeded the configured maximum */
|
||||
/* block size (application level) */
|
||||
unsigned short Rx_invalid_block_count; /* the number of invalid blocks received */
|
||||
unsigned short Tx_underrun_count; /* the number of transmit underruns */
|
||||
unsigned short comms_err_res_Tx; /* reserved (later use) for a transmit statistic */
|
||||
unsigned short DCD_state_change_count; /* the number of times DCD changed state */
|
||||
unsigned short CTS_state_change_count; /* the number of times CTS changed state */
|
||||
} COMMUNICATIONS_ERROR_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* definitions for reading the operational statistics */
|
||||
/* the operational statistics structure */
|
||||
typedef struct {
|
||||
unsigned long no_blocks_Rx; /* the number of data blocks received and made available for the application */
|
||||
unsigned long no_bytes_Rx; /* the number of bytes received and made available for the application */
|
||||
unsigned long no_blocks_Tx; /* the number of data blocks transmitted */
|
||||
unsigned long no_bytes_Tx; /* the number of bytes transmitted */
|
||||
} OPERATIONAL_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* definitions for interrupt usage */
|
||||
/* 'interrupt_triggers' bit mapping set by a SET_INTERRUPT_TRIGGERS command */
|
||||
#define INTERRUPT_ON_RX_BLOCK 0x01 /* interrupt when an data block is available for the application */
|
||||
#define INTERRUPT_ON_TIMER 0x20 /* interrupt at a defined millisecond interval */
|
||||
|
||||
/* interrupt types indicated at 'ptr_interrupt_interface_byte' */
|
||||
#define RX_INTERRUPT_PENDING 0x01 /* a receive interrupt is pending */
|
||||
#define TIMER_INTERRUPT_PENDING 0x20 /* a timer interrupt is pending */
|
||||
|
||||
#define MAX_INTERRUPT_TIMER_VALUE 60000 /* the maximum permitted interrupt timer value */
|
||||
|
||||
|
||||
/* definitions for data block transmission */
|
||||
/* the setting of the 'misc_Tx_Rx_bits' in the mailbox */
|
||||
#define TX_BLK_TRANSPARENT 0x01 /* send a transparent text block */
|
||||
#define ETB_DEFINES_EOB 0x02 /* an ETB character defines the end of this text block */
|
||||
#define ITB_DEFINES_EOB 0x04 /* an ITB character defines the end of this text block */
|
||||
#define USR_DEFINES_TX_DATA 0x10 /* the user application defines the data to be transmitted */
|
||||
|
||||
|
||||
|
||||
/* definitions for the 'Rx_error_bits' in the RECEIVE mailbox */
|
||||
#define RX_BCC_ERROR 0x01 /* a receive BCC error occurred */
|
||||
#define RX_OVERRUN_ERROR 0x02 /* a receive overrun error occurred */
|
||||
#define RX_INVALID_BLOCK 0x04 /* an invalid block was received */
|
||||
#define RX_EXCESSIVE_LGTH_ERR_INT_LVL 0x10 /* the received block was too long (interrupt level) */
|
||||
#define RX_EXCESSIVE_LGTH_ERR_APP_LVL 0x20 /* the received block was too long (application level) */
|
||||
|
||||
typedef struct {
|
||||
unsigned char station PACKED;
|
||||
unsigned short time_stamp PACKED;
|
||||
unsigned char reserved[13] PACKED;
|
||||
} api_rx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_rx_hdr_t api_rx_hdr PACKED;
|
||||
unsigned char data[1] PACKED;
|
||||
} api_rx_element_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char station PACKED;
|
||||
unsigned char misc_tx_rx_bits PACKED;
|
||||
unsigned char reserved[14] PACKED;
|
||||
} api_tx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_tx_hdr_t api_tx_hdr PACKED;
|
||||
unsigned char data[1] PACKED;
|
||||
} api_tx_element_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#define SIOC_WANPIPE_EXEC_CMD SIOC_WANPIPE_DEVPRIVATE
|
||||
|
||||
#endif
|
|
@ -1,213 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* bsc_api.h Bisync Streaming API header file.
|
||||
*
|
||||
* Author: Jaspreet Singh <jaspreet@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 1998-1997 Sangoma Technologies Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
* Sep 24, 1998 Jaspreet Singh o Initial Version.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef __SDLA_BSTRM__
|
||||
#define __SDLA_BSTRM__
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
|
||||
/* Status flag for determining whether to perform a check on socket receive
|
||||
* queue.
|
||||
*/
|
||||
#define NO_SK_RX_CHECK 0x00
|
||||
#define TOP_CHECK_SK_RX_Q 0x01
|
||||
#define BTM_CHECK_SK_RX_Q 0x02
|
||||
|
||||
#define NO_READ_CMD 0x00
|
||||
#define READ_CMD 0x01
|
||||
|
||||
/* physical addresses on the adapter
|
||||
*/
|
||||
#define SEND_MB_OFF 0x0000 /* base addr of the SEND mb area */
|
||||
#define RECEIVE_MB_OFF 0x1000 /* base addr of the RECEIVE mb area */
|
||||
#define INTERRUPT_REPORT_IB_OFF 0x1FF0 /* a ptr to the interrupt reporting interface byte */
|
||||
#define INTERRUPT_PERMIT_IB_OFF 0x1FF1 /* a pointer to the interrupt permission interface byte */
|
||||
#define PTR_MODEM_STATUS_IB 0xFFF4 /* a pointer to the modem status interface byte */
|
||||
|
||||
|
||||
/* BSC streaming commands */
|
||||
#define BSC_WRITE 0x01 /* transmit a BSC block */
|
||||
#define BSC_READ 0x90
|
||||
#define ENABLE_COMMUNICATIONS 0x02 /* enable communications */
|
||||
#define DISABLE_COMMUNICATIONS 0x03 /* disable communications */
|
||||
#define READ_OPERATIONAL_STATS 0x07 /* retrieve the operational statistics */
|
||||
#define FLUSH_OPERATIONAL_STATS 0x08 /* flush the operational statistics */
|
||||
#define READ_COMMS_ERR_STATS 0x09 /* read the communication error statistics */
|
||||
#define FLUSH_COMMS_ERR_STATS 0x0A /* flush the communication error statistics */
|
||||
#define SET_MODEM_STATUS 0x0B /* set the modem status */
|
||||
#define READ_MODEM_STATUS 0x0C /* read the current modem status (CTS and DCD status) */
|
||||
#define FLUSH_BSC_BUFFERS 0x0D /* flush any queued transmit and receive buffers */
|
||||
#define READ_CONFIGURATION 0x10 /* read the current operational configuration */
|
||||
#define SET_CONFIGURATION 0x11 /* set the operational configuration */
|
||||
#define READ_CODE_VERSION 0x15 /* read the code version */
|
||||
#define SET_INTERRUPT_TRIGGERS 0x20 /* set the interrupt triggers */
|
||||
#define READ_INTERRUPT_TRIGGERS 0x21 /* read the interrupt trigger configuration */
|
||||
#define READ_ADAPTER_CONFIGURATION 0xA0 /* find out what type of adapter is being used */
|
||||
|
||||
|
||||
|
||||
/* return code from BSC streaming commands */
|
||||
#define COMMAND_SUCCESSFULL 0x00 /* the command was successfull */
|
||||
#define COMMUNICATIONS_DISABLED 0x01 /* communications are currently disabled */
|
||||
#define COMMUNICATIONS_ENABLED 0x02 /* communications are currently enabled */
|
||||
#define SET_CONFIG_BEFORE_ENABLE_COMMS 0x03 /* SET_CONFIGURATION before ENABLE_COMMUNICATIONS */
|
||||
#define INVALID_CONFIGURATION_DATA 0x03 /* the passed configuration data is invalid */
|
||||
#define INVALID_TX_DATA_LGTH 0x03 /* the length of the data to be transmitted is invalid */
|
||||
#define CANT_FLUSH_BUSY_SENDING 0x03 /* the BSC buffers cannot be flushed as a block is being transmitted */
|
||||
#define TX_BUFFERS_FULL 0x04 /* the transmit buffers are full */
|
||||
#define ILLEGAL_COMMAND 0x05 /* the defined HDLC command is invalid */
|
||||
#define MODEM_STATUS_CHANGE 0x10 /* a modem (DCD/CTS) status change ocurred */
|
||||
#define NO_DATA_AVAILABLE 0x20
|
||||
|
||||
/* mailbox definitions */
|
||||
/*
|
||||
The two mailboxes take up a total of 8192 bytes, so each is 4096 bytes in size. However, we reserve the last 16 bytes
|
||||
in the receive mailbox for miscellaneous interface bytes, so each mailbox is now 4080 bytes. If we subtract 16 bytes
|
||||
for the mailbox header area, we are left with a mailbox data size of 4064 bytes.
|
||||
*/
|
||||
#define SIZEOF_MB_DATA_BFR 4064
|
||||
#define MAILBOX_SIZE 20
|
||||
|
||||
/* the mailbox structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag PACKED; /* the opp flag */
|
||||
unsigned char command PACKED; /* the user command */
|
||||
unsigned short buffer_length PACKED; /* the data length */
|
||||
unsigned char return_code PACKED; /* the return code */
|
||||
unsigned char misc_Tx_Rx_bits PACKED; /* miscellaneous transmit and receive bits */
|
||||
unsigned char Rx_error_bits PACKED; /* an indication of a block received with an error */
|
||||
unsigned short Rx_time_stamp PACKED; /* a millisecond receive time stamp */
|
||||
unsigned char reserved[7] PACKED; /* reserved for later use */
|
||||
char data[SIZEOF_MB_DATA_BFR] PACKED; /* the data area */
|
||||
} MAILBOX_STRUCT;
|
||||
|
||||
typedef struct {
|
||||
pid_t pid_num PACKED;
|
||||
MAILBOX_STRUCT cmdarea PACKED;
|
||||
} CMDBLOCK_STRUCT;
|
||||
|
||||
/* definitions for setting the configuration */
|
||||
#define MAXIMUM_BAUD_RATE 112000 /* the maximum permitted baud rate */
|
||||
#define MIN_BLOCK_LENGTH 2 /* the minimum permitted block length */
|
||||
#define MAX_BLOCK_LENGTH 2200 /* the maximum permitted block length */
|
||||
#define MIN_NO_CONSEC_PADs_EOB 1 /* the minimum number of consecutive PADs defining the end-of-block */
|
||||
#define MAX_NO_CONSEC_PADs_EOB 50 /* the maximum number of consecutive PADs defining the end-of-block */
|
||||
#define MIN_ADD_LEAD_TX_SYN_CHARS 0 /* the minimum number of additional leading SYN characters */
|
||||
#define MAX_ADD_LEAD_TX_SYN_CHARS 50 /* the maximum number of additional leading SYN characters */
|
||||
#define MIN_NO_BITS_PER_CHAR 8 /* the minimum number of bits per character */
|
||||
#define MAX_NO_BITS_PER_CHAR 8 /* the maximum number of bits per character */
|
||||
|
||||
/* definitions for the 'Rx_block_type' */
|
||||
#define RX_BLOCK_TYPE_1 1
|
||||
#define RX_BLOCK_TYPE_2 2
|
||||
#define RX_BLOCK_TYPE_3 3
|
||||
|
||||
/* definitions for 'parity' */
|
||||
#define NO_PARITY 0 /* no parity */
|
||||
#define ODD_PARITY 1 /* odd parity */
|
||||
#define EVEN_PARITY 2 /* even parity */
|
||||
|
||||
/* definitions for the 'statistics_options' */
|
||||
#define RX_STATISTICS 0x0001 /* enable receiver statistics */
|
||||
#define RX_TIME_STAMP 0x0002 /* enable the receive time stamp */
|
||||
#define TX_STATISTICS 0x0100 /* enable transmitter statistics */
|
||||
|
||||
/* definitions for the 'misc_config_options' */
|
||||
#define STRIP_PARITY_BIT_FROM_DATA 0x0001 /* strip the parity bit from the data for block types 1 & 3 */
|
||||
|
||||
/* definitions for the 'modem_config_options' */
|
||||
#define DONT_RAISE_DTR_RTS_EN_COMMS 0x0001 /* don't raise DTR and RTS when enabling communications */
|
||||
|
||||
/* the configuration structure */
|
||||
typedef struct {
|
||||
unsigned long baud_rate PACKED; /* the baud rate */
|
||||
unsigned long adapter_frequency PACKED; /* the adapter frequecy */
|
||||
unsigned short max_data_length PACKED; /* the maximum length of a BSC data block */
|
||||
unsigned short EBCDIC_encoding PACKED; /* EBCDIC/ASCII encoding */
|
||||
unsigned short Rx_block_type PACKED; /* the type of BSC block to be received */
|
||||
unsigned short no_consec_PADs_EOB PACKED; /* the number of consecutive PADs indicating the end of the block */
|
||||
unsigned short no_add_lead_Tx_SYN_chars PACKED; /* the number of additional leading transmit SYN characters */
|
||||
unsigned short no_bits_per_char PACKED; /* the number of bits per character */
|
||||
unsigned short parity PACKED; /* parity */
|
||||
unsigned short misc_config_options PACKED; /* miscellaneous configuration options */
|
||||
unsigned short statistics_options PACKED; /* statistic options */
|
||||
unsigned short modem_config_options PACKED; /* modem configuration options */
|
||||
} CONFIGURATION_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* definitions for reading the communications errors */
|
||||
/* the communications error structure */
|
||||
typedef struct {
|
||||
unsigned short Rx_overrun_err_count; /* the number of receiver overrun errors */
|
||||
unsigned short BCC_err_count; /* the number of receiver BCC errors */
|
||||
unsigned short nxt_Rx_bfr_occupied_count; /* the number of times a block had to be discarded due to buffering */
|
||||
/* limitations */
|
||||
unsigned short Rx_too_long_int_lvl_count; /* the number of blocks received which exceeded the maximum permitted */
|
||||
/* block size (interrupt level) */
|
||||
unsigned short Rx_too_long_app_lvl_count; /* the number of blocks received which exceeded the configured maximum */
|
||||
/* block size (application level) */
|
||||
unsigned short comms_err_res_Rx; /* reserved (later use) for a receive statistic */
|
||||
unsigned short Tx_underrun_count; /* the number of transmit underruns */
|
||||
unsigned short comms_err_res_Tx; /* reserved (later use) for a transmit statistic */
|
||||
unsigned short DCD_state_change_count; /* the number of times DCD changed state */
|
||||
unsigned short CTS_state_change_count; /* the number of times CTS changed state */
|
||||
} COMMUNICATIONS_ERROR_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* definitions for reading the operational statistics */
|
||||
/* the operational statistics structure */
|
||||
typedef struct {
|
||||
unsigned long no_blocks_Rx PACKED; /* the number of data blocks received and made available for the application */
|
||||
unsigned long no_bytes_Rx PACKED; /* the number of bytes received and made available for the application */
|
||||
unsigned long no_blocks_Tx PACKED; /* the number of data blocks transmitted */
|
||||
unsigned long no_bytes_Tx PACKED; /* the number of bytes transmitted */
|
||||
} OPERATIONAL_STATS_STRUCT;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/* definitions for interrupt usage */
|
||||
/* 'interrupt_triggers' bit mapping set by a SET_INTERRUPT_TRIGGERS command */
|
||||
#define INTERRUPT_ON_RX_BLOCK 0x01 /* interrupt when an data block is
|
||||
available for the application */
|
||||
#define NO_INTERRUPTS 0x00
|
||||
#define INTERRUPT_ON_TIMER 0x20
|
||||
|
||||
/* interrupt types indicated at 'ptr_interrupt_interface_byte' */
|
||||
#define RX_INTERRUPT_PENDING 0x01 /* a receive interrupt is pending */
|
||||
|
||||
typedef struct {
|
||||
char int_type;
|
||||
char int_allowed;
|
||||
} BSC_INT_BYTES;
|
||||
|
||||
|
||||
/* definitions for data block transmission */
|
||||
/* the setting of the 'misc_Tx_Rx_bits' in the mailbox */
|
||||
#define TX_BLK_TRANSPARENT 0x01 /* send a transparent text block */
|
||||
#define ETB_DEFINES_EOB 0x02 /* an ETB character defines the end of this text block */
|
||||
#define ITB_DEFINES_EOB 0x04 /* an ITB character defines the end of this text block */
|
||||
#define USR_DEFINES_TX_DATA 0x10 /* the user application defines the data to be transmitted */
|
||||
|
||||
|
||||
|
||||
/* definitions for the 'Rx_error_bits' in the RECEIVE mailbox */
|
||||
#define RX_BCC_ERROR 0x01 /* a receive BCC error occurred */
|
||||
#define RX_OVERRUN_ERROR 0x02 /* a receive overrun error occurred */
|
||||
#define RX_EXCESSIVE_LGTH_ERR_INT_LVL 0x10 /* the received block was too long (interrupt level) */
|
||||
#define RX_EXCESSIVE_LGTH_ERR_APP_LVL 0x20 /* the received block was too long (application level) */
|
|
@ -1,819 +0,0 @@
|
|||
/*************************************************************************
|
||||
sdla_chdlc.h Sangoma Cisco HDLC firmware API definitions
|
||||
|
||||
Author: Gideon Hack
|
||||
Nenad Corbic <ncorbic@sangoma.com>
|
||||
|
||||
Copyright: (c) 1995-2000 Sangoma Technologies Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the term of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version
|
||||
2 of the License, or (at your option) any later version.
|
||||
|
||||
===========================================================================
|
||||
Oct 04, 1999 Nenad Corbic Updated API support
|
||||
Jun 02, 1999 Gideon Hack Changes for S514 usage.
|
||||
Oct 28, 1998 Jaspreet Singh Made changes for Dual Port CHDLC.
|
||||
Jun 11, 1998 David Fong Initial version.
|
||||
===========================================================================
|
||||
|
||||
Organization
|
||||
- Compatibility notes
|
||||
- Constants defining the shared memory control block (mailbox)
|
||||
- Interface commands
|
||||
- Return code from interface commands
|
||||
- Constants for the commands (structures for casting data)
|
||||
- UDP Management constants and structures
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef _SDLA_CHDLC_H
|
||||
#define _SDLA_CHDLC_H
|
||||
|
||||
#if defined(__LINUX__)
|
||||
# include <linux/wanpipe_sppp_iface.h>
|
||||
#else
|
||||
# include <wanpipe_sppp_iface.h>
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------
|
||||
Notes:
|
||||
|
||||
All structres defined in this file are byte-aligned.
|
||||
|
||||
Compiler Platform
|
||||
------------------------
|
||||
GNU C Linux
|
||||
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants defining the shared memory control block (mailbox)
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
#define PRI_BASE_ADDR_MB_STRUCT 0xE000 /* the base address of the mailbox structure on the adapter */
|
||||
#define SEC_BASE_ADDR_MB_STRUCT 0xE800 /* the base address of the mailbox structure on the adapter */
|
||||
#define SIZEOF_MB_DATA_BFR 2032 /* the size of the actual mailbox data area */
|
||||
#define NUMBER_MB_RESERVED_BYTES 0x0B /* the number of reserved bytes in the mailbox header area */
|
||||
|
||||
|
||||
#define MIN_LGTH_CHDLC_DATA_CFG 300 /* min length of the CHDLC data field (for configuration purposes) */
|
||||
#define PRI_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* PRIMARY - max length of the CHDLC data field */
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
unsigned char opp_flag ; /* the opp flag */
|
||||
unsigned char command ; /* the user command */
|
||||
unsigned short buffer_length ; /* the data length */
|
||||
unsigned char return_code ; /* the return code */
|
||||
unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] ; /* reserved for later */
|
||||
unsigned char data[SIZEOF_MB_DATA_BFR] ; /* the data area */
|
||||
} CHDLC_MAILBOX_STRUCT;
|
||||
#endif
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Interface commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* global interface commands */
|
||||
#define READ_GLOBAL_EXCEPTION_CONDITION 0x01
|
||||
#define SET_GLOBAL_CONFIGURATION 0x02
|
||||
/*#define READ_GLOBAL_CONFIGURATION 0x03*/
|
||||
#define READ_GLOBAL_STATISTICS 0x04
|
||||
#define FLUSH_GLOBAL_STATISTICS 0x05
|
||||
#define SET_MODEM_STATUS 0x06 /* set status of DTR or RTS */
|
||||
#define READ_MODEM_STATUS 0x07 /* read status of CTS and DCD */
|
||||
#define READ_COMMS_ERROR_STATS 0x08
|
||||
#define FLUSH_COMMS_ERROR_STATS 0x09
|
||||
#define SET_TRACE_CONFIGURATION 0x0A /* set the line trace config */
|
||||
#define READ_TRACE_CONFIGURATION 0x0B /* read the line trace config */
|
||||
#define READ_TRACE_STATISTICS 0x0C /* read the trace statistics */
|
||||
#define FLUSH_TRACE_STATISTICS 0x0D /* flush the trace statistics */
|
||||
#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the S508/FT1 monitoring */
|
||||
#define SET_FT1_CONFIGURATION 0x18 /* set the FT1 configuration */
|
||||
#define READ_FT1_CONFIGURATION 0x19 /* read the FT1 configuration */
|
||||
#define TRANSMIT_ASYNC_DATA_TO_FT1 0x1A /* output asynchronous data to the FT1 */
|
||||
#define RECEIVE_ASYNC_DATA_FROM_FT1 0x1B /* receive asynchronous data from the FT1 */
|
||||
#define FT1_MONITOR_STATUS_CTRL 0x1C /* set the status of the FT1 monitoring */
|
||||
|
||||
#define READ_FT1_OPERATIONAL_STATS 0x1D /* read the S508/FT1 operational statistics */
|
||||
#define SET_FT1_MODE 0x1E /* set the operational mode of the S508/FT1 module */
|
||||
|
||||
/* CHDLC-level interface commands */
|
||||
/*#define READ_CHDLC_CODE_VERSION 0x20*/
|
||||
#define READ_CHDLC_EXCEPTION_CONDITION 0x21 /* read exception condition from the adapter */
|
||||
#define SET_CHDLC_CONFIGURATION 0x22
|
||||
/*#define READ_CHDLC_CONFIGURATION 0x23*/
|
||||
#define ENABLE_CHDLC_COMMUNICATIONS 0x24
|
||||
#define DISABLE_CHDLC_COMMUNICATIONS 0x25
|
||||
#define READ_CHDLC_LINK_STATUS 0x26
|
||||
|
||||
#define SET_MISC_TX_RX_PARAMETERS 0x29
|
||||
/* set miscellaneous Tx/Rx parameters */
|
||||
#define START_BAUD_CALIBRATION 0x2A
|
||||
/* calibrate an external clock */
|
||||
#define READ_BAUD_CALIBRATION_RESULT 0x2B
|
||||
|
||||
#define RESET_ESCC 0x2C
|
||||
/* read the result of a baud rate calibration */
|
||||
|
||||
#define SET_CHDLC_INTERRUPT_TRIGGERS 0x30
|
||||
/* set application interrupt triggers */
|
||||
#define READ_CHDLC_INTERRUPT_TRIGGERS 0x31
|
||||
/* read application interrupt trigger configuration */
|
||||
|
||||
/* Special UDP drivers management commands */
|
||||
#define CPIPE_ENABLE_TRACING 0x50
|
||||
#define CPIPE_DISABLE_TRACING 0x51
|
||||
#define CPIPE_GET_TRACE_INFO 0x52
|
||||
#define CPIPE_GET_IBA_DATA 0x53
|
||||
#define DIGITAL_LOOPTEST CPIPE_GET_IBA_DATA
|
||||
#define CPIPE_FT1_READ_STATUS 0x54
|
||||
#define CPIPE_DRIVER_STAT_IFSEND 0x55
|
||||
#define CPIPE_DRIVER_STAT_INTR 0x56
|
||||
#define CPIPE_DRIVER_STAT_GEN 0x57
|
||||
#define CPIPE_FLUSH_DRIVER_STATS 0x58
|
||||
#define CPIPE_ROUTER_UP_TIME 0x59
|
||||
|
||||
#if 0
|
||||
#define CPIPE_MPPP_TRACE_ENABLE 0x60
|
||||
#define CPIPE_MPPP_TRACE_DISABLE 0x61
|
||||
#define CPIPE_TE1_56K_STAT 0x62 /* TE1_56K */
|
||||
#define CPIPE_GET_MEDIA_TYPE 0x63 /* TE1_56K */
|
||||
#define CPIPE_FLUSH_TE1_PMON 0x64 /* TE1 */
|
||||
#define CPIPE_READ_REGISTER 0x65 /* TE1_56K */
|
||||
#define CPIPE_TE1_CFG 0x66 /* TE1 */
|
||||
#endif
|
||||
|
||||
/* Driver specific commands for API */
|
||||
#define CHDLC_READ_TRACE_DATA 0xE4 /* read trace data */
|
||||
#define TRACE_ALL 0x00
|
||||
#define TRACE_PROT 0x01
|
||||
#define TRACE_DATA 0x02
|
||||
|
||||
#define DISCARD_RX_ERROR_FRAMES 0x0001
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Return codes from interface commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
#define COMMAND_OK 0x00
|
||||
|
||||
/* return codes from global interface commands */
|
||||
#define NO_GLOBAL_EXCEP_COND_TO_REPORT 0x01 /* there is no CHDLC exception condition to report */
|
||||
#define LGTH_GLOBAL_CFG_DATA_INVALID 0x01 /* the length of the passed global configuration data is invalid */
|
||||
#define LGTH_TRACE_CFG_DATA_INVALID 0x01 /* the length of the passed trace configuration data is invalid */
|
||||
#define IRQ_TIMEOUT_VALUE_INVALID 0x02 /* an invalid application IRQ timeout value was selected */
|
||||
#define TRACE_CONFIG_INVALID 0x02 /* the passed line trace configuration is invalid */
|
||||
#define ADAPTER_OPERATING_FREQ_INVALID 0x03 /* an invalid adapter operating frequency was selected */
|
||||
#define TRC_DEAC_TMR_INVALID 0x03 /* the trace deactivation timer is invalid */
|
||||
#define S508_FT1_ADPTR_NOT_PRESENT 0x0C /* the S508/FT1 adapter is not present */
|
||||
#define INVALID_FT1_STATUS_SELECTION 0x0D /* the S508/FT1 status selection is invalid */
|
||||
#define FT1_OP_STATS_NOT_ENABLED 0x0D /* the FT1 operational statistics have not been enabled */
|
||||
#define FT1_OP_STATS_NOT_AVAILABLE 0x0E /* the FT1 operational statistics are not currently available */
|
||||
#define S508_FT1_MODE_SELECTION_BUSY 0x0E /* the S508/FT1 adapter is busy selecting the operational mode */
|
||||
|
||||
/* return codes from command READ_GLOBAL_EXCEPTION_CONDITION */
|
||||
#define EXCEP_MODEM_STATUS_CHANGE 0x10 /* a modem status change occurred */
|
||||
#define EXCEP_TRC_DISABLED 0x11 /* the trace has been disabled */
|
||||
#define EXCEP_IRQ_TIMEOUT 0x12 /* IRQ timeout */
|
||||
#define EXCEP_CSU_DSU_STATE_CHANGE 0x16
|
||||
|
||||
/* return codes from CHDLC-level interface commands */
|
||||
#define NO_CHDLC_EXCEP_COND_TO_REPORT 0x21 /* there is no CHDLC exception condition to report */
|
||||
#define CHDLC_COMMS_DISABLED 0x21 /* communications are not currently enabled */
|
||||
#define CHDLC_COMMS_ENABLED 0x21 /* communications are currently enabled */
|
||||
#define DISABLE_CHDLC_COMMS_BEFORE_CFG 0x21 /* CHDLC communications must be disabled before setting the configuration */
|
||||
#define ENABLE_CHDLC_COMMS_BEFORE_CONN 0x21 /* communications must be enabled before using the CHDLC_CONNECT conmmand */
|
||||
#define CHDLC_CFG_BEFORE_COMMS_ENABLED 0x22 /* perform a SET_CHDLC_CONFIGURATION before enabling comms */
|
||||
#define LGTH_CHDLC_CFG_DATA_INVALID 0x22 /* the length of the passed CHDLC configuration data is invalid */
|
||||
#define LGTH_INT_TRIGGERS_DATA_INVALID 0x22 /* the length of the passed interrupt trigger data is invalid */
|
||||
#define INVALID_IRQ_SELECTED 0x23 /* in invalid IRQ was selected in the SET_CHDLC_INTERRUPT_TRIGGERS */
|
||||
#define INVALID_CHDLC_CFG_DATA 0x23 /* the passed CHDLC configuration data is invalid */
|
||||
#define IRQ_TMR_VALUE_INVALID 0x24 /* an invalid application IRQ timer value was selected */
|
||||
#define LARGER_PERCENT_TX_BFR_REQUIRED 0x24 /* a larger Tx buffer percentage is required */
|
||||
#define LARGER_PERCENT_RX_BFR_REQUIRED 0x25 /* a larger Rx buffer percentage is required */
|
||||
#define S514_BOTH_PORTS_SAME_CLK_MODE 0x26 /* S514 - both ports must have same clock mode */
|
||||
#define BAUD_CALIBRATION_NOT_DONE 0x29 /* a baud rate calibration has not been performed */
|
||||
#define BUSY_WITH_BAUD_CALIBRATION 0x2A /* adapter busy with a baud rate calibration */
|
||||
#define BAUD_CAL_FAILED_NO_TX_CLK 0x2B /* baud rate calibration failed (no transmit clock) */
|
||||
#define BAUD_CAL_FAILED_BAUD_HI 0x2C /* baud rate calibration failed (baud too high) */
|
||||
#define CANNOT_DO_BAUD_CAL 0x2D /* a baud rate calibration cannot be performed */
|
||||
|
||||
#define INVALID_CMND_HDLC_STREAM_MODE 0x4E /* the CHDLC interface command is invalid for HDLC streaming mode */
|
||||
#define INVALID_CHDLC_COMMAND 0x4F /* the defined CHDLC interface command is invalid */
|
||||
|
||||
/* return codes from command READ_CHDLC_EXCEPTION_CONDITION */
|
||||
#define EXCEP_LINK_ACTIVE 0x30 /* the CHDLC link has become active */
|
||||
#define EXCEP_LINK_INACTIVE_MODEM 0x31 /* the CHDLC link has become inactive (modem status) */
|
||||
#define EXCEP_LINK_INACTIVE_KPALV 0x32 /* the CHDLC link has become inactive (keepalive status) */
|
||||
#define EXCEP_IP_ADDRESS_DISCOVERED 0x33 /* the IP address has been discovered */
|
||||
#define EXCEP_LOOPBACK_CONDITION 0x34 /* a loopback condition has occurred */
|
||||
|
||||
|
||||
/* return code from command CHDLC_SEND_WAIT and CHDLC_SEND_NO_WAIT */
|
||||
#define LINK_DISCONNECTED 0x21
|
||||
#define NO_TX_BFRS_AVAIL 0x24
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the SET_GLOBAL_CONFIGURATION/READ_GLOBAL_CONFIGURATION commands
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global configuration structure */
|
||||
typedef struct {
|
||||
unsigned short adapter_config_options ; /* adapter config options */
|
||||
unsigned short app_IRQ_timeout ; /* application IRQ timeout */
|
||||
unsigned int adapter_operating_frequency ; /* adapter operating frequency */
|
||||
unsigned short frame_transmit_timeout ;
|
||||
} GLOBAL_CONFIGURATION_STRUCT;
|
||||
|
||||
/* settings for the 'app_IRQ_timeout' */
|
||||
#define MAX_APP_IRQ_TIMEOUT_VALUE 5000 /* the maximum permitted IRQ timeout */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_GLOBAL_STATISTICS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global statistics structure */
|
||||
typedef struct {
|
||||
unsigned short app_IRQ_timeout_count ;
|
||||
} GLOBAL_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_COMMS_ERROR_STATS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the communications error statistics structure */
|
||||
typedef struct {
|
||||
unsigned short Rx_overrun_err_count ;
|
||||
unsigned short CRC_err_count ; /* receiver CRC error count */
|
||||
unsigned short Rx_abort_count ; /* abort frames recvd count */
|
||||
unsigned short Rx_dis_pri_bfrs_full_count ;/* receiver disabled */
|
||||
unsigned short comms_err_stat_reserved_1 ;/* reserved for later */
|
||||
unsigned short sec_Tx_abort_msd_Tx_int_count ; /* secondary - abort frames transmitted count (missed Tx interrupt) */
|
||||
unsigned short missed_Tx_und_int_count ; /* missed tx underrun interrupt count */
|
||||
unsigned short sec_Tx_abort_count ; /*secondary-abort frames tx count */
|
||||
unsigned short DCD_state_change_count ; /* DCD state change */
|
||||
unsigned short CTS_state_change_count ; /* CTS state change */
|
||||
} COMMS_ERROR_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants used for line tracing
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the trace configuration structure (SET_TRACE_CONFIGURATION/READ_TRACE_CONFIGURATION commands) */
|
||||
typedef struct {
|
||||
unsigned char trace_config ; /* trace configuration */
|
||||
unsigned short trace_deactivation_timer ; /* trace deactivation timer */
|
||||
unsigned int ptr_trace_stat_el_cfg_struct ; /* a pointer to the line trace element configuration structure */
|
||||
} LINE_TRACE_CONFIG_STRUCT;
|
||||
|
||||
/* 'trace_config' bit settings */
|
||||
#define TRACE_INACTIVE 0x00 /* trace is inactive */
|
||||
#define TRACE_ACTIVE 0x01 /* trace is active */
|
||||
#define TRACE_DELAY_MODE 0x04 /* operate the trace in delay mode */
|
||||
#define TRACE_DATA_FRAMES 0x08 /* trace Data frames */
|
||||
#define TRACE_SLARP_FRAMES 0x10 /* trace SLARP frames */
|
||||
#define TRACE_CDP_FRAMES 0x20 /* trace CDP frames */
|
||||
|
||||
/* the line trace status element configuration structure */
|
||||
typedef struct {
|
||||
unsigned short number_trace_status_elements ; /* number of line trace elements */
|
||||
unsigned int base_addr_trace_status_elements ; /* base address of the trace element list */
|
||||
unsigned int next_trace_element_to_use ; /* pointer to the next trace element to be used */
|
||||
unsigned int base_addr_trace_buffer ; /* base address of the trace data buffer */
|
||||
unsigned int end_addr_trace_buffer ; /* end address of the trace data buffer */
|
||||
} TRACE_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/* the line trace status element structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag ; /* opp flag */
|
||||
unsigned short trace_length ; /* trace length */
|
||||
unsigned char trace_type ; /* trace type */
|
||||
unsigned short trace_time_stamp ; /* time stamp */
|
||||
unsigned short trace_reserved_1 ; /* reserved for later use */
|
||||
unsigned int trace_reserved_2 ; /* reserved for later use */
|
||||
unsigned int ptr_data_bfr ; /* ptr to the trace data buffer */
|
||||
} TRACE_STATUS_ELEMENT_STRUCT;
|
||||
|
||||
/* "trace_type" bit settings */
|
||||
#define TRACE_INCOMING 0x00
|
||||
#define TRACE_OUTGOINGING 0x01
|
||||
#define TRACE_INCOMING_ABORTED 0x10
|
||||
#define TRACE_INCOMING_CRC_ERROR 0x20
|
||||
#define TRACE_INCOMING_OVERRUN_ERROR 0x40
|
||||
|
||||
|
||||
|
||||
/* the line trace statistics structure */
|
||||
typedef struct {
|
||||
unsigned int frames_traced_count ; /* number of frames traced */
|
||||
unsigned int trc_frms_not_recorded_count ; /* number of trace frames discarded */
|
||||
} LINE_TRACE_STATS_STRUCT;
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the FT1_MONITOR_STATUS_CTRL command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
#define DISABLE_FT1_STATUS_STATISTICS 0x00 /* disable the FT1 status and statistics monitoring */
|
||||
#define ENABLE_READ_FT1_STATUS 0x01 /* read the FT1 operational status */
|
||||
#define ENABLE_READ_FT1_OP_STATS 0x02 /* read the FT1 operational statistics */
|
||||
#define FLUSH_FT1_OP_STATS 0x04 /* flush the FT1 operational statistics */
|
||||
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the SET_CHDLC_CONFIGURATION command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the CHDLC configuration structure */
|
||||
typedef struct {
|
||||
unsigned int baud_rate ; /* the baud rate */
|
||||
unsigned short line_config_options ; /* line configuration options */
|
||||
unsigned short modem_config_options ; /* modem configration options */
|
||||
unsigned short modem_status_timer ; /* timer for monitoring modem status changes */
|
||||
unsigned short CHDLC_API_options ; /* CHDLC API options */
|
||||
unsigned short CHDLC_protocol_options ; /* CHDLC protocol options */
|
||||
unsigned short percent_data_buffer_for_Tx ; /* percentage data buffering used for Tx */
|
||||
unsigned short CHDLC_statistics_options ; /* CHDLC operational statistics options */
|
||||
unsigned short max_CHDLC_data_field_length ; /* the maximum length of the CHDLC Data field */
|
||||
unsigned short transmit_keepalive_timer ; /* the transmit keepalive timer */
|
||||
unsigned short receive_keepalive_timer ; /* the receive keepalive timer */
|
||||
unsigned short keepalive_error_tolerance ; /* the receive keepalive error tolerance */
|
||||
unsigned short SLARP_request_timer ; /* the SLARP request timer */
|
||||
unsigned int IP_address ; /* the IP address */
|
||||
unsigned int IP_netmask ; /* the IP netmask */
|
||||
unsigned int ptr_shared_mem_info_struct ; /* a pointer to the shared memory area information structure */
|
||||
unsigned int ptr_CHDLC_Tx_stat_el_cfg_struct ; /* a pointer to the transmit status element configuration structure */
|
||||
unsigned int ptr_CHDLC_Rx_stat_el_cfg_struct ; /* a pointer to the receive status element configuration structure */
|
||||
} CHDLC_CONFIGURATION_STRUCT;
|
||||
|
||||
/* settings for the 'line_config_options' */
|
||||
#define INTERFACE_LEVEL_V35 0x0000
|
||||
/* V.35 interface level */
|
||||
|
||||
#define INTERFACE_LEVEL_RS232 0x0001
|
||||
/* RS-232 interface level */
|
||||
|
||||
#define NRZI_ENCODING 0x0010
|
||||
/* NRZI data encoding */
|
||||
|
||||
#define IDLE_MARK 0x0020
|
||||
/* idle line condition is mark (not flags) */
|
||||
|
||||
|
||||
/* settings for the 'modem_config_options' */
|
||||
|
||||
#define DONT_RAISE_DTR_RTS_ON_EN_COMMS 0x0001
|
||||
/* don't automatically raise DTR and RTS when performing an
|
||||
ENABLE_CHDLC_COMMUNICATIONS command */
|
||||
|
||||
#define DONT_REPORT_CHG_IN_MODEM_STAT 0x0002
|
||||
/* don't report changes in modem status to the application */
|
||||
|
||||
#define SWITCHED_CTS_RTS 0x0010
|
||||
/* switched CTS/RTS */
|
||||
|
||||
|
||||
/* bit settings for the 'CHDLC_protocol_options' byte */
|
||||
|
||||
#define IGNORE_DCD_FOR_LINK_STAT 0x0001
|
||||
/* ignore DCD in determining the CHDLC link status */
|
||||
|
||||
#define IGNORE_CTS_FOR_LINK_STAT 0x0002
|
||||
/* ignore CTS in determining the CHDLC link status */
|
||||
|
||||
#define IGNORE_KPALV_FOR_LINK_STAT 0x0004
|
||||
/* ignore keepalive frames in determining the CHDLC link status */
|
||||
|
||||
#define INSTALL_FAST_INT_HANDLERS 0x1000
|
||||
/* install 'fast' interrupt handlers for improved dual-port perf. */
|
||||
|
||||
#define USE_32_BIT_CRC 0x2000
|
||||
/* use a 32-bit CRC */
|
||||
|
||||
#define SINGLE_TX_BUFFER 0x4000
|
||||
/* configure a single transmit buffer */
|
||||
|
||||
#define HDLC_STREAMING_MODE 0x8000
|
||||
|
||||
/* settings for the 'CHDLC_statistics_options' */
|
||||
|
||||
#define CHDLC_TX_DATA_BYTE_COUNT_STAT 0x0001
|
||||
/* record the number of Data bytes transmitted */
|
||||
|
||||
#define CHDLC_RX_DATA_BYTE_COUNT_STAT 0x0002
|
||||
/* record the number of Data bytes received */
|
||||
|
||||
#define CHDLC_TX_THROUGHPUT_STAT 0x0004
|
||||
/* compute the Data frame transmit throughput */
|
||||
|
||||
#define CHDLC_RX_THROUGHPUT_STAT 0x0008
|
||||
/* compute the Data frame receive throughput */
|
||||
|
||||
|
||||
/* permitted minimum and maximum values for setting the CHDLC configuration */
|
||||
#define PRI_MAX_BAUD_RATE_S508 2666666 /* PRIMARY - maximum baud rate (S508) */
|
||||
#define SEC_MAX_BAUD_RATE_S508 258064 /* SECONDARY - maximum baud rate (S508) */
|
||||
#define PRI_MAX_BAUD_RATE_S514 2750000 /* PRIMARY - maximum baud rate (S508) */
|
||||
#define SEC_MAX_BAUD_RATE_S514 515625 /* SECONDARY - maximum baud rate (S508) */
|
||||
|
||||
#define MIN_MODEM_TIMER 0 /* minimum modem status timer */
|
||||
#define MAX_MODEM_TIMER 5000 /* maximum modem status timer */
|
||||
|
||||
#define SEC_MAX_NO_DATA_BYTES_IN_FRAME 2048 /* SECONDARY - max length of the CHDLC data field */
|
||||
|
||||
#define MIN_Tx_KPALV_TIMER 0 /* minimum transmit keepalive timer */
|
||||
#define MAX_Tx_KPALV_TIMER 60000 /* maximum transmit keepalive timer */
|
||||
#define DEFAULT_Tx_KPALV_TIMER 10000 /* default transmit keepalive timer */
|
||||
|
||||
#define MIN_Rx_KPALV_TIMER 10 /* minimum receive keepalive timer */
|
||||
#define MAX_Rx_KPALV_TIMER 60000 /* maximum receive keepalive timer */
|
||||
#define DEFAULT_Rx_KPALV_TIMER 10000 /* default receive keepalive timer */
|
||||
|
||||
#define MIN_KPALV_ERR_TOL 1 /* min kpalv error tolerance count */
|
||||
#define MAX_KPALV_ERR_TOL 20 /* max kpalv error tolerance count */
|
||||
#define DEFAULT_KPALV_ERR_TOL 3 /* default value */
|
||||
|
||||
#define MIN_SLARP_REQ_TIMER 0 /* min transmit SLARP Request timer */
|
||||
#define MAX_SLARP_REQ_TIMER 60000 /* max transmit SLARP Request timer */
|
||||
#define DEFAULT_SLARP_REQ_TIMER 0 /* default value -- no SLARP */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the READ_CHDLC_LINK_STATUS command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the CHDLC status structure */
|
||||
typedef struct {
|
||||
unsigned char CHDLC_link_status ; /* CHDLC link status */
|
||||
unsigned char no_Data_frms_for_app ; /* number of Data frames available for the application */
|
||||
unsigned char receiver_status ; /* enabled/disabled */
|
||||
unsigned char SLARP_state ; /* internal SLARP state */
|
||||
} CHDLC_LINK_STATUS_STRUCT;
|
||||
|
||||
/* settings for the 'CHDLC_link_status' variable */
|
||||
#define CHDLC_LINK_INACTIVE 0x00 /* the CHDLC link is inactive */
|
||||
#define CHDLC_LINK_ACTIVE 0x01 /* the CHDLC link is active */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for using application interrupts
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the structure used for the SET_CHDLC_INTERRUPT_TRIGGERS/READ_CHDLC_INTERRUPT_TRIGGERS command */
|
||||
typedef struct {
|
||||
unsigned char CHDLC_interrupt_triggers ; /* CHDLC interrupt trigger configuration */
|
||||
unsigned char IRQ ; /* IRQ to be used */
|
||||
unsigned short interrupt_timer ; /* interrupt timer */
|
||||
unsigned short misc_interrupt_bits ; /* miscellaneous bits */
|
||||
} CHDLC_INT_TRIGGERS_STRUCT;
|
||||
|
||||
/* 'CHDLC_interrupt_triggers' bit settings */
|
||||
#define APP_INT_ON_RX_FRAME 0x01 /* interrupt on Data frame reception */
|
||||
#define APP_INT_ON_TX_FRAME 0x02 /* interrupt when an Data frame may be transmitted */
|
||||
#define APP_INT_ON_COMMAND_COMPLETE 0x04 /* interrupt when an interface command is complete */
|
||||
#define APP_INT_ON_TIMER 0x08 /* interrupt on a defined millisecond timeout */
|
||||
#define APP_INT_ON_GLOBAL_EXCEP_COND 0x10 /* interrupt on a global exception condition */
|
||||
#define APP_INT_ON_CHDLC_EXCEP_COND 0x20 /* interrupt on an CHDLC exception condition */
|
||||
#define APP_INT_ON_TRACE_DATA_AVAIL 0x80 /* interrupt when trace data is available */
|
||||
|
||||
/* interrupt types indicated at 'interrupt_type' byte of the INTERRUPT_INFORMATION_STRUCT */
|
||||
#define NO_APP_INTS_PEND 0x00 /* no interrups are pending */
|
||||
#define RX_APP_INT_PEND 0x01 /* a receive interrupt is pending */
|
||||
#define TX_APP_INT_PEND 0x02 /* a transmit interrupt is pending */
|
||||
#define COMMAND_COMPLETE_APP_INT_PEND 0x04 /* a 'command complete' interrupt is pending */
|
||||
#define TIMER_APP_INT_PEND 0x08 /* a timer interrupt is pending */
|
||||
#define GLOBAL_EXCEP_COND_APP_INT_PEND 0x10 /* a global exception condition interrupt is pending */
|
||||
#define CHDLC_EXCEP_COND_APP_INT_PEND 0x20 /* an CHDLC exception condition interrupt is pending */
|
||||
#define TRACE_DATA_AVAIL_APP_INT_PEND 0x80 /* a trace data available interrupt is pending */
|
||||
|
||||
|
||||
/* modem status changes */
|
||||
#define DCD_HIGH 0x08
|
||||
#define CTS_HIGH 0x20
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for Data frame transmission
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the Data frame transmit status element configuration structure */
|
||||
typedef struct {
|
||||
unsigned short number_Tx_status_elements ; /* number of transmit status elements */
|
||||
unsigned int base_addr_Tx_status_elements ; /* base address of the transmit element list */
|
||||
unsigned int next_Tx_status_element_to_use ; /* pointer to the next transmit element to be used */
|
||||
} CHDLC_TX_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/* the Data frame transmit status element structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag ; /* opp flag */
|
||||
unsigned short frame_length ; /* length of the frame to be transmitted */
|
||||
unsigned char misc_Tx_bits ; /* miscellaneous transmit bits */
|
||||
unsigned int reserved_2 ; /* reserved for internal use */
|
||||
unsigned int reserved_3 ; /* reserved for internal use */
|
||||
unsigned int ptr_data_bfr ; /* pointer to the data area */
|
||||
} CHDLC_DATA_TX_STATUS_EL_STRUCT;
|
||||
|
||||
|
||||
/* settings for the 'misc_Tx_bits'
|
||||
* (pertains only to switched CTS/RTS and
|
||||
* 'idle mark' configurations) */
|
||||
|
||||
#define DROP_RTS_AFTER_TX 0x01
|
||||
/* drop RTS after transmission of this frame */
|
||||
|
||||
#define IDLE_FLAGS_AFTER_TX 0x02
|
||||
/* idle flags after transmission of this frame */
|
||||
|
||||
/* settings for the 'misc_Tx_bits' for IPv4/IPv6 usage */
|
||||
#define TX_DATA_IPv4 0x00
|
||||
/* apply the IPv4 CHDLC header to the transmitted Data frame */
|
||||
#define TX_DATA_IPv6 0x80
|
||||
/* apply the IPv6 CHDLC header to the transmitted Data frame */
|
||||
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for Data frame reception
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the Data frame receive status element configuration structure */
|
||||
typedef struct {
|
||||
unsigned short number_Rx_status_elements ; /* number of receive status elements */
|
||||
unsigned int base_addr_Rx_status_elements ; /* base address of the receive element list */
|
||||
unsigned int next_Rx_status_element_to_use ; /* pointer to the next receive element to be used */
|
||||
unsigned int base_addr_Rx_buffer ; /* base address of the receive data buffer */
|
||||
unsigned int end_addr_Rx_buffer ; /* end address of the receive data buffer */
|
||||
} CHDLC_RX_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/* the Data frame receive status element structure */
|
||||
typedef struct {
|
||||
unsigned char opp_flag ; /* opp flag */
|
||||
unsigned short frame_length ; /* length of the received frame */
|
||||
unsigned char error_flag ; /* frame errors (HDLC_STREAMING_MODE)*/
|
||||
unsigned short time_stamp ; /* receive time stamp (HDLC_STREAMING_MODE) */
|
||||
unsigned int reserved_1 ; /* reserved for internal use */
|
||||
unsigned short reserved_2 ; /* reserved for internal use */
|
||||
unsigned int ptr_data_bfr ; /* pointer to the data area */
|
||||
} CHDLC_DATA_RX_STATUS_EL_STRUCT;
|
||||
|
||||
|
||||
/* settings for the 'error_flag' */
|
||||
#define RX_FRM_ABORT 0x01
|
||||
#define RX_FRM_CRC_ERROR 0x02
|
||||
#define RX_FRM_OVERRUN_ERROR 0x04
|
||||
|
||||
/* settings for the 'error_flag' for IPv4/IPv6 usage */
|
||||
#define RX_DATA_IPv4 0x00
|
||||
/* the received Data frame is IPv4 */
|
||||
#define RX_DATA_IPv6 0x80
|
||||
/* the received Data frame is IPv6 */
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants defining the shared memory information area
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the global information structure */
|
||||
typedef struct {
|
||||
unsigned char global_status ; /* global status */
|
||||
unsigned char modem_status ; /* current modem status */
|
||||
unsigned char global_excep_conditions ; /* global exception conditions */
|
||||
unsigned char glob_info_reserved[5] ; /* reserved */
|
||||
unsigned char codename[4] ; /* Firmware name */
|
||||
unsigned char codeversion[4] ; /* Firmware version */
|
||||
} GLOBAL_INFORMATION_STRUCT;
|
||||
|
||||
/* the CHDLC information structure */
|
||||
typedef struct {
|
||||
unsigned char CHDLC_status ; /* CHDLC status */
|
||||
unsigned char CHDLC_excep_conditions ; /* CHDLC exception conditions */
|
||||
unsigned char CHDLC_info_reserved[14] ; /* reserved */
|
||||
} CHDLC_INFORMATION_STRUCT;
|
||||
|
||||
/* the interrupt information structure */
|
||||
typedef struct {
|
||||
unsigned char interrupt_type ; /* type of interrupt triggered */
|
||||
unsigned char interrupt_permission ; /* interrupt permission mask */
|
||||
unsigned char int_info_reserved[14] ; /* reserved */
|
||||
} INTERRUPT_INFORMATION_STRUCT;
|
||||
|
||||
/* the S508/FT1 information structure */
|
||||
typedef struct {
|
||||
unsigned char parallel_port_A_input ; /* input - parallel port A */
|
||||
unsigned char parallel_port_B_input ; /* input - parallel port B */
|
||||
unsigned char FT1_info_reserved[14] ; /* reserved */
|
||||
} FT1_INFORMATION_STRUCT;
|
||||
|
||||
/* the shared memory area information structure */
|
||||
typedef struct {
|
||||
GLOBAL_INFORMATION_STRUCT global_info_struct ; /* the global information structure */
|
||||
CHDLC_INFORMATION_STRUCT CHDLC_info_struct ; /* the CHDLC information structure */
|
||||
INTERRUPT_INFORMATION_STRUCT interrupt_info_struct ; /* the interrupt information structure */
|
||||
FT1_INFORMATION_STRUCT FT1_info_struct ; /* the S508/FT1 information structure */
|
||||
} SHARED_MEMORY_INFO_STRUCT;
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
* UDP Management constants and structures
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* The embedded control block for UDP mgmt
|
||||
This is essentially a mailbox structure, without the large data field */
|
||||
|
||||
#ifndef HDLC_PROT_ONLY
|
||||
|
||||
typedef struct {
|
||||
unsigned char opp_flag ; /* the opp flag */
|
||||
unsigned char command ; /* the user command */
|
||||
unsigned short buffer_length ; /* the data length */
|
||||
unsigned char return_code ; /* the return code */
|
||||
unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] ; /* reserved for later */
|
||||
} cblock_t;
|
||||
|
||||
/* UDP management packet layout (data area of ip packet) */
|
||||
/*
|
||||
typedef struct {
|
||||
unsigned char signature[8] ;
|
||||
unsigned char request_reply ;
|
||||
unsigned char id ;
|
||||
unsigned char reserved[6] ;
|
||||
cblock_t cblock ;
|
||||
unsigned char num_frames ;
|
||||
unsigned char ismoredata ;
|
||||
unsigned char data[SIZEOF_MB_DATA_BFR] ;
|
||||
} udp_management_packet_t;
|
||||
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char num_frames ;
|
||||
unsigned char ismoredata ;
|
||||
} trace_info_t;
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
ip_pkt_t ip_pkt ;
|
||||
udp_pkt_t udp_pkt ;
|
||||
wp_mgmt_t wp_mgmt ;
|
||||
cblock_t cblock ;
|
||||
trace_info_t trace_info ;
|
||||
unsigned char data[SIZEOF_MB_DATA_BFR] ;
|
||||
} chdlc_udp_pkt_t;
|
||||
#endif
|
||||
|
||||
typedef struct ft1_exec_cmd{
|
||||
unsigned char command ; /* the user command */
|
||||
unsigned short buffer_length ; /* the data length */
|
||||
unsigned char return_code ; /* the return code */
|
||||
unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] ;
|
||||
} ft1_exec_cmd_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char opp_flag ;
|
||||
ft1_exec_cmd_t cmd ;
|
||||
unsigned char data[SIZEOF_MB_DATA_BFR] ;
|
||||
} ft1_exec_t;
|
||||
|
||||
|
||||
#define UDPMGMT_SIGNATURE "CTPIPEAB"
|
||||
#define UDPMGMT_SIGNATURE_LEN 8
|
||||
|
||||
|
||||
/* UDP/IP packet (for UDP management) layout */
|
||||
/*
|
||||
typedef struct {
|
||||
unsigned char reserved[2] ;
|
||||
unsigned short ip_length ;
|
||||
unsigned char reserved2[4] ;
|
||||
unsigned char ip_ttl ;
|
||||
unsigned char ip_protocol ;
|
||||
unsigned short ip_checksum ;
|
||||
unsigned int ip_src_address ;
|
||||
unsigned int ip_dst_address ;
|
||||
unsigned short udp_src_port ;
|
||||
unsigned short udp_dst_port ;
|
||||
unsigned short udp_length ;
|
||||
unsigned short udp_checksum ;
|
||||
udp_management_packet_t um_packet ;
|
||||
} ip_packet_t;
|
||||
*/
|
||||
|
||||
/* valid ip_protocol for UDP management */
|
||||
#define UDPMGMT_UDP_PROTOCOL 0x11
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
unsigned char status ;
|
||||
unsigned char data_avail ;
|
||||
unsigned short real_length ;
|
||||
unsigned short time_stamp ;
|
||||
unsigned char data[1] ;
|
||||
} trace_pkt_t;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
unsigned char error_flag ;
|
||||
unsigned short time_stamp ;
|
||||
unsigned int sec ;
|
||||
unsigned int usec ;
|
||||
unsigned char reserved[5] ;
|
||||
} api_rx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_rx_hdr_t api_rx_hdr ;
|
||||
unsigned char data[1] ;
|
||||
} api_rx_element_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char attr ;
|
||||
unsigned char misc_Tx_bits ;
|
||||
unsigned char reserved[14] ;
|
||||
} api_tx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_tx_hdr_t api_tx_hdr ;
|
||||
unsigned char data[1] ;
|
||||
} api_tx_element_t;
|
||||
|
||||
#endif //HDLC_PROT_ONLY
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Constants for the SET_FT1_CONFIGURATION/READ_FT1_CONFIGURATION command
|
||||
* --------------------------------------------------------------------------*/
|
||||
|
||||
/* the FT1 configuration structure */
|
||||
typedef struct {
|
||||
unsigned short framing_mode;
|
||||
unsigned short encoding_mode;
|
||||
unsigned short line_build_out;
|
||||
unsigned short channel_base;
|
||||
unsigned short baud_rate_kbps; /* the baud rate (in kbps) */
|
||||
unsigned short clock_mode;
|
||||
} ft1_config_t;
|
||||
|
||||
|
||||
|
||||
/* settings for the 'framing_mode' */
|
||||
#define ESF_FRAMING 0x00 /* ESF framing */
|
||||
#define D4_FRAMING 0x01 /* D4 framing */
|
||||
|
||||
/* settings for the 'encoding_mode' */
|
||||
#define B8ZS_ENCODING 0x00 /* B8ZS encoding */
|
||||
#define AMI_ENCODING 0x01 /* AMI encoding */
|
||||
|
||||
/* settings for the 'line_build_out' */
|
||||
#define LN_BLD_CSU_0dB_DSX1_0_to_133 0x00 /* set build out to CSU (0db) or DSX-1 (0-133ft) */
|
||||
#define LN_BLD_DSX1_133_to_266 0x01 /* set build out DSX-1 (133-266ft) */
|
||||
#define LN_BLD_DSX1_266_to_399 0x02 /* set build out DSX-1 (266-399ft) */
|
||||
#define LN_BLD_DSX1_399_to_533 0x03 /* set build out DSX-1 (399-533ft) */
|
||||
#define LN_BLD_DSX1_533_to_655 0x04 /* set build out DSX-1 (533-655ft) */
|
||||
#define LN_BLD_CSU_NEG_7dB 0x05 /* set build out to CSU (-7.5db) */
|
||||
#define LN_BLD_CSU_NEG_15dB 0x06 /* set build out to CSU (-15db) */
|
||||
#define LN_BLD_CSU_NEG_22dB 0x07 /* set build out to CSU (-22.5db) */
|
||||
|
||||
/* settings for the 'channel_base' */
|
||||
#define MIN_CHANNEL_BASE_VALUE 1 /* the minimum permitted channel base value */
|
||||
#define MAX_CHANNEL_BASE_VALUE 24 /* the maximum permitted channel base value */
|
||||
|
||||
/* settings for the 'baud_rate_kbps' */
|
||||
#define MIN_BAUD_RATE_KBPS 0 /* the minimum permitted baud rate (kbps) */
|
||||
#define MAX_BAUD_RATE_KBPS 1536 /* the maximum permitted baud rate (kbps) */
|
||||
#define BAUD_RATE_FT1_AUTO_CONFIG 0xFFFF /* the baud rate used to trigger an automatic FT1 configuration */
|
||||
|
||||
/* settings for the 'clock_mode' */
|
||||
#define CLOCK_MODE_NORMAL 0x00 /* clock mode set to normal (slave) */
|
||||
#define CLOCK_MODE_MASTER 0x01 /* clock mode set to master */
|
||||
|
||||
|
||||
#define BAUD_RATE_FT1_AUTO_CONFIG 0xFFFF
|
||||
#define AUTO_FT1_CONFIG_NOT_COMPLETE 0x08
|
||||
#define AUTO_FT1_CFG_FAIL_OP_MODE 0x0C
|
||||
#define AUTO_FT1_CFG_FAIL_INVALID_LINE 0x0D
|
||||
|
||||
#undef wan_udphdr_data
|
||||
#define wan_udphdr_data wan_udphdr_u.chdlc.data
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#undef wan_udp_data
|
||||
#define wan_udp_data wan_udp_hdr.wan_udphdr_u.chdlc.data
|
||||
#endif
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif /* _SDLA_CHDLC_H */
|
|
@ -1,570 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* sdla_fr.h Sangoma frame relay firmware API definitions.
|
||||
*
|
||||
* Author: Gideon Hack
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
* Oct 04, 1999 Gideon Hack Updated API structures
|
||||
* Jun 02, 1999 Gideon Hack Modifications for S514 support
|
||||
* Oct 12, 1997 Jaspreet Singh Added FR_READ_DLCI_IB_MAPPING
|
||||
* Jul 21, 1997 Jaspreet Singh Changed FRRES_TOO_LONG and FRRES_TOO_MANY to
|
||||
* 0x05 and 0x06 respectively.
|
||||
* Dec 23, 1996 Gene Kozin v2.0
|
||||
* Apr 29, 1996 Gene Kozin v1.0 (merged version S502 & S508 definitions).
|
||||
* Sep 26, 1995 Gene Kozin Initial version.
|
||||
*****************************************************************************/
|
||||
#ifndef _SDLA_FR_H
|
||||
#define _SDLA_FR_H
|
||||
|
||||
#include <linux/wanpipe_fr_iface.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Notes:
|
||||
* ------
|
||||
* 1. All structures defined in this file are byte-alined.
|
||||
*
|
||||
* Compiler Platform
|
||||
* -------- --------
|
||||
* GNU C Linux
|
||||
*/
|
||||
#pragma pack(1)
|
||||
|
||||
/* Adapter memory layout */
|
||||
#define FR_MB_VECTOR 0xE000 /* mailbox window vector */
|
||||
#define FR502_RX_VECTOR 0xA000 /* S502 direct receive window vector */
|
||||
#define FR502_MBOX_OFFS 0xF60 /* S502 mailbox offset */
|
||||
#define FR508_MBOX_OFFS 0 /* S508 mailbox offset */
|
||||
#define FR502_FLAG_OFFS 0x1FF0 /* S502 status flags offset */
|
||||
#define FR508_FLAG_OFFS 0x1000 /* S508 status flags offset */
|
||||
#define FR502_RXMB_OFFS 0x900 /* S502 direct receive mailbox offset */
|
||||
#define FR508_TXBC_OFFS 0x1100 /* S508 Tx buffer info offset */
|
||||
#define FR508_RXBC_OFFS 0x1120 /* S508 Rx buffer info offset */
|
||||
|
||||
/* Important constants */
|
||||
#define FR502_MAX_DATA 4096 /* maximum data buffer length */
|
||||
#define FR508_MAX_DATA 4080 /* maximum data buffer length */
|
||||
#define MIN_LGTH_FR_DATA_CFG 300 /* min Information frame length
|
||||
(for configuration purposes) */
|
||||
#define FR_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* max Information frame length */
|
||||
|
||||
#define HIGHEST_VALID_DLCI 991
|
||||
|
||||
/****** Data Structures *****************************************************/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Frame relay command block.
|
||||
*/
|
||||
typedef struct fr_cmd
|
||||
{
|
||||
unsigned char command PACKED; /* command code */
|
||||
unsigned short length PACKED; /* length of data buffer */
|
||||
unsigned char result PACKED; /* return code */
|
||||
unsigned short dlci PACKED; /* DLCI number */
|
||||
unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
|
||||
unsigned short rxlost1 PACKED; /* frames discarded at int. level */
|
||||
unsigned int rxlost2 PACKED; /* frames discarded at app. level */
|
||||
unsigned char rsrv[2] PACKED; /* reserved for future use */
|
||||
} fr_cmd_t;
|
||||
|
||||
|
||||
/* Special UDP drivers management commands */
|
||||
#define FPIPE_ENABLE_TRACING 0x41
|
||||
#define FPIPE_DISABLE_TRACING 0x42
|
||||
#define FPIPE_GET_TRACE_INFO 0x43
|
||||
#define FPIPE_FT1_READ_STATUS 0x44
|
||||
#define FPIPE_DRIVER_STAT_IFSEND 0x45
|
||||
#define FPIPE_DRIVER_STAT_INTR 0x46
|
||||
#define FPIPE_DRIVER_STAT_GEN 0x47
|
||||
#define FPIPE_FLUSH_DRIVER_STATS 0x48
|
||||
#define FPIPE_ROUTER_UP_TIME 0x49
|
||||
#define FPIPE_TE1_56K_STAT 0x50 /* TE1_56K */
|
||||
#define FPIPE_GET_MEDIA_TYPE 0x51 /* TE1_56K */
|
||||
#define FPIPE_FLUSH_TE1_PMON 0x52 /* TE1 */
|
||||
#define FPIPE_READ_REGISTER 0x53 /* TE1_56K */
|
||||
#define FPIPE_TE1_CFG 0x54 /* TE1 */
|
||||
|
||||
/* 'result' field defines */
|
||||
#define FRRES_OK 0x00 /* command executed successfully */
|
||||
#define FRRES_DISABLED 0x01 /* communications not enabled */
|
||||
#define FRRES_INOPERATIVE 0x02 /* channel inoperative */
|
||||
#define FRRES_DLCI_INACTIVE 0x03 /* DLCI is inactive */
|
||||
#define FRRES_DLCI_INVALID 0x04 /* DLCI is not configured */
|
||||
#define FRRES_TOO_LONG 0x05
|
||||
#define FRRES_TOO_MANY 0x06
|
||||
#define FRRES_CIR_OVERFLOW 0x07 /* Tx throughput has exceeded CIR */
|
||||
#define FRRES_BUFFER_OVERFLOW 0x08
|
||||
#define FRRES_MODEM_FAILURE 0x10 /* DCD and/or CTS dropped */
|
||||
#define FRRES_CHANNEL_DOWN 0x11 /* channel became inoperative */
|
||||
#define FRRES_CHANNEL_UP 0x12 /* channel became operative */
|
||||
#define FRRES_DLCI_CHANGE 0x13 /* DLCI status (or number) changed */
|
||||
#define FRRES_DLCI_MISMATCH 0x14
|
||||
#define FRRES_INVALID_CMD 0x1F /* invalid command */
|
||||
|
||||
/* 'attr' field defines */
|
||||
#define FRATTR_
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S502 frame relay status flags.
|
||||
* This structure is located at offset FR502_FLAG_OFFS into FR_MB_VECTOR.
|
||||
*/
|
||||
typedef struct fr502_flags
|
||||
{
|
||||
unsigned char rsrv1[1] PACKED; /* 00h: */
|
||||
unsigned char tx_ready PACKED; /* 01h: Tx buffer available */
|
||||
unsigned char rx_ready PACKED; /* 02h: Rx frame available */
|
||||
unsigned char event PACKED; /* 03h: asynchronous event */
|
||||
unsigned char mstatus PACKED; /* 04h: modem status */
|
||||
unsigned char rsrv2[8] PACKED; /* 05h: */
|
||||
unsigned char iflag PACKED; /* 0Dh: interrupt flag */
|
||||
unsigned char imask PACKED; /* 0Eh: interrupt mask */
|
||||
} fr502_flags_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S508 frame relay status flags.
|
||||
* This structure is located at offset FR508_FLAG_OFFS into FR_MB_VECTOR.
|
||||
*/
|
||||
typedef struct fr508_flags
|
||||
{
|
||||
unsigned char rsrv1[3] PACKED; /* 00h: reserved */
|
||||
unsigned char event PACKED; /* 03h: asynchronous event */
|
||||
unsigned char mstatus PACKED; /* 04h: modem status */
|
||||
unsigned char rsrv2[11] PACKED; /* 05h: reserved */
|
||||
unsigned char iflag PACKED; /* 10h: interrupt flag */
|
||||
unsigned char imask PACKED; /* 11h: interrupt mask */
|
||||
unsigned int tse_offs PACKED; /* 12h: Tx status element */
|
||||
unsigned short dlci PACKED; /* 16h: DLCI NUMBER */
|
||||
} fr508_flags_t;
|
||||
|
||||
/* 'event' field defines */
|
||||
#define FR_EVENT_STATUS 0x01 /* channel status change */
|
||||
#define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */
|
||||
#define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */
|
||||
#define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low */
|
||||
|
||||
/* 'mstatus' field defines */
|
||||
#define FR_MDM_DCD 0x08 /* mdm_status: DCD */
|
||||
#define FR_MDM_CTS 0x20 /* mdm_status: CTS */
|
||||
|
||||
/* 'iflag' & 'imask' fields defines */
|
||||
#define FR_INTR_RXRDY 0x01 /* Rx ready */
|
||||
#define FR_INTR_TXRDY 0x02 /* Tx ready */
|
||||
#define FR_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */
|
||||
#define FR_INTR_READY 0x08 /* interface command completed */
|
||||
#define FR_INTR_DLC 0x10 /* DLC status change */
|
||||
#define FR_INTR_TIMER 0x20 /* millisecond timer */
|
||||
#define FR_INTR_TX_MULT_DLCIs 0x80 /* Tx interrupt on multiple DLCIs */
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Receive Buffer Configuration Info. S508 only!
|
||||
* This structure is located at offset FR508_RXBC_OFFS into FR_MB_VECTOR.
|
||||
*/
|
||||
typedef struct fr_buf_info
|
||||
{
|
||||
unsigned short rse_num PACKED; /* 00h: number of status elements */
|
||||
unsigned int rse_base PACKED; /* 02h: receive status array base */
|
||||
unsigned int rse_next PACKED; /* 06h: next status element */
|
||||
unsigned int buf_base PACKED; /* 0Ah: rotational buffer base */
|
||||
unsigned short reserved PACKED; /* 0Eh: */
|
||||
unsigned int buf_top PACKED; /* 10h: rotational buffer top */
|
||||
} fr_buf_info_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Buffer Status Element. S508 only!
|
||||
* Array of structures of this type is located at offset defined by the
|
||||
* 'rse_base' field of the frBufInfo_t structure into absolute adapter
|
||||
* memory address space.
|
||||
*/
|
||||
typedef struct fr_rx_buf_ctl
|
||||
{
|
||||
unsigned char flag PACKED; /* 00h: ready flag */
|
||||
unsigned short length PACKED; /* 01h: frame length */
|
||||
unsigned short dlci PACKED; /* 03h: DLCI */
|
||||
unsigned char attr PACKED; /* 05h: FECN/BECN/DE/CR */
|
||||
unsigned short tmstamp PACKED; /* 06h: time stamp */
|
||||
unsigned short rsrv[2] PACKED; /* 08h: */
|
||||
unsigned int offset PACKED; /* 0Ch: buffer absolute address */
|
||||
} fr_rx_buf_ctl_t;
|
||||
|
||||
typedef struct fr_tx_buf_ctl
|
||||
{
|
||||
unsigned char flag PACKED; /* 00h: ready flag */
|
||||
unsigned short rsrv0[2] PACKED; /* 01h: */
|
||||
unsigned short length PACKED; /* 05h: frame length */
|
||||
unsigned short dlci PACKED; /* 07h: DLCI */
|
||||
unsigned char attr PACKED; /* 09h: FECN/BECN/DE/CR */
|
||||
unsigned short rsrv1 PACKED; /* 0Ah: */
|
||||
unsigned int offset PACKED; /* 0Ch: buffer absolute address */
|
||||
} fr_tx_buf_ctl_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0.
|
||||
*/
|
||||
typedef struct fr_conf
|
||||
{
|
||||
unsigned short station PACKED; /* 00h: CPE/Node */
|
||||
unsigned short options PACKED; /* 02h: configuration options */
|
||||
unsigned short kbps PACKED; /* 04h: baud rate in kbps */
|
||||
unsigned short port PACKED; /* 06h: RS-232/V.35 */
|
||||
unsigned short mtu PACKED; /* 08h: max. transmit length */
|
||||
unsigned short t391 PACKED; /* 0Ah: */
|
||||
unsigned short t392 PACKED; /* 0Ch: */
|
||||
unsigned short n391 PACKED; /* 0Eh: */
|
||||
unsigned short n392 PACKED; /* 10h: */
|
||||
unsigned short n393 PACKED; /* 12h: */
|
||||
unsigned short cir_fwd PACKED; /* 14h: */
|
||||
unsigned short bc_fwd PACKED; /* 16h: */
|
||||
unsigned short be_fwd PACKED; /* 18h: */
|
||||
unsigned short cir_bwd PACKED; /* 1Ah: */
|
||||
unsigned short bc_bwd PACKED; /* 1Ch: */
|
||||
unsigned short be_bwd PACKED; /* 1Eh: */
|
||||
unsigned short dlci[0] PACKED; /* 20h: */
|
||||
} fr_conf_t;
|
||||
|
||||
/* 'station_type' defines */
|
||||
#define FRCFG_STATION_CPE 0
|
||||
#define FRCFG_STATION_NODE 1
|
||||
|
||||
/* 'conf_flags' defines */
|
||||
#define FRCFG_IGNORE_TX_CIR 0x0001
|
||||
#define FRCFG_IGNORE_RX_CIR 0x0002
|
||||
#define FRCFG_DONT_RETRANSMIT 0x0004
|
||||
#define FRCFG_IGNORE_CBS 0x0008
|
||||
#define FRCFG_THROUGHPUT 0x0010 /* enable throughput calculation */
|
||||
#define FRCFG_DIRECT_RX 0x0080 /* enable direct receive buffer */
|
||||
#define FRCFG_AUTO_CONFIG 0x8000 /* enable auto DLCI configuration */
|
||||
|
||||
/* 'baud_rate' defines */
|
||||
#define FRCFG_BAUD_1200 12
|
||||
#define FRCFG_BAUD_2400 24
|
||||
#define FRCFG_BAUD_4800 48
|
||||
#define FRCFG_BAUD_9600 96
|
||||
#define FRCFG_BAUD_19200 19
|
||||
#define FRCFG_BAUD_38400 38
|
||||
#define FRCFG_BAUD_56000 56
|
||||
#define FRCFG_BAUD_64000 64
|
||||
#define FRCFG_BAUD_128000 128
|
||||
|
||||
/* 'port_mode' defines */
|
||||
#define FRCFG_MODE_EXT_CLK 0x0000
|
||||
#define FRCFG_MODE_INT_CLK 0x0001
|
||||
#define FRCFG_MODE_V35 0x0000 /* S508 only */
|
||||
#define FRCFG_MODE_RS232 0x0002 /* S508 only */
|
||||
|
||||
/* defines for line tracing */
|
||||
|
||||
/* the line trace status element presented by the frame relay code */
|
||||
typedef struct {
|
||||
unsigned char flag PACKED; /* ready flag */
|
||||
unsigned short length PACKED; /* trace length */
|
||||
unsigned char rsrv0[2] PACKED; /* reserved */
|
||||
unsigned char attr PACKED; /* trace attributes */
|
||||
unsigned short tmstamp PACKED; /* time stamp */
|
||||
unsigned char rsrv1[4] PACKED; /* reserved */
|
||||
unsigned int offset PACKED; /* buffer absolute address */
|
||||
} fr_trc_el_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char status PACKED; /* status flag */
|
||||
unsigned char data_passed PACKED; /* 0 if no data passed, 1 if */
|
||||
/* data passed */
|
||||
unsigned short length PACKED; /* frame length */
|
||||
unsigned short tmstamp PACKED; /* time stamp */
|
||||
} fpipemon_trc_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
fpipemon_trc_hdr_t fpipemon_trc_hdr PACKED;
|
||||
unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] PACKED;
|
||||
} fpipemon_trc_t;
|
||||
|
||||
/* bit settings for the 'status' byte - note that bits 1, 2 and 3 are used */
|
||||
/* for returning the number of frames being passed to fpipemon */
|
||||
#define TRC_INCOMING_FRM 0x00
|
||||
#define TRC_OUTGOING_FRM 0x01
|
||||
#define TRC_ABORT_ERROR 0x10
|
||||
#define TRC_CRC_ERROR 0x20
|
||||
#define TRC_OVERRUN_ERROR 0x40
|
||||
#define MORE_TRC_DATA 0x80
|
||||
|
||||
#define MAX_FRMS_TRACED 0x07
|
||||
|
||||
#define NO_TRC_ELEMENTS_OFF 0x9000
|
||||
#define BASE_TRC_ELEMENTS_OFF 0x9002
|
||||
#define TRC_ACTIVE 0x01
|
||||
#define FLUSH_TRC_BUFFERS 0x02
|
||||
#define FLUSH_TRC_STATISTICS 0x04
|
||||
#define TRC_SIGNALLING_FRMS 0x10
|
||||
#define TRC_INFO_FRMS 0x20
|
||||
#define ACTIVATE_TRC (TRC_ACTIVE | TRC_SIGNALLING_FRMS | TRC_INFO_FRMS)
|
||||
#define RESET_TRC (FLUSH_TRC_BUFFERS | FLUSH_TRC_STATISTICS)
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Channel configuration.
|
||||
* This structure is passed to the FR_SET_CONFIG command when dlci != 0.
|
||||
*/
|
||||
typedef struct fr_dlc_conf
|
||||
{
|
||||
unsigned short conf_flags PACKED; /* 00h: configuration bits */
|
||||
unsigned short cir_fwd PACKED; /* 02h: */
|
||||
unsigned short bc_fwd PACKED; /* 04h: */
|
||||
unsigned short be_fwd PACKED; /* 06h: */
|
||||
unsigned short cir_bwd PACKED; /* 08h: */
|
||||
unsigned short bc_bwd PACKED; /* 0Ah: */
|
||||
unsigned short be_bwd PACKED; /* 0Ch: */
|
||||
} fr_dlc_conf_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S502 interrupt mode control block.
|
||||
* This structure is passed to the FR_SET_INTR_FLAGS and returned by the
|
||||
* FR_READ_INTR_FLAGS commands.
|
||||
*/
|
||||
typedef struct fr502_intr_ctl
|
||||
{
|
||||
unsigned char mode PACKED; /* 00h: interrupt enable flags */
|
||||
unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
|
||||
} fr502_intr_ctl_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S508 interrupt mode control block.
|
||||
* This structure is passed to the FR_SET_INTR_FLAGS and returned by the
|
||||
* FR_READ_INTR_FLAGS commands.
|
||||
*/
|
||||
typedef struct fr508_intr_ctl
|
||||
{
|
||||
unsigned char mode PACKED; /* 00h: interrupt enable flags */
|
||||
unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
|
||||
unsigned char irq PACKED; /* 03h: IRQ level to activate */
|
||||
unsigned char flags PACKED; /* 04h: ?? */
|
||||
unsigned short timeout PACKED; /* 05h: ms, for timer interrupt */
|
||||
} fr508_intr_ctl_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Channel status.
|
||||
* This structure is returned by the FR_READ_STATUS command.
|
||||
*/
|
||||
typedef struct fr_dlc_Status
|
||||
{
|
||||
unsigned char status PACKED; /* 00h: link/DLCI status */
|
||||
struct
|
||||
{
|
||||
unsigned short dlci PACKED; /* 01h: DLCI number */
|
||||
unsigned char status PACKED; /* 03h: DLCI status */
|
||||
} circuit[1] PACKED;
|
||||
} fr_dlc_status_t;
|
||||
|
||||
/* 'status' defines */
|
||||
#define FR_LINK_INOPER 0x00 /* for global status (DLCI == 0) */
|
||||
#define FR_LINK_OPER 0x01
|
||||
|
||||
#define FR_DLCI_INOPER 0x00
|
||||
#define FR_DLCI_DELETED 0x01 /* for circuit status (DLCI != 0) */
|
||||
#define FR_DLCI_ACTIVE 0x02
|
||||
#define FR_DLCI_WAITING 0x04
|
||||
#define FR_DLCI_NEW 0x08
|
||||
#define FR_DLCI_REPORT 0x40
|
||||
|
||||
#if 0
|
||||
/*----------------------------------------------------------------------------
|
||||
* Global Statistics Block.
|
||||
* This structure is returned by the FR_READ_STATISTICS command when
|
||||
* dcli == 0.
|
||||
*/
|
||||
typedef struct fr_link_stat
|
||||
{
|
||||
unsigned short rx_too_long PACKED; /* 00h: */
|
||||
unsigned short rx_dropped PACKED; /* 02h: */
|
||||
unsigned short rx_dropped2 PACKED; /* 04h: */
|
||||
unsigned short rx_bad_dlci PACKED; /* 06h: */
|
||||
unsigned short rx_bad_format PACKED; /* 08h: */
|
||||
unsigned short retransmitted PACKED; /* 0Ah: */
|
||||
unsigned short cpe_tx_FSE PACKED; /* 0Ch: */
|
||||
unsigned short cpe_tx_LIV PACKED; /* 0Eh: */
|
||||
unsigned short cpe_rx_FSR PACKED; /* 10h: */
|
||||
unsigned short cpe_rx_LIV PACKED; /* 12h: */
|
||||
unsigned short node_rx_FSE PACKED; /* 14h: */
|
||||
unsigned short node_rx_LIV PACKED; /* 16h: */
|
||||
unsigned short node_tx_FSR PACKED; /* 18h: */
|
||||
unsigned short node_tx_LIV PACKED; /* 1Ah: */
|
||||
unsigned short rx_ISF_err PACKED; /* 1Ch: */
|
||||
unsigned short rx_unsolicited PACKED; /* 1Eh: */
|
||||
unsigned short rx_SSN_err PACKED; /* 20h: */
|
||||
unsigned short rx_RSN_err PACKED; /* 22h: */
|
||||
unsigned short T391_timeouts PACKED; /* 24h: */
|
||||
unsigned short T392_timeouts PACKED; /* 26h: */
|
||||
unsigned short N392_reached PACKED; /* 28h: */
|
||||
unsigned short cpe_SSN_RSN PACKED; /* 2Ah: */
|
||||
unsigned short current_SSN PACKED; /* 2Ch: */
|
||||
unsigned short current_RSN PACKED; /* 2Eh: */
|
||||
unsigned short curreny_T391 PACKED; /* 30h: */
|
||||
unsigned short current_T392 PACKED; /* 32h: */
|
||||
unsigned short current_N392 PACKED; /* 34h: */
|
||||
unsigned short current_N393 PACKED; /* 36h: */
|
||||
} fr_link_stat_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* DLCI statistics.
|
||||
* This structure is returned by the FR_READ_STATISTICS command when
|
||||
* dlci != 0.
|
||||
*/
|
||||
typedef struct fr_dlci_stat
|
||||
{
|
||||
unsigned int tx_frames PACKED; /* 00h: */
|
||||
unsigned int tx_bytes PACKED; /* 04h: */
|
||||
unsigned int rx_frames PACKED; /* 08h: */
|
||||
unsigned int rx_bytes PACKED; /* 0Ch: */
|
||||
unsigned int rx_dropped PACKED; /* 10h: */
|
||||
unsigned int rx_inactive PACKED; /* 14h: */
|
||||
unsigned int rx_exceed_CIR PACKED; /* 18h: */
|
||||
unsigned int rx_DE_set PACKED; /* 1Ch: */
|
||||
unsigned int tx_throughput PACKED; /* 20h: */
|
||||
unsigned int tx_calc_timer PACKED; /* 24h: */
|
||||
unsigned int rx_throughput PACKED; /* 28h: */
|
||||
unsigned int rx_calc_timer PACKED; /* 2Ch: */
|
||||
} fr_dlci_stat_t;
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Communications error statistics.
|
||||
* This structure is returned by the FR_READ_ERROR_STATS command.
|
||||
*/
|
||||
typedef struct fr_comm_stat
|
||||
{
|
||||
unsigned char rx_overruns PACKED; /* 00h: */
|
||||
unsigned char rx_bad_crc PACKED; /* 01h: */
|
||||
unsigned char rx_aborts PACKED; /* 02h: */
|
||||
unsigned char rx_too_long PACKED; /* 03h: */
|
||||
unsigned char tx_aborts PACKED; /* 04h: */
|
||||
unsigned char tx_underruns PACKED; /* 05h: */
|
||||
unsigned char tx_missed_undr PACKED; /* 06h: */
|
||||
unsigned char dcd_dropped PACKED; /* 07h: */
|
||||
unsigned char cts_dropped PACKED; /* 08h: */
|
||||
} fr_comm_stat_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Defines for the FR_ISSUE_IS_FRAME command.
|
||||
*/
|
||||
#define FR_ISF_LVE 2 /* issue Link Verification Enquiry */
|
||||
#define FR_ISF_FSE 3 /* issue Full Status Enquiry */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Frame Relay ARP Header -- Used for Dynamic route creation with InvARP
|
||||
*/
|
||||
|
||||
typedef struct arphdr_fr
|
||||
{
|
||||
unsigned short ar_hrd PACKED; /* format of hardware addr */
|
||||
unsigned short ar_pro PACKED; /* format of protocol addr */
|
||||
unsigned char ar_hln PACKED; /* length of hardware addr */
|
||||
unsigned char ar_pln PACKED; /* length of protocol addr */
|
||||
unsigned short ar_op PACKED; /* ARP opcode */
|
||||
unsigned short ar_sha PACKED; /* Sender DLCI addr 2 bytes */
|
||||
unsigned int ar_sip PACKED; /* Sender IP addr 4 bytes */
|
||||
unsigned short ar_tha PACKED; /* Target DLCI addr 2 bytes */
|
||||
unsigned int ar_tip PACKED; /* Target IP addr 4 bytes */
|
||||
} arphdr_fr_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Frame Relay RFC 1490 SNAP Header -- Used to check for ARP packets
|
||||
*/
|
||||
typedef struct arphdr_1490
|
||||
{
|
||||
unsigned char control PACKED; /* UI, etc... */
|
||||
unsigned char pad PACKED; /* Pad */
|
||||
unsigned char NLPID PACKED; /* SNAP */
|
||||
unsigned char OUI[3] PACKED; /* Ethertype, etc... */
|
||||
unsigned short PID PACKED; /* ARP, IP, etc... */
|
||||
} arphdr_1490_t;
|
||||
|
||||
/* valid ip_protocol for UDP management */
|
||||
#define UDPMGMT_UDP_PROTOCOL 0x11
|
||||
|
||||
#define UDPMGMT_FPIPE_SIGNATURE "FPIPE8ND"
|
||||
#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS"
|
||||
|
||||
/* values for request/reply byte */
|
||||
#define UDPMGMT_REQUEST 0x01
|
||||
#define UDPMGMT_REPLY 0x02
|
||||
#define UDP_OFFSET 12
|
||||
|
||||
typedef struct {
|
||||
unsigned int if_send_entry;
|
||||
unsigned int if_send_skb_null;
|
||||
unsigned int if_send_broadcast;
|
||||
unsigned int if_send_multicast;
|
||||
unsigned int if_send_critical_ISR;
|
||||
unsigned int if_send_critical_non_ISR;
|
||||
unsigned int if_send_busy;
|
||||
unsigned int if_send_busy_timeout;
|
||||
unsigned int if_send_DRVSTATS_request;
|
||||
unsigned int if_send_FPIPE_request;
|
||||
unsigned int if_send_wan_disconnected;
|
||||
unsigned int if_send_dlci_disconnected;
|
||||
unsigned int if_send_no_bfrs;
|
||||
unsigned int if_send_adptr_bfrs_full;
|
||||
unsigned int if_send_bfrs_passed_to_adptr;
|
||||
unsigned int if_send_consec_send_fail;
|
||||
} drvstats_if_send_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int rx_intr_no_socket;
|
||||
unsigned int rx_intr_dev_not_started;
|
||||
unsigned int rx_intr_DRVSTATS_request;
|
||||
unsigned int rx_intr_FPIPE_request;
|
||||
unsigned int rx_intr_bfr_not_passed_to_stack;
|
||||
unsigned int rx_intr_bfr_passed_to_stack;
|
||||
} drvstats_rx_intr_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int UDP_FPIPE_mgmt_kmalloc_err;
|
||||
unsigned int UDP_FPIPE_mgmt_direction_err;
|
||||
unsigned int UDP_FPIPE_mgmt_adptr_type_err;
|
||||
unsigned int UDP_FPIPE_mgmt_adptr_cmnd_OK;
|
||||
unsigned int UDP_FPIPE_mgmt_adptr_cmnd_timeout;
|
||||
unsigned int UDP_FPIPE_mgmt_adptr_send_passed;
|
||||
unsigned int UDP_FPIPE_mgmt_adptr_send_failed;
|
||||
unsigned int UDP_FPIPE_mgmt_not_passed_to_stack;
|
||||
unsigned int UDP_FPIPE_mgmt_passed_to_stack;
|
||||
unsigned int UDP_FPIPE_mgmt_no_socket;
|
||||
unsigned int UDP_DRVSTATS_mgmt_kmalloc_err;
|
||||
unsigned int UDP_DRVSTATS_mgmt_adptr_cmnd_OK;
|
||||
unsigned int UDP_DRVSTATS_mgmt_adptr_cmnd_timeout;
|
||||
unsigned int UDP_DRVSTATS_mgmt_adptr_send_passed;
|
||||
unsigned int UDP_DRVSTATS_mgmt_adptr_send_failed;
|
||||
unsigned int UDP_DRVSTATS_mgmt_not_passed_to_stack;
|
||||
unsigned int UDP_DRVSTATS_mgmt_passed_to_stack;
|
||||
unsigned int UDP_DRVSTATS_mgmt_no_socket;
|
||||
} drvstats_gen_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char attr PACKED;
|
||||
unsigned short time_stamp PACKED;
|
||||
unsigned char reserved[13] PACKED;
|
||||
} api_rx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_rx_hdr_t api_rx_hdr PACKED;
|
||||
void * data PACKED;
|
||||
} api_rx_element_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char attr PACKED;
|
||||
unsigned char reserved[15] PACKED;
|
||||
} api_tx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_tx_hdr_t api_tx_hdr PACKED;
|
||||
void * data PACKED;
|
||||
} api_tx_element_t;
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif /* _SDLA_FR_H */
|
||||
|
|
@ -25,12 +25,14 @@
|
|||
#define WAN_MEDIA_FXOFXS 0x08
|
||||
|
||||
/*The line code */
|
||||
#define WAN_LCODE_NONE 0x00
|
||||
#define WAN_LCODE_AMI 0x01 /* T1/E1/DS3/E3 */
|
||||
#define WAN_LCODE_B8ZS 0x02 /* T1 */
|
||||
#define WAN_LCODE_HDB3 0x03 /* E1/E3 */
|
||||
#define WAN_LCODE_B3ZS 0x04 /* DS3 */
|
||||
|
||||
/* Framing modes */
|
||||
#define WAN_FR_NONE 0x00
|
||||
#define WAN_FR_ESF 0x01
|
||||
#define WAN_FR_D4 0x02
|
||||
#define WAN_FR_ESF_JAPAN 0x03
|
||||
|
@ -185,6 +187,7 @@ typedef struct {
|
|||
unsigned int line_no;
|
||||
unsigned char tx_tristate_mode;
|
||||
unsigned int tdmv_law;
|
||||
unsigned char poll_mode; /* enable fe poll driven arch */
|
||||
union {
|
||||
sdla_te_cfg_t te_cfg;
|
||||
sdla_te3_cfg_t te3_cfg;
|
||||
|
@ -521,7 +524,7 @@ typedef struct {
|
|||
/* Transmit DTMF number */
|
||||
int (*set_dtmf)(sdla_fe_t*, int, unsigned char);
|
||||
/* Enable/Disable FE interrupt */
|
||||
int (*intr_ctrl)(sdla_fe_t*, int, int, int, unsigned int);
|
||||
int (*intr_ctrl)(sdla_fe_t*, int, u_int8_t, u_int8_t, unsigned int);
|
||||
/* Event Control */
|
||||
int (*event_ctrl)(sdla_fe_t*, wan_event_ctrl_t*);
|
||||
/* Front-End watchdog */
|
||||
|
|
|
@ -1,761 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* sdla_hdlc.h HDLC API header file.
|
||||
*
|
||||
* Author: Jaspreet Singh <jaspreet@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 1998-1997 Sangoma Technologies Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
* Oct 14, 1998 Jaspreet Singh o Initial Version.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _SDLA_HDLC___
|
||||
#define _SDLA_HDLC___
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
|
||||
/* Status flag for determining whether to perform a check on socket receive * queue.
|
||||
*/
|
||||
#define NO_SK_RX_CHECK 0x00
|
||||
#define TOP_CHECK_SK_RX_Q 0x01
|
||||
#define BTM_CHECK_SK_RX_Q 0x02
|
||||
|
||||
|
||||
#define NO_READ_CMD 0x00
|
||||
#define READ_CMD 0x01
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants defining the shared memory control block (mailbox)
|
||||
*/
|
||||
|
||||
/* the base address of the HDLC mailbox structure on the adapter */
|
||||
#define HDLC_MB_STRUCT_OFFSET 0x0000
|
||||
/* the number of reserved bytes in the mailbox header area */
|
||||
#define NUMBER_HDLC_MB_RES_BYTES 0x0A
|
||||
/* the size of the actual mailbox data area */
|
||||
#define SIZEOF_HDLC_MB_DATA_BFR 1008
|
||||
#define MAX_NO_DATA_BYTES_IN_I_FRAME 4099 /* maximum length of the HDLC I-field */
|
||||
|
||||
/* Just the header, excluding the data area */
|
||||
#define MAILBOX_SIZE 30
|
||||
/*
|
||||
* the control block mailbox structure for API purposes.
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
unsigned char opp_flag PACKED; /* the opp flag */
|
||||
unsigned char command PACKED; /* the command code */
|
||||
unsigned short buffer_length PACKED; /* the data length */
|
||||
unsigned char return_code PACKED; /* the return code */
|
||||
unsigned char PF_bit PACKED; /* the HDLC P/F bit */
|
||||
char MB_reserved[NUMBER_HDLC_MB_RES_BYTES] PACKED; /* for later use */
|
||||
char data[MAX_NO_DATA_BYTES_IN_I_FRAME] PACKED; /* the data area */
|
||||
|
||||
} HDLC_MAILBOX_STRUCT;
|
||||
|
||||
|
||||
/* The following structure definition is for driver use ONLY */
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned char opp_flag PACKED; /* the opp flag */
|
||||
unsigned char command PACKED; /* the command code */
|
||||
unsigned short buffer_length PACKED; /* the data length */
|
||||
unsigned char return_code PACKED; /* the return code */
|
||||
unsigned char PF_bit PACKED; /* the HDLC P/F bit */
|
||||
char MB_reserved[NUMBER_HDLC_MB_RES_BYTES] PACKED; /* for later use */
|
||||
char data[SIZEOF_HDLC_MB_DATA_BFR] PACKED; /* the data area */
|
||||
|
||||
} TRUE_HDLC_MAILBOX_STRUCT;
|
||||
|
||||
|
||||
typedef struct {
|
||||
pid_t pid_num PACKED;
|
||||
HDLC_MAILBOX_STRUCT cmdarea PACKED;
|
||||
|
||||
} CMDBLOCK_STRUCT;
|
||||
|
||||
/*
|
||||
* Interface commands
|
||||
*/
|
||||
|
||||
/*
|
||||
* global interface commands
|
||||
*/
|
||||
|
||||
#define READ_GLOBAL_EXCEPTION_CONDITION 0x01 /* read a global exception condition from the adapter */
|
||||
#define SET_GLOBAL_CONFIGURATION 0x02 /* set the global operational configuration */
|
||||
#define READ_GLOBAL_CONFIGURATION 0x03 /* read the global configuration */
|
||||
#define READ_GLOBAL_STATISTICS 0x04 /* retrieve the global statistics */
|
||||
#define FLUSH_GLOBAL_STATISTICS 0x05 /* flush the global statistics */
|
||||
#define SET_MODEM_STATUS 0x06 /* set the status of DTR and/or RTS */
|
||||
#define READ_MODEM_STATUS 0x07 /* read the current status of CTS and DCD */
|
||||
#define READ_COMMS_ERROR_STATS 0x08 /* read the communication error statistics */
|
||||
#define FLUSH_COMMS_ERROR_STATS 0x09 /* flush the communication error statistics */
|
||||
#define SET_TRACE_CONFIGURATION 0x0A /* set the line trace configuration */
|
||||
#define READ_TRACE_CONFIGURATION 0x0B /* read the line trace configuration */
|
||||
#define READ_TRACE_STATISTICS 0x0C /* read the trace statistics */
|
||||
#define FLUSH_TRACE_STATISTICS 0x0D /* flush the trace statistics */
|
||||
#define FT1_MONITOR_STATUS_CTRL 0x1E /* set the status of the S508/FT1 monitoring */
|
||||
#define SET_FT1_MODE 0x1F /* set the operational mode of the S508/FT1 module */
|
||||
|
||||
/*
|
||||
* HDLC-level interface commands
|
||||
*/
|
||||
|
||||
#define READ_HDLC_CODE_VERSION 0x20 /* read the HDLC code version */
|
||||
#define READ_HDLC_EXCEPTION_CONDITION 0x21 /* read an HDLC exception condition from the adapter */
|
||||
#define SET_HDLC_CONFIGURATION 0x22 /* set the HDLC operational configuration */
|
||||
#define READ_HDLC_CONFIGURATION 0x23 /* read the current HDLC operational configuration */
|
||||
#define ENABLE_HDLC_COMMUNICATIONS 0x24 /* enable HDLC communications */
|
||||
#define DISABLE_HDLC_COMMUNICATIONS 0x25 /* disable HDLC communications */
|
||||
#define HDLC_CONNECT 0x26 /* enter the HDLC ABM state */
|
||||
#define HDLC_DISCONNECT 0x27 /* enter the HDLC disconnected state */
|
||||
#define READ_HDLC_LINK_STATUS 0x28 /* read the HDLC link status */
|
||||
#define READ_HDLC_OPERATIONAL_STATS 0x29 /* retrieve the HDLC operational statistics */
|
||||
#define FLUSH_HDLC_OPERATIONAL_STATS 0x2A /* flush the HDLC operational statistics */
|
||||
#define SET_HDLC_BUSY_CONDITION 0x2B /* force the HDLC code into a busy condition */
|
||||
#define SEND_UI_FRAME 0x2C /* transmit an Unnumbered Information frame */
|
||||
#define SET_HDLC_INTERRUPT_TRIGGERS 0x30 /* set the HDLC application interrupt triggers */
|
||||
#define READ_HDLC_INTERRUPT_TRIGGERS 0x31 /* read the HDLC application interrupt trigger configuration */
|
||||
|
||||
|
||||
#define HDLC_SEND_NO_WAIT 0xE0 /* send I frames : Poll */
|
||||
#define HDLC_SEND_WAIT 0xE1 /* send I frames : Interrupt*/
|
||||
#define HDLC_READ_NO_WAIT 0xE2 /* receive I frames : Poll */
|
||||
#define HDLC_READ_WAIT 0xE3 /* receive I frames : Interrupt*/
|
||||
#define HDLC_READ_TRACE_DATA 0xE4 /* receive Trace data */
|
||||
|
||||
|
||||
/*
|
||||
* Return codes from interface commands
|
||||
*/
|
||||
|
||||
#define OK 0x00 /* the interface command was successfull */
|
||||
|
||||
/*
|
||||
* return codes from global interface commands
|
||||
*/
|
||||
|
||||
#define NO_GLOBAL_EXCEP_COND_TO_REPORT 0x01 /* there is no HDLC exception condition to report */
|
||||
#define LGTH_GLOBAL_CFG_DATA_INVALID 0x01 /* the length of the passed global configuration data is invalid */
|
||||
#define LGTH_TRACE_CFG_DATA_INVALID 0x01 /* the length of the passed trace configuration data is invalid */
|
||||
#define IRQ_TIMEOUT_VALUE_INVALID 0x02 /* an invalid application IRQ timeout value was selected */
|
||||
#define TRACE_CONFIG_INVALID 0x02 /* the passed line trace configuration is invalid */
|
||||
#define ADAPTER_OPERATING_FREQ_INVALID 0x03 /* an invalid adapter operating frequency was selected */
|
||||
#define TRC_DEAC_TMR_INVALID 0x03 /* the trace deactivation timer is invalid */
|
||||
#define S508_FT1_ADPTR_NOT_PRESENT 0x0E /* the S508/FT1 adapter is not present */
|
||||
#define S508_FT1_MODE_SELECTION_BUSY 0x0F /* the S508/FT1 adapter is busy selecting the operational mode */
|
||||
|
||||
/*
|
||||
* return codes from command READ_GLOBAL_EXCEPTION_CONDITION
|
||||
*/
|
||||
#define EXCEP_MODEM_STATUS_CHANGE 0x10 /* a modem status change occurred */
|
||||
#define EXCEP_TRC_DISABLED 0x11 /* the trace has been disabled */
|
||||
|
||||
/*
|
||||
* return codes from HDLC-level interface commands
|
||||
*/
|
||||
#define NO_HDLC_EXCEP_COND_TO_REPORT 0x21 /* there is no HDLC exception condition to report */
|
||||
#define HDLC_COMMS_DISABLED 0x21 /* communications are not currently enabled */
|
||||
#define HDLC_COMMS_ENABLED 0x21 /* communications are currently enabled */
|
||||
#define DISABLE_HDLC_COMMS_BEFORE_CFG 0x21 /* HDLC communications must be disabled before setting the configuration */
|
||||
#define ENABLE_HDLC_COMMS_BEFORE_CONN 0x21 /* communications must be enabled before using the HDLC_CONNECT conmmand */
|
||||
#define HDLC_CFG_BEFORE_COMMS_ENABLED 0x22 /* perform a SET_HDLC_CONFIGURATION before enabling comms */
|
||||
#define SET_TRACE_CFG 0x22 /* perform a SET_TRACE_CONFIGURATION */
|
||||
#define LGTH_HDLC_CFG_DATA_INVALID 0x22 /* the length of the passed HDLC configuration data is invalid */
|
||||
#define LGTH_HDLC_INT_DATA_INVALID 0x22 /* the length of the passed interrupt trigger data is invalid */
|
||||
#define HDLC_LINK_NOT_IN_ABM 0x22 /* the HDLC link is not currently in the ABM */
|
||||
#define HDLC_LINK_CURRENTLY_IN_ABM 0x22 /* the HDLC link is currently in the ABM */
|
||||
#define NO_TX_BFRS_AVAILABLE 0x23 /* no buffers available for transmission */
|
||||
#define INVALID_HDLC_APP_IRQ_SELECTED 0x23 /* in invalid IRQ was selected in the SET_HDLC_INTERRUPT_TRIGGERS */
|
||||
#define INVALID_HDLC_CFG_DATA 0x23 /* the passed HDLC configuration data is invalid */
|
||||
#define UI_FRM_TX_BFR_IN_USE 0x23 /* the buffer used for UI frame transmission is currently in use */
|
||||
#define T3_LESS_THAN_T1 0x24 /* the configured T3 value is less than T1 */
|
||||
#define HDLC_IRQ_TMR_VALUE_INVALID 0x24 /* an invalid application IRQ timer value was selected */
|
||||
#define UI_FRM_TX_LGTH_INVALID 0x24 /* the length of the UI frame to be transmitted is invalid */
|
||||
#define T4_LESS_THAN_T1 0x25 /* the configured T4 value is less than T1 */
|
||||
#define BFR_LGTH_EXCESSIVE_FOR_BFR_CFG 0x26 /* the configured buffer length is excessive for the configuration */
|
||||
#define INVALID_HDLC_COMMAND 0x4F /* the defined HDLC interface command is invalid */
|
||||
|
||||
/*
|
||||
* return codes from command READ_HDLC_EXCEPTION_CONDITION
|
||||
*/
|
||||
#define EXCEP_SABM_RX 0x30 /* a SABM frame was recvd in the ABM */
|
||||
#define EXCEP_DISC_RX 0x31 /* a DISC frame was recvd in the ABM */
|
||||
#define EXCEP_DM_RX 0x32 /* a DM frame was recvd in the ABM */
|
||||
#define EXCEP_UA_RX 0x33 /* a UA frame was recvd in the ABM */
|
||||
#define EXCEP_FRMR_RX 0x34 /* a FRMR frame was recvd in the ABM */
|
||||
#define EXCEP_UI_RX 0x37 /* a UI frame was received */
|
||||
#define EXCEP_SABM_TX_DM_RX 0x38 /* a SABM frame was transmitted due to the reception of a DM */
|
||||
#define EXCEP_SABM_TX_UA_RX 0x39 /* a SABM frame was transmitted due to the reception of a UA */
|
||||
/* while the link was in the ABM */
|
||||
#define EXCEP_SABM_TX_FRMR_RX 0x3A /* a SABM frame was transmitted due to the reception of a FRMR */
|
||||
/* while the link was in the ABM */
|
||||
#define EXCEP_SABM_TX_UNSOLIC_RESP_RX 0x3B /* a SABM frame was transmitted due to the reception of an */
|
||||
/* unsolicited response with the F bit set */
|
||||
#define EXCEP_SABM_TX_N2_EXPIRY 0x3C /* a SABM frame was transmitted due to an N2 count expiry */
|
||||
#define EXCEP_FRMR_TX 0x3F /* a FRMR frame was transmitted */
|
||||
#define EXCEP_SABM_RETRY_LIM_EXCEEDED 0x40 /* the SABM retry limit was exceeded */
|
||||
#define EXCEP_DISC_RETRY_LIM_EXCEEDED 0x41 /* the DISC retry limit was exceeded */
|
||||
#define EXCEP_FRMR_RETRY_LIM_EXCEEDED 0x42 /* the FRMR retry limit was exceeded */
|
||||
#define EXCEP_T3_TIMEOUT_EXCEEDED 0x45 /* the T3 timeout limit has been exceeded */
|
||||
|
||||
#define NO_TRACE_BUFFERS 0x60 /* No trace buffers are avail */
|
||||
#define TRACE_BUFFER_TOO_BIG 0x61
|
||||
#define TRACE_BUFFER_NOT_STORED 0x62
|
||||
|
||||
/*
|
||||
* Constants for the SET_GLOBAL_CONFIGURATION/READ_GLOBAL_CONFIGURATION
|
||||
* commands
|
||||
*/
|
||||
|
||||
/*
|
||||
* the global configuration structure
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
unsigned short adapter_config_options; /* configuration options */
|
||||
unsigned short app_IRQ_timeout; /* application IRQ timeout */
|
||||
unsigned long adapter_operating_frequency; /* operating frequency*/
|
||||
|
||||
} GLOBAL_CONFIGURATION_STRUCT;
|
||||
|
||||
/* settings for the 'app_IRQ_timeout' */
|
||||
#define MAX_APP_IRQ_TIMEOUT_VALUE 5000 /* the maximum permitted IRQ
|
||||
timeout */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants for the READ_GLOBAL_STATISTICS command
|
||||
*/
|
||||
|
||||
/*
|
||||
* the global statistics structure
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
unsigned short app_IRQ_timeout_count;
|
||||
|
||||
} GLOBAL_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants for the READ_COMMS_ERROR_STATS command
|
||||
*/
|
||||
|
||||
/*
|
||||
* the communications error statistics structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned char Rx_overrun_err_count; /* receiver overrun error count */
|
||||
unsigned char CRC_err_count; /* receiver CRC error count */
|
||||
unsigned char Rx_abort_count; /* abort frames received count */
|
||||
unsigned char Rx_dis_pri_bfrs_full_count; /* receiver disabled count */
|
||||
unsigned char comms_err_stat_reserved_1; /* reserved for later use */
|
||||
unsigned char comms_err_stat_reserved_2; /* reserved for later use */
|
||||
unsigned char missed_Tx_und_int_count;/* missed tx underrun intr count*/
|
||||
unsigned char comms_err_stat_reserved_3; /* reserved for later use */
|
||||
unsigned char DCD_state_change_count; /* DCD state change count */
|
||||
unsigned char CTS_state_change_count; /* CTS state change count */
|
||||
|
||||
} COMMS_ERROR_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants used for line tracing
|
||||
*/
|
||||
|
||||
/*
|
||||
* the trace configuration structure (SET_TRACE_CONFIGURATION/
|
||||
* READ_TRACE_CONFIGURATION commands)
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned char trace_config PACKED; /* trace configuration */
|
||||
unsigned short trace_deactivation_timer PACKED; /* trace deactivation timer */
|
||||
unsigned long ptr_trace_stat_el_cfg_struct PACKED; /* a pointer to the line trace element configuration structure */
|
||||
|
||||
} LINE_TRACE_CONFIG_STRUCT;
|
||||
|
||||
/* 'trace_config' bit settings */
|
||||
#define TRACE_INACTIVE 0x00 /* trace is inactive */
|
||||
#define TRACE_ACTIVE 0x01 /* trace is active */
|
||||
#define TRACE_DELAY_MODE 0x04 /* operate the trace in the
|
||||
delay mode */
|
||||
#define TRACE_I_FRAMES 0x08 /* trace I-frames */
|
||||
#define TRACE_SUPERVISORY_FRAMES 0x10 /* trace Supervisory frames */
|
||||
#define TRACE_UNNUMBERED_FRAMES 0x20 /* trace Unnumbered frames */
|
||||
|
||||
/*
|
||||
* the line trace status element configuration structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned short number_trace_status_elements PACKED; /* number of line trace elements */
|
||||
unsigned long base_addr_trace_status_elements PACKED;/* base address of the trace element list */
|
||||
unsigned long next_trace_element_to_use PACKED; /* pointer to the next trace element to be used */
|
||||
unsigned long base_addr_trace_buffer PACKED; /* base address of the trace data buffer */
|
||||
unsigned long end_addr_trace_buffer PACKED; /* end address of the trace data buffer */
|
||||
|
||||
} TRACE_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/*
|
||||
* the line trace status element structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned char opp_flag PACKED; /* opp flag */
|
||||
unsigned short trace_length PACKED; /* trace length */
|
||||
unsigned char trace_type PACKED; /* trace type */
|
||||
unsigned short trace_time_stamp PACKED;/* time stamp */
|
||||
unsigned short trace_reserved_1 PACKED;/* reserved for later use */
|
||||
unsigned long trace_reserved_2 PACKED; /* reserved for later use */
|
||||
unsigned long ptr_data_bfr PACKED; /* pointer to the trace data buffer */
|
||||
|
||||
} TRACE_STATUS_ELEMENT_STRUCT;
|
||||
|
||||
/*
|
||||
* the line trace statistics structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned long frames_traced_count; /* number of frames traced*/
|
||||
unsigned long trc_frms_not_recorded_count; /* number of trace frames
|
||||
discarded */
|
||||
unsigned short trc_disabled_internally_count; /* number of times the
|
||||
trace was disabled
|
||||
internally */
|
||||
|
||||
} LINE_TRACE_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants for the SET_HDLC_CONFIGURATION command
|
||||
*/
|
||||
|
||||
/*
|
||||
* the HDLC configuration structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned long baud_rate PACKED; /* the baud rate */
|
||||
unsigned short line_config_options PACKED; /* line configuration options */
|
||||
unsigned short modem_config_options PACKED; /* modem configuration options */
|
||||
unsigned short HDLC_API_options PACKED; /* HDLC API options */
|
||||
unsigned short HDLC_protocol_options PACKED; /* HDLC protocol options */
|
||||
unsigned short HDLC_buffer_config_options PACKED; /* HDLC buffer configuration options */
|
||||
unsigned short HDLC_statistics_options PACKED; /* HDLC operational statistics options */
|
||||
unsigned short configured_as_DTE PACKED; /* DTE or DCE configuration */
|
||||
unsigned short max_HDLC_I_field_length PACKED; /* the maximum length of the HDLC I-field */
|
||||
unsigned short HDLC_I_frame_window PACKED; /* k - the I-frame window (maximum number of outstanding I-frames) */
|
||||
unsigned short HDLC_T1_timer PACKED; /* the HDLC T1 timer */
|
||||
unsigned short HDLC_T2_timer PACKED; /* the HDLC T2 timer */
|
||||
unsigned short HDLC_T3_timer PACKED; /* the HDLC T3 timer */
|
||||
unsigned short HDLC_T4_timer PACKED; /* the HDLC T4 timer */
|
||||
unsigned short HDLC_N2_counter PACKED; /* the HDLC N2 counter */
|
||||
unsigned long ptr_shared_mem_info_struct PACKED;/* a pointer to the shared memory area information structure */
|
||||
unsigned long ptr_HDLC_Tx_stat_el_cfg_struct PACKED;/* a pointer to the transmit status element configuration structure */
|
||||
unsigned long ptr_HDLC_Rx_stat_el_cfg_struct PACKED;/* a pointer to the receive status element configuration structure */
|
||||
|
||||
} HDLC_CONFIGURATION_STRUCT;
|
||||
|
||||
/* settings for the 'line_config_options' */
|
||||
#define INTERFACE_LEVEL_V35 0x0000 /* use V.35 interface level */
|
||||
#define INTERFACE_LEVEL_RS232 0x0001 /* use RS-232 interface level */
|
||||
|
||||
/* settings for the 'modem_config_options' */
|
||||
#define DONT_RAISE_DTR_RTS_ON_EN_COMMS 0x0001 /* don't automatically raise DTR and RTS when performing an */
|
||||
|
||||
/* ENABLE_HDLC_COMMUNICATIONS command */
|
||||
|
||||
#define DONT_REPORT_CHG_IN_MODEM_STAT 0x0002 /* don't report changes in modem status to the application */
|
||||
#define DISABLE_DCD_CTS_INTERRUPTS 0x0004 /* ignore DCD and CTS interrupts on the adapter */
|
||||
|
||||
/* bit settings for the 'HDLC_API_options' */
|
||||
#define PERMIT_HDLC_CONNECT_IN_ABM 0x0001 /* allow the use of the HDLC_CONNECT command while in the ABM */
|
||||
|
||||
/* bit settings for the 'HDLC_protocol_options' byte */
|
||||
#define MOD_8_SELECTED 0x0000 /* use modulo 8 operation */
|
||||
#define MOD_128_SELECTED 0x0001 /* use modulo 128 (extended) operation */
|
||||
#define AUTO_MODULO_DETECTION 0x0002 /* use automatic modulus detection */
|
||||
#define PASSIVE_LINK_SETUP 0x0004 /* no SABMs should be issued when setting up the link */
|
||||
#define ENTER_DISC_PHASE_AFTR_DISC_SNT 0x0008 /* enter the disconnnected phase after issuing a DISC command */
|
||||
|
||||
/* settings for the 'HDLC_buffer_config_options' */
|
||||
#define HDLC_I_FRM_RX_HYSTERESIS 0x000F /* the HDLC I-frame receive hysteresis */
|
||||
#define HDLC_I_FRM_BFRS_3rd_LVL_PROT 0x0010 /* the HDLC I-frame buffers are to be used by a 3rd level protocol */
|
||||
|
||||
/* settings for the 'HDLC_statistics_options' */
|
||||
#define HDLC_TX_I_FRM_BYTE_COUNT_STAT 0x0001 /* compute the number of I-frame bytes transmitted */
|
||||
#define HDLC_RX_I_FRM_BYTE_COUNT_STAT 0x0002 /* compute the number of I-frame bytes received */
|
||||
#define HDLC_TX_THROUGHPUT_STAT 0x0004 /* compute the I-frame transmit throughput */
|
||||
#define HDLC_RX_THROUGHPUT_STAT 0x0008 /* compute the I-frame receive throughput */
|
||||
|
||||
/* permitted minimum and maximum values for setting the HDLC configuration */
|
||||
#define MAX_BAUD_RATE 2666000 /* maximum baud rate */
|
||||
#define MIN_NO_DATA_BYTES_IN_I_FRAME 300 /* minimum length of the configured HDLC I-field */
|
||||
#define MIN_PERMITTED_k_VALUE 0 /* minimum I-frame window size */
|
||||
#define MAX_PERMITTED_k_VALUE 127 /* maximum I-frame window size */
|
||||
#define MIN_PERMITTED_T1_VALUE 1 /* minimum T1 */
|
||||
#define MAX_PERMITTED_T1_VALUE 60000 /* maximum T1 */
|
||||
#define MIN_PERMITTED_T2_VALUE 0 /* minimum T2 */
|
||||
#define MAX_PERMITTED_T2_VALUE 60000 /* maximum T2 */
|
||||
#define MIN_PERMITTED_T3_VALUE 0 /* minimum T3 */
|
||||
#define MAX_PERMITTED_T3_VALUE 60000 /* maximum T3 */
|
||||
#define MIN_PERMITTED_T4_VALUE 0 /* minimum T4 */
|
||||
#define MAX_PERMITTED_T4_VALUE 60000 /* maximum T4 */
|
||||
#define MIN_PERMITTED_N2_VALUE 1 /* minimum N2 */
|
||||
#define MAX_PERMITTED_N2_VALUE 30 /* maximum N2 */
|
||||
|
||||
|
||||
/*
|
||||
* Constants for the READ_HDLC_LINK_STATUS command
|
||||
*/
|
||||
|
||||
/*
|
||||
* the HDLC status structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned char HDLC_link_status; /* HDLC link status (disconnect/ABM) */
|
||||
unsigned char modulus_type; /* configured modulus type */
|
||||
unsigned char no_I_frms_for_app;/* number of I-frames available for the application */
|
||||
unsigned char receiver_status; /* receiver status (enabled/disabled) */
|
||||
unsigned char LAPB_state; /* internal LAPB state */
|
||||
unsigned char rotating_SUP_frm_count; /* count of Supervisory frames received */
|
||||
|
||||
} HDLC_LINK_STATUS_STRUCT;
|
||||
|
||||
/* settings for the 'HDLC_link_status' variable */
|
||||
#define HDLC_LINK_DISCONNECTED 0x00 /* the HDLC link is disconnected */
|
||||
#define HDLC_LINK_IN_AB 0x01 /* the HDLC link is in the ABM (connected) */
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants for the READ_HDLC_OPERATIONAL_STATS command
|
||||
*/
|
||||
|
||||
/*
|
||||
* the HDLC operational statistics structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
/* Information frame transmission statistics */
|
||||
unsigned long I_frames_Tx_ack_count; /* I-frames transmitted (and acknowledged) count */
|
||||
unsigned long I_bytes_Tx_ack_count; /* I-bytes transmitted (and acknowledged) count */
|
||||
unsigned long I_frm_Tx_throughput; /* I-frame transmit throughput */
|
||||
unsigned long no_ms_for_HDLC_Tx_thruput_comp;/* millisecond time used for Tx throughput computation */
|
||||
unsigned long I_frames_retransmitted_count; /* I-frames re-transmitted count */
|
||||
unsigned long I_bytes_retransmitted_count; /* I-bytes re-transmitted count */
|
||||
unsigned short I_frms_not_Tx_lgth_err_count; /* number of I-frames not transmitted (length error) */
|
||||
unsigned short Tx_I_frms_disc_st_chg_count; /* the number of I-frames discarded (change in the LAPB state) */
|
||||
unsigned long reserved_I_frm_Tx_stat; /* reserved for later use */
|
||||
|
||||
/* Information frame reception statistics */
|
||||
unsigned long I_frames_Rx_buffered_count; /* I-frames received (and buffered) count */
|
||||
unsigned long I_bytes_Rx_buffered_count; /* I-bytes received (and buffered) count */
|
||||
unsigned long I_frm_Rx_throughput; /* I-frame receive throughput */
|
||||
unsigned long no_ms_for_HDLC_Rx_thruput_comp;/* millisecond time used for Rx throughput computation */
|
||||
unsigned short I_frms_Rx_too_long_count; /* I-frames received of excessive length count */
|
||||
unsigned short I_frms_Rx_seq_err_count; /* out of sequence I-frames received count */
|
||||
unsigned long reserved_I_frm_Rx_stat1; /* reserved for later use */
|
||||
unsigned long reserved_I_frm_Rx_stat2; /* reserved for later use */
|
||||
unsigned long reserved_I_frm_Rx_stat3; /* reserved for later use */
|
||||
|
||||
/* Supervisory frame transmission/reception statistics */
|
||||
unsigned short RR_Tx_count; /* RR frames transmitted count */
|
||||
unsigned short RR_Rx_count; /* RR frames received count */
|
||||
unsigned short RNR_Tx_count; /* RNR frames transmitted count */
|
||||
unsigned short RNR_Rx_count; /* RNR frames received count */
|
||||
unsigned short REJ_Tx_count; /* REJ frames transmitted count */
|
||||
unsigned short REJ_Rx_count; /* REJ frames received count */
|
||||
|
||||
/* Unnumbered frame transmission/reception statistics */
|
||||
unsigned short SABM_Tx_count; /* SABM frames transmitted count */
|
||||
unsigned short SABM_Rx_count; /* SABM frames received count */
|
||||
unsigned short SABME_Tx_count; /* SABME frames transmitted count */
|
||||
unsigned short SABME_Rx_count; /* SABME frames received count */
|
||||
unsigned short DISC_Tx_count; /* DISC frames transmitted count */
|
||||
unsigned short DISC_Rx_count; /* DISC frames received count */
|
||||
unsigned short DM_Tx_count; /* DM frames transmitted count */
|
||||
unsigned short DM_Rx_count; /* DM frames received count */
|
||||
unsigned short UA_Tx_count; /* UA frames transmitted count */
|
||||
unsigned short UA_Rx_count; /* UA frames received count */
|
||||
unsigned short FRMR_Tx_count; /* FRMR frames transmitted count */
|
||||
unsigned short FRMR_Rx_count; /* FRMR frames received count */
|
||||
unsigned short UI_Tx_count; /* UI frames transmitted count */
|
||||
unsigned short UI_Rx_buffered_count;/* UI frames received and buffered count */
|
||||
unsigned long reserved_Sup_Unnum_stat1; /* reserved for later use */
|
||||
unsigned long reserved_Sup_Unnum_stat2; /* reserved for later use */
|
||||
|
||||
/* Incomming frames with a format error statistics */
|
||||
unsigned short Rx_frm_shorter_32_bits_count; /* frames received of less than 32 bits in length count */
|
||||
unsigned short Rx_I_fld_Sup_Unnum_frm_count; /* Supervisory/Unnumbered frames received with */
|
||||
|
||||
/* illegal I-fields count */
|
||||
unsigned short Rx_frms_invld_HDLC_addr_count;/* frames received with an invalid HDLC address count */
|
||||
unsigned short Rx_invld_HDLC_ctrl_fld_count; /* frames received of an invalid/unsupported */
|
||||
/* control field count */
|
||||
unsigned long reserved_frm_format_err1; /* reserved for later use */
|
||||
unsigned long reserved_frm_format_err2; /* reserved for later use */
|
||||
|
||||
/* FRMR/UI reception error statistics */
|
||||
unsigned short Rx_FRMR_frms_discard_count;/* incomming FRMR frames discarded count */
|
||||
unsigned short Rx_UI_frms_discard_count;/* incomming UI frames discarded count */
|
||||
unsigned short UI_frms_Rx_invld_lgth_count;/* UI frames of invalid length received count */
|
||||
unsigned short reserved_Rx_err_stat1; /* reserved for later use */
|
||||
unsigned long reserved_Rx_err_stat2; /* reserved for later use */
|
||||
unsigned long reserved_Rx_err_stat3; /* reserved for later use */
|
||||
|
||||
/* HDLC timeout/retry statistics */
|
||||
unsigned short T1_timeout_count; /* T1 timeouts count */
|
||||
unsigned short T3_timeout_count; /* T3 timeouts count */
|
||||
unsigned short T4_timeout_count; /* T4 timeouts count */
|
||||
unsigned short reserved_timeout_stat; /* reserved for later use */
|
||||
unsigned short N2_threshold_reached_count;/* N2 threshold reached count */
|
||||
unsigned short reserved_threshold_stat; /* reserved for later use */
|
||||
unsigned long To_retry_reserved_stat; /* reserved for later use */
|
||||
|
||||
/* miscellaneous statistics */
|
||||
unsigned long reserved_misc_stat1; /* reserved for later use */
|
||||
unsigned long reserved_misc_stat2; /* reserved for later use */
|
||||
unsigned long reserved_misc_stat3; /* reserved for later use */
|
||||
unsigned long reserved_misc_stat4; /* reserved for later use */
|
||||
|
||||
} HDLC_OPERATIONAL_STATS_STRUCT;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants for the SEND_UI_FRAME command
|
||||
*/
|
||||
|
||||
#define MAX_LENGTH_UI_DATA 512 /* maximum UI frame data length */
|
||||
|
||||
/*
|
||||
* the structure used for UI frame transmission/reception
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char HDLC_address; /* HDLC address in the frame */
|
||||
unsigned char UI_reserved; /* reserved for internal use */
|
||||
char data[MAX_LENGTH_UI_DATA]; /* UI data area */
|
||||
} UI_FRAME_STRUCT;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants for using application interrupts
|
||||
*/
|
||||
|
||||
/*
|
||||
* the structure used for the SET_HDLC_INTERRUPT_TRIGGERS/
|
||||
* READ_HDLC_INTERRUPT_TRIGGERS command
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned char HDLC_interrupt_triggers; /* HDLC interrupt trigger configuration */
|
||||
unsigned char IRQ; /* IRQ to be used */
|
||||
unsigned short interrupt_timer; /* interrupt timer */
|
||||
|
||||
} HDLC_INT_TRIGGERS_STRUCT;
|
||||
|
||||
/* 'HDLC_interrupt_triggers' bit settings */
|
||||
#define APP_INT_ON_RX_FRAME 0x01 /* interrupt on I-frame reception */
|
||||
#define APP_INT_ON_TX_FRAME 0x02 /* interrupt when an I-frame may be transmitted */
|
||||
#define APP_INT_ON_COMMAND_COMPLETE 0x04 /* interrupt when an interface command is complete */
|
||||
#define APP_INT_ON_TIMER 0x08 /* interrupt on a defined millisecond timeout */
|
||||
#define APP_INT_ON_GLOBAL_EXCEP_COND 0x10 /* interrupt on a global exception condition */
|
||||
#define APP_INT_ON_HDLC_EXCEP_COND 0x20 /* interrupt on an HDLC exception condition */
|
||||
#define APP_INT_ON_TRACE_DATA_AVAIL 0x80 /* interrupt when trace data is available */
|
||||
|
||||
|
||||
/*
|
||||
* the HDLC interrupt information structure
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
unsigned char interrupt_type PACKED; /* type of interrupt triggered */
|
||||
unsigned char interrupt_permission PACKED; /* interrupt permission mask */
|
||||
unsigned char int_info_reserved[14] PACKED; /* reserved */
|
||||
|
||||
} HDLC_INTERRUPT_INFO_STRUCT;
|
||||
|
||||
/* interrupt types indicated at 'interrupt_type' byte of the
|
||||
HDLC_INTERRUPT_INFO_STRUCT */
|
||||
#define NO_APP_INTS_PEND 0x00 /* no interrups are pending */
|
||||
#define RX_APP_INT_PEND 0x01 /*receive interrupt is pending */
|
||||
#define TX_APP_INT_PEND 0x02 /* a transmit interrupt is pending */
|
||||
#define COMMAND_COMPLETE_APP_INT_PEND 0x04 /* a 'command complete' interrupt is pending */
|
||||
#define TIMER_APP_INT_PEND 0x08 /* a timer interrupt is pending */
|
||||
#define GLOBAL_EXCEP_COND_APP_INT_PEND 0x10 /* a global exception condition interrupt is pending */
|
||||
#define HDLC_EXCEP_COND_APP_INT_PEND 0x20 /* an HDLC exception condition interrupt is pending */
|
||||
#define TRACE_DATA_AVAIL_APP_INT_PEND 0x80 /* a trace data available interrupt is pending */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants for Information frame transmission
|
||||
*/
|
||||
|
||||
/*
|
||||
* the I-frame transmit status element configuration structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned short number_Tx_status_elements PACKED; /* number of transmit status elements */
|
||||
unsigned long base_addr_Tx_status_elements PACKED; /* base address of the transmit element list */
|
||||
unsigned long next_Tx_status_element_to_use PACKED; /* pointer to the next transmit element to be used */
|
||||
|
||||
} HDLC_TX_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/*
|
||||
* the I-frame transmit status element structure
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
unsigned char opp_flag PACKED; /* opp flag */
|
||||
unsigned short I_frame_length PACKED; /* length of the frame*/
|
||||
unsigned char P_bit PACKED; /* P-bit setting in the frame */
|
||||
unsigned long reserved_1 PACKED; /* reserved for internal use */
|
||||
unsigned long reserved_2 PACKED; /* reserved for internal use */
|
||||
unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
|
||||
|
||||
} HDLC_I_FRM_TX_STATUS_EL_STRUCT;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants for Information frame reception
|
||||
*/
|
||||
|
||||
/*
|
||||
* the I-frame receive status element configuration structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned short number_Rx_status_elements PACKED; /* number of receive status elements */
|
||||
unsigned long base_addr_Rx_status_elements PACKED; /* base address of the receive element list */
|
||||
unsigned long next_Rx_status_element_to_use PACKED; /* pointer to the next receive element to be used */
|
||||
unsigned long base_addr_Rx_buffer PACKED; /* base address of the receive data buffer */
|
||||
unsigned long end_addr_Rx_buffer PACKED; /* end address of the receive data buffer */
|
||||
} HDLC_RX_STATUS_EL_CFG_STRUCT;
|
||||
|
||||
/*
|
||||
* the I-frame receive status element structure
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
unsigned char opp_flag PACKED; /* opp flag */
|
||||
unsigned short I_frame_length PACKED; /*length of the recvd frame */
|
||||
unsigned char P_bit PACKED; /* P-bit setting in the frame */
|
||||
unsigned long reserved_1 PACKED; /* reserved for internal use */
|
||||
unsigned long reserved_2 PACKED; /* reserved for internal use */
|
||||
unsigned long ptr_data_bfr PACKED; /* pointer to the data area */
|
||||
|
||||
} HDLC_I_FRM_RX_STATUS_EL_STRUCT;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Constants defining the shared memory information area
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* the global information structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned char global_status PACKED; /* global status */
|
||||
unsigned char modem_status PACKED;/* current modem status*/
|
||||
unsigned char global_excep_conditions PACKED; /* global exception conditions */
|
||||
unsigned char glob_info_reserved[5] PACKED; /* reserved */
|
||||
unsigned char code_name[4] PACKED; /* code name */
|
||||
unsigned char code_version[4] PACKED; /* code version */
|
||||
|
||||
} GLOBAL_INFORMATION_STRUCT;
|
||||
|
||||
|
||||
/*
|
||||
* the S508/FT1 information structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned char parallel_port_A_input PACKED; /* input - parallel port A */
|
||||
unsigned char parallel_port_B_input PACKED; /* input - parallel port B */
|
||||
unsigned char FT1_info_reserved[14] PACKED; /* reserved */
|
||||
|
||||
} FT1_INFORMATION_STRUCT;
|
||||
|
||||
/*
|
||||
* the HDLC information structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
unsigned char HDLC_status PACKED; /* HDLC status */
|
||||
unsigned char HDLC_excep_frms_Rx PACKED; /* HDLC exception conditions - received frames */
|
||||
unsigned char HDLC_excep_frms_Tx PACKED; /* HDLC exception conditions - transmitted frames */
|
||||
unsigned char HDLC_excep_miscellaneous PACKED; /* HDLC exception conditions - miscellaneous */
|
||||
unsigned char rotating_SUP_frm_count PACKED; /* rotating Supervisory frame count */
|
||||
unsigned char LAPB_status PACKED; /* internal LAPB status */
|
||||
unsigned char internal_HDLC_status PACKED; /* internal HDLC status */
|
||||
unsigned char HDLC_info_reserved[9] PACKED; /* reserved */
|
||||
|
||||
} HDLC_INFORMATION_STRUCT;
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* the HDLC shared memory area information structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
GLOBAL_INFORMATION_STRUCT global_info PACKED; /* the global information structure */
|
||||
FT1_INFORMATION_STRUCT FT1_info PACKED; /* the S508/FT1 information structure */
|
||||
HDLC_INFORMATION_STRUCT HDLC_info PACKED; /* the HDLC information structure */
|
||||
HDLC_INTERRUPT_INFO_STRUCT HDLC_interrupt_info PACKED; /* the HDLC interrupt information structure */
|
||||
|
||||
} HDLC_SHARED_MEMORY_INFO_STRUCT;
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
|
@ -1,168 +0,0 @@
|
|||
#ifndef __WANPIPE_MFR__
|
||||
#define __WANPIPE_MFR__
|
||||
|
||||
#define HDLC_PROT_ONLY
|
||||
#include <linux/sdla_chdlc.h>
|
||||
#include <linux/sdla_fr.h>
|
||||
|
||||
|
||||
#undef wan_udphdr_data
|
||||
#define wan_udphdr_data wan_udphdr_u.data
|
||||
|
||||
#undef wan_udp_data
|
||||
#define wan_udp_data wan_udp_hdr.wan_udphdr_data
|
||||
|
||||
#undef MAX_FR_CHANNELS
|
||||
#undef HIGHEST_VALID_DLCI
|
||||
|
||||
#define MAX_FR_CHANNELS 1023
|
||||
#define HIGHEST_VALID_DLCI MAX_FR_CHANNELS-1
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
unsigned ea1 : 1;
|
||||
unsigned cr : 1;
|
||||
unsigned dlcih: 6;
|
||||
|
||||
unsigned ea2 : 1;
|
||||
unsigned de : 1;
|
||||
unsigned becn : 1;
|
||||
unsigned fecn : 1;
|
||||
unsigned dlcil: 4;
|
||||
}fr_hdr;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#define FR_HEADER_LEN 8
|
||||
|
||||
#define LINK_STATE_RELIABLE 0x01
|
||||
#define LINK_STATE_REQUEST 0x02 /* full stat sent (DCE) / req pending (DTE) */
|
||||
#define LINK_STATE_CHANGED 0x04 /* change in PVCs state, send full report */
|
||||
#define LINK_STATE_FULLREP_SENT 0x08 /* full report sent */
|
||||
|
||||
#define FR_UI 0x03
|
||||
#define FR_PAD 0x00
|
||||
|
||||
#define NLPID_IP 0xCC
|
||||
#define NLPID_IPV6 0x8E
|
||||
#define NLPID_SNAP 0x80
|
||||
#define NLPID_PAD 0x00
|
||||
#define NLPID_Q933 0x08
|
||||
|
||||
|
||||
|
||||
/* 'status' defines */
|
||||
#define FR_LINK_INOPER 0x00 /* for global status (DLCI == 0) */
|
||||
#define FR_LINK_OPER 0x01
|
||||
|
||||
#if 0
|
||||
#define FR_DLCI_INOPER 0x00
|
||||
#define FR_DLCI_DELETED 0x01 /* for circuit status (DLCI != 0) */
|
||||
#define FR_DLCI_ACTIVE 0x02
|
||||
#define FR_DLCI_WAITING 0x04
|
||||
#define FR_DLCI_NEW 0x08
|
||||
#define FR_DLCI_REPORT 0x40
|
||||
#endif
|
||||
|
||||
#define PVC_STATE_NEW 0x01
|
||||
#define PVC_STATE_ACTIVE 0x02
|
||||
#define PVC_STATE_FECN 0x08 /* FECN condition */
|
||||
#define PVC_STATE_BECN 0x10 /* BECN condition */
|
||||
|
||||
|
||||
#define LMI_ANSI_DLCI 0
|
||||
#define LMI_LMI_DLCI 1023
|
||||
|
||||
#define LMI_PROTO 0x08
|
||||
#define LMI_CALLREF 0x00 /* Call Reference */
|
||||
#define LMI_ANSI_LOCKSHIFT 0x95 /* ANSI lockshift */
|
||||
#define LMI_REPTYPE 1 /* report type */
|
||||
#define LMI_CCITT_REPTYPE 0x51
|
||||
#define LMI_ALIVE 3 /* keep alive */
|
||||
#define LMI_CCITT_ALIVE 0x53
|
||||
#define LMI_PVCSTAT 7 /* pvc status */
|
||||
#define LMI_CCITT_PVCSTAT 0x57
|
||||
#define LMI_FULLREP 0 /* full report */
|
||||
#define LMI_INTEGRITY 1 /* link integrity report */
|
||||
#define LMI_SINGLE 2 /* single pvc report */
|
||||
#define LMI_STATUS_ENQUIRY 0x75
|
||||
#define LMI_STATUS 0x7D /* reply */
|
||||
|
||||
#define LMI_REPT_LEN 1 /* report type element length */
|
||||
#define LMI_INTEG_LEN 2 /* link integrity element length */
|
||||
|
||||
#define LMI_LENGTH 13 /* standard LMI frame length */
|
||||
#define LMI_ANSI_LENGTH 14
|
||||
|
||||
#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */
|
||||
#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10) /* max 10 bytes for FR */
|
||||
|
||||
#define MAX_TRACE_QUEUE 100
|
||||
#define TRACE_QUEUE_LIMIT 1001
|
||||
#define MAX_TRACE_TIMEOUT (HZ*10)
|
||||
|
||||
static __inline__ u16 status_to_dlci(u8 *status, u8 *state)
|
||||
{
|
||||
*state &= ~(PVC_STATE_ACTIVE | PVC_STATE_NEW);
|
||||
if (status[2] & 0x08)
|
||||
*state |= PVC_STATE_NEW;
|
||||
else if (status[2] & 0x02)
|
||||
*state |= PVC_STATE_ACTIVE;
|
||||
|
||||
return ((status[0] & 0x3F)<<4) | ((status[1] & 0x78)>>3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static __inline__ u16 q922_to_dlci(u8 *hdr)
|
||||
{
|
||||
return ((hdr[0] & 0xFC)<<2) | ((hdr[1] & 0xF0)>>4);
|
||||
}
|
||||
|
||||
|
||||
static inline u8 fr_lmi_nextseq(u8 x)
|
||||
{
|
||||
x++;
|
||||
return x ? x : 1;
|
||||
}
|
||||
|
||||
static __inline__ void dlci_to_q922(u8 *hdr, u16 dlci)
|
||||
{
|
||||
hdr[0] = (dlci>>2) & 0xFC;
|
||||
hdr[1] = ((dlci<<4) & 0xF0) | 0x01;
|
||||
}
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
struct tasklet_struct wanpipe_task;
|
||||
unsigned long tq_working;
|
||||
netdevice_t *dlci_to_dev_map[MAX_FR_CHANNELS];
|
||||
unsigned char global_dlci_map[MAX_FR_CHANNELS];
|
||||
wan_fr_conf_t cfg;
|
||||
unsigned char station;
|
||||
struct sk_buff_head rx_free;
|
||||
struct sk_buff_head rx_used;
|
||||
struct sk_buff_head lmi_queue;
|
||||
struct sk_buff_head trace_queue;
|
||||
unsigned long last_rx_poll;
|
||||
unsigned int txseq, rxseq;
|
||||
unsigned char state;
|
||||
unsigned long n391cnt;
|
||||
unsigned int last_errors;
|
||||
struct timer_list timer;
|
||||
unsigned short lmi_dlci;
|
||||
netdevice_t *tx_dev;
|
||||
|
||||
fr_link_stat_t link_stats;
|
||||
void *update_dlci;
|
||||
unsigned long tracing_enabled;
|
||||
int max_trace_queue;
|
||||
unsigned long trace_timeout;
|
||||
|
||||
unsigned int max_rx_queue;
|
||||
} fr_prot_t;
|
||||
|
||||
#endif
|
|
@ -1,370 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* sdla_ppp.h Sangoma PPP firmware API definitions.
|
||||
*
|
||||
* Author: Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 1995-1997 Sangoma Technologies Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
* Feb 24, 2000 Nenad Corbic v2.1.2
|
||||
* Jan 06, 1997 Gene Kozin v2.0
|
||||
* Apr 11, 1996 Gene Kozin Initial version.
|
||||
*****************************************************************************/
|
||||
#ifndef _SDLA_PPP_H
|
||||
#define _SDLA_PPP_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Notes:
|
||||
* ------
|
||||
* 1. All structures defined in this file are byte-alined.
|
||||
*
|
||||
* Compiler Platform
|
||||
* -------- --------
|
||||
* GNU C Linux
|
||||
*/
|
||||
#pragma pack(1)
|
||||
|
||||
#include <linux/wanpipe_sppp_iface.h>
|
||||
|
||||
/* Adapter memory layout and important constants */
|
||||
#define PPP508_MB_VECT 0xE000 /* mailbox window vector */
|
||||
#define PPP508_MB_OFFS 0 /* mailbox offset */
|
||||
#define PPP508_FLG_OFFS 0x1000 /* status flags offset */
|
||||
#define PPP508_BUF_OFFS 0x1100 /* buffer info block offset */
|
||||
#define PPP514_MB_OFFS 0xE000 /* mailbox offset */
|
||||
#define PPP514_FLG_OFFS 0xF000 /* status flags offset */
|
||||
#define PPP514_BUF_OFFS 0xF100 /* buffer info block offset */
|
||||
|
||||
#define PPP_MAX_DATA 1008 /* command block data buffer length */
|
||||
|
||||
/****** Data Structures *****************************************************/
|
||||
/*----------------------------------------------------------------------------
|
||||
* PPP Command Block.
|
||||
*/
|
||||
typedef struct ppp_cmd{
|
||||
unsigned char command PACKED; /* command code */
|
||||
unsigned short length PACKED; /* length of data buffer */
|
||||
unsigned char result PACKED; /* return code */
|
||||
unsigned char rsrv[11] PACKED; /* reserved for future use */
|
||||
} ppp_cmd_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char status PACKED;
|
||||
unsigned char data_avail PACKED;
|
||||
unsigned short real_length PACKED;
|
||||
unsigned short time_stamp PACKED;
|
||||
unsigned char data[1] PACKED;
|
||||
} trace_pkt_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char opp_flag PACKED;
|
||||
unsigned char trace_type PACKED;
|
||||
unsigned short trace_length PACKED;
|
||||
unsigned short trace_data_ptr PACKED;
|
||||
unsigned short trace_time_stamp PACKED;
|
||||
} trace_element_t;
|
||||
|
||||
|
||||
|
||||
/* 'result' field defines */
|
||||
#define PPPRES_OK 0x00 /* command executed successfully */
|
||||
#define PPPRES_INVALID_STATE 0x09 /* invalid command in this context */
|
||||
|
||||
#if 0
|
||||
/*----------------------------------------------------------------------------
|
||||
* PPP Mailbox.
|
||||
* This structure is located at offset PPP???_MB_OFFS into PPP???_MB_VECT
|
||||
*/
|
||||
typedef struct ppp_mbox
|
||||
{
|
||||
unsigned char flag PACKED; /* 00h: command execution flag */
|
||||
ppp_cmd_t cmd PACKED; /* 01h: command block */
|
||||
unsigned char data[1] PACKED; /* 10h: variable length data buffer */
|
||||
} ppp_mbox_t;
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------
|
||||
* PPP Status Flags.
|
||||
* This structure is located at offset PPP???_FLG_OFFS into
|
||||
* PPP???_MB_VECT.
|
||||
*/
|
||||
typedef struct ppp_flags
|
||||
{
|
||||
unsigned char iflag PACKED; /* 00: interrupt flag */
|
||||
unsigned char imask PACKED; /* 01: interrupt mask */
|
||||
unsigned char resrv PACKED;
|
||||
unsigned char mstatus PACKED; /* 03: modem status */
|
||||
unsigned char lcp_state PACKED; /* 04: LCP state */
|
||||
unsigned char ppp_phase PACKED; /* 05: PPP phase */
|
||||
unsigned char ip_state PACKED; /* 06: IPCP state */
|
||||
unsigned char ipx_state PACKED; /* 07: IPXCP state */
|
||||
unsigned char pap_state PACKED; /* 08: PAP state */
|
||||
unsigned char chap_state PACKED; /* 09: CHAP state */
|
||||
unsigned short disc_cause PACKED; /* 0A: disconnection cause */
|
||||
} ppp_flags_t;
|
||||
|
||||
/* 'iflag' defines */
|
||||
#define PPP_INTR_RXRDY 0x01 /* Rx ready */
|
||||
#define PPP_INTR_TXRDY 0x02 /* Tx ready */
|
||||
#define PPP_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */
|
||||
#define PPP_INTR_CMD 0x08 /* interface command completed */
|
||||
#define PPP_INTR_DISC 0x10 /* data link disconnected */
|
||||
#define PPP_INTR_OPEN 0x20 /* data link open */
|
||||
#define PPP_INTR_DROP_DTR 0x40 /* DTR drop timeout expired */
|
||||
#define PPP_INTR_TIMER 0x80 /* timer interrupt */
|
||||
|
||||
|
||||
/* 'mstatus' defines */
|
||||
#define PPP_MDM_DCD 0x08 /* mdm_status: DCD */
|
||||
#define PPP_MDM_CTS 0x20 /* mdm_status: CTS */
|
||||
|
||||
/* 'disc_cause' defines */
|
||||
#define PPP_LOCAL_TERMINATION 0x0001 /* Local Request by PPP termination phase */
|
||||
#define PPP_DCD_CTS_DROP 0x0002 /* DCD and/or CTS dropped. Link down */
|
||||
#define PPP_REMOTE_TERMINATION 0x0800 /* Remote Request by PPP termination phase */
|
||||
|
||||
/* 'misc_config_bits' defines */
|
||||
#define DONT_RE_TX_ABORTED_I_FRAMES 0x01
|
||||
#define TX_FRM_BYTE_COUNT_STATS 0x02
|
||||
#define RX_FRM_BYTE_COUNT_STATS 0x04
|
||||
#define TIME_STAMP_IN_RX_FRAMES 0x08
|
||||
#define NON_STD_ADPTR_FREQ 0x10
|
||||
#define INTERFACE_LEVEL_RS232 0x20
|
||||
#define AUTO_LINK_RECOVERY 0x100
|
||||
#define DONT_TERMINATE_LNK_MAX_CONFIG 0x200
|
||||
|
||||
/* 'authentication options' defines */
|
||||
#define NO_AUTHENTICATION 0x00
|
||||
#define INBOUND_AUTH 0x80
|
||||
#define PAP_AUTH 0x01
|
||||
#define CHAP_AUTH 0x02
|
||||
|
||||
/* 'ip options' defines */
|
||||
#define L_AND_R_IP_NO_ASSIG 0x00
|
||||
#define L_IP_LOCAL_ASSIG 0x01
|
||||
#define L_IP_REMOTE_ASSIG 0x02
|
||||
#define R_IP_LOCAL_ASSIG 0x04
|
||||
#define R_IP_REMOTE_ASSIG 0x08
|
||||
#define ENABLE_IP 0x80
|
||||
|
||||
/* 'ipx options' defines */
|
||||
#define ROUTING_PROT_DEFAULT 0x20
|
||||
#define ENABLE_IPX 0x80
|
||||
#define DISABLE_IPX 0x00
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* PPP Buffer Info.
|
||||
* This structure is located at offset PPP508_BUF_OFFS into
|
||||
* PPP508_MB_VECT.
|
||||
*/
|
||||
typedef struct ppp508_buf_info
|
||||
{
|
||||
unsigned short txb_num PACKED; /* 00: number of transmit buffers */
|
||||
unsigned int txb_ptr PACKED; /* 02: pointer to the buffer ctl. */
|
||||
unsigned int txb_nxt PACKED;
|
||||
unsigned char rsrv1[22] PACKED;
|
||||
unsigned short rxb_num PACKED; /* 20: number of receive buffers */
|
||||
unsigned int rxb_ptr PACKED; /* 22: pointer to the buffer ctl. */
|
||||
unsigned int rxb1_ptr PACKED; /* 26: pointer to the first buf.ctl. */
|
||||
unsigned int rxb_base PACKED; /* 2A: pointer to the buffer base */
|
||||
unsigned char rsrv2[2] PACKED;
|
||||
unsigned int rxb_end PACKED; /* 30: pointer to the buffer end */
|
||||
} ppp508_buf_info_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Transmit/Receive Buffer Control Block.
|
||||
*/
|
||||
typedef struct ppp_buf_ctl
|
||||
{
|
||||
unsigned char flag PACKED; /* 00: 'buffer ready' flag */
|
||||
unsigned short length PACKED; /* 01: length of data */
|
||||
unsigned char reserved1[1] PACKED; /* 03: */
|
||||
unsigned char proto PACKED; /* 04: protocol */
|
||||
unsigned short timestamp PACKED; /* 05: time stamp (Rx only) */
|
||||
unsigned char reserved2[5] PACKED; /* 07: */
|
||||
union
|
||||
{
|
||||
unsigned short o_p[2]; /* 1C: buffer offset & page (S502) */
|
||||
unsigned int ptr; /* 1C: buffer pointer (S508) */
|
||||
} buf PACKED;
|
||||
} ppp_buf_ctl_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S508 Adapter Configuration Block (passed to the PPP_SET_CONFIG command).
|
||||
*/
|
||||
typedef struct ppp508_conf
|
||||
{
|
||||
unsigned int line_speed PACKED; /* 00: baud rate, bps */
|
||||
unsigned short txbuf_percent PACKED; /* 04: % of Tx buffer */
|
||||
unsigned short conf_flags PACKED; /* 06: configuration bits */
|
||||
unsigned short mtu_local PACKED; /* 08: local MTU */
|
||||
unsigned short mtu_remote PACKED; /* 0A: remote MTU */
|
||||
unsigned short restart_tmr PACKED; /* 0C: restart timer */
|
||||
unsigned short auth_rsrt_tmr PACKED; /* 0E: authentication timer */
|
||||
unsigned short auth_wait_tmr PACKED; /* 10: authentication timer */
|
||||
unsigned short mdm_fail_tmr PACKED; /* 12: modem failure timer */
|
||||
unsigned short dtr_drop_tmr PACKED; /* 14: DTR drop timer */
|
||||
unsigned short connect_tmout PACKED; /* 16: connection timeout */
|
||||
unsigned short conf_retry PACKED; /* 18: max. retry */
|
||||
unsigned short term_retry PACKED; /* 1A: max. retry */
|
||||
unsigned short fail_retry PACKED; /* 1C: max. retry */
|
||||
unsigned short auth_retry PACKED; /* 1E: max. retry */
|
||||
unsigned char auth_options PACKED; /* 20: authentication opt. */
|
||||
unsigned char ip_options PACKED; /* 21: IP options */
|
||||
unsigned int ip_local PACKED; /* 22: local IP address */
|
||||
unsigned int ip_remote PACKED; /* 26: remote IP address */
|
||||
unsigned char ipx_options PACKED; /* 2A: IPX options */
|
||||
unsigned char ipx_netno[4] PACKED; /* 2B: IPX net number */
|
||||
unsigned char ipx_local[6] PACKED; /* 2F: local IPX node number*/
|
||||
unsigned char ipx_remote[6] PACKED; /* 35: remote IPX node num.*/
|
||||
unsigned char ipx_router[48] PACKED; /* 3B: IPX router name*/
|
||||
unsigned int alt_cpu_clock PACKED; /* 6B: */
|
||||
} ppp508_conf_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S508 Adapter Read Connection Information Block
|
||||
* Returned by the PPP_GET_CONNECTION_INFO command
|
||||
*/
|
||||
typedef struct ppp508_connect_info
|
||||
{
|
||||
unsigned short mru PACKED; /* 00-01 Remote Max Rec' Unit */
|
||||
unsigned char ip_options PACKED; /* 02: Negotiated ip options */
|
||||
unsigned int ip_local PACKED; /* 03-06: local IP address */
|
||||
unsigned int ip_remote PACKED; /* 07-0A: remote IP address */
|
||||
unsigned char ipx_options PACKED; /* 0B: Negotiated ipx options */
|
||||
unsigned char ipx_netno[4] PACKED; /* 0C-0F: IPX net number */
|
||||
unsigned char ipx_local[6] PACKED; /* 10-1F: local IPX node # */
|
||||
unsigned char ipx_remote[6] PACKED; /* 16-1B: remote IPX node # */
|
||||
unsigned char ipx_router[48] PACKED; /* 1C-4B: IPX router name */
|
||||
unsigned char auth_status PACKED; /* 4C: Authentication Status */
|
||||
unsigned char inbd_auth_peerID[1] PACKED; /* 4D: variable length inbound authenticated peer ID */
|
||||
} ppp508_connect_info_t;
|
||||
|
||||
/* 'line_speed' field */
|
||||
#define PPP_BITRATE_1200 0x01
|
||||
#define PPP_BITRATE_2400 0x02
|
||||
#define PPP_BITRATE_4800 0x03
|
||||
#define PPP_BITRATE_9600 0x04
|
||||
#define PPP_BITRATE_19200 0x05
|
||||
#define PPP_BITRATE_38400 0x06
|
||||
#define PPP_BITRATE_45000 0x07
|
||||
#define PPP_BITRATE_56000 0x08
|
||||
#define PPP_BITRATE_64000 0x09
|
||||
#define PPP_BITRATE_74000 0x0A
|
||||
#define PPP_BITRATE_112000 0x0B
|
||||
#define PPP_BITRATE_128000 0x0C
|
||||
#define PPP_BITRATE_156000 0x0D
|
||||
|
||||
/* Defines for the 'conf_flags' field */
|
||||
#define PPP_IGNORE_TX_ABORT 0x01 /* don't re-transmit aborted frames */
|
||||
#define PPP_ENABLE_TX_STATS 0x02 /* enable Tx statistics */
|
||||
#define PPP_ENABLE_RX_STATS 0x04 /* enable Rx statistics */
|
||||
#define PPP_ENABLE_TIMESTAMP 0x08 /* enable timestamp */
|
||||
|
||||
/* 'ip_options' defines */
|
||||
#define PPP_LOCAL_IP_LOCAL 0x01
|
||||
#define PPP_LOCAL_IP_REMOTE 0x02
|
||||
#define PPP_REMOTE_IP_LOCAL 0x04
|
||||
#define PPP_REMOTE_IP_REMOTE 0x08
|
||||
|
||||
/* 'ipx_options' defines */
|
||||
#define PPP_REMOTE_IPX_NETNO 0x01
|
||||
#define PPP_REMOTE_IPX_LOCAL 0x02
|
||||
#define PPP_REMOTE_IPX_REMOTE 0x04
|
||||
#define PPP_IPX_ROUTE_RIP_SAP 0x08
|
||||
#define PPP_IPX_ROUTE_NLSP 0x10
|
||||
#define PPP_IPX_ROUTE_DEFAULT 0x20
|
||||
#define PPP_IPX_CONF_COMPLETE 0x40
|
||||
#define PPP_IPX_ENABLE 0x80
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S508 Adapter Configuration Block (returned by the PPP_READ_CONFIG command).
|
||||
*/
|
||||
typedef struct ppp508_get_conf
|
||||
{
|
||||
unsigned int bps PACKED; /* 00: baud rate, bps */
|
||||
ppp508_conf_t conf PACKED; /* 04: requested config. */
|
||||
unsigned short txb_num PACKED; /* 6F: number of Tx buffers */
|
||||
unsigned short rxb_num PACKED; /* 71: number of Rx buffers */
|
||||
} ppp508_get_conf_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S508 Operational Statistics (returned by the PPP_READ_STATISTIC command).
|
||||
*/
|
||||
typedef struct ppp508_stats
|
||||
{
|
||||
unsigned short reserved1 PACKED; /* 00: */
|
||||
unsigned short rx_bad_len PACKED; /* 02: */
|
||||
unsigned short reserved2 PACKED; /* 04: */
|
||||
unsigned int tx_frames PACKED; /* 06: */
|
||||
unsigned int tx_bytes PACKED; /* 0A: */
|
||||
unsigned int rx_frames PACKED; /* 0E: */
|
||||
unsigned int rx_bytes PACKED; /* 12: */
|
||||
} ppp508_stats_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Adapter Error Statistics (returned by the PPP_READ_ERROR_STATS command).
|
||||
*/
|
||||
typedef struct ppp_err_stats
|
||||
{
|
||||
unsigned char rx_overrun PACKED; /* 00: Rx overrun errors */
|
||||
unsigned char rx_bad_crc PACKED; /* 01: Rx CRC errors */
|
||||
unsigned char rx_abort PACKED; /* 02: Rx aborted frames */
|
||||
unsigned char rx_lost PACKED; /* 03: Rx frames lost */
|
||||
unsigned char tx_abort PACKED; /* 04: Tx aborted frames */
|
||||
unsigned char tx_underrun PACKED; /* 05: Tx underrun errors */
|
||||
unsigned char tx_missed_intr PACKED; /* 06: Tx underruns missed */
|
||||
unsigned char reserved PACKED; /* 07: Tx underruns missed */
|
||||
unsigned char dcd_trans PACKED; /* 08: DCD transitions */
|
||||
unsigned char cts_trans PACKED; /* 09: CTS transitions */
|
||||
} ppp_err_stats_t;
|
||||
|
||||
/* Data structure for SET_TRIGGER_INTR command
|
||||
*/
|
||||
|
||||
typedef struct ppp_intr_info{
|
||||
unsigned char i_enable PACKED; /* 0 Interrupt enable bits */
|
||||
unsigned char irq PACKED; /* 1 Irq number */
|
||||
unsigned short timer_len PACKED; /* 2 Timer delay */
|
||||
} ppp_intr_info_t;
|
||||
|
||||
|
||||
#define FT1_MONITOR_STATUS_CTRL 0x80
|
||||
#define SET_FT1_MODE 0x81
|
||||
|
||||
|
||||
|
||||
/* Special UDP drivers management commands */
|
||||
#define PPIPE_ENABLE_TRACING 0x20
|
||||
#define PPIPE_DISABLE_TRACING 0x21
|
||||
#define PPIPE_GET_TRACE_INFO 0x22
|
||||
#define PPIPE_GET_IBA_DATA 0x23
|
||||
#define PPIPE_KILL_BOARD 0x24
|
||||
#define PPIPE_FT1_READ_STATUS 0x25
|
||||
#define PPIPE_DRIVER_STAT_IFSEND 0x26
|
||||
#define PPIPE_DRIVER_STAT_INTR 0x27
|
||||
#define PPIPE_DRIVER_STAT_GEN 0x28
|
||||
#define PPIPE_FLUSH_DRIVER_STATS 0x29
|
||||
#define PPIPE_ROUTER_UP_TIME 0x30
|
||||
#define PPIPE_TE1_56K_STAT 0x40 /* TE1_56K */
|
||||
#define PPIPE_GET_MEDIA_TYPE 0x41 /* TE1_56K */
|
||||
#define PPIPE_FLUSH_TE1_PMON 0x42 /* TE1 */
|
||||
#define PPIPE_READ_REGISTER 0x43 /* TE1_56K */
|
||||
#define PPIPE_TE1_CFG 0x44 /* TE1 */
|
||||
|
||||
#define DISABLE_TRACING 0x00
|
||||
#define TRACE_SIGNALLING_FRAMES 0x01
|
||||
#define TRACE_DATA_FRAMES 0x02
|
||||
|
||||
#define UDPMGMT_SIGNATURE "PTPIPEAB"
|
||||
#define UDPDRV_SIGNATURE "DRVSTATS"
|
||||
#define UDPMGMT_UDP_PROTOCOL 0x11
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif /* _SDLA_PPP_H */
|
|
@ -127,6 +127,7 @@
|
|||
#define WAN_TE_STATS_BIT_RXLEVEL 0x0002
|
||||
|
||||
/* For T1 only */
|
||||
#define WAN_T1_LBO_NONE 0x00
|
||||
#define WAN_T1_LBO_0_DB 0x01
|
||||
#define WAN_T1_LBO_75_DB 0x02
|
||||
#define WAN_T1_LBO_15_DB 0x03
|
||||
|
@ -277,6 +278,7 @@
|
|||
#define TE_POLL_READ 0x0C
|
||||
#define TE_POLL_WRITE 0x0D
|
||||
#define TE_LINKCRIT_TIMER 0x0F
|
||||
#define WAN_TE_POLL_LINKREADY 0x10
|
||||
|
||||
/* TE1 T1/E1 interrupt setting delay */
|
||||
#define INTR_TE1_TIMER 150 /* 50 ms */
|
||||
|
@ -365,9 +367,9 @@
|
|||
#define WAN_TE_INTR_NONE 0x00
|
||||
#define WAN_TE_INTR_GLOBAL 0x01
|
||||
#define WAN_TE_INTR_BASIC 0x02
|
||||
#define WAN_TE_INTR_SIGNALLING 0x03
|
||||
#define WAN_TE_INTR_FXS_DTMF 0x04
|
||||
#define WAN_TE_INTR_PMON 0x05
|
||||
#define WAN_TE_INTR_SIGNALLING 0x04
|
||||
#define WAN_TE_INTR_FXS_DTMF 0x08
|
||||
#define WAN_TE_INTR_PMON 0x10
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* T1/E1 configuration structures.
|
||||
|
@ -563,6 +565,10 @@ typedef struct {
|
|||
|
||||
u_int16_t status_cnt;
|
||||
|
||||
int reg_dbg_busy;
|
||||
int reg_dbg_ready;
|
||||
unsigned char reg_dbg_value;
|
||||
|
||||
wan_ticks_t crit_alarm_start;
|
||||
unsigned int lb_mode;
|
||||
} sdla_te_param_t;
|
||||
|
|
|
@ -660,6 +660,8 @@
|
|||
#define BIT_LRISMR_RSMS1 0x02
|
||||
#define BIT_LRISMR_RSMS0 0x01
|
||||
|
||||
#define REG_LTXLAE 0x100C
|
||||
|
||||
/* BERT Register Definitions */
|
||||
#define REG_BLSR 0x110E
|
||||
#define BIT_BLSR_BBED 0x40
|
||||
|
|
|
@ -1,790 +0,0 @@
|
|||
/*****************************************************************************
|
||||
* sdla_x25.h Sangoma X.25 firmware API definitions.
|
||||
*
|
||||
* Author: Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
* Feb 28, 2000 Nenad Corbic Updated for socket based x25api
|
||||
* Dec 13, 1996 Gene Kozin Initial version
|
||||
*****************************************************************************/
|
||||
#ifndef _SDLA_X25_H
|
||||
#define _SDLA_X25_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Notes:
|
||||
* ------
|
||||
* 1. All structures defined in this file are byte-alined.
|
||||
* Compiler Platform
|
||||
* -------- --------
|
||||
* GNU C Linux
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <linux/wanpipe_x25_kernel.h>
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/****** CONSTANTS DEFINITIONS ***********************************************/
|
||||
|
||||
#define X25_MAX_CHAN 255 /* max number of open X.25 circuits */
|
||||
#define X25_MAX_DATA 1024 /* max length of X.25 data buffer */
|
||||
/*
|
||||
* X.25 shared memory layout.
|
||||
*/
|
||||
#define X25_MBOX_OFFS 0x16B0 /* general mailbox block */
|
||||
#define X25_RXMBOX_OFFS 0x1AD0 /* receive mailbox */
|
||||
#define X25_STATUS_OFFS 0x1EF0 /* X.25 status structure */
|
||||
#define X25_MB_VECTOR 0xE000 /* S514 mailbox window vecotr */
|
||||
#define X25_MISC_HDLC_BITS 0x1F00 /*X.25 miscallaneous HDLC bits */
|
||||
#define X25_MODEM_STATE_OFFS 0xF6AF /* Mode state offset */
|
||||
#define X25_TX_TIMEOUT_OFFS 0xF6AE /* Tx Timeout: detect no tx clock */
|
||||
|
||||
/* code levels */
|
||||
#define HDLC_LEVEL 0x01
|
||||
#define X25_LEVEL 0x02
|
||||
#define X25_AND_HDLC_LEVEL 0x03
|
||||
#define DO_HDLC_LEVEL_ERROR_CHECKING 0x04
|
||||
|
||||
/****** DATA STRUCTURES *****************************************************/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X.25 Command Block.
|
||||
*/
|
||||
typedef struct X25Cmd
|
||||
{
|
||||
unsigned char command PACKED; /* command code */
|
||||
unsigned short length PACKED; /* transfer data length */
|
||||
unsigned char result PACKED; /* return code */
|
||||
unsigned char pf PACKED; /* P/F bit */
|
||||
unsigned short lcn PACKED; /* logical channel */
|
||||
unsigned char qdm PACKED; /* Q/D/M bits */
|
||||
unsigned char cause PACKED; /* cause field */
|
||||
unsigned char diagn PACKED; /* diagnostics */
|
||||
unsigned char pktType PACKED; /* packet type */
|
||||
unsigned char resrv[4] PACKED; /* reserved */
|
||||
} TX25Cmd;
|
||||
|
||||
/*
|
||||
* Defines for the 'command' field.
|
||||
*/
|
||||
/*----- General commands --------------*/
|
||||
#define X25_SET_GLOBAL_VARS 0x0B /* set global variables */
|
||||
#define X25_READ_MODEM_STATUS 0x0C /* read modem status */
|
||||
#define X25_READ_CODE_VERSION 0x15 /* read firmware version number */
|
||||
#define X25_TRACE_CONFIGURE 0x14 /* configure trace facility */
|
||||
#define X25_READ_TRACE_DATA 0x16 /* read trace data */
|
||||
#define X25_SET_INTERRUPT_MODE 0x17 /* set interrupt generation mode */
|
||||
#define X25_READ_INTERRUPT_MODE 0x18 /* read interrupt generation mode */
|
||||
/*----- HDLC-level commands -----------*/
|
||||
#define X25_HDLC_LINK_CONFIGURE 0x01 /* configure HDLC link level */
|
||||
#define X25_HDLC_LINK_OPEN 0x02 /* open HDLC link */
|
||||
#define X25_HDLC_LINK_CLOSE 0x03 /* close HDLC link */
|
||||
#define X25_HDLC_LINK_SETUP 0x04 /* set up HDLC link */
|
||||
#define X25_HDLC_LINK_DISC 0x05 /* disconnect DHLC link */
|
||||
#define X25_HDLC_LINK_STATUS 0x06 /* read DHLC link status */
|
||||
#define X25_HDLC_READ_STATS 0x07 /* read operational statistics */
|
||||
#define X25_HDLC_FLUSH_STATS 0x08 /* flush operational statistics */
|
||||
#define X25_HDLC_READ_COMM_ERR 0x09 /* read error statistics */
|
||||
#define X25_HDLC_FLUSH_COMM_ERR 0x0A /* flush error statistics */
|
||||
#define X25_HDLC_FLUSH_BUFFERS 0x0D /* flush HDLC-level data buffers */
|
||||
#define X25_HDLC_SPRVS_CNT_STAT 0x0F /* read surervisory count status */
|
||||
#define X25_HDLC_SEND_UI_FRAME 0x10 /* send unnumbered information frame */
|
||||
#define X25_HDLC_WRITE 0x11 /* send HDLC information frame */
|
||||
#define X25_HDLC_READ 0x21 /* read HDLC information frame */
|
||||
#define X25_HDLC_READ_CONFIG 0x12 /* read HDLC configuration */
|
||||
#define X25_HDLC_SET_CONFIG 0x13 /* set HDLC configuration */
|
||||
#define SET_PROTOCOL_LEVEL 0x1F /* set protocol level */
|
||||
/*----- X.25-level commands -----------*/
|
||||
#define X25_READ 0x22 /* read X.25 packet */
|
||||
#define X25_WRITE 0x23 /* send X.25 packet */
|
||||
#define X25_PLACE_CALL 0x30 /* place a call on SVC */
|
||||
#define X25_ACCEPT_CALL 0x31 /* accept incomming call */
|
||||
#define X25_CLEAR_CALL 0x32 /* clear call */
|
||||
#define X25_CLEAR_CONFRM 0x33 /* send clear confirmation packet */
|
||||
#define X25_RESET 0x34 /* send reset request packet */
|
||||
#define X25_RESET_CONFRM 0x35 /* send reset confirmation packet */
|
||||
#define X25_RESTART 0x36 /* send restart request packet */
|
||||
#define X25_RESTART_CONFRM 0x37 /* send restart confirmation packet */
|
||||
#define X25_WP_INTERRUPT 0x38 /* send interrupt request packet */
|
||||
#define X25_INTERRUPT_CONFRM 0x39 /* send interrupt confirmation pkt */
|
||||
#define X25_REGISTRATION_RQST 0x3A /* send registration request packet */
|
||||
#define X25_REGISTRATION_CONFRM 0x3B /* send registration confirmation */
|
||||
#define X25_IS_DATA_AVAILABLE 0x40 /* querry receive queue */
|
||||
#define X25_INCOMMING_CALL_CTL 0x41 /* select incomming call options */
|
||||
#define X25_CONFIGURE_PVC 0x42 /* configure PVC */
|
||||
#define X25_GET_ACTIVE_CHANNELS 0x43 /* get a list of active circuits */
|
||||
#define X25_READ_CHANNEL_CONFIG 0x44 /* read virt. circuit configuration */
|
||||
#define X25_FLUSH_DATA_BUFFERS 0x45 /* flush X.25-level data buffers */
|
||||
#define X25_READ_HISTORY_TABLE 0x46 /* read asynchronous event log */
|
||||
#define X25_HISTORY_TABLE_CTL 0x47 /* control asynchronous event log */
|
||||
#define X25_GET_TX_D_BIT_STATUS 0x48 /* is packet with D-bit acknowleged */
|
||||
#define X25_READ_STATISTICS 0x49 /* read X.25-level statistics */
|
||||
#define X25_FLUSH_STATISTICS 0x4A /* flush X.25-level statistics */
|
||||
#define X25_READ_CONFIGURATION 0x50 /* read HDLC & X.25 configuration */
|
||||
#define X25_SET_CONFIGURATION 0x51 /* set HDLC & X.25 configuration */
|
||||
|
||||
/*
|
||||
* Defines for the 'result' field.
|
||||
*/
|
||||
/*----- General results ---------------*/
|
||||
#define X25RES_OK 0x00
|
||||
#define X25RES_ERROR 0x01
|
||||
#define X25RES_LINK_NOT_IN_ABM 0x02 /* link is not in ABM mode */
|
||||
#define X25RES_LINK_CLOSED 0x03
|
||||
#define X25RES_INVAL_LENGTH 0x04
|
||||
#define X25RES_INVAL_CMD 0x05
|
||||
#define X25RES_UNNUMBERED_FRAME 0x06 /* unnunbered frame received */
|
||||
#define X25RES_FRM_REJECT_MODE 0x07 /* link is in Frame Reject mode */
|
||||
#define X25RES_MODEM_FAILURE 0x08 /* DCD and/or CTS dropped */
|
||||
#define X25RES_N2_RETRY_LIMIT 0x09 /* N2 retry limit has been exceeded */
|
||||
#define X25RES_INVAL_LCN 0x30 /* invalid logical channel number */
|
||||
#define X25RES_INVAL_STATE 0x31 /* channel is not in data xfer mode */
|
||||
#define X25RES_INVAL_DATA_LEN 0x32 /* invalid data length */
|
||||
#define X25RES_NOT_READY 0x33 /* no data available / buffers full */
|
||||
#define X25RES_NETWORK_DOWN 0x34
|
||||
#define X25RES_CHANNEL_IN_USE 0x35 /* there is data queued on this LCN */
|
||||
#define X25RES_REGST_NOT_SUPPRT 0x36 /* registration not supported */
|
||||
#define X25RES_INVAL_FORMAT 0x37 /* invalid packet format */
|
||||
#define X25RES_D_BIT_NOT_SUPPRT 0x38 /* D-bit pragmatics not supported */
|
||||
#define X25RES_FACIL_NOT_SUPPRT 0x39 /* Call facility not supported */
|
||||
#define X25RES_INVAL_CALL_ARG 0x3A /* errorneous call arguments */
|
||||
#define X25RES_INVAL_CALL_DATA 0x3B /* errorneous call user data */
|
||||
#define X25RES_ASYNC_PACKET 0x40 /* asynchronous packet received */
|
||||
#define X25RES_PROTO_VIOLATION 0x41 /* protocol violation occured */
|
||||
#define X25RES_PKT_TIMEOUT 0x42 /* X.25 packet time out */
|
||||
#define X25RES_PKT_RETRY_LIMIT 0x43 /* X.25 packet retry limit exceeded */
|
||||
/*----- Command-dependant results -----*/
|
||||
#define X25RES_LINK_DISC 0x00 /* HDLC_LINK_STATUS */
|
||||
#define X25RES_LINK_IN_ABM 0x01 /* HDLC_LINK_STATUS */
|
||||
#define X25RES_NO_DATA 0x01 /* HDLC_READ/READ_TRACE_DATA*/
|
||||
#define X25RES_TRACE_INACTIVE 0x02 /* READ_TRACE_DATA */
|
||||
#define X25RES_LINK_IS_OPEN 0x01 /* HDLC_LINK_OPEN */
|
||||
#define X25RES_LINK_IS_DISC 0x02 /* HDLC_LINK_DISC */
|
||||
#define X25RES_LINK_IS_CLOSED 0x03 /* HDLC_LINK_CLOSE */
|
||||
#define X25RES_INVAL_PARAM 0x31 /* INCOMMING_CALL_CTL */
|
||||
#define X25RES_INVAL_CONFIG 0x35 /* REGISTR_RQST/CONFRM */
|
||||
|
||||
/*
|
||||
* Defines for the 'qdm_bits' field.
|
||||
*/
|
||||
#define X25CMD_Q_BIT_MASK 0x04
|
||||
#define X25CMD_D_BIT_MASK 0x02
|
||||
#define X25CMD_M_BIT_MASK 0x01
|
||||
|
||||
/*
|
||||
* Defines for the 'pkt_type' field.
|
||||
*/
|
||||
/*----- Asynchronous events ------*/
|
||||
|
||||
#define ASE_LAPB_DOWN 0x00
|
||||
#define ASE_MODEM_DOWN X25_READ_MODEM_STATUS
|
||||
|
||||
#define ASE_CLEAR_RQST 0x02
|
||||
#define ASE_RESET_RQST 0x04
|
||||
#define ASE_RESTART_RQST 0x08
|
||||
#define ASE_INTERRUPT 0x10
|
||||
#define ASE_DTE_REGISTR_RQST 0x20
|
||||
#define ASE_CALL_RQST 0x30
|
||||
#define ASE_CALL_ACCEPTED 0x31
|
||||
#define ASE_CLEAR_CONFRM 0x32
|
||||
#define ASE_RESET_CONFRM 0x33
|
||||
#define ASE_RESTART_CONFRM 0x34
|
||||
#define ASE_INTERRUPT_CONFRM 0x35
|
||||
#define ASE_DCE_REGISTR_CONFRM 0x36
|
||||
#define ASE_DIAGNOSTIC 0x37
|
||||
#define ASE_CALL_AUTO_CLEAR 0x38
|
||||
#define AUTO_RESPONSE_FLAG 0x80
|
||||
/*----- Time-Out events ----------*/
|
||||
#define TOE_RESTART_RQST 0x03
|
||||
#define TOE_CALL_RQST 0x05
|
||||
#define TOE_CLEAR_RQST 0x08
|
||||
#define TOE_RESET_RQST 0x0A
|
||||
/*----- Protocol Violation events */
|
||||
#define PVE_CLEAR_RQST 0x32
|
||||
#define PVE_RESET_RQST 0x33
|
||||
#define PVE_RESTART_RQST 0x34
|
||||
#define PVE_DIAGNOSTIC 0x37
|
||||
|
||||
#define INTR_ON_RX_FRAME 0x01
|
||||
#define INTR_ON_TX_FRAME 0x02
|
||||
#define INTR_ON_MODEM_STATUS_CHANGE 0x04
|
||||
#define INTR_ON_COMMAND_COMPLETE 0x08
|
||||
#define INTR_ON_X25_ASY_TRANSACTION 0x10
|
||||
#define INTR_ON_TRACE_DATA 0x20
|
||||
#define INTR_ON_TIMER 0x40
|
||||
#define DIRECT_RX_INTR_USAGE 0x80
|
||||
|
||||
#define NO_INTR_PENDING 0x00
|
||||
#define RX_INTR_PENDING 0x01
|
||||
#define TX_INTR_PENDING 0x02
|
||||
#define MODEM_INTR_PENDING 0x04
|
||||
#define COMMAND_COMPLETE_INTR_PENDING 0x08
|
||||
#define X25_ASY_TRANS_INTR_PENDING 0x10
|
||||
#define TRACE_INTR_PENDING 0x20
|
||||
#define TIMER_INTR_PENDING 0x40
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X.25 Mailbox.
|
||||
* This structure is located at offsets X25_MBOX_OFFS and X25_RXMBOX_OFFS
|
||||
* into shared memory window.
|
||||
*/
|
||||
typedef struct X25Mbox
|
||||
{
|
||||
unsigned char opflag PACKED; /* 00h: execution flag */
|
||||
TX25Cmd cmd PACKED; /* 01h: command block */
|
||||
unsigned char data[1] PACKED; /* 10h: data buffer */
|
||||
} TX25Mbox;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X.25 Time Stamp Structure.
|
||||
*/
|
||||
typedef struct X25TimeStamp
|
||||
{
|
||||
unsigned char month PACKED;
|
||||
unsigned char date PACKED;
|
||||
unsigned char sec PACKED;
|
||||
unsigned char min PACKED;
|
||||
unsigned char hour PACKED;
|
||||
} TX25TimeStamp;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X.25 Status Block.
|
||||
* This structure is located at offset X25_STATUS_OFF into shared memory
|
||||
* window.
|
||||
*/
|
||||
typedef struct X25Status
|
||||
{
|
||||
unsigned short pvc_map PACKED; /* 00h: PVC map */
|
||||
unsigned short icc_map PACKED; /* 02h: Incomming Chan. map */
|
||||
unsigned short twc_map PACKED; /* 04h: Two-way Cnan. map */
|
||||
unsigned short ogc_map PACKED; /* 06h: Outgoing Chan. map */
|
||||
TX25TimeStamp tstamp PACKED; /* 08h: timestamp (BCD) */
|
||||
unsigned char iflags PACKED; /* 0Dh: interrupt flags */
|
||||
unsigned char imask PACKED; /* 0Eh: interrupt mask */
|
||||
unsigned char resrv PACKED; /* 0Eh: */
|
||||
unsigned char gflags PACKED; /* 10h: misc. HDLC/X25 flags */
|
||||
unsigned char cflags[X25_MAX_CHAN] PACKED; /* channel status bytes */
|
||||
} TX25Status;
|
||||
|
||||
/*
|
||||
* Bitmasks for the 'iflags' field.
|
||||
*/
|
||||
#define X25_RX_INTR 0x01 /* receive interrupt */
|
||||
#define X25_TX_INTR 0x02 /* transmit interrupt */
|
||||
#define X25_MODEM_INTR 0x04 /* modem status interrupt (CTS/DCD) */
|
||||
#define X25_EVENT_INTR 0x10 /* asyncronous event encountered */
|
||||
#define X25_CMD_INTR 0x08 /* interface command complete */
|
||||
|
||||
/*
|
||||
* Bitmasks for the 'gflags' field.
|
||||
*/
|
||||
#define X25_HDLC_ABM 0x01 /* HDLC is in ABM mode */
|
||||
#define X25_RX_READY 0x02 /* X.25 data available */
|
||||
#define X25_TRACE_READY 0x08 /* trace data available */
|
||||
#define X25_EVENT_IND 0x20 /* asynchronous event indicator */
|
||||
#define X25_TX_READY 0x40 /* space is available in Tx buf.*/
|
||||
|
||||
/*
|
||||
* Bitmasks for the 'cflags' field.
|
||||
*/
|
||||
#define X25_XFER_MODE 0x80 /* channel is in data transfer mode */
|
||||
#define X25_TXWIN_OPEN 0x40 /* transmit window open */
|
||||
#define X25_RXBUF_MASK 0x3F /* number of data buffers available */
|
||||
|
||||
/*****************************************************************************
|
||||
* Following definitions structurize contents of the TX25Mbox.data field for
|
||||
* different X.25 interface commands.
|
||||
****************************************************************************/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_SET_GLOBAL_VARS Command.
|
||||
*/
|
||||
typedef struct X25GlobalVars
|
||||
{
|
||||
unsigned char resrv PACKED; /* 00h: reserved */
|
||||
unsigned char dtrCtl PACKED; /* 01h: DTR control code */
|
||||
unsigned char resErr PACKED; /* 01h: '1' - reset modem error */
|
||||
} TX25GlobalVars;
|
||||
|
||||
/*
|
||||
* Defines for the 'dtrCtl' field.
|
||||
*/
|
||||
#define X25_RAISE_DTR 0x01
|
||||
#define X25_DROP_DTR 0x02
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_READ_MODEM_STATUS Command.
|
||||
*/
|
||||
typedef struct X25ModemStatus
|
||||
{
|
||||
unsigned char status PACKED; /* 00h: modem status */
|
||||
} TX25ModemStatus;
|
||||
|
||||
/*
|
||||
* Defines for the 'status' field.
|
||||
*/
|
||||
#define X25_CTS_MASK 0x20
|
||||
#define X25_DCD_MASK 0x08
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_HDLC_LINK_STATUS Command.
|
||||
*/
|
||||
typedef struct X25LinkStatus
|
||||
{
|
||||
unsigned char txQueued PACKED; /* 00h: queued Tx I-frames*/
|
||||
unsigned char rxQueued PACKED; /* 01h: queued Rx I-frames*/
|
||||
unsigned char station PACKED; /* 02h: DTE/DCE config. */
|
||||
unsigned char reserved PACKED; /* 03h: reserved */
|
||||
unsigned char sfTally PACKED; /* 04h: supervisory frame tally */
|
||||
} TX25LinkStatus;
|
||||
|
||||
/*
|
||||
* Defines for the 'station' field.
|
||||
*/
|
||||
#define X25_STATION_DTE 0x01 /* station configured as DTE */
|
||||
#define X25_STATION_DCE 0x02 /* station configured as DCE */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_HDLC_READ_STATS Command.
|
||||
*/
|
||||
typedef struct HdlcStats
|
||||
{ /* a number of ... */
|
||||
unsigned short rxIFrames PACKED; /* 00h: ready Rx I-frames */
|
||||
unsigned short rxNoseq PACKED; /* 02h: frms out-of-sequence */
|
||||
unsigned short rxNodata PACKED; /* 04h: I-frms without data */
|
||||
unsigned short rxDiscarded PACKED; /* 06h: discarded frames */
|
||||
unsigned short rxTooLong PACKED; /* 08h: frames too long */
|
||||
unsigned short rxBadAddr PACKED; /* 0Ah: frms with inval.addr*/
|
||||
unsigned short txAcked PACKED; /* 0Ch: acknowledged I-frms */
|
||||
unsigned short txRetransm PACKED; /* 0Eh: re-transmit. I-frms */
|
||||
unsigned short t1Timeout PACKED; /* 10h: T1 timeouts */
|
||||
unsigned short rxSABM PACKED; /* 12h: received SABM frames */
|
||||
unsigned short rxDISC PACKED; /* 14h: received DISC frames */
|
||||
unsigned short rxDM PACKED; /* 16h: received DM frames */
|
||||
unsigned short rxFRMR PACKED; /* 18h: FRMR frames received */
|
||||
unsigned short txSABM PACKED; /* 1Ah: transm. SABM frames*/
|
||||
unsigned short txDISC PACKED; /* 1Ch: transm. DISC frames*/
|
||||
unsigned short txDM PACKED; /* 1Eh: transm. DM frames */
|
||||
unsigned short txFRMR PACKED; /* 20h: transm. FRMR frames*/
|
||||
} THdlcStats;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_HDLC_READ_COMM_ERR Command.
|
||||
*/
|
||||
typedef struct HdlcCommErr
|
||||
{ /* a number of ... */
|
||||
unsigned char rxOverrun PACKED; /* 00h: Rx overrun errors */
|
||||
unsigned char rxBadCrc PACKED; /* 01h: Rx CRC errors */
|
||||
unsigned char rxAborted PACKED; /* 02h: Rx aborted frames */
|
||||
unsigned char rxDropped PACKED; /* 03h: frames lost */
|
||||
unsigned char txAborted PACKED; /* 04h: Tx aborted frames */
|
||||
unsigned char txUnderrun PACKED; /* 05h: Tx underrun errors */
|
||||
unsigned char txMissIntr PACKED; /* 06h: missed underrun ints */
|
||||
unsigned char reserved PACKED; /* 07h: reserved */
|
||||
unsigned char droppedDCD PACKED; /* 08h: times DCD dropped */
|
||||
unsigned char droppedCTS PACKED; /* 09h: times CTS dropped */
|
||||
} THdlcCommErr;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_SET_CONFIGURATION & X25_READ_CONFIGURATION Commands.
|
||||
*/
|
||||
typedef struct X25Config
|
||||
{
|
||||
unsigned char baudRate PACKED; /* 00h: */
|
||||
unsigned char t1 PACKED; /* 01h: */
|
||||
unsigned char t2 PACKED; /* 02h: */
|
||||
unsigned char n2 PACKED; /* 03h: */
|
||||
unsigned short hdlcMTU PACKED; /* 04h: */
|
||||
unsigned char hdlcWindow PACKED; /* 06h: */
|
||||
unsigned char t4 PACKED; /* 07h: */
|
||||
unsigned char autoModem PACKED; /* 08h: */
|
||||
unsigned char autoHdlc PACKED; /* 09h: */
|
||||
unsigned char hdlcOptions PACKED; /* 0Ah: */
|
||||
unsigned char station PACKED; /* 0Bh: */
|
||||
unsigned char pktWindow PACKED; /* 0Ch: */
|
||||
unsigned short defPktSize PACKED; /* 0Dh: */
|
||||
unsigned short pktMTU PACKED; /* 0Fh: */
|
||||
unsigned short loPVC PACKED; /* 11h: */
|
||||
unsigned short hiPVC PACKED; /* 13h: */
|
||||
unsigned short loIncommingSVC PACKED; /* 15h: */
|
||||
unsigned short hiIncommingSVC PACKED; /* 17h: */
|
||||
unsigned short loTwoWaySVC PACKED; /* 19h: */
|
||||
unsigned short hiTwoWaySVC PACKED; /* 1Bh: */
|
||||
unsigned short loOutgoingSVC PACKED; /* 1Dh: */
|
||||
unsigned short hiOutgoingSVC PACKED; /* 1Fh: */
|
||||
unsigned short options PACKED; /* 21h: */
|
||||
unsigned char responseOpt PACKED; /* 23h: */
|
||||
unsigned short facil1 PACKED; /* 24h: */
|
||||
unsigned short facil2 PACKED; /* 26h: */
|
||||
unsigned short ccittFacil PACKED; /* 28h: */
|
||||
unsigned short otherFacil PACKED; /* 2Ah: */
|
||||
unsigned short ccittCompat PACKED; /* 2Ch: */
|
||||
unsigned char t10t20 PACKED; /* 2Eh: */
|
||||
unsigned char t11t21 PACKED; /* 2Fh: */
|
||||
unsigned char t12t22 PACKED; /* 30h: */
|
||||
unsigned char t13t23 PACKED; /* 31h: */
|
||||
unsigned char t16t26 PACKED; /* 32H: */
|
||||
unsigned char t28 PACKED; /* 33h: */
|
||||
unsigned char r10r20 PACKED; /* 34h: */
|
||||
unsigned char r12r22 PACKED; /* 35h: */
|
||||
unsigned char r13r23 PACKED; /* 36h: */
|
||||
} TX25Config;
|
||||
|
||||
#define X25_PACKET_WINDOW 0x02 /* Default value for Window Size */
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_READ_CHANNEL_CONFIG Command.
|
||||
*/
|
||||
typedef struct X25ChanAlloc /*----- Channel allocation -*/
|
||||
{
|
||||
unsigned short loPVC PACKED; /* 00h: lowest PVC number */
|
||||
unsigned short hiPVC PACKED; /* 02h: highest PVC number */
|
||||
unsigned short loIncommingSVC PACKED; /* 04h: lowest incoming SVC */
|
||||
unsigned short hiIncommingSVC PACKED; /* 06h: highest incoming SVC */
|
||||
unsigned short loTwoWaySVC PACKED; /* 08h: lowest two-way SVC */
|
||||
unsigned short hiTwoWaySVC PACKED; /* 0Ah: highest two-way SVC */
|
||||
unsigned short loOutgoingSVC PACKED; /* 0Ch: lowest outgoing SVC */
|
||||
unsigned short hiOutgoingSVC PACKED; /* 0Eh: highest outgoing SVC */
|
||||
} TX25ChanAlloc;
|
||||
|
||||
typedef struct X25ChanCfg /*------ Channel configuration -----*/
|
||||
{
|
||||
unsigned char type PACKED; /* 00h: channel type */
|
||||
unsigned char txConf PACKED; /* 01h: Tx packet and window sizes */
|
||||
unsigned char rxConf PACKED; /* 01h: Rx packet and window sizes */
|
||||
} TX25ChanCfg;
|
||||
|
||||
/*
|
||||
* Defines for the 'type' field.
|
||||
*/
|
||||
#define X25_PVC 0x01 /* PVC */
|
||||
#define X25_SVC_IN 0x03 /* Incoming SVC */
|
||||
#define X25_SVC_TWOWAY 0x07 /* Two-way SVC */
|
||||
#define X25_SVC_OUT 0x0B /* Outgoing SVC */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X25_READ_STATISTICS Command.
|
||||
*/
|
||||
typedef struct X25Stats
|
||||
{ /* number of packets Tx/Rx'ed */
|
||||
unsigned short txRestartRqst PACKED; /* 00h: Restart Request */
|
||||
unsigned short rxRestartRqst PACKED; /* 02h: Restart Request */
|
||||
unsigned short txRestartConf PACKED; /* 04h: Restart Confirmation */
|
||||
unsigned short rxRestartConf PACKED; /* 06h: Restart Confirmation */
|
||||
unsigned short txResetRqst PACKED; /* 08h: Reset Request */
|
||||
unsigned short rxResetRqst PACKED; /* 0Ah: Reset Request */
|
||||
unsigned short txResetConf PACKED; /* 0Ch: Reset Confirmation */
|
||||
unsigned short rxResetConf PACKED; /* 0Eh: Reset Confirmation */
|
||||
unsigned short txCallRequest PACKED; /* 10h: Call Request */
|
||||
unsigned short rxCallRequest PACKED; /* 12h: Call Request */
|
||||
unsigned short txCallAccept PACKED; /* 14h: Call Accept */
|
||||
unsigned short rxCallAccept PACKED; /* 16h: Call Accept */
|
||||
unsigned short txClearRqst PACKED; /* 18h: Clear Request */
|
||||
unsigned short rxClearRqst PACKED; /* 1Ah: Clear Request */
|
||||
unsigned short txClearConf PACKED; /* 1Ch: Clear Confirmation */
|
||||
unsigned short rxClearConf PACKED; /* 1Eh: Clear Confirmation */
|
||||
unsigned short txDiagnostic PACKED; /* 20h: Diagnostic */
|
||||
unsigned short rxDiagnostic PACKED; /* 22h: Diagnostic */
|
||||
unsigned short txRegRqst PACKED; /* 24h: Registration Request */
|
||||
unsigned short rxRegRqst PACKED; /* 26h: Registration Request */
|
||||
unsigned short txRegConf PACKED; /* 28h: Registration Confirm.*/
|
||||
unsigned short rxRegConf PACKED; /* 2Ah: Registration Confirm.*/
|
||||
unsigned short txInterrupt PACKED; /* 2Ch: Interrupt */
|
||||
unsigned short rxInterrupt PACKED; /* 2Eh: Interrupt */
|
||||
unsigned short txIntrConf PACKED; /* 30h: Interrupt Confirm. */
|
||||
unsigned short rxIntrConf PACKED; /* 32h: Interrupt Confirm. */
|
||||
unsigned short txData PACKED; /* 34h: Data */
|
||||
unsigned short rxData PACKED; /* 36h: Data */
|
||||
unsigned short txRR PACKED; /* 38h: RR */
|
||||
unsigned short rxRR PACKED; /* 3Ah: RR */
|
||||
unsigned short txRNR PACKED; /* 3Ch: RNR */
|
||||
unsigned short rxRNR PACKED; /* 3Eh: RNR */
|
||||
} TX25Stats;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* X25_READ_HISTORY_TABLE Command.
|
||||
*/
|
||||
typedef struct X25EventLog
|
||||
{
|
||||
unsigned char type PACKED; /* 00h: transaction type */
|
||||
unsigned short lcn PACKED; /* 01h: logical channel num */
|
||||
unsigned char packet PACKED; /* 03h: async packet type */
|
||||
unsigned char cause PACKED; /* 04h: X.25 cause field */
|
||||
unsigned char diag PACKED; /* 05h: X.25 diag field */
|
||||
TX25TimeStamp ts PACKED; /* 06h: time stamp */
|
||||
} TX25EventLog;
|
||||
|
||||
/*
|
||||
* Defines for the 'type' field.
|
||||
*/
|
||||
#define X25LOG_INCOMMING 0x00
|
||||
#define X25LOG_APPLICATION 0x01
|
||||
#define X25LOG_AUTOMATIC 0x02
|
||||
#define X25LOG_ERROR 0x04
|
||||
#define X25LOG_TIMEOUT 0x08
|
||||
#define X25LOG_RECOVERY 0x10
|
||||
|
||||
/*
|
||||
* Defines for the 'packet' field.
|
||||
*/
|
||||
#define X25LOG_CALL_RQST 0x0B
|
||||
#define X25LOG_CALL_ACCEPTED 0x0F
|
||||
#define X25LOG_CLEAR_RQST 0x13
|
||||
#define X25LOG_CLEAR_CONFRM 0x17
|
||||
#define X25LOG_RESET_RQST 0x1B
|
||||
#define X25LOG_RESET_CONFRM 0x1F
|
||||
#define X25LOG_RESTART_RQST 0xFB
|
||||
#define X25LOG_RESTART_COMFRM 0xFF
|
||||
#define X25LOG_DIAGNOSTIC 0xF1
|
||||
#define X25LOG_DTE_REG_RQST 0xF3
|
||||
#define X25LOG_DTE_REG_COMFRM 0xF7
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_TRACE_CONFIGURE Command.
|
||||
*/
|
||||
typedef struct X25TraceCfg
|
||||
{
|
||||
unsigned char flags PACKED; /* 00h: trace configuration flags */
|
||||
unsigned char timeout PACKED; /* 01h: timeout for trace delay mode*/
|
||||
} TX25TraceCfg;
|
||||
|
||||
/*
|
||||
* Defines for the 'flags' field.
|
||||
*/
|
||||
#define X25_TRC_ENABLE 0x01 /* bit0: '1' - trace enabled */
|
||||
#define X25_TRC_TIMESTAMP 0x02 /* bit1: '1' - time stamping enabled*/
|
||||
#define X25_TRC_DELAY 0x04 /* bit2: '1' - trace delay enabled */
|
||||
#define X25_TRC_DATA 0x08 /* bit3: '1' - trace data packets */
|
||||
#define X25_TRC_SUPERVISORY 0x10 /* bit4: '1' - trace suprvisory pkts*/
|
||||
#define X25_TRC_ASYNCHRONOUS 0x20 /* bit5: '1' - trace asynch. packets*/
|
||||
#define X25_TRC_HDLC 0x40 /* bit6: '1' - trace all packets */
|
||||
#define X25_TRC_READ 0x80 /* bit7: '1' - get current config. */
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* X25_READ_TRACE_DATA Command.
|
||||
*/
|
||||
typedef struct X25Trace /*----- Trace data structure -------*/
|
||||
{
|
||||
unsigned short length PACKED; /* 00h: trace data length */
|
||||
unsigned char type PACKED; /* 02h: trace type */
|
||||
unsigned char lost_cnt PACKED; /* 03h: N of traces lost */
|
||||
TX25TimeStamp tstamp PACKED; /* 04h: mon/date/sec/min/hour */
|
||||
unsigned short millisec PACKED; /* 09h: ms time stamp */
|
||||
unsigned char data[0] PACKED; /* 0Bh: traced frame */
|
||||
} TX25Trace;
|
||||
|
||||
/*
|
||||
* Defines for the 'type' field.
|
||||
*/
|
||||
#define X25_TRC_TYPE_MASK 0x0F /* bits 0..3: trace type */
|
||||
#define X25_TRC_TYPE_RX_FRAME 0x00 /* received frame trace */
|
||||
#define X25_TRC_TYPE_TX_FRAME 0x01 /* transmitted frame */
|
||||
#define X25_TRC_TYPE_ERR_FRAME 0x02 /* error frame */
|
||||
|
||||
#define X25_TRC_ERROR_MASK 0xF0 /* bits 4..7: error code */
|
||||
#define X25_TRCERR_RX_ABORT 0x10 /* receive abort error */
|
||||
#define X25_TRCERR_RX_BADCRC 0x20 /* receive CRC error */
|
||||
#define X25_TRCERR_RX_OVERRUN 0x30 /* receiver overrun error */
|
||||
#define X25_TRCERR_RX_TOO_LONG 0x40 /* excessive frame length error */
|
||||
#define X25_TRCERR_TX_ABORT 0x70 /* aborted frame transmittion error */
|
||||
#define X25_TRCERR_TX_UNDERRUN 0x80 /* transmit underrun error */
|
||||
|
||||
/*****************************************************************************
|
||||
* Following definitions describe HDLC frame and X.25 packet formats.
|
||||
****************************************************************************/
|
||||
|
||||
typedef struct HDLCFrame /*----- DHLC Frame Format ----------*/
|
||||
{
|
||||
unsigned char addr PACKED; /* address field */
|
||||
unsigned char cntl PACKED; /* control field */
|
||||
unsigned char data[0] PACKED;
|
||||
} THDLCFrame;
|
||||
|
||||
typedef struct X25Pkt /*----- X.25 Paket Format ----------*/
|
||||
{
|
||||
unsigned char lcn_hi PACKED; /* 4 MSB of Logical Channel Number */
|
||||
unsigned char lcn_lo PACKED; /* 8 LSB of Logical Channel Number */
|
||||
unsigned char type PACKED;
|
||||
unsigned char data[0] PACKED;
|
||||
} TX25Pkt;
|
||||
|
||||
/*
|
||||
* Defines for the 'lcn_hi' field.
|
||||
*/
|
||||
#define X25_Q_BIT_MASK 0x80 /* Data Qualifier Bit mask */
|
||||
#define X25_D_BIT_MASK 0x40 /* Delivery Confirmation Bit mask */
|
||||
#define X25_M_BITS_MASK 0x30 /* Modulo Bits mask */
|
||||
#define X25_LCN_MSB_MASK 0x0F /* LCN most significant bits mask */
|
||||
|
||||
/*
|
||||
* Defines for the 'type' field.
|
||||
*/
|
||||
#define X25PKT_DATA 0x01 /* Data packet mask */
|
||||
#define X25PKT_SUPERVISORY 0x02 /* Supervisory packet mask */
|
||||
#define X25PKT_CALL_RQST 0x0B /* Call Request/Incoming */
|
||||
#define X25PKT_CALL_ACCEPTED 0x0F /* Call Accepted/Connected */
|
||||
#define X25PKT_CLEAR_RQST 0x13 /* Clear Request/Indication */
|
||||
#define X25PKT_CLEAR_CONFRM 0x17 /* Clear Confirmation */
|
||||
#define X25PKT_RESET_RQST 0x1B /* Reset Request/Indication */
|
||||
#define X25PKT_RESET_CONFRM 0x1F /* Reset Confirmation */
|
||||
#define X25PKT_RESTART_RQST 0xFB /* Restart Request/Indication */
|
||||
#define X25PKT_RESTART_CONFRM 0xFF /* Restart Confirmation */
|
||||
#define X25PKT_INTERRUPT 0x23 /* Interrupt */
|
||||
#define X25PKT_INTERRUPT_CONFRM 0x27 /* Interrupt Confirmation */
|
||||
#define X25PKT_DIAGNOSTIC 0xF1 /* Diagnostic */
|
||||
#define X25PKT_REGISTR_RQST 0xF3 /* Registration Request */
|
||||
#define X25PKT_REGISTR_CONFRM 0xF7 /* Registration Confirmation */
|
||||
#define X25PKT_RR_MASKED 0x01 /* Receive Ready packet after masking */
|
||||
#define X25PKT_RNR_MASKED 0x05 /* Receive Not Ready after masking */
|
||||
|
||||
|
||||
typedef struct {
|
||||
TX25Cmd cmd PACKED;
|
||||
char data[X25_MAX_DATA] PACKED;
|
||||
} mbox_cmd_t;
|
||||
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
unsigned char qdm PACKED; /* Q/D/M bits */
|
||||
unsigned char cause PACKED; /* cause field */
|
||||
unsigned char diagn PACKED; /* diagnostics */
|
||||
unsigned char pktType PACKED;
|
||||
unsigned short length PACKED;
|
||||
unsigned char result PACKED;
|
||||
unsigned short lcn PACKED;
|
||||
unsigned short mtu PACKED;
|
||||
unsigned short mru PACKED;
|
||||
char reserved[3] PACKED;
|
||||
}x25api_hdr_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
x25api_hdr_t hdr PACKED;
|
||||
char data[X25_MAX_DATA] PACKED;
|
||||
}x25api_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XPIPEMON Definitions
|
||||
*/
|
||||
|
||||
/* valid ip_protocol for UDP management */
|
||||
#define UDPMGMT_UDP_PROTOCOL 0x11
|
||||
#define UDPMGMT_XPIPE_SIGNATURE "XLINK8ND"
|
||||
#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS"
|
||||
|
||||
/* values for request/reply byte */
|
||||
#define UDPMGMT_REQUEST 0x01
|
||||
#define UDPMGMT_REPLY 0x02
|
||||
#define UDP_OFFSET 12
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
unsigned char opp_flag PACKED; /* the opp flag */
|
||||
unsigned char command PACKED; /* command code */
|
||||
unsigned short length PACKED; /* transfer data length */
|
||||
unsigned char result PACKED; /* return code */
|
||||
unsigned char pf PACKED; /* P/F bit */
|
||||
unsigned short lcn PACKED; /* logical channel */
|
||||
unsigned char qdm PACKED; /* Q/D/M bits */
|
||||
unsigned char cause PACKED; /* cause field */
|
||||
unsigned char diagn PACKED; /* diagnostics */
|
||||
unsigned char pktType PACKED; /* packet type */
|
||||
unsigned char resrv[4] PACKED; /* reserved */
|
||||
} cblock_t;
|
||||
|
||||
typedef struct {
|
||||
ip_pkt_t ip_pkt PACKED;
|
||||
udp_pkt_t udp_pkt PACKED;
|
||||
wp_mgmt_t wp_mgmt PACKED;
|
||||
cblock_t cblock PACKED;
|
||||
unsigned char data[4080] PACKED;
|
||||
} x25_udp_pkt_t;
|
||||
#endif
|
||||
|
||||
typedef struct read_hdlc_stat {
|
||||
unsigned short inf_frames_rx_ok PACKED;
|
||||
unsigned short inf_frames_rx_out_of_seq PACKED;
|
||||
unsigned short inf_frames_rx_no_data PACKED;
|
||||
unsigned short inf_frames_rx_dropped PACKED;
|
||||
unsigned short inf_frames_rx_data_too_long PACKED;
|
||||
unsigned short inf_frames_rx_invalid_addr PACKED;
|
||||
unsigned short inf_frames_tx_ok PACKED;
|
||||
unsigned short inf_frames_tx_retransmit PACKED;
|
||||
unsigned short T1_timeouts PACKED;
|
||||
unsigned short SABM_frames_rx PACKED;
|
||||
unsigned short DISC_frames_rx PACKED;
|
||||
unsigned short DM_frames_rx PACKED;
|
||||
unsigned short FRMR_frames_rx PACKED;
|
||||
unsigned short SABM_frames_tx PACKED;
|
||||
unsigned short DISC_frames_tx PACKED;
|
||||
unsigned short DM_frames_tx PACKED;
|
||||
unsigned short FRMR_frames_tx PACKED;
|
||||
} read_hdlc_stat_t;
|
||||
|
||||
typedef struct read_comms_err_stats{
|
||||
unsigned char overrun_err_rx PACKED;
|
||||
unsigned char CRC_err PACKED;
|
||||
unsigned char abort_frames_rx PACKED;
|
||||
unsigned char frames_dropped_buf_full PACKED;
|
||||
unsigned char abort_frames_tx PACKED;
|
||||
unsigned char transmit_underruns PACKED;
|
||||
unsigned char missed_tx_underruns_intr PACKED;
|
||||
unsigned char reserved PACKED;
|
||||
unsigned char DCD_drop PACKED;
|
||||
unsigned char CTS_drop PACKED;
|
||||
} read_comms_err_stats_t;
|
||||
|
||||
typedef struct trace_data {
|
||||
unsigned short length PACKED;
|
||||
unsigned char type PACKED;
|
||||
unsigned char trace_dropped PACKED;
|
||||
unsigned char reserved[5] PACKED;
|
||||
unsigned short timestamp PACKED;
|
||||
unsigned int sec PACKED;
|
||||
unsigned int usec PACKED;
|
||||
unsigned char data[0] PACKED;
|
||||
} trace_data_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
enum {UDP_XPIPE_TYPE};
|
||||
|
||||
#define XPIPE_ENABLE_TRACING 0x14
|
||||
#define XPIPE_DISABLE_TRACING 0x14
|
||||
#define XPIPE_GET_TRACE_INFO 0x16
|
||||
#define XPIPE_FT1_READ_STATUS 0x74
|
||||
#define XPIPE_DRIVER_STAT_IFSEND 0x75
|
||||
#define XPIPE_DRIVER_STAT_INTR 0x76
|
||||
#define XPIPE_DRIVER_STAT_GEN 0x77
|
||||
#define XPIPE_FLUSH_DRIVER_STATS 0x78
|
||||
#define XPIPE_ROUTER_UP_TIME 0x79
|
||||
#define XPIPE_SET_FT1_MODE 0x81
|
||||
#define XPIPE_FT1_STATUS_CTRL 0x80
|
||||
|
||||
|
||||
/* error messages */
|
||||
#define NO_BUFFS_OR_CLOSED_WIN 0x33
|
||||
#define DATA_LENGTH_TOO_BIG 0x32
|
||||
#define NO_DATA_AVAILABLE 0x33
|
||||
#define Z80_TIMEOUT_ERROR 0x0a
|
||||
#define NO_BUFFS 0x08
|
||||
|
||||
|
||||
/* Trace options */
|
||||
#define TRACE_DEFAULT 0x03
|
||||
#define TRACE_SUPERVISOR_FRMS 0x10
|
||||
#define TRACE_ASYNC_FRMS 0x20
|
||||
#define TRACE_ALL_HDLC_FRMS 0x40
|
||||
#define TRACE_DATA_FRMS 0x08
|
||||
|
||||
|
||||
#endif /* _SDLA_X25_H */
|
|
@ -1,133 +0,0 @@
|
|||
/*************************************************************************
|
||||
ss7_linux.h Sangoma SS7 firmware API definitions
|
||||
|
||||
Author: Gideon Hack
|
||||
Nenad Corbic <ncorbic@sangoma.com>
|
||||
|
||||
Copyright: (c) 1995-2000 Sangoma Technologies Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the term of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version
|
||||
2 of the License, or (at your option) any later version.
|
||||
|
||||
===========================================================================
|
||||
Dec 22, 2000 Gideon Hack Initial Verison
|
||||
Jan 16, 2001 Gideon Hack Header updates
|
||||
===========================================================================
|
||||
|
||||
Descripiton:
|
||||
The 'C' header file for the Sangoma S508/S514 SS7 code API.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _SS7_LINUX_H
|
||||
#define _SS7_LINUX_H
|
||||
|
||||
|
||||
#include <linux/sdla_ss7.h>
|
||||
#include <linux/if_wanpipe.h>
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
enum {
|
||||
SIOCC_PC_RESERVED = (SIOC_WANPIPE_DEVPRIVATE),
|
||||
SIOCS_GENERAL_CMD,
|
||||
SIOCS_CHECK_FRONT_STATE,
|
||||
SIOC_RECEIVE,
|
||||
SIOC_SEND,
|
||||
SIOC_RECEIVE_WAIT,
|
||||
SIOC_RECEIVE_AVAILABLE,
|
||||
SIOC_RETRIEVE_MSU_BUFS
|
||||
};
|
||||
|
||||
#define SS7_CMD_BLOCK_SZ (sizeof(wan_mbox_t)-1-SIZEOF_MB_DATA_BFR)
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char status PACKED;
|
||||
unsigned char data_avail PACKED;
|
||||
unsigned short real_length PACKED;
|
||||
unsigned short time_stamp PACKED;
|
||||
unsigned char data[1] PACKED;
|
||||
} trace_pkt_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char SIO PACKED;
|
||||
unsigned short time_stamp PACKED;
|
||||
unsigned char reserved[13] PACKED;
|
||||
} api_rx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_rx_hdr_t api_rx_hdr PACKED;
|
||||
void * data PACKED;
|
||||
} api_rx_element_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char SIO PACKED;
|
||||
unsigned char reserved[15] PACKED;
|
||||
} api_tx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_tx_hdr_t api_tx_hdr PACKED;
|
||||
void * data PACKED;
|
||||
} api_tx_element_t;
|
||||
|
||||
|
||||
/* The embedded control block for UDP mgmt
|
||||
This is essentially a mailbox structure, without the large data field */
|
||||
#if 0
|
||||
typedef struct {
|
||||
unsigned char opp_flag PACKED; /* the opp flag */
|
||||
unsigned char command PACKED; /* the user command */
|
||||
unsigned short buffer_length PACKED; /* the data length */
|
||||
unsigned char return_code PACKED; /* the return code */
|
||||
unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */
|
||||
} cblock_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char num_frames PACKED;
|
||||
unsigned char ismoredata PACKED;
|
||||
} trace_info_t;
|
||||
|
||||
typedef struct {
|
||||
ip_pkt_t ip_pkt PACKED;
|
||||
udp_pkt_t udp_pkt PACKED;
|
||||
wp_mgmt_t wp_mgmt PACKED;
|
||||
cblock_t cblock PACKED;
|
||||
trace_info_t trace_info PACKED;
|
||||
unsigned char data[SIZEOF_MB_DATA_BFR] PACKED;
|
||||
} ss7_udp_pkt_t;
|
||||
#endif
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/* modem status changes */
|
||||
#define DCD_HIGH 0x08
|
||||
#define CTS_HIGH 0x20
|
||||
|
||||
/* Special UDP drivers management commands */
|
||||
#define SPIPE_ENABLE_TRACING 0x50
|
||||
#define SPIPE_DISABLE_TRACING 0x51
|
||||
#define SPIPE_GET_TRACE_INFO 0x52
|
||||
#define SPIPE_GET_IBA_DATA 0x53
|
||||
#define SPIPE_FT1_READ_STATUS 0x54
|
||||
#define SPIPE_DRIVER_STAT_IFSEND 0x55
|
||||
#define SPIPE_DRIVER_STAT_INTR 0x56
|
||||
#define SPIPE_DRIVER_STAT_GEN 0x57
|
||||
#define SPIPE_FLUSH_DRIVER_STATS 0x58
|
||||
#define SPIPE_ROUTER_UP_TIME 0x59
|
||||
|
||||
/* Driver specific commands for API */
|
||||
#define CHDLC_READ_TRACE_DATA 0xE4 /* read trace data */
|
||||
#define TRACE_ALL 0x00
|
||||
#define TRACE_PROT 0x01
|
||||
#define TRACE_DATA 0x02
|
||||
|
||||
#define UDPMGMT_UDP_PROTOCOL 0x11
|
||||
#define UDPMGMT_SIGNATURE "CTPIPEAB" /* "STPIPEAB" */
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -731,13 +731,26 @@ typedef struct
|
|||
unsigned short tdm_tx_dma_toggle;
|
||||
unsigned int tdm_logic_ch_map;
|
||||
|
||||
void *rtp_dev;
|
||||
int rtp_len;
|
||||
netskb_t *rx_rtp_skb;
|
||||
netskb_t *tx_rtp_skb;
|
||||
unsigned long sec_chk_cnt;
|
||||
|
||||
wan_skb_queue_t rtp_tap_list;
|
||||
unsigned int rx_errors_hist;
|
||||
unsigned int rx_errors_over_cnt;
|
||||
unsigned long rx_errors_timeout;
|
||||
unsigned long rx_errors_down_timeout;
|
||||
|
||||
} sdla_xilinx_t;
|
||||
|
||||
|
||||
enum {
|
||||
AFT_CHIP_CONFIGURED,
|
||||
AFT_FRONT_END_UP,
|
||||
AFT_TDM_GLOBAL_ISR,
|
||||
AFT_TDM_RING_BUF,
|
||||
AFT_TDM_FAST_ISR,
|
||||
AFT_TDM_SW_RING_BUF
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned long current_offset;
|
||||
|
@ -849,6 +862,7 @@ typedef struct sdla
|
|||
unsigned long update_comms_stats;
|
||||
|
||||
sdla_fe_t fe; /* front end structures */
|
||||
u8 fe_no_intr; /* do not enable global fe intr */
|
||||
|
||||
unsigned int rCount;
|
||||
|
||||
|
@ -874,6 +888,7 @@ typedef struct sdla
|
|||
#endif
|
||||
|
||||
wan_hwec_conf_t hwec_conf;
|
||||
wan_rtp_conf_t rtp_conf;
|
||||
|
||||
#if defined(CONFIG_PRODUCT_WANPIPE_GENERIC)
|
||||
struct sdla* same_card;
|
||||
|
@ -972,7 +987,9 @@ extern void wp_tasklet_per_cpu_init (void);
|
|||
//extern int wan_reply_udp( unsigned char *data, unsigned int mbox_len, int trace_opt);
|
||||
//extern int wan_udp_pkt_type(sdla_t* card,unsigned char *data);
|
||||
|
||||
extern int wan_ip_udp_setup(void* card_id, u32 ip, u32 udp_port,
|
||||
extern int wan_ip_udp_setup(void* card_id,
|
||||
wan_rtp_conf_t *rtp_conf,
|
||||
u32 chan,
|
||||
unsigned char *data, unsigned int mbox_len);
|
||||
|
||||
extern int wanpipe_sdlc_unregister(netdevice_t *dev);
|
||||
|
|
|
@ -89,11 +89,6 @@
|
|||
#endif
|
||||
|
||||
/* Defines */
|
||||
|
||||
#ifndef PACKED
|
||||
#define PACKED __attribute__((packed))
|
||||
#endif
|
||||
|
||||
#define WANPIPE_MAGIC 0x414C4453L /* signature: 'SDLA' reversed */
|
||||
|
||||
/* IOCTL numbers (up to 16) */
|
||||
|
@ -736,11 +731,9 @@ typedef struct
|
|||
unsigned short tdm_tx_dma_toggle;
|
||||
unsigned int tdm_logic_ch_map;
|
||||
|
||||
void *rtp_dev;
|
||||
int rtp_len;
|
||||
netskb_t *rx_rtp_skb;
|
||||
netskb_t *tx_rtp_skb;
|
||||
unsigned long sec_chk_cnt;
|
||||
|
||||
wan_skb_queue_t rtp_tap_list;
|
||||
} sdla_xilinx_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -879,6 +872,7 @@ typedef struct sdla
|
|||
#endif
|
||||
|
||||
wan_hwec_conf_t hwec_conf;
|
||||
wan_rtp_conf_t rtp_conf;
|
||||
|
||||
#if defined(CONFIG_PRODUCT_WANPIPE_GENERIC)
|
||||
struct sdla* same_card;
|
||||
|
@ -920,6 +914,10 @@ typedef struct sdla
|
|||
u_long oerrors, ierrors;
|
||||
u_long opackets, ipackets;
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
/* This value is used for detecting TDM Voice
|
||||
* rsync timeout, it should be long */
|
||||
unsigned long rsync_timeout;
|
||||
} sdla_t;
|
||||
|
||||
/****** Public Functions ****************************************************/
|
||||
|
@ -973,7 +971,9 @@ extern void wp_tasklet_per_cpu_init (void);
|
|||
//extern int wan_reply_udp( unsigned char *data, unsigned int mbox_len, int trace_opt);
|
||||
//extern int wan_udp_pkt_type(sdla_t* card,unsigned char *data);
|
||||
|
||||
extern int wan_ip_udp_setup(void* card_id, u32 ip, u32 udp_port,
|
||||
extern int wan_ip_udp_setup(void* card_id,
|
||||
wan_rtp_conf_t *rtp_conf,
|
||||
u32 chan,
|
||||
unsigned char *data, unsigned int mbox_len);
|
||||
|
||||
extern int wanpipe_sdlc_unregister(netdevice_t *dev);
|
||||
|
|
|
@ -549,6 +549,19 @@ typedef struct wan_lip_fr_dlci
|
|||
unsigned char type;
|
||||
} wan_fr_dlci_t;
|
||||
|
||||
|
||||
typedef struct wan_rtp_conf
|
||||
{
|
||||
unsigned int rtp_ip;
|
||||
unsigned int rtp_local_ip;
|
||||
unsigned short rtp_port;
|
||||
unsigned short rtp_sample;
|
||||
unsigned char rtp_devname[WAN_IFNAME_SZ+1];
|
||||
unsigned char rtp_mac[WAN_IFNAME_SZ+1];
|
||||
unsigned char rtp_local_mac[WAN_IFNAME_SZ+1];
|
||||
}wan_rtp_conf_t;
|
||||
|
||||
|
||||
typedef struct wan_xilinx_conf
|
||||
{
|
||||
unsigned short dma_per_ch; /* DMA buffers per logic channel */
|
||||
|
@ -563,10 +576,16 @@ typedef struct wan_xilinx_conf
|
|||
// unsigned int ec_persist_disable; /* HW EC Persist */
|
||||
|
||||
|
||||
#if 0
|
||||
unsigned int rtp_ip;
|
||||
unsigned short rtp_port;
|
||||
unsigned short rtp_sample;
|
||||
char rtp_devname[WAN_IFNAME_SZ+1];
|
||||
#endif
|
||||
unsigned int err_throttle_period;
|
||||
unsigned int err_throttle_timeout;
|
||||
|
||||
|
||||
} wan_xilinx_conf_t;
|
||||
|
||||
typedef struct wan_xilinx_conf_if
|
||||
|
@ -958,6 +977,8 @@ typedef struct wandev_conf
|
|||
|
||||
wan_tdmv_conf_t tdmv_conf;
|
||||
wan_hwec_conf_t hwec_conf;
|
||||
wan_rtp_conf_t rtp_conf;
|
||||
|
||||
|
||||
unsigned char line_idle; /* IDLE FLAG/ IDLE MARK */
|
||||
unsigned char ignore_front_end_status;
|
||||
|
|
|
@ -2018,6 +2018,16 @@ static __inline int wan_netif_del(netdevice_t* dev)
|
|||
#if defined(__LINUX__)
|
||||
static __inline void wan_netif_fake_init(netdevice_t *d)
|
||||
{
|
||||
|
||||
#ifdef LINUX_FEAT_2624
|
||||
d->header_ops = NULL;
|
||||
#else
|
||||
d->hard_header = NULL;
|
||||
d->rebuild_header = NULL;
|
||||
d->header_cache_update = NULL;
|
||||
d->hard_header_cache = NULL;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -578,6 +578,7 @@ void wanpipe_debugging (void* data, int pending);
|
|||
#else
|
||||
void wanpipe_debugging (unsigned long data);
|
||||
#endif
|
||||
static __inline int wan_skb_tailroom(void* skb);
|
||||
|
||||
/****************************************************************************
|
||||
** I N L I N E F U N C T I O N S
|
||||
|
@ -1417,7 +1418,7 @@ static __inline void wan_skb_copyback(void* skb, int off, int len, caddr_t cp)
|
|||
struct sk_buff* sk = (struct sk_buff*)skb;
|
||||
unsigned char* data = NULL;
|
||||
if (off == wan_skb_len(skb)){
|
||||
if (len > wan_skb_tailroom(sk)){
|
||||
if (wan_skb_tail_pointer(sk) + len > wan_skb_end_pointer(sk)){
|
||||
DEBUG_EVENT("wan_skb_copyback: Internal Error (off=%d,len=%d,skb_len=%d)!\n",
|
||||
off, len, wan_skb_len(skb));
|
||||
return;
|
||||
|
@ -1458,7 +1459,7 @@ static __inline int wan_skb_copyback_user(void* skb, int off, int len, caddr_t c
|
|||
struct sk_buff* sk = (struct sk_buff*)skb;
|
||||
unsigned char* data = NULL;
|
||||
if (off == wan_skb_len(skb)){
|
||||
if (len > wan_skb_tailroom(sk)) {
|
||||
if (wan_skb_tail_pointer(sk) + len > wan_skb_end_pointer(sk)){
|
||||
DEBUG_EVENT("wan_skb_copyback_user: Internal Error (off=%d,len=%d,skb_len=%d)!\n",
|
||||
off, len, wan_skb_len(skb));
|
||||
return -EINVAL;
|
||||
|
@ -2017,6 +2018,16 @@ static __inline int wan_netif_del(netdevice_t* dev)
|
|||
#if defined(__LINUX__)
|
||||
static __inline void wan_netif_fake_init(netdevice_t *d)
|
||||
{
|
||||
|
||||
#ifdef LINUX_FEAT_2624
|
||||
d->hard_header = NULL;
|
||||
d->rebuild_header = NULL;
|
||||
d->header_cache_update = NULL;
|
||||
d->hard_header_cache = NULL;
|
||||
#else
|
||||
d->header_ops = NULL;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,6 +46,20 @@
|
|||
#define wan_skb_set_tail_pointer(skb,offset) ((skb)->tail = ((skb)->data + offset))
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) || defined(LINUX_FEAT_2624)
|
||||
# ifndef LINUX_FEAT_2624
|
||||
# define LINUX_FEAT_2624 1
|
||||
# endif
|
||||
# define wan_dev_get_by_name(name) dev_get_by_name(&init_net,name)
|
||||
# define wan_dev_get_by_index(idx) dev_get_by_index(&init_net,idx)
|
||||
# define wan_init_net(name) init_net.name
|
||||
#else
|
||||
# define wan_dev_get_by_name(name) dev_get_by_name(name)
|
||||
# define wan_dev_get_by_index(idx) dev_get_by_index(idx)
|
||||
# define wan_init_net(name) name
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef IRQF_SHARED
|
||||
#define IRQF_SHARED SA_SHIRQ
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,513 @@
|
|||
|
||||
#ifndef _WANPIPE_KERNEL_H
|
||||
#define _WANPIPE_KERNEL_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
# if defined (__BIG_ENDIAN_BITFIELD)
|
||||
# define WAN_BIG_ENDIAN 1
|
||||
# undef WAN_LITTLE_ENDIAN
|
||||
# else
|
||||
# undef WAN_BIG_ENDIAN
|
||||
# define WAN_LITTLE_ENDIAN 1
|
||||
# endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9)
|
||||
# define MODULE_LICENSE(a)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
|
||||
# define snprintf(a,b,c,d...) sprintf(a,c,##d)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
|
||||
# define wp_ip_rt_ioctl(_cmd_,_rptr_) -EINVAL
|
||||
# define wp_devinet_ioctl(_cmd_,_rptr_) -EINVAL
|
||||
#else
|
||||
# define wp_ip_rt_ioctl(_cmd_,_rptr_) ip_rt_ioctl(_cmd_,_rptr_)
|
||||
# define wp_devinet_ioctl(_cmd_,_rptr_) devinet_ioctl(_cmd_,_rptr_)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
|
||||
#define wan_skb_reset_mac_header(skb) skb_reset_mac_header(skb)
|
||||
#define wan_skb_reset_network_header(skb) skb_reset_network_header(skb)
|
||||
#define wan_skb_end_pointer(skb) skb_end_pointer(skb)
|
||||
#define wan_skb_tail_pointer(skb) skb_tail_pointer(skb)
|
||||
#define wan_skb_reset_tail_pointer(skb) skb_reset_tail_pointer(skb)
|
||||
#define wan_skb_set_tail_pointer(skb,offset) skb_set_tail_pointer(skb,offset)
|
||||
#else
|
||||
#define wan_skb_reset_mac_header(skb) ((skb)->mac.raw = (skb)->data)
|
||||
#define wan_skb_reset_network_header(skb) ((skb)->nh.raw = (skb)->data)
|
||||
#define wan_skb_tail_pointer(skb) ((skb)->tail)
|
||||
#define wan_skb_end_pointer(skb) ((skb)->end)
|
||||
#define wan_skb_reset_tail_pointer(skb) ((skb)->tail = (skb)->data)
|
||||
#define wan_skb_set_tail_pointer(skb,offset) ((skb)->tail = ((skb)->data + offset))
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
|
||||
# define LINUX_FEAT_2624 1
|
||||
# define wan_dev_get_by_name(name) dev_get_by_name(&init_net,name)
|
||||
# define wan_dev_get_by_index(idx) dev_get_by_index(&init_net,idx)
|
||||
# define wan_init_net(name) init_net.name
|
||||
#else
|
||||
# define wan_dev_get_by_name(name) dev_get_by_name(name)
|
||||
# define wan_dev_get_by_index(idx) dev_get_by_index(idx)
|
||||
# define wan_init_net(name) name
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef IRQF_SHARED
|
||||
#define IRQF_SHARED SA_SHIRQ
|
||||
#endif
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
||||
/* KERNEL 2.6.X */
|
||||
|
||||
#define LINUX_2_6
|
||||
#define netdevice_t struct net_device
|
||||
|
||||
#define FREE_READ 1
|
||||
#define FREE_WRITE 0
|
||||
|
||||
#define stop_net_queue(a) netif_stop_queue(a)
|
||||
#define start_net_queue(a) netif_start_queue(a)
|
||||
#define is_queue_stopped(a) netif_queue_stopped(a)
|
||||
#define wake_net_dev(a) netif_wake_queue(a)
|
||||
#define is_dev_running(a) netif_running(a)
|
||||
#define wan_dev_kfree_skb(a,b) dev_kfree_skb_any(a)
|
||||
|
||||
#define tq_struct work_struct
|
||||
|
||||
#define wan_call_usermodehelper(a,b,c) call_usermodehelper(a,b,c,0)
|
||||
|
||||
#define pci_present() 1
|
||||
|
||||
static inline void wan_schedule_task(struct tq_struct *tq)
|
||||
{
|
||||
schedule_work(tq);
|
||||
}
|
||||
|
||||
#define ADMIN_CHECK() {if (!capable(CAP_SYS_ADMIN)) {\
|
||||
DEBUG_EVENT("wanpipe: ADMIN_CHECK: Failed Cap=0x%X Fsuid=0x%X Euid=0x%X\n", \
|
||||
current->cap_effective,current->fsuid,current->euid);\
|
||||
return -EPERM; \
|
||||
}\
|
||||
}
|
||||
|
||||
#define NET_ADMIN_CHECK() {if (!capable(CAP_NET_ADMIN)){\
|
||||
DEBUG_EVENT("wanpipe: NET_ADMIN_CHECK: Failed Cap=0x%X Fsuid=0x%X Euid=0x%X\n", \
|
||||
current->cap_effective,current->fsuid,current->euid);\
|
||||
return -EPERM; \
|
||||
}\
|
||||
}
|
||||
|
||||
#define WAN_IRQ_CALL(fn,args,ret) ret = fn args
|
||||
#define WAN_IRQ_RETURN(a) return a
|
||||
#define WAN_IRQ_RETVAL irqreturn_t
|
||||
#define WAN_IRQ_RETVAL_DECL(ret) irqreturn_t ret = WAN_IRQ_NONE
|
||||
#define WAN_IRQ_RETVAL_SET(ret, val) ret = val
|
||||
#define WAN_IRQ_HANDLED IRQ_HANDLED
|
||||
#define WAN_IRQ_NONE IRQ_NONE
|
||||
|
||||
#define mark_bh(a)
|
||||
|
||||
#define wan_clear_bit(a,b) clear_bit((a),(unsigned long*)(b))
|
||||
#define wan_set_bit(a,b) set_bit((a),(unsigned long*)(b))
|
||||
#define wan_test_bit(a,b) test_bit((a),(unsigned long*)(b))
|
||||
#define wan_test_and_set_bit(a,b) test_and_set_bit((a),(unsigned long*)(b))
|
||||
#define wan_test_and_clear_bit(a,b) test_and_clear_bit((a),(unsigned long*)(b))
|
||||
|
||||
#define dev_init_buffers(a)
|
||||
|
||||
#define WP_PDE(_a) PDE(_a)
|
||||
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
|
||||
# define wp_rcu_read_lock(in_dev) rcu_read_lock()
|
||||
# define wp_rcu_read_unlock(in_dev) rcu_read_unlock()
|
||||
# define wp_readb(ptr) readb((void __iomem *)(ptr))
|
||||
# define wp_reads(ptr) reads((void __iomem *)(ptr))
|
||||
# define wp_readl(ptr) readl((void __iomem *)(ptr))
|
||||
# define wp_writeb(data,ptr) writeb(data,(void __iomem *)(ptr))
|
||||
# define wp_writew(data,ptr) writew(data,(void __iomem *)(ptr))
|
||||
# define wp_writel(data,ptr) writel(data,(void __iomem *)(ptr))
|
||||
# define wp_memset_io(ptr,data,len) memset_io((void __iomem *)(ptr),data,len)
|
||||
#else
|
||||
# define wp_rcu_read_lock(in_dev) read_lock_bh(&in_dev->lock)
|
||||
# define wp_rcu_read_unlock(in_dev) read_unlock_bh(&in_dev->lock)
|
||||
# define wp_readb(ptr) readb((ptr))
|
||||
# define wp_reads(ptr) reads((ptr))
|
||||
# define wp_readl(ptr) readl((ptr))
|
||||
# define wp_writeb(data,ptr) writeb(data,(ptr))
|
||||
# define wp_writew(data,ptr) writew(data,(ptr))
|
||||
# define wp_writel(data,ptr) writel(data,(ptr))
|
||||
# define wp_memset_io(ptr,data,len) memset_io((ptr),data,len)
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,14)
|
||||
#define htonl __constant_htonl
|
||||
#define htons __constant_htons
|
||||
#define ntohl __constant_ntohl
|
||||
#define ntohs __constant_ntohs
|
||||
#endif
|
||||
|
||||
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
|
||||
/* --------------------------------------------------
|
||||
* KERNEL 2.4.X
|
||||
* -------------------------------------------------*/
|
||||
|
||||
#define LINUX_2_4
|
||||
#define netdevice_t struct net_device
|
||||
|
||||
#define FREE_READ 1
|
||||
#define FREE_WRITE 0
|
||||
|
||||
#define stop_net_queue(a) netif_stop_queue(a)
|
||||
#define start_net_queue(a) netif_start_queue(a)
|
||||
#define is_queue_stopped(a) netif_queue_stopped(a)
|
||||
#define wake_net_dev(a) netif_wake_queue(a)
|
||||
#define is_dev_running(a) netif_running(a)
|
||||
#define wan_dev_kfree_skb(a,b) dev_kfree_skb_any(a)
|
||||
#define pci_get_device(a,b,c) pci_find_device(a,b,c)
|
||||
|
||||
#define __dev_get(a) dev_get(a)
|
||||
|
||||
static inline void wan_schedule_task(struct tq_struct *tq)
|
||||
{
|
||||
schedule_task(tq);
|
||||
}
|
||||
|
||||
#ifndef INIT_WORK
|
||||
# define INIT_WORK INIT_TQUEUE
|
||||
#endif
|
||||
|
||||
#define wan_call_usermodehelper(a,b,c) call_usermodehelper(a,b,c)
|
||||
|
||||
#define ADMIN_CHECK() {if (!capable(CAP_SYS_ADMIN)) {\
|
||||
DEBUG_EVENT("wanpipe: ADMIN_CHECK: Failed Cap=0x%X Fsuid=0x%X Euid=0x%X\n", \
|
||||
current->cap_effective,current->fsuid,current->euid);\
|
||||
return -EPERM; \
|
||||
}\
|
||||
}
|
||||
|
||||
#define NET_ADMIN_CHECK() {if (!capable(CAP_NET_ADMIN)){\
|
||||
DEBUG_EVENT("wanpipe: NET_ADMIN_CHECK: Failed Cap=0x%X Fsuid=0x%X Euid=0x%X\n", \
|
||||
current->cap_effective,current->fsuid,current->euid);\
|
||||
return -EPERM; \
|
||||
}\
|
||||
}
|
||||
|
||||
#define WAN_IRQ_CALL(fn,args,ret) fn args
|
||||
#define WAN_IRQ_RETURN(a) return
|
||||
#define WAN_IRQ_RETVAL void
|
||||
#define WAN_IRQ_RETVAL_DECL(ret)
|
||||
#define WAN_IRQ_RETVAL_SET(ret, val)
|
||||
#ifndef WAN_IRQ_NONE
|
||||
# define WAN_IRQ_NONE (0)
|
||||
#endif
|
||||
|
||||
#ifndef WAN_IRQ_HANDLED
|
||||
# define WAN_IRQ_HANDLED (1)
|
||||
#endif
|
||||
|
||||
#define wan_clear_bit(a,b) clear_bit((a),(b))
|
||||
#define wan_set_bit(a,b) set_bit((a),(b))
|
||||
#define wan_test_bit(a,b) test_bit((a),(b))
|
||||
#define wan_test_and_set_bit(a,b) test_and_set_bit((a),(b))
|
||||
#define wan_test_and_clear_bit(a,b) test_and_clear_bit((a),(b))
|
||||
|
||||
static inline struct proc_dir_entry *WP_PDE(const struct inode *inode)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,21)
|
||||
return (struct proc_dir_entry *)inode->u.generic_ip;
|
||||
#else
|
||||
return (struct proc_dir_entry *)inode->i_private;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define wp_rcu_read_lock(in_dev) read_lock_bh(&in_dev->lock)
|
||||
#define wp_rcu_read_unlock(in_dev) read_unlock_bh(&in_dev->lock)
|
||||
#define wp_readb(ptr) readb((ptr))
|
||||
#define wp_reads(ptr) reads((ptr))
|
||||
#define wp_readl(ptr) readl((ptr))
|
||||
|
||||
#define wp_writeb(data,ptr) writeb(data,(ptr))
|
||||
#define wp_writew(data,ptr) writew(data,(ptr))
|
||||
#define wp_writel(data,ptr) writel(data,(ptr))
|
||||
#define wp_memset_io(ptr,data,len) memset_io((ptr),data,len)
|
||||
|
||||
|
||||
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
|
||||
/*-----------------------------------------------------
|
||||
* KERNEL 2.2.X
|
||||
* ---------------------------------------------------*/
|
||||
|
||||
#define LINUX_2_1
|
||||
#define net_device device
|
||||
#define netdevice_t struct device
|
||||
#define FREE_READ 1
|
||||
#define FREE_WRITE 0
|
||||
|
||||
#define S_IRUGO 0
|
||||
|
||||
#define __exit
|
||||
|
||||
#ifndef get_order
|
||||
# define get_order(x) __get_order(x)
|
||||
#endif
|
||||
|
||||
#define pci_get_device(a,b,c) pci_find_device(a,b,c)
|
||||
#define wan_dev_kfree_skb(a,b) kfree_skb(a)
|
||||
#define dev_kfree_skb_any(a) kfree_skb(a)
|
||||
|
||||
#define netif_wake_queue(dev) do { \
|
||||
clear_bit(0, &(dev)->tbusy); \
|
||||
mark_bh(NET_BH); \
|
||||
} while(0)
|
||||
#define netif_start_queue(dev) do { \
|
||||
(dev)->tbusy = 0; \
|
||||
(dev)->interrupt = 0; \
|
||||
(dev)->start = 1; \
|
||||
} while (0)
|
||||
|
||||
#define netif_stop_queue(dev) (set_bit(0, &(dev)->tbusy))
|
||||
#define netif_running(dev) (dev)->start
|
||||
#define netdevice_start(dev) (dev)->start = 1
|
||||
#define netdevice_stop(dev) (dev)->start = 0
|
||||
#define netif_queue_stopped(dev) (test_bit(0,&(dev)->tbusy))
|
||||
#define netif_set_tx_timeout(dev, tf, tm)
|
||||
|
||||
#define stop_net_queue(dev) netif_stop_queue(dev)
|
||||
#define start_net_queue(dev) netif_start_queue(dev)
|
||||
#define is_queue_stopped(dev) netif_queue_stopped(dev)
|
||||
#define wake_net_dev(dev) netif_wake_queue(dev)
|
||||
#define is_dev_running(dev) netif_running(dev)
|
||||
|
||||
#define dev_kfree_skb_irq(x) kfree_skb(x)
|
||||
|
||||
#define tasklet_struct tq_struct
|
||||
|
||||
#define __dev_get(a) dev_get(a)
|
||||
|
||||
#ifndef DECLARE_WAITQUEUE
|
||||
#define DECLARE_WAITQUEUE(wait, current) struct wait_queue wait = { current, NULL }
|
||||
#endif
|
||||
|
||||
#define tasklet_kill(a) { if ((a)->sync) {} }
|
||||
|
||||
#define request_mem_region(addr, size, name) ((void *)1)
|
||||
#define release_mem_region(addr, size)
|
||||
#define pci_enable_device(x) (0)
|
||||
#define pci_resource_start(dev, bar) dev->base_address[bar]
|
||||
|
||||
#define wp_rcu_read_lock(in_dev)
|
||||
#define wp_rcu_read_unlock(in_dev)
|
||||
#define wp_readb(ptr) readb((ptr))
|
||||
#define wp_reads(ptr) reads((ptr))
|
||||
#define wp_readl(ptr) readl((ptr))
|
||||
#define wp_writeb(data,ptr) writeb(data,(ptr))
|
||||
#define wp_writew(data,ptr) writew(data,(ptr))
|
||||
#define wp_writel(data,ptr) writel(data,(ptr))
|
||||
#define wp_memset_io(ptr,data,len) memset_io((ptr),data,len)
|
||||
|
||||
static inline void tasklet_hi_schedule(struct tasklet_struct *tasklet)
|
||||
{
|
||||
queue_task(tasklet, &tq_immediate);
|
||||
mark_bh(IMMEDIATE_BH);
|
||||
}
|
||||
|
||||
static inline void tasklet_schedule(struct tasklet_struct *tasklet)
|
||||
{
|
||||
queue_task(tasklet, &tq_immediate);
|
||||
mark_bh(IMMEDIATE_BH);
|
||||
}
|
||||
|
||||
static inline void tasklet_init(struct tasklet_struct *tasklet,
|
||||
void (*func)(unsigned long),
|
||||
unsigned long data)
|
||||
{
|
||||
tasklet->next = NULL;
|
||||
tasklet->sync = 0;
|
||||
tasklet->routine = (void (*)(void *))func;
|
||||
tasklet->data = (void *)data;
|
||||
}
|
||||
|
||||
static inline void wan_schedule_task(struct tq_struct *tq)
|
||||
{
|
||||
queue_task(tq, &tq_scheduler);
|
||||
}
|
||||
|
||||
/* Setup Dma Memory size copied directly from 3c505.c */
|
||||
static inline int __get_order(unsigned long size)
|
||||
{
|
||||
int order;
|
||||
|
||||
size = (size - 1) >> (PAGE_SHIFT - 1);
|
||||
order = -1;
|
||||
do {
|
||||
size >>= 1;
|
||||
order++;
|
||||
} while (size);
|
||||
return order;
|
||||
}
|
||||
|
||||
typedef int (get_info_t)(char *, char **, off_t, int, int);
|
||||
|
||||
#define ADMIN_CHECK() {if (!capable(CAP_SYS_ADMIN)) return -EPERM;}
|
||||
#define NET_ADMIN_CHECK() {if (!capable(CAP_NET_ADMIN)) return -EPERM;}
|
||||
|
||||
#define WAN_IRQ_CALL(fn,args,ret) fn args
|
||||
#define WAN_IRQ_RETURN(a) return
|
||||
#define WAN_IRQ_RETVAL void
|
||||
#define WAN_IRQ_RETVAL_DECL(ret)
|
||||
#define WAN_IRQ_RETVAL_SET(ret, val)
|
||||
#ifndef WAN_IRQ_NONE
|
||||
# define WAN_IRQ_NONE (0)
|
||||
#endif
|
||||
|
||||
#ifndef WAN_IRQ_HANDLED
|
||||
# define WAN_IRQ_HANDLED (1)
|
||||
#endif
|
||||
|
||||
typedef unsigned long mm_segment_t;
|
||||
|
||||
#ifndef INIT_WORK
|
||||
# define INIT_WORK INIT_TQUEUE
|
||||
#endif
|
||||
|
||||
#define wan_clear_bit(a,b) clear_bit((a),(b))
|
||||
#define wan_set_bit(a,b) set_bit((a),(b))
|
||||
#define wan_test_bit(a,b) test_bit((a),(b))
|
||||
#define wan_test_and_set_bit(a,b) test_and_set_bit((a),(b))
|
||||
#define wan_test_and_clear_bit(a,b) test_and_clear_bit((a),(b))
|
||||
|
||||
static inline struct proc_dir_entry *WP_PDE(const struct inode *inode)
|
||||
{
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
|
||||
return (struct proc_dir_entry *)inode->u.generic_ip;
|
||||
#else
|
||||
return (struct proc_dir_entry *)inode->i_private;
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
/* KERNEL 2.0.X */
|
||||
|
||||
|
||||
#define LINUX_2_0
|
||||
#define netdevice_t struct device
|
||||
|
||||
static inline struct proc_dir_entry *WP_PDE(const struct inode *inode)
|
||||
{
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18)
|
||||
return (struct proc_dir_entry *)inode->i_private;
|
||||
#else
|
||||
return (struct proc_dir_entry *)inode->u.generic_ip;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define test_and_set_bit set_bit
|
||||
#define net_ratelimit() 1
|
||||
|
||||
#define stop_net_queue(a) (set_bit(0, &a->tbusy))
|
||||
#define start_net_queue(a) (clear_bit(0,&a->tbusy))
|
||||
#define is_queue_stopped(a) (a->tbusy)
|
||||
#define wake_net_dev(a) {clear_bit(0,&a->tbusy);mark_bh(NET_BH);}
|
||||
#define is_dev_running(a) (test_bit(0,(void*)&a->start))
|
||||
#define wan_dev_kfree_skb(a,b) kfree_skb(a,b)
|
||||
#define pci_get_device(a,b,c) pci_find_device(a,b,c)
|
||||
#define spin_lock_init(a)
|
||||
#define spin_lock(a)
|
||||
#define spin_unlock(a)
|
||||
|
||||
#define __dev_get(a) dev_get(a)
|
||||
|
||||
#define netif_wake_queue(dev) do { \
|
||||
clear_bit(0, &dev->tbusy); \
|
||||
mark_bh(NET_BH); \
|
||||
} while(0)
|
||||
#define netif_start_queue(dev) do { \
|
||||
dev->tbusy = 0; \
|
||||
dev->interrupt = 0; \
|
||||
dev->start = 1; \
|
||||
} while (0)
|
||||
#define netif_stop_queue(dev) set_bit(0, &dev->tbusy)
|
||||
#define netif_running(dev) dev->start
|
||||
#define netdevice_start(dev) dev->start = 1
|
||||
#define netdevice_stop(dev) dev->start = 0
|
||||
#define netif_set_tx_timeout(dev, tf, tm)
|
||||
#define dev_kfree_skb_irq(x) kfree_skb(x)
|
||||
|
||||
typedef int (write_proc_t)(char *, char **, off_t, int, int);
|
||||
|
||||
#define net_device_stats enet_statistics
|
||||
|
||||
static inline int copy_from_user(void *a, void *b, int len){
|
||||
int err = verify_area(VERIFY_READ, b, len);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
memcpy_fromfs (a, b, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int copy_to_user(void *a, void *b, int len){
|
||||
int err = verify_area(VERIFY_WRITE, b, len);
|
||||
if (err)
|
||||
return err;
|
||||
memcpy_tofs (a, b,len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define WAN_IRQ_CALL(fn,args,ret) fn args
|
||||
#define WAN_IRQ_RETURN(a) return
|
||||
#define WAN_IRQ_RETVAL void
|
||||
#define WAN_IRQ_RETVAL_DECL(ret)
|
||||
#define WAN_IRQ_RETVAL_SET(ret, val)
|
||||
|
||||
#ifndef WAN_IRQ_NONE
|
||||
# define WAN_IRQ_NONE (0)
|
||||
#endif
|
||||
|
||||
#ifndef WAN_IRQ_HANDLED
|
||||
# define WAN_IRQ_HANDLED (1)
|
||||
#endif
|
||||
|
||||
typedef unsigned long mm_segment_t;
|
||||
|
||||
#endif
|
||||
|
||||
static inline int open_dev_check(netdevice_t *dev)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
|
||||
return is_dev_running(dev);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
/* This file is not being included from kernel space
|
||||
* we need to define what kersdladrv_pci_tblnel version we are
|
||||
* running */
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
|
||||
#define LINUX_2_6
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
|
||||
#define LINUX_2_4
|
||||
#else
|
||||
#define LINUX_2_4
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -1,684 +0,0 @@
|
|||
/* $Header: /usr/local/cvsroot/wanpipe_common/include/wanpipe_lip.h,v 1.38 2007/02/21 18:46:09 sangoma Exp $ */
|
||||
|
||||
#ifndef _WANPIPE_LIP_HEADER_
|
||||
#define _WANPIPE_LIP_HEADER_
|
||||
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
# include <wanpipe_includes.h>
|
||||
# include <wanpipe_defines.h>
|
||||
# include <wanpipe_debug.h>
|
||||
# include <wanpipe_common.h>
|
||||
# include <wanpipe_abstr.h>
|
||||
# include <wanpipe_snmp.h>
|
||||
# include <wanproc.h>
|
||||
# include <wanpipe.h>
|
||||
# include <wanpipe_cfg.h>
|
||||
# include <if_wanpipe_common.h>
|
||||
# include <wanpipe_iface.h>
|
||||
# include <wanpipe_lip_kernel.h>
|
||||
# include <wanpipe_fr_iface.h>
|
||||
# include <wanpipe_sppp_iface.h>
|
||||
# if defined(CONFIG_PRODUCT_WANPIPE_LAPB) || defined(CONFIG_PRODUCT_WANPIPE_LIP_LAPD)
|
||||
# include <wanpipe_lapb_iface.h>
|
||||
# endif
|
||||
# if defined(CONFIG_PRODUCT_WANPIPE_XDLC)
|
||||
# include <wanpipe_xdlc_iface.h>
|
||||
# endif
|
||||
#else
|
||||
# include <linux/wanpipe_includes.h>
|
||||
# include <linux/wanpipe_defines.h>
|
||||
# include <linux/wanpipe_debug.h>
|
||||
# include <linux/wanpipe_common.h>
|
||||
# include <linux/wanpipe_abstr.h>
|
||||
# include <linux/wanpipe_snmp.h>
|
||||
# include <linux/wanproc.h>
|
||||
# include <linux/wanpipe.h>
|
||||
# include <linux/wanpipe_cfg.h>
|
||||
# include <linux/if_wanpipe.h>
|
||||
# include <linux/if_wanpipe_common.h>
|
||||
# include <linux/wanpipe_fr_iface.h>
|
||||
# include <linux/wanpipe_lip_atm_iface.h>
|
||||
# include <linux/wanpipe_sppp_iface.h>
|
||||
# if defined(CONFIG_PRODUCT_WANPIPE_LAPB) || defined(CONFIG_PRODUCT_WANPIPE_LIP_LAPD)
|
||||
# include <linux/wanpipe_lapb_iface.h>
|
||||
# endif
|
||||
# if defined(CONFIG_PRODUCT_WANPIPE_LIP_KATM)
|
||||
# include <linux/wanpipe_katm_iface.h>
|
||||
# endif
|
||||
# if defined(CONFIG_PRODUCT_WANPIPE_XDLC)
|
||||
# include <linux/wanpipe_xdlc_iface.h>
|
||||
# endif
|
||||
# if defined(CONFIG_PRODUCT_WANPIPE_XMTP2)
|
||||
# include <linux/wanpipe_xmtp2_iface.h>
|
||||
# endif
|
||||
# include <linux/wanpipe_lip_kernel.h>
|
||||
# include <linux/wanpipe_iface.h>
|
||||
|
||||
# ifdef WPLIP_TTY_SUPPORT
|
||||
# include <linux/tty.h>
|
||||
# include <linux/tty_driver.h>
|
||||
# include <linux/tty_flip.h>
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef WAN_KERNEL
|
||||
|
||||
/*
|
||||
***********************************************************************************
|
||||
* *
|
||||
* X25HDR.C is the 'C' header file for the Sangoma X.25 code for the S508 adapter. *
|
||||
* *
|
||||
***********************************************************************************
|
||||
*/
|
||||
|
||||
#define LIP_OK 0
|
||||
#define TCPIP 0
|
||||
|
||||
#define MAX_CALL_REQ_ASYNC_PKT 512
|
||||
|
||||
#define NON_D_OPT 3
|
||||
#define D_OPT 2
|
||||
|
||||
#define FLOW_CONTROL_MASK 0x1F
|
||||
|
||||
#define ONE_BYTE 1
|
||||
#define MAX_TOKENS 31
|
||||
|
||||
#define MODNAME "wanpipe_lip"
|
||||
|
||||
#define MAX_LINK_RX_Q_LEN 10
|
||||
#define MAX_TAIL_ROOM 16
|
||||
#define MAX_LIP_LINKS 255
|
||||
|
||||
#if 0
|
||||
/* This option defaults the inital network
|
||||
* interface state to STOPPED/DISABLED.
|
||||
*
|
||||
* In this case, all traffic will be blocked
|
||||
* and data pushed back up the protocol stack.
|
||||
* This can cause memory starvation if there are
|
||||
* many interfaces running, because each interface
|
||||
* queue can be up to 100 packets, and fames will
|
||||
* only be dropped once the queue is overfilled
|
||||
*
|
||||
* By disabling this option, all packets received
|
||||
* by the interface in disconnected state, will be
|
||||
* silently discarded with carrier stat incremented.
|
||||
*/
|
||||
#define WANPIPE_LIP_IFNET_QUEUE_POLICY_INIT_OFF
|
||||
#endif
|
||||
|
||||
/* BH flags */
|
||||
enum{
|
||||
WPLIP_BH_RUNNING,
|
||||
WPLIP_RX_FSM_RUNNING,
|
||||
WPLIP_SMP_CONFLICT,
|
||||
WPLIP_BH_AWAITING_KICK,
|
||||
WPLIP_LINK_TIMER_EXPIRED,
|
||||
WPLIP_MORE_LINK_TX,
|
||||
WPLIP_LINK_DOWN,
|
||||
WPLIP_KICK,
|
||||
WPLIP_TTY_BUSY
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* LIP DEV Critical */
|
||||
enum {
|
||||
WPLIP_TX_WINDOW_CLOSED,
|
||||
WPLIP_SEND_AWAITING_KICK,
|
||||
WPLIP_TIMER_EXPIRED,
|
||||
WPLIP_DEV_DOWN,
|
||||
WPLIP_DEV_UNREGISTER,
|
||||
WPLIP_RX,
|
||||
WPLIP_IOCTL_SMP,
|
||||
WPLIP_DEV_SENDING
|
||||
};
|
||||
|
||||
#define MAX_RX_FACIL_CODE 30
|
||||
|
||||
#define BH_DEBUG 0
|
||||
|
||||
#define SOFT_INIT 0
|
||||
#define HARD_INIT 1
|
||||
#define MAX_SOFTIRQ_TIMEOUT 2
|
||||
|
||||
/*
|
||||
* Physical X25 Link
|
||||
* Each Link can support multiple logical
|
||||
* channels (svc).
|
||||
*/
|
||||
#define MAX_LCN 255
|
||||
#define MAX_DECODE_BUF_SZ 1000
|
||||
#define MAX_PROC_NAME 10
|
||||
|
||||
#ifndef MAX_PROC_EVENTS
|
||||
#define MAX_PROC_EVENTS 20
|
||||
#endif
|
||||
#define MAX_PROC_EVENT_SIZE X25_CALL_STR_SZ+200+1
|
||||
|
||||
|
||||
/*#define MAX_TX_BUF 10*/
|
||||
#define MAX_TX_BUF 32
|
||||
#define MAX_ATM_TX_BUF 35
|
||||
#define MAX_RX_Q 128
|
||||
|
||||
#define WPLIP_MAGIC_LINK 0xDAFE1234
|
||||
#define WPLIP_MAGIC_DEV 0xDAFE4321
|
||||
#define WPLIP_MAGIC_DEV_EL 0xDAFE4444
|
||||
|
||||
#define WPLIP_ASSERT_MAGIC(ptr,magic,ret) \
|
||||
if ((*(unsigned long*)ptr) != magic) { \
|
||||
DEBUG_EVENT("%s:%d: Error Invalid Magic number in Link dev!\n", \
|
||||
__FUNCTION__,__LINE__); \
|
||||
return ret ; \
|
||||
}
|
||||
#define WPLIP_ASSERT_MAGIC_VOID(ptr,magic) \
|
||||
if ((*(unsigned long*)ptr) != magic) { \
|
||||
DEBUG_EVENT("%s:%d: Error Invalid Magic number in Link dev!\n", \
|
||||
__FUNCTION__,__LINE__); \
|
||||
return; \
|
||||
}
|
||||
|
||||
struct wplip_dev;
|
||||
|
||||
WAN_LIST_HEAD(wplip_link_list,wplip_link);
|
||||
|
||||
typedef struct wplip_link
|
||||
{
|
||||
unsigned long magic;
|
||||
WAN_LIST_ENTRY(wplip_link) list_entry;
|
||||
|
||||
/* List of all Logic channel
|
||||
* devices attached to the link
|
||||
*
|
||||
* Packet direction UP
|
||||
* */
|
||||
WAN_LIST_HEAD(,wplip_dev) list_head_ifdev;
|
||||
unsigned int dev_cnt;
|
||||
wan_rwlock_t dev_list_lock;
|
||||
|
||||
|
||||
/* List of Tx Devices attached
|
||||
* to the Link.
|
||||
*
|
||||
* Packet direction DOWN
|
||||
*
|
||||
* Eg. Load balancing over multiple
|
||||
* links */
|
||||
|
||||
WAN_LIST_HEAD(,wplip_dev_list) list_head_tx_ifdev;
|
||||
unsigned int tx_dev_cnt;
|
||||
wan_rwlock_t tx_dev_list_lock;
|
||||
|
||||
|
||||
unsigned char state;
|
||||
unsigned char carrier_state;
|
||||
unsigned char prot_state;
|
||||
|
||||
void *prot;
|
||||
wan_timer_t prot_timer;
|
||||
|
||||
unsigned char protocol;
|
||||
|
||||
|
||||
/* Internal control information */
|
||||
wan_timer_info_t timer;
|
||||
|
||||
unsigned long tq_working;
|
||||
|
||||
wan_rwlock_t map_lock;
|
||||
void *api_sk_id;
|
||||
|
||||
wan_spinlock_t bh_lock;
|
||||
|
||||
unsigned char name [MAX_PROC_NAME];
|
||||
#if 0
|
||||
struct proc_dir_entry *proc_dir;
|
||||
unsigned char *proc_event_log [MAX_PROC_EVENTS];
|
||||
atomic_t proc_event_offset;
|
||||
#endif
|
||||
|
||||
wan_skb_queue_t tx_queue;
|
||||
wan_skb_queue_t rx_queue;
|
||||
wan_tasklet_t task;
|
||||
|
||||
struct wplip_dev *cur_tx;
|
||||
|
||||
int link_num;
|
||||
|
||||
atomic_t refcnt;
|
||||
|
||||
unsigned char tty_opt;
|
||||
|
||||
#ifdef WPLIP_TTY_SUPPORT
|
||||
struct tty_struct *tty;
|
||||
unsigned int tty_minor;
|
||||
unsigned int tty_open;
|
||||
unsigned char *tty_buf;
|
||||
wan_skb_queue_t tty_rx;
|
||||
wan_taskq_t tty_task_queue;
|
||||
unsigned char async_mode;
|
||||
#endif
|
||||
|
||||
wan_taskq_t prot_task;
|
||||
u32 latency_qlen;
|
||||
|
||||
} wplip_link_t;
|
||||
|
||||
|
||||
#define CALL_REQUEST_INFO_SZ 512
|
||||
|
||||
|
||||
/*
|
||||
* The logic channel per link connection control structure.
|
||||
*/
|
||||
typedef struct wplip_dev{
|
||||
|
||||
wanpipe_common_t common;
|
||||
|
||||
unsigned long magic;
|
||||
WAN_LIST_ENTRY(wplip_dev) list_entry;
|
||||
|
||||
unsigned short critical;
|
||||
|
||||
/* Internal control information */
|
||||
wan_skb_queue_t tx_queue;
|
||||
|
||||
/* The link we are part of */
|
||||
wplip_link_t *lip_link;
|
||||
|
||||
void *sk_id;
|
||||
unsigned char api_state;
|
||||
#if defined(__LINUX__)
|
||||
struct proc_dir_entry *dent;
|
||||
#endif
|
||||
struct net_device_stats ifstats;
|
||||
|
||||
unsigned char used;
|
||||
unsigned char protocol;
|
||||
|
||||
unsigned char name[MAX_PROC_NAME];
|
||||
|
||||
unsigned char udp_pkt_data[sizeof(wan_udp_pkt_t)+10];
|
||||
unsigned int udp_pkt_len;
|
||||
|
||||
unsigned long ipx_net_num;
|
||||
|
||||
unsigned int prot_addr;
|
||||
|
||||
unsigned int max_mtu_sz;
|
||||
unsigned int max_mtu_sz_orig;
|
||||
|
||||
atomic_t refcnt;
|
||||
pid_t pid;
|
||||
|
||||
unsigned int interface_down;
|
||||
wan_taskq_t if_task;
|
||||
|
||||
} wplip_dev_t;
|
||||
|
||||
typedef struct wplip_dev_list
|
||||
{
|
||||
unsigned long magic;
|
||||
netdevice_t *dev;
|
||||
WAN_LIST_ENTRY(wplip_dev_list) list_entry;
|
||||
}wplip_dev_list_t;
|
||||
|
||||
|
||||
typedef struct wplip_prot_iface
|
||||
{
|
||||
unsigned int init;
|
||||
wplip_prot_reg_t reg;
|
||||
void*(*prot_link_register)(void *link_ptr,
|
||||
char *devname,
|
||||
void *cfg,
|
||||
wplip_prot_reg_t *reg);
|
||||
|
||||
int (*prot_link_unregister)(void *prot_ptr);
|
||||
|
||||
void*(*prot_chan_register)(void *if_ptr,
|
||||
void *prot_ptr,
|
||||
char *devname,
|
||||
void *cfg,
|
||||
unsigned char type);
|
||||
|
||||
int (*prot_chan_unregister)(void *chan_ptr);
|
||||
|
||||
int (*open_chan) (void *chan_ptr);
|
||||
int (*close_chan)(void *chan_ptr);
|
||||
|
||||
int (*tx) (void *chan_ptr, void *skb, int type);
|
||||
int (*ioctl) (void *chan_ptr, int cmd, void *arg);
|
||||
int (*pipemon)(void *chan,
|
||||
int cmd,
|
||||
int dlci,
|
||||
unsigned char* data,
|
||||
unsigned int *len);
|
||||
|
||||
int (*rx) (void *prot_ptr, void *rx_pkt);
|
||||
int (*timer) (void *prot_ptr, unsigned int *period, unsigned int);
|
||||
int (*bh) (void *);
|
||||
int (*snmp) (void *, void *);
|
||||
int (*task) (void *prot_ptr);
|
||||
|
||||
}wplip_prot_iface_t;
|
||||
|
||||
#define MAX_LIP_PROTOCOLS 255
|
||||
|
||||
#define WPLIP_PROT_ASSERT(prot,ret) \
|
||||
if (prot >= MAX_LIP_PROTOCOLS){ \
|
||||
DEBUG_EVENT("%s:%d: Lip Error: Invalid Protocol 0x%X\n",\
|
||||
__FUNCTION__,__LINE__,prot);\
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define WPLIP_PROT_FUNC_ASSERT(prot,func,ret) \
|
||||
if (prot->func == NULL){ \
|
||||
DEBUG_EVENT("%s:%d: Lip Error: Protocol function not supported\n",\
|
||||
__FUNCTION__,__LINE__);\
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define WPLIP_PROT_EXIST(prot,ret) \
|
||||
if (wplip_prot_ops[prot] == NULL){ \
|
||||
DEBUG_EVENT("%s:%d: Lip Error: Unsupported/UnCompiled Protocol 0x%X\n",\
|
||||
__FUNCTION__,__LINE__,prot);\
|
||||
return ret; \
|
||||
}
|
||||
|
||||
|
||||
#define wplip_hold(_dev) wan_atomic_inc(&(_dev)->refcnt)
|
||||
#define wplip_put(_dev) wan_atomic_dec(&(_dev)->refcnt)
|
||||
|
||||
#define wplip_get_link(_reg) (_reg)->wplip_link
|
||||
#define wplip_get_lipdev(_dev) (wplip_dev_t*)wan_netif_priv((_dev))
|
||||
|
||||
#define wplip_liplink_magic(_link) ((_link)->magic == WPLIP_MAGIC_LINK)
|
||||
#define wplip_lipdev_magic(_lipdev) ((_lipdev)->magic == WPLIP_MAGIC_DEV)
|
||||
|
||||
|
||||
/* Function Prototypes */
|
||||
|
||||
/* wanpipe_lip_iface.c */
|
||||
extern unsigned char wplip_link_num[];
|
||||
extern wan_rwlock_t wplip_link_lock;
|
||||
extern struct wplip_link_list list_head_link;
|
||||
extern int wplip_data_rx_up(wplip_dev_t* lip_dev, void *skb);
|
||||
extern int wplip_data_tx_down(wplip_link_t *lip_link, void *skb);
|
||||
extern int wplip_callback_tx_down(void *lip_dev, void *skb);
|
||||
extern int wplip_link_callback_tx_down(void *lip_link, void *skb);
|
||||
extern int wplip_callback_kick_prot_task(void *lip_link);
|
||||
extern int wplip_set_hw_idle_frame (void *liplink_ptr, unsigned char *data, int len);
|
||||
|
||||
/* wanpipe_lip_sub.c */
|
||||
extern wplip_link_t* wplip_create_link(char *devname);
|
||||
extern void wplip_remove_link(wplip_link_t *lip_link);
|
||||
extern void wplip_insert_link(wplip_link_t *lip_link);
|
||||
extern int wplip_link_exists(wplip_link_t *lip_link);
|
||||
extern void wplip_free_link(wplip_link_t *lip_link);
|
||||
extern int wplip_lipdev_latency_change(wplip_link_t *lip_link);
|
||||
|
||||
|
||||
#if 1
|
||||
extern wplip_dev_t* wplip_create_lipdev(char *dev_name,int);
|
||||
#else
|
||||
extern wplip_dev_t* wplip_create_lipdev(char *dev_name);
|
||||
#endif
|
||||
extern void wplip_free_lipdev(wplip_dev_t *lip_dev);
|
||||
extern int wplip_lipdev_exists(wplip_link_t *lip_link, char *dev_name);
|
||||
extern void wplip_remove_lipdev(wplip_link_t *lip_link,
|
||||
wplip_dev_t *lip_dev);
|
||||
extern void wplip_insert_lipdev(wplip_link_t *wplip_link,
|
||||
wplip_dev_t *wplip_dev);
|
||||
|
||||
extern unsigned int dec_to_uint (unsigned char* str, int len);
|
||||
|
||||
/* wanpipe_lip_netdev.c */
|
||||
extern int wplip_open_dev(netdevice_t *dev);
|
||||
extern int wplip_stop_dev(netdevice_t *dev);
|
||||
extern struct net_device_stats * wplip_ifstats (netdevice_t *dev);
|
||||
extern int wplip_if_send (netskb_t *skb, netdevice_t *dev);
|
||||
extern int wplip_if_init(netdevice_t *dev);
|
||||
extern void wplip_kick(void *wplip_id,int reason);
|
||||
|
||||
|
||||
# ifdef WPLIP_TTY_SUPPORT
|
||||
/* wanpipe_lip_tty.c */
|
||||
extern int wplip_reg_tty(wplip_link_t *lip_link, wanif_conf_t *conf);
|
||||
extern int wplip_unreg_tty(wplip_link_t *lip_link);
|
||||
extern int wanpipe_tty_trigger_poll(wplip_link_t *lip_link);
|
||||
extern void wplip_tty_receive(wplip_link_t *lip_link, void *skb);
|
||||
#endif
|
||||
|
||||
/* wanpipe_lip_prot.c */
|
||||
extern int wplip_init_prot(void);
|
||||
extern int wplip_free_prot(void);
|
||||
extern int wplip_reg_link_prot(wplip_link_t *lip_link, wanif_conf_t *conf);
|
||||
extern int wplip_unreg_link_prot(wplip_link_t *lip_link);
|
||||
extern int wplip_reg_lipdev_prot(wplip_dev_t *lip_dev, wanif_conf_t *conf);
|
||||
extern int wplip_unreg_lipdev_prot(wplip_dev_t *lip_dev);
|
||||
extern int wplip_open_lipdev_prot(wplip_dev_t *lip_dev);
|
||||
extern int wplip_close_lipdev_prot(wplip_dev_t *lip_dev);
|
||||
extern int wplip_prot_rx(wplip_link_t *lip_link, netskb_t *skb);
|
||||
|
||||
#if 0
|
||||
extern void wplip_prot_rx_kick(wplip_dev_t *lip_dev);
|
||||
#endif
|
||||
extern int wplip_prot_kick(wplip_link_t *lip_link, wplip_dev_t *lip_dev);
|
||||
extern int wplip_prot_tx(wplip_dev_t *lip_dev, wan_api_tx_hdr_t *api_tx_hdr, netskb_t *skb, int type);
|
||||
extern int wplip_prot_oob(wplip_dev_t *lip_dev, unsigned char*, int reason);
|
||||
extern int wplip_prot_ioctl(wplip_dev_t *lip_dev, int cmd, void *arg);
|
||||
extern int wplip_prot_udp_mgmt_pkt(wplip_dev_t * lip_dev, wan_udp_pkt_t *wan_udp_pkt);
|
||||
extern int wplip_prot_udp_snmp_pkt(wplip_dev_t * lip_dev, int cmd, struct ifreq* ifr);
|
||||
|
||||
|
||||
extern int wplip_link_prot_change_state(void *wplip_id,
|
||||
int state,
|
||||
unsigned char*,int);
|
||||
extern int wplip_lipdev_prot_change_state(void *wplip_id,
|
||||
int state,
|
||||
unsigned char*,int);
|
||||
|
||||
|
||||
extern unsigned int wplip_get_ipv4_addr (void *wplip_id, int type);
|
||||
extern int wplip_set_ipv4_addr (void *wplip_id,
|
||||
unsigned int,
|
||||
unsigned int,
|
||||
unsigned int,
|
||||
unsigned int);
|
||||
extern void wplip_add_gateway(void *wplip_id);
|
||||
extern void wplip_trigger_if_task(wplip_dev_t *lip_dev);
|
||||
|
||||
void wplip_ipxwan_switch_net_num(unsigned char *sendpacket,
|
||||
unsigned long network_number,
|
||||
unsigned long *orig_dnet,
|
||||
unsigned long *orig_snet,
|
||||
unsigned char incoming);
|
||||
|
||||
|
||||
void wplip_ipxwan_restore_net_num(unsigned char *sendpacke,
|
||||
unsigned long orig_dnet,
|
||||
unsigned long orig_snet);
|
||||
|
||||
|
||||
int wplip_handle_ipxwan(wplip_dev_t *lip_dev, void *skb);
|
||||
|
||||
#if 0
|
||||
extern int gdbg_flag;
|
||||
#endif
|
||||
|
||||
static __inline int wplip_trigger_bh(wplip_link_t *lip_link)
|
||||
{
|
||||
if (wan_test_bit(WPLIP_LINK_DOWN,&lip_link->tq_working)){
|
||||
return -ENETDOWN;
|
||||
}
|
||||
|
||||
if (wan_skb_queue_len(&lip_link->rx_queue)){
|
||||
WAN_TASKLET_SCHEDULE((&lip_link->task));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (wan_test_bit(WPLIP_BH_AWAITING_KICK,&lip_link->tq_working)){
|
||||
#if 0
|
||||
if (gdbg_flag){
|
||||
DEBUG_EVENT("%s: Waiting for kick!\n",
|
||||
__FUNCTION__);
|
||||
}
|
||||
#endif
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
#if 0
|
||||
gdbg_flag=0;
|
||||
#endif
|
||||
WAN_TASKLET_SCHEDULE((&lip_link->task));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline int wplip_kick_trigger_bh(wplip_link_t *lip_link)
|
||||
{
|
||||
wan_clear_bit(WPLIP_BH_AWAITING_KICK,&lip_link->tq_working);
|
||||
WAN_TASKLET_SCHEDULE((&lip_link->task));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static __inline int wplip_decode_protocol(wplip_dev_t *lip_dev, void *ptr)
|
||||
{
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
struct sockaddr *sa = (struct sockaddr *)ptr;
|
||||
|
||||
|
||||
switch (sa->sa_family){
|
||||
|
||||
case AF_INET:
|
||||
return WPLIP_IP;
|
||||
case AF_INET6:
|
||||
return WPLIP_IPV6;
|
||||
case AF_IPX:
|
||||
return WPLIP_IPX;
|
||||
default:
|
||||
return WPLIP_IP;
|
||||
}
|
||||
|
||||
#elif defined(__LINUX__)
|
||||
struct sk_buff *skb=(struct sk_buff*)ptr;
|
||||
|
||||
if (lip_dev->common.usedby == BRIDGE ||
|
||||
lip_dev->common.usedby == BRIDGE_NODE){
|
||||
return WPLIP_ETH;
|
||||
|
||||
}
|
||||
|
||||
if (lip_dev->common.lip_prot == WANCONFIG_LAPD) {
|
||||
return WPLIP_LAPD;
|
||||
}
|
||||
|
||||
if (lip_dev->common.usedby == STACK){
|
||||
switch (lip_dev->common.lip_prot){
|
||||
case WANCONFIG_PPP:
|
||||
case WANCONFIG_TTY:
|
||||
return WPLIP_PPP;
|
||||
case WANCONFIG_FR:
|
||||
return WPLIP_FR;
|
||||
}
|
||||
/* Break out down */
|
||||
}
|
||||
|
||||
switch (htons(skb->protocol)){
|
||||
|
||||
case ETH_P_IP:
|
||||
return WPLIP_IP;
|
||||
case ETH_P_IPV6:
|
||||
return WPLIP_IPV6;
|
||||
case ETH_P_IPX:
|
||||
return WPLIP_IPX;
|
||||
}
|
||||
|
||||
return WPLIP_IP;
|
||||
#else
|
||||
# error ("wplip_decode_protocol: Unknown Protocol!\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if defined(__LINUX__)
|
||||
static __inline void wp_lip_config_bridge_mode(wplip_dev_t *lip_dev)
|
||||
{
|
||||
netdevice_t * dev = lip_dev->common.dev;
|
||||
/* Setup the interface for Bridging */
|
||||
int hw_addr=0;
|
||||
ether_setup(dev);
|
||||
|
||||
/* Use a random number to generate the MAC address */
|
||||
memcpy(dev->dev_addr, "\xFE\xFC\x00\x00\x00\x00", 6);
|
||||
get_random_bytes(&hw_addr, sizeof(hw_addr));
|
||||
*(int *)(dev->dev_addr + 2) += hw_addr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*__KERNEL__*/
|
||||
#endif
|
||||
|
||||
/*_WANPIPE_X25_HEADER_*/
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define WPLIP_ASSERT(reg,ret) if (!(reg)) {\
|
||||
DEBUG_EVENT("%s:%d Assert Error!\n", \
|
||||
__FUNCTION__,__LINE__); \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#define WPLIP_ASSERT_VOID(reg) if (!(reg)) {\
|
||||
DEBUG_EVENT("%s:%d Assert Error!\n", \
|
||||
__FUNCTION__,__LINE__); \
|
||||
return; \
|
||||
}
|
||||
|
||||
#define FUNC_BEGIN() DEBUG_EVENT("%s:%d ---Begin---\n",__FUNCTION__,__LINE__);
|
||||
#define FUNC_END() DEBUG_EVENT("%s:%d ---End---\n\n",__FUNCTION__,__LINE__);
|
||||
|
||||
|
||||
#define X25_DEBUG_MEM
|
||||
|
||||
#ifdef X25_DEBUG_MEM
|
||||
|
||||
#define X25_SKB_DEC(x) atomic_sub(x,&x25_skb_alloc)
|
||||
#define X25_SKB_INC(x) atomic_add(x,&x25_skb_alloc)
|
||||
|
||||
#define ALLOC_SKB(skb,len) { skb = dev_alloc_skb(len); \
|
||||
if (skb != NULL){ X25_SKB_INC(skb->truesize);}else{ WAN_MEM_ASSERT("X25");} }
|
||||
#define KFREE_SKB(skb) { X25_SKB_DEC(skb->truesize); dev_kfree_skb_any(skb); }
|
||||
|
||||
|
||||
#define X25_MEM_DEC(x) atomic_sub(x,&x25_mem_alloc)
|
||||
#define X25_MEM_INC(x) atomic_add(x,&x25_mem_alloc)
|
||||
|
||||
#define KMALLOC(ptr,len,flag) { ptr=kmalloc(len, flag); \
|
||||
if (ptr != NULL){ X25_MEM_INC(len);} else {WAN_MEM_ASSERT("X25");}}
|
||||
#define KFREE(ptr) {X25_MEM_DEC(sizeof(*ptr)); kfree(ptr);}
|
||||
|
||||
#else
|
||||
#define KMALLOC(ptr,len,flag) ptr=kmalloc(len, flag)
|
||||
#define KFREE(ptr) kfree(ptr)
|
||||
|
||||
#define ALLOC_SKB(new_skb,len, dsp) new_skb = dev_alloc_skb(len)
|
||||
#define KFREE_SKB(skb) dev_kfree_skb_any(skb)
|
||||
|
||||
#define X25_SKB_DEC(x)
|
||||
#define X25_SKB_INC(x)
|
||||
#define X25_MEM_DEC(x)
|
||||
#define X25_MEM_INC(x)
|
||||
#endif
|
||||
|
||||
#define is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0)
|
|
@ -300,7 +300,8 @@ typedef struct wanpipe_tdm_api{
|
|||
|
||||
#ifdef WAN_KERNEL
|
||||
|
||||
#define WP_TDM_API_MAX_LEN 1024
|
||||
/* Maximum API Len = 200ms = 1600 */
|
||||
#define WP_TDM_API_MAX_LEN 8*200
|
||||
#define WP_TDM_API_CHUNK_SZ 8
|
||||
|
||||
enum {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#define WANPIPE_COMPANY "Sangoma Technologies Inc"
|
||||
|
||||
/********** LINUX **********/
|
||||
#define WANPIPE_VERSION "3.2.3"
|
||||
#define WANPIPE_VERSION "3.2.4"
|
||||
#define WANPIPE_SUB_VERSION "0"
|
||||
#define WANPIPE_VERSION_BETA 0
|
||||
#define WANPIPE_LITE_VERSION "1.1.1"
|
||||
|
|
|
@ -248,6 +248,17 @@ typedef struct wan_conf
|
|||
/*----------------------------------------------------------------------------
|
||||
* WAN device data space.
|
||||
*/
|
||||
|
||||
typedef struct wan_rtp_chan
|
||||
{
|
||||
netskb_t *rx_skb;
|
||||
netskb_t *tx_skb;
|
||||
u32 rx_ts;
|
||||
u32 tx_ts;
|
||||
}wan_rtp_chan_t;
|
||||
|
||||
|
||||
|
||||
struct wan_dev_le {
|
||||
WAN_LIST_ENTRY(wan_dev_le) dev_link;
|
||||
netdevice_t *dev;
|
||||
|
@ -404,6 +415,13 @@ typedef struct wan_device
|
|||
int (*hwec_enable)(void* card_id, int, int);
|
||||
|
||||
void (*critical_event) (void *, int);
|
||||
|
||||
unsigned long rtp_tap_call_map;
|
||||
unsigned long rtp_tap_call_status;
|
||||
wan_rtp_chan_t rtp_chan[32];
|
||||
void *rtp_dev;
|
||||
int rtp_len;
|
||||
void (*rtp_tap)(void *card, u8 chan, u8* rx, u8* tx, u32 len);
|
||||
} wan_device_t;
|
||||
|
||||
WAN_LIST_HEAD(wan_devlist_, wan_device);
|
||||
|
@ -454,6 +472,8 @@ extern void unregister_wanpipe_fw_protocol (void);
|
|||
extern void wan_skb_destructor (struct sk_buff *skb);
|
||||
#endif
|
||||
|
||||
extern unsigned long wan_get_ip_address (netdevice_t *dev, int option);
|
||||
|
||||
void *wanpipe_ec_register(void*, int);
|
||||
int wanpipe_ec_unregister(void*,void*);
|
||||
int wanpipe_ec_isr(void*,void*);
|
||||
|
|
|
@ -1,56 +1,56 @@
|
|||
0xf7567a8a wanpipe_api_buf_check /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xf27fa082 wanpipe_lip_connect /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xc8a15fa6 sdla_register /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0xf7b65505 wp_sppp_input /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0xf08131ff wanpipe_api_sock_rx /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xeb489e63 wanrouter_proc_add_interface /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x59fb2682 sdla_hw_probe /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0x9a7a6658 wanpipe_lip_rx /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x580596c4 proc_router /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x94be524d register_wanec_iface /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xde2890ff bind_api_listen_to_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x524e2f20 register_wanpipe_fw_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x6eee717c register_wan_device net/wanrouter/wanrouter EXPORT_SYMBOL
|
||||
0xd3eaa2bd wanrouter_proc_add_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x43891608 wp_sppp_attach /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0xf03004fc wp_sppp_detach /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0x56712648 wanpipe_ec_event_ctrl /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x7cd3c2bc wanpipe_ec_poll /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xf8093f70 wanrouter_proc_delete_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xdfd0f6c6 sdla_get_hw_adptr_cnt /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0x10723cdb wanpipe_ec_register /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xa49dc980 wp_sppp_change_mtu /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0xd981a1fc wanrouter_encapsulate net/wanrouter/wanrouter EXPORT_SYMBOL
|
||||
0xecdb7fad wan_skb_destructor /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x563e1e4c register_wanpipe_api_socket /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xade2d0d7 sdla_get_hw_probe /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0x53c87809 proc_add_line /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x22a2999f sdla_unregister /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0xd6fdd720 wanrouter_type_trans net/wanrouter/wanrouter EXPORT_SYMBOL
|
||||
0x8506b552 wan_get_ip_address /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x5de7fb30 wan_set_ip_address /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x7d68ed07 protocol_disconnected /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xfabc999d bind_api_to_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x38eb6851 unregister_wanpipe_api_socket /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xaac011d2 wanpipe_lip_kick /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x3b604364 unbind_api_listen_from_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x6df6c4e0 wan_run_wanrouter /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xeb418feb sdla_hw_bridge_probe /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0x04df932b unregister_wanec_iface /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x19823ac0 wanpipe_ec_isr /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x13405f6b unregister_wanpipe_fw_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x85e65535 wanpipe_api_listen_rx /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x2bcba8b7 wp_sppp_open /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0x656c1338 wp_sppp_reopen /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0xd6eb126f wp_sppp_do_ioctl /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0x5b7efb57 wanpipe_api_poll_wake /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x02fd3230 wan_add_gateway /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x03229b9c wp_sppp_close /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0x77bcb76a wanrouter_proc_delete_interface /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x2f21a326 unregister_wanpipe_lip_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x0ebe03d1 unregister_wan_device net/wanrouter/wanrouter EXPORT_SYMBOL
|
||||
0x22317d82 wanpipe_lip_disconnect /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x0af8ffa5 protocol_connected /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x53350bd4 wanpipe_ec_unregister /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xab182e38 register_wanpipe_lip_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xd9baedd9 protocol_connecting /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xf7567a8a wanpipe_api_buf_check /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xf27fa082 wanpipe_lip_connect /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xb4edda1f sdla_register /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0x65961c99 wp_sppp_input /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0xb916f196 wanpipe_api_sock_rx /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x056e1de4 wanrouter_proc_add_interface /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x59fb2682 sdla_hw_probe /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0x9a7a6658 wanpipe_lip_rx /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x85f368da proc_router /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x94be524d register_wanec_iface /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x60999505 bind_api_listen_to_protocol /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x524e2f20 register_wanpipe_fw_protocol /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xe88bfb7c register_wan_device /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x10db02a6 wanrouter_proc_add_protocol /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x10d5642a wp_sppp_attach /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0x81da5ca3 wp_sppp_detach /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0x56712648 wanpipe_ec_event_ctrl /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x7cd3c2bc wanpipe_ec_poll /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x890ec208 wanrouter_proc_delete_protocol /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xdfd0f6c6 sdla_get_hw_adptr_cnt /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0x10723cdb wanpipe_ec_register /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xefa95f45 wp_sppp_change_mtu /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0xe00ced6c wanrouter_encapsulate /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xd66c38fa wan_skb_destructor /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xdb54c778 register_wanpipe_api_socket /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xade2d0d7 sdla_get_hw_probe /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0x30c72f04 proc_add_line /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x22a2999f sdla_unregister /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0xce02307d wanrouter_type_trans /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x859feb6e wan_get_ip_address /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x1ce26925 wan_set_ip_address /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x7d68ed07 protocol_disconnected /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x1a4bdc8b bind_api_to_protocol /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x38eb6851 unregister_wanpipe_api_socket /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xaac011d2 wanpipe_lip_kick /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x3b604364 unbind_api_listen_from_protocol /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x6df6c4e0 wan_run_wanrouter /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xeb418feb sdla_hw_bridge_probe /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL
|
||||
0x04df932b unregister_wanec_iface /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x19823ac0 wanpipe_ec_isr /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x13405f6b unregister_wanpipe_fw_protocol /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x22a97a48 wanpipe_api_listen_rx /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x960df2b1 wp_sppp_open /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0xf43f7591 wp_sppp_reopen /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0x8583d23f wp_sppp_do_ioctl /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0x5b7efb57 wanpipe_api_poll_wake /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x40a869ba wan_add_gateway /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0xfbb5df19 wp_sppp_close /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL
|
||||
0x41340b5a wanrouter_proc_delete_interface /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x2f21a326 unregister_wanpipe_lip_protocol /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x0ebe03d1 unregister_wan_device /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x22317d82 wanpipe_lip_disconnect /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x59395190 protocol_connected /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x53350bd4 wanpipe_ec_unregister /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x0b745285 register_wanpipe_lip_protocol /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
0x4f7101a8 protocol_connecting /root/development/3.2/wanpipe-3.2.4.pe8/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL
|
||||
|
|
|
@ -585,6 +585,20 @@ int a104_global_chip_config(sdla_t *card)
|
|||
__FUNCTION__, __LINE__);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (card->adptr_subtype == AFT_SUBTYPE_SHARK){
|
||||
u16 max_ec_chans;
|
||||
card->hw_iface.getcfg(card->hw, SDLA_HWEC_NO, &max_ec_chans);
|
||||
|
||||
if (max_ec_chans) {
|
||||
DEBUG_EVENT("%s: Global HWEC Clock Source : %i\n",
|
||||
card->devname,card->wandev.comm_port+1);
|
||||
card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG,®);
|
||||
aft_chipcfg_set_oct_clk_src(®,card->wandev.comm_port);
|
||||
card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg);
|
||||
}
|
||||
}
|
||||
|
||||
#endif/*INIT_FE_ONLY*/
|
||||
return 0;
|
||||
}
|
||||
|
@ -668,6 +682,31 @@ static int aft_ds_set_clock_ref(sdla_t *card, u32 *reg, u32 master_port)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void aft_set_hwec_clock_src(sdla_t *card)
|
||||
{
|
||||
wan_smp_flag_t smp_flags, flags;
|
||||
|
||||
if (card->adptr_subtype == AFT_SUBTYPE_SHARK && card->hwec_conf.clk_src){
|
||||
|
||||
u32 cfg_reg;
|
||||
card->hwec_conf.clk_src = WAN_FE_LINENO(&card->fe);
|
||||
|
||||
DEBUG_EVENT("%s: Global EC Clock Port = %d\n",
|
||||
card->devname,
|
||||
card->hwec_conf.clk_src+1);
|
||||
|
||||
|
||||
card->hw_iface.hw_lock(card->hw,&smp_flags);
|
||||
wan_spin_lock_irq(&card->wandev.lock,&flags);
|
||||
|
||||
card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG, &cfg_reg);
|
||||
aft_chipcfg_set_oct_clk_src(&cfg_reg,card->hwec_conf.clk_src);
|
||||
card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG, cfg_reg);
|
||||
|
||||
wan_spin_unlock_irq(&card->wandev.lock,&flags);
|
||||
card->hw_iface.hw_unlock(card->hw,&smp_flags);
|
||||
}
|
||||
}
|
||||
|
||||
int a104_chip_config(sdla_t *card)
|
||||
{
|
||||
|
@ -689,25 +728,6 @@ int a104_chip_config(sdla_t *card)
|
|||
card->devname, card->wandev.comm_port+1);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (card->adptr_subtype == AFT_SUBTYPE_SHARK){
|
||||
|
||||
/* FIXME: Do not hardcode port numbers */
|
||||
if ((int)card->hwec_conf.clk_src < 0 ||
|
||||
card->hwec_conf.clk_src > 7) {
|
||||
DEBUG_EVENT("%s: ERROR: Invalid SHARK Octasic Clock Source %d\n",
|
||||
card->devname,card->hwec_conf.clk_src);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
DEBUG_EVENT("%s: Global EC Clock Port = %d\n",
|
||||
card->devname,
|
||||
card->hwec_conf.clk_src+1);
|
||||
|
||||
aft_chipcfg_set_oct_clk_src(®,card->hwec_conf.clk_src);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* On A108 Cards the T1/E1 will be configured per PORT
|
||||
* not per CARD */
|
||||
|
@ -894,6 +914,7 @@ int a104_chip_config(sdla_t *card)
|
|||
|
||||
card->hw_iface.getcfg(card->hw, SDLA_HWEC_NO, &max_ec_chans);
|
||||
|
||||
|
||||
card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG, &cfg_reg);
|
||||
if (max_ec_chans > aft_chipcfg_get_ec_channels(cfg_reg)){
|
||||
DEBUG_EVENT("%s: Critical Error: Exceeded Maximum Available Echo Channels!\n",
|
||||
|
@ -913,6 +934,8 @@ int a104_chip_config(sdla_t *card)
|
|||
if (!card->wandev.ec_dev) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
aft_set_hwec_clock_src(card);
|
||||
#else
|
||||
|
||||
DEBUG_EVENT("%s: Wanpipe HW Echo Canceller module is not compiled!\n",
|
||||
|
|
|
@ -257,7 +257,7 @@ static int sdla_ds_te1_pre_release(void* pfe);
|
|||
static int sdla_ds_te1_TxChanCtrl(sdla_fe_t* fe, int channel, int enable);
|
||||
static int sdla_ds_te1_RxChanCtrl(sdla_fe_t* fe, int channel, int enable);
|
||||
static int sdla_ds_te1_disable_irq(void* pfe); /* Change to static */
|
||||
static int sdla_ds_te1_intr_ctrl(sdla_fe_t*, int, int, int, unsigned int);
|
||||
static int sdla_ds_te1_intr_ctrl(sdla_fe_t*, int, u_int8_t, u_int8_t, unsigned int);
|
||||
static int sdla_ds_te1_check_intr(sdla_fe_t *fe);
|
||||
static int sdla_ds_te1_intr(sdla_fe_t *fe);
|
||||
static int sdla_ds_te1_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data);
|
||||
|
@ -663,6 +663,160 @@ static int sdla_ds_te1_global_unconfig(void* pfe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
** sdla_ds_te1_cfg_verify()
|
||||
**
|
||||
** Description: Verify T1/E1 Front-End configuration
|
||||
** Arguments:
|
||||
** Returns: 0 - successfully, otherwise -EINVAL.
|
||||
*******************************************************************************/
|
||||
static int sdla_ds_te1_cfg_verify(void* pfe)
|
||||
{
|
||||
sdla_fe_t *fe = (sdla_fe_t*)pfe;
|
||||
|
||||
|
||||
if (IS_T1_FEMEDIA(fe) || IS_J1_FEMEDIA(fe)){
|
||||
|
||||
/* Verify FE framing type */
|
||||
switch(WAN_FE_FRAME(fe)){
|
||||
case WAN_FR_D4: case WAN_FR_ESF: case WAN_FR_UNFRAMED:
|
||||
break;
|
||||
case WAN_FR_NONE:
|
||||
DEBUG_EVENT("%s: Defaulting T1 Frame = ESF\n",
|
||||
fe->name);
|
||||
WAN_FE_FRAME(fe) = WAN_FR_ESF;
|
||||
break;
|
||||
default:
|
||||
DEBUG_EVENT("%s: Error: Invalid %s FE Framing type (%X)\n",
|
||||
fe->name,
|
||||
FE_MEDIA_DECODE(fe),
|
||||
WAN_FE_FRAME(fe));
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Verify FE line code type */
|
||||
switch(WAN_FE_LCODE(fe)){
|
||||
case WAN_LCODE_B8ZS: case WAN_LCODE_AMI:
|
||||
break;
|
||||
case WAN_LCODE_NONE:
|
||||
DEBUG_EVENT("%s: Defaulting T1 Line Code = B8ZS\n",
|
||||
fe->name);
|
||||
WAN_FE_LCODE(fe) = WAN_LCODE_B8ZS;
|
||||
break;
|
||||
default:
|
||||
DEBUG_EVENT("%s: Error: Invalid %s FE Line code type (%X)\n",
|
||||
fe->name,
|
||||
FE_MEDIA_DECODE(fe),
|
||||
WAN_FE_LCODE(fe));
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Verify LBO */
|
||||
switch(WAN_TE1_LBO(fe)) {
|
||||
case WAN_T1_LBO_0_DB: case WAN_T1_LBO_75_DB:
|
||||
case WAN_T1_LBO_15_DB: case WAN_T1_LBO_225_DB:
|
||||
case WAN_T1_0_133: case WAN_T1_133_266: case WAN_T1_110_220:
|
||||
case WAN_T1_266_399: case WAN_T1_220_330:
|
||||
case WAN_T1_399_533: case WAN_T1_330_440: case WAN_T1_440_550:
|
||||
case WAN_T1_533_655: case WAN_T1_550_660:
|
||||
break;
|
||||
case WAN_T1_LBO_NONE:
|
||||
DEBUG_EVENT("%s: Defaulting T1 LBO = 0 db\n",
|
||||
fe->name);
|
||||
WAN_TE1_LBO(fe) = WAN_T1_LBO_0_DB;
|
||||
break;
|
||||
default:
|
||||
DEBUG_EVENT("%s: Error: Invalid %s LBO value (%X)\n",
|
||||
fe->name,
|
||||
FE_MEDIA_DECODE(fe),
|
||||
WAN_TE1_LBO(fe));
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
}else if (IS_E1_FEMEDIA(fe)){
|
||||
|
||||
/* Verify FE framing type */
|
||||
switch(WAN_FE_FRAME(fe)){
|
||||
case WAN_FR_NCRC4: case WAN_FR_CRC4: case WAN_FR_UNFRAMED:
|
||||
break;
|
||||
case WAN_FR_NONE:
|
||||
DEBUG_EVENT("%s: Defaulting E1 Frame = CRC4\n",
|
||||
fe->name);
|
||||
WAN_FE_FRAME(fe) = WAN_FR_CRC4;
|
||||
break;
|
||||
default:
|
||||
DEBUG_EVENT("%s: Error: Invalid %s FE Framing type (%X)\n",
|
||||
fe->name,
|
||||
FE_MEDIA_DECODE(fe),
|
||||
WAN_FE_FRAME(fe));
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Verify FE line code type */
|
||||
switch(WAN_FE_LCODE(fe)){
|
||||
case WAN_LCODE_HDB3: case WAN_LCODE_AMI:
|
||||
break;
|
||||
case WAN_LCODE_NONE:
|
||||
DEBUG_EVENT("%s: Defaulting E1 Line Code = HDB3\n",
|
||||
fe->name);
|
||||
WAN_FE_LCODE(fe) = WAN_LCODE_HDB3;
|
||||
break;
|
||||
default:
|
||||
DEBUG_EVENT("%s: Error: Invalid %s FE Line code type (%X)\n",
|
||||
fe->name,
|
||||
FE_MEDIA_DECODE(fe),
|
||||
WAN_FE_LCODE(fe));
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Verify LBO */
|
||||
switch(WAN_TE1_LBO(fe)) {
|
||||
case WAN_E1_120: case WAN_E1_75:
|
||||
break;
|
||||
case WAN_T1_LBO_NONE:
|
||||
DEBUG_EVENT("%s: Defaulting E1 LBO = 120 OH\n",
|
||||
fe->name);
|
||||
WAN_TE1_LBO(fe) = WAN_E1_120;
|
||||
break;
|
||||
default:
|
||||
DEBUG_EVENT("%s: Error: Invalid %s LBO value (%X)\n",
|
||||
fe->name,
|
||||
FE_MEDIA_DECODE(fe),
|
||||
WAN_TE1_LBO(fe));
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(WAN_TE1_SIG_MODE(fe)){
|
||||
case WAN_TE1_SIG_CAS: case WAN_TE1_SIG_CCS:
|
||||
break;
|
||||
case WAN_TE1_SIG_NONE:
|
||||
DEBUG_EVENT("%s: Defaulting E1 Signalling = CCS\n",
|
||||
fe->name);
|
||||
WAN_TE1_SIG_MODE(fe) = WAN_TE1_SIG_CCS;
|
||||
break;
|
||||
default:
|
||||
DEBUG_EVENT("%s: Error: Invalid E1 Signalling type (%X)\n",
|
||||
fe->name,
|
||||
WAN_TE1_SIG_MODE(fe));
|
||||
return -EINVAL;
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
DEBUG_EVENT("%s: Error: Invalid FE Media type (%X)\n",
|
||||
fe->name,
|
||||
WAN_FE_MEDIA(fe));
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
** sdla_ds_te1_chip_config()
|
||||
**
|
||||
|
@ -766,8 +920,10 @@ static int sdla_ds_te1_chip_config(void* pfe)
|
|||
WRITE_REG(REG_RCR1, value | BIT_RCR1_E1_SYNCE);
|
||||
break;
|
||||
default:
|
||||
DEBUG_EVENT("%s: Unsupported DS Frame mode (%X)\n",
|
||||
fe->name, WAN_FE_FRAME(fe));
|
||||
DEBUG_EVENT("%s: Error: Invalid %s Frame mode (%X:%s)\n",
|
||||
fe->name,
|
||||
FE_MEDIA_DECODE(fe),
|
||||
WAN_FE_FRAME(fe), FE_FRAME_DECODE(fe));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -805,8 +961,10 @@ static int sdla_ds_te1_chip_config(void* pfe)
|
|||
break;
|
||||
|
||||
default:
|
||||
DEBUG_EVENT("%s: Unsupported DS Line code mode (%X)\n",
|
||||
fe->name, WAN_FE_LCODE(fe));
|
||||
DEBUG_EVENT("%s: Error: Invalid %s Line code value (%X:%s)\n",
|
||||
fe->name,
|
||||
FE_MEDIA_DECODE(fe),
|
||||
WAN_FE_LCODE(fe), FE_LCODE_DECODE(fe));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -873,6 +1031,7 @@ static int sdla_ds_te1_chip_config(void* pfe)
|
|||
}
|
||||
|
||||
value = 0x00;
|
||||
|
||||
switch(WAN_TE1_LBO(fe)) {
|
||||
case WAN_T1_LBO_0_DB:
|
||||
value = 0x00;
|
||||
|
@ -899,6 +1058,7 @@ static int sdla_ds_te1_chip_config(void* pfe)
|
|||
break;
|
||||
case WAN_T1_399_533:
|
||||
case WAN_T1_330_440:
|
||||
case WAN_T1_440_550:
|
||||
value = BIT_LTITSR_L1 | BIT_LTITSR_L0;
|
||||
break;
|
||||
case WAN_T1_533_655:
|
||||
|
@ -912,10 +1072,11 @@ static int sdla_ds_te1_chip_config(void* pfe)
|
|||
value = 0x00;
|
||||
break;
|
||||
default:
|
||||
if (IS_E1_FEMEDIA(fe)){
|
||||
value = BIT_LTITSR_L0;
|
||||
}
|
||||
break;
|
||||
DEBUG_EVENT("%s: Error: Invalid %s LBO value (%X)\n",
|
||||
fe->name,
|
||||
FE_MEDIA_DECODE(fe),
|
||||
WAN_TE1_LBO(fe));
|
||||
return -EINVAL;
|
||||
}
|
||||
if (IS_T1_FEMEDIA(fe)){
|
||||
WRITE_REG(REG_LTITSR, value | BIT_LTITSR_TIMPL0);
|
||||
|
@ -977,13 +1138,19 @@ static int sdla_ds_te1_chip_config(void* pfe)
|
|||
if (IS_T1_FEMEDIA(fe)){
|
||||
WRITE_REG(REG_LRISMR, value | BIT_LRISMR_RIMPM0);
|
||||
}else{
|
||||
value |= BIT_LRISMR_RIMPOFF;
|
||||
//value |= BIT_LRISMR_RIMPOFF;
|
||||
if (WAN_TE1_LBO(fe) == WAN_E1_120){
|
||||
value |= BIT_LRISMR_RIMPM1 | BIT_LRISMR_RIMPM0;
|
||||
}
|
||||
WRITE_REG(REG_LRISMR, value);
|
||||
}
|
||||
|
||||
if (IS_E1_FEMEDIA(fe) && WAN_TE1_LBO(fe) == WAN_E1_120){
|
||||
/* Feb 7, 2008
|
||||
** Adjust DAC gain (-4.88%) */
|
||||
WRITE_REG(REG_LTXLAE, 0x09);
|
||||
}
|
||||
|
||||
/* Additional front-end settings */
|
||||
value = READ_REG(REG_ERCNT);
|
||||
if (WAN_FE_LCODE(fe) == WAN_LCODE_AMI){
|
||||
|
@ -1083,6 +1250,8 @@ static int sdla_ds_te1_config(void* pfe)
|
|||
break;
|
||||
}
|
||||
|
||||
if (sdla_ds_te1_cfg_verify(fe)) return -EINVAL;
|
||||
|
||||
DEBUG_EVENT("%s: Configuring DS %s %s FE\n",
|
||||
fe->name,
|
||||
DECODE_CHIPID(fe->fe_chip_id),
|
||||
|
@ -1104,7 +1273,12 @@ static int sdla_ds_te1_config(void* pfe)
|
|||
fe->name,
|
||||
WAN_TE1_SIG_DECODE(fe));
|
||||
}
|
||||
|
||||
if (fe->fe_cfg.poll_mode == WANOPT_YES){
|
||||
sdla_t *card = (sdla_t*)fe->card;
|
||||
DEBUG_EVENT("%s: FE Poll driven\n",
|
||||
fe->name);
|
||||
card->fe_no_intr = 1;
|
||||
}
|
||||
if (sdla_ds_te1_chip_config(fe)){
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -1119,10 +1293,13 @@ static int sdla_ds_te1_config(void* pfe)
|
|||
|
||||
wan_set_bit(TE_CONFIGURED,(void*)&fe->te_param.critical);
|
||||
|
||||
#if 0
|
||||
/* Do not enable it here */
|
||||
/* Enable interrupts */
|
||||
sdla_ds_te1_intr_ctrl(fe, 0, WAN_TE_INTR_GLOBAL, WAN_FE_INTR_ENABLE, 0x00);
|
||||
/* Enable manual update pmon counter */
|
||||
sdla_ds_te1_intr_ctrl(fe, 0, WAN_TE_INTR_PMON, WAN_FE_INTR_MASK, 0x00);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1243,11 +1420,13 @@ static int sdla_ds_te1_disable_irq(void* pfe)
|
|||
{
|
||||
sdla_fe_t *fe = (sdla_fe_t*)pfe;
|
||||
|
||||
/* FIXME: Alex to disable interrupts here */
|
||||
sdla_ds_te1_intr_ctrl(fe, 0, WAN_TE_INTR_GLOBAL, WAN_FE_INTR_MASK, 0x00);
|
||||
sdla_ds_te1_intr_ctrl(fe, 0, WAN_TE_INTR_BASIC, WAN_FE_INTR_MASK, 0x00);
|
||||
sdla_ds_te1_intr_ctrl(fe, 0, WAN_TE_INTR_PMON, WAN_FE_INTR_MASK, 0x00);
|
||||
|
||||
if (fe->fe_cfg.poll_mode == WANOPT_NO){
|
||||
/* Disable interrupts here */
|
||||
sdla_ds_te1_intr_ctrl(
|
||||
fe, 0,
|
||||
(WAN_TE_INTR_GLOBAL|WAN_TE_INTR_BASIC|WAN_TE_INTR_PMON),
|
||||
WAN_FE_INTR_MASK, 0x00);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2175,7 +2354,7 @@ sdla_ds_te1_rbs_print(sdla_fe_t* fe, int last_status)
|
|||
******************************************************************************
|
||||
*/
|
||||
static int
|
||||
sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, int type, int mode, unsigned int ts_map)
|
||||
sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, u_int8_t type, u_int8_t mode, unsigned int ts_map)
|
||||
{
|
||||
unsigned char mask, value;
|
||||
unsigned char rscse;
|
||||
|
@ -2183,12 +2362,12 @@ sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, int type, int mode, unsigned int
|
|||
|
||||
WAN_ASSERT(fe->write_fe_reg == NULL);
|
||||
WAN_ASSERT(fe->read_fe_reg == NULL);
|
||||
WAN_ASSERT(fe->fe_cfg.poll_mode == WANOPT_YES);
|
||||
|
||||
if (!wan_test_bit(TE_CONFIGURED,(void*)&fe->te_param.critical)){
|
||||
return 0;
|
||||
}
|
||||
switch(type){
|
||||
case WAN_TE_INTR_GLOBAL:
|
||||
if (type & WAN_TE_INTR_GLOBAL){
|
||||
mask = READ_REG(REG_GFIMR);
|
||||
if (mode == WAN_FE_INTR_ENABLE){
|
||||
//mask |= (1<<WAN_FE_LINENO(fe));
|
||||
|
@ -2218,9 +2397,9 @@ sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, int type, int mode, unsigned int
|
|||
mask &= ~(1<<WAN_DS_REGBITMAP(fe));
|
||||
}
|
||||
WRITE_REG(REG_GBIMR, mask);
|
||||
break;
|
||||
}
|
||||
|
||||
case WAN_TE_INTR_BASIC:
|
||||
if (type & WAN_TE_INTR_BASIC){
|
||||
if (mode == WAN_FE_INTR_ENABLE){
|
||||
unsigned char mask = 0x00;
|
||||
|
||||
|
@ -2253,9 +2432,9 @@ sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, int type, int mode, unsigned int
|
|||
|
||||
WRITE_REG(REG_LSIMR, 0x00);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WAN_TE_INTR_SIGNALLING:
|
||||
if (type & WAN_TE_INTR_SIGNALLING){
|
||||
for(ch = 1; ch <= fe->te_param.max_channels; ch++){
|
||||
if (!wan_test_bit(ch, &ts_map)){
|
||||
continue;
|
||||
|
@ -2285,9 +2464,9 @@ sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, int type, int mode, unsigned int
|
|||
value &= ~BIT_RIM4_RSCOS;
|
||||
}
|
||||
WRITE_REG(REG_RIM4, value);
|
||||
break;
|
||||
}
|
||||
|
||||
case WAN_TE_INTR_PMON:
|
||||
if (type & WAN_TE_INTR_PMON){
|
||||
value = READ_REG(REG_ERCNT);
|
||||
if (mode == WAN_FE_INTR_ENABLE){
|
||||
value &= ~BIT_ERCNT_EAMS;
|
||||
|
@ -2295,12 +2474,6 @@ sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, int type, int mode, unsigned int
|
|||
value |= BIT_ERCNT_EAMS;
|
||||
}
|
||||
WRITE_REG(REG_ERCNT, value);
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_EVENT("%s: Unsupported interrupt type %X!\n",
|
||||
fe->name, type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -2672,6 +2845,7 @@ static int sdla_ds_te1_check_intr(sdla_fe_t *fe)
|
|||
|
||||
WAN_ASSERT(fe->write_fe_reg == NULL);
|
||||
WAN_ASSERT(fe->read_fe_reg == NULL);
|
||||
WAN_ASSERT(fe->fe_cfg.poll_mode == WANOPT_YES);
|
||||
|
||||
framer_istatus = __READ_REG(REG_GFISR);
|
||||
liu_istatus = __READ_REG(REG_GLISR);
|
||||
|
@ -2755,12 +2929,13 @@ static int sdla_ds_te1_intr(sdla_fe_t *fe)
|
|||
#if 1
|
||||
if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){
|
||||
sdla_fe_timer_event_t event;
|
||||
/* AL: March 1, 2006: Mask global FE intr */
|
||||
/* AL: March 1, 2006
|
||||
** Mask global FE intr
|
||||
** Disable automatic update */
|
||||
sdla_ds_te1_intr_ctrl(
|
||||
fe, 0, WAN_TE_INTR_BASIC, WAN_FE_INTR_MASK, 0x00);
|
||||
/* Disable automatic update */
|
||||
sdla_ds_te1_intr_ctrl(
|
||||
fe, 0, WAN_TE_INTR_PMON, WAN_FE_INTR_MASK, 0x00);
|
||||
fe, 0,
|
||||
(WAN_TE_INTR_GLOBAL|WAN_TE_INTR_BASIC|WAN_TE_INTR_PMON),
|
||||
WAN_FE_INTR_MASK, 0x00);
|
||||
/* Start LINKDOWN poll */
|
||||
event.type = TE_LINKCRIT_TIMER;
|
||||
event.delay = POLLING_TE1_TIMER*5;
|
||||
|
@ -2777,18 +2952,13 @@ static int sdla_ds_te1_intr(sdla_fe_t *fe)
|
|||
if (status != fe->fe_status){
|
||||
if (fe->fe_status != FE_CONNECTED){
|
||||
sdla_fe_timer_event_t event;
|
||||
/* AL: March 1, 2006: Mask global FE intr */
|
||||
/* AL: March 1, 2006
|
||||
** Mask global FE intr
|
||||
** Disable automatic update */
|
||||
sdla_ds_te1_intr_ctrl(
|
||||
fe, 0,
|
||||
WAN_TE_INTR_BASIC,
|
||||
WAN_FE_INTR_MASK,
|
||||
0x00);
|
||||
/* Disable automatic update */
|
||||
sdla_ds_te1_intr_ctrl(
|
||||
fe, 0,
|
||||
WAN_TE_INTR_PMON,
|
||||
WAN_FE_INTR_MASK,
|
||||
0x00);
|
||||
fe, 0,
|
||||
(WAN_TE_INTR_GLOBAL|WAN_TE_INTR_BASIC|WAN_TE_INTR_PMON),
|
||||
WAN_FE_INTR_MASK, 0x00);
|
||||
/* Start LINKDOWN poll */
|
||||
event.type = TE_LINKDOWN_TIMER;
|
||||
event.delay = POLLING_TE1_TIMER*5;
|
||||
|
@ -3049,16 +3219,19 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe)
|
|||
** because it cause to stay longer in interrupt handler
|
||||
** (critical for XILINX code) */
|
||||
if (fe->fe_status == FE_CONNECTED){
|
||||
/* Enable Basic Interrupt */
|
||||
sdla_ds_te1_intr_ctrl( fe, 0,
|
||||
WAN_TE_INTR_BASIC,
|
||||
WAN_FE_INTR_ENABLE,
|
||||
0x00);
|
||||
/* Enable automatic update pmon counters */
|
||||
sdla_ds_te1_intr_ctrl( fe, 0,
|
||||
WAN_TE_INTR_PMON,
|
||||
WAN_FE_INTR_ENABLE,
|
||||
0x00);
|
||||
if (fe->fe_cfg.poll_mode == WANOPT_YES){
|
||||
event->type = WAN_TE_POLL_LINKREADY;
|
||||
event->delay = POLLING_TE1_TIMER;
|
||||
pending = 1;
|
||||
}else{
|
||||
/* Enable Basic Interrupt */
|
||||
/* Enable automatic update pmon counters */
|
||||
sdla_ds_te1_intr_ctrl(
|
||||
fe, 0,
|
||||
(WAN_TE_INTR_GLOBAL|WAN_TE_INTR_BASIC|WAN_TE_INTR_PMON),
|
||||
WAN_FE_INTR_ENABLE,
|
||||
0x00);
|
||||
}
|
||||
if (card->wandev.te_link_state){
|
||||
card->wandev.te_link_state(card);
|
||||
}
|
||||
|
@ -3069,6 +3242,28 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe)
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case WAN_TE_POLL_LINKREADY:
|
||||
/* Only used in no interrupt driven front-end mode */
|
||||
sdla_ds_te1_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE);
|
||||
if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){
|
||||
/* Short circuit detected, go to LINKCRIT state */
|
||||
event->type = TE_LINKCRIT_TIMER;
|
||||
event->delay = POLLING_TE1_TIMER;
|
||||
pending = 1;
|
||||
break;
|
||||
}
|
||||
sdla_ds_te1_set_status(fe, fe->fe_alarm);
|
||||
if (fe->fe_status == FE_CONNECTED){
|
||||
pending = 1;
|
||||
}else{
|
||||
event->type = TE_LINKDOWN_TIMER;
|
||||
event->delay = POLLING_TE1_TIMER;
|
||||
pending = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case TE_RBS_READ:
|
||||
/* Physically read RBS status and print */
|
||||
sdla_ds_te1_rbs_print(fe, 0);
|
||||
|
@ -3139,24 +3334,22 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe)
|
|||
fe->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Enable interrupts */
|
||||
sdla_ds_te1_intr_ctrl(fe, 0, WAN_TE_INTR_BASIC, WAN_FE_INTR_ENABLE, 0x00);
|
||||
/* Enable manual update pmon counter */
|
||||
sdla_ds_te1_intr_ctrl(fe, 0, WAN_TE_INTR_PMON, WAN_FE_INTR_ENABLE, 0x00);
|
||||
event->type = TE_LINKDOWN_TIMER;
|
||||
event->delay = POLLING_TE1_TIMER;
|
||||
pending = 1;
|
||||
break;
|
||||
|
||||
case TE_POLL_READ:
|
||||
DEBUG_EVENT("%s: Reading %s Front-End register: Reg[%04X]=%02X\n",
|
||||
fe->te_param.reg_dbg_value = READ_REG(event->te_event.reg);
|
||||
DEBUG_TE1("%s: Read %s Front-End Reg:%04X=%02X\n",
|
||||
fe->name, FE_MEDIA_DECODE(fe),
|
||||
event->te_event.reg,
|
||||
READ_REG(event->te_event.reg));
|
||||
fe->te_param.reg_dbg_value);
|
||||
fe->te_param.reg_dbg_ready = 1;
|
||||
break;
|
||||
|
||||
case TE_POLL_WRITE:
|
||||
DEBUG_EVENT("%s: Writting %s Front-End register: Reg[%04X]=%02X\n",
|
||||
DEBUG_EVENT("%s: Write %s Front-End Reg:%04X=%02X\n",
|
||||
fe->name, FE_MEDIA_DECODE(fe),
|
||||
event->te_event.reg,
|
||||
event->te_event.value);
|
||||
|
@ -3241,7 +3434,7 @@ static int sdla_ds_te1_pmon(sdla_fe_t *fe, int action)
|
|||
pmon2 = READ_REG(REG_PCVCR1) << 8 | READ_REG(REG_PCVCR2);
|
||||
/* OOF Error for T1/E1 */
|
||||
pmon3 = READ_REG(REG_FOSCR1) << 8 | READ_REG(REG_FOSCR2);
|
||||
if (IS_E1_FEMEDIA(fe)){
|
||||
if (IS_E1_FEMEDIA(fe) && WAN_FE_FRAME(fe) == WAN_FR_CRC4){
|
||||
/* E-bit counter (Far End Block Errors) */
|
||||
pmon4 = READ_REG(REG_E1EBCR1) << 8 | READ_REG(REG_E1EBCR2);
|
||||
}
|
||||
|
@ -3665,11 +3858,24 @@ static int sdla_ds_te1_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data)
|
|||
udp_cmd->wan_cmd_return_code = WAN_CMD_OK;
|
||||
break;
|
||||
case WAN_FE_DEBUG_REG:
|
||||
if (fe->te_param.reg_dbg_busy){
|
||||
if (fe_debug->fe_debug_reg.read == 2 && fe->te_param.reg_dbg_ready){
|
||||
/* Poll the register value */
|
||||
fe_debug->fe_debug_reg.value = fe->te_param.reg_dbg_value;
|
||||
udp_cmd->wan_cmd_return_code = WAN_CMD_OK;
|
||||
fe->te_param.reg_dbg_busy = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
event.type = (fe_debug->fe_debug_reg.read) ?
|
||||
TE_POLL_READ : TE_POLL_WRITE;
|
||||
event.te_event.reg = fe_debug->fe_debug_reg.reg;
|
||||
event.te_event.reg = (u_int16_t)fe_debug->fe_debug_reg.reg;
|
||||
event.te_event.value = fe_debug->fe_debug_reg.value;
|
||||
event.delay = POLLING_TE1_TIMER;
|
||||
if (fe_debug->fe_debug_reg.read){
|
||||
fe->te_param.reg_dbg_busy = 1;
|
||||
fe->te_param.reg_dbg_ready = 0;
|
||||
}
|
||||
sdla_ds_te1_add_event(fe, &event);
|
||||
udp_cmd->wan_cmd_return_code = WAN_CMD_OK;
|
||||
break;
|
||||
|
|
|
@ -949,8 +949,6 @@ static int if_init (netdevice_t* dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
dev->do_ioctl = &if_ioctl;
|
||||
|
|
|
@ -540,8 +540,6 @@ static int del_if (wan_device_t* wandev, netdevice_t* ifp)
|
|||
wp_sppp_detach(ifp);
|
||||
|
||||
ifp->do_ioctl = NULL;
|
||||
ifp->hard_header = NULL;
|
||||
ifp->rebuild_header = NULL;
|
||||
|
||||
kfree(adsl->common.prot_ptr);
|
||||
adsl->common.prot_ptr= NULL;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1211,8 +1211,6 @@ static int if_init (netdevice_t* dev)
|
|||
dev->type = ARPHRD_PPP;
|
||||
dev->mtu = card->wandev.mtu;
|
||||
dev->hard_header_len = 16;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->addr_len = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -919,8 +919,6 @@ static int if_init (netdevice_t* dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
#if defined(LINUX_2_4)||defined(LINUX_2_6)
|
||||
|
|
|
@ -1039,8 +1039,6 @@ static int if_init (struct net_device* dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
#if defined(LINUX_2_4)||defined(LINUX_2_6)
|
||||
|
|
|
@ -5290,7 +5290,7 @@ static int bstrm_bind_dev_switch (sdla_t *card, bitstrm_private_area_t*chan, cha
|
|||
return 0;
|
||||
}
|
||||
|
||||
sw_dev = dev_get_by_name(sw_dev_name);
|
||||
sw_dev = wan_dev_get_by_name(sw_dev_name);
|
||||
if (!sw_dev){
|
||||
DEBUG_EVENT( "%s: Device %s waiting for switch device %s\n",
|
||||
card->devname, chan->if_name,sw_dev_name);
|
||||
|
@ -5498,8 +5498,6 @@ static int protocol_shutdown (sdla_t *card, netdevice_t *dev)
|
|||
wp_sppp_detach(dev);
|
||||
|
||||
dev->do_ioctl = NULL;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
|
||||
if (chan->common.prot_ptr){
|
||||
kfree(chan->common.prot_ptr);
|
||||
|
|
|
@ -431,8 +431,6 @@ static int if_init (netdevice_t* dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
dev->do_ioctl = &if_ioctl;
|
||||
|
|
|
@ -489,8 +489,6 @@ static int if_init (netdevice_t* dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
dev->do_ioctl = &if_ioctl;
|
||||
|
|
|
@ -1189,8 +1189,6 @@ static int if_init (netdevice_t* dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
#if defined(LINUX_2_4)||defined(LINUX_2_6)
|
||||
|
|
|
@ -372,8 +372,6 @@ static int if_init (netdevice_t* dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
#if defined(LINUX_2_4)||defined(LINUX_2_6)
|
||||
|
|
|
@ -1459,8 +1459,6 @@ static int if_init (netdevice_t* dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
#if defined(LINUX_2_4) || defined(LINUX_2_6)
|
||||
|
|
|
@ -1107,7 +1107,6 @@ static int if_init (netdevice_t* dev)
|
|||
#endif
|
||||
dev->do_ioctl = if_do_ioctl;
|
||||
|
||||
dev->hard_header = NULL;
|
||||
dev->hard_header_len = 0;
|
||||
dev->addr_len = 2;
|
||||
*(u16*)dev->dev_addr = htons(chan->dlci);
|
||||
|
|
|
@ -486,8 +486,6 @@ static int if_init (struct net_device* dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
dev->do_ioctl = if_do_ioctl;
|
||||
|
|
|
@ -894,8 +894,6 @@ static int if_init(netdevice_t *dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
#if defined(LINUX_2_4)||defined(LINUX_2_6)
|
||||
|
|
|
@ -367,7 +367,7 @@ static int wp_remora_udp(sdla_fe_t*, void*, unsigned char*);
|
|||
static unsigned int wp_remora_active_map(sdla_fe_t* fe);
|
||||
static unsigned char wp_remora_fe_media(sdla_fe_t *fe);
|
||||
static int wp_remora_set_dtmf(sdla_fe_t*, int, unsigned char);
|
||||
static int wp_remora_intr_ctrl(sdla_fe_t*, int, int, int, unsigned int);
|
||||
static int wp_remora_intr_ctrl(sdla_fe_t*, int, u_int8_t, u_int8_t, unsigned int);
|
||||
static int wp_remora_event_ctrl(sdla_fe_t*, wan_event_ctrl_t*);
|
||||
|
||||
static int sdla_rm_add_timer(sdla_fe_t*, unsigned long);
|
||||
|
@ -2965,7 +2965,7 @@ static int wp_remora_watchdog(sdla_fe_t *fe)
|
|||
* Returns:
|
||||
******************************************************************************/
|
||||
static int
|
||||
wp_remora_intr_ctrl(sdla_fe_t *fe, int mod_no, int type, int mode, unsigned int ts_map)
|
||||
wp_remora_intr_ctrl(sdla_fe_t *fe, int mod_no, u_int8_t type, u_int8_t mode, unsigned int ts_map)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
|
@ -2982,8 +2982,7 @@ wp_remora_intr_ctrl(sdla_fe_t *fe, int mod_no, int type, int mode, unsigned int
|
|||
}
|
||||
if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXS){
|
||||
|
||||
switch(type){
|
||||
case WAN_RM_INTR_GLOBAL:
|
||||
if (type & WAN_RM_INTR_GLOBAL){
|
||||
if (mode == WAN_FE_INTR_ENABLE){
|
||||
WRITE_RM_REG(mod_no, 21, fe->rm_param.mod[mod_no].u.fxs.imask1);
|
||||
WRITE_RM_REG(mod_no, 22, fe->rm_param.mod[mod_no].u.fxs.imask2);
|
||||
|
@ -2993,30 +2992,16 @@ wp_remora_intr_ctrl(sdla_fe_t *fe, int mod_no, int type, int mode, unsigned int
|
|||
WRITE_RM_REG(mod_no, 22, 0x00);
|
||||
WRITE_RM_REG(mod_no, 23, 0x00);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DEBUG_EVENT(
|
||||
"%s: Module %d: Unsupported FXS interrupt type (%X)!\n",
|
||||
fe->name, mod_no, type);
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
}else if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXO){
|
||||
switch(type){
|
||||
case WAN_RM_INTR_GLOBAL:
|
||||
|
||||
if (type & WAN_RM_INTR_GLOBAL){
|
||||
if (mode == WAN_FE_INTR_ENABLE){
|
||||
WRITE_RM_REG(mod_no, 3, fe->rm_param.mod[mod_no].u.fxo.imask);
|
||||
}else{
|
||||
WRITE_RM_REG(mod_no, 3, 0x00);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DEBUG_EVENT(
|
||||
"%s: Module %d: Unsupported FXO interrupt type (%X)!\n",
|
||||
fe->name, mod_no, type);
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
|
|
|
@ -1412,6 +1412,7 @@ static int wp_tdmv_remora_rx_chan(wan_tdmv_t *wan_tdmv, int channo,
|
|||
#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER
|
||||
wan_tdmv_rxtx_pwr_t *pwr_rxtx = NULL;
|
||||
#endif
|
||||
sdla_t *card;
|
||||
|
||||
WAN_ASSERT2(wr == NULL, -EINVAL);
|
||||
WAN_ASSERT2(channo < 0, -EINVAL);
|
||||
|
@ -1420,6 +1421,7 @@ static int wp_tdmv_remora_rx_chan(wan_tdmv_t *wan_tdmv, int channo,
|
|||
if (!IS_TDMV_UP(wr)){
|
||||
return -EINVAL;
|
||||
}
|
||||
card = wr->card;
|
||||
|
||||
#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER
|
||||
pwr_rxtx = &wan_tdmv->chan_pwr[channo];
|
||||
|
@ -1445,22 +1447,23 @@ DEBUG_EVENT("Module %d: RX: %02X %02X %02X %02X %02X %02X %02X %02X\n",
|
|||
wp_tdmv_echo_check(wan_tdmv, &wr->chans[channo], channo);
|
||||
#endif
|
||||
|
||||
if (!wan_test_bit(channo, &wr->echo_off_map)){
|
||||
if ((!card->wandev.ec_enable || card->wandev.ec_enable_map == 0) &&
|
||||
!wan_test_bit(channo, &wr->echo_off_map)) {
|
||||
|
||||
/*Echo spike starts at 25bytes*/
|
||||
#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER
|
||||
if(pwr_rxtx->current_state != ECHO_ABSENT){
|
||||
#endif
|
||||
#if 0
|
||||
/* Echo spike starts at 16 bytes */
|
||||
|
||||
|
||||
if (wan_test_bit(AFT_TDM_SW_RING_BUF,&card->u.aft.chip_cfg_status)) {
|
||||
/* Updated for SWRING buffer
|
||||
* Sets up the spike at 3 bytes */
|
||||
zt_ec_chunk(
|
||||
&wr->chans[channo],
|
||||
wr->chans[channo].readchunk,
|
||||
wr->chans[channo].writechunk);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
/*Echo spike starts at 9 bytes*/
|
||||
} else {
|
||||
/* This should be used without SWRING Echo spike starts at 9 bytes*/
|
||||
zt_ec_chunk(
|
||||
&wr->chans[channo],
|
||||
wr->chans[channo].readchunk,
|
||||
|
@ -1469,7 +1472,7 @@ DEBUG_EVENT("Module %d: RX: %02X %02X %02X %02X %02X %02X %02X %02X\n",
|
|||
wr->ec_chunk1[channo],
|
||||
wr->chans[channo].writechunk,
|
||||
ZT_CHUNKSIZE);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*Echo spike starts at bytes*/
|
||||
|
|
|
@ -518,8 +518,6 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev)
|
|||
* since in some cases (mrouted) daemons continue
|
||||
* to call ioctl() after the device has gone down */
|
||||
dev->do_ioctl = NULL;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
|
||||
sdlc_set_intr_mode(card, 0);
|
||||
if (card->u.sdlc.comm_enabled){
|
||||
|
|
|
@ -1880,6 +1880,13 @@ static int wp_tdmv_hwec(struct zt_chan *chan, int enable)
|
|||
WAN_ASSERT2(wp->card == NULL, -ENODEV);
|
||||
card = wp->card;
|
||||
|
||||
if (enable) {
|
||||
wan_set_bit(channel,&card->wandev.rtp_tap_call_map);
|
||||
} else {
|
||||
wan_clear_bit(channel,&card->wandev.rtp_tap_call_map);
|
||||
}
|
||||
|
||||
|
||||
if (card->wandev.ec_enable){
|
||||
DEBUG_TDMV("[TDMV]: %s: %s HW echo canceller on channel %d\n",
|
||||
wp->devname,
|
||||
|
@ -2337,6 +2344,12 @@ static int wp_tdmv_span_buf_rotate(void *pcard, u32 buf_sz, unsigned long mask)
|
|||
prefetch(wp->chans[x].writechunk);
|
||||
#endif
|
||||
|
||||
if (card->wandev.rtp_len && card->wandev.rtp_tap) {
|
||||
card->wandev.rtp_tap(card,x,
|
||||
wp->chans[x].readchunk,
|
||||
wp->chans[x].writechunk,
|
||||
ZT_CHUNKSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1339,8 +1339,7 @@ static int if_init (netdevice_t* dev)
|
|||
/* Initialize device driver entry points */
|
||||
dev->open = &if_open;
|
||||
dev->stop = &if_close;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
|
||||
dev->hard_start_xmit = &if_send;
|
||||
dev->get_stats = &if_stats;
|
||||
dev->do_ioctl = &x25_ioctl;
|
||||
|
|
|
@ -53,10 +53,6 @@ enum wp_device_down_states{
|
|||
DEVICE_DOWN
|
||||
};
|
||||
|
||||
enum {
|
||||
AFT_CHIP_CONFIGURED,
|
||||
AFT_FRONT_END_UP,
|
||||
};
|
||||
|
||||
enum {
|
||||
AFT_FE_CFG_ERR,
|
||||
|
@ -1875,8 +1871,6 @@ static int if_init (netdevice_t* dev)
|
|||
}
|
||||
|
||||
dev->hard_header_len = 0;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
|
||||
/* Enable Mulitcasting if user selected */
|
||||
if (chan->mc == WANOPT_YES){
|
||||
|
|
|
@ -223,8 +223,6 @@ static int wan_iface_init(netdevice_t* dev)
|
|||
dev->open = &wan_iface_open;
|
||||
dev->stop = &wan_iface_close;
|
||||
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &wan_iface_send;
|
||||
dev->get_stats = &wan_iface_get_stats;
|
||||
dev->tx_timeout = &wan_iface_tx_timeout;
|
||||
|
@ -266,9 +264,6 @@ static int wan_iface_eth_init(netdevice_t* dev)
|
|||
dev->do_ioctl = &wan_iface_ioctl;
|
||||
dev->open = &wan_iface_open;
|
||||
dev->stop = &wan_iface_close;
|
||||
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
dev->hard_start_xmit = &wan_iface_send;
|
||||
dev->get_stats = &wan_iface_get_stats;
|
||||
dev->tx_timeout = &wan_iface_tx_timeout;
|
||||
|
|
|
@ -974,8 +974,6 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev)
|
|||
* since in some cases (mrouted) daemons continue
|
||||
* to call ioctl() after the device has gone down */
|
||||
dev->do_ioctl = NULL;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
|
||||
if (chan->common.prot_ptr){
|
||||
kfree(chan->common.prot_ptr);
|
||||
|
@ -1046,8 +1044,7 @@ static int if_init (netdevice_t* dev)
|
|||
dev->type = ARPHRD_PPP;
|
||||
dev->mtu = card->wandev.mtu;
|
||||
dev->hard_header_len = 0;
|
||||
dev->hard_header = NULL;
|
||||
dev->rebuild_header = NULL;
|
||||
|
||||
}
|
||||
|
||||
/* Overwrite the sppp ioctl, because we need to run
|
||||
|
|
|
@ -1398,8 +1398,19 @@ sppp_phase_name(enum ppp_phase phase)
|
|||
* Handle transmit packets.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef LINUX_FEAT_2624
|
||||
static int sppp_hard_header(struct sk_buff *skb,
|
||||
struct net_device *dev, __u16 type,
|
||||
const void *daddr, const void *saddr,
|
||||
unsigned int len)
|
||||
#else
|
||||
static int sppp_hard_header(struct sk_buff *skb, struct net_device *dev, __u16 type,
|
||||
void *daddr, void *saddr, unsigned int len)
|
||||
#endif
|
||||
{
|
||||
struct sppp *sp = (struct sppp *)sppp_of(dev);
|
||||
struct ppp_header *h;
|
||||
|
@ -1442,10 +1453,13 @@ static int sppp_hard_header(struct sk_buff *skb, struct net_device *dev, __u16 t
|
|||
return sizeof(struct ppp_header);
|
||||
}
|
||||
|
||||
static int sppp_rebuild_header(struct sk_buff *skb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#ifdef LINUX_FEAT_2624
|
||||
static const struct header_ops sppp_header_ops = {
|
||||
.create = sppp_hard_header,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Send keepalive packets, every 10 seconds.
|
||||
|
@ -2288,9 +2302,12 @@ void wp_sppp_attach(struct ppp_device *pd)
|
|||
* Device specific setup. All but interrupt handler and
|
||||
* hard_start_xmit.
|
||||
*/
|
||||
|
||||
#ifdef LINUX_FEAT_2624
|
||||
dev->header_ops = &sppp_header_ops;
|
||||
#else
|
||||
dev->hard_header = sppp_hard_header;
|
||||
dev->rebuild_header = sppp_rebuild_header;
|
||||
#endif
|
||||
|
||||
dev->tx_queue_len = 100;
|
||||
dev->type = ARPHRD_HDLC;
|
||||
dev->addr_len = 0;
|
||||
|
@ -2306,8 +2323,7 @@ void wp_sppp_attach(struct ppp_device *pd)
|
|||
dev->stop = wp_sppp_close;
|
||||
#endif
|
||||
dev->change_mtu = wp_sppp_change_mtu;
|
||||
dev->hard_header_cache = NULL;
|
||||
dev->header_cache_update = NULL;
|
||||
|
||||
dev->flags = IFF_MULTICAST|IFF_POINTOPOINT|IFF_NOARP;
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -223,7 +223,9 @@ static void wp_wakeup_tdmapi(wanpipe_tdm_api_dev_t *tdm_api)
|
|||
#endif
|
||||
|
||||
static struct cdev wptdm_cdev = {
|
||||
#ifndef LINUX_FEAT_2624
|
||||
.kobj = {.name = "wptdm", },
|
||||
#endif
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
|
@ -750,7 +752,13 @@ static ssize_t wp_tdmapi_write_msg(struct file *file, struct msghdr *msg, size_t
|
|||
return -EINVAL;
|
||||
}
|
||||
#endif
|
||||
skb_len=WP_TDM_API_MAX_LEN;
|
||||
if (count > (WP_TDM_API_MAX_LEN+sizeof(wp_tdm_api_tx_hdr_t))) {
|
||||
DEBUG_TEST("%s: Error: TDM API Tx packet too big %d\n",
|
||||
tdm_api->name,count);
|
||||
return -EFBIG;
|
||||
}
|
||||
|
||||
skb_len=WP_TDM_API_MAX_LEN+sizeof(wp_tdm_api_tx_hdr_t);
|
||||
}
|
||||
|
||||
if (wan_skb_queue_len(&tdm_api->wp_tx_list) > tdm_api->tx_q_len){
|
||||
|
|
|
@ -363,6 +363,8 @@ int wan_reply_udp(void* card_id, unsigned char *data, unsigned int mbox_len)
|
|||
|
||||
|
||||
|
||||
|
||||
#if defined(__LINUX__)
|
||||
/*
|
||||
* ===========================================================================
|
||||
* Reply to UDP Management system.
|
||||
|
@ -370,7 +372,9 @@ int wan_reply_udp(void* card_id, unsigned char *data, unsigned int mbox_len)
|
|||
* mbox_len - includes data length and trace_info_t (chdlc and dsl).
|
||||
* Return length of reply.
|
||||
*/
|
||||
int wan_ip_udp_setup(void* card_id, u32 ip, u32 udp_port, unsigned char *data, unsigned int mbox_len)
|
||||
int wan_ip_udp_setup(void* card_id, wan_rtp_conf_t *rtp_conf,
|
||||
u32 chan,
|
||||
unsigned char *data, unsigned int mbox_len)
|
||||
{
|
||||
wan_rtp_pkt_t* rtp_pkt = (wan_rtp_pkt_t*)data;
|
||||
unsigned short len,
|
||||
|
@ -394,19 +398,21 @@ int wan_ip_udp_setup(void* card_id, u32 ip, u32 udp_port, unsigned char *data, u
|
|||
#endif
|
||||
|
||||
/* put it on an even boundary */
|
||||
#if 1
|
||||
if (udp_length & 0x0001){
|
||||
udp_length += 1;
|
||||
data[sizeof(ethhdr_t)+sizeof(iphdr_t)+udp_length]=0;
|
||||
len += 1;
|
||||
even_bound = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
temp = (udp_length<<8)|(udp_length>>8);
|
||||
rtp_pkt->wan_udp_len = temp;
|
||||
|
||||
temp = rtp_pkt->wan_udp_sport;
|
||||
rtp_pkt->wan_udp_sport = 0;
|
||||
rtp_pkt->wan_udp_dport = udp_port;
|
||||
rtp_pkt->wan_udp_sport = htons(rtp_conf->rtp_port+chan);
|
||||
rtp_pkt->wan_udp_dport = htons(rtp_conf->rtp_port+chan);
|
||||
|
||||
/* calculate UDP checksum */
|
||||
rtp_pkt->wan_udp_sum = 0;
|
||||
|
@ -422,16 +428,17 @@ int wan_ip_udp_setup(void* card_id, u32 ip, u32 udp_port, unsigned char *data, u
|
|||
rtp_pkt->wan_ip_len = temp;
|
||||
|
||||
/* IP addresses */
|
||||
rtp_pkt->wan_ip_src = 0;
|
||||
rtp_pkt->wan_ip_dst = ip;
|
||||
rtp_pkt->wan_ip_src = rtp_conf->rtp_local_ip;
|
||||
rtp_pkt->wan_ip_dst = rtp_conf->rtp_ip;
|
||||
rtp_pkt->wan_ip_v = 4;
|
||||
rtp_pkt->wan_ip_hl = 5;
|
||||
rtp_pkt->wan_ip_len = htons(ip_length);
|
||||
rtp_pkt->wan_ip_tos = 1;
|
||||
rtp_pkt->wan_ip_ttl = 255;
|
||||
rtp_pkt->wan_ip_p = IPPROTO_UDP;
|
||||
|
||||
memset(rtp_pkt->wan_eth_dest,0xFF,ETH_ALEN);
|
||||
memset(rtp_pkt->wan_eth_src,0xFF,ETH_ALEN);
|
||||
memcpy(rtp_pkt->wan_eth_dest,rtp_conf->rtp_mac,ETH_ALEN);
|
||||
memcpy(rtp_pkt->wan_eth_src,rtp_conf->rtp_local_mac,ETH_ALEN);
|
||||
rtp_pkt->wan_eth_proto=0x0008;
|
||||
|
||||
/* fill in IP checksum */
|
||||
|
@ -440,7 +447,7 @@ int wan_ip_udp_setup(void* card_id, u32 ip, u32 udp_port, unsigned char *data, u
|
|||
|
||||
return len+sizeof(ethhdr_t);
|
||||
} /* wan_ip_udp_setup */
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
*****************************************************************************
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -142,7 +142,7 @@ static atomic_t af_skb_alloc;
|
|||
atomic_t wanpipe_socks_nr;
|
||||
extern struct proto_ops wanpipe_ops;
|
||||
|
||||
static struct sock *wanpipe_alloc_socket(void);
|
||||
static struct sock *wanpipe_alloc_socket(struct sock *, void *net);
|
||||
static void check_write_queue(struct sock *);
|
||||
|
||||
|
||||
|
@ -327,7 +327,7 @@ struct sock *wanpipe_make_new(struct sock *osk)
|
|||
if (osk->sk_type != SOCK_RAW)
|
||||
return NULL;
|
||||
|
||||
if ((sk = wanpipe_alloc_socket()) == NULL)
|
||||
if ((sk = wanpipe_alloc_socket(osk,NULL)) == NULL)
|
||||
return NULL;
|
||||
|
||||
sk->sk_family = osk->sk_family;
|
||||
|
@ -713,8 +713,10 @@ static int wanpipe_api_sock_rcv(struct sk_buff *skb, netdevice_t *dev, struct s
|
|||
sll->sll_ifindex = dev->ifindex;
|
||||
sll->sll_halen = 0;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)
|
||||
if (dev->hard_header_parse)
|
||||
sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WAN_PACKET_DATA : Data which should be passed up the receive queue.
|
||||
|
@ -788,22 +790,39 @@ static int wanpipe_api_sock_rcv(struct sk_buff *skb, netdevice_t *dev, struct s
|
|||
*
|
||||
*===========================================================*/
|
||||
|
||||
static struct sock *wanpipe_alloc_socket(void)
|
||||
static struct sock *wanpipe_alloc_socket(struct sock *osk, void *net)
|
||||
{
|
||||
struct sock *sk;
|
||||
struct wanpipe_opt *wan_opt;
|
||||
|
||||
#ifdef LINUX_2_6
|
||||
#ifdef AF_WANPIPE_2612_UPDATE
|
||||
if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, &packet_proto,1)) == NULL)
|
||||
|
||||
# if defined(LINUX_FEAT_2624)
|
||||
if (!osk && !net) {
|
||||
DEBUG_EVENT("%s:%d ASSERT osk net pointer = NULL! \n",
|
||||
__FUNCTION__,__LINE__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (osk) {
|
||||
net=osk->sk_net;
|
||||
}
|
||||
|
||||
sk = sk_alloc((struct net*)net, PF_WANPIPE, GFP_ATOMIC, &packet_proto);
|
||||
|
||||
# elif defined(AF_WANPIPE_2612_UPDATE)
|
||||
sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, &packet_proto,1);
|
||||
# else
|
||||
sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, 1,NULL);
|
||||
# endif
|
||||
|
||||
#else
|
||||
if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, 1,NULL)) == NULL)
|
||||
#endif
|
||||
#else
|
||||
if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, 1)) == NULL)
|
||||
sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, 1);
|
||||
#endif
|
||||
|
||||
if (sk == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((wan_opt = kmalloc(sizeof(struct wanpipe_opt), GFP_ATOMIC)) == NULL) {
|
||||
sk_free(sk);
|
||||
|
@ -932,6 +951,7 @@ static int wanpipe_sendmsg(struct socket *sock, struct msghdr *msg, int len,
|
|||
goto out_free;
|
||||
}
|
||||
|
||||
#ifndef LINUX_FEAT_2624
|
||||
if (dev->hard_header) {
|
||||
int res;
|
||||
err = -EINVAL;
|
||||
|
@ -940,6 +960,7 @@ static int wanpipe_sendmsg(struct socket *sock, struct msghdr *msg, int len,
|
|||
goto out_free;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
skb->protocol = proto;
|
||||
skb->priority = sk->sk_priority;
|
||||
|
@ -1309,7 +1330,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le
|
|||
* we are finshed with the device we should run
|
||||
* dev_put() to release it */
|
||||
#if defined(LINUX_2_4)||defined(LINUX_2_6)
|
||||
dev = dev_get_by_name(name);
|
||||
dev = wan_dev_get_by_name(name);
|
||||
#else
|
||||
dev = dev_get(name);
|
||||
#endif
|
||||
|
@ -1350,7 +1371,7 @@ wanpipe_svc_connect_skip:
|
|||
err=-EINVAL;
|
||||
}else{
|
||||
sk->sk_state = WANSOCK_DISCONNECTED;
|
||||
SK_PRIV(sk)->dev=dev_get_by_index(sk->sk_bound_dev_if);
|
||||
SK_PRIV(sk)->dev=wan_dev_get_by_index(sk->sk_bound_dev_if);
|
||||
if (SK_PRIV(sk)->dev){
|
||||
err=0;
|
||||
}else{
|
||||
|
@ -1376,7 +1397,7 @@ wanpipe_svc_connect_skip:
|
|||
* dev_put() to release it */
|
||||
|
||||
#if defined(LINUX_2_4)||defined(LINUX_2_6)
|
||||
dev = dev_get_by_name(name);
|
||||
dev = wan_dev_get_by_name(name);
|
||||
#else
|
||||
dev = dev_get(name);
|
||||
#endif
|
||||
|
@ -1420,7 +1441,7 @@ wanpipe_svc_listen_skip:
|
|||
name[14]=0;
|
||||
|
||||
#if defined(LINUX_2_4)||defined(LINUX_2_6)
|
||||
dev = dev_get_by_name(name);
|
||||
dev = wan_dev_get_by_name(name);
|
||||
#else
|
||||
dev = dev_get(name);
|
||||
#endif
|
||||
|
@ -1490,17 +1511,26 @@ wanpipe_svc_listen_skip:
|
|||
* Crates AF_WANPIPE socket.
|
||||
*===========================================================*/
|
||||
|
||||
#ifdef LINUX_FEAT_2624
|
||||
int wanpipe_create(struct net *net, struct socket *sock, int protocol)
|
||||
#else
|
||||
int wanpipe_create(struct socket *sock, int protocol)
|
||||
#endif
|
||||
{
|
||||
struct sock *sk;
|
||||
unsigned long flags;
|
||||
|
||||
|
||||
#ifndef LINUX_FEAT_2624
|
||||
/* Used to fake the net structure for lower kernels */
|
||||
void *net = NULL;
|
||||
#endif
|
||||
|
||||
if (sock->type != SOCK_RAW)
|
||||
return -ESOCKTNOSUPPORT;
|
||||
|
||||
sock->state = SS_UNCONNECTED;
|
||||
|
||||
if ((sk = wanpipe_alloc_socket()) == NULL){
|
||||
if ((sk = wanpipe_alloc_socket(NULL, net)) == NULL){
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -885,7 +885,7 @@ static int wan_device_new_if (wan_device_t *wandev, wanif_conf_t *u_conf)
|
|||
}
|
||||
|
||||
|
||||
if ((dev=dev_get_by_name(conf->name))){
|
||||
if ((dev=wan_dev_get_by_name(conf->name))){
|
||||
dev_put(dev);
|
||||
dev=NULL;
|
||||
err = -EEXIST; /* name already exists */
|
||||
|
@ -917,7 +917,7 @@ static int wan_device_new_if (wan_device_t *wandev, wanif_conf_t *u_conf)
|
|||
|
||||
if (dev->name == NULL){
|
||||
err = -EINVAL;
|
||||
}else if ((tmp_dev=dev_get_by_name(dev->name))){
|
||||
}else if ((tmp_dev=wan_dev_get_by_name(dev->name))){
|
||||
dev_put(tmp_dev);
|
||||
err = -EEXIST; /* name already exists */
|
||||
}else if (dev->priv){
|
||||
|
@ -990,8 +990,8 @@ static int wan_device_del_if (wan_device_t *wandev, char *u_name)
|
|||
}
|
||||
|
||||
if (devle == NULL || dev == NULL){
|
||||
if ((dev = dev_get_by_name(name)) == NULL){
|
||||
printk(KERN_INFO "%s: dev_get_by_name failed\n", name);
|
||||
if ((dev = wan_dev_get_by_name(name)) == NULL){
|
||||
printk(KERN_INFO "%s: wan_dev_get_by_name failed\n", name);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -1522,7 +1522,7 @@ static int wan_device_new_if_lapb (wan_device_t *wandev, wanif_conf_t *u_conf)
|
|||
goto wan_device_new_if_lapb_exit;
|
||||
}
|
||||
|
||||
if ((tmp_dev=dev_get_by_name(conf->name)) != NULL){
|
||||
if ((tmp_dev=wan_dev_get_by_name(conf->name)) != NULL){
|
||||
printk(KERN_INFO "%s: Device already exists!\n",
|
||||
conf->name);
|
||||
dev_put(tmp_dev);
|
||||
|
@ -1662,7 +1662,7 @@ static int wan_device_new_if_x25 (wan_device_t *wandev, wanif_conf_t *u_conf)
|
|||
goto wan_device_new_if_x25_exit;
|
||||
}
|
||||
|
||||
if ((tmp_dev=dev_get_by_name(conf->name)) != NULL){
|
||||
if ((tmp_dev=wan_dev_get_by_name(conf->name)) != NULL){
|
||||
printk(KERN_INFO "%s: Device already exists!\n",
|
||||
conf->name);
|
||||
dev_put(tmp_dev);
|
||||
|
@ -1686,7 +1686,7 @@ static int wan_device_new_if_x25 (wan_device_t *wandev, wanif_conf_t *u_conf)
|
|||
}
|
||||
|
||||
//Find a master device for our x25 lcn
|
||||
if ((dev = dev_get_by_name(conf->master)) == NULL){
|
||||
if ((dev = wan_dev_get_by_name(conf->master)) == NULL){
|
||||
printk(KERN_INFO "%s: Master device %s used by X25 SVC %s no found!\n",
|
||||
wandev->name,conf->master,conf->name);
|
||||
goto wan_device_new_if_x25_exit;
|
||||
|
@ -1773,7 +1773,7 @@ static int wan_device_new_if_dsp (wan_device_t *wandev, wanif_conf_t *u_conf)
|
|||
goto wan_device_new_if_dsp_exit;
|
||||
}
|
||||
|
||||
if ((tmp_dev=dev_get_by_name(conf->name)) != NULL){
|
||||
if ((tmp_dev=wan_dev_get_by_name(conf->name)) != NULL){
|
||||
printk(KERN_INFO "%s: Device already exists!\n",
|
||||
conf->name);
|
||||
dev_put(tmp_dev);
|
||||
|
@ -1792,7 +1792,7 @@ static int wan_device_new_if_dsp (wan_device_t *wandev, wanif_conf_t *u_conf)
|
|||
}
|
||||
|
||||
//Find a master device for our x25 lcn
|
||||
if ((dev = dev_get_by_name(conf->master)) == NULL){
|
||||
if ((dev = wan_dev_get_by_name(conf->master)) == NULL){
|
||||
printk(KERN_INFO "%s: Master device %s, no found for %s\n",
|
||||
wandev->name, conf->master,conf->name);
|
||||
goto wan_device_new_if_dsp_exit;
|
||||
|
@ -1918,7 +1918,7 @@ static int wan_device_new_if_lip (wan_device_t *wandev, wanif_conf_t *u_conf)
|
|||
goto wan_device_new_if_lip_exit;
|
||||
}
|
||||
|
||||
if ((tmp_dev=dev_get_by_name(conf->name)) != NULL){
|
||||
if ((tmp_dev=wan_dev_get_by_name(conf->name)) != NULL){
|
||||
printk(KERN_INFO "%s: Device already exists!\n",
|
||||
conf->name);
|
||||
dev_put(tmp_dev);
|
||||
|
@ -1936,7 +1936,7 @@ static int wan_device_new_if_lip (wan_device_t *wandev, wanif_conf_t *u_conf)
|
|||
}
|
||||
|
||||
//Find a master device lip device
|
||||
if ((dev = dev_get_by_name(conf->master)) == NULL){
|
||||
if ((dev = wan_dev_get_by_name(conf->master)) == NULL){
|
||||
printk(KERN_INFO "%s: Master device %s used by LIP %s no found!\n",
|
||||
wandev->name,conf->master,conf->name);
|
||||
goto wan_device_new_if_lip_exit;
|
||||
|
|
Binary file not shown.
|
@ -960,7 +960,7 @@ wandev_get_info_end:
|
|||
int wanrouter_proc_init (void)
|
||||
{
|
||||
struct proc_dir_entry *p;
|
||||
proc_router = proc_mkdir(ROUTER_NAME, proc_net);
|
||||
proc_router = proc_mkdir(ROUTER_NAME, wan_init_net(proc_net));
|
||||
if (!proc_router)
|
||||
goto fail;
|
||||
|
||||
|
@ -1090,7 +1090,7 @@ fail_probe_verbose:
|
|||
fail_stat:
|
||||
remove_proc_entry("config", proc_router);
|
||||
fail_config:
|
||||
remove_proc_entry(ROUTER_NAME, proc_net);
|
||||
remove_proc_entry(ROUTER_NAME, wan_init_net(proc_net));
|
||||
fail:
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -1115,7 +1115,7 @@ void wanrouter_proc_cleanup (void)
|
|||
remove_proc_entry("map", proc_router);
|
||||
remove_proc_entry("interfaces", proc_router);
|
||||
remove_proc_entry("dev_map",proc_router);
|
||||
remove_proc_entry(ROUTER_NAME,proc_net);
|
||||
remove_proc_entry(ROUTER_NAME,wan_init_net(proc_net));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
%define WANPIPE_VER wanpipe-modules
|
||||
%define name %{WANPIPE_VER}
|
||||
%define version 3.2.3
|
||||
%define version 3.2.4
|
||||
%define release 0
|
||||
%define serial 1
|
||||
%define MODULES_DIR /lib/modules
|
||||
|
@ -50,12 +50,47 @@ echo "Wanpipe Modules located in %{MODULES_DIR}/%{KVERSION}"
|
|||
|
||||
|
||||
%changelog
|
||||
* Thu Jan 24 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.2.1
|
||||
|
||||
* Thu Mar 6 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.4
|
||||
========================================================================
|
||||
|
||||
- Fixed a compile bug that occured on some kernels due to inlining.
|
||||
- Updates Setup script
|
||||
- Updated for 2.6.24 kernels
|
||||
TDM Voice (Zaptel) tested with 2.6.24 kernel.
|
||||
Known issues: WAN protocols are broken for 2.6.24 kernels.
|
||||
Its a compilation issue that will be fixed ASAP.
|
||||
|
||||
- TDM API bug fix
|
||||
Check for max frame size on audio stream
|
||||
|
||||
- Updated for Zaptel 1.4.9
|
||||
|
||||
- AFT IRQ Throttling feature
|
||||
This feature is use to protect the server from
|
||||
terrible lines. In some cases a bad hdlc line can
|
||||
cause thousands of interrupts per sec. Rx errors are now
|
||||
throttled so that system does not get compromized.
|
||||
|
||||
- AFT RTP TAP Feature
|
||||
RTP TAP Feature allows user to tap voice channels during
|
||||
Asterisk-Zaptel/TMD API operation at the driver/kernel level.
|
||||
Each voice stream is encapsulated in UDP/RTP header and transmitted over
|
||||
neghbouring ethernet address directly from kenrel space.
|
||||
Tapping 4E1s worth of voice channels adds estra 2% system load :)
|
||||
http://wiki.sangoma.com/wanpipe-voice-rtp-tap
|
||||
|
||||
- AFT Software Ring Buffers on A200/A400 Analog Cards
|
||||
This feature improves analog preformance under Asterisk/TDM API
|
||||
mode. In particualr it improves faxing reliability and
|
||||
minimizes frame slippage due to system load or bad incoming
|
||||
clock from the line.
|
||||
Note: All AFT T1/E1 cards have this feature in hardare :)
|
||||
|
||||
|
||||
* Thu Jan 18 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.3
|
||||
========================================================================
|
||||
|
||||
- No changes from 3.2.2
|
||||
Version updated for versioning sake.
|
||||
|
||||
* Thu Jan 18 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.2
|
||||
========================================================================
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%define KERNEL_VERSION %{?kern_ver}
|
||||
%define WANPIPE_VER wanpipe-util
|
||||
%define name %{WANPIPE_VER}
|
||||
%define version 3.2.3
|
||||
%define version 3.2.4
|
||||
%define release 0
|
||||
%define serial 1
|
||||
%define ETC_DIR /etc
|
||||
|
@ -246,12 +246,47 @@ install_init;
|
|||
|
||||
|
||||
%changelog
|
||||
* Thu Jan 24 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.2.1
|
||||
|
||||
* Thu Mar 6 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.4
|
||||
========================================================================
|
||||
|
||||
- Fixed a compile bug that occured on some kernels due to inlining.
|
||||
- Updates Setup script
|
||||
- Updated for 2.6.24 kernels
|
||||
TDM Voice (Zaptel) tested with 2.6.24 kernel.
|
||||
Known issues: WAN protocols are broken for 2.6.24 kernels.
|
||||
Its a compilation issue that will be fixed ASAP.
|
||||
|
||||
- TDM API bug fix
|
||||
Check for max frame size on audio stream
|
||||
|
||||
- Updated for Zaptel 1.4.9
|
||||
|
||||
- AFT IRQ Throttling feature
|
||||
This feature is use to protect the server from
|
||||
terrible lines. In some cases a bad hdlc line can
|
||||
cause thousands of interrupts per sec. Rx errors are now
|
||||
throttled so that system does not get compromized.
|
||||
|
||||
- AFT RTP TAP Feature
|
||||
RTP TAP Feature allows user to tap voice channels during
|
||||
Asterisk-Zaptel/TMD API operation at the driver/kernel level.
|
||||
Each voice stream is encapsulated in UDP/RTP header and transmitted over
|
||||
neghbouring ethernet address directly from kenrel space.
|
||||
Tapping 4E1s worth of voice channels adds estra 2% system load :)
|
||||
http://wiki.sangoma.com/wanpipe-voice-rtp-tap
|
||||
|
||||
- AFT Software Ring Buffers on A200/A400 Analog Cards
|
||||
This feature improves analog preformance under Asterisk/TDM API
|
||||
mode. In particualr it improves faxing reliability and
|
||||
minimizes frame slippage due to system load or bad incoming
|
||||
clock from the line.
|
||||
Note: All AFT T1/E1 cards have this feature in hardare :)
|
||||
|
||||
|
||||
* Thu Jan 18 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.3
|
||||
========================================================================
|
||||
|
||||
- No changes from 3.2.2
|
||||
Version updated for versioning sake.
|
||||
|
||||
* Thu Jan 18 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.2
|
||||
========================================================================
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%define KERNEL_VERSION %{?kern_ver}
|
||||
%define WANPIPE_VER wanpipe
|
||||
%define name %{WANPIPE_VER}
|
||||
%define version 3.2.3
|
||||
%define version 3.2.4
|
||||
%define release 0
|
||||
%define serial 1
|
||||
%define UTILS_DIR /usr/sbin
|
||||
|
@ -254,12 +254,47 @@ install_init;
|
|||
|
||||
|
||||
%changelog
|
||||
* Thu Jan 24 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.2.1
|
||||
|
||||
* Thu Mar 6 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.4
|
||||
========================================================================
|
||||
|
||||
- Fixed a compile bug that occured on some kernels due to inlining.
|
||||
- Updates Setup script
|
||||
- Updated for 2.6.24 kernels
|
||||
TDM Voice (Zaptel) tested with 2.6.24 kernel.
|
||||
Known issues: WAN protocols are broken for 2.6.24 kernels.
|
||||
Its a compilation issue that will be fixed ASAP.
|
||||
|
||||
- TDM API bug fix
|
||||
Check for max frame size on audio stream
|
||||
|
||||
- Updated for Zaptel 1.4.9
|
||||
|
||||
- AFT IRQ Throttling feature
|
||||
This feature is use to protect the server from
|
||||
terrible lines. In some cases a bad hdlc line can
|
||||
cause thousands of interrupts per sec. Rx errors are now
|
||||
throttled so that system does not get compromized.
|
||||
|
||||
- AFT RTP TAP Feature
|
||||
RTP TAP Feature allows user to tap voice channels during
|
||||
Asterisk-Zaptel/TMD API operation at the driver/kernel level.
|
||||
Each voice stream is encapsulated in UDP/RTP header and transmitted over
|
||||
neghbouring ethernet address directly from kenrel space.
|
||||
Tapping 4E1s worth of voice channels adds estra 2% system load :)
|
||||
http://wiki.sangoma.com/wanpipe-voice-rtp-tap
|
||||
|
||||
- AFT Software Ring Buffers on A200/A400 Analog Cards
|
||||
This feature improves analog preformance under Asterisk/TDM API
|
||||
mode. In particualr it improves faxing reliability and
|
||||
minimizes frame slippage due to system load or bad incoming
|
||||
clock from the line.
|
||||
Note: All AFT T1/E1 cards have this feature in hardare :)
|
||||
|
||||
|
||||
* Thu Jan 18 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.3
|
||||
========================================================================
|
||||
|
||||
- No changes from 3.2.2
|
||||
Version updated for versioning sake.
|
||||
|
||||
* Thu Jan 18 2008 Nenad Corbic <ncorbic@sangoma.com> - Stable - 3.2.2
|
||||
========================================================================
|
||||
|
|
|
@ -2106,7 +2106,7 @@ WANPIPE_IS_RUNNING=/var/run/wanpipe_is_running
|
|||
RUGGEDCOM=No
|
||||
|
||||
if [ $OSYSTEM = "Linux" ]; then
|
||||
ROUTER_VERSION=3.2.3
|
||||
ROUTER_VERSION=3.2.4
|
||||
IFCONFIG_LIST=ifconfig
|
||||
MODULE_STAT=lsmod
|
||||
WAN_DRIVERS="wanpipe"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 34
|
||||
/svn/sangoma_mgd/!svn/ver/59/trunk
|
||||
/svn/sangoma_mgd/!svn/ver/65/trunk
|
||||
END
|
||||
sigboost.h
|
||||
K 25
|
||||
|
@ -9,24 +9,24 @@ svn:wc:ra_dav:version-url
|
|||
V 45
|
||||
/svn/sangoma_mgd/!svn/ver/36/trunk/sigboost.h
|
||||
END
|
||||
sound.raw
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/sangoma_mgd/!svn/ver/1/trunk/sound.raw
|
||||
END
|
||||
sangoma_mgd.conf.sample
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 58
|
||||
/svn/sangoma_mgd/!svn/ver/25/trunk/sangoma_mgd.conf.sample
|
||||
END
|
||||
switch_buffer.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 49
|
||||
/svn/sangoma_mgd/!svn/ver/1/trunk/switch_buffer.h
|
||||
END
|
||||
sangoma_mgd.conf.sample
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 58
|
||||
/svn/sangoma_mgd/!svn/ver/64/trunk/sangoma_mgd.conf.sample
|
||||
END
|
||||
sound.raw
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/sangoma_mgd/!svn/ver/1/trunk/sound.raw
|
||||
END
|
||||
callgettest.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
|
@ -39,17 +39,23 @@ svn:wc:ra_dav:version-url
|
|||
V 40
|
||||
/svn/sangoma_mgd/!svn/ver/1/trunk/ss7box
|
||||
END
|
||||
re-sync.sh
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 45
|
||||
/svn/sangoma_mgd/!svn/ver/20/trunk/re-sync.sh
|
||||
END
|
||||
call_signal.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/sangoma_mgd/!svn/ver/42/trunk/call_signal.c
|
||||
END
|
||||
re-sync.sh
|
||||
sangoma_mgd.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 45
|
||||
/svn/sangoma_mgd/!svn/ver/20/trunk/re-sync.sh
|
||||
V 48
|
||||
/svn/sangoma_mgd/!svn/ver/66/trunk/sangoma_mgd.c
|
||||
END
|
||||
woomera.conf
|
||||
K 25
|
||||
|
@ -57,29 +63,23 @@ svn:wc:ra_dav:version-url
|
|||
V 46
|
||||
/svn/sangoma_mgd/!svn/ver/1/trunk/woomera.conf
|
||||
END
|
||||
sangoma_mgd.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/sangoma_mgd/!svn/ver/59/trunk/sangoma_mgd.c
|
||||
END
|
||||
call_signal.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 47
|
||||
/svn/sangoma_mgd/!svn/ver/1/trunk/call_signal.h
|
||||
END
|
||||
Changelog.sangoma_mgd
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 56
|
||||
/svn/sangoma_mgd/!svn/ver/60/trunk/Changelog.sangoma_mgd
|
||||
END
|
||||
sangoma_mgd.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 48
|
||||
/svn/sangoma_mgd/!svn/ver/58/trunk/sangoma_mgd.h
|
||||
/svn/sangoma_mgd/!svn/ver/64/trunk/sangoma_mgd.h
|
||||
END
|
||||
Changelog.sangoma_mgd
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 56
|
||||
/svn/sangoma_mgd/!svn/ver/66/trunk/Changelog.sangoma_mgd
|
||||
END
|
||||
q931_cause.h
|
||||
K 25
|
||||
|
@ -99,6 +99,12 @@ svn:wc:ra_dav:version-url
|
|||
V 42
|
||||
/svn/sangoma_mgd/!svn/ver/51/trunk/install
|
||||
END
|
||||
sangoma_mgd_memdbg.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 55
|
||||
/svn/sangoma_mgd/!svn/ver/62/trunk/sangoma_mgd_memdbg.c
|
||||
END
|
||||
smg_ctrl
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
|
@ -108,12 +114,18 @@ END
|
|||
switch_buffer.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 49
|
||||
/svn/sangoma_mgd/!svn/ver/1/trunk/switch_buffer.c
|
||||
V 50
|
||||
/svn/sangoma_mgd/!svn/ver/61/trunk/switch_buffer.c
|
||||
END
|
||||
Makefile
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/sangoma_mgd/!svn/ver/48/trunk/Makefile
|
||||
/svn/sangoma_mgd/!svn/ver/65/trunk/Makefile
|
||||
END
|
||||
sangoma_mgd_memdbg.h
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 55
|
||||
/svn/sangoma_mgd/!svn/ver/62/trunk/sangoma_mgd_memdbg.h
|
||||
END
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
8
|
||||
|
||||
dir
|
||||
59
|
||||
65
|
||||
https://www.sangomapbx.com:/svn/sangoma_mgd/trunk
|
||||
https://www.sangomapbx.com:/svn/sangoma_mgd
|
||||
|
||||
|
||||
|
||||
2008-01-24T23:37:43.572123Z
|
||||
59
|
||||
2008-02-07T18:15:41.313227Z
|
||||
65
|
||||
ncorbic
|
||||
|
||||
|
||||
|
@ -32,72 +32,75 @@ file
|
|||
|
||||
|
||||
|
||||
2007-11-26T01:25:46.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
d2023784f5d89a5623927a366705e22a
|
||||
2007-11-24T22:45:32.820698Z
|
||||
36
|
||||
ncorbic
|
||||
|
||||
app
|
||||
dir
|
||||
|
||||
sound.raw
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-01-11T19:07:46.000000Z
|
||||
da36acc78b83d5047481df0cca63d969
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
sangoma_mgd.conf.sample
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-02-07T18:07:12.000000Z
|
||||
31bd051e4281dc2e6e705cded0c30971
|
||||
2008-02-07T18:04:31.680485Z
|
||||
64
|
||||
ncorbic
|
||||
|
||||
switch_buffer.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-09-21T20:55:42.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
f4832443a621cbb88e92535898d11b83
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
root
|
||||
|
||||
sangoma_mgd.conf.sample
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-10-18T17:51:26.000000Z
|
||||
6f5866feb746caa979c0c4df03517326
|
||||
2007-10-16T22:33:32.246854Z
|
||||
25
|
||||
ncorbic
|
||||
|
||||
sound.raw
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-09-21T20:55:42.000000Z
|
||||
da36acc78b83d5047481df0cca63d969
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
app
|
||||
dir
|
||||
|
||||
callgettest.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-09-21T20:55:42.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
2403f191bdc1959c4cfd186b5030b9b1
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
root
|
||||
has-props
|
||||
|
||||
conf
|
||||
dir
|
||||
|
||||
ss7box
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-12-21T21:08:30.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
f20dab977386b2508903e24a307ca2d6
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
|
@ -107,68 +110,65 @@ has-props
|
|||
|
||||
svn:special
|
||||
|
||||
conf
|
||||
dir
|
||||
|
||||
scripts
|
||||
dir
|
||||
|
||||
re-sync.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-09-25T00:58:41.000000Z
|
||||
1cd822495b7d97b8e089c93bac1ad71a
|
||||
2007-09-25T02:04:57.936973Z
|
||||
20
|
||||
ncorbic
|
||||
has-props
|
||||
|
||||
call_signal.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-11-28T21:14:37.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
bcf6ba51a26281d7a0963c364f8610f1
|
||||
2007-11-28T21:12:42.416435Z
|
||||
42
|
||||
ncorbic
|
||||
|
||||
re-sync.sh
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-01-11T19:07:46.000000Z
|
||||
1cd822495b7d97b8e089c93bac1ad71a
|
||||
2007-09-25T02:04:57.936973Z
|
||||
20
|
||||
ncorbic
|
||||
has-props
|
||||
|
||||
sangoma_mgd.c
|
||||
file
|
||||
66
|
||||
|
||||
|
||||
|
||||
2008-02-08T17:53:31.000000Z
|
||||
fb2f3311aca106d27d61957211903a0d
|
||||
2008-02-08T17:46:54.335012Z
|
||||
66
|
||||
ncorbic
|
||||
|
||||
woomera.conf
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-09-24T19:55:41.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
356d6fc18e0670efac6de6001e58648e
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
root
|
||||
|
||||
sangoma_mgd.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-01-25T21:10:41.000000Z
|
||||
1c26650ec682522d42585c0300d9cc51
|
||||
2008-01-24T23:37:43.572123Z
|
||||
59
|
||||
ncorbic
|
||||
|
||||
call_signal.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2007-09-21T20:55:42.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
1a8b734edbabbe1e04c0086460cf1565
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
|
@ -180,22 +180,22 @@ file
|
|||
|
||||
|
||||
|
||||
2008-01-18T23:23:07.000000Z
|
||||
980fdef03b9982e8411a1e3a0d45a57d
|
||||
2008-01-18T23:17:38.335382Z
|
||||
58
|
||||
2008-02-07T18:07:44.000000Z
|
||||
0e349003dfb2ecb954424d503cee4c9e
|
||||
2008-02-07T18:04:31.680485Z
|
||||
64
|
||||
ncorbic
|
||||
|
||||
Changelog.sangoma_mgd
|
||||
file
|
||||
60
|
||||
66
|
||||
|
||||
|
||||
|
||||
2008-01-25T21:12:18.000000Z
|
||||
bcf8a4b0b7ad944703d619cbf5087230
|
||||
2008-01-25T21:06:05.930927Z
|
||||
60
|
||||
2008-02-08T17:54:19.000000Z
|
||||
24d92bda7769867980fd44e68f2eb422
|
||||
2008-02-08T17:46:54.335012Z
|
||||
66
|
||||
ncorbic
|
||||
|
||||
q931_cause.h
|
||||
|
@ -204,7 +204,7 @@ file
|
|||
|
||||
|
||||
|
||||
2007-09-21T20:55:42.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
a31121fb876e49155ae5d77812b68cc3
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
|
@ -216,7 +216,7 @@ file
|
|||
|
||||
|
||||
|
||||
2007-09-21T20:55:42.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
0f725f95ced42af15dcaef21f3a1722b
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
|
@ -231,13 +231,25 @@ file
|
|||
|
||||
|
||||
|
||||
2007-12-20T17:31:41.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
0e00003cd276e523b9b6e6df6a2f823f
|
||||
2007-12-20T00:59:56.095828Z
|
||||
51
|
||||
ncorbic
|
||||
has-props
|
||||
|
||||
sangoma_mgd_memdbg.c
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-02-06T22:45:23.000000Z
|
||||
c97ea5c4ee482db2409549e9c320d633
|
||||
2008-02-06T22:23:25.673829Z
|
||||
62
|
||||
ncorbic
|
||||
|
||||
smg_ctrl
|
||||
file
|
||||
|
||||
|
@ -257,11 +269,11 @@ file
|
|||
|
||||
|
||||
|
||||
2007-09-21T20:55:42.000000Z
|
||||
628f33fbdf3fb2d3c2861684146bbf5c
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
root
|
||||
2008-02-06T22:45:23.000000Z
|
||||
c8cc3aa052980e6c7cb766ae564882d1
|
||||
2008-02-06T22:22:53.766395Z
|
||||
61
|
||||
ncorbic
|
||||
|
||||
Makefile
|
||||
file
|
||||
|
@ -269,9 +281,21 @@ file
|
|||
|
||||
|
||||
|
||||
2007-12-05T19:56:32.000000Z
|
||||
7f772a76025b629be3915375ccbf5034
|
||||
2007-12-05T18:26:50.890720Z
|
||||
48
|
||||
2008-02-07T18:23:40.000000Z
|
||||
d03c6e24e68df0f99cee78567a623583
|
||||
2008-02-07T18:15:41.313227Z
|
||||
65
|
||||
ncorbic
|
||||
|
||||
sangoma_mgd_memdbg.h
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2008-02-06T22:45:23.000000Z
|
||||
81957c6e3d9a6caa2e223e954c15c49c
|
||||
2008-02-06T22:23:25.673829Z
|
||||
62
|
||||
ncorbic
|
||||
|
||||
|
|
|
@ -1,12 +1,32 @@
|
|||
sangoma_mgd.c
|
||||
======================================
|
||||
Jan 24 2007
|
||||
|
||||
Feb 08 2008
|
||||
* v1.30 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* The fix in v1.26 causes double stop.
|
||||
* I took out the v1.26 fix and added
|
||||
* a big warning if that condition is
|
||||
* ever reached.
|
||||
|
||||
|
||||
Feb 07 2008
|
||||
* v1.29 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Added strip_cid_non_digits option
|
||||
*
|
||||
|
||||
Feb 06 2008
|
||||
* v1.28 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Fixed a memory leak in clone event
|
||||
* function. Added memory check subsystem
|
||||
*
|
||||
|
||||
Jan 24 2008
|
||||
* v1.27 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Fixed a memory leak on incoming calls
|
||||
* Removed the use of server listener which
|
||||
* was not used
|
||||
|
||||
Jan 18 2007
|
||||
Jan 18 2008
|
||||
* v1.26 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Fixed hangup after invalid Answer or Ack Session
|
||||
* Can cause double use of setup id - now fixed
|
||||
|
|
|
@ -38,6 +38,10 @@ CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6
|
|||
CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g
|
||||
LDFLAGS=-L lib/libteletone/.libs -L. -L/usr/local/lib -L ../../ssmg/libsangoma.trunk/.libs -lpthread -lsangoma -lm
|
||||
|
||||
#Enable memory leak subsystem
|
||||
#Not to be used in production
|
||||
#CFLAGS += -DSMG_MEMORY_DEBUG
|
||||
|
||||
|
||||
ifeq "${SMG_DTMF}" "YES"
|
||||
LDFLAGS+= -lteletone
|
||||
|
@ -57,12 +61,16 @@ switch_buffer.o: switch_buffer.c switch_buffer.h
|
|||
call_signal.o: call_signal.c call_signal.h
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o call_signal.o call_signal.c
|
||||
|
||||
sangoma_mgd: sangoma_mgd.o call_signal.o switch_buffer.o sigboost.h
|
||||
rm -fr core*
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o switch_buffer.o call_signal.o $(LDFLAGS)
|
||||
sangoma_mgd_memdbg.o: sangoma_mgd_memdbg.c sangoma_mgd_memdbg.h
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd_memdbg.o sangoma_mgd_memdbg.c
|
||||
|
||||
sangoma_mgd.o: sangoma_mgd.c sangoma_mgd.h sigboost.h
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c
|
||||
|
||||
sangoma_mgd: sangoma_mgd.o sangoma_mgd_memdbg.o call_signal.o switch_buffer.o sigboost.h sangoma_mgd_memdbg.h
|
||||
rm -fr core*
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o sangoma_mgd_memdbg.o switch_buffer.o call_signal.o $(LDFLAGS)
|
||||
|
||||
|
||||
|
||||
clean: old_cleanup
|
||||
|
|
|
@ -8,14 +8,30 @@
|
|||
* the GNU General Public License
|
||||
*
|
||||
* =============================================
|
||||
* v1.30 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Feb 08 2008
|
||||
* The fix in v1.26 causes double stop.
|
||||
* I took out the v1.26 fix and added
|
||||
* a big warning if that condition is
|
||||
* ever reached.
|
||||
*
|
||||
* v1.29 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Feb 07 2008
|
||||
* Added strip_cid_non_digits option
|
||||
*
|
||||
* v1.28 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Feb 06 2008
|
||||
* Fixed a memory leak in clone event
|
||||
* function. Added memory check subsystem
|
||||
*
|
||||
* v1.27 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Jan 24 2007
|
||||
* Jan 24 2008
|
||||
* Fixed a memory leak on incoming calls
|
||||
* Removed the use of server listener which
|
||||
* was not used
|
||||
*
|
||||
* v1.26 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Jan 18 2007
|
||||
* Jan 18 2008
|
||||
* Fixed hangup after invalid Answer or Ack Session
|
||||
* Can cause double use of setup id - now fixed
|
||||
* Update on autoacm on accept check for acked.
|
||||
|
@ -120,6 +136,7 @@
|
|||
*********************************************************************************/
|
||||
|
||||
#include "sangoma_mgd.h"
|
||||
#include "sangoma_mgd_memdbg.h"
|
||||
#include "q931_cause.h"
|
||||
|
||||
|
||||
|
@ -141,7 +158,7 @@ static struct woomera_interface woomera_dead_dev;
|
|||
#endif
|
||||
|
||||
|
||||
#define SMG_VERSION "v1.27"
|
||||
#define SMG_VERSION "v1.30"
|
||||
|
||||
/* enable early media */
|
||||
#if 1
|
||||
|
@ -176,7 +193,7 @@ hp_tdm_api_span_t *hptdmspan[WOOMERA_MAX_SPAN];
|
|||
|
||||
const char WELCOME_TEXT[] =
|
||||
"================================================================================\n"
|
||||
"Sangoma Media Gateway Daemon v1.27 \n"
|
||||
"Sangoma Media Gateway Daemon v1.30 \n"
|
||||
"TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n"
|
||||
"Copyright 2005, 2006, 2007 \n"
|
||||
"Nenad Corbic <ncorbic@sangoma.com>, Anthony Minessale II <anthmct@yahoo.com>\n"
|
||||
|
@ -289,13 +306,17 @@ void __log_printf(int level, FILE *fp, char *file, const char *func, int line, c
|
|||
return;
|
||||
}
|
||||
|
||||
if (fp == NULL) {
|
||||
fp = server.log;
|
||||
}
|
||||
|
||||
if (level && level > server.debug) {
|
||||
return;
|
||||
}
|
||||
|
||||
va_start(ap, fmt);
|
||||
#ifdef SOLARIS
|
||||
data = (char *) malloc(2048);
|
||||
data = (char *) smg_malloc(2048);
|
||||
vsnprintf(data, 2048, fmt, ap);
|
||||
#else
|
||||
ret = vasprintf(&data, fmt, ap);
|
||||
|
@ -371,7 +392,7 @@ static int socket_printf(int socket, char *fmt, ...)
|
|||
|
||||
va_start(ap, fmt);
|
||||
#ifdef SOLARIS
|
||||
data = (char *) malloc(2048);
|
||||
data = (char *) smg_malloc(2048);
|
||||
vsnprintf(data, 2048, fmt, ap);
|
||||
#else
|
||||
ret = vasprintf(&data, fmt, ap);
|
||||
|
@ -508,10 +529,10 @@ static struct woomera_event *new_woomera_event_printf(struct woomera_event *ebuf
|
|||
|
||||
va_start(ap, fmt);
|
||||
#ifdef SOLARIS
|
||||
event->data = (char *) malloc(2048);
|
||||
event->data = (char *) smg_malloc(2048);
|
||||
vsnprintf(event->data, 2048, fmt, ap);
|
||||
#else
|
||||
ret = vasprintf(&event->data, fmt, ap);
|
||||
ret = smg_vasprintf(&event->data, fmt, ap);
|
||||
#endif
|
||||
va_end(ap);
|
||||
if (ret == -1) {
|
||||
|
@ -532,9 +553,14 @@ static struct woomera_event *woomera_clone_event(struct woomera_event *event)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* This overwrites the MALLOC in clone causing a memory leak */
|
||||
memcpy(clone, event, sizeof(*event));
|
||||
|
||||
/* We must set the malloc flag back so that this event
|
||||
* will be deleted */
|
||||
_woomera_set_flag(clone, WFLAG_MALLOC);
|
||||
clone->next = NULL;
|
||||
clone->data = strdup(event->data);
|
||||
clone->data = smg_strdup(event->data);
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
@ -570,7 +596,7 @@ static void enqueue_event(struct woomera_interface *woomera,
|
|||
if (free_data && event->data) {
|
||||
/* The event has been duplicated, the original data
|
||||
* should be freed */
|
||||
free(event->data);
|
||||
smg_free(event->data);
|
||||
event->data=NULL;
|
||||
}
|
||||
}
|
||||
|
@ -630,7 +656,7 @@ static void del_listener(struct woomera_interface *woomera)
|
|||
} else {
|
||||
server.listeners = ptr->next;
|
||||
}
|
||||
free(ptr);
|
||||
smg_free(ptr);
|
||||
break;
|
||||
}
|
||||
last = ptr;
|
||||
|
@ -644,7 +670,7 @@ static void add_listener(struct woomera_interface *woomera)
|
|||
|
||||
pthread_mutex_lock(&server.listen_lock);
|
||||
|
||||
if ((new = malloc(sizeof(*new)))) {
|
||||
if ((new = smg_malloc(sizeof(*new)))) {
|
||||
memset(new, 0, sizeof(*new));
|
||||
new->woomera = woomera;
|
||||
new->next = server.listeners;
|
||||
|
@ -710,7 +736,7 @@ static struct woomera_interface *alloc_woomera(void)
|
|||
{
|
||||
struct woomera_interface *woomera = NULL;
|
||||
|
||||
if ((woomera = malloc(sizeof(struct woomera_interface)))) {
|
||||
if ((woomera = smg_malloc(sizeof(struct woomera_interface)))) {
|
||||
|
||||
memset(woomera, 0, sizeof(struct woomera_interface));
|
||||
|
||||
|
@ -934,7 +960,7 @@ static struct media_session *media_session_new(struct woomera_interface *woomera
|
|||
log_printf(2, server.log,"Starting new MEDIA session [%s] [%s]\n",
|
||||
woomera->interface,woomera->raw?woomera->raw:"N/A");
|
||||
|
||||
if ((ms = malloc(sizeof(struct media_session)))) {
|
||||
if ((ms = smg_malloc(sizeof(struct media_session)))) {
|
||||
memset(ms, 0, sizeof(struct media_session));
|
||||
|
||||
if (woomera->loop_tdm != 1) {
|
||||
|
@ -947,7 +973,7 @@ static struct media_session *media_session_new(struct woomera_interface *woomera
|
|||
}
|
||||
}
|
||||
|
||||
ms->ip = strndup(woomera->raw, x);
|
||||
ms->ip = smg_strndup(woomera->raw, x);
|
||||
time(&ms->started);
|
||||
p = woomera->raw + (x+1);
|
||||
ms->port = atoi(p);
|
||||
|
@ -981,7 +1007,7 @@ static struct media_session *media_session_new(struct woomera_interface *woomera
|
|||
static void media_session_free(struct media_session *ms)
|
||||
{
|
||||
if (ms->ip) {
|
||||
free(ms->ip);
|
||||
smg_free(ms->ip);
|
||||
}
|
||||
|
||||
teletone_destroy_session(&ms->tone_session);
|
||||
|
@ -989,7 +1015,7 @@ static void media_session_free(struct media_session *ms)
|
|||
|
||||
ms->woomera = NULL;
|
||||
|
||||
free(ms);
|
||||
smg_free(ms);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1907,7 +1933,7 @@ static struct woomera_interface * launch_woomera_loop_thread(call_signal_event_t
|
|||
server.process_table[event->span][event->chan].dev = NULL;
|
||||
memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ);
|
||||
pthread_mutex_unlock(&server.process_lock);
|
||||
free(woomera);
|
||||
smg_free(woomera);
|
||||
log_printf(0, server.log, "Critical ERROR: memory/socket error\n");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2969,6 +2995,10 @@ handle_call_answer_end:
|
|||
if (woomera) {
|
||||
woomera_set_flag(woomera,WFLAG_MEDIA_END);
|
||||
} else {
|
||||
|
||||
/* This can casuse a double STOP
|
||||
must be debugged further */
|
||||
#if 0
|
||||
isup_exec_command(event->span,
|
||||
event->chan,
|
||||
-1,
|
||||
|
@ -2977,6 +3007,9 @@ handle_call_answer_end:
|
|||
|
||||
log_printf(1, server.log, "Sent CALL STOP to Answer without session [w%dg%d]\n",
|
||||
event->span+1, event->chan+1);
|
||||
#endif
|
||||
log_printf(0, server.log, "WARNING: Received Answer with no session [w%dg%d]\n",
|
||||
event->span+1, event->chan+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3566,7 +3599,6 @@ static void handle_call_start_nack_ack(call_signal_event_t *event)
|
|||
return;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void validate_number(unsigned char *s)
|
||||
{
|
||||
unsigned char *p;
|
||||
|
@ -3578,16 +3610,15 @@ static void validate_number(unsigned char *s)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int parse_ss7_event(call_signal_connection_t *mcon, call_signal_event_t *event)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
#if 0
|
||||
validate_number((unsigned char*)event->called_number_digits);
|
||||
validate_number((unsigned char*)event->calling_number_digits);
|
||||
#endif
|
||||
if (server.strip_cid_non_digits) {
|
||||
validate_number((unsigned char*)event->called_number_digits);
|
||||
validate_number((unsigned char*)event->calling_number_digits);
|
||||
}
|
||||
|
||||
#if 1
|
||||
log_printf(2, server.log,
|
||||
|
@ -3948,13 +3979,13 @@ static void *woomera_thread_run(void *obj)
|
|||
if (socket_printf(woomera->socket, "%s", event_string)) {
|
||||
woomera_set_flag(woomera, WFLAG_MEDIA_END);
|
||||
woomera_clear_flag(woomera, WFLAG_RUNNING);
|
||||
free(event_string);
|
||||
smg_free(event_string);
|
||||
log_printf(4, server.log,
|
||||
"WOOMERA session (ptr=%p) print string error\n",
|
||||
woomera);
|
||||
break;
|
||||
}
|
||||
free(event_string);
|
||||
smg_free(event_string);
|
||||
}
|
||||
woomera_clear_flag(woomera, WFLAG_EVENT);
|
||||
}
|
||||
|
@ -4165,7 +4196,7 @@ woo_re_hangup:
|
|||
|
||||
while ((event_string = dequeue_event(woomera))) {
|
||||
socket_printf(woomera->socket, "%s", event_string);
|
||||
free(event_string);
|
||||
smg_free(event_string);
|
||||
}
|
||||
|
||||
if (peek_from_holding_tank(index)) {
|
||||
|
@ -4236,7 +4267,7 @@ woo_re_hangup:
|
|||
if (woomera_test_flag(woomera, WFLAG_EVENT)){
|
||||
while ((event_string = dequeue_event(woomera))) {
|
||||
socket_printf(woomera->socket, "%s", event_string);
|
||||
free(event_string);
|
||||
smg_free(event_string);
|
||||
}
|
||||
woomera_clear_flag(woomera, WFLAG_EVENT);
|
||||
}
|
||||
|
@ -4360,7 +4391,7 @@ woo_re_hangup:
|
|||
|
||||
/* delete queue */
|
||||
while ((event_string = dequeue_event(woomera))) {
|
||||
free(event_string);
|
||||
smg_free(event_string);
|
||||
}
|
||||
|
||||
if (woomera_test_flag(woomera, WFLAG_LISTENING)) {
|
||||
|
@ -4386,7 +4417,7 @@ woo_re_hangup:
|
|||
|
||||
woomera_message_clear(&wmsg);
|
||||
|
||||
free(woomera);
|
||||
smg_free(woomera);
|
||||
pthread_mutex_lock(&server.thread_count_lock);
|
||||
server.call_count--;
|
||||
server.thread_count--;
|
||||
|
@ -4549,7 +4580,7 @@ static int configure_server(void)
|
|||
cnt++;
|
||||
} else if (!strcasecmp(var, "logfile_path")) {
|
||||
if (!server.logfile_path) {
|
||||
server.logfile_path = strdup(val);
|
||||
server.logfile_path = smg_strdup(val);
|
||||
}
|
||||
} else if (!strcasecmp(var, "woomera_port")) {
|
||||
server.port = atoi(val);
|
||||
|
@ -4569,6 +4600,8 @@ static int configure_server(void)
|
|||
server.dtmf_off = atoi(val);
|
||||
} else if (!strcasecmp(var, "dtmf_inter_ch_duration")){
|
||||
server.dtmf_intr_ch = atoi(val);
|
||||
} else if (!strcasecmp(var, "strip_cid_non_digits")){
|
||||
server.strip_cid_non_digits = atoi(val);
|
||||
} else if (!strcasecmp(var, "max_calls")) {
|
||||
int max = atoi(val);
|
||||
if (max > 0) {
|
||||
|
@ -4722,7 +4755,7 @@ static int main_thread(void)
|
|||
|
||||
close_socket(&new_woomera->socket);
|
||||
new_woomera->socket=-1;
|
||||
free(new_woomera);
|
||||
smg_free(new_woomera);
|
||||
}
|
||||
} else {
|
||||
log_printf(0, server.log, "Critical ERROR: memory/socket error\n");
|
||||
|
@ -4736,7 +4769,8 @@ static int main_thread(void)
|
|||
|
||||
static int do_ignore(int sig)
|
||||
{
|
||||
return 0;
|
||||
sdla_memdbg_free(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_shut(int sig)
|
||||
|
@ -4820,7 +4854,7 @@ static int woomera_startup(int argc, char **argv)
|
|||
}
|
||||
} else if (!strcasecmp(arg, "-log")) {
|
||||
if (argv[x] && *(argv[x]) != '-') {
|
||||
server.logfile_path = strdup(argv[x++]);
|
||||
server.logfile_path = smg_strdup(argv[x++]);
|
||||
}
|
||||
} else if (*arg == '-') {
|
||||
log_printf(0, stderr, "Unknown Option %s\n", arg);
|
||||
|
@ -4913,6 +4947,7 @@ static int woomera_startup(int argc, char **argv)
|
|||
|
||||
(void) signal(SIGINT,(void *) do_shut);
|
||||
(void) signal(SIGPIPE,(void *) do_ignore);
|
||||
(void) signal(SIGUSR1,(void *) do_ignore);
|
||||
(void) signal(SIGHUP,(void *) do_shut);
|
||||
|
||||
|
||||
|
@ -4923,7 +4958,8 @@ static int woomera_startup(int argc, char **argv)
|
|||
}
|
||||
|
||||
fprintf(stderr, "%s", WELCOME_TEXT);
|
||||
log_printf(0, stderr, "Woomera STARTUP Complete. [AutoACM=%i]\n",autoacm);
|
||||
log_printf(0, stderr, "Woomera STARTUP Complete. [AutoACM=%i SDigit=%i]\n",
|
||||
autoacm,server.strip_cid_non_digits);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -4946,13 +4982,13 @@ static int woomera_shutdown(void)
|
|||
|
||||
|
||||
if (server.logfile_path) {
|
||||
free(server.logfile_path);
|
||||
smg_free(server.logfile_path);
|
||||
server.logfile_path = NULL;
|
||||
}
|
||||
|
||||
/* delete queue */
|
||||
while ((event_string = dequeue_event(&server.master_connection))) {
|
||||
free(event_string);
|
||||
smg_free(event_string);
|
||||
}
|
||||
|
||||
while(server.thread_count > 0) {
|
||||
|
@ -4985,6 +5021,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
mlockall(MCL_FUTURE);
|
||||
|
||||
sdla_memdbg_init();
|
||||
|
||||
server.hw_coding=0;
|
||||
|
||||
|
@ -4997,6 +5034,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
woomera_shutdown();
|
||||
|
||||
sdla_memdbg_free(1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,3 +59,10 @@ dtmf_off_duration => 10
|
|||
#1-Enable (Default)
|
||||
autoacm => 1
|
||||
|
||||
|
||||
#Strip non digits from incoming
|
||||
#calls. Removes F from incoming cid
|
||||
#when overlap signalling is used.
|
||||
#0-Disable
|
||||
#1-Enable
|
||||
strip_cid_non_digits => 0
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <syslog.h>
|
||||
#include <g711.h>
|
||||
|
||||
#include "sangoma_mgd_memdbg.h"
|
||||
|
||||
#ifdef __LINUX__
|
||||
#include <sys/prctl.h>
|
||||
|
@ -67,7 +68,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
#define STDERR fileno(stderr)
|
||||
#define MAXPENDING 500
|
||||
#define MGD_STACK_SIZE 1024 * 240
|
||||
|
@ -278,6 +278,7 @@ struct woomera_server {
|
|||
int dtmf_off;
|
||||
int dtmf_intr_ch;
|
||||
int dtmf_size;
|
||||
int strip_cid_non_digits;
|
||||
} server;
|
||||
|
||||
struct woomera_config {
|
||||
|
@ -478,13 +479,13 @@ static inline void woomera_set_raw(struct woomera_interface *woomera, char *raw)
|
|||
char *oldraw=woomera->raw;
|
||||
|
||||
if (raw) {
|
||||
woomera->raw = strdup(raw);
|
||||
woomera->raw = smg_strdup(raw);
|
||||
} else {
|
||||
woomera->raw = NULL;
|
||||
}
|
||||
|
||||
if (oldraw) {
|
||||
free(oldraw);
|
||||
smg_free(oldraw);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -510,13 +511,13 @@ static inline void woomera_set_interface(struct woomera_interface *woomera, char
|
|||
char *iface = woomera->interface;
|
||||
|
||||
if (interface) {
|
||||
woomera->interface = strdup(interface);
|
||||
woomera->interface = smg_strdup(interface);
|
||||
} else {
|
||||
woomera->interface = NULL;
|
||||
}
|
||||
|
||||
if (iface) {
|
||||
free(iface);
|
||||
smg_free(iface);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -549,7 +550,7 @@ static inline struct woomera_event *new_woomera_event(void)
|
|||
{
|
||||
struct woomera_event *event = NULL;
|
||||
|
||||
if ((event = malloc(sizeof(*event)))) {
|
||||
if ((event = smg_malloc(sizeof(*event)))) {
|
||||
memset(event, 0, sizeof(*event));
|
||||
_woomera_set_flag(event, WFLAG_MALLOC);
|
||||
}
|
||||
|
@ -561,7 +562,7 @@ static inline struct woomera_event *new_woomera_event(void)
|
|||
static inline void destroy_woomera_event_data(struct woomera_event *event)
|
||||
{
|
||||
if (event->data) {
|
||||
free (event->data);
|
||||
smg_free (event->data);
|
||||
event->data=NULL;
|
||||
}
|
||||
}
|
||||
|
@ -569,10 +570,12 @@ static inline void destroy_woomera_event_data(struct woomera_event *event)
|
|||
static inline void destroy_woomera_event(struct woomera_event **event, event_args free_data)
|
||||
{
|
||||
if (free_data) {
|
||||
free ((*event)->data);
|
||||
smg_free ((*event)->data);
|
||||
}
|
||||
|
||||
(*event)->data=NULL;
|
||||
if (woomera_test_flag((*event), WFLAG_MALLOC)) {
|
||||
free (*event);
|
||||
smg_free (*event);
|
||||
*event = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
|
||||
|
||||
#include "sangoma_mgd.h"
|
||||
#include "sangoma_mgd_memdbg.h"
|
||||
|
||||
|
||||
int wan_debug_mem;
|
||||
pthread_mutex_t smg_debug_mem_lock;
|
||||
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
#warning "SMG_MEMORY_DEBUG Enabled"
|
||||
#endif
|
||||
|
||||
WAN_LIST_HEAD(SNAME_PLACEHOLDER_MEM, sdla_memdbg_el) sdla_memdbg_head =
|
||||
WAN_LIST_HEAD_INITIALIZER(&sdla_memdbg_head);
|
||||
|
||||
|
||||
int sdla_memdbg_init(void)
|
||||
{
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
pthread_mutex_init(&smg_debug_mem_lock, NULL);
|
||||
WAN_LIST_INIT(&sdla_memdbg_head);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int sdla_memdbg_push(void *mem, char *func_name, int line, int len)
|
||||
{
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
sdla_memdbg_el_t *sdla_mem_el;
|
||||
|
||||
sdla_mem_el = malloc(sizeof(sdla_memdbg_el_t));
|
||||
if (!sdla_mem_el) {
|
||||
log_printf(0,NULL,"%s:%d Critical failed to allocate memory!\n",
|
||||
__FUNCTION__,__LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(sdla_mem_el,0,sizeof(sdla_memdbg_el_t));
|
||||
|
||||
sdla_mem_el->len=len;
|
||||
sdla_mem_el->line=line;
|
||||
sdla_mem_el->mem=mem;
|
||||
strncpy(sdla_mem_el->cmd_func,func_name,sizeof(sdla_mem_el->cmd_func)-1);
|
||||
|
||||
|
||||
pthread_mutex_lock(&smg_debug_mem_lock);
|
||||
wan_debug_mem+=sdla_mem_el->len;
|
||||
WAN_LIST_INSERT_HEAD(&sdla_memdbg_head, sdla_mem_el, next);
|
||||
pthread_mutex_unlock(&smg_debug_mem_lock);
|
||||
|
||||
#ifdef SMG_MEMORY_DEBUG_PRINT
|
||||
log_printf(0,NULL,"%s:%d: Alloc %p Len=%i Total=%i\n",
|
||||
sdla_mem_el->cmd_func,sdla_mem_el->line,
|
||||
sdla_mem_el->mem, sdla_mem_el->len,wan_debug_mem);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int sdla_memdbg_pull(void *mem, char *func_name, int line)
|
||||
{
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
sdla_memdbg_el_t *sdla_mem_el;
|
||||
int err=-1;
|
||||
|
||||
pthread_mutex_lock(&smg_debug_mem_lock);
|
||||
|
||||
WAN_LIST_FOREACH(sdla_mem_el, &sdla_memdbg_head, next){
|
||||
if (sdla_mem_el->mem == mem) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (sdla_mem_el) {
|
||||
WAN_LIST_REMOVE(sdla_mem_el, next);
|
||||
wan_debug_mem-=sdla_mem_el->len;
|
||||
pthread_mutex_unlock(&smg_debug_mem_lock);
|
||||
|
||||
#ifdef SMG_MEMORY_DEBUG_PRINT
|
||||
log_printf(0,NULL,"%s:%d: DeAlloc %p Len=%i Total=%i (From %s:%d)\n",
|
||||
func_name,line,
|
||||
sdla_mem_el->mem, sdla_mem_el->len, wan_debug_mem,
|
||||
sdla_mem_el->cmd_func,sdla_mem_el->line);
|
||||
#endif
|
||||
|
||||
free(sdla_mem_el);
|
||||
err=0;
|
||||
} else {
|
||||
pthread_mutex_unlock(&smg_debug_mem_lock);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
log_printf(0,NULL,"%s:%d: sdla_memdbg_pull - Critical Error: Unknown Memeory %p\n",
|
||||
func_name,line,mem);
|
||||
}
|
||||
|
||||
return err;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int sdla_memdbg_free(int free_mem)
|
||||
{
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
sdla_memdbg_el_t *sdla_mem_el;
|
||||
int total=0;
|
||||
|
||||
log_printf(0,NULL,"sdladrv: Memory Still Allocated=%i \n",
|
||||
wan_debug_mem);
|
||||
|
||||
log_printf(0,NULL,"=====================BEGIN================================\n");
|
||||
|
||||
sdla_mem_el = WAN_LIST_FIRST(&sdla_memdbg_head);
|
||||
while(sdla_mem_el){
|
||||
sdla_memdbg_el_t *tmp = sdla_mem_el;
|
||||
|
||||
log_printf(0,NULL,"%s:%d: Mem Leak %p Len=%i \n",
|
||||
sdla_mem_el->cmd_func,sdla_mem_el->line,
|
||||
sdla_mem_el->mem, sdla_mem_el->len);
|
||||
total+=sdla_mem_el->len;
|
||||
|
||||
sdla_mem_el = WAN_LIST_NEXT(sdla_mem_el, next);
|
||||
|
||||
if (free_mem) {
|
||||
WAN_LIST_REMOVE(tmp, next);
|
||||
free(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
log_printf(0,NULL,"=====================END==================================\n");
|
||||
log_printf(0,NULL,"sdladrv: Memory Still Allocated=%i Leaks Found=%i Missing=%i\n",
|
||||
wan_debug_mem,total,wan_debug_mem-total);
|
||||
|
||||
if (free_mem) {
|
||||
pthread_mutex_destroy(&smg_debug_mem_lock);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
# ifndef __SMG_MEM_DEBUG__
|
||||
# define __SMG_MEM_DEBUG__
|
||||
|
||||
|
||||
|
||||
# define WAN_LIST_HEAD(name, type) struct name { struct type * lh_first; }
|
||||
# define WAN_LIST_HEAD_INITIALIZER(head) { NULL }
|
||||
# define WAN_LIST_ENTRY(type) struct { struct type *le_next; struct type **le_prev; }
|
||||
# define WAN_LIST_FIRST(head) ((head)->lh_first)
|
||||
# define WAN_LIST_END(head) NULL
|
||||
# define WAN_LIST_EMPTY(head) (WAN_LIST_FIRST(head) == WAN_LIST_END(head))
|
||||
# define WAN_LIST_NEXT(elm, field) ((elm)->field.le_next)
|
||||
# define WAN_LIST_FOREACH(var, head, field) for((var) = WAN_LIST_FIRST(head); \
|
||||
(var); \
|
||||
(var) = WAN_LIST_NEXT(var, field))
|
||||
# define WAN_LIST_INIT(head) do { WAN_LIST_FIRST(head) = NULL;}\
|
||||
while(0)
|
||||
|
||||
#define WAN_LIST_INSERT_HEAD(head, elm, field) do { \
|
||||
if ((WAN_LIST_NEXT((elm), field) = WAN_LIST_FIRST((head))) != NULL) \
|
||||
WAN_LIST_FIRST((head))->field.le_prev = &WAN_LIST_NEXT((elm), field);\
|
||||
WAN_LIST_FIRST((head)) = (elm); \
|
||||
(elm)->field.le_prev = &WAN_LIST_FIRST((head)); \
|
||||
} while (0)
|
||||
#define WAN_LIST_INSERT_AFTER(listelm, elm, field) do { \
|
||||
if ((WAN_LIST_NEXT((elm), field) = WAN_LIST_NEXT((listelm), field)) != NULL)\
|
||||
WAN_LIST_NEXT((listelm), field)->field.le_prev = \
|
||||
&WAN_LIST_NEXT((elm), field); \
|
||||
WAN_LIST_NEXT((listelm), field) = (elm); \
|
||||
(elm)->field.le_prev = &WAN_LIST_NEXT((listelm), field); \
|
||||
} while (0)
|
||||
#define WAN_LIST_REMOVE(elm, field) do { \
|
||||
if (WAN_LIST_NEXT((elm), field) != NULL) \
|
||||
WAN_LIST_NEXT((elm), field)->field.le_prev = \
|
||||
(elm)->field.le_prev; \
|
||||
*(elm)->field.le_prev = WAN_LIST_NEXT((elm), field); \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
typedef struct sdla_memdbg_el
|
||||
{
|
||||
unsigned int len;
|
||||
unsigned int line;
|
||||
char cmd_func[128];
|
||||
void *mem;
|
||||
WAN_LIST_ENTRY(sdla_memdbg_el) next;
|
||||
}sdla_memdbg_el_t;
|
||||
|
||||
|
||||
int sdla_memdbg_push(void *mem, char *func_name, int line, int len);
|
||||
int sdla_memdbg_init(void);
|
||||
int sdla_memdbg_pull(void *mem, char *func_name, int line);
|
||||
int sdla_memdbg_free(int);
|
||||
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
#define smg_malloc(size) __smg_malloc(size,(char*)__FUNCTION__,(int)__LINE__)
|
||||
static inline void* __smg_malloc(int size, char *func_name, int line)
|
||||
#else
|
||||
static inline void* smg_malloc(int size)
|
||||
#endif
|
||||
{
|
||||
void* ptr = NULL;
|
||||
ptr = malloc(size);
|
||||
if (ptr){
|
||||
memset(ptr, 0, size);
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
sdla_memdbg_push(ptr, func_name, line, size);
|
||||
#endif
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
#define smg_strdup(ptr) __smg_strdup(ptr,(char*)__FUNCTION__,(int)__LINE__)
|
||||
static inline char* __smg_strdup(char *sptr, char *func_name, int line)
|
||||
#else
|
||||
static inline char* smg_strdup(char *sptr)
|
||||
#endif
|
||||
{
|
||||
char* ptr = NULL;
|
||||
ptr = strdup(sptr);
|
||||
if (ptr){
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
sdla_memdbg_push(ptr, func_name, line, strlen(ptr));
|
||||
#endif
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
#define smg_strndup(ptr,len) __smg_strndup(ptr,len,(char*)__FUNCTION__,(int)__LINE__)
|
||||
static inline char* __smg_strndup(char *sptr, int len, char *func_name, int line)
|
||||
#else
|
||||
static inline char* smg_strndup(char *sptr, int len)
|
||||
#endif
|
||||
{
|
||||
char* ptr = NULL;
|
||||
ptr = strndup(sptr,len);
|
||||
if (ptr){
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
sdla_memdbg_push(ptr, func_name, line, strlen(ptr));
|
||||
#endif
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
#define smg_vasprintf(a,b,c) __smg_vasprintf(a,b,c,(char*)__FUNCTION__,(int)__LINE__)
|
||||
static inline int __smg_vasprintf(char **strp, const char *fmt, va_list ap, char *func_name, int line)
|
||||
#else
|
||||
static inline int smg_vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
#endif
|
||||
{
|
||||
int ret = vasprintf(strp,fmt,ap);
|
||||
if (ret){
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
sdla_memdbg_push(*strp, func_name, line, strlen(*strp));
|
||||
#endif
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(SMG_MEMORY_DEBUG)
|
||||
#define smg_free(ptr) __smg_free(ptr,(char*)__FUNCTION__,(int)__LINE__)
|
||||
static inline void __smg_free(void* ptr, char *func_name, int line)
|
||||
#else
|
||||
static inline void smg_free(void* ptr)
|
||||
#endif
|
||||
{
|
||||
if (!ptr){
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SMG_MEMORY_DEBUG
|
||||
sdla_memdbg_pull(ptr, func_name, line);
|
||||
#endif
|
||||
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "sangoma_mgd.h"
|
||||
#include "switch_buffer.h"
|
||||
#include "sangoma_mgd_memdbg.h"
|
||||
|
||||
static uint32_t buffer_id = 0;
|
||||
|
||||
|
@ -46,8 +47,8 @@ SWITCH_DECLARE(switch_status_t) switch_buffer_create(switch_buffer_t **buffer, s
|
|||
switch_buffer_t *new_buffer;
|
||||
|
||||
|
||||
if ((new_buffer = malloc(sizeof(switch_buffer_t))) != 0
|
||||
&& (new_buffer->data = malloc(max_len)) != 0) {
|
||||
if ((new_buffer = smg_malloc(sizeof(switch_buffer_t))) != 0
|
||||
&& (new_buffer->data = smg_malloc(max_len)) != 0) {
|
||||
|
||||
new_buffer->datalen = max_len;
|
||||
new_buffer->id = buffer_id++;
|
||||
|
@ -64,12 +65,12 @@ switch_buffer_create_dynamic(switch_buffer_t **buffer, switch_size_t blocksize,
|
|||
{
|
||||
switch_buffer_t *new_buffer;
|
||||
|
||||
if ((new_buffer = malloc(sizeof(*new_buffer)))) {
|
||||
if ((new_buffer = smg_malloc(sizeof(*new_buffer)))) {
|
||||
memset(new_buffer, 0, sizeof(*new_buffer));
|
||||
|
||||
if (start_len) {
|
||||
if (!(new_buffer->data = malloc(start_len))) {
|
||||
free(new_buffer);
|
||||
if (!(new_buffer->data = smg_malloc(start_len))) {
|
||||
smg_free(new_buffer);
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
memset(new_buffer->data, 0, start_len);
|
||||
|
@ -260,8 +261,8 @@ SWITCH_DECLARE(void) switch_buffer_zero(switch_buffer_t *buffer)
|
|||
SWITCH_DECLARE(void) switch_buffer_destroy(switch_buffer_t **buffer)
|
||||
{
|
||||
if (*buffer) {
|
||||
free((*buffer)->data);
|
||||
free(*buffer);
|
||||
smg_free((*buffer)->data);
|
||||
smg_free(*buffer);
|
||||
}
|
||||
|
||||
*buffer = NULL;
|
||||
|
|
|
@ -1,12 +1,32 @@
|
|||
sangoma_mgd.c
|
||||
======================================
|
||||
Jan 24 2007
|
||||
|
||||
Feb 08 2008
|
||||
* v1.30 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* The fix in v1.26 causes double stop.
|
||||
* I took out the v1.26 fix and added
|
||||
* a big warning if that condition is
|
||||
* ever reached.
|
||||
|
||||
|
||||
Feb 07 2008
|
||||
* v1.29 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Added strip_cid_non_digits option
|
||||
*
|
||||
|
||||
Feb 06 2008
|
||||
* v1.28 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Fixed a memory leak in clone event
|
||||
* function. Added memory check subsystem
|
||||
*
|
||||
|
||||
Jan 24 2008
|
||||
* v1.27 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Fixed a memory leak on incoming calls
|
||||
* Removed the use of server listener which
|
||||
* was not used
|
||||
|
||||
Jan 18 2007
|
||||
Jan 18 2008
|
||||
* v1.26 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Fixed hangup after invalid Answer or Ack Session
|
||||
* Can cause double use of setup id - now fixed
|
||||
|
|
|
@ -38,6 +38,10 @@ CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6
|
|||
CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g
|
||||
LDFLAGS=-L lib/libteletone/.libs -L. -L/usr/local/lib -L ../../ssmg/libsangoma.trunk/.libs -lpthread -lsangoma -lm
|
||||
|
||||
#Enable memory leak subsystem
|
||||
#Not to be used in production
|
||||
#CFLAGS += -DSMG_MEMORY_DEBUG
|
||||
|
||||
|
||||
ifeq "${SMG_DTMF}" "YES"
|
||||
LDFLAGS+= -lteletone
|
||||
|
@ -57,12 +61,16 @@ switch_buffer.o: switch_buffer.c switch_buffer.h
|
|||
call_signal.o: call_signal.c call_signal.h
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o call_signal.o call_signal.c
|
||||
|
||||
sangoma_mgd: sangoma_mgd.o call_signal.o switch_buffer.o sigboost.h
|
||||
rm -fr core*
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o switch_buffer.o call_signal.o $(LDFLAGS)
|
||||
sangoma_mgd_memdbg.o: sangoma_mgd_memdbg.c sangoma_mgd_memdbg.h
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd_memdbg.o sangoma_mgd_memdbg.c
|
||||
|
||||
sangoma_mgd.o: sangoma_mgd.c sangoma_mgd.h sigboost.h
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c
|
||||
|
||||
sangoma_mgd: sangoma_mgd.o sangoma_mgd_memdbg.o call_signal.o switch_buffer.o sigboost.h sangoma_mgd_memdbg.h
|
||||
rm -fr core*
|
||||
$(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o sangoma_mgd_memdbg.o switch_buffer.o call_signal.o $(LDFLAGS)
|
||||
|
||||
|
||||
|
||||
clean: old_cleanup
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
8
|
||||
|
||||
dir
|
||||
59
|
||||
65
|
||||
https://www.sangomapbx.com:/svn/sangoma_mgd/trunk/app
|
||||
https://www.sangomapbx.com:/svn/sangoma_mgd
|
||||
|
||||
|
@ -32,7 +32,7 @@ file
|
|||
|
||||
|
||||
|
||||
2007-09-21T20:55:40.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
0b2da6b313f90b443457c4815ab95dab
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
|
@ -45,7 +45,7 @@ file
|
|||
|
||||
|
||||
|
||||
2007-09-21T20:55:40.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
604a892b5a763fef18fe92aa29f82bc9
|
||||
2007-09-21T20:53:51.260136Z
|
||||
1
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 35
|
||||
/svn/chan_woomera/!svn/ver/41/trunk
|
||||
/svn/chan_woomera/!svn/ver/44/trunk
|
||||
END
|
||||
chan_woomera.c
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 50
|
||||
/svn/chan_woomera/!svn/ver/41/trunk/chan_woomera.c
|
||||
/svn/chan_woomera/!svn/ver/44/trunk/chan_woomera.c
|
||||
END
|
||||
g711.h
|
||||
K 25
|
||||
|
@ -19,7 +19,7 @@ Changelog.chan_woomera
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 58
|
||||
/svn/chan_woomera/!svn/ver/42/trunk/Changelog.chan_woomera
|
||||
/svn/chan_woomera/!svn/ver/43/trunk/Changelog.chan_woomera
|
||||
END
|
||||
Makefile
|
||||
K 25
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
8
|
||||
|
||||
dir
|
||||
41
|
||||
44
|
||||
https://www.sangomapbx.com:/svn/chan_woomera/trunk
|
||||
https://www.sangomapbx.com:/svn/chan_woomera
|
||||
|
||||
|
||||
|
||||
2008-01-24T23:40:21.460521Z
|
||||
41
|
||||
2008-02-06T23:34:48.342150Z
|
||||
44
|
||||
ncorbic
|
||||
|
||||
|
||||
|
@ -32,10 +32,10 @@ file
|
|||
|
||||
|
||||
|
||||
2008-01-25T21:10:46.000000Z
|
||||
b436e071f0ca59e89dee6ff3ef3d9773
|
||||
2008-01-24T23:40:21.460521Z
|
||||
41
|
||||
2008-02-06T23:42:07.000000Z
|
||||
addee4a05c90a34d09faf9aa243d3a89
|
||||
2008-02-06T23:34:48.342150Z
|
||||
44
|
||||
ncorbic
|
||||
|
||||
g711.h
|
||||
|
@ -44,7 +44,7 @@ file
|
|||
|
||||
|
||||
|
||||
2007-09-21T20:31:17.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
0f725f95ced42af15dcaef21f3a1722b
|
||||
2007-09-21T20:29:00.887216Z
|
||||
1
|
||||
|
@ -52,14 +52,14 @@ root
|
|||
|
||||
Changelog.chan_woomera
|
||||
file
|
||||
42
|
||||
|
||||
|
||||
|
||||
2008-01-25T21:13:42.000000Z
|
||||
7dc04dac5167baa18fb3242bbb557506
|
||||
2008-01-25T21:07:23.131339Z
|
||||
42
|
||||
|
||||
2008-02-06T23:39:56.000000Z
|
||||
f97db784fdeb41fcb933c91e083b6256
|
||||
2008-02-06T23:32:32.062055Z
|
||||
43
|
||||
ncorbic
|
||||
|
||||
Makefile
|
||||
|
@ -68,7 +68,7 @@ file
|
|||
|
||||
|
||||
|
||||
2007-12-20T17:31:49.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
39268f5baaa58f6391cba2f506e41f18
|
||||
2007-12-18T20:11:15.703141Z
|
||||
29
|
||||
|
@ -80,7 +80,7 @@ file
|
|||
|
||||
|
||||
|
||||
2007-11-26T01:25:59.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
6b44396eddae33cda9cdb078e5030a1f
|
||||
2007-10-30T20:04:39.055688Z
|
||||
14
|
||||
|
@ -92,7 +92,7 @@ file
|
|||
|
||||
|
||||
|
||||
2007-09-21T20:55:42.000000Z
|
||||
2008-01-11T19:07:46.000000Z
|
||||
356d6fc18e0670efac6de6001e58648e
|
||||
2007-09-24T15:52:51.889664Z
|
||||
2
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
chan_woomera.c
|
||||
======================================
|
||||
Feb 06 2008
|
||||
* v1.25 Nenad Corbic <ncorbic@sangoma.com>
|
||||
* Bug fix in woomera message declaration
|
||||
* Possible memory overflow
|
||||
*
|
||||
|
||||
Jan 23 2008
|
||||
* v1.24 Nenad Corbic <ncorbic@sangoma.com>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue