diff --git a/eicon/aclocal.m4 b/eicon/aclocal.m4 index ef39b014..75d0f534 100644 --- a/eicon/aclocal.m4 +++ b/eicon/aclocal.m4 @@ -19,3 +19,23 @@ AC_DEFUN(AC_CHECK_XLOG, [ AC_SUBST(HAVE_XLOG) ]) + +dnl +dnl Check for PCI in native driver +dnl + +AC_DEFUN(AC_CHECK_NPCI, [ + OLD_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR} -I/usr/include" + have_npci="no" + AC_MSG_CHECKING([for pci code in ${CONFIG_KERNELDIR}/drivers/isdn/eicon/eicon.h]) + AC_TRY_COMPILE([#include + #include ],eicon_pci_codebuf *p = NULL;,have_npci="yes",) + AC_MSG_RESULT("${have_npci}") + CPPFLAGS="$OLD_CPPFLAGS" + if test "$have_npci" != "no" ; then + AC_DEFINE(HAVE_NPCI) + fi + AC_SUBST(HAVE_NPCI) +]) + diff --git a/eicon/config.h.in b/eicon/config.h.in index d76fe612..64c8f6a7 100644 --- a/eicon/config.h.in +++ b/eicon/config.h.in @@ -1,6 +1,9 @@ /* define if we have XLOG capability */ #undef HAVE_XLOG +/* define if we have PCI code in native driver */ +#undef HAVE_NPCI + /* Define if you have the header file. */ #undef HAVE_CURSES_H diff --git a/eicon/configure b/eicon/configure index b16572ab..417b8110 100755 --- a/eicon/configure +++ b/eicon/configure @@ -1530,15 +1530,48 @@ EOF + OLD_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-nostdinc -I${CONFIG_KERNELDIR} -I/usr/include" + have_npci="no" + echo $ac_n "checking for pci code in ${CONFIG_KERNELDIR}/drivers/isdn/eicon/eicon.h""... $ac_c" 1>&6 +echo "configure:1538: checking for pci code in ${CONFIG_KERNELDIR}/drivers/isdn/eicon/eicon.h" >&5 + cat > conftest.$ac_ext < + #include +int main() { +eicon_pci_codebuf *p = NULL; +; return 0; } +EOF +if { (eval echo configure:1548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + have_npci="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + echo "$ac_t"""${have_npci}"" 1>&6 + CPPFLAGS="$OLD_CPPFLAGS" + if test "$have_npci" != "no" ; then + cat >> confdefs.h <<\EOF +#define HAVE_NPCI 1 +EOF + + fi + + + if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:1536: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:1569: 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 < Autoconf TIOCGETP @@ -1556,7 +1589,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -1581,17 +1614,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:1585: checking for $ac_hdr" >&5 +echo "configure:1618: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1595: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1628: \"$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* @@ -1620,12 +1653,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1624: checking for $ac_func" >&5 +echo "configure:1657: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1685: \"$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 @@ -1673,7 +1706,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:1677: checking for working mmap" >&5 +echo "configure:1710: 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 @@ -1681,7 +1714,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1858: \"$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 @@ -2034,6 +2067,7 @@ s%@CC@%$CC%g s%@CPP@%$CPP%g s%@CONFIG_KERNELDIR@%$CONFIG_KERNELDIR%g s%@HAVE_XLOG@%$HAVE_XLOG%g +s%@HAVE_NPCI@%$HAVE_NPCI%g s%@INSTALL@%$INSTALL%g s%@MANDATE@%$MANDATE%g s%@CONFIG_EICONCTRL_DEBUG@%$CONFIG_EICONCTRL_DEBUG%g diff --git a/eicon/configure.in b/eicon/configure.in index 88e12800..a2419588 100644 --- a/eicon/configure.in +++ b/eicon/configure.in @@ -39,6 +39,7 @@ AC_CHECK_HEADER($CONFIG_KERNELDIR/drivers/isdn/eicon/eicon.h,, dnl Checks for typedefs, structures, and compiler characteristics. AC_CHECK_XLOG +AC_CHECK_NPCI dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL diff --git a/eicon/eiconctrl.c b/eicon/eiconctrl.c index a1094379..048afcb4 100644 --- a/eicon/eiconctrl.c +++ b/eicon/eiconctrl.c @@ -1,4 +1,4 @@ -/* $Id: eiconctrl.c,v 1.8 1999/10/12 18:01:52 armin Exp $ +/* $Id: eiconctrl.c,v 1.9 1999/11/21 12:41:25 armin Exp $ * * Eicon-ISDN driver for Linux. (Control-Utility) * @@ -21,6 +21,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: eiconctrl.c,v $ + * Revision 1.9 1999/11/21 12:41:25 armin + * Added further check for future driver changes. + * * Revision 1.8 1999/10/12 18:01:52 armin * Backward compatible to older driver versions. * @@ -104,7 +107,9 @@ int directory_size; unsigned int no_of_downloads = 0; int total_bytes_in_download = 0; __u32 download_pos; +#ifdef HAVE_NPCI t_dsp_download_desc p_download_table[35]; +#endif int usage_bit; int usage_byte; @@ -138,6 +143,7 @@ char *spid_state[] = }; +#ifdef HAVE_NPCI #ifdef HAVE_XLOG /*********** XLOG stuff **********/ @@ -1164,7 +1170,8 @@ void spid_event(FILE * stream, struct msg_s * message, word code) } /*********** XLOG stuff end **********/ -#endif +#endif /* XLOG */ +#endif /* NPCI */ void usage() { fprintf(stderr,"usage: %s add (add card)\n",cmd); @@ -1173,8 +1180,10 @@ void usage() { fprintf(stderr," or: %s [-d ] [-v] load [options]\n",cmd); fprintf(stderr," or: %s [-d ] debug []\n",cmd); fprintf(stderr," or: %s [-d ] manage [read|exec ] (management-tool)\n",cmd); +#ifdef HAVE_NPCI #ifdef HAVE_XLOG fprintf(stderr," or: %s [-d ] xlog [cont] (request XLOG)\n",cmd); +#endif #endif fprintf(stderr,"load firmware:\n"); fprintf(stderr," basics : -d ID defined when eicon module was loaded/card added\n"); @@ -1192,6 +1201,7 @@ void usage() { } +#ifdef HAVE_NPCI /*-------------------------------------------------------------- * display_combifile_details() * @@ -1668,6 +1678,7 @@ eicon_codebuf *load_combifile(int card_type, u_char *protobuf, int *plen) free(combifile_start); return (cb); } +#endif /* NPCI */ void beep2(void) { @@ -2216,7 +2227,7 @@ int main(int argc, char **argv) { char protoname[1024]; char filename[1024]; u_char protobuf[0x100000]; - eicon_codebuf *cb; + eicon_codebuf *cb = NULL; if (argc <= (arg_ofs + 1)) strcpy(protoname,"etsi"); @@ -2234,16 +2245,30 @@ int main(int argc, char **argv) { switch (ctype) { case EICON_CTYPE_MAESTRAP: printf("Adapter-type is Diva Server PRI/PCI\n"); - strcpy(fileext, ".pm"); card_type = 23; +#ifdef HAVE_NPCI + strcpy(fileext, ".pm"); tei = 1; break; +#else + fprintf(stderr, "Adapter-type not supported for load !\n"); + fprintf(stderr, "Update of util package is necessary, "); + fprintf(stderr, "because of major changes in driver code.\n"); + exit(-1); +#endif case EICON_CTYPE_MAESTRA: printf("Adapter-type is Diva Server BRI/PCI\n"); - strcpy(fileext, ".sm"); card_type = 21; +#ifdef HAVE_NPCI + strcpy(fileext, ".sm"); tei = 0; break; +#else + fprintf(stderr, "Adapter-type not supported for load !\n"); + fprintf(stderr, "Update of util package is necessary, "); + fprintf(stderr, "because of major changes in driver code.\n"); + exit(-1); +#endif case EICON_CTYPE_S: case EICON_CTYPE_SX: case EICON_CTYPE_SCOM: @@ -2300,10 +2325,12 @@ int main(int argc, char **argv) { memcpy(&cb->isa.code, protobuf, plen); cb->isa.firmware_len = plen; } else { +#ifdef HAVE_NPCI if (!(cb = load_combifile(card_type, protobuf, &plen))) { fprintf(stderr, "Error loading Combifile\n"); exit(-1); } +#endif } if (isabus) { @@ -2320,6 +2347,7 @@ int main(int argc, char **argv) { cb->isa.Crc4 = 0; cb->isa.Loopback = 0; } else { +#ifdef HAVE_NPCI cb->pci.tei = tei; cb->pci.nt2 = 0; cb->pci.WatchDog = 0; @@ -2333,6 +2361,7 @@ int main(int argc, char **argv) { cb->pci.Crc4 = 0; cb->pci.Loopback = 0; cb->pci.NoHscx30Mode = 0; +#endif /* NPCI */ } /* parse extented options */ @@ -2343,8 +2372,10 @@ int main(int argc, char **argv) { cb->isa.LowChannel = atoi(argv[arg_ofs] + 2); if (!cb->isa.LowChannel) cb->isa.LowChannel = 1; } else { +#ifdef HAVE_NPCI cb->pci.LowChannel = atoi(argv[arg_ofs] + 2); if (!cb->pci.LowChannel) cb->pci.LowChannel = 1; +#endif /* NPCI */ } continue; } @@ -2354,98 +2385,126 @@ int main(int argc, char **argv) { cb->isa.tei <<= 1; cb->isa.tei |= 0x01; } else { +#ifdef HAVE_NPCI cb->pci.tei = atoi(argv[arg_ofs] + 2); cb->pci.tei <<= 1; cb->pci.tei |= 0x01; +#endif } continue; } if (!strcmp(argv[arg_ofs], "-z")) { if (isabus) cb->isa.Loopback = 1; +#ifdef HAVE_NPCI else cb->pci.Loopback = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-p")) { if (isabus) cb->isa.Permanent = 1; +#ifdef HAVE_NPCI else cb->pci.Permanent = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-w")) { if (isabus) cb->isa.WatchDog = 1; +#ifdef HAVE_NPCI else cb->pci.WatchDog = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-c")) { if (isabus) cb->isa.Crc4 = 1; +#ifdef HAVE_NPCI else cb->pci.Crc4 = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-c1")) { if (isabus) cb->isa.Crc4 = 1; +#ifdef HAVE_NPCI else cb->pci.Crc4 = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-c2")) { if (isabus) cb->isa.Crc4 = 2; +#ifdef HAVE_NPCI else cb->pci.Crc4 = 2; +#endif continue; } if (!strcmp(argv[arg_ofs], "-n")) { if (isabus) cb->isa.nt2 = 1; +#ifdef HAVE_NPCI else cb->pci.nt2 = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-p")) { if (isabus) cb->isa.Permanent = 1; +#ifdef HAVE_NPCI else cb->pci.Permanent = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-h")) { +#ifdef HAVE_NPCI if (!isabus) cb->pci.NoHscx30Mode = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-o")) { if (isabus) cb->isa.NoOrderCheck = 1; +#ifdef HAVE_NPCI else cb->pci.NoOrderCheck = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-s")) { if (isabus) cb->isa.StableL2 = 1; +#ifdef HAVE_NPCI else cb->pci.StableL2 = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-s1")) { if (isabus) cb->isa.StableL2 = 1; +#ifdef HAVE_NPCI else cb->pci.StableL2 = 1; +#endif continue; } if (!strcmp(argv[arg_ofs], "-s2")) { if (isabus) cb->isa.StableL2 = 2; +#ifdef HAVE_NPCI else cb->pci.StableL2 = 2; +#endif continue; } } @@ -2482,6 +2541,7 @@ int main(int argc, char **argv) { return 0; } +#ifdef HAVE_NPCI #ifdef HAVE_XLOG if (!strcmp(argv[arg_ofs], "xlog")) { int cont = 0; @@ -2602,7 +2662,8 @@ int main(int argc, char **argv) { close(fd); return 0; } -#endif +#endif /* XLOG */ +#endif /* NPCI */ if (!strcmp(argv[arg_ofs], "manage")) { mb = malloc(sizeof(eicon_manifbuf));