First checkin, not complete, for Armin only.

This commit is contained in:
fritz 1998-06-12 11:11:42 +00:00
parent 54d5a07cc8
commit a4133bb51d
7 changed files with 2340 additions and 0 deletions

73
diehl/Makefile.in Normal file
View File

@ -0,0 +1,73 @@
# $Id: Makefile.in,v 1.1 1998/06/12 11:11:42 fritz Exp $
#
# Makefile for diehlctrl
# (C) 1997 Fritz Elfert
#
#
SHELL = /bin/sh
CFLAGS = -Wall -O2
INCLUDES = -I. -I@CONFIG_KERNELDIR@/include -I@CONFIG_KERNELDIR@/drivers/isdn/diehl
DEFS =
LDFLAGS = -L../lib @LIBS@
PROGRAM = diehlctrl
MODULES = diehlctrl.o
MANPAGE = diehlctrl.8
INSTALL = @INSTALL@
SBINDIR = @CONFIG_SBINDIR@
DATADIR = @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 =
ifeq ("@CONFIG_DIEHLCTRL_DEBUG@","y")
COPTS += -D__DEBUGVAR__
endif
.SUFFIXES:
.SUFFIXES: .c .o
%.o: %.c Makefile
$(CC) $(CFLAGS) $(INCLUDES) $(DEFS) $(COPTS) -c -o $@ $<
all: $(PROGRAM)
config:
@./configure
Makefile: Makefile.in config.status
./config.status
config.status: configure
./config.status --recheck
$(PROGRAM): $(MODULES)
$(CC) $(CFLAGS) $(INCLUDES) $(DEFS) $? $(LDFLAGS) -o $@
install-data:
mkdir -p $(DATADIR)
#$(INSTALL_DATA) firmware/loadpg.bin $(DATADIR)/loadpg.bin
#$(INSTALL_DATA) firmware/pc_eu_ca.bin $(DATADIR)/pc_eu_ca.bin
#$(INSTALL_DATA) firmware/pc_1t_ca.bin $(DATADIR)/pc_1t_ca.bin
install-man: $(PROGRAM).man
mkdir -p $(MAN8DIR)
$(INSTALL_MAN) $< $(MAN8DIR)/$(MANPAGE)
install: $(PROGRAM) install-man install-data
$(INSTALL_PROGRAM) $(PROGRAM) $(SBINDIR)/$(PROGRAM)
install-strip: $(PROGRAM)
$(INSTALL_PROGRAM) -s $(PROGRAM) $(SBINDIR)/$(PROGRAM)
uninstall:
rm -f $(SBINDIR)/$(PROGRAM) $(MAN8DIR)/$(MANPAGE)
clean:
rm -f *.o *~ $(PROGRAM)
distclean: clean
rm -f config.status config.cache config.log Makefile diehlctrl.man

41
diehl/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,41 @@
dnl
dnl Try finding linux sourcetree
dnl
AC_DEFUN(AC_FIND_KERNEL, [
OLD_CPPFLAGS="$CPPFLAGS"
lxdir="no"
eval tst_kerneldir=$CONFIG_KERNELDIR
AC_ARG_WITH(kernel,
[ --with-kernel=DIR Set kernel source directory [/usr/src/linux]],
DOTEST="y"; tst_kerneldir="${withval}")
if test "$DOTEST" = "y" || test "$CONFIG_KERNELDIR" != "" ; then
AC_MSG_CHECKING([for linux kernel source in ${tst_kerneldir}])
CPPFLAGS="-nostdinc -I${tst_kerneldir}/drivers/isdn"
AC_TRY_CPP([#include <isdn_common.h>], lxdir=${tst_kerneldir},
AC_MSG_RESULT("no"))
fi
if test "$lxdir" = "no" ; then
AC_MSG_CHECKING([for linux kernel source in /usr/src/linux])
CPPFLAGS="-nostdinc -I/usr/src/linux/drivers/isdn"
AC_TRY_CPP([#include <isdn_common.h>], lxdir=/usr/src/linux)
fi
if test "$lxdir" = "no" ; then
AC_MSG_RESULT("$lxdir")
AC_MSG_CHECKING([for linux kernel source in /usr/local/src/linux])
CPPFLAGS="-nostdinc -I/usr/local/src/linux/drivers/isdn"
AC_TRY_CPP([#include <isdn_common.h>], lxdir=/usr/local/src/linux)
fi
if test "$lxdir" != "no" ; then
AC_MSG_RESULT("yes")
else
lxdir=""
AC_MSG_ERROR("Kernel source not found. You MUST specify a correct path to the linux source in the configuration.")
fi
CONFIG_KERNELDIR="$lxdir"
CPPFLAGS="$OLD_CPPFLAGS"
AC_DEFINE_UNQUOTED(CONFIG_KERNELDIR,"$lxdir")
AC_SUBST(CONFIG_KERNELDIR)
])

1809
diehl/configure vendored Executable file

File diff suppressed because it is too large Load Diff

73
diehl/configure.in Normal file
View File

@ -0,0 +1,73 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(diehlctrl.c)
AC_PREFIX_DEFAULT("/usr")
I4LVERSION=${I4LVERSION:-"?.?"}
CONFIG_DATADIR=${CONFIG_DATADIR:-"/usr/lib/isdn"}
CONFIG_SBINDIR=${CONFIG_SBINDIR:-"/sbin"}
CONFIG_MANDIR=${CONFIG_MANDIR:-"/usr/man"}
CONFIG_DIEHLCTRL_DEBUG=${CONFIG_DIEHLCTRL_DEBUG:-"n"}
CONFIG_KERNELDIR=`eval echo ${CONFIG_KERNELDIR:-"/usr/src/linux"}`
MANDATE=`grep CHECKIN diehlctrl.man.in | awk '{print $4}'`
dnl Checks for programs.
AC_PROG_INSTALL
AC_PROG_CC
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h)
dnl Find current kernel source
AC_FIND_KERNEL
AC_CHECK_HEADERS($CONFIG_KERNELDIR/include/linux/isdn.h,,
AC_MSG_ERROR("$CONFIG_KERNELDIR/include/linux/isdn.h missing. Kernel installed?")
)
AC_CHECK_HEADERS($CONFIG_KERNELDIR/drivers/isdn/diehl/diehl.h,,
AC_MSG_ERROR("$CONFIG_KERNELDIR/drivers/isdn/diehl/diehl.h missing. Kernel installed?")
)
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MMAP
dnl Optional firmware directory
AC_ARG_WITH(firmware,
[ --with-firmware=DIR Set dir where firmware istalled. [/usr/lib/isdn]],
CONFIG_DATADIR="${withval}"
AC_DEFINE(CONFIG_DATADIR,"${withval}"),
)
dnl Optional sbin directory
AC_ARG_WITH(sbin,
[ --with-sbin=DIR Set dir where binary is istalled. [/sbin]],
CONFIG_SBINDIR="${withval}"
AC_DEFINE(CONFIG_SBINDIR,"${withval}"),
)
dnl Optional man directory
AC_ARG_WITH(man,
[ --with-man=DIR Set manpage dir. [/usr/man]],
CONFIG_MANDIR="${withval}"
AC_DEFINE(CONFIG_MANDIR,"${withval}"),
)
dnl Check, if user wants dump option for debugging
AC_ARG_ENABLE(dump,
[ --enable-dump Enable dump feature for debugging [no]],
CONFIG_DIEHLCTRL_DEBUG="y"
)
AC_SUBST(INSTALL)
AC_SUBST(MANDATE)
AC_SUBST(CONFIG_DIEHLCTRL_DEBUG)
AC_SUBST(CONFIG_DATADIR)
AC_SUBST(CONFIG_KERNELDIR)
AC_SUBST(CONFIG_SBINDIR)
AC_SUBST(CONFIG_MANDIR)
AC_SUBST(I4LVERSION)
AC_OUTPUT(Makefile diehlctrl.man)

188
diehl/diehlctrl.c Normal file
View File

@ -0,0 +1,188 @@
/* $Id: diehlctrl.c,v 1.1 1998/06/12 11:11:45 fritz Exp $
*
* Diehl-ISDN driver for Linux. (Control-Utility)
*
* Copyright 1998 by Fritz Elfert (fritz@wuemaus.franken.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: diehlctrl.c,v $
* Revision 1.1 1998/06/12 11:11:45 fritz
* First checkin, not complete, for Armin only.
*
*/
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <malloc.h>
#include <linux/isdn.h>
#include <diehl.h>
char *cmd;
void usage() {
fprintf(stderr,"usage: %s shmem [shmem-addr] (get/set memaddr)\n",cmd);
fprintf(stderr," or: %s irq [irq-nr] (get/set irq)\n",cmd);
fprintf(stderr," or: %s load <bootcode> <protocol> (load firmware)\n",cmd);
exit(-1);
}
int main(int argc, char **argv) {
int fd;
int tmp;
int ac;
int arg_ofs;
isdn_ioctl_struct ioctl_s;
cmd = argv[0];
if (argc > 1) {
if (!strcmp(argv[1], "-d")) {
strcpy(ioctl_s.drvid, argv[2]);
arg_ofs = 3;
} else {
ioctl_s.drvid[0] = '\0';
arg_ofs = 1;
}
} else
usage();
ac = argc - (arg_ofs - 1);
if (ac < 2)
usage();
fd = open("/dev/isdnctrl",O_RDWR);
if (fd < 0) {
perror("/dev/isdnctrl");
exit(-1);
}
if (!strcmp(argv[arg_ofs], "shmem")) {
if (ac == 3) {
if (sscanf(argv[arg_ofs + 1], "%i", &tmp) !=1 )
usage();
ioctl_s.arg = tmp;
if (ioctl(fd, DIEHL_IOCTL_SETMMIO + IIOCDRVCTL, &ioctl_s) < 0) {
perror("ioctl SETMMIO");
exit(-1);
}
}
if ((tmp = ioctl(fd, DIEHL_IOCTL_GETMMIO + IIOCDRVCTL, &ioctl_s)) < 0) {
perror("ioctl GETMMIO");
exit(-1);
}
printf("Shared memory at 0x%08lx\n", (unsigned long)tmp);
close(fd);
return 0;
}
if (!strcmp(argv[arg_ofs], "irq")) {
if (ac == 3) {
if (sscanf(argv[arg_ofs + 1], "%i", &tmp) != 1)
usage();
ioctl_s.arg = tmp;
if (ioctl(fd, DIEHL_IOCTL_SETIRQ + IIOCDRVCTL, &ioctl_s) < 0) {
perror("ioctl SETIRQ");
exit(-1);
}
}
if ((tmp = ioctl(fd, DIEHL_IOCTL_GETIRQ + IIOCDRVCTL, &ioctl_s)) < 0) {
perror("ioctl GETIRQ");
exit(-1);
}
printf("Irq is %d\n", tmp);
close(fd);
return 0;
}
if (!strcmp(argv[arg_ofs], "load")) {
FILE *code;
int plen;
char protoname[1024];
char bootname[1024];
u_char protobuf[0x100000];
u_char bootbuf[0x1000];
diehl_codebuf *cb;
if (ac == 4) {
strcpy(bootname, argv[arg_ofs + 1]);
strcpy(protoname,argv[arg_ofs + 2]);
if ((tmp = ioctl(fd,DIEHL_IOCTL_GETTYPE + IIOCDRVCTL, &ioctl_s)) < 1) {
perror("ioctl GETTYPE");
exit(-1);
}
switch (tmp) {
case DIEHL_CTYPE_S:
strcat(bootname,".bin");
printf("Adapter-type is Diehl-S\n");
break;
case DIEHL_CTYPE_SX:
strcat(protoname,".sx");
printf("Adapter-type is Diehl-SX\n");
break;
case DIEHL_CTYPE_SCOM:
strcat(protoname,".sy");
printf("Adapter-type is Diehl-SCOM\n");
break;
case DIEHL_CTYPE_QUADRO:
strcat(protoname,".sq");
printf("Adapter-type is Diehl-QUADRO\n");
break;
case DIEHL_CTYPE_PRI:
strcat(protoname,".p");
printf("Adapter-type is Diehl-PRI\n");
break;
default:
fprintf(stderr, "Unknown Adapter type %d\n", tmp);
exit(-1);
}
if (!(code = fopen(protoname,"r"))) {
perror(protoname);
exit(-1);
}
if ((plen = fread(protobuf, 1, sizeof(protobuf), code))<1) {
fprintf(stderr, "Read error on %s\n", protoname);
exit(-1);
}
plen = (plen % 256)?((plen/256)+1)*256:plen;
fclose(code);
if (!(code = fopen(bootname,"r"))) {
perror(bootname);
exit(-1);
}
if ((tmp = fread(bootbuf, 1, sizeof(bootbuf), code))<1) {
fprintf(stderr, "Read error on %s\n", bootname);
exit(-1);
}
fclose(code);
cb = malloc(sizeof(diehl_codebuf) + tmp + plen );
memset(cb, 0, sizeof(diehl_codebuf));
memcpy(&cb->isa.code, bootbuf, tmp);
memcpy(&cb->isa.code[tmp], protobuf, plen);
cb->isa.bootstrap_len = tmp;
cb->isa.firmware_len = plen;
cb->isa.boot_opt = DIEHL_ISA_BOOT_MEMCHK;
printf("Loading Protocol %s ...\n", &protobuf[4]);
ioctl_s.arg = (ulong)cb;
if (ioctl(fd, DIEHL_IOCTL_LOADBOOT + IIOCDRVCTL, &ioctl_s) < 0) {
perror("ioctl LOADBOOT");
exit(-1);
}
close(fd);
return 0;
}
usage();
}
return 0;
}

154
diehl/diehlctrl.man.in Normal file
View File

@ -0,0 +1,154 @@
.\" $Id: diehlctrl.man.in,v 1.1 1998/06/12 11:11:46 fritz Exp $
.\"
.\" CHECKIN $Date: 1998/06/12 11:11:46 $
.\"
.\" Process this file with
.\" groff -man -Tascii diehlctrl.1 for ASCII output, or
.\" groff -man -Tps diehlctrl.1 for PostScript output
.\"
.TH DIEHLCTRL 8 "@MANDATE@" isdn4k-utils-@I4LVERSION@ "Linux System Administration"
.SH NAME
diehlctrl \- configure Diehl active ISDN adaptor
.SH SYNOPSIS
.B diehlctrl [-d
.IB Driver-Id ]
.I action options
.B ...
.SH DESCRIPTION
.B diehlctrl
is used to setup the Diehl
.SM ISDN
device driver and for downloading the firmware into the
.SM ISDN
card.
.LP
The use of
.I diehlctrl
makes sense, if you are using an active Diehl ISDN card only.
.LP
.SH OPTIONS
.TP
.BI "-d " Driver-Id
selects the S0 interface named by
.IR Driver-Id .
Driver-Ids are defined during driver initialisation. See
.BR diehl (4)
for a description of the syntax to be used for modularised and
monolithic driver versions.
This option
.B must
be used to identify the S0 interface if more than one S0 interface is
existent. If a single card is used, it may be omitted.
If using more than one card, support for the other cards is enabled
with the
.B add
action of diehlctrl. Ids may
.B not
start with
.B digits
or small
.BR x ,
because these values are misinterpreted
as numeric parameters by
.BR insmod .
For loading the module, always the
newest
.B modutils
package should be used to avoid problems during load.
.LP
The following
.I actions
may be given to
.BR diehlctrl .
.TP
.BI "irq [" "interrupt" ]
sets the irq number to use.
After loading the diehl-module into kernel-space, this command
should be used as the very first setup, if the hardware settings are
different from the default settings below.
If both parameters are omitted, prints out current settings. The
default irq number is
.IR 0x320 .
.TP
.B leased on|1|2|off
switches between normal (dialup) and leased-line mode. Leased-line mode
is intended for usage with S64K-lines or - if both channels are used -
for S02. If the second parameter is
.B 1
, only one channel is enabled.
If the second parameter is
.BR 2 " or " on
both channels are enabled. Leased lines do not have a D-channel. When
leased-line mode is enabled, the driver simulates incoming calls using
special "phone-numbers" for calling and called address which are generated
as follows:
.ie 1
.RS
Calling number:
.RS
.BI LEASED x
.RS
where
.I x
is the internal slot-number of the S0 interface. This number starts with
.I 0
for the first S0 interface and is incremented by one for every S0 interface
configured using the
.B add
action.
.RE
.RE
.ie 1
Called number:
.RS
.I x
.RS
where
.I x
is equal to the channel number of the calling S0 interface starting with
.IR 1 .
.RE
.RE
.RE
.TP
.BI "load " boot-code " " firmware
downloads the firmware into the card and starts operation. The firmware
name
.B must
be given
.B without
extension, since the card-type is determined automatically and according
to this, the appropriate extension is appended by the program. The
following extensions are used for various card-types:
Diehl-S:
.B .bin
Diehl-SX:
.B .sx
Diehl-SCOM:
.B .sy
Diehl-Quadro:
.B .sq
Diehl-PRI
.B .p
Using this command, after loading the diehl-module into kernel-space the
first real access to the hardware is done. Therefore the
.B irq
action above, should be used before, if the hardware settings are different
from the default settings.
Usually the images are located in
.IR @DATADIR@ .
The boot-code is named
.IR prload.bin .
.TP
.B dump
is available if the program is configured using the
.B --enable-dump
option only. The contents of internal driver variables is dumped on stdout.
.LP
.SH BUGS
No bugs so far.
.SH AUTHOR
\(co 1998 by Fritz Elfert <fritz@wuemaus.franken.de>
.LP
.SH SEE ALSO
.BR isdnctrl "(8), " diehl "(4), " isdnctrl "(4), " ttyI (4).

2
diehl/install-sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exit 0