First checkin of new version 2.0

- support for 4BRI, includes orig Eicon
  divautil files and firmware updated (only etsi).
This commit is contained in:
Armin Schindler 2000-03-25 12:56:41 +00:00
parent e8915fadb4
commit eecb80af4f
27 changed files with 6344 additions and 1139 deletions

View File

@ -1,5 +1,9 @@
$Id$
V2.0 - 2000-03-23 - Eicon's divautils included to support new
kernel-driver 2.0
Support for 4BRI card.
V1.2 - 2000-02-12 - Added write command to management interface.
Increased D-Channel logbuffer.

View File

@ -5,37 +5,46 @@
# (C) 1998-2000 Armin Schindler
# (C) 1999,2000 Cytronics & Melware
#
#
SHELL = /bin/sh
CFLAGS = -Wall -O2
CFLAGS = -Wall -O2 -DUNIX -DLINUX
INCLUDES = -I. -I@CONFIG_KERNELDIR@/include -I@CONFIG_KERNELDIR@/drivers/isdn/eicon
DEFS =
LDFLAGS = -L../lib @LIBS@
PROGRAMS =
PROGRAM = eiconctrl
MODULES = eiconctrl.o
DIVALOADPROGRAM = divaload
DIVALOGDPROGRAM = divalogd
DIVALOGPROGRAM = divalog
DIVAPROGRAMS = $(DIVALOADPROGRAM) $(DIVALOGDPROGRAM) $(DIVALOGPROGRAM)
MANPAGE = eiconctrl.8
INSTALL = @INSTALL@
SBINDIR = @CONFIG_SBINDIR@
DATADIR = @CONFIG_DATADIR@
DATA_DIR = @CONFIG_DATADIR@
MANDIR = @CONFIG_MANDIR@
MAN8DIR = $(MANDIR)/man8
INSTALL_PROGRAM = $(INSTALL) -o 0 -g 0 -m 0750
INSTALL_DATA = $(INSTALL) -o 0 -g 0 -m 0644
INSTALL_MAN = $(INSTALL) -o 0 -g 0 -m 0644
CC = @CC@
COPTS = -D__DATADIR__=\"$(shell echo $(DESTDIR)$(DATADIR))\"
COPTS = -DDATADIR=\"$(shell echo $(DESTDIR)$(DATA_DIR))\"
ifeq ("@CONFIG_EICONCTRL_DEBUG@","y")
COPTS += -D__DEBUGVAR__
COPTS += -DDEBUG
endif
.SUFFIXES:
.SUFFIXES: .c .o
%.o: %.c Makefile
$(CC) $(CFLAGS) $(INCLUDES) $(DEFS) $(COPTS) -c -o $@ $<
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o $@ $<
all: $(PROGRAM)
PROGRAMS = $(PROGRAM)
ifeq ("@HAVE_NATIVE@","n")
PROGRAMS += $(DIVAPROGRAMS)
endif
all: $(PROGRAMS)
config:
@./configure
@ -46,28 +55,78 @@ Makefile: Makefile.in config.status
config.status: configure
./config.status --recheck
$(PROGRAM): $(MODULES)
$(CC) $(CFLAGS) $(INCLUDES) $(DEFS) $? $(LDFLAGS) -o $@
$(PROGRAM):
$(CC) $(CFLAGS) $(INCLUDES) -DEICONCTRL $(COPTS) -c -o eiconctrl.o eiconctrl.c
$(CC) $(CFLAGS) $(INCLUDES) -DEICONCTRL $(COPTS) -c -o ./divautil/xlog.o ./divautil/xlog.c
ifeq ("@HAVE_NATIVE@","n")
$(CC) $(CFLAGS) $(INCLUDES) -DEICONCTRL $(COPTS) -c -o ./divautil/lindiload.o ./divautil/lindiload.c
$(CC) $(CFLAGS) $(INCLUDES) -DEICONCTRL $(COPTS) -c -o ./divautil/linload.o ./divautil/linload.c
$(CC) $(CFLAGS) $(INCLUDES) -DEICONCTRL $(COPTS) -c -o ./divautil/lindownload.o ./divautil/lindownload.c
$(CC) $(CFLAGS) $(INCLUDES) -DEICONCTRL $(COPTS) -c -o linuxcfg.o linuxcfg.c
$(CC) $(CFLAGS) $(INCLUDES) -DEICONCTRL eiconctrl.o ./divautil/lindiload.o ./divautil/linload.o ./divautil/lindownload.o ./divautil/xlog.o linuxcfg.o $(LDFLAGS) -o $(PROGRAM)
else
$(CC) $(CFLAGS) $(INCLUDES) -DEICONCTRL eiconctrl.o ./divautil/xlog.o $(LDFLAGS) -o $(PROGRAM)
endif
$(DIVALOADPROGRAM):
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o ./divautil/lindiload.o ./divautil/lindiload.c
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o ./divautil/linload.o ./divautil/linload.c
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o ./divautil/lindownload.o ./divautil/lindownload.c
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o linuxcfg.o linuxcfg.c
$(CC) $(CFLAGS) $(INCLUDES) ./divautil/lindiload.o ./divautil/linload.o ./divautil/lindownload.o linuxcfg.o $(LDFLAGS) -o $(DIVALOADPROGRAM)
$(DIVALOGDPROGRAM):
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o ./divautil/divalogdchr.o ./divautil/divalogdchr.c
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o ./divautil/loglib.o ./divautil/loglib.c
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o linuxcfg.o linuxcfg.c
$(CC) $(CFLAGS) $(INCLUDES) ./divautil/divalogdchr.o ./divautil/loglib.o linuxcfg.o $(LDFLAGS) -o $(DIVALOGDPROGRAM)
$(DIVALOGPROGRAM):
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o ./divautil/divalog.o ./divautil/divalog.c
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o ./divautil/loglib.o ./divautil/loglib.c
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o ./divautil/idilog.o ./divautil/idilog.c
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o ./divautil/xlog.o ./divautil/xlog.c
$(CC) $(CFLAGS) $(INCLUDES) $(COPTS) -c -o linuxcfg.o linuxcfg.c
$(CC) $(CFLAGS) $(INCLUDES) ./divautil/divalog.o ./divautil/loglib.o ./divautil/idilog.o ./divautil/xlog.o linuxcfg.o $(LDFLAGS) -o $(DIVALOGPROGRAM)
install-data:
mkdir -p $(DESTDIR)$(DATADIR)
tar xpvCfz $(DESTDIR)$(DATADIR) firmware/eicon_firm.tgz
mkdir -p $(DESTDIR)$(DATA_DIR)
tar xpCfz $(DESTDIR)$(DATA_DIR) firmware/eicon_firm.tgz
install-man: $(PROGRAM).man
mkdir -p $(DESTDIR)$(MAN8DIR)
$(INSTALL_MAN) $< $(DESTDIR)$(MAN8DIR)/$(MANPAGE)
install: $(PROGRAM) install-man install-data
install: all install-man install-data
$(INSTALL_PROGRAM) $(PROGRAM) $(DESTDIR)$(SBINDIR)/$(PROGRAM)
ifeq ("@HAVE_NATIVE@","n")
$(INSTALL_PROGRAM) $(DIVALOADPROGRAM) $(DESTDIR)$(SBINDIR)/$(DIVALOADPROGRAM)
$(INSTALL_PROGRAM) $(DIVALOGDPROGRAM) $(DESTDIR)$(SBINDIR)/$(DIVALOGDPROGRAM)
$(INSTALL_PROGRAM) $(DIVALOGPROGRAM) $(DESTDIR)$(SBINDIR)/$(DIVALOGPROGRAM)
endif
install-strip: $(PROGRAM)
install-strip: all
$(INSTALL_PROGRAM) -s $(PROGRAM) $(DESTDIR)$(SBINDIR)/$(PROGRAM)
ifeq ("@HAVE_NATIVE@","n")
$(INSTALL_PROGRAM) -s $(DIVALOADPROGRAM) $(DESTDIR)$(SBINDIR)/$(DIVALOADPROGRAM)
$(INSTALL_PROGRAM) -s $(DIVALOGDPROGRAM) $(DESTDIR)$(SBINDIR)/$(DIVALOGDPROGRAM)
$(INSTALL_PROGRAM) -s $(DIVALOGPROGRAM) $(DESTDIR)$(SBINDIR)/$(DIVALOGPROGRAM)
endif
uninstall:
rm -f $(DESTDIR)$(SBINDIR)/$(PROGRAM) $(DESTDIR)$(MAN8DIR)/$(MANPAGE)
ifeq ("@HAVE_NATIVE@","n")
rm -f $(DESTDIR)$(SBINDIR)/$(DIVALOADPROGRAM)
rm -f $(DESTDIR)$(SBINDIR)/$(DIVALOGDPROGRAM)
rm -f $(DESTDIR)$(SBINDIR)/$(DIVALOGPROGRAM)
endif
clean:
rm -f *.o *~ $(PROGRAM)
rm -f $(DIVALOADPROGRAM)
rm -f $(DIVALOGDPROGRAM)
rm -f $(DIVALOGPROGRAM)
rm -f ./divautil/*.o ./divautil/*~
distclean: clean
rm -f config.status config.cache config.log config.h Makefile eiconctrl.man

View File

@ -1,7 +1,7 @@
Eiconctrl user utility and firmware for supported active cards
Eiconctrl user utility and firmware for supported active ISDN cards
from Eicon Technology.
Version 1.2 (c) 2000 Cytronics & Melware
Version 2.0 (c) 2000 Cytronics & Melware
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
@ -32,11 +32,9 @@ news are, you can activate this with the command
(off course, you can deactivate this using "eiconctrl isdnlog off").
The bad news are, this is only possible with the
DIVA Server BRI card.
DIVA Server BRI card or the DIVA Server 4BRI card.
NOTICE :
This package is also part of isdn4k-utils package for isdn4linux
(refer to http://www.isdn4linux.de)
In order to use other isdn4linux features, like isdn-net-devices or
isdn feature and monitoring tools, you will need other parts from
the isdn4k-utils package.

3
eicon/aclocal.m4 vendored
View File

@ -48,6 +48,7 @@ AC_DEFUN(AC_CHECK_NPCI, [
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR} -I/usr/include"
have_npci="no"
HAVE_NATIVE="n"
AC_MSG_CHECKING([for pci code in ${CONFIG_KERNELDIR}/drivers/isdn/eicon/eicon.h])
AC_TRY_COMPILE([#include <linux/types.h>
#include <drivers/isdn/eicon/eicon.h>],eicon_pci_codebuf *p = NULL;,have_npci="yes",)
@ -55,7 +56,9 @@ AC_DEFUN(AC_CHECK_NPCI, [
CPPFLAGS="$OLD_CPPFLAGS"
if test "$have_npci" != "no" ; then
AC_DEFINE(HAVE_NPCI)
HAVE_NATIVE="y"
fi
AC_SUBST(HAVE_NPCI)
AC_SUBST(HAVE_NATIVE)
])

42
eicon/configure vendored
View File

@ -537,7 +537,7 @@ fi
I4LVERSION=${I4LVERSION:-"?.?"}
CONFIG_DATADIR=${CONFIG_DATADIR:-"/usr/lib/isdn"}
CONFIG_DATADIR=${CONFIG_DATADIR:-"/usr/lib/isdn/eicon"}
CONFIG_SBINDIR=${CONFIG_SBINDIR:-"/sbin"}
CONFIG_MANDIR=${CONFIG_MANDIR:-"/usr/man"}
CONFIG_EICONCTRL_DEBUG=${CONFIG_EICONCTRL_DEBUG:-"n"}
@ -1535,10 +1535,11 @@ EOF
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR} -I/usr/include"
have_npci="no"
HAVE_NATIVE="n"
echo $ac_n "checking for pci code in ${CONFIG_KERNELDIR}/drivers/isdn/eicon/eicon.h""... $ac_c" 1>&6
echo "configure:1540: checking for pci code in ${CONFIG_KERNELDIR}/drivers/isdn/eicon/eicon.h" >&5
echo "configure:1541: checking for pci code in ${CONFIG_KERNELDIR}/drivers/isdn/eicon/eicon.h" >&5
cat > conftest.$ac_ext <<EOF
#line 1542 "configure"
#line 1543 "configure"
#include "confdefs.h"
#include <linux/types.h>
#include <drivers/isdn/eicon/eicon.h>
@ -1546,7 +1547,7 @@ int main() {
eicon_pci_codebuf *p = NULL;
; return 0; }
EOF
if { (eval echo configure:1550: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1551: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
have_npci="yes"
else
@ -1561,17 +1562,19 @@ rm -f conftest*
#define HAVE_NPCI 1
EOF
HAVE_NATIVE="y"
fi
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR} -I/usr/include"
have_trace="no"
echo $ac_n "checking for TRACE in ${CONFIG_KERNELDIR}/drivers/isdn/eicon/eicon.h""... $ac_c" 1>&6
echo "configure:1573: checking for TRACE in ${CONFIG_KERNELDIR}/drivers/isdn/eicon/eicon.h" >&5
echo "configure:1576: checking for TRACE in ${CONFIG_KERNELDIR}/drivers/isdn/eicon/eicon.h" >&5
cat > conftest.$ac_ext <<EOF
#line 1575 "configure"
#line 1578 "configure"
#include "confdefs.h"
#include <linux/types.h>
#include <drivers/isdn/eicon/eicon.h>
@ -1579,7 +1582,7 @@ int main() {
int x = TRACE_OK;
; return 0; }
EOF
if { (eval echo configure:1583: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1586: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
have_trace="yes"
else
@ -1600,13 +1603,13 @@ EOF
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
echo "configure:1604: checking whether ${CC-cc} needs -traditional" >&5
echo "configure:1607: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
#line 1610 "configure"
#line 1613 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@ -1624,7 +1627,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
#line 1628 "configure"
#line 1631 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@ -1649,17 +1652,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1653: checking for $ac_hdr" >&5
echo "configure:1656: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1658 "configure"
#line 1661 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1666: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1688,12 +1691,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1692: checking for $ac_func" >&5
echo "configure:1695: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1697 "configure"
#line 1700 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1716,7 +1719,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1741,7 +1744,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
echo "configure:1745: checking for working mmap" >&5
echo "configure:1748: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1749,7 +1752,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
#line 1753 "configure"
#line 1756 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@ -1889,7 +1892,7 @@ main()
}
EOF
if { (eval echo configure:1893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@ -2114,6 +2117,7 @@ s%@CPP@%$CPP%g
s%@CONFIG_KERNELDIR@%$CONFIG_KERNELDIR%g
s%@HAVE_XLOG@%$HAVE_XLOG%g
s%@HAVE_NPCI@%$HAVE_NPCI%g
s%@HAVE_NATIVE@%$HAVE_NATIVE%g
s%@HAVE_TRACE@%$HAVE_TRACE%g
s%@INSTALL@%$INSTALL%g
s%@MANDATE@%$MANDATE%g

View File

@ -3,7 +3,7 @@ AC_INIT(eiconctrl.c)
AC_PREFIX_DEFAULT("/usr")
I4LVERSION=${I4LVERSION:-"?.?"}
CONFIG_DATADIR=${CONFIG_DATADIR:-"/usr/lib/isdn"}
CONFIG_DATADIR=${CONFIG_DATADIR:-"/usr/lib/isdn/eicon"}
CONFIG_SBINDIR=${CONFIG_SBINDIR:-"/sbin"}
CONFIG_MANDIR=${CONFIG_MANDIR:-"/usr/man"}
CONFIG_EICONCTRL_DEBUG=${CONFIG_EICONCTRL_DEBUG:-"n"}

817
eicon/divautil/cardtype.h Normal file
View File

@ -0,0 +1,817 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.1
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _CARDTYPE_H_
#define _CARDTYPE_H_
/*
* D-channel protocol identifiers
*
* Attention: Unfortunately the identifiers defined here differ from
* the identifiers used in Protocol/1/Common/prot/q931.h .
* The only reason for this is that q931.h has not a global
* scope and we did not know about the definitions there.
* But the definitions here cannot be changed easily because
* they are used in setup scripts and programs.
* Thus the definitions here have to be mapped if they are
* used in the protocol code context !
*/
#define PROTTYPE_MINVAL 0
#define PROTTYPE_ETSI 0
#define PROTTYPE_1TR6 1
#define PROTTYPE_BELG 2
#define PROTTYPE_FRANC 3
#define PROTTYPE_ATEL 4
#define PROTTYPE_NI 5
#define PROTTYPE_5ESS 6
#define PROTTYPE_JAPAN 7
#define PROTTYPE_SWED 8
#define PROTTYPE_US 9
#define PROTTYPE_MAXVAL 9
/*
* Card type identifiers
*/
#define CARD_UNKNOWN 0
#define CARD_NONE 0
/* DIVA cards */
#define CARDTYPE_DIVA_MCA 0
#define CARDTYPE_DIVA_ISA 1
#define CARDTYPE_DIVA_PCM 2
#define CARDTYPE_DIVAPRO_ISA 3
#define CARDTYPE_DIVAPRO_PCM 4
#define CARDTYPE_DIVAPICO_ISA 5
#define CARDTYPE_DIVAPICO_PCM 6
/* DIVA 2.0 cards */
#define CARDTYPE_DIVAPRO20_PCI 7
#define CARDTYPE_DIVA20_PCI 8
/* S cards */
#define CARDTYPE_QUADRO_ISA 9
#define CARDTYPE_S_ISA 10
#define CARDTYPE_S_MCA 11
#define CARDTYPE_SX_ISA 12
#define CARDTYPE_SX_MCA 13
#define CARDTYPE_SXN_ISA 14
#define CARDTYPE_SXN_MCA 15
#define CARDTYPE_SCOM_ISA 16
#define CARDTYPE_SCOM_MCA 17
#define CARDTYPE_PR_ISA 18
#define CARDTYPE_PR_MCA 19
/* Diva Server cards (formerly called Maestra, later Amadeo) */
#define CARDTYPE_MAESTRA_ISA 20
#define CARDTYPE_MAESTRA_PCI 21
/* Diva Server cards to be developed (Quadro, Primary rate) */
#define CARDTYPE_DIVASRV_Q_8M_PCI 22
#define CARDTYPE_DIVASRV_P_30M_PCI 23
#define CARDTYPE_DIVASRV_P_2M_PCI 24
#define CARDTYPE_DIVASRV_P_9M_PCI 25
/* DIVA 2.0 cards */
#define CARDTYPE_DIVA20_ISA 26
#define CARDTYPE_DIVA20U_ISA 27
#define CARDTYPE_DIVA20U_PCI 28
#define CARDTYPE_DIVAPRO20_ISA 29
#define CARDTYPE_DIVAPRO20U_ISA 30
#define CARDTYPE_DIVAPRO20U_PCI 31
/* DIVA combi cards (piccola ISDN + rockwell modem) */
#define CARDTYPE_DIVAMOBILE_PCM 32
#define CARDTYPE_TDKGLOBALPRO_PCM 33
/* DIVA Pro PC OEM card for 'New Media Corporation' */
#define CARDTYPE_NMC_DIVAPRO_PCM 34
/* DIVA Pro 2.0 OEM cards for 'British Telecom' */
#define CARDTYPE_BT_EXLANE_PCI 35
#define CARDTYPE_BT_EXLANE_ISA 36
/* DIVA low cost cards, 1st name DIVA 3.0, 2nd DIVA 2.01, 3rd ??? */
#define CARDTYPE_DIVALOW_ISA 37
#define CARDTYPE_DIVALOWU_ISA 38
/* next free card type identifier */
#define CARDTYPE_MAX 39
/*
* The card families
*/
#define FAMILY_DIVA 1
#define FAMILY_S 2
#define FAMILY_MAESTRA 3
#define FAMILY_MAX 4
/*
* The basic card types
*/
#define CARD_DIVA 1 /* DSP based, old DSP */
#define CARD_PRO 2 /* DSP based, new DSP */
#define CARD_PICO 3 /* HSCX based */
#define CARD_S 4 /* IDI on board based */
#define CARD_SX 5 /* IDI on board based */
#define CARD_SXN 6 /* IDI on board based */
#define CARD_SCOM 7 /* IDI on board based */
#define CARD_QUAD 8 /* IDI on board based */
#define CARD_PR 9 /* IDI on board based */
#define CARD_MAE 10 /* IDI on board based */
#define CARD_MAEQ 11 /* IDI on board based */
#define CARD_MAEP 12 /* IDI on board based */
#define CARD_DIVALOW 13 /* IPAC based */
#define CARD_MAX 14
/*
* The internal card types of the S family
*/
#define CARD_I_NONE 0
#define CARD_I_S 0
#define CARD_I_SX 1
#define CARD_I_SCOM 2
#define CARD_I_QUAD 3
#define CARD_I_PR 4
/*
* The bus types we support
*/
#define BUS_ISA 1
#define BUS_PCM 2
#define BUS_PCI 3
#define BUS_MCA 4
/*
* The chips we use for B-channel traffic
*/
#define CHIP_NONE 0
#define CHIP_DSP 1
#define CHIP_HSCX 2
#define CHIP_IPAC 3
/*
* The structures where the card properties are aggregated by id
*/
typedef struct CARD_PROPERTIES
{ char *Name; /* official marketing name */
unsigned short PnPId; /* plug and play ID (for non PCMIA cards) */
unsigned short Version; /* major and minor version no of the card */
unsigned char DescType; /* card type to set in the IDI descriptor */
unsigned char Family; /* basic family of the card */
unsigned short Features; /* features bits to set in the IDI desc. */
unsigned char Card; /* basic card type */
unsigned char IType; /* internal type of S cards (read from ram) */
unsigned char Bus; /* bus type this card is designed for */
unsigned char Chip; /* chipset used on card */
unsigned char Adapters; /* number of adapters on card */
unsigned char Channels; /* # of channels per adapter */
unsigned short E_info; /* # of ram entity info structs per adapter */
unsigned short SizeIo; /* size of IO window per adapter */
unsigned short SizeMem; /* size of memory window per adapter */
} CARD_PROPERTIES;
typedef struct CARD_RESOURCE
{ unsigned char Int [10];
unsigned short IoFirst;
unsigned short IoStep;
unsigned short IoCnt;
unsigned long MemFirst;
unsigned long MemStep;
unsigned short MemCnt;
} CARD_RESOURCE;
/* test if the card of type 't' is a plug & play card */
#define IS_PNP(t) \
( \
( \
CardProperties[t].Bus != BUS_ISA \
&& \
CardProperties[t].Bus != BUS_MCA \
) \
|| \
( \
CardProperties[t].Family != FAMILY_S \
&& \
CardProperties[t].Card != CARD_DIVA \
) \
)
/* extract IDI Descriptor info for card type 't' (p == DescType/Features) */
#define IDI_PROP(t,p) (CardProperties[t].p)
#if CARDTYPE_H_WANT_DATA
#if CARDTYPE_H_WANT_IDI_DATA
/* include "di_defs.h" for IDI adapter type and feature flag definitions */
#include "di_defs.h"
#else /*!CARDTYPE_H_WANT_IDI_DATA*/
/* define IDI adapter types and feature flags here to prevent inclusion */
#ifndef IDI_ADAPTER_S
#define IDI_ADAPTER_S 1
#define IDI_ADAPTER_PR 2
#define IDI_ADAPTER_DIVA 3
#define IDI_ADAPTER_MAESTRA 4
#endif
#ifndef DI_VOICE
#define DI_VOICE 0x0 /* obsolete define */
#define DI_FAX3 0x1
#define DI_MODEM 0x2
#define DI_POST 0x4
#define DI_V110 0x8
#define DI_V120 0x10
#define DI_POTS 0x20
#define DI_CODEC 0x40
#endif
#endif /*CARDTYPE_H_WANT_IDI_DATA*/
#define DI_V1x0 (DI_V110 | DI_V120)
#define DI_NULL 0x0000
/*--- CardProperties [Index=CARDTYPE_....] ---------------------------------*/
CARD_PROPERTIES CardProperties [ ] =
{
{ // 0
"DIVA MCA", 0x6336, 0x0100,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3,
CARD_DIVA, CARD_I_NONE, BUS_MCA, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 1
"DIVA ISA", 0x0000, 0x0100,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3,
CARD_DIVA, CARD_I_NONE, BUS_ISA, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 2
"DIVA/PCM", 0x0000, 0x0100,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3,
CARD_DIVA, CARD_I_NONE, BUS_PCM, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 3
"DIVA PRO ISA", 0x0031, 0x0100,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3 | DI_MODEM | DI_CODEC,
CARD_PRO, CARD_I_NONE, BUS_ISA, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 4
"DIVA PRO PC-Card", 0x0000, 0x0100,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3 | DI_MODEM,
CARD_PRO, CARD_I_NONE, BUS_PCM, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 5
"DIVA PICCOLA ISA", 0x0051, 0x0100,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V120,
CARD_PICO, CARD_I_NONE, BUS_ISA, CHIP_HSCX,
1, 2, 0, 8, 0
},
{ // 6
"DIVA PICCOLA PCM", 0x0000, 0x0100,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V120,
CARD_PICO, CARD_I_NONE, BUS_PCM, CHIP_HSCX,
1, 2, 0, 8, 0
},
{ // 7
"DIVA PRO 2.0 S/T PCI", 0xe001, 0x0200,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3 | DI_MODEM | DI_POTS,
CARD_PRO, CARD_I_NONE, BUS_PCI, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 8
"DIVA 2.0 S/T PCI", 0xe002, 0x0200,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V120 | DI_POTS,
CARD_PICO, CARD_I_NONE, BUS_PCI, CHIP_HSCX,
1, 2, 0, 8, 0
},
{ // 9
"QUADRO ISA", 0x0000, 0x0100,
IDI_ADAPTER_S, FAMILY_S, DI_NULL,
CARD_QUAD, CARD_I_QUAD, BUS_ISA, CHIP_NONE,
4, 2, 16, 0, 0x800
},
{ // 10
"S ISA", 0x0000, 0x0100,
IDI_ADAPTER_S, FAMILY_S, DI_CODEC,
CARD_S, CARD_I_S, BUS_ISA, CHIP_NONE,
1, 1, 16, 0, 0x800
},
{ // 11
"S MCA", 0x6a93, 0x0100,
IDI_ADAPTER_S, FAMILY_S, DI_CODEC,
CARD_S, CARD_I_S, BUS_MCA, CHIP_NONE,
1, 1, 16, 16, 0x400
},
{ // 12
"SX ISA", 0x0000, 0x0100,
IDI_ADAPTER_S, FAMILY_S, DI_NULL,
CARD_SX, CARD_I_SX, BUS_ISA, CHIP_NONE,
1, 2, 16, 0, 0x800
},
{ // 13
"SX MCA", 0x6a93, 0x0100,
IDI_ADAPTER_S, FAMILY_S, DI_NULL,
CARD_SX, CARD_I_SX, BUS_MCA, CHIP_NONE,
1, 2, 16, 16, 0x400
},
{ // 14
"SXN ISA", 0x0000, 0x0100,
IDI_ADAPTER_S, FAMILY_S, DI_NULL,
CARD_SXN, CARD_I_SCOM, BUS_ISA, CHIP_NONE,
1, 2, 16, 0, 0x800
},
{ // 15
"SXN MCA", 0x6a93, 0x0100,
IDI_ADAPTER_S, FAMILY_S, DI_NULL,
CARD_SXN, CARD_I_SCOM, BUS_MCA, CHIP_NONE,
1, 2, 16, 16, 0x400
},
{ // 16
"SCOM ISA", 0x0000, 0x0100,
IDI_ADAPTER_S, FAMILY_S, DI_CODEC,
CARD_SCOM, CARD_I_SCOM, BUS_ISA, CHIP_NONE,
1, 2, 16, 0, 0x800
},
{ // 17
"SCOM MCA", 0x6a93, 0x0100,
IDI_ADAPTER_S, FAMILY_S, DI_CODEC,
CARD_SCOM, CARD_I_SCOM, BUS_MCA, CHIP_NONE,
1, 2, 16, 16, 0x400
},
{ // 18
"S2M ISA", 0x0000, 0x0100,
IDI_ADAPTER_PR, FAMILY_S, DI_NULL,
CARD_PR, CARD_I_PR, BUS_ISA, CHIP_NONE,
1, 30, 256, 0, 0x4000
},
{ // 19
"S2M MCA", 0x6abb, 0x0100,
IDI_ADAPTER_PR, FAMILY_S, DI_NULL,
CARD_PR, CARD_I_PR, BUS_MCA, CHIP_NONE,
1, 30, 256, 16, 0x4000
},
{ // 20
"DIVA Server BRI-2M ISA", 0x0041, 0x0100,
IDI_ADAPTER_MAESTRA,FAMILY_MAESTRA, DI_V1x0 | DI_FAX3 | DI_MODEM,
CARD_MAE, CARD_I_NONE, BUS_ISA, CHIP_DSP,
1, 2, 16, 8, 0
},
{ // 21
"DIVA Server BRI-2M PCI", 0xE010, 0x0100,
IDI_ADAPTER_MAESTRA,FAMILY_MAESTRA, DI_V1x0 | DI_FAX3 | DI_MODEM,
CARD_MAE, CARD_I_NONE, BUS_PCI, CHIP_DSP,
1, 2, 16, 8, 0
},
{ // 22
"DIVA Server 4BRI-8M PCI", 0xE012, 0x0100,
IDI_ADAPTER_MAESTRA,FAMILY_MAESTRA, DI_V1x0 | DI_FAX3 | DI_MODEM,
CARD_MAEQ, CARD_I_NONE, BUS_PCI, CHIP_DSP,
4, 2, 16, 8, 0
},
{ // 23
"DIVA Server PRI-30M PCI", 0xE014, 0x0100,
IDI_ADAPTER_MAESTRA,FAMILY_MAESTRA, DI_V1x0 | DI_FAX3 | DI_MODEM,
CARD_MAEP, CARD_I_NONE, BUS_PCI, CHIP_DSP,
1, 30, 256, 8, 0
},
{ // 24
"DIVA Server PRI-2M PCI", 0xe014, 0x0100,
IDI_ADAPTER_MAESTRA,FAMILY_MAESTRA, DI_V1x0 | DI_FAX3 | DI_MODEM,
CARD_MAEP, CARD_I_NONE, BUS_PCI, CHIP_DSP,
1, 30, 256, 8, 0
},
{ // 25
"DIVA Server PRI-9M PCI", 0x0000, 0x0100,
IDI_ADAPTER_MAESTRA,FAMILY_MAESTRA, DI_V1x0 | DI_FAX3 | DI_MODEM,
CARD_MAEP, CARD_I_NONE, BUS_PCI, CHIP_DSP,
1, 30, 256, 8, 0
},
{ // 26
"DIVA 2.0 S/T ISA", 0x0071, 0x0200,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V120 | DI_POTS,
CARD_PICO, CARD_I_NONE, BUS_ISA, CHIP_HSCX,
1, 2, 0, 8, 0
},
{ // 27
"DIVA 2.0 U ISA", 0x0091, 0x0200,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V120 | DI_POTS,
CARD_PICO, CARD_I_NONE, BUS_ISA, CHIP_HSCX,
1, 2, 0, 8, 0
},
{ // 28
"DIVA 2.0 U PCI", 0xe004, 0x0200,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V120 | DI_POTS,
CARD_PICO, CARD_I_NONE, BUS_PCI, CHIP_HSCX,
1, 2, 0, 8, 0
},
{ // 29
"DIVA PRO 2.0 S/T ISA", 0x0061, 0x0200,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3 | DI_MODEM | DI_POTS,
CARD_PRO, CARD_I_NONE, BUS_ISA, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 30
"DIVA PRO 2.0 U ISA", 0x0081, 0x0200,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3 | DI_MODEM | DI_POTS,
CARD_PRO, CARD_I_NONE, BUS_ISA, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 31
"DIVA PRO 2.0 U PCI", 0xe003, 0x0200,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3 | DI_MODEM | DI_POTS,
CARD_PRO, CARD_I_NONE, BUS_PCI, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 32
"DIVA MOBILE", 0x0000, 0x0100,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V120,
CARD_PICO, CARD_I_NONE, BUS_PCM, CHIP_HSCX,
1, 2, 0, 8, 0
},
{ // 33
"TDK DFI3600", 0x0000, 0x0100,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V120,
CARD_PICO, CARD_I_NONE, BUS_PCM, CHIP_HSCX,
1, 2, 0, 8, 0
},
{ // 34 (OEM version of 4 - "DIVA PRO PC-Card")
"New Media ISDN", 0x0000, 0x0100,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3 | DI_MODEM,
CARD_PRO, CARD_I_NONE, BUS_PCM, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 35 (OEM version of 7 - "DIVA PRO 2.0 S/T PCI")
"BT ExLane PCI", 0xe101, 0x0200,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3 | DI_MODEM | DI_POTS,
CARD_PRO, CARD_I_NONE, BUS_PCI, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 36 (OEM version of 29 - "DIVA PRO 2.0 S/T ISA")
"BT ExLane ISA", 0x1061, 0x0200,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V1x0 | DI_FAX3 | DI_MODEM | DI_POTS,
CARD_PRO, CARD_I_NONE, BUS_ISA, CHIP_DSP,
1, 2, 0, 8, 0
},
{ // 37
"DIVA 2.01 S/T ISA", 0x00A1, 0x0300,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V120,
CARD_DIVALOW, CARD_I_NONE, BUS_ISA, CHIP_IPAC,
1, 2, 0, 8, 0
},
{ // 38
"DIVA 2.01 U ISA", 0x00B1, 0x0300,
IDI_ADAPTER_DIVA, FAMILY_DIVA, DI_V120,
CARD_DIVALOW, CARD_I_NONE, BUS_ISA, CHIP_IPAC,
1, 2, 0, 8, 0
},
} ;
/*--- CardResource [Index=CARDTYPE_....] ---------------------------(GEI)-*/
CARD_RESOURCE CardResource [ ] = {
// Interrupts IO-Address Mem-Address
/* 0*/ { 3,4,9,0,0,0,0,0,0,0, 0x200,0x20,16, 0x0,0x0,0 }, // DIVA MCA
/* 1*/ { 3,4,9,10,11,12,0,0,0,0, 0x200,0x20,16, 0x0,0x0,0 }, // DIVA ISA
/* 2*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x8,8192, 0x0,0x0,0 }, // DIVA PCMCIA
/* 3*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // DIVA PRO ISA
/* 4*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x8,8192, 0x0,0x0,0 }, // DIVA PRO PCMCIA
/* 5*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // DIVA PICCOLA ISA
/* 6*/ { 0,0,0,0,0,0,0,0,0,0, 0x0,0x0,0, 0x0,0x0,0 }, // DIVA PICCOLA PCMCIA
/* 7*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x8,8192, 0x0,0x0,0 }, // DIVA PRO 2.0 PCI
/* 8*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x8,8192, 0x0,0x0,0 }, // DIVA 2.0 PCI
/* 9*/ { 3,4,5,7,9,10,11,12,0,0, 0x0,0x0,0, 0x80000,0x2000,64 }, // QUADRO ISA
/*10*/ { 3,4,9,10,11,12,0,0,0,0, 0x0,0x0,0, 0xc0000,0x2000,16 }, // S ISA
/*11*/ { 3,4,9,0,0,0,0,0,0,0, 0xc00,0x10,16, 0xc0000,0x2000,16 }, // S MCA
/*12*/ { 3,4,9,10,11,12,0,0,0,0, 0x0,0x0,0, 0xc0000,0x2000,16 }, // SX ISA
/*13*/ { 3,4,9,0,0,0,0,0,0,0, 0xc00,0x10,16, 0xc0000,0x2000,16 }, // SX MCA
/*14*/ { 3,4,5,7,9,10,11,12,0,0, 0x0,0x0,0, 0x80000,0x0800,256 }, // SXN ISA
/*15*/ { 3,4,9,0,0,0,0,0,0,0, 0xc00,0x10,16, 0xc0000,0x2000,16 }, // SXN MCA
/*16*/ { 3,4,5,7,9,10,11,12,0,0, 0x0,0x0,0, 0x80000,0x0800,256 }, // SCOM ISA
/*17*/ { 3,4,9,0,0,0,0,0,0,0, 0xc00,0x10,16, 0xc0000,0x2000,16 }, // SCOM MCA
/*18*/ { 3,4,5,7,9,10,11,12,0,0, 0x0,0x0,0, 0xc0000,0x4000,16 }, // S2M ISA
/*19*/ { 3,4,9,0,0,0,0,0,0,0, 0xc00,0x10,16, 0xc0000,0x4000,16 }, // S2M MCA
/*20*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // MAESTRA ISA
/*21*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x8,8192, 0x0,0x0,0 }, // MAESTRA PCI
/*22*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // MAESTRA QUADRO ISA
/*23*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x20,2048, 0x0,0x0,0 }, // MAESTRA QUADRO PCI
/*24*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // MAESTRA PRIMARY ISA
/*25*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x8,8192, 0x0,0x0,0 }, // MAESTRA PRIMARY PCI
/*26*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // DIVA 2.0 ISA
/*27*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // DIVA 2.0 /U ISA
/*28*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x8,8192, 0x0,0x0,0 }, // DIVA 2.0 /U PCI
/*29*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // DIVA PRO 2.0 ISA
/*30*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // DIVA PRO 2.0 /U ISA
/*31*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x8,8192, 0x0,0x0,0 }, // DIVA PRO 2.0 /U PCI
/*32*/ { 0,0,0,0,0,0,0,0,0,0, 0x0,0x0,0, 0x0,0x0,0 }, // DIVA MOBILE
/*33*/ { 0,0,0,0,0,0,0,0,0,0, 0x0,0x0,0, 0x0,0x0,0 }, // TDK DFI3600 (same as DIVA MOBILE [32])
/*34*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x8,8192, 0x0,0x0,0 }, // New Media ISDN (same as DIVA PRO PCMCIA [4])
/*35*/ { 3,4,5,7,9,10,11,12,14,15, 0x0,0x8,8192, 0x0,0x0,0 }, // BT ExLane PCI (same as DIVA PRO 2.0 PCI [7])
/*36*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // BT ExLane ISA (same as DIVA PRO 2.0 ISA [29])
/*37*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // DIVA 2.01 S/T ISA
/*38*/ { 3,5,7,9,10,11,12,14,15,0, 0x200,0x20,16, 0x0,0x0,0 }, // DIVA 2.01 U ISA
};
#else /*!CARDTYPE_H_WANT_DATA*/
extern CARD_PROPERTIES CardProperties [] ;
extern CARD_RESOURCE CardResource [] ;
#endif /*CARDTYPE_H_WANT_DATA*/
/*
* all existing download files
*/
#define CARD_PROT_CNT 9
#define CARD_FT_UNKNOWN 0
#define CARD_FT_B 1
#define CARD_FT_D 2
#define CARD_FT_S 3
#define CARD_FT_M 4
#define CARD_FT_NEW_DSP_COMBIFILE 5 /* File format of new DSP code (the DSP code powered by Telindus) */
#define CARD_FILE_NONE 0
#define CARD_B_S 1
#define CARD_B_P 2
#define CARD_D_NEW_DSP_COMBIFILE 3
#define CARD_P_S_E 4
#define CARD_P_S_1 5
#define CARD_P_S_B 6
#define CARD_P_S_F 7
#define CARD_P_S_A 8
#define CARD_P_S_N 9
#define CARD_P_S_5 10
#define CARD_P_S_J 11
#define CARD_P_SX_E 12
#define CARD_P_SX_1 13
#define CARD_P_SX_B 14
#define CARD_P_SX_F 15
#define CARD_P_SX_A 16
#define CARD_P_SX_N 17
#define CARD_P_SX_5 18
#define CARD_P_SX_J 19
#define CARD_P_SY_E 20
#define CARD_P_SY_1 21
#define CARD_P_SY_B 22
#define CARD_P_SY_F 23
#define CARD_P_SY_A 24
#define CARD_P_SY_N 25
#define CARD_P_SY_5 26
#define CARD_P_SY_J 27
#define CARD_P_SQ_E 28
#define CARD_P_SQ_1 29
#define CARD_P_SQ_B 30
#define CARD_P_SQ_F 31
#define CARD_P_SQ_A 32
#define CARD_P_SQ_N 33
#define CARD_P_SQ_5 34
#define CARD_P_SQ_J 35
#define CARD_P_P_E 36
#define CARD_P_P_1 37
#define CARD_P_P_B 38
#define CARD_P_P_F 39
#define CARD_P_P_A 40
#define CARD_P_P_N 41
#define CARD_P_P_5 42
#define CARD_P_P_J 43
#define CARD_P_M_E 44
#define CARD_P_M_1 45
#define CARD_P_M_B 46
#define CARD_P_M_F 47
#define CARD_P_M_A 48
#define CARD_P_M_N 49
#define CARD_P_M_5 50
#define CARD_P_M_J 51
#define CARD_P_S_S 52
#define CARD_P_SX_S 53
#define CARD_P_SY_S 54
#define CARD_P_SQ_S 55
#define CARD_P_P_S 56
#define CARD_P_M_S 57
typedef struct CARD_FILES_DATA
{
char * Name;
unsigned char Type;
}
CARD_FILES_DATA;
typedef struct CARD_FILES
{
unsigned char Boot;
unsigned char Dsp;
unsigned char Prot [CARD_PROT_CNT];
}
CARD_FILES;
#if CARDTYPE_H_WANT_DATA
CARD_FILES_DATA CardFData [] = {
// Filename Filetype
0, CARD_FT_UNKNOWN,
"didnload.bin", CARD_FT_B,
"diprload.bin", CARD_FT_B,
"didspdld.bin", CARD_FT_NEW_DSP_COMBIFILE,
"di_etsi.bin", CARD_FT_S,
"di_1tr6.bin", CARD_FT_S,
"di_belg.bin", CARD_FT_S,
"di_franc.bin", CARD_FT_S,
"di_atel.bin", CARD_FT_S,
"di_ni.bin", CARD_FT_S,
"di_5ess.bin", CARD_FT_S,
"di_japan.bin", CARD_FT_S,
"di_etsi.sx", CARD_FT_S,
"di_1tr6.sx", CARD_FT_S,
"di_belg.sx", CARD_FT_S,
"di_franc.sx", CARD_FT_S,
"di_atel.sx", CARD_FT_S,
"di_ni.sx", CARD_FT_S,
"di_5ess.sx", CARD_FT_S,
"di_japan.sx", CARD_FT_S,
"di_etsi.sy", CARD_FT_S,
"di_1tr6.sy", CARD_FT_S,
"di_belg.sy", CARD_FT_S,
"di_franc.sy", CARD_FT_S,
"di_atel.sy", CARD_FT_S,
"di_ni.sy", CARD_FT_S,
"di_5ess.sy", CARD_FT_S,
"di_japan.sy", CARD_FT_S,
"di_etsi.sq", CARD_FT_S,
"di_1tr6.sq", CARD_FT_S,
"di_belg.sq", CARD_FT_S,
"di_franc.sq", CARD_FT_S,
"di_atel.sq", CARD_FT_S,
"di_ni.sq", CARD_FT_S,
"di_5ess.sq", CARD_FT_S,
"di_japan.sq", CARD_FT_S,
"di_etsi.p", CARD_FT_S,
"di_1tr6.p", CARD_FT_S,
"di_belg.p", CARD_FT_S,
"di_franc.p", CARD_FT_S,
"di_atel.p", CARD_FT_S,
"di_ni.p", CARD_FT_S,
"di_5ess.p", CARD_FT_S,
"di_japan.p", CARD_FT_S,
"di_etsi.sm", CARD_FT_M,
"di_1tr6.sm", CARD_FT_M,
"di_belg.sm", CARD_FT_M,
"di_franc.sm", CARD_FT_M,
"di_atel.sm", CARD_FT_M,
"di_ni.sm", CARD_FT_M,
"di_5ess.sm", CARD_FT_M,
"di_japan.sm", CARD_FT_M,
"di_swed.bin", CARD_FT_S,
"di_swed.sx", CARD_FT_S,
"di_swed.sy", CARD_FT_S,
"di_swed.sq", CARD_FT_S,
"di_swed.p", CARD_FT_S,
"di_swed.sm", CARD_FT_M
};
CARD_FILES CardFiles [] =
{
{ /* CARD_UNKNOWN */
CARD_FILE_NONE,
CARD_FILE_NONE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE
},
{ /* CARD_DIVA */
CARD_FILE_NONE,
CARD_D_NEW_DSP_COMBIFILE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE
},
{ /* CARD_PRO */
CARD_FILE_NONE,
CARD_D_NEW_DSP_COMBIFILE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE
},
{ /* CARD_PICO */
CARD_FILE_NONE,
CARD_FILE_NONE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE
},
{ /* CARD_S */
CARD_B_S,
CARD_FILE_NONE,
CARD_P_S_E, CARD_P_S_1, CARD_P_S_B, CARD_P_S_F,
CARD_P_S_A, CARD_P_S_N, CARD_P_S_5, CARD_P_S_J,
CARD_P_S_S
},
{ /* CARD_SX */
CARD_B_S,
CARD_FILE_NONE,
CARD_P_SX_E, CARD_P_SX_1, CARD_P_SX_B, CARD_P_SX_F,
CARD_P_SX_A, CARD_P_SX_N, CARD_P_SX_5, CARD_P_SX_J,
CARD_P_SX_S
},
{ /* CARD_SXN */
CARD_B_S,
CARD_FILE_NONE,
CARD_P_SY_E, CARD_P_SY_1, CARD_P_SY_B, CARD_P_SY_F,
CARD_P_SY_A, CARD_P_SY_N, CARD_P_SY_5, CARD_P_SY_J,
CARD_P_SY_S
},
{ /* CARD_SCOM */
CARD_B_S,
CARD_FILE_NONE,
CARD_P_SY_E, CARD_P_SY_1, CARD_P_SY_B, CARD_P_SY_F,
CARD_P_SY_A, CARD_P_SY_N, CARD_P_SY_5, CARD_P_SY_J,
CARD_P_SY_S
},
{ /* CARD_QUAD */
CARD_B_S,
CARD_FILE_NONE,
CARD_P_SQ_E, CARD_P_SQ_1, CARD_P_SQ_B, CARD_P_SQ_F,
CARD_P_SQ_A, CARD_P_SQ_N, CARD_P_SQ_5, CARD_P_SQ_J,
CARD_P_SQ_S
},
{ /* CARD_PR */
CARD_B_P,
CARD_FILE_NONE,
CARD_P_P_E, CARD_P_P_1, CARD_P_P_B, CARD_P_P_F,
CARD_P_P_A, CARD_P_P_N, CARD_P_P_5, CARD_P_P_J,
CARD_P_P_S
},
{ /* CARD_MAE */
CARD_FILE_NONE,
CARD_D_NEW_DSP_COMBIFILE,
CARD_P_M_E, CARD_P_M_1, CARD_P_M_B, CARD_P_M_F,
CARD_P_M_A, CARD_P_M_N, CARD_P_M_5, CARD_P_M_J,
CARD_P_M_S
},
{ /* CARD_MAEQ */ /* currently not supported */
CARD_FILE_NONE,
CARD_FILE_NONE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE
},
{ /* CARD_MAEP */ /* currently not supported */
CARD_FILE_NONE,
CARD_FILE_NONE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE, CARD_FILE_NONE,
CARD_FILE_NONE
}
};
#else /*!CARDTYPE_H_WANT_DATA*/
extern CARD_FILES_DATA CardFData [] ;
extern CARD_FILES CardFiles [] ;
#endif /*CARDTYPE_H_WANT_DATA*/
#endif /* _CARDTYPE_H_ */

157
eicon/divautil/cau_1tr6.h Normal file
View File

@ -0,0 +1,157 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.0
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
static char * cau_1tr6[] = {
"0",
"Invalid call reference",
"2",
"Bearer service not implemented",
"4",
"5",
"Channel unacceptable",
"Call identity does not exist",
"Call identity in use",
"9",
"No channel available",
"11",
"12",
"13",
"14",
"15",
"Requested facility not implemented",
"Requested facility not subscribed",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"Outgoing call barred",
"User access busy",
"Wrong closed user group",
"35",
"36",
"Semipermanent connection not allowed",
"38",
"39",
"40",
"41",
"42",
"43",
"44",
"45",
"46",
"47",
"Reverse charging not allowed at originating end",
"49",
"50",
"51",
"52",
"Destination not obtainable",
"54",
"55",
"Number changed",
"Out of order",
"No User responding",
"User busy",
"60",
"Incoming calls barred",
"Call rejected",
"63",
"64",
"65",
"66",
"67",
"68",
"69",
"70",
"71",
"72",
"73",
"74",
"75",
"76",
"77",
"78",
"79",
"80",
"81",
"82",
"83",
"84",
"85",
"86",
"87",
"Incompatible destination",
"Network congestion",
"Remote user initiated",
"91",
"92",
"93",
"94",
"95",
"96",
"97",
"98",
"99",
"100",
"101",
"102",
"103",
"104",
"105",
"106",
"107",
"108",
"109",
"110",
"111",
"Local procedure error",
"Remote procedure error",
"Remote user suspended",
"Remote user resumed",
"116",
"117",
"118",
"119",
"120",
"121",
"122",
"123",
"124",
"125",
"126",
"User info discarded locally"
};

157
eicon/divautil/cau_q931.h Normal file
View File

@ -0,0 +1,157 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.0
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
static char * cau_q931[] = {
"0",
"Unallocated (unassigned) number",
"No route to specified transit network",
"No route to destination",
"4",
"5",
"Channel unacceptable",
"Call awarded and being deliverd in an established channel",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"Normal call clearing",
"User busy",
"No user responding",
"No answer from user (user alerted)",
"20",
"Call rejected",
"Number changed",
"23",
"24",
"25",
"Non-selected user clearing",
"Destination out of order",
"Invalid number format",
"Facility rejected",
"Response to STATUS ENQUIRY",
"Normal, unspecified",
"32",
"33",
"No circuit/channel available",
"35",
"36",
"37",
"Network out of order",
"39",
"40",
"Temporary failure",
"Switching equipment congestion",
"Access information discarded",
"Requested circuit/channel not available",
"45",
"46",
"Resources unavailable, unspecified",
"48",
"Quality of service unavailable",
"Requested facility not subscribed",
"51",
"52",
"53",
"54",
"55",
"56",
"Bearer capability not authorized",
"Bearer capabliity not presently available",
"59",
"60",
"61",
"62",
"Service or option not available, unspecified",
"64",
"Bearer capability not implemented",
"Channel type not implemented",
"67",
"68",
"Requested facility not implemented",
"Only restricted digital information bearer capability is available",
"71",
"72",
"73",
"74",
"75",
"76",
"77",
"78",
"Service or option not implemented, unspecified",
"80",
"Invalid call reference value",
"Identified channel does not exist",
"A suspended call exists, but this call identity does not",
"Call identity in use",
"No call suspended",
"Call having the requested call identity has been cleared",
"87",
"Incompatible destination",
"89",
"90",
"Invalid transit network selection",
"92",
"93",
"94",
"Invalid message, unspecified",
"Mandatory information element is missing",
"Message type non-existent or not implemented",
"Message not compatible with call state or not implemented",
"Information element non-existent or not implemented",
"Invalid information element contents",
"Message not compatible with call state",
"Recovery on timer expiry",
"103",
"104",
"105",
"106",
"107",
"108",
"109",
"110",
"Protocol error, unspecified",
"112",
"113",
"114",
"115",
"116",
"117",
"118",
"119",
"120",
"121",
"122",
"123",
"124",
"125",
"126",
"Internetworking, unspecified"
};

61
eicon/divautil/diload.h Normal file
View File

@ -0,0 +1,61 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.1
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Internal include file for Diva card library
*/
#if !defined(DILOAD_H)
#define DILOAD_H
int DivaLoad( char **dsp_names,parameter_t *options, char *msg);
/* define IOCTL commands */
#define DI_START_LOAD (90)
#define DI_TASK (91)
#define DI_END_LOAD (92)
#define DI_PARAMS (93)
/* define return codes for errors. */
#define ERR_ETDD_OK 0
#define ERR_ETDD_ACCESS 1
#define ERR_ETDD_DSP 2
#define ERR_ETDD_IOCTL 3
#define ERR_ETDD_NOMEM 4
#define ERR_ETDD_OPEN 5
#define ERR_ETDD_READ 6
/* define type for holding DSP code */
typedef struct
{
word size; /* length of buffer */
char *buffer; /* buffer holding DSP code */
} di_load_t;
#endif /* of DILOAD_H */

40
eicon/divautil/diva.h Normal file
View File

@ -0,0 +1,40 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.1
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Include file for Diva card library
*/
#if !defined(DIVA_H)
#define DIVA_H
/* load DSP code onto Diva card */
extern
int DivaLoad(char **buffer, parameter_t *options, char *msg);
#endif /* of DIVA_H */

490
eicon/divautil/divalog.c Normal file
View File

@ -0,0 +1,490 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.3
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Source file for Unix kernel logger client program
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <signal.h>
#include <memory.h>
#include <poll.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include "sys.h"
#include "divalog.h"
#include "loglib.h"
static
int terminating = FALSE; /* are we finishing ? */
static
int send_close = TRUE; /* should we send a close message ? */
static
klog_msg_t message; /* message to server */
static
int read_fd = -1; /* our read pointer */
static
int server_fd = -1; /* server's command file descriptor */
static
uint_t active_logs = DIVAS_LOG_DEBUG; /* our active logs */
static
uint_t active_card = 0; /* active card */
extern void log_idi_req(FILE *stream, void * buf);
extern void log_idi_cb(FILE *stream, void * buf);
/*
* Send server a message
*/
static
int SendServerMessage( int fd,
klog_msg_t *msg)
{
int size;
/* write to specified file descriptor */
if ((size = write(fd, msg, sizeof(klog_msg_t))) != sizeof(klog_msg_t))
{
if (size < 0)
{
perror("divalog: write to server");
}
else
{
fprintf(stderr, "divalog: bad size on write to server");
}
return(1);
}
return(0);
}
/*
* Finish up
*/
static
void Terminate(int dummy)
{
if (terminating)
{
return;
}
terminating = TRUE;
/* tell server we're gone if required */
if (send_close)
{
message.request = KLOG_CLOSE_CLIENT;
(void) SendServerMessage(server_fd, &message);
}
close(read_fd);
/* delete our own connection */
DeleteClient(message.buffer);
exit(0);
return;
}
/*
* Set up a signal catcher for all signals to terminate gracefully
*/
static
void InitialiseSignalCatcher(void)
{
struct sigaction act;
int i;
memset(&act, 0, sizeof(struct sigaction));
act.sa_handler = Terminate;
sigemptyset(&act.sa_mask);
for (i = 0; i < NSIG; i++)
{
(void) sigaction(i, &act, NULL);
}
return;
}
/*
* Read the next entry from the log:
*/
static
int ReadLog(int fd,
clog_t *entry)
{
int size;
/* get the entry from the log */
if ((size = read(fd, entry, sizeof(clog_t))) != sizeof(clog_t))
{
if (size < 0)
{
perror("divalog: read from server");
}
else
{
fprintf(stderr, "divalog: bad size on read from server");
}
return(1);
}
return(0);
}
/*
* parse string into card number
* return non-zero if error
*/
static
int parse_card_id(char *arg, uint_t *card_id)
{
char *a = arg;
while (*a)
{
if (!isdigit(*a))
{
return -1;
}
a++;
}
*card_id = atoi(arg);
if ((*card_id < 1) || ( *card_id > 16 ))
{
return -1;
}
return 0;
}
/*
* Tell user how to use the program
*/
void usage(void)
{
fprintf(stderr, "usage: divalog [-a N] [-z] [[-w] | [-f file] [-x] [-c] [-i]\n");
fprintf(stderr, " -a N to specify adapter number (N defaults to 1)\n");
fprintf(stderr, " -z to clear log of all entries\n");
fprintf(stderr, " -w to wait for entries to be logged\n");
fprintf(stderr, " -f file to log to specified file\n");
fprintf(stderr, " -x read ISDN trace\n");
fprintf(stderr, " -c read CAPI trace\n");
fprintf(stderr, " -i read IDI trace\n");
return;
}
/*
* display single entry
*/
static
void display_prefix(FILE *fp, int card_id, unsigned int ms)
{
unsigned int sec, min, hour;
sec = ms / 1000;
ms %= 1000;
min = (sec / 60) % 60;
sec %= 60;
hour = min / 60;
if (card_id == -1)
{
fprintf(fp, " ");
}
else
{
fprintf(fp, "%d ", card_id + 1);
}
fprintf(fp, "%3d:%02d:%02d.%03d ", hour, min, sec, ms);
return;
}
/*
* display single entry
*/
static
void display_entry(FILE *fp, clog_t *e)
{
unsigned int ms, sec, min, hour;
ms = e->data.time_stamp;
sec = ms / 1000;
ms %= 1000;
min = (sec / 60) % 60;
sec %= 60;
hour = min / 60;
if ((e->data.card != -1)
&& (e->data.card != active_card))
{
return;
}
switch (e->data.type)
{
case (KLOG_TEXT_MSG):
if (active_logs & DIVAS_LOG_DEBUG)
{
display_prefix(fp, e->data.card, e->data.time_stamp);
fprintf(fp, "%s\n", e->data.buffer);
break;
}
case (KLOG_XTXT_MSG):
if (active_logs & DIVAS_LOG_XLOG)
{
display_prefix(fp, e->data.card, e->data.time_stamp);
fprintf(fp, "%s\n", e->data.buffer);
}
break;
case (KLOG_IDI_REQ):
if (active_logs & DIVAS_LOG_IDI)
{
display_prefix(fp, e->data.card, e->data.time_stamp);
fprintf(fp, "IDI ");
log_idi_req(fp, e->data.buffer);
}
break;
case (KLOG_IDI_CALLBACK):
if (active_logs & DIVAS_LOG_IDI)
{
display_prefix(fp, e->data.card, e->data.time_stamp);
fprintf(fp, "IDI ");
log_idi_cb(fp, e->data.buffer);
}
break;
case (KLOG_XLOG_MSG):
if (active_logs & DIVAS_LOG_XLOG)
{
int j; char xlogb[120];
char *xp = xlogb; unsigned short code;
unsigned short *code_p = (unsigned short *) xp;
code = (unsigned short) e->data.code;
*code_p = code;
xp += sizeof(unsigned short);
for (j = 0; j < (int) e->data.length; j++)
{
*xp++ = e->data.buffer[j];
}
display_prefix(fp, e->data.card, e->data.time_stamp);
xlog(fp, (char *) &e->data.code,
e->data.length + sizeof(word));
}
break;
default:
display_prefix(fp, e->data.card, e->data.time_stamp);
fprintf(fp, "UNKNOWN LOG MESSAGE TYPE (%d) of length (%d)\n",
(int) e->data.type, (int) e->data.length);
break;
}
fflush(fp);
return;
}
/*
* start here
*/
int main(int argc, char *argv[])
{
FILE *fp = stdout;
clog_t entry;
char *file_name = NULL;
int c;
bool_t reset_log = FALSE;
/* by default, finish when we've seen all log entries */
message.flags = KLOG_TELL_WHEN_EMPTY;
opterr = 0;
while ((c = getopt(argc, argv, "hwzxcif:a:")) != -1)
{
switch (c)
{
case 'h':
usage();
return(0);
break;
case 'f':
if (!message.flags)
{
fprintf(stderr, "divalog: invalid combination of options\n");
usage();
return(1);
}
file_name = optarg;
break;
case 'a':
if (parse_card_id(optarg, &active_card))
{
fprintf(stderr, "divalog: invalid adapter number\n");
usage();
return(1);
}
active_card--;
break;
case 'w':
if (file_name)
{
fprintf(stderr, "divalog: invalid combination of options\n");
usage();
return(1);
}
message.flags = 0; /* keep reading for ever */
break;
case 'z':
reset_log = TRUE;
break;
case 'x':
active_logs |= DIVAS_LOG_XLOG;
break;
case 'i':
active_logs |= DIVAS_LOG_IDI;
break;
case 'c':
active_logs |= DIVAS_LOG_CAPI;
break;
default:
fprintf(stderr, "divalog: invalid command line option\n");
usage();
return(1);
break;
}
}
if (file_name)
{
if (!(fp = fopen(file_name, "w")))
{
fprintf(stderr, "divalog: unable to open file \"%s\"\n", file_name);
return(2);
}
}
if (reset_log)
{
message.flags |= KLOG_RESET_LOG;
}
/* open the server's file descriptor */
if (OpenServer(&server_fd))
{
return(1);
}
/* generate a name for ourselves and open our connection to server */
CreateClientName(message.buffer);
if (OpenClient(message.buffer, &read_fd))
{
return(1);
}
/* tell server we're here */
message.request = KLOG_OPEN_CLIENT;
message.logs = active_logs;
message.card_id = active_card;
if (SendServerMessage(server_fd, &message))
{
return(1);
}
InitialiseSignalCatcher();
while (!ReadLog(read_fd, &entry))
{
if (entry.data.time_stamp || entry.data.buffer[0])
{
display_entry(fp, &entry);
}
if (entry.flags & KLOG_NO_MORE_LOG)
{
send_close = FALSE;
Terminate(0);
}
}
return(0);
}

View File

@ -0,0 +1,741 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.3
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Source file for Unix kernel logger daemon process
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <memory.h>
#include <sys/ioctl.h>
#include <poll.h>
#include <unistd.h>
#include <string.h>
#include "divas.h"
#include "divalog.h"
#include "loglib.h"
#include "linuxcfg.h"
/* define two poll rates for XLOG both measures in milliseconds */
#define SLOW_POLL (5000) /* no client is displaying XLOG */
#define FAST_POLL (100) /* client actively displaying XLOG */
/* max number of clients supported */
#define MAX_CLIENTS (10)
/*
* define a type for holding information about each client
*/
typedef struct
{
char name[80]; /* name of client */
int fd; /* file descriptor */
int read_ptr; /* read pointer in log */
uint_t flags; /* additional information (see above) */
uint_t logs; /* active logs */
uint_t card_id; /* card being logged */
uint_t discarded; /* number of entries discarded */
} klog_client_t;
/* number of log entries buffered */
#define MIN_NUM_ENTRIES (10)
#define DEFAULT_NUM_ENTRIES (1024)
#define MAX_NUM_ENTRIES (100000)
static
int num_entries = DEFAULT_NUM_ENTRIES;
static
klog_client_t client[MAX_CLIENTS]; /* data structure for each client */
static
int server_fd = -1; /* server's command file descriptor */
static
int log_fd = -1; /* klog device */
static
klog_t *log = NULL; /* log buffer */
static
int write_ptr = 0; /* write pointer into log buffer */
static
int oldest_ptr = 0; /* oldest entry in log buffer */
static
int timeout = SLOW_POLL; /* poll timeout - slow by default */
/*
* update poll timer, depening on whether anyone looking for XLOG
*/
static
void update_xlog_requests(void)
{
int i;
timeout = SLOW_POLL;
for (i = 0; i < MAX_CLIENTS; i++)
{
if ((client[i].fd != -1) && (client[i].logs & DIVAS_LOG_XLOG))
{
timeout = FAST_POLL;
break;
}
}
return;
}
/*
* Function to close client
*/
void close_client( klog_client_t *client,
clog_t *message)
{
if (message)
{
message->flags = KLOG_NO_MORE_LOG;
(void) write(client->fd, message, sizeof(clog_t));
}
/* clear this client's information and close our end of the FIFO */
close(client->fd);
memset(client, 0, sizeof(klog_client_t));
client->fd = -1;
update_xlog_requests();
return;
}
/*
* send a request down to specified card, looking for xlog
*/
static
void req_xlog(int card_num)
{
if (ioctl(log_fd, DIA_IOCTL_XLOG_REQ, &card_num) == -1)
{
perror("divalogd: error in log device");
}
return;
}
/*
* tell driver which cards and log types we're interested in
*/
static
void req_xlogs(void)
{
int i;
for (i = 0; i < MAX_CLIENTS; i++)
{
if ((client[i].fd != -1) && (client[i].logs & DIVAS_LOG_XLOG))
{
req_xlog(client[i].card_id);
}
}
return;
}
/*
* Handle log event
*/
int HandleLogEvent(int fd)
{
int n;
int i;
klog_t *k;
k = &log[write_ptr];
if ((n = read(fd, k, sizeof(klog_t))) != sizeof(klog_t))
{
if (n < 0)
{
perror("divalogd: server message read");
}
else
{
fprintf(stderr,
"divalogd: bad size (%d) on server message read", n);
}
return(1);
}
/* if we just read an XLOG message, send request for next one */
if ((k->type == KLOG_XLOG_MSG) || (k->type == KLOG_XTXT_MSG))
{
req_xlog(k->card);
}
/* update write pointer */
write_ptr++;
write_ptr %= num_entries;
/* see if we have to bump the pointer to the oldest log entry */
if (write_ptr == oldest_ptr)
{
oldest_ptr++;
oldest_ptr %= num_entries;
}
/* check to see if we have to bump any client readers */
for (i = 0; i < MAX_CLIENTS; i++)
{
if ((client[i].fd != -1) && (write_ptr == client[i].read_ptr))
{
client[i].read_ptr++;
client[i].read_ptr %= num_entries;
client[i].discarded++;
}
}
return(0);
}
/*
* tell driver which cards and log types we're interested in
*/
static
int update_active_logs(void)
{
int i;
dia_log_t logs;
/* tell driver we're interested in logging */
for (i = 0; i < MAX_CLIENTS; i++)
{
if (client[i].fd != -1)
{
logs.card_id = client[i].card_id;
logs.log_types = client[i].logs;
if (ioctl(log_fd, DIA_IOCTL_LOG, &logs) == -1)
{
perror("divalogd: error in log device");
return -1;
}
}
}
return 0;
}
/*
* Handle server event: a client has sent us a message
*/
int HandleServerEvent(int fd)
{
klog_msg_t message; /* message from client */
int i; /* handly scratch counter */
int size; /* size of information read */
/* get the client message */
if ((size = read(fd, &message, sizeof(klog_msg_t))) != sizeof(klog_msg_t))
{
if (size < 0)
{
perror("divalogd: server message read");
}
else
{
fprintf(stderr, "divalogd: bad size on server message read");
}
return(1);
}
switch (message.request)
{
case (KLOG_OPEN_CLIENT) :
/* look for an empty client slot */
for (i = 0; i < MAX_CLIENTS; i++)
{
if (client[i].fd == -1)
{
break;
}
}
if (i == MAX_CLIENTS)
{
fprintf(stderr, "divalogd: too many clients\n");
break;
}
if (OpenClient(message.buffer, &client[i].fd))
{
fprintf(stderr, "divalogd: error in opening client %s\n",
message.buffer);
break;
}
/* set the client read pointer to oldest entry in the buffer */
if (message.flags & KLOG_RESET_LOG)
{
int j;
write_ptr = oldest_ptr = 0;
for (j = 0; j < MAX_CLIENTS; j++)
{
client[j].read_ptr = 0;
}
}
else
{
client[i].read_ptr = oldest_ptr;
}
/* save client's name and the request flags */
strcpy(client[i].name, message.buffer);
client[i].flags = message.flags;
client[i].card_id = message.card_id;
client[i].logs = message.logs;
client[i].discarded = FALSE;
/*
* after all that, if log is empty and client has requested
* notification, close the client
*/
if ((oldest_ptr == write_ptr) &&
(message.flags & KLOG_TELL_WHEN_EMPTY))
{
clog_t client_msg;
client_msg.flags = KLOG_NO_MORE_LOG;
client_msg.data.time_stamp = 0;
client_msg.data.buffer[0] = '\0';
close_client(&client[i], &client_msg);
}
else
{
update_active_logs();
update_xlog_requests();
}
break;
case (KLOG_CLOSE_CLIENT) :
for (i = 0; i < MAX_CLIENTS; i++)
{
if (!(strcmp(client[i].name, message.buffer)))
{
break;
}
}
if (i == MAX_CLIENTS)
{
fprintf(stderr, "divalogd: client %s not found for close\n",
message.buffer);
break;
}
close_client(&client[i], NULL);
break;
default :
fprintf(stderr, "divalogd: unknown client request %d\n", message.request);
break;
}
return(0);
}
/*
* Tell client that we've discarded one or more entries
*/
static
int tell_client_discarded(klog_client_t *client)
{
static
char buffer[80];
int size;
clog_t entry;
/* fill in a dummy entry tellinmg client we've discarded entries */
sprintf(buffer, "WARNING ! divalog buffer overflow - %d %s discarded",
client->discarded, (client->discarded == 1) ? "entry" : "entries");
client->discarded = 0;
entry.flags = 0;
entry.data.time_stamp = 0;
entry.data.type = KLOG_TEXT_MSG;
entry.data.length = strlen(buffer);
entry.data.code = 0;
strcpy(entry.data.buffer, buffer);
if ((size = write(client->fd, &entry,sizeof(clog_t))) != sizeof(clog_t))
{
if (size < 0)
{
perror("divalogd: write to client");
}
else
{
fprintf(stderr, "divalogd: bad size on write to client");
}
return(1);
}
return(0);
}
/*
* Handle client event: a client is ready to accept data
*/
int HandleClientEvent(klog_client_t *client)
{
int size;
clog_t entry;
if (client->discarded)
{
return(tell_client_discarded(client));
}
if (client->read_ptr != write_ptr)
{
/* write next entry to client */
memcpy(&entry.data, &log[client->read_ptr], sizeof(klog_t));
client->read_ptr++;
client->read_ptr %= num_entries;
if ((client->read_ptr == write_ptr)
&& (client->flags & KLOG_TELL_WHEN_EMPTY))
{
entry.flags = KLOG_NO_MORE_LOG;
}
else
{
entry.flags = 0;
}
if ((size = write(client->fd, &entry,sizeof(clog_t))) != sizeof(clog_t))
{
if (size < 0)
{
perror("divalogd: write to client");
}
else
{
fprintf(stderr, "divalogd: bad size on write to client");
}
return(1);
}
/* if we're closing the client, go and do it */
if (entry.flags)
{
close_client(client, NULL);
}
}
return(0);
}
/*
* Wait for an event to happen
*/
int WaitEvent(void)
{
struct pollfd fds[MAX_CLIENTS + 2]; /* list of file descriptor info */
unsigned long nfds = 2; /* number of files of interest */
int n; /* number of files active */
int i, j; /* handy scratch counters */
/* set up the poll array */
memset(fds, 0, sizeof(fds));
/* we're interested in reading from server command or klog files */
fds[0].fd = log_fd;
fds[0].events = POLLIN;
fds[1].fd = server_fd;
fds[1].events = POLLIN;
while (TRUE)
{
/* if any client is not up to date then make sure we service it */
nfds = 0;
for (i = 0; i < MAX_CLIENTS; i++)
{
if ((client[i].fd != -1) && (client[i].read_ptr != write_ptr))
{
fds[2 + nfds].fd = client[i].fd;
fds[2 + nfds].events = POLLOUT;
nfds++;
}
}
nfds += 2; /* we always have server and log to service */
if ((n = poll(fds, nfds, timeout)) < 0)
{
perror("divalogd: poll");
return(1);
}
if (n == 0)
{
req_xlogs();
continue;
}
/* check log device */
if (fds[0].revents & POLLIN)
{
if (HandleLogEvent(fds[0].fd))
{
return(1);
}
}
/* check for server command */
if (fds[1].revents & POLLIN)
{
if (HandleServerEvent(fds[1].fd))
{
return(1);
}
}
/* check for clients that are ready to receive and aren't up to date */
for (i = 2; i < (int) nfds; i++)
{
if (fds[i].revents & POLLOUT)
{
/* find the client owning this file descriptor */
for (j = 0; j < MAX_CLIENTS; j++)
{
if (client[j].fd == fds[i].fd)
{
if (HandleClientEvent(&client[j]))
{
return(1);
}
}
}
}
}
}
}
/*
* Display usage of command line
*/
static
void usage(void)
{
fprintf(stderr, "usage: divalogd [num_entries]\n");
fprintf(stderr,
" where num_entries is the number of entries to buffer\n");
fprintf(stderr, " num_entries must be between %d and %d\n",
MIN_NUM_ENTRIES, MAX_NUM_ENTRIES);
return;
}
/*
* Load the number of entries
*/
void get_num_entries(char *argv[])
{
int i;
num_entries = 0;
i = 0;
while ((i < 10) && (argv[1][i]))
{
if (!strcmp(argv[1], "-h"))
{
usage();
exit(1);
}
if ((argv[1][i] < '0') || (argv[1][i] > '9'))
{
usage();
fprintf(stderr, "divalogd: non-numeric number of entries\n");
exit(1);
}
num_entries = (num_entries * 10) + ((int) argv[1][i] - '0');
i++;
}
if ((i == 10) ||
(num_entries < MIN_NUM_ENTRIES) || (num_entries > MAX_NUM_ENTRIES))
{
usage();
fprintf(stderr,
"divalogd: invalid number of entries\n");
exit(1);
}
return;
}
/*
* start here
*/
int main(int argc, char *argv[])
{
int i;
dia_log_t active_logs;
if (!((argc == 1) || (argc == 2)))
{
usage();
fprintf(stderr, "divalogd: invalid command line\n");
exit(1);
}
if (argc == 2)
{
get_num_entries(argv);
}
/* get a buffer for the log entries */
if (!(log = malloc(num_entries * sizeof(klog_t))))
{
fprintf(stderr, "divalogd: memory allocation failure\n");
exit(1);
}
/* open the driver */
if ((log_fd = open(DIVAS_DEVICE, O_RDONLY)) == -1)
{
perror("divalogd: open of log device");
return 1;
}
/* tell driver we're interested in logging */
active_logs.card_id = 0;
active_logs.log_types = DIVAS_LOG_DEBUG;
if (ioctl(log_fd, DIA_IOCTL_LOG, &active_logs) == -1)
{
perror("divalogd: error in log device");
return 1;
}
/* open the server's (our) file descriptor */
if (OpenServer(&server_fd))
{
return(1);
}
/* initialise client information */
for (i = 0; i < MAX_CLIENTS; i++)
{
client[i].fd = -1;
}
/* wait for something to happen */
if (WaitEvent())
{
return(1);
}
return(0);
}

173
eicon/divautil/idilog.c Normal file
View File

@ -0,0 +1,173 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.2
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <stdio.h>
#include <string.h>
#include "idi.h"
#include "pc.h"
typedef struct
{
int value;
char *name;
} map_t;
static
map_t global_id_name [] =
{
{ 0, "?????" },
{ GL_ERR_ID, "ERR " },
{ DSIG_ID, "D-SIG" },
{ NL_ID, "NL " },
{ BLLC_ID, "B-LLC" },
{ TASK_ID, "TASK " },
{ TIMER_ID, "TIMER" },
{ TEL_ID, "TEL " },
{ MAN_ID, "MGMT " },
{ 0, NULL }
};
static
map_t rc_name [] =
{
{ 0, "?????" },
{ UNKNOWN_COMMAND, "unknown command " },
{ WRONG_COMMAND, "wrong command " },
{ WRONG_ID, "unknown id " },
{ WRONG_CH, "wrong channel " },
{ UNKNOWN_IE, "unknown IE " },
{ WRONG_IE, "wrong IE " },
{ OUT_OF_RESOURCES, "out of resources " },
{ ADAPTER_DEAD, "adapter dead " },
{ N_FLOW_CONTROL, "n-flow control " },
{ ASSIGN_RC, "assign ack " },
{ ASSIGN_OK, "assign O.K. " },
{ OK_FC, "flow control O.K. " },
{ READY_INT, "ready interrupt " },
{ TIMER_INT, "timer interrupt " },
{ OK, "O.K. " },
{ 0, NULL }
};
/*
* Map integer value to associated string
*/
static
char *map_int(int val, map_t *table)
{
static map_t *t;
t = table;
t++;
while (t->name)
{
if (t->value == val)
{
break;
}
t++;
}
if (!t->name)
{
t = table;
}
return(t->name);
}
/*
* display ID name or value
*/
static
void display_id(FILE *fp, int id)
{
char *s;
s = map_int(id, global_id_name);
if (*s != '?')
{
fprintf(fp, "%s ", s);
}
else
{
fprintf(fp, " %02x ", id);
}
return;
}
void log_idi_req(FILE *fp, void * buf)
{
ENTITY *e = buf;
fprintf(fp, "req %04x.%04x ", e->user[0] & 0xffff, e->user[1] & 0xffff);
display_id(fp, (int) e->Id & 0xff);
fprintf(fp, "REQ: %02x\n", e->Req & 0xff);
return;
}
void log_idi_cb(FILE *fp, void * buf)
{
ENTITY *e = buf;
fprintf(fp, "%s %04x.%04x ", e->Rc ? " rc" : "ind",
e->user[0] & 0xffff, e->user[1] & 0xffff);
display_id(fp, (int) e->Id & 0xff);
if ((e->Rc) && (e->Ind))
{
fprintf(fp, "ERRROR - both Rc (%02x) and Ind (%02x) set !\n",
e->Rc & 0xff, e->Ind & 0xff);
}
else
{
if (e->Rc)
{
fprintf(fp, "%s\n", map_int((int) e->Rc & 0xff, rc_name));
}
if (e->Ind)
{
fprintf(fp, "IND: %02x\n", e->Ind & 0xff);
}
}
return;
}

837
eicon/divautil/lindiload.c Normal file
View File

@ -0,0 +1,837 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.10
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <memory.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include "sys.h"
#include "pc_maint.h"
#include "divas.h"
#include "load.h"
#include "diva.h"
#include "diload.h"
#include "linuxcfg.h"
byte read_dec(char *str,word *val);
byte read_hex(char *str,dword *val);
byte check_oa(char *str);
byte check_osa(char *str);
byte check_spid(char *str);
void usage(char *name);
dia_config_t options;
dia_card_t card;
int load_all_cards = FALSE;
int card_idl;
byte cards[20], num_cards;
byte new_cards[20], new_num_cards = 0;
byte real_card_id[20];
byte flavours[20];
char OSA[8][MAX_ADDR];
char OAD[8][MAX_ADDR];
char SPID[8][MAX_SPID];
char *flavour_str[] = {
"etsi",
"ni",
"5ess",
"1tr6",
"franc",
"japan" };
int DivaALoad(char *dsp_name, dia_config_t *options, dia_card_t *card, char *msg , int adapter_instance);
static char *card_desc[] = {"DIVA Server PRI",
"DIVA Server BRI",
"DIVA Server 4-BRI"};
int main( int argc, char *argv[] )
{
int rc=0;
char ret_msg[80];
char disp_msg[80];
int i,opt;
byte stablel2;
word tei=0xff, channel_no=0, adapter_no=0;
char c;
int dev_id = 0;
byte card_i;
char afname[10] = "";
byte byId;
byte *pParamStr, *pOAD, *pOSA, *pSPID;
dia_card_list_t *card_list;
argc=0;
opt=1;
bzero(&options, sizeof(dia_config_t));
bzero(&card, sizeof(dia_card_t));
printf("divaload: Firmware loader for Eicon DIVA Server ISDN adapters\n");
if ((dev_id = open(DIVAS_DEVICE, O_RDONLY, 0)) == -1)
{
fprintf(stderr, "Couldn't open %s\n", DIVAS_DEVICE);
return 1;
}
if((rc = ioctl(dev_id, DIA_IOCTL_DETECT, &cards)) == -1)
{
fprintf(stderr, "%s DETECT Error %d\n", DIVAS_DEVICE, rc);
(void)close(dev_id);
return 1;
}
card_list = calloc(cards[0], sizeof(dia_card_list_t));
if((rc = ioctl(dev_id, DIA_IOCTL_GET_LIST, card_list)) == -1)
{
fprintf(stderr, "%s COUNT Error %d\n", DIVAS_DEVICE, rc);
(void)close(dev_id);
return 1;
}
close(dev_id);
num_cards = cards[0];
{
int i;
for (i=1; i<=num_cards;)
{
new_cards[new_num_cards+1] = cards[i];
real_card_id[new_num_cards+1] = i-1;
if (cards[i] == 2) // 4BRI
{
i+=3;
}
new_num_cards++;
i++;
}
}
num_cards = new_num_cards;
if (num_cards)
{
printf("divaload: %d %s found\n", num_cards,
num_cards > 1 ? "adapters" : "adapter");
}
else
{
printf("divaload: no adapters found\n");
}
while( argv[opt] )
{
if( argv[opt][0]=='-')
{
c=argv[opt][1];
opt++;
if(c>='A' && c<='Z')
{
c+='a'-'A';
}
switch(c)
{
case '1':
case '2':
case '3': // For 4BRI
case '4':
case '5':
case '6':
case '7':
case '8':
byId = c - '1';
opt--; /* Go back to -n??? argument to see if it was oad, osa or spid */
pParamStr = argv[opt] + 2; /* Set up pointer to paramater string - oad, osa, spid */
if (strcmp(pParamStr, "oad") == 0)
{
pOAD = pParamStr + 4;
if (check_oa(pOAD))
{
strcpy((char *)OAD[byId], pOAD);
}
else
{
fprintf(stderr, "Invalid OAD - %s\n", pOAD);
}
}
else if (strcmp(pParamStr, "osa") == 0)
{
pOSA = pParamStr + 4;
if (check_osa(pOSA))
{
strcpy((char *)OSA[byId], pOSA);
}
else
{
fprintf(stderr, "Invalid OSA - %s\n", pOSA);
}
}
else if (strcmp(pParamStr, "spid") == 0)
{
pSPID = pParamStr + 5;
if (check_spid(pSPID))
{
strcpy((char *)SPID[byId], pSPID);
}
else
{
fprintf(stderr, "Invalid SPID - %s\n", pSPID);
}
}
else
{
fprintf(stderr, "Invalid sub-parameter: [%s]\n", pParamStr);
return 1;
}
opt++; opt++;
break;
case 'e':
options.crc4=TRUE;
break;
case 'a': // all?
opt--;
if ((argv[opt][2] == 'l') && (argv[opt][3] == 'l') && (argv[opt][4] == '\0') && (options.card_id == 0))
{
load_all_cards = TRUE;
}
else if (options.card_id != 0)
{
fprintf(stderr, "divaload: cannot specify both -all and -c\n");
}
else
{
fprintf(stderr, "divaload: invalid parameter [%s] (Use 'all')\n", argv[opt]);
return 1;
}
opt++;
break;
case 'c': // Card number (starting from 1)
if(read_dec(argv[opt],(word *) &adapter_no))
{
fprintf(stderr, "divaload: invalid card number specified\n");
return (1);
}
else if (load_all_cards)
{
fprintf(stderr, "divaload: -all specified. Cannot specify both -all and -c");
return 1;
}
else if ((adapter_no < 1) || (adapter_no > num_cards))
{
if (num_cards > 1)
{
fprintf(stderr, "divaload: use value between 1 and %d inclusive\n", num_cards);
return 1;
}
else
{
fprintf(stderr, "divaload: adapter numbers start at 1\n");
return 1;
}
}
opt++;
break;
case 'f': /* Switch configuration */
if (!argv[opt])
{
fprintf(stderr, "divaload: No switch type specified\n");
return (1);
}
switch((char)argv[opt][0])
{
case 'E': /* ETSI */
case 'e':
strcpy(afname, "te_etsi");
break;
case 'A': /* ATEL */
case 'a':
strcpy(afname, "te_atel");
break;
case 'J': /* JAPAN */
case 'j':
strcpy(afname, "te_japan");
break;
case 'N': /* NI1 */
case 'n':
strcpy(afname, "te_ni");
break;
case '5': /* 5ESS */
strcpy(afname, "te_5ess");
break;
case '1': /* 5ESS */
strcpy(afname, "te_1tr6");
break;
default:
printf("divaload: Invalid switch type (%s)\n", argv[opt]);
return (1);
}
opt++;
break;
case 'h':
usage(argv[0]);
return (1);
break;
case 'l':
if(read_dec(argv[opt],(word*)&channel_no))
{
printf("Invalid params for channel option.\n");
return (1);
}
else
{
if (channel_no > 30)
{
printf("Invalid channel number (%d)!!\n", channel_no);
return (1);
}
options.low_channel = channel_no;
opt++;
}
break;
case 'n':
options.nt2=TRUE;
break;
case 'o':
options.no_order_check=TRUE;
break;
case 'p':
options.permanent=TRUE;
break;
case 's':
options.stable_l2=1;
if(!argv[opt] || *argv[opt]=='-')
{
break;
}
if(read_dec(argv[opt],(word*)&stablel2))
{
printf("Invalid options for Layer2 operation.\n");
return (1);
}
else
{
if(stablel2>3)
{
printf("Invalid options for Layer2 operation.\n");
return 1;
}
options.stable_l2=stablel2;
opt++;
}
break;
case 't':
if(read_dec(argv[opt],(word*)&tei))
{
printf("Invalid params for TEI option.\n");
return (1);
}
else
{
if(tei>63)
{
printf("Invalid tei number !!\n");
return (1);
}
options.tei = tei;
opt++;
}
break;
/* Invalid parameter (on Linux anyway) */
default:
fprintf(stderr, "divaload: invalid parameter [%c]\n", c);
return -1;
}
}
}
if (strlen(afname) == 0)
{
fprintf(stderr, "divaload: No switch type specified ('./divaload -h' for help)\n");
return -1;
}
if (load_all_cards)
{
int num_adaps, qm;
for (card_i = 1 ; card_i <= num_cards; card_i++)
{
/* announce_card(card_i, cards[card_i]);*/
fprintf(stderr, "divaload: Loading %s with %s firmware\n", card_desc[cards[card_i]], afname + 3);
options.card_id = card_i - 1;
if (card_list[options.card_id].state == DIA_RUNNING)
{
fprintf(stderr, "divaload: adapter %d already running.\n", card_i);
continue;
}
if (new_cards[card_i] == 0)
{
/* strcpy(afname, "te_");
strcat(afname, flavour_str[flavours[card_i]]);*/
strcat(afname, ".pm");
num_adaps = 1;
}
else if (new_cards[card_i] == 1)
{
/* strcpy(afname, "te_");
strcat(afname, flavour_str[flavours[card_i]]);*/
strcat(afname, ".sm");
num_adaps = 1;
}
else if (new_cards[card_i] == 2)
{
strcat(afname, ".qm ");
num_adaps = 4;
}
else
{
printf("divaload: unknown card type %d\n", new_cards[card_i]);
return -1;
}
/*rc=DivaALoad(afname, &options, &card, ret_msg);*/
options.card_id = real_card_id[card_i];
for (i=options.card_id, qm = 0; num_adaps; i++, num_adaps--, qm++)
{
options.card_id = i;
if (new_cards[card_i] == 2) //4BRI
{
afname[strlen(afname) - 1] = '0' + qm;
}
rc=DivaALoad(afname, &options, &card, ret_msg, num_adaps);
if( rc != ERR_ETDD_OK )
{
switch(rc)
{
case ERR_ETDD_ACCESS:
sprintf(disp_msg,"cannot access file %s",ret_msg);
perror(disp_msg);
break;
case ERR_ETDD_DSP:
sprintf(disp_msg,"cannot access DSP binary %s",ret_msg);
perror(disp_msg);
break;
case ERR_ETDD_IOCTL:
sprintf(disp_msg,"error doing ioctl");
perror(disp_msg);
break;
case ERR_ETDD_NOMEM:
printf("DivaLoad:Not enough memory available.\n");
break;
case ERR_ETDD_OPEN:
sprintf(disp_msg,"Cannot open file %s",ret_msg);
perror(disp_msg);
break;
case ERR_ETDD_READ:
sprintf(disp_msg,"Cannot read from file %s",ret_msg);
perror(disp_msg);
break;
default:
printf("divaload: unknown error\n");
}/*switch*/
}/*if*/
}/*Next Sub-Adapter*/
if (strchr(afname, '.'))
{
*(strchr(afname, '.')) = '\0';
}
}/*Next real adapter*/
}
else
{
int num_adaps = 0, qm;
if (adapter_no == 0) // No adapter specified
{
fprintf(stderr, "divaload: You need to specify either an adpater (-c n) or use -all\n");
return -1;
}
fprintf(stderr, "divaload: Loading %s with %s firmware\n", card_desc[cards[adapter_no]], afname + 3);
options.card_id = real_card_id[adapter_no];
if (card_list[options.card_id].state == DIA_RUNNING)
{
fprintf(stderr, "divaload: adapter %d already running.\n", adapter_no);
return -1;
}
//options.card_id = adapter_no - 1;
if (new_cards[adapter_no] == 0)
{
strcat(afname, ".pm");
num_adaps = 1;
}
else if (new_cards[adapter_no] == 1)
{
strcat(afname, ".sm");
num_adaps = 1;
}
else if (new_cards[adapter_no] == 2)
{
strcat(afname, ".qm ");
num_adaps = 4;
}
else
{
printf("divaload: unknown adapter type %d", new_cards[adapter_no]);
return -1;
}
// Load num_adaps adapters (4BRI: num_adaps = 4)
for (i=options.card_id, qm = 0; num_adaps; i++, num_adaps--, qm++)
{
options.card_id = i;
// num_adaps serves as a trigger for download of the combifile
// Only gets done (in DivaALoad) when num_adaps == 1 (i.e. last one)
if (new_cards[adapter_no] == 2) // 4BRI
{
afname[strlen(afname) - 1] = '0' + qm;
}
strcpy((char *)options.terminal[0].oad, OAD[qm*2]);
strcpy((char *)options.terminal[1].oad, OAD[(qm*2)+1]);
strcpy((char *)options.terminal[0].osa, OSA[qm*2]);
strcpy((char *)options.terminal[1].osa, OSA[(qm*2)+1]);
strcpy((char *)options.terminal[0].spid, SPID[qm*2]);
strcpy((char *)options.terminal[1].spid, SPID[(qm*2)+1]);
rc=DivaALoad(afname, &options, &card, ret_msg, num_adaps);
if( rc != ERR_ETDD_OK )
{
switch(rc)
{
case ERR_ETDD_ACCESS:
sprintf(disp_msg,"cannot access file %s",ret_msg);
perror(disp_msg);
break;
case ERR_ETDD_DSP:
sprintf(disp_msg,"cannot access DSP binary %s",ret_msg);
perror(disp_msg);
break;
case ERR_ETDD_IOCTL:
sprintf(disp_msg,"error doing ioctl");
perror(disp_msg);
break;
case ERR_ETDD_NOMEM:
printf("divaload: not enough memory available.\n");
break;
case ERR_ETDD_OPEN:
sprintf(disp_msg,"cannot open file %s",ret_msg);
perror(disp_msg);
break;
case ERR_ETDD_READ:
sprintf(disp_msg,"cannot read from file %s",ret_msg);
perror(disp_msg);
break;
default:
printf("divaload: unknown error\n");
}
}
} // 'for' loop for loading 4BRI adapters
}
return(0);
}
/*
* take in a decimal number from the keyboard
*/
byte read_dec(char *str,word *val)
{
word c;
*val=0;
if(!str)
{
return TRUE;
}
c=*str;
while( *str && (c>='0' && c<='9'))
{
*val *= 10;
*val += c-'0';
str++;
c=*str;
}
if( *str )
{
*val=0;
return TRUE;
}
else
{
return FALSE;
}
}
/*
* take in a hex number from the keyboard
*/
byte read_hex(char *str,dword *val)
{
word c;
*val=0;
if(!str)
{
return TRUE;
}
if(!strncmp(str, "0x", 2))
{
str++;
str++;
}
c=*str;
while( *str && ((c>='0' && c<='9') || (c>='a' && c<='f') || (c>='A' && c<='F')))
{
*val *= 0x10;
if (c>='0' && c<='9')
{
*val += c-'0';
}
else
{
if (c>='a' && c<='f')
{
*val += c-'a';
*val += 0xa;
}
else
{
*val += c-'A';
*val += 0xa;
}
}
str++;
c=*str;
}
if( *str )
{
*val=0;
return TRUE;
}
else
{
return FALSE;
}
}
/*
* validate the Originating Address string
*/
byte check_oa(char *str)
{
byte len=0;
if(!*str)
{
return FALSE;
}
while(*str && len<MAX_ADDR && (*str>='0' && *str<='9'))
{
len++;
str++;
}
if( *str )
{
return FALSE;
}
else
{
return TRUE;
}
}
/*
* validate the Originating Sub-Address string
*/
byte check_osa(char *str)
{
byte len=0;
if(!*str)
{
return FALSE;
}
while(*str && len<MAX_ADDR && ((*str>='0' && *str<='9')
|| *str=='P' || *str=='p' ))
{
len++;
str++;
}
if( *str )
{
return FALSE;
}
else
{
return TRUE;
}
}
/*
* validate the SPID string
*/
byte check_spid(char *str)
{
byte len=0;
if(!*str)
{
return FALSE;
}
while(*str && len<MAX_SPID && (*str>='0' && *str<='9'))
{
len++;
str++;
}
if( *str )
{
return FALSE;
}
else
{
return TRUE;
}
}
/*
* Usage function
*/
void usage(char *name)
{
printf("%s usage:\n",name);
printf("[-c <n>] [-all] [-f <switch type>] [-h] [-l <n>] [-n] [-o] [-p] [-s <0|1|2>] [-t n] [-<1|2><oad|osa|spid> value]\n");
printf("Where:\n");
printf(" -c n where n is the card to start\n");
printf(" -all to start all cards\n");
printf(" -e to specify CRC4\n");
printf(" -f <switch type> where <switch type> can be ETSI ...\n");
printf(" -h for usage\n");
printf(" -l <n> where n is the starting channel number (between 0 and 30)\n");
printf(" By default the allocation of channels is made on a high-to-low basis.\n");
printf(" By specifying -l you select a low-to-high allocation policy (in addition\n");
printf(" to specifying the starting channel number)\n");
printf(" -n to select NT2 mode\n");
printf(" -o to enforce order checking with information elements\n");
printf(" -p to establish a permanent connection (e.g. leased line configuration)\n");
printf(" -s <n> Layer 2 (D-Channel) connection type:\n");
printf(" 0 - Normal operation (only when there is an active B-channel connection)\n");
printf(" 1 - Never deactivated (from initial B-channel connection)\n");
printf(" 2 - Always active (regardless of B-channel connection status)\n");
printf(" -t <n> specifies a fixed TEI value between 0 and 63. Default is a dynamic TEI assignment\n");
printf(" -<1|2><oad|osa|spid> value (BRI only)\n");
printf(" Specify the Originating Address (OAD), Originating Sub-address (OSA) and/or Service\n");
printf(" Profile Identifier (SPID) for each B-channel (1 or 2)\n");
printf(" Example: divaload ... -1oad 123456 -1spid 1234560001\n");
}

View File

@ -0,0 +1,850 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.7
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/* Includes */
#include <stdio.h>
#include <unistd.h>
#include "sys.h" /* platform specific stuff */
#include "dsp_defs.h" /* combifile structures and definitions */
#include "cardtype.h" /* containd defines for card type ordinals */
#include "divas.h" /* defines for IOCTLs */
#include "constant.h"
#include "linux.h" /* Linux specific download stuff */
#include <sys/ioctl.h>
#include <sys/types.h> /* for file info */
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h> /* For dynamic memory allocation */
#include <memory.h> /* For memcpy stuff */
#include <errno.h> /* For error checking stuff */
#include "linuxcfg.h"
/* Definitions */
/*
static char dsp_combifile_format_identification[DSP_COMBIFILE_FORMAT_IDENTIFICATION_SIZE] =
{
'E', 'i', 'c', 'o', 'n', '.', 'D', 'i',
'e', 'h', 'l', ' ', 'D', 'S', 'P', ' ',
'D', 'o', 'w', 'n', 'l', 'o', 'a', 'd',
' ', 'C', 'o', 'm', 'b', 'i', 'f', 'i',
'l', 'e', '\0','\0','\0','\0','\0','\0',
'\0','\0','\0','\0','\0','\0','\0','\0'
};
static char dsp_file_format_identification[DSP_FILE_FORMAT_IDENTIFICATION_SIZE] =
{
'E', 'i', 'c', 'o', 'n', '.', 'D', 'i',
'e', 'h', 'l', ' ', 'D', 'S', 'P', ' ',
'D', 'o', 'w', 'n', 'l', 'o', 'a', 'd',
'\0','F', 'i', 'l', 'e','\0','\0','\0',
'\0','\0','\0','\0','\0','\0','\0','\0',
'\0','\0','\0','\0','\0','\0','\0','\0'
};
*/
#define COMBIFILE DATADIR "/dspdload.bin"
/*These files will contain the binaries wriiten to card*/
#ifdef DEBUG
#define DSPFILE DATADIR "/debug_dsp"
#define TABLEFILE DATADIR "/debug_tablefile"
#endif
/* External references */
extern int num_directory_entries;
extern int usage_mask_size;
extern int download_count;
extern int directory_size;
extern int usage_bit;
extern int usage_byte;
extern int card_id;
static int first_load = TRUE;
int set_download_pos(int card_type, word wFeatures);
/* Forward references */
t_dsp_combifile_directory_entry *display_combifile_details(char *details);
dword get_download(char *download_block, char *usage_mask_ptr);
dword store_download(char *data, word size, char *store);
int set_alignment_mask(int card_type);
int download(char *block, dword size, int code);
/*--------------------------------------------------------------------------
* load_combifile() function
*
* opens combifile, reads into buffer and calls fn to display info.
* It then parses the directory for the fileset required for the
* specified card. It the calls a function to determine the amount of memory
* required for the download and calls it again to get the download required.
* Finally it downloads the data from the combi file and a table of addresses.
*
* Parameters: cardtype = Card ordinal as specified in cardtype.h
*--------------------------------------------------------------------------*/
void load_combifile(int card_type, word wFeatures)
{
int fd;
int count;
int file_set_number=0;
struct stat file_info;
char *combifile_start;
char *usage_mask_ptr;
char *download_block;
t_dsp_combifile_directory_entry *directory;
t_dsp_combifile_directory_entry *tmp_directory;
dword download_size;
#ifdef DEBUG
int dsp_fd;
int table_fd;
#endif
if(!set_alignment_mask(card_type))
{
return;
}
if(!set_download_pos(card_type, wFeatures))
{
return;
}
if ((fd = open(COMBIFILE, O_RDONLY, 0)) == -1)
{
perror("Error opening Eicon combifile");
return;
}
if (fstat(fd, &file_info))
{
perror("Error geting file details of Eicon combifile");
close(fd);
return;
}
if ( file_info.st_size <= 0 )
{
perror("Invalid file length in Eicon combifile");
close(fd);
return;
}
combifile_start = malloc(file_info.st_size);
if(!combifile_start)
{
perror("Error allocating memory for Eicon combifile");
close(fd);
return;
}
#ifdef DEBUG
printf("File mapped to address 0x%x\n", combifile_start);
#endif
if((read(fd, combifile_start, file_info.st_size)) != file_info.st_size)
{
perror("Error reading Eicon combifile into memory");
free(combifile_start);
close(fd);
return;
}
close(fd); /* We're done with the file */
directory = display_combifile_details(combifile_start);
#ifdef DEBUG
printf("Directory mapped to address 0x%x, offset = 0x%x\n", directory,
((unsigned int)directory - (unsigned int)combifile_start));
#endif
tmp_directory = directory;
for(count = 0; count < num_directory_entries; count++)
{
if(BYTE_SWAP_WORD(tmp_directory->card_type_number) == card_type)
{
#ifdef DEBUG
printf("Found entry in directory slot %d\n", count);
printf("File set number is %d\n",
BYTE_SWAP_WORD(tmp_directory->file_set_number));
printf("Matched Card %d is %d. Fileset number is %d\n", count,
BYTE_SWAP_WORD(tmp_directory->card_type_number),
BYTE_SWAP_WORD(tmp_directory->file_set_number));
#endif
file_set_number = BYTE_SWAP_WORD(tmp_directory->file_set_number);
break;
}
#ifdef DEBUG
printf("Card %d is %d. Fileset number is %d\n", count,
BYTE_SWAP_WORD(tmp_directory->card_type_number),
BYTE_SWAP_WORD(tmp_directory->file_set_number));
#endif
tmp_directory++;
}
if(count == num_directory_entries)
{
printf("Card not found in directory\n");
free(combifile_start);
return;
}
usage_bit = file_set_number%8;
usage_byte= file_set_number/8;
#ifdef DEBUG
printf("Bit field is bit %d in byte %d of the usage mask\n",
usage_bit,
usage_byte);
#endif
usage_mask_ptr = (char *)(directory);
usage_mask_ptr += directory_size;
#ifdef DEBUG
printf("First mask at address 0x%x, offset = 0x%x\n", usage_mask_ptr,
(usage_mask_ptr - combifile_start));
#endif
no_of_tables = malloc((sizeof(dword)));
download_size = get_download(NULL, usage_mask_ptr);
#ifdef DEBUG
printf("Initial size of download_size is 0x%x\n",download_size);
#endif
if(!download_size)
{
printf("Error getting details on DSP downloads\n");
free(combifile_start);
return;
}
/* Allocate the amount of space to hold the details from the
* combifile plus an additional amount to allow for alignment
* on dword boundary. (Max. shift is 3 bytes for each download)
*/
download_block = malloc((download_size + (no_of_downloads * 100)));
#ifdef DEBUG
printf("download_block size = (download_size + alignments) is: 0x%x\n",(download_size + (no_of_downloads * 100)));
#endif
if(!download_block)
{
printf("Error allocating memory for download\n");
free(combifile_start);
return;
}
#ifdef DEBUG
printf("Calling get_download to write into download_block\n");
#endif
if(!(get_download(download_block, usage_mask_ptr)))
{
printf("Error getting data for DSP download\n");
free(download_block);
free(combifile_start);
free(no_of_tables);
return;
}
#ifdef DEBUG
printf("Downloading data using IOCTLs to Card\n");
#endif
#ifdef DEBUG
if ((dsp_fd = open(DSPFILE, O_RDWR)) == -1)
{
perror("Error opening Eicon dsp_file");
return;
}
if ((!(write(dsp_fd,download_block,total_bytes_in_download))))
{
perror("Error writing to Eicon dsp_file");
return;
}
close(dsp_fd);
#endif
if(!(download(download_block, total_bytes_in_download, DIA_DSP_CODE)))
{
printf("Error downloading Combifile details\n");
free(download_block);
free(combifile_start);
free(no_of_tables);
return;
}
if(!(download(no_of_tables,sizeof(table_count), DIA_DLOAD_CNT)))
{
printf("Error downloading number of downloads to load\n");
free(download_block);
free(combifile_start);
free(no_of_tables);
return;
}
#ifdef DEBUG
if ((table_fd = open(TABLEFILE, O_RDWR)) == -1)
{
perror("Error opening Eicon table_file");
return;
}
if ((!(write(table_fd,(char *)p_download_table,sizeof(p_download_table)))))
{
perror("Error writing to Eicon table_file");
return;
}
close(table_fd);
#endif
if(!(download((char *)p_download_table,sizeof(p_download_table), DIA_TABLE_CODE)))
{
printf("Error downloading Combifile details\n");
free(download_block);
free(combifile_start);
free(no_of_tables);
return;
}
free(download_block);
free(combifile_start);
free(no_of_tables);
return;
}
/*--------------------------------------------------------------
* display_combifile_details()
*
* Displays the information in the combifile header
* Arguments: Pointer to the combifile structure in memory
* Returns: The address of the begining of directory which is
* directly after the file description.
*-------------------------------------------------------------*/
t_dsp_combifile_directory_entry *display_combifile_details(char *details)
{
dword offset=0;
t_dsp_combifile_header *file_header;
char *description;
t_dsp_combifile_directory_entry *return_ptr = NULL;
file_header = (t_dsp_combifile_header *)details;
#ifdef DEBUG
printf("%s\n", file_header->format_identification);
printf("\tFormat Version: 0x%.4x\n",
BYTE_SWAP_WORD(file_header->format_version_bcd));
printf("\tNumber of directory entries : %d\n",
BYTE_SWAP_WORD(file_header->directory_entries));
printf("\tDownload count: %d\n", BYTE_SWAP_WORD(file_header->download_count));
#endif
description = (char *)file_header + BYTE_SWAP_WORD((file_header->header_size));
printf("%s\n", description);
num_directory_entries = BYTE_SWAP_WORD(file_header->directory_entries);
usage_mask_size = BYTE_SWAP_WORD(file_header->usage_mask_size);
download_count = BYTE_SWAP_WORD(file_header->download_count);
directory_size = BYTE_SWAP_WORD(file_header->directory_size);
return_ptr = (t_dsp_combifile_directory_entry *) (unsigned int)file_header ;
offset += (BYTE_SWAP_WORD((file_header->header_size)));
offset += (BYTE_SWAP_WORD((file_header->combifile_description_size)));
offset += (dword)return_ptr;
return (t_dsp_combifile_directory_entry *)offset;
}
/*-----------------------------------------------------------------------
* get_download ()
*
* Loops for each download in the combifile, reading the usage mask to
* determine if this DSP code is required for the current file set.
* If a memory address is specified for download_area, the code is stored
* there.
* Arguments:ptr to download_block to store code,ptr to first usage_mask in
* combifile which has been read into memory
* Returns: length of download required
*-----------------------------------------------------------------------*/
dword get_download(char *download_block, char *download_area)
{
int n;
char *usage_mask;
char test_byte=0;
dword length=0;
dword addr;
unsigned int table_index;
t_dsp_file_header *file_header;
t_dsp_download_desc *p_download_desc;
char *data;
#ifdef DEBUG
int i;
#endif
no_of_downloads = 0;
test_byte = 0x01;
test_byte <<= usage_bit;
usage_mask = malloc(usage_mask_size);
if(!usage_mask)
{
printf("Error allocating memory for usage mask");
return 0;
}
bzero(usage_mask, usage_mask_size);
for(n = 0; n < download_count; n++)
{
memcpy(usage_mask, download_area, usage_mask_size);
#ifdef DEBUG
printf(" \n");
printf("Usage mask = 0x%.2x ", usage_mask[0]);
if(usage_mask_size > 1)
{
for(i=1; i<usage_mask_size; i++)
{
printf("0x%.2x ", usage_mask[i]);
}
}
#endif
download_area += usage_mask_size;
file_header = (t_dsp_file_header *)download_area;
#ifdef DEBUG
printf("%s %d\n", file_header->format_identification,n);
#endif
if( test_byte & usage_mask[usage_byte] )
{
no_of_downloads++;
table_index = (no_of_downloads - 1);
#ifdef DEBUG
printf("*****DSP DOWNLOAD %d REQUIRED******\n", n);
printf("download required count is now %d\n",no_of_downloads);
printf(" \n");
#endif
/*This is the lenth of the memory to malloc */
length += ((dword)((word)(BYTE_SWAP_WORD(file_header->header_size)
- sizeof(t_dsp_file_header))))
+ ((dword)BYTE_SWAP_WORD((file_header->download_description_size)))
+ ((dword)BYTE_SWAP_WORD((file_header->memory_block_table_size)))
+ ((dword)BYTE_SWAP_WORD((file_header->segment_table_size)))
+ ((dword)BYTE_SWAP_WORD((file_header->symbol_table_size)))
+ ((dword)BYTE_SWAP_WORD((file_header->total_data_size_dm)))
+ ((dword)BYTE_SWAP_WORD((file_header->total_data_size_pm)));
if(download_block)
{
data = (char *)file_header;
data += ((dword)(BYTE_SWAP_WORD(file_header->header_size)));
p_download_desc = &(p_download_table[table_index]);
p_download_desc->download_id = file_header->download_id;
p_download_desc->download_flags = file_header->download_flags;
p_download_desc->required_processing_power = file_header->required_processing_power;
p_download_desc->interface_channel_count = file_header->interface_channel_count;
p_download_desc->excess_header_size = BYTE_SWAP_WORD((word)(BYTE_SWAP_WORD(file_header->header_size) - (word)sizeof(t_dsp_file_header)));
p_download_desc->memory_block_count = file_header->memory_block_count;
p_download_desc->segment_count = file_header->segment_count;
p_download_desc->symbol_count = file_header->symbol_count;
p_download_desc->data_block_count_dm = file_header->data_block_count_dm;
p_download_desc->data_block_count_pm = file_header->data_block_count_pm;
p_download_desc->p_excess_header_data = NULL;
if ((BYTE_SWAP_WORD (p_download_desc->excess_header_size) != 0))
{
#ifdef DEBUG
printf("1.store_download called from get_download\n");
#endif
addr = store_download(data, p_download_desc->excess_header_size,
download_block);
p_download_desc->p_excess_header_data = (byte *)addr;
data += (BYTE_SWAP_WORD(p_download_desc->excess_header_size));
}
p_download_desc->p_download_description = NULL;
if ((BYTE_SWAP_WORD(file_header->download_description_size) != 0))
{
#ifdef DEBUG
printf("2.store_download called from get_download\n");
#endif
addr = store_download(data, file_header->download_description_size,
download_block);
p_download_desc->p_download_description = (char *)addr;
data += (BYTE_SWAP_WORD(file_header->download_description_size));
}
p_download_desc->p_memory_block_table = NULL;
if ((BYTE_SWAP_WORD(file_header->memory_block_table_size) != 0))
{
#ifdef DEBUG
printf("3.store_download called from get_download\n");
#endif
addr = store_download(data, file_header->memory_block_table_size,
download_block);
p_download_desc->p_memory_block_table = (t_dsp_memory_block_desc *)addr;
data += (BYTE_SWAP_WORD(file_header->memory_block_table_size));
}
p_download_desc->p_segment_table = NULL;
if ((BYTE_SWAP_WORD(file_header->segment_table_size) != 0))
{
#ifdef DEBUG
printf("4.store_download called from get_download\n");
#endif
addr = store_download(data, file_header->segment_table_size,
download_block);
p_download_desc->p_segment_table = (t_dsp_segment_desc *)addr;
data += (BYTE_SWAP_WORD(file_header->segment_table_size));
}
p_download_desc->p_symbol_table = NULL;
if ((BYTE_SWAP_WORD(file_header->symbol_table_size) != 0))
{
#ifdef DEBUG
printf("5.store_download called from get_download\n");
#endif
addr = store_download(data, file_header->symbol_table_size,
download_block);
p_download_desc->p_symbol_table = (t_dsp_symbol_desc *)addr;
data += (BYTE_SWAP_WORD(file_header->symbol_table_size));
}
p_download_desc->p_data_blocks_dm = NULL;
if ((BYTE_SWAP_WORD(file_header->total_data_size_dm) != 0))
{
#ifdef DEBUG
printf("6.store_download called from get_download\n");
#endif
addr = store_download(data, file_header->total_data_size_dm,
download_block);
p_download_desc->p_data_blocks_dm = (word *)addr;
data += (BYTE_SWAP_WORD(file_header->total_data_size_dm));
}
p_download_desc->p_data_blocks_pm = NULL;
if ((BYTE_SWAP_WORD(file_header->total_data_size_pm) != 0))
{
#ifdef DEBUG
printf("7.store_download called from get_download\n");
#endif
addr = store_download(data, file_header->total_data_size_pm,
download_block);
p_download_desc->p_data_blocks_pm = (word *)addr;
data += (BYTE_SWAP_WORD(file_header->total_data_size_pm));
}
}
}
download_area += ((dword)((word)(BYTE_SWAP_WORD(file_header->header_size))));
download_area +=((dword)BYTE_SWAP_WORD((file_header->download_description_size)));
download_area += ((dword)BYTE_SWAP_WORD((file_header->memory_block_table_size)));
download_area += ((dword)BYTE_SWAP_WORD((file_header->segment_table_size)));
download_area += ((dword)BYTE_SWAP_WORD((file_header->symbol_table_size)));
download_area += ((dword)BYTE_SWAP_WORD((file_header->total_data_size_dm)));
download_area += ((dword)BYTE_SWAP_WORD((file_header->total_data_size_pm)));
}
table_count=BYTE_SWAP_DWORD(no_of_downloads);
/**no_of_tables=table_count;*/
bzero(no_of_tables,sizeof(dword));
memcpy(no_of_tables,&table_count,sizeof(dword));
#ifdef DEBUG
printf("***0x%x bytes of memory required for %d downloads***\n", length, no_of_downloads);
printf("BYTE_SWAP_DWORD table_count is:%d\n",table_count);
printf(" \n");
#endif
free(usage_mask);
first_load = TRUE;
return length;
}
/*----------------------------------------------------------------------
* store_download()
*
* Stores the size bytes of DSP code from data into dynamicaly
* allocated memory block.
* Arguments: pointer to data, length, pointer to begining of mem block
* Returns the address to be put in download table
*----------------------------------------------------------------------*/
dword store_download(char *data, word size, char *store)
{
word real_size;
static char* position;
static char* initial;
static dword addr;
dword data_start_addr;
dword align;
#ifdef DEBUG
printf("Writing Data to memory block\n");
#endif
if(first_load)
{
addr = download_pos;
position = initial = (char *)store;
first_load = FALSE;
}
/*Starting address to where the data is written in the download_block*/
data_start_addr = addr;
real_size = BYTE_SWAP_WORD(size);
align = ((addr + (real_size + ~ALIGNMENT_MASK)) & ALIGNMENT_MASK) -
(addr + real_size);
memcpy(position, data, real_size);
position += real_size;
addr += real_size;
bzero(position, align);
position += align;
addr += align;
total_bytes_in_download = position - initial;
#ifdef DEBUG
printf("total_bytes written so far is 0x%x\n",total_bytes_in_download);
printf("align value for this download is: %d\n",align);
#endif
/* We return (data_start_addr) because we want to point to start of data
However for next write to download_block the starting postion addr is saved*/
return BYTE_SWAP_DWORD(data_start_addr);
/*return BYTE_SWAP_DWORD(addr);*/
}
/*-------------------------------------------------------------------------
* set_alignment_mask()
*
* Sets the alignment mask for the specified card type. This
* allows us to allign the data in the download block correctly
* Arguments: A int representing the card type
* Returns TRUE if the card is supported, otherwise returns FALSE.
*------------------------------------------------------------------------*/
int set_alignment_mask(int card_type)
{
int ret;
switch(card_type)
{
case CARDTYPE_MAESTRA_PCI:
case CARDTYPE_DIVASRV_P_9M_PCI:
case CARDTYPE_DIVASRV_Q_8M_PCI:
ALIGNMENT_MASK = ALIGNMENT_MASK_MAESTRA;
ret = TRUE;
break;
default:
printf("Card not supported\n");
ret = FALSE;
break;
}
return ret;
}
/*-----------------------------------------------------------------------
* set_download_position()
*
* Sets the address to where the DSP code goes on the card
* Arguments: Card number
* Returns TRUE if card is supported
*----------------------------------------------------------------------*/
int set_download_pos(int card_type, word wFeatures)
{
int ret;
switch(card_type)
{
case CARDTYPE_MAESTRA_PCI:
if (wFeatures & 0x8)
{
download_pos = V90D_DSP_CODE_BASE;
}
else
{
download_pos = ORG_DSP_CODE_BASE;
}
download_pos += (((sizeof(dword) +
sizeof(p_download_table)) + 3)
& 0xFFFFFFFC);
ret = TRUE;
break;
case CARDTYPE_DIVASRV_P_9M_PCI:
download_pos = MP_DSP_CODE_BASE + (((sizeof(dword)
+ sizeof(p_download_table))
+ ~ALIGNMENT_MASK_MAESTRA)
& ALIGNMENT_MASK_MAESTRA);
ret = TRUE;
break;
case CARDTYPE_DIVASRV_Q_8M_PCI:
if (wFeatures & PROTCAP_V90D)
{
download_pos = MQ_V90D_DSP_CODE_BASE;
}
else
{
download_pos = MQ_ORG_DSP_CODE_BASE;
}
download_pos += (((sizeof(dword) +
sizeof(p_download_table)) + 3)
& 0xFFFFFFFC);
ret = TRUE;
break;
default:
printf("Card not supported\n");
ret = FALSE;
break;
}
return ret;
}
/*-----------------------------------------------------------------------------
* download()
*
* Does an IOCTL to download size bytes from block with code
* type set to code
*
* Arguments: Pointer to data, length of data , code type
* Returns TRUE on success, other wise returns FALSE
*----------------------------------------------------------------------------*/
int download(char *block, dword size, int code)
{
dia_load_t load;
int fd;
#ifdef DEBUG
printf("Downloading to Card 0x%x bytes\n", size);
#endif
load.card_id = card_id;
/* open the Divas device */
if ((fd = open(DIVAS_DEVICE, O_RDONLY, 0)) == -1)
{
perror("Error opening DIVA Server device");
return(FALSE);
}
load.code_type = code;
load.code = (unsigned char *)block;
load.length = size;
if((ioctl(fd, DIA_IOCTL_LOAD, &load)) == -1)
{
perror("IOCTL error on DIVA Servers");
(void)close(fd);
return FALSE;
}
(void)close(fd);
return TRUE;
}

271
eicon/divautil/linload.c Normal file
View File

@ -0,0 +1,271 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.8
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Source file for Unix Diva card library
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
/*#include <ioctls.h>*/
#include "sys.h"
#include "pc_maint.h"
#include "divas.h"
#include "load.h"
#include "diva.h"
#include "diload.h"
#include "cardtype.h"
#include "linuxcfg.h"
int card_id;
extern byte new_cards[];
extern byte cards[];
/*int sprintf(char *,char *,...);*/
void *malloc(size_t);
/*
* load the specified buffer containing DSP code onto the Diva card
*/
void load_combifile(int card_type, word wFeatures);
int DivaALoad(char *dsp_name, dia_config_t *options, dia_card_t *card, char *msg , int adapter_instance)
{
int loadfd; /* Divas file pointer */
int fd; /* file pointer */
struct stat file_info; /* info about file */
dia_load_t load; /* information to load */
char *microcode_dir = DATADIR "/";
char filename[100];
dia_start_t start;
int rc;
char *pFeatureString;
word wFeatures = 0;
card_id = load.card_id = options->card_id;
start.card_id = options->card_id;
/* open the Divas device */
if ((loadfd = open(DIVAS_DEVICE, O_RDONLY, 0)) == -1)
{
sprintf(msg,DIVAS_DEVICE);
return(ERR_ETDD_OPEN);
}
card = NULL;
/* if we have command line options configured */
if( card )
{
/* pass them down to the driver. */
if((rc = ioctl(loadfd, DIA_IOCTL_INIT, card)) == -1)
{
fprintf(stderr, "%s INIT Error %d\n", DIVAS_DEVICE, rc);
(void)close(loadfd);
return(ERR_ETDD_IOCTL);
}
}
if ((cards[options->card_id + 1] == 2) &&
(adapter_instance == 4)) // Only on first 4BRI virtual adapter
{
strcpy(filename, microcode_dir);
strcat(filename, "/ds4bri.bit");
if ((fd = open(filename, O_RDONLY, 0)) == -1)
{
sprintf(msg,dsp_name);
(void)close(loadfd);
return(ERR_ETDD_DSP);
}
if (fstat(fd, &file_info))
{
sprintf(msg,dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_ACCESS);
}
if ( file_info.st_size <= 0 )
{
sprintf(msg,"file error (%s)",dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_READ);
}
if (!(load.code = malloc(file_info.st_size)))
{
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_NOMEM);
}
if (read(fd, load.code, file_info.st_size) != file_info.st_size)
{
sprintf(msg,"format error, %s", dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_READ);
}
load.length = file_info.st_size;
load.code_type=DIA_FPGA_CODE;
if((ioctl(loadfd, DIA_IOCTL_LOAD, &load)) == -1)
{
fprintf(stderr, "%s LOAD\n", DIVAS_DEVICE);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_IOCTL);
}
free(load.code);
close(fd);
}
/* open file containing DSP code */
strcpy(filename, microcode_dir);
strcat(filename, dsp_name);
/* open this DSP binary for reading */
if ((fd = open(filename, O_RDONLY, 0)) == -1)
{
sprintf(msg,dsp_name);
(void)close(loadfd);
return(ERR_ETDD_DSP);
}
if (fstat(fd, &file_info))
{
sprintf(msg,dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_ACCESS);
}
if ( file_info.st_size <= 0 )
{
sprintf(msg,"file error (%s)",dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_READ);
}
/* allocate a buffer and read contents of file into buffer */
if (!(load.code = malloc(file_info.st_size)))
{
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_NOMEM);
}
if (read(fd, load.code, file_info.st_size) != file_info.st_size)
{
sprintf(msg,"format error, %s", dsp_name);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_READ);
}
pFeatureString = (char *) strstr(&load.code[0x80], "[F#");
pFeatureString += 3;
wFeatures = strtol(pFeatureString,NULL, 16);
load.length = file_info.st_size;
load.code_type=DIA_CPU_CODE;
/* assign buffers and length and pass ioctl to /dev/Divas */
if((ioctl(loadfd, DIA_IOCTL_LOAD, &load)) == -1)
{
fprintf(stderr, "%s LOAD\n", DIVAS_DEVICE);
(void)close(loadfd);
(void)close(fd);
return(ERR_ETDD_IOCTL);
}
free(load.code);
(void) close(fd);
(void) close(loadfd);
if (cards[options->card_id + 1] == 0)
{
load_combifile(CARDTYPE_DIVASRV_P_9M_PCI, wFeatures);
}
else if (cards[options->card_id + 1] == 1)
{
load_combifile(CARDTYPE_MAESTRA_PCI, wFeatures);
}
else if ((cards[options->card_id + 1] == 2) &&
(adapter_instance == 1)) // Only on last 4BRI virtual adapter
{
load_combifile(CARDTYPE_DIVASRV_Q_8M_PCI, wFeatures);
}
/* open the Divas device */
if ((loadfd = open(DIVAS_DEVICE, O_RDONLY, 0)) == -1)
{
sprintf(msg,DIVAS_DEVICE);
return(ERR_ETDD_OPEN);
}
if((ioctl(loadfd, DIA_IOCTL_CONFIG, options)) == -1)
{
fprintf(stderr, "%s CONFIG\n", DIVAS_DEVICE);
(void)close(loadfd);
return(ERR_ETDD_IOCTL);
}
/* Inform /dev/Divas that loading is finished */
if (adapter_instance == 1) // only do this once
{
if((ioctl(loadfd, DIA_IOCTL_START, &start)) == -1)
{
fprintf(stderr, "%s START\n", DIVAS_DEVICE);
(void)close(loadfd);
return(ERR_ETDD_IOCTL);
}
}//if (adapter_instance == 1)
(void)close(loadfd);
return(ERR_ETDD_OK);
}

55
eicon/divautil/linux.h Normal file
View File

@ -0,0 +1,55 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.2
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#if !defined(_LINUX_H_)
#define _LINUX_H_
/* Macro for byte swaping */
#define BYTE_SWAP_WORD(a) a
#define BYTE_SWAP_DWORD(a) a
/* Globals */
int num_directory_entries = 0;
int usage_mask_size = 0;
int download_count = 0;
int directory_size = 0;
int ALIGNMENT_MASK;
int usage_bit = 0;
int usage_byte = 0;
unsigned int no_of_downloads = 0;
int total_bytes_in_download = 0;
dword table_count=0;
char *no_of_tables;
t_dsp_download_desc p_download_table[DSP_MAX_DOWNLOAD_COUNT];
dword download_pos;
#endif /* _LINUX_H_ */

63
eicon/divautil/load.h Normal file
View File

@ -0,0 +1,63 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.1
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Data Structure for down loading configuration details to the protocol
* driver controlling the Diehl Diva card.
*
*/
#if !defined(_LOAD_H)
#define _LOAD_H
#define MAX_ADDR 23
#define MAX_SPID 32
#define ETDP_TEI 0x01
#define ETDP_NT2 0x02
#define ETDP_PERMANENT 0x04
#define ETDP_LAYER2 0x08
#define ETDP_NOORDERCHECK 0x10
#define ETDP_PORT1 0x20
#define ETDP_PORT2 0x40
typedef struct
{
word configured;
byte tei;
byte nt2;
byte permanent;
byte stablel2;
byte noordercheck;
byte oad[2][MAX_ADDR];
byte osa[2][MAX_ADDR];
byte spid[2][MAX_SPID];
}parameter_t;
#endif /*_LOAD_H*/

145
eicon/divautil/loglib.c Normal file
View File

@ -0,0 +1,145 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.4
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Source file for Unix kernel logger library
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include "loglib.h"
/* Server's FIFO name */
static char *server_name = DATADIR "/KLOGD.S";
static char *client_name = DATADIR "/KLOG.";
/*
* Open the server's FIFO, create it of not there
*/
err_t OpenServer(int *fd)
{
struct stat buffer;
if (stat(server_name, &buffer) == -1)
{
if (mkfifo(server_name, 0666) == -1)
{
perror("mkfifo");
return(ERR_SERVER);
}
}
if ((*fd = open(server_name, O_RDWR)) == -1)
{
perror("open server");
return(ERR_SERVER);
}
return(ERR_OK);
}
/*
* Open the clients's FIFO, create it of not there
*/
err_t OpenClient( char *name,
int *fd)
{
struct stat buffer;
if (stat(name, &buffer) == -1)
{
if (mkfifo(name, 0666) == -1)
{
perror("mkfifo");
return(ERR_SERVER);
}
}
if ((*fd = open(name, O_RDWR)) == -1)
{
perror("open client");
return(ERR_SERVER);
}
return(ERR_OK);
}
/*
* Make up a client's name
*/
void CreateClientName(char *name)
{
sprintf(name, "%s%d", client_name, (int) getpid());
return;
}
/*
* Delete Server
*/
void DeleteServer(void)
{
if (unlink(server_name))
{
perror("unlink of server");
}
return;
}
/*
* Delete Client
*/
void DeleteClient(char *name)
{
if (unlink(name))
{
char buffer[80];
sprintf(buffer, "unlink of client %s", name);
perror(buffer);
}
return;
}

138
eicon/divautil/loglib.h Normal file
View File

@ -0,0 +1,138 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.4
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* Internal include file for kernel logger
*/
#if !defined(_KLOGLIB_H)
#define _KLOGLIB_H
#include "divalog.h"
#include "divas.h"
/* following should be defined in stdlib.h */
extern int opterr;
extern char *optarg;
/* make sure NULL is defined */
#if !defined(NULL)
#define NULL ((void *) 0)
#endif
typedef unsigned int uint_t;
/* define some standard types */
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE 1
#endif
typedef unsigned short int bool_t;
typedef unsigned int err_t;
/* define a MACRO to get the number of elements in an array */
#if !defined DIM
#define DIM(A) ((sizeof(A)) / (sizeof(A[0])))
#endif
/* following are values to use for flags for client/server communication */
#define KLOG_TELL_WHEN_EMPTY (1 << 0) /* client->server to request info */
#define KLOG_NO_MORE_LOG (1 << 1) /* server->client no more logs there */
#define KLOG_RESET_LOG (1 << 2) /* client->server, reset the log */
/*
* define type used for sending to log message to client
*/
typedef struct
{
uint_t flags; /* use defines above */
klog_t data;
} clog_t;
/*
* define type used for client/server communication
*/
typedef enum
{
KLOG_OPEN_CLIENT = 0,
KLOG_CLOSE_CLIENT = 1
} klog_req_t;
typedef struct
{
klog_req_t request; /* type of server request */
uint_t flags; /* additional information (see above) */
uint_t logs; /* DIVAS_LOG_XXX bit-mask */
uint_t card_id; /* card number to log */
char buffer[80]; /* information */
} klog_msg_t;
/*
* define error codes
*/
#define ERR_OK (0)
#define ERR_CLIENT (1)
#define ERR_SERVER (2)
/* Open the klog server */
extern err_t OpenServer(int *fd);
/* Create a client name */
extern void CreateClientName(char *name);
/* Open the klog client */
extern err_t OpenClient(char *name, int *fd);
/* Delete the klog server connection */
extern void DeleteServer(void);
/* Delete the klog client connection */
extern void DeleteClient(char *name);
/* Eicon specific function to print out a coded message */
extern void xlog(FILE *, char *, uint_t);
#endif /* of _KLOGLIB_H */

983
eicon/divautil/xlog.c Normal file
View File

@ -0,0 +1,983 @@
/*
*
* Copyright (C) Eicon Technology Corporation, 2000.
*
* This source file is supplied for the exclusive use with Eicon
* Technology Corporation's range of DIVA Server Adapters.
*
* Eicon File Revision : 1.1
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#define byte unsigned char
#define word unsigned short
#define dword unsigned long
#define TRUE 1
#define FALSE 0
#include <stdio.h>
#include <string.h>
#include "cau_1tr6.h"
#include "cau_q931.h"
#ifdef far
#undef far
#endif
#define far
#define SWAP(a) a
/*----------------------------------------------------------------*/
/* Prints into a buffer instead into a file if PRT2BUF is defined */
#if defined(PRT2BUF)
#define FILE byte
#define fprintf o+=sprintf
#define Out &stream[o]
#else
#define Out stream
#endif
static word o; /* index to buffer, not used if printed to file */
/*----------------------------------------------------------------*/
/* Define max byte count of a message to print before "cont" */
/* variable can be set externally to change this behaviour */
word maxout = 30;
struct l1s {
short length;
unsigned char i[22];
};
struct l2s {
short code;
short length;
unsigned char i[20];
};
union par {
char text[42];
struct l1s l1;
struct l2s l2;
};
typedef struct xlog_s XLOG;
struct xlog_s {
short code;
union par info;
};
typedef struct log_s LOG;
struct log_s {
word length;
word code;
word timeh;
word timel;
byte buffer[80];
};
#define ZERO_BASED_INDEX_VALID(x,t) ((unsigned)x < sizeof(t)/sizeof(t[0]))
#define ONE_BASED_INDEX_VALID(x,t) ((unsigned)x <= sizeof(t)/sizeof(t[0]))
static char *ll_name[13] = {
"LL_UDATA",
"LL_ESTABLISH",
"LL_RELEASE",
"LL_DATA",
"LL_LOCAL",
"LL_REMOTE",
"",
"LL_TEST",
"LL_MDATA",
"LL_BUDATA",
"",
"LL_XID",
"LL_XID_R"
};
static char *ns_name[13] = {
"N-MDATA",
"N-CONNECT",
"N-CONNECT ACK",
"N-DISC",
"N-DISC ACK",
"N-RESET",
"N-RESET ACK",
"N-DATA",
"N-EDATA",
"N-UDATA",
"N-BDATA",
"N-DATA ACK",
"N-EDATA ACK"
};
static char * l1_name[] = {
"SYNC_LOST",
"SYNC_GAINED",
"L1_DOWN",
"L1_UP",
"ACTIVATION_REQ",
"PS1_DOWN",
"PS1_UP",
"L1_FC1",
"L1_FC2",
"L1_FC3",
"L1_FC4"
};
static struct {
byte code;
char * name;
} capi20_command[] = {
{ 0x01, "ALERT" },
{ 0x02, "CONNECT" },
{ 0x03, "CONNECT_ACTIVE" },
{ 0x04, "DISCONNECT" },
{ 0x05, "LISTEN" },
{ 0x08, "INFO" },
{ 0x41, "SELECT_B" },
{ 0x80, "FACILITY" },
{ 0x82, "CONNECT_B3" },
{ 0x83, "CONNECT_B3_ACTIVE" },
{ 0x84, "DISCONNECT_B3" },
{ 0x86, "DATA_B3" },
{ 0x87, "RESET_B3" },
{ 0x88, "CONNECT_B3_T90_ACTIVE" },
{ 0xd4, "PORTABILITY" }, /* suspend/resume */
{ 0xff, "MANUFACTURER" }
};
static struct {
byte code;
char * name;
} capi11_command[] = {
{ 0x01, "RESET_B3" },
{ 0x02, "CONNECT" },
{ 0x03, "CONNECT_ACTIVE" },
{ 0x04, "DISCONNECT" },
{ 0x05, "LISTEN" },
{ 0x06, "GET_PARMS" },
{ 0x07, "INFO" },
{ 0x08, "DATA" },
{ 0x09, "CONNECT_INFO" },
{ 0x40, "SELECT_B2" },
{ 0x80, "SELECT_B3" },
{ 0x81, "LISTEN_B3" },
{ 0x82, "CONNECT_B3" },
{ 0x83, "CONNECT_B3_ACTIVE" },
{ 0x84, "DISCONNECT_B3" },
{ 0x85, "GET_B3_PARMS" },
{ 0x86, "DATA_B3" },
{ 0x87, "HANDSET" },
};
static struct {
byte code;
char * name;
} capi20_subcommand[] = {
{ 0x80, "REQ" },
{ 0x81, "CON" },
{ 0x82, "IND" },
{ 0x83, "RES" }
};
static struct {
byte code;
char * name;
} capi11_subcommand[] = {
{ 0x00, "REQ" },
{ 0x01, "CON" },
{ 0x02, "IND" },
{ 0x03, "RES" }
};
#define PD_MAX 4
static struct {
byte code;
char * name;
} pd[PD_MAX] = {
{ 0x08, "Q.931 " },
{ 0x0c, "CORNET " },
{ 0x40, "DKZE " },
{ 0x41, "1TR6 " }
};
#define MT_MAX 34
static struct {
byte code;
char * name;
} mt[MT_MAX] = {
{ 0x01, "ALERT" },
{ 0x02, "CALL_PROC" },
{ 0x03, "PROGRESS" },
{ 0x05, "SETUP" },
{ 0x07, "CONN" },
{ 0x0d, "SETUP_ACK" },
{ 0x0f, "CONN_ACK" },
{ 0x20, "USER_INFO" },
{ 0x21, "SUSP_REJ" },
{ 0x22, "RESUME_REJ" },
{ 0x24, "HOLD_REQ" },
{ 0x25, "SUSP" },
{ 0x26, "RESUME" },
{ 0x28, "HOLD_ACK" },
{ 0x30, "HOLD_REJ" },
{ 0x31, "RETRIEVE_REQ" },
{ 0x33, "RETRIEVE_ACK" },
{ 0x37, "RETRIEVE_REJ" },
{ 0x2d, "SUSP_ACK" },
{ 0x2e, "RESUME_ACK" },
{ 0x45, "DISC" },
{ 0x46, "RESTART" },
{ 0x4d, "REL" },
{ 0x4e, "RESTART_ACK" },
{ 0x5a, "REL_COM" },
{ 0x60, "SEGMENT" },
{ 0x62, "FACILITY" },
{ 0x64, "REGISTER" },
{ 0x6d, "GINFO" },
{ 0x6e, "NOTIFY" },
{ 0x75, "STATUS_ENQ" },
{ 0x79, "CONGESTION_CTRL" },
{ 0x7d, "STATUS" },
{ 0x7b, "INFO" }
};
#define IE_MAX 41
static struct {
word code;
char * name;
} ie[IE_MAX] = {
{ 0x00a1, "Sending complete" },
{ 0x00a0, "MORE" },
{ 0x00b0, "Congestion level" },
{ 0x00d0, "Repeat indicator" },
{ 0x0000, "SMSG" },
{ 0x0004, "Bearer Capability" },
{ 0x0008, "Cause" },
{ 0x000c, "Connected Address" },
{ 0x0010, "Call Identity" },
{ 0x0014, "Call State" },
{ 0x0018, "Channel Id" },
{ 0x001a, "Advice of Charge" },
{ 0x001c, "Facility" },
{ 0x001e, "Progress Indicator" },
{ 0x0020, "NSF" },
{ 0x0027, "Notify Indicator" },
{ 0x0028, "Display" },
{ 0x0029, "Date" },
{ 0x002c, "Key " },
{ 0x0034, "Signal" },
{ 0x003a, "SPID" },
{ 0x003b, "Endpoint Id" },
{ 0x004c, "Connected Number" },
{ 0x006c, "Calling Party Number" },
{ 0x006d, "Calling Party Subaddress" },
{ 0x0070, "Called Party Number" },
{ 0x0071, "Called Party Subaddress" },
{ 0x0074, "Redirected Number" },
{ 0x0076, "Redirecting Number" },
{ 0x0078, "TNET" },
{ 0x0079, "Restart Indicator" },
{ 0x007c, "LLC" },
{ 0x007d, "HLC" },
{ 0x007e, "User User Info" },
{ 0x007f, "ESC" },
{ 0x051a, "Advice of Charge" },
{ 0x061a, "Advice of Charge" },
{ 0x0601, "Service Indicator" },
{ 0x0602, "Charging Info" },
{ 0x0603, "Date" },
{ 0x0607, "Called Party State" }
};
static char * sig_state[] = {
"Null state",
"Call initiated",
"Overlap sending",
"Outgoing call proceeding",
"Call delivered",
"",
"Call present",
"Call received",
"Connect request",
"Incoming call proceeding",
"Active",
"Disconnect request",
"Disconnect indication",
"",
"",
"Suspend request",
"",
"Resume request",
"",
"Release request",
"",
"",
"",
"",
"",
"Overlap receiving"
};
static char * sig_timeout[] = {
"",
"T303",
"",
"",
"",
"",
"",
"",
"T313",
"",
"T309",
"T305",
"",
"",
"",
"T319",
"",
"T318",
"",
"T308",
"",
"",
"",
"",
"",
"T302"
};
struct msg_s {
word code;
word length;
byte info[1000];
} message = {0,0,{0}};
/* MIPS CPU exeption context structure */
struct xcptcontext {
dword sr;
dword cr;
dword epc;
dword vaddr;
dword regs[32];
dword mdlo;
dword mdhi;
dword reseverd;
dword xclass;
}xcp;
/* MIPS CPU exception classes */
#define XCPC_GENERAL 0
#define XCPC_TLBMISS 1
#define XCPC_XTLBMISS 2
#define XCPC_CACHEERR 3
#define XCPC_CLASS 0x0ff
#define XCPC_USRSTACK 0x100
#define XCPTINTR 0
#define XCPTMOD 1
#define XCPTTLBL 2
#define XCPTTLBS 3
#define XCPTADEL 4
#define XCPTADES 5
#define XCPTIBE 6
#define XCPTDBE 7
#define XCPTSYS 8
#define XCPTBP 9
#define XCPTRI 10
#define XCPTCPU 11
#define XCPTOVF 12
#define XCPTTRAP 13
#define XCPTVCEI 14
#define XCPTFPE 15
#define XCPTCP2 16
#define XCPTRES17 17
#define XCPTRES18 18
#define XCPTRES19 19
#define XCPTRES20 20
#define XCPTRES21 21
#define XCPTRES22 22
#define XCPTWATCH 23
#define XCPTRES24 24
#define XCPTRES25 25
#define XCPTRES26 26
#define XCPTRES27 27
#define XCPTRES28 28
#define XCPTRES29 29
#define XCPTRES30 30
#define XCPTVCED 31
#define NXCPT 32
/* exception classes */
#define XCPC_GENERAL 0
#define XCPC_TLBMISS 1
#define XCPC_XTLBMISS 2
#define XCPC_CACHEERR 3
#define XCPC_CLASS 0x0ff
#define XCPC_USRSTACK 0x100
/*------------------------------------------------------------------*/
/* local function prototypes */
/*------------------------------------------------------------------*/
word xlog(FILE * stream,void * buffer);
void xlog_sig(FILE * stream, struct msg_s * message);
void call_failed_event(FILE * stream, struct msg_s * message, word code);
void display_q931_message(FILE * stream, struct msg_s * message);
void display_ie(FILE * stream, byte pd, word w, byte * ie);
void spid_event(FILE * stream, struct msg_s * message, word code);
word xlog(FILE *stream, void * buf)
{
word i;
word n;
word code;
XLOG *buffer = buf;
o = 0;
switch((byte)SWAP(buffer->code)) {
case 1:
n = SWAP(buffer->info.l1.length);
if(SWAP(buffer->code) &0xff00) fprintf(stream,"B%d-X(%03d) ",SWAP(buffer->code)>>8,n);
else fprintf(stream,"B-X(%03d) ",n);
for(i=0;i<n && i<maxout;i++)
fprintf(stream,"%02X ",buffer->info.l1.i[i]);
if(n>i) fprintf(stream,"cont");
break;
case 2:
n = SWAP(buffer->info.l1.length);
if(SWAP(buffer->code) &0xff00) fprintf(stream,"B%d-R(%03d) ",SWAP(buffer->code)>>8,n);
else fprintf(stream,"B-R(%03d) ",n);
for(i=0;i<n && i<maxout;i++)
fprintf(stream,"%02X ",buffer->info.l1.i[i]);
if(n>i) fprintf(stream,"cont");
break;
case 3:
n = SWAP(buffer->info.l1.length);
fprintf(stream,"D-X(%03d) ",n);
for(i=0;i<n && i<maxout;i++)
fprintf(stream,"%02X ",buffer->info.l1.i[i]);
if(n>i) fprintf(stream,"cont");
break;
case 4:
n = SWAP(buffer->info.l1.length);
fprintf(stream,"D-R(%03d) ",n);
for(i=0;i<n && i<maxout;i++)
fprintf(stream,"%02X ",buffer->info.l1.i[i]);
if(n>i) fprintf(stream,"cont");
break;
case 5:
n = SWAP(buffer->info.l2.length);
fprintf(stream,"SIG-EVENT(%03d)%04X - ",n,SWAP(buffer->info.l2.code));
for(i=0;i<n && i<maxout;i++)
fprintf(stream,"%02X ",buffer->info.l2.i[i]);
if(n>i) fprintf(stream,"cont");
break;
case 6:
code = SWAP(buffer->info.l2.code);
if(code && code <= 13)
fprintf(stream,"%s IND",ll_name[code-1]);
else
fprintf(stream,"UNKNOWN LL IND");
break;
case 7:
code = SWAP(buffer->info.l2.code);
if(code && code <= 13)
fprintf(stream,"%s REQ",ll_name[code-1]);
else
fprintf(stream,"UNKNOWN LL REQ");
break;
case 8:
n = SWAP(buffer->info.l2.length);
fprintf(stream,"DEBUG%04X - ",SWAP(buffer->info.l2.code));
for(i=0;i<n && i<maxout;i++)
fprintf(stream,"%02X ",buffer->info.l2.i[i]);
if(n>i) fprintf(stream,"cont");
break;
case 9:
fprintf(stream,"MDL-ERROR(%s)",buffer->info.text);
break;
case 10:
fprintf(stream,"UTASK->PC(%02X)",SWAP(buffer->info.l2.code));
break;
case 11:
fprintf(stream,"PC->UTASK(%02X)",SWAP(buffer->info.l2.code));
break;
case 12:
n = SWAP(buffer->info.l1.length);
fprintf(stream,"X-X(%03d) ",n);
for(i=0;i<n && i<maxout;i++)
fprintf(stream,"%02X ",buffer->info.l1.i[i]);
if(n>i) fprintf(stream,"cont");
break;
case 13:
n = SWAP(buffer->info.l1.length);
fprintf(stream,"X-R(%03d) ",n);
for(i=0;i<n && i<maxout;i++)
fprintf(stream,"%02X ",buffer->info.l1.i[i]);
if(n>i) fprintf(stream,"cont");
break;
case 14:
code = SWAP(buffer->info.l2.code)-1;
if((code &0x0f)<=12)
fprintf(stream,"%s IND",ns_name[code &0x0f]);
else
fprintf(stream,"UNKNOWN NS IND");
break;
case 15:
code = SWAP(buffer->info.l2.code)-1;
if((code & 0x0f)<=12)
fprintf(stream,"%s REQ",ns_name[code &0x0f]);
else
fprintf(stream,"UNKNOWN NS REQ");
break;
case 16:
fprintf(stream,"TASK %02i: %s",
SWAP(buffer->info.l2.code),buffer->info.l2.i);
break;
case 18:
code = SWAP(buffer->info.l2.code);
fprintf(stream,"IO-REQ %02x",code);
break;
case 19:
code = SWAP(buffer->info.l2.code);
fprintf(stream,"IO-CON %02x",code);
break;
case 20:
code = SWAP(buffer->info.l2.code);
if ( ZERO_BASED_INDEX_VALID(code,l1_name) )
fprintf(stream, l1_name[code]);
else
fprintf(stream, "UNKNOWN L1 STATE (0x%04x)", code);
break;
case 21:
for(i=0;i<(word)SWAP(buffer->info.l2.length);i++)
message.info[message.length++] = buffer->info.l2.i[i];
if(SWAP(buffer->info.l2.code)) {
switch(SWAP(buffer->info.l2.code) &0xff) {
case 1:
xlog_sig(stream,&message);
break;
default:
fprintf(stream,"MSG%04X - ",SWAP(buffer->info.l2.code));
for(i=0;i<message.length;i++)
fprintf(stream,"%02X ",message.info[i]);
break;
}
message.length = 0;
}
else {
fprintf(stream,"MORE");
}
break;
case 22:
for(i=0;i<(word)SWAP(buffer->info.l2.length);i++)
message.info[message.length++] = buffer->info.l2.i[i];
if(SWAP(buffer->info.l2.code)) {
switch(SWAP(buffer->info.l2.code) &0xff) {
case 1:
call_failed_event(stream, &message, SWAP(buffer->info.l2.code));
break;
case 2:
spid_event(stream, &message, SWAP(buffer->info.l2.code));
break;
default:
fprintf(stream,"EVENT%04X - ",SWAP(buffer->info.l2.code));
for(i=0;i<message.length;i++)
fprintf(stream,"%02X ",message.info[i]);
break;
}
message.length = 0;
}
else {
fprintf(stream,"MORE");
}
break;
case 23:
fprintf(stream,"EYE");
for(i=0; i<(word)SWAP(buffer->info.l1.length); i+=2) {
fprintf(stream," %02x%02x",buffer->info.l1.i[i+1],buffer->info.l1.i[i]);
}
break;
case 24:
fprintf(stream, buffer->info.text);
break;
case 50:
/*--- register dump comes in two blocks, each 80 Bytes long. Print
--- content after second part has been arrived */
if (0 == ((byte)(SWAP(buffer->code)>>8))) /* first part */
{
for (i=0; i<20; i++)
((dword far *)(&xcp.sr))[i] = ((dword far *)&buffer->info.text)[i];
fprintf(stream,"Register Dump part #1 received.");
break; /* wait for next */
}
for (i=0; i<20; i++)
((dword far *)(&xcp.sr))[i+20] = ((dword far *)&buffer->info.text)[i];
fprintf(stream,"Register Dump part #2 received, printing now:\n");
fprintf(stream,"CPU Exception Class: %04x Code:",(int) xcp.xclass);
switch ((xcp.cr &0x0000007c) >> 2)
{
case XCPTINTR: fprintf(stream,"interrupt "); break;
case XCPTMOD: fprintf(stream,"TLB mod /IBOUND "); break;
case XCPTTLBL: fprintf(stream,"TLB load /DBOUND "); break;
case XCPTTLBS: fprintf(stream,"TLB store "); break;
case XCPTADEL: fprintf(stream,"Address error load "); break;
case XCPTADES: fprintf(stream,"Address error store "); break;
case XCPTIBE: fprintf(stream,"Instruction load bus error "); break;
case XCPTDBE: fprintf(stream,"Data load/store bus error "); break;
case XCPTSYS: fprintf(stream,"Syscall "); break;
case XCPTBP: fprintf(stream,"Breakpoint "); break;
case XCPTCPU: fprintf(stream,"Coprocessor unusable "); break;
case XCPTRI: fprintf(stream,"Reverd instruction "); break;
case XCPTOVF: fprintf(stream,"Overflow "); break;
case 23: fprintf(stream,"WATCH "); break;
default: fprintf(stream,"Unknown Code "); break;
}
fprintf(stream,"\n");
fprintf(stream,"sr = %08lx\t",xcp.sr);
fprintf(stream,"cr = %08lx\t",xcp.cr);
fprintf(stream,"epc = %08lx\t",xcp.epc);
fprintf(stream,"vadr= %08lx\n",xcp.vaddr);
fprintf(stream,"zero= %08lx\t",xcp.regs[0]);
fprintf(stream,"at = %08lx\t",xcp.regs[1]);
fprintf(stream,"v0 = %08lx\t",xcp.regs[2]);
fprintf(stream,"v1 = %08lx\n",xcp.regs[3]);
fprintf(stream,"a0 = %08lx\t",xcp.regs[4]);
fprintf(stream,"a1 = %08lx\t",xcp.regs[5]);
fprintf(stream,"a2 = %08lx\t",xcp.regs[6]);
fprintf(stream,"a3 = %08lx\n",xcp.regs[7]);
fprintf(stream,"t0 = %08lx\t",xcp.regs[8]);
fprintf(stream,"t1 = %08lx\t",xcp.regs[9]);
fprintf(stream,"t2 = %08lx\t",xcp.regs[10]);
fprintf(stream,"t3 = %08lx\n",xcp.regs[11]);
fprintf(stream,"t4 = %08lx\t",xcp.regs[12]);
fprintf(stream,"t5 = %08lx\t",xcp.regs[13]);
fprintf(stream,"t6 = %08lx\t",xcp.regs[14]);
fprintf(stream,"t7 = %08lx\n",xcp.regs[15]);
fprintf(stream,"s0 = %08lx\t",xcp.regs[16]);
fprintf(stream,"s1 = %08lx\t",xcp.regs[17]);
fprintf(stream,"s2 = %08lx\t",xcp.regs[18]);
fprintf(stream,"s3 = %08lx\n",xcp.regs[19]);
fprintf(stream,"s4 = %08lx\t",xcp.regs[20]);
fprintf(stream,"s5 = %08lx\t",xcp.regs[21]);
fprintf(stream,"s6 = %08lx\t",xcp.regs[22]);
fprintf(stream,"s7 = %08lx\n",xcp.regs[23]);
fprintf(stream,"t8 = %08lx\t",xcp.regs[24]);
fprintf(stream,"t9 = %08lx\t",xcp.regs[25]);
fprintf(stream,"k0 = %08lx\t",xcp.regs[26]);
fprintf(stream,"k1 = %08lx\n",xcp.regs[27]);
fprintf(stream,"gp = %08lx\t",xcp.regs[28]);
fprintf(stream,"sp = %08lx\t",xcp.regs[29]);
fprintf(stream,"s8 = %08lx\t",xcp.regs[30]);
fprintf(stream,"ra = %08lx\n",xcp.regs[31]);
fprintf(stream,"mdlo= %08lx\t",xcp.mdlo);
fprintf(stream,"mdhi= %08lx\n",xcp.mdhi);
break;
case 128:
case 129:
n = SWAP(buffer->info.l1.length);
if(SWAP(buffer->code)==128) fprintf(stream,"CAPI20_PUT(%03d) ",n);
else fprintf(stream,"CAPI20_GET(%03d) ",n);
fprintf(stream,"APPL %02x%02x ", buffer->info.l1.i[1], buffer->info.l1.i[0]);
fprintf(stream,"%02x%02x:%02x%02x%02x%02x ",
buffer->info.l1.i[5], buffer->info.l1.i[4],
buffer->info.l1.i[9], buffer->info.l1.i[8],
buffer->info.l1.i[7], buffer->info.l1.i[6]);
for(i=0;i<15 && buffer->info.l1.i[2]!=capi20_command[i].code;i++);
if(i<15) fprintf(stream,"%s ",capi20_command[i].name);
else fprintf(stream,"CMD(%x) ",buffer->info.l1.i[2]);
for(i=0;i<4 && buffer->info.l1.i[3]!=capi20_subcommand[i].code;i++);
if(i<4) fprintf(stream,"%s",capi20_subcommand[i].name);
else fprintf(stream,"SUB(%x)",buffer->info.l1.i[3]);
fprintf(stream,"\n ");
for(i=10;i<n-2;i++)
fprintf(stream,"%02X ",buffer->info.l1.i[i]);
break;
case 130:
case 131:
n = SWAP(buffer->info.l1.length);
if(SWAP(buffer->code)==130) fprintf(stream,"CAPI11_PUT(%03d) ",n);
else fprintf(stream,"CAPI11_GET(%03d) ",n);
fprintf(stream,"APPL %02x%02x ", buffer->info.l1.i[1], buffer->info.l1.i[0]);
fprintf(stream,"%02x%02x:", buffer->info.l1.i[5], buffer->info.l1.i[4]);
for(i=0;i<18 && buffer->info.l1.i[2]!=capi11_command[i].code;i++);
if(i<18) fprintf(stream,"%s ",capi11_command[i].name);
else fprintf(stream,"CMD(%x) ",buffer->info.l1.i[2]);
for(i=0;i<4 && buffer->info.l1.i[3]!=capi11_subcommand[i].code;i++);
if(i<4) fprintf(stream,"%s",capi11_subcommand[i].name);
else fprintf(stream,"SUB(%x)",buffer->info.l1.i[3]);
fprintf(stream,"\n ");
for(i=6;i<n-2;i++)
fprintf(stream,"%02X ",buffer->info.l1.i[i]);
break;
}
fprintf(stream,"\n");
return o;
}
void xlog_sig(FILE * stream, struct msg_s * message)
{
word n;
word i;
word cr;
byte msg;
n = message->length;
msg = TRUE;
switch(SWAP(*(word *)&message->info[0])) {
case 0x0000:
fprintf(stream,"SIG-x(%03i)",n-4);
break;
case 0x0010:
case 0x0013:
fprintf(stream,"SIG-R(%03i)",n-4);
cr ^=0x8000;
break;
case 0x0020:
fprintf(stream,"SIG-X(%03i)",n-4);
break;
default:
fprintf(stream,"SIG-EVENT %04X", SWAP(*(word *)&message->info[0]));
msg = FALSE;
break;
}
for(i=0; (i<n-4) && (n>4); i++)
fprintf(stream," %02X",message->info[4+i]);
fprintf(stream,"\n");
if(msg) display_q931_message(stream, message);
}
void call_failed_event(FILE * stream, struct msg_s * message, word code)
{
fprintf(stream, "EVENT: Call failed in State '%s'\n", sig_state[code>>8]);
switch(SWAP(*(word *)&message->info[0])) {
case 0x0000:
case 0x0010:
case 0x0020:
display_q931_message(stream, message);
break;
case 0xff00:
fprintf(stream," ");
fprintf(stream,"Signaling Timeout %s",sig_timeout[code>>8]);
break;
case 0xffff:
fprintf(stream," ");
fprintf(stream,"Link disconnected");
switch(message->info[4]) {
case 8:
fprintf(stream,", Layer-1 error (cable or NT)");
break;
case 9:
fprintf(stream,", Layer-2 error");
break;
case 10:
fprintf(stream,", TEI error");
break;
}
break;
}
}
void display_q931_message(FILE * stream, struct msg_s * message)
{
word i;
word cr;
word p;
word w;
word wlen;
byte codeset,lock;
fprintf(stream," ");
cr = 0;
/* read one byte call reference */
if(message->info[5]==1) {
cr = message->info[6] &0x7f;
}
/* read two byte call reference */
if(message->info[5]==2) {
cr = message->info[7];
cr += (message->info[6] &0x7f)<<8;
}
/* read call reference flag */
if(message->info[5]) {
if(message->info[6] &0x80) cr |=0x8000;
}
for(i=0;i<PD_MAX && message->info[4]!=pd[i].code;i++);
if(i<PD_MAX) fprintf(stream,"%sCR%04x ",pd[i].name,cr);
else fprintf(stream,"PD(%02xCR%04x) ",message->info[4],cr);
p = 6+message->info[5];
for(i=0;i<MT_MAX && message->info[p]!=mt[i].code;i++);
if(i<MT_MAX) fprintf(stream,"%s",mt[i].name);
else fprintf(stream,"MT%02x",message->info[p]);
p++;
codeset = 0;
lock = 0;
while(p<message->length) {
fprintf(stream,"\n ");
/* read information element id and length */
w = message->info[p];
if(w & 0x80) {
w &=0xf0;
wlen = 1;
}
else {
wlen = message->info[p+1]+2;
}
if(lock & 0x80) lock &=0x7f;
else codeset = lock;
if(w==0x90) {
codeset = message->info[p];
if(codeset &8) fprintf(stream,"SHIFT %02x",codeset &7);
else fprintf(stream,"SHIFT LOCK %02x",codeset &7);
if(!(codeset & 0x08)) lock = (byte)(codeset & 7);
codeset &=7;
lock |=0x80;
}
else {
w |= (codeset<<8);
for(i=0;i<IE_MAX && w!=ie[i].code;i++);
if(i<IE_MAX) fprintf(stream,"%s",ie[i].name);
else fprintf(stream,"%01x/%02x ",codeset,(byte)w);
if((p+wlen) > message->length) {
fprintf(stream,"IE length error");
}
else {
if(wlen>1) display_ie(stream,message->info[4],w,&message->info[1+p]);
}
}
/* check if length valid (not exceeding end of packet) */
p+=wlen;
}
}
void display_ie(FILE * stream, byte pd, word w, byte * ie)
{
word i;
switch(w) {
case 0x08:
for(i=0;i<ie[0];i++) fprintf(stream," %02x",ie[1+i]);
switch(pd) {
case 0x08:
for(i=0; i<ie[0] && !(ie[1+i]&0x80); i++);
fprintf(stream, " '%s'",cau_q931[ie[2+i]&0x7f]);
break;
case 0x41:
if(ie[0]) fprintf(stream, " '%s'",cau_1tr6[ie[1]&0x7f]);
else fprintf(stream, " '%s'",cau_1tr6[0]);
break;
}
break;
case 0x0c:
case 0x6c:
case 0x6d:
case 0x70:
case 0x71:
for(i=0; i<ie[0] && !(ie[1+i]&0x80); i++)
fprintf(stream, " %02x",ie[1+i]);
fprintf(stream, " %02x",ie[1+i++]);
fprintf(stream," '");
for( ; i<ie[0]; i++) fprintf(stream, "%c",ie[1+i]);
fprintf(stream,"'");
break;
case 0x2c:
case 0x603:
fprintf(stream," '");
for(i=0 ; i<ie[0]; i++) fprintf(stream, "%c",ie[1+i]);
fprintf(stream,"'");
break;
default:
for(i=0;i<ie[0];i++) fprintf(stream," %02x",ie[1+i]);
break;
}
}
void spid_event(FILE * stream, struct msg_s * message, word code)
{
word i;
switch(code>>8) {
case 1:
fprintf(stream, "EVENT: SPID rejected");
break;
case 2:
fprintf(stream, "EVENT: SPID accepted");
break;
case 3:
fprintf(stream, "EVENT: Timeout, resend SPID");
break;
case 4:
fprintf(stream, "EVENT: Layer-2 failed, resend SPID");
break;
case 5:
fprintf(stream, "EVENT: Call attempt on inactive SPID");
break;
}
fprintf(stream, " '");
for(i=0;i<message->info[0];i++) fprintf(stream,"%c",message->info[1+i]);
fprintf(stream, "'");
}

File diff suppressed because it is too large Load Diff

View File

@ -8,9 +8,9 @@
.\"
.TH EICONCTRL 8 "@MANDATE@" eiconctrl-V1.1 "Linux System Administration"
.SH NAME
eiconctrl \- configure Eicon active ISDN adaptor
eiconctrl \- configure Eicon active ISDN card
.SH SYNOPSIS
.B eiconctrl [-v] [-d
.B eiconctrl [-d
.IB Driver-Id ]
.I action options
.B ...
@ -28,9 +28,6 @@ makes sense, if you are using an active Eicon ISDN card only.
.LP
.SH OPTIONS
.TP
.BI -v
verbose during downloading the firmware.
.TP
.BI "-d " Driver-Id
selects the S0/S2M interface named by
.IR Driver-Id .
@ -69,7 +66,7 @@ may be given to
sets the irq number to use (only ISA).
If the interrupt value is omitted, the current setting will be printed.
.TP
.BI "load " protocol " " [options]
.BI "load " -f " protocol " " [options]
Downloads the protocol- and dsp-code into the card and starts operation.
.LP
.RS
@ -86,23 +83,12 @@ Downloads the protocol- and dsp-code into the card and starts operation.
.RS
.BR options
.br
.BR -l[channel#] " channel allocation policy"
.br
.BR -c[1|2] " CRC4 Multiframe usage [off|on]"
.br
.BR -tTEI " use the fixed TEI"
.br
.BR -h " no HSCX 30 mode (PRI only)"
.br
.BR -n " NT2 mode"
.br
.BR -p " leased line D channel"
.br
.BR -s[1|2] " LAPD layer 2 session strategy"
.br
.BR -o " allow disordered info elements"
.br
.BR -z " switch to loopback mode"
For options see
.I eiconctrl
without any parameters for ISA cards
and
.I eiconctrl divaload -h
for PCI cards.
.br
.RE
.LP
@ -123,10 +109,10 @@ Switch trace-information for isdnlog on/off.
.LP
.SH EXAMPLE
.TP
.BI eiconctrl " load etsi"
.BI eiconctrl " load -f etsi"
loads and starts S0 type adapter with protocol E-DSS1.
.TP
.BI eiconctrl " load etsi -s2 -n"
.BI eiconctrl " load -f etsi -s2 -n"
loads and starts S2M type adapter with protocol E-DSS1.
.LP
.SH BUGS

Binary file not shown.

56
eicon/linuxcfg.c Normal file
View File

@ -0,0 +1,56 @@
/* $Id$
*
* Eicon-ISDN driver for Linux. (Config)
*
* Copyright 1999 by Armin Schindler (mac@melware.de)
* Copyright 1999 Cytronics & Melware (info@melware.de)
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
*
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <linux/types.h>
#include <linux/isdn.h>
#include <eicon.h>
int Divas_ioctl(int fd, int req, void * p)
{
int ret = 0;
int newreq = 0;
isdn_ioctl_struct iioctl_s;
/* ret = ioctl(fd, req, p); */
newreq = req + EICON_IOCTL_DIA_OFFSET + IIOCDRVCTL;
iioctl_s.drvid[0] = '\0';
iioctl_s.arg = (ulong)p;
ret = ioctl(fd, newreq, &iioctl_s);
return(ret);
}

44
eicon/linuxcfg.h Normal file
View File

@ -0,0 +1,44 @@
/* $Id$
*
* Eicon-ISDN driver for Linux. (Config)
*
* Copyright 2000 by Armin Schindler (mac@melware.de)
* Copyright 2000 Cytronics & Melware (info@melware.de)
*
* 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, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log$
*
*/
#ifdef EICONCTRL
/* config for native eicon driver with I4L */
#define main(a,b) Divaload_main(a,b)
#define DIVAS_DEVICE "/dev/isdnctrl"
#define ioctl(a,b,c) Divas_ioctl(a,b,c)
extern int Divas_ioctl(int, int, void *);
#else
/* config for standalone */
#define DIVAS_DEVICE "/dev/Divas"
#endif