- added support for DN1/SPID1 DN2/SPID2 for 5ESS und NI1 protocols.

- allow debuging of patchvalues.
- optimize configure.in/configure
This commit is contained in:
Carsten Paeth 1998-02-07 20:09:03 +00:00
parent 949f28da8f
commit 8e7beb66cb
3 changed files with 106 additions and 97 deletions

View File

@ -6,6 +6,10 @@
* Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
*
* $Log$
* Revision 1.5 1998/01/16 14:02:08 calle
* patchvalues working now, leased lines and dchannel protocols like
* CT1,VN3 und AUSTEL support okay, point to point also patchable.
*
* Revision 1.3 1997/12/07 20:02:22 calle
* prepared support for cardtype and different protocols
*
@ -43,10 +47,12 @@ char *cmd;
char *ctrldev;
int arg_ofs;
int debugpatch = 0;
void usage(void)
{
fprintf(stderr, "usage: %s add <portbase> <irq> [B1|M1|T1] (Add a new card)\n", cmd);
fprintf(stderr, " or: %s load <bootcode> [contrnr [protocol [P2P]]] (load firmware)\n", cmd);
fprintf(stderr, " or: %s load <bootcode> [contrnr [protocol [P2P | DN1:SPID1 [DN2:SPID2]]]] (load firmware)\n", cmd);
fprintf(stderr, " or: %s reset [contrnr] (reset controller)\n", cmd);
exit(1);
}
@ -82,9 +88,9 @@ static struct pmap {
{ "CT1", DP_CT1 },
{ "VN3", DP_VN3 },
{ "AUSTEL", DP_AUSTEL },
#if 0
{ "5ESS", DP_5ESS },
{ "NI1", DP_NI1 },
#if 0
{ "DSS1MOBIL", DP_DSS1MOBIL },
{ "1TR6MOBIL", DP_1TR6MOBIL },
{ "GSM", DP_GSM },
@ -145,7 +151,8 @@ static void addpatchvalue(char *name, char *value, int len)
patcharea[patchlen+1] = 0;
}
int set_configuration(avmb1_t4file *t4config, int protocol, int p2p)
int set_configuration(avmb1_t4file *t4config, int protocol, int p2p,
char *dn1, char *spid1, char *dn2, char *spid2)
{
addpatchvalue("AutoFrame", "\001", 1);
addpatchvalue("WATCHDOG", "1", 1);
@ -177,11 +184,29 @@ int set_configuration(avmb1_t4file *t4config, int protocol, int p2p)
addpatchvalue("PROTOCOL", "\004", 1);
break;
case DP_NI1:
p2p = 0;
addpatchvalue("PROTOCOL", "\003", 1);
break; /* $$$ */
if (dn1 && spid1) {
addpatchvalue("DN", dn1, strlen(dn1));
addpatchvalue("SPID", spid1, strlen(spid1));
}
if (dn2 && spid2) {
addpatchvalue("DN2", dn2, strlen(dn2));
addpatchvalue("SPID2", spid2, strlen(spid2));
}
break;
case DP_5ESS:
p2p = 0;
addpatchvalue("PROTOCOL", "\005", 1);
break; /* $$$ */
if (dn1 && spid1) {
addpatchvalue("DN", dn1, strlen(dn1));
addpatchvalue("SPID", spid1, strlen(spid1));
}
if (dn2 && spid2) {
addpatchvalue("DN2", dn2, strlen(dn2));
addpatchvalue("SPID2", spid2, strlen(spid2));
}
break;
case DP_DSS1MOBIL:
addpatchvalue("PatchMobileMode", "0", 1);
break;
@ -201,6 +226,14 @@ int set_configuration(avmb1_t4file *t4config, int protocol, int p2p)
}
t4config->len = patchlen+1;
t4config->data = patcharea;
if (debugpatch) {
FILE *fp = fopen("/tmp/b1.pvals", "w");
if (fp) {
fwrite(t4config->data, t4config->len, 1, fp);
fclose(fp);
fprintf(stderr, "avmcapictrl: patchvalues written to /tmp/b1.pvals\n");
}
}
return 0;
}
@ -219,6 +252,10 @@ int main(int argc, char **argv)
avmb1_resetdef rdef;
avmb1_getdef gdef;
int newdriver;
char *dn1 = 0;
char *spid1 = 0;
char *dn2 = 0;
char *spid2 = 0;
cmd = strrchr(argv[0], '/');
cmd = (cmd == NULL) ? argv[0] : ++cmd;
@ -313,13 +350,22 @@ int main(int argc, char **argv)
return 0;
}
}
if (!strcasecmp(argv[arg_ofs], "load")) {
if ( strcasecmp(argv[arg_ofs], "load") == 0
|| strcasecmp(argv[arg_ofs], "test") == 0 ) {
struct stat st;
int codefd;
int contr = 1;
int protocol = 0;
int p2p = 0;
if (strcasecmp(argv[arg_ofs], "test") == 0)
debugpatch = 1;
if (ac == 2) {
usage();
exit(1);
}
if (ac > 3)
contr = atoi(argv[arg_ofs + 2]);
@ -341,9 +387,31 @@ int main(int argc, char **argv)
if (strcasecmp(argv[arg_ofs + 4], "P2P") == 0) {
p2p = 1;
} else {
fprintf(stderr,"parameter should be P2P not \"%s\"\n",
if (protocol != DP_5ESS && protocol != DP_NI1) {
fprintf(stderr,"parameter should be P2P not \"%s\"\n",
argv[arg_ofs + 4]);
exit(1);
exit(1);
}
dn1 = argv[arg_ofs + 4];
spid1 = strchr(dn1, ':');
if (spid1 == 0) {
fprintf(stderr,"DN1 and SPID1 should be spearated by ':s': %s\n",
argv[arg_ofs + 4]);
exit(1);
}
*spid1++ = 0;
if (ac > 6) {
dn2 = argv[arg_ofs + 5];
spid2 = strchr(dn2, ':');
if (spid2 == 0) {
fprintf(stderr,"DN2 and SPID2 should be spearated by ':s': %s\n",
argv[arg_ofs + 5]);
exit(1);
}
*spid2++ = 0;
}
}
}
@ -365,8 +433,14 @@ int main(int argc, char **argv)
ldef.t4config.len = 0;
ldef.t4config.data = 0;
if (protocol || p2p)
set_configuration(&ldef.t4config, protocol, p2p);
if (protocol || p2p || (dn1 && spid1) || (dn2 && spid2)) {
set_configuration(&ldef.t4config, protocol, p2p,
dn1, spid1, dn2, spid2);
if (debugpatch)
exit(0);
} else if (debugpatch) {
fprintf(stderr,"avmcapictrl: no patchvalues needed\n");
}
printf("Loading Bootcode %s ... ", argv[arg_ofs + 1]);
fflush(stdout);
if (newdriver)

101
avmb1/configure vendored
View File

@ -1088,19 +1088,21 @@ EOF
ac_safe=`echo "$CONFIG_KERNELDIR/include/linux/isdn.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $CONFIG_KERNELDIR/include/linux/isdn.h""... $ac_c" 1>&6
echo "configure:1094: checking for $CONFIG_KERNELDIR/include/linux/isdn.h" >&5
for ac_hdr in $CONFIG_KERNELDIR/include/linux/isdn.h $CONFIG_KERNELDIR/include/linux/b1lli.h $CONFIG_KERNELDIR/include/linux/capi.h $CONFIG_KERNELDIR/include/linux/kernelcapi.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:1096: 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 1099 "configure"
#line 1101 "configure"
#include "confdefs.h"
#include <$CONFIG_KERNELDIR/include/linux/isdn.h>
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1104: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1106: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1116,91 +1118,28 @@ rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
{ echo "configure: error: "Missing $CONFIG_KERNELDIR/include/linux/isdn.h. Kernel source installed?"" 1>&2; exit 1; }
fi
ac_safe=`echo "$CONFIG_KERNELDIR/include/linux/b1lli.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $CONFIG_KERNELDIR/include/linux/b1lli.h""... $ac_c" 1>&6
echo "configure:1128: checking for $CONFIG_KERNELDIR/include/linux/b1lli.h" >&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 1133 "configure"
#include "confdefs.h"
#include <$CONFIG_KERNELDIR/include/linux/b1lli.h>
ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
{ echo "configure: error: "Missing $CONFIG_KERNELDIR/include/linux/b1lli.h. Kernel source installed?"" 1>&2; exit 1; }
fi
ac_safe=`echo "$CONFIG_KERNELDIR/include/linux/capi.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $CONFIG_KERNELDIR/include/linux/capi.h""... $ac_c" 1>&6
echo "configure:1162: checking for $CONFIG_KERNELDIR/include/linux/capi.h" >&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 1167 "configure"
#include "confdefs.h"
#include <$CONFIG_KERNELDIR/include/linux/capi.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
{ echo "configure: error: "Missing $CONFIG_KERNELDIR/linux/include/capi.h. Kernel source installed?"" 1>&2; exit 1; }
{ echo "configure: error: "Missing $ac_hdr. Kernel source installed?"" 1>&2; exit 1; }
fi
done
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
echo "configure:1198: checking whether ${CC-cc} needs -traditional" >&5
echo "configure:1137: 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 1204 "configure"
#line 1143 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@ -1218,7 +1157,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
#line 1222 "configure"
#line 1161 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@ -1242,12 +1181,12 @@ fi
for ac_func in mmap
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1246: checking for $ac_func" >&5
echo "configure:1185: 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 1251 "configure"
#line 1190 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1270,7 +1209,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else

View File

@ -21,12 +21,8 @@ AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h)
dnl Check for kernel stuff
AC_FIND_KERNEL
AC_CHECK_HEADER($CONFIG_KERNELDIR/include/linux/isdn.h,,
AC_MSG_ERROR("Missing $CONFIG_KERNELDIR/include/linux/isdn.h. Kernel source installed?"))
AC_CHECK_HEADER($CONFIG_KERNELDIR/include/linux/b1lli.h,,
AC_MSG_ERROR("Missing $CONFIG_KERNELDIR/include/linux/b1lli.h. Kernel source installed?"))
AC_CHECK_HEADER($CONFIG_KERNELDIR/include/linux/capi.h,,
AC_MSG_ERROR("Missing $CONFIG_KERNELDIR/linux/include/capi.h. Kernel source installed?"))
AC_CHECK_HEADERS($CONFIG_KERNELDIR/include/linux/isdn.h $CONFIG_KERNELDIR/include/linux/b1lli.h $CONFIG_KERNELDIR/include/linux/capi.h $CONFIG_KERNELDIR/include/linux/kernelcapi.h,,
AC_MSG_ERROR("Missing $ac_hdr. Kernel source installed?"))
dnl Checks for typedefs, structures, and compiler characteristics.