Added actctrl.

This commit is contained in:
fritz 1997-09-25 21:41:36 +00:00
parent d48a901bf4
commit 6ecf3aa59e
7 changed files with 2283 additions and 0 deletions

79
act2000/Makefile.in Normal file
View File

@ -0,0 +1,79 @@
# $Id: Makefile.in,v 1.1 1997/09/25 21:41:36 fritz Exp $
#
# Makefile for actctrl
# (C) 1997 Fritz Elfert
#
#
SHELL = /bin/sh
CFLAGS = -Wall -O2
INCLUDES = -I. @DEBUGVAR@ -I@KERNELDIR@/drivers/isdn/act2000
DEFS =
LDFLAGS = -L../lib @LIBS@
PROGRAM = actctrl
MODULES = actctrl.o
MANPAGE = actctrl.8
FIRMWARE = bip1120.btl
INSTALL = @INSTALL@
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
prefix = @prefix@
exec_prefix = @exec_prefix@
ifeq (../.config,$(wildcard ../.config))
include ../.config
ifeq ($(CONFIG_ACTCTRL_DEBUG),y)
DEFS += -DDEBUGVAR
endif
DATADIR = $(CONFIG_DATADIR)
SBINDIR = $(CONFIG_SBINDIR)
mandir = $(CONFIG_MANDIR)
else
DATADIR = /usr/lib/isdn
SBINDIR = /sbin
mandir = @mandir@
endif
MAN8DIR = $(mandir)/man8
CC = @CC@
.SUFFIXES:
.SUFFIXES: .c .o
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDES) $(DEFS) -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-man: $(PROGRAM).man
mkdir -p $(MAN8DIR)
$(INSTALL_MAN) $< $(MAN8DIR)/$(MANPAGE)
install-data: firmware/$(FIRMWARE)
mkdir -p $(DATADIR)
$(INSTALL_DATA) $< $(DATADIR)/$(FIRMWARE)
install: $(PROGRAM) install-man
$(INSTALL_PROGRAM) $(PROGRAM) $(SBINDIR)/$(PROGRAM)
install-strip: $(PROGRAM)
$(INSTALL_PROGRAM) -s $(PROGRAM) $(SBINDIR)/$(PROGRAM)
uninstall:
rm -f $(SBINDIR)/$(PROGRAM) $(MAN8DIR)/$(MANPAGE) $(DATADIR)/$(FIRMWARE)
clean:
rm -f *.o *~ $(PROGRAM)
distclean: clean
rm -f config.status config.cache config.log Makefile actctrl.man

42
act2000/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,42 @@
dnl
dnl Try finding linux sourcetree
dnl
AC_DEFUN(AC_FIND_KERNEL, [
KERNELDIR=""
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
KERNELDIR="$lxdir"
CPPFLAGS="$OLD_CPPFLAGS"
AC_DEFINE_UNQUOTED(KERNELDIR,"$lxdir")
AC_SUBST(KERNELDIR)
])

283
act2000/actctrl.c Normal file
View File

@ -0,0 +1,283 @@
/* $Id: actctrl.c,v 1.1 1997/09/25 21:41:37 fritz Exp $
* IBM Active 2000 ISDN driver for Linux. (Control-Utility)
*
* Copyright 1994,95 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: actctrl.c,v $
* Revision 1.1 1997/09/25 21:41:37 fritz
* Added actctrl.
*
*
*/
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <linux/isdn.h>
#include "act2000.h"
char *cmd;
char *ctrldev;
int arg_ofs;
void
usage()
{
#if 0
fprintf(stderr, "usage: %s [-d driverId] io [port] [irq] (get/set hw-io)\n", cmd);
#endif
fprintf(stderr, " or: %s [-d driverId] add [bus [port [irq [id]]]] (Add a new card\n", cmd);
fprintf(stderr, " or: %s [-d driverId] load <bootcode> (load firmware)\n", cmd);
fprintf(stderr, " or: %s [-d driverId] dproto <1tr6|euro> [msn's] (set D-channel protocol)\n", cmd);
#if 0
fprintf(stderr, " or: %s [-d driverId] dbg <num> (devel Func)\n", cmd);
#endif
exit(-1);
}
int
main(int argc, char **argv)
{
int fd;
FILE *code;
int ac;
int a;
u_char buf[500000];
isdn_ioctl_struct ioctl_s;
act2000_ddef dload;
act2000_cdef newcard;
cmd = strrchr(argv[0], '/');
cmd = (cmd == NULL) ? argv[0] : ++cmd;
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);
fd = open("/dev/isdnctrl", O_RDWR);
if (fd < 0) {
perror("/dev/isdnctrl");
exit(-1);
}
if (!strcmp(argv[arg_ofs], "add")) {
if (ac < 3)
usage();
if (ac >= 3) {
a = -1;
if (!strcmp(argv[arg_ofs + 1], "isa"))
a = ACT2000_BUS_ISA;
if (!strcmp(argv[arg_ofs + 1], "mca"))
a = ACT2000_BUS_MCA;
if (!strcmp(argv[arg_ofs + 1], "pcmcia"))
a = ACT2000_BUS_PCMCIA;
if (a == -1) {
fprintf(stderr, "Bus must be \"isa\", \"mca\" or \"pcmcia\"\n");
exit(-1);
}
if (a != ACT2000_BUS_ISA) {
fprintf(stderr, "Currently only isa Bus is supported\n");
exit(-1);
}
newcard.bus = a;
}
a = -2;
if (ac >= 4) {
if (!strcmp(argv[arg_ofs + 2], "auto"))
a = -1;
else
sscanf(argv[arg_ofs + 2], "%i", &a);
if (a == 0x200 || a == 0x240 || a == 0x280 || a == 0x2c0
|| a == 0x300 || a == 0x340 || a == 0x380 ||
a == 0xcfe0 || a == 0xcfa0 || a == 0xcf60 || a == 0xcf20
|| a == 0xcee0 || a == 0xcea0 || a == 0xce60 || a == -1)
newcard.port = a;
else {
fprintf(stderr, "Invalid port. Possible values are:\n");
fprintf(stderr, " 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340\n");
fprintf(stderr, " 0x380, 0xcfe0, 0xcfa0, 0xcf60, 0xcf20\n");
fprintf(stderr, " 0xcee0, 0xcea0, 0xce60 or \"auto\"\n");
exit(-1);
}
}
newcard.irq = -1;
if (ac >= 5) {
a = -2;
if (!strcmp(argv[arg_ofs + 3], "auto"))
a = -1;
if (!strcmp(argv[arg_ofs + 3], "none"))
a = 0;
if (a == -2)
sscanf(argv[arg_ofs + 2], "%i", &a);
if (a == 3 || a == 5 || a == 7 || a == 10 || a == 11 || a == 12
|| a == 15 || a == -1 || a == 0)
newcard.irq = a;
else {
fprintf(stderr, "Invalid IRQ. Possible values are:\n");
fprintf(stderr, " 3, 5, 7, 10, 11, 12, 15, \"auto\" or \"none\"\n");
exit(-1);
}
}
ioctl_s.arg = (unsigned long) &newcard;
newcard.id[0] = 0;
if (ac >= 6)
strncpy(newcard.id, argv[arg_ofs + 4], sizeof(newcard.id) - 1);
if ((ioctl(fd, ACT2000_IOCTL_ADDCARD + IIOCDRVCTL, &ioctl_s)) < 0) {
perror("ioctl ADDCARD");
exit(-1);
}
close(fd);
return 0;
}
#if 0
if (!strcmp(argv[arg_ofs], "io")) {
if (ac == 4) {
if (sscanf(argv[arg_ofs + 1], "%i", &mmio) != 1)
usage();
if (sscanf(argv[arg_ofs + 2], "%i", &port) != 1)
usage();
ioctl_s.arg = mmio;
if ((mmio = ioctl(fd, ICN_IOCTL_SETMMIO + IIOCDRVCTL, &ioctl_s)) < 0) {
perror("ioctl SETMMIO");
exit(-1);
}
ioctl_s.arg = port;
if ((port = ioctl(fd, ICN_IOCTL_SETPORT + IIOCDRVCTL, &ioctl_s)) < 0) {
perror("ioctl SETPORT");
exit(-1);
}
}
if ((mmio = ioctl(fd, ICN_IOCTL_GETMMIO + IIOCDRVCTL, &ioctl_s)) < 0) {
perror("ioctl GETMMIO");
exit(-1);
}
if ((port = ioctl(fd, ICN_IOCTL_GETPORT + IIOCDRVCTL, &ioctl_s)) < 0) {
perror("ioctl GETPORT");
exit(-1);
}
printf("Memory-mapped io at 0x%08lx, port 0x%03x\n",
(unsigned long) mmio, (unsigned short) port);
close(fd);
return 0;
}
#endif
if (!strcmp(argv[arg_ofs], "load")) {
if (ac == 3) {
if (!(code = fopen(argv[arg_ofs + 1], "r"))) {
perror(argv[arg_ofs + 1]);
exit(-1);
}
dload.buffer = buf;
if ((dload.length = fread(buf, 1, sizeof(buf), code)) < 1) {
fprintf(stderr, "Read error on %s\n", argv[arg_ofs + 1]);
exit(-1);
}
dload.length -= 32;
dload.buffer += 32;
printf("Loading Firmware %s ... ", argv[arg_ofs + 1]);
fflush(stdout);
ioctl_s.arg = (ulong) & dload;
if (ioctl(fd, ACT2000_IOCTL_LOADBOOT + IIOCDRVCTL, &ioctl_s) < 0) {
perror("\nioctl LOADBOOT");
exit(-1);
}
fclose(code);
printf("done\n");
return 0;
}
usage();
}
if (!strcmp(argv[arg_ofs], "dproto")) {
if (ac >= 3) {
char msnlist[1024];
int proto = -1;
if (strcmp(argv[arg_ofs + 1], "1tr6") == 0)
proto = 0;
if (strcmp(argv[arg_ofs + 1], "euro") == 0)
proto = 1;
if (proto == -1)
usage();
msnlist[0] = '\0';
if (ac > 3) {
if (proto == 0)
usage();
strcpy(msnlist, argv[arg_ofs + 2]);
}
ioctl_s.arg = (ulong)proto;
if (ioctl(fd, ACT2000_IOCTL_SETPROTO + IIOCDRVCTL, &ioctl_s) < 0) {
perror("ioctl SETPROTO");
exit(-1);
}
if (strlen(msnlist)) {
char *p = msnlist;
char m[17];
int i = 0;
char *q;
while ((q = strtok(p, ",")) && (i<10)) {
p = NULL;
if (strlen(q) > 15) {
fprintf(stderr, "MSN may not exceed 15 digits\n");
exit(-1);
}
if (q[0] == '-')
sprintf(m, "%d", i);
else
sprintf(m, "%d%s", i, q);
ioctl_s.arg = (ulong)&m;
if (ioctl(fd, ACT2000_IOCTL_SETMSN + IIOCDRVCTL, &ioctl_s) < 0) {
perror("ioctl SETMSN");
exit(-1);
}
i++;
}
}
return 0;
}
usage();
}
if (!strcmp(argv[arg_ofs], "dbg")) {
if (ac == 3) {
int res;
unsigned long parm;
res = sscanf(argv[arg_ofs + 1], "%li", &parm);
if (res != 1) {
fprintf(stderr, "Couldn't read parameter\n");
exit(-1);
}
ioctl_s.arg = parm;
if (ioctl(fd, ACT2000_IOCTL_TEST + IIOCDRVCTL, &ioctl_s) < 0) {
perror("ioctl TEST");
exit(-1);
}
return 0;
}
usage();
}
usage();
return 0;
}

121
act2000/actctrl.man.in Normal file
View File

@ -0,0 +1,121 @@
.\" $Id: actctrl.man.in,v 1.1 1997/09/25 21:41:38 fritz Exp $
.\"
.\" CHECKIN $Date: 1997/09/25 21:41:38 $
.\"
.\" Process this file with
.\" groff -man -Tascii actctrl.1 for ASCII output, or
.\" groff -man -Tps actctrl.1 for PostScript output
.\"
.TH ACTCTRL 8 "@MANDATE@" isdn4k-utils-@I4LVERSION@ "Linux System Administration"
.SH NAME
actctrl \- configure IBM Active 2000 ISDN adaptor
.SH SYNOPSIS
.B actctrl [-d
.IB Driver-Id ]
.I action options
.B ...
.SH DESCRIPTION
.B actctrl
is used to setup the IBM Active 2000
.SM ISDN
device driver and for downloading the firmware into the
.SM ISDN
card.
.LP
The use of
.I actctrl
makes sense, if you are using an IBM Active 2000 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 act2000 (4)
for a description of the syntax to be used for modularized 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 IBM Active 2000 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 actctrl. 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 actctrl .
.TP
.BI "add [" bus "[ " port "[ " irq "[ " id ]]]]
enables support for an additional card in the driver.
.I bus
is is an integer describing the bus-type of the card. Currently,
the only value which is allowed here is
.B 1
meaning ISA-bus. In the future, the values
.B 2
(for MCA) and
.B 3
(for PCMCIA) will be available.
.I port
is either an integer describing the base port, or the string
.B auto
which enables autoprobing.
.I irq
is either an integer describing the IRQ to use, the string
.BR auto ,
which enables grabbing of the next free IRQ or the string
.B none
which enables polled mode for this card.
.I id
is an arbitrary string for referencing the card at a later time.
.TP
.BI "dproto " protocol " [" msn0 , msn1 ", ... " msn9 ]
selects the D-channel protocol and defines MSN's if using Euro protocol.
.I protocol
may be either the string
.B 1tr6
or the string
.BR euro .
If selecting Euro protocol, a comma-separated list of up to 10 MSN's
may be appended. For defining an empty entry in this list, use a dash.
.TP
.BI "load " firmware
downloads the firmware into the card and starts operation.
Usually the images are located in
.IR @I4LCONFDIR@ .
The firmware is named
.IR bip1120.bpl .
.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.
.SH FILES
.TP
.I @I4LCONFDIR@/bip1120.bpl
This is the image of the firmware designed for both the German 1TR6 protocol
and Euro ISDN.
.LP
.SH BUGS
No bugs so far.
.SH AUTHOR
\(co 1997 by Fritz Elfert <fritz@wuemaus.franken.de>
.LP
.SH SEE ALSO
.BR isdnctrl "(8), " act2000 "(4), " isdnctrl "(4), " ttyI (4).

1718
act2000/configure vendored Executable file

File diff suppressed because it is too large Load Diff

38
act2000/configure.in Normal file
View File

@ -0,0 +1,38 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(actctrl.c)
AC_PREFIX_DEFAULT(/usr)
I4LCONFDIR=${I4LCONFDIR:-"/etc/isdn"}
I4LVERSION=${I4LVERSION:-"?.?"}
MANDATE=`grep CHECKIN actctrl.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)
AC_CHECK_HEADERS(linux/isdn.h)
dnl Find current kernel source
AC_FIND_KERNEL
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MMAP
dnl Check, if user wants dump option for debugging
AC_ARG_ENABLE(dump,[ --enable-dump Enable dump feature for debugging],\
DEBUGVAR=-D__DEBUGVAR__)
AC_SUBST(INSTALL)
AC_SUBST(DEBUGVAR)
AC_SUBST(MANDATE)
AC_SUBST(I4LCONFDIR)
AC_SUBST(I4LVERSION)
AC_OUTPUT(Makefile actctrl.man)

2
act2000/install-sh Executable file
View File

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