summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/i4b/driver/i4b_ctl.c43
-rw-r--r--sys/i4b/driver/i4b_ipr.c35
-rw-r--r--sys/i4b/driver/i4b_isppp.c16
-rw-r--r--sys/i4b/driver/i4b_rbch.c44
-rw-r--r--sys/i4b/driver/i4b_tel.c216
-rw-r--r--sys/i4b/driver/i4b_trace.c42
-rw-r--r--sys/i4b/include/i4b_global.h8
-rw-r--r--sys/i4b/include/i4b_isdnq931.h6
-rw-r--r--sys/i4b/include/i4b_l1l2.h6
-rw-r--r--sys/i4b/include/i4b_l2l3.h6
-rw-r--r--sys/i4b/include/i4b_l3l4.h10
-rw-r--r--sys/i4b/include/i4b_mbuf.h6
-rw-r--r--sys/i4b/layer1/i4b_avm_a1.c6
-rw-r--r--sys/i4b/layer1/i4b_avm_fritz_pci.c1288
-rw-r--r--sys/i4b/layer1/i4b_avm_fritz_pcmcia.c4
-rw-r--r--sys/i4b/layer1/i4b_bchan.c8
-rw-r--r--sys/i4b/layer1/i4b_ctx_s0P.c6
-rw-r--r--sys/i4b/layer1/i4b_drn_ngo.c6
-rw-r--r--sys/i4b/layer1/i4b_dynalink.c4
-rw-r--r--sys/i4b/layer1/i4b_elsa_isdnmc.c26
-rw-r--r--sys/i4b/layer1/i4b_elsa_mcall.c4
-rw-r--r--sys/i4b/layer1/i4b_elsa_qs1i.c15
-rw-r--r--sys/i4b/layer1/i4b_elsa_qs1p.c6
-rw-r--r--sys/i4b/layer1/i4b_hscx.c8
-rw-r--r--sys/i4b/layer1/i4b_hscx.h4
-rw-r--r--sys/i4b/layer1/i4b_ipac.h6
-rw-r--r--sys/i4b/layer1/i4b_isac.c8
-rw-r--r--sys/i4b/layer1/i4b_isac.h4
-rw-r--r--sys/i4b/layer1/i4b_isic.c50
-rw-r--r--sys/i4b/layer1/i4b_isic_isa.c82
-rw-r--r--sys/i4b/layer1/i4b_isic_pci.c67
-rw-r--r--sys/i4b/layer1/i4b_isic_pcmcia.c35
-rw-r--r--sys/i4b/layer1/i4b_isic_pnp.c8
-rw-r--r--sys/i4b/layer1/i4b_itk_ix1.c113
-rw-r--r--sys/i4b/layer1/i4b_l1.c8
-rw-r--r--sys/i4b/layer1/i4b_l1.h98
-rw-r--r--sys/i4b/layer1/i4b_l1fsm.c10
-rw-r--r--sys/i4b/layer1/i4b_sws.c4
-rw-r--r--sys/i4b/layer1/i4b_tel_s016.c6
-rw-r--r--sys/i4b/layer1/i4b_tel_s0163.c191
-rw-r--r--sys/i4b/layer1/i4b_tel_s08.c6
-rw-r--r--sys/i4b/layer1/i4b_tel_s0P.c6
-rw-r--r--sys/i4b/layer1/i4b_usr_sti.c6
-rw-r--r--sys/i4b/layer1/isa_isic.c4
-rw-r--r--sys/i4b/layer1/isapnp_isic.c4
-rw-r--r--sys/i4b/layer1/isic_supio.c4
-rw-r--r--sys/i4b/layer1/pci_isic.c4
-rw-r--r--sys/i4b/layer1/pcmcia_isic.c4
-rw-r--r--sys/i4b/layer1/pcmcia_isic.h4
-rw-r--r--sys/i4b/layer2/i4b_iframe.c6
-rw-r--r--sys/i4b/layer2/i4b_l2.c6
-rw-r--r--sys/i4b/layer2/i4b_l2.h6
-rw-r--r--sys/i4b/layer2/i4b_l2fsm.c6
-rw-r--r--sys/i4b/layer2/i4b_l2fsm.h6
-rw-r--r--sys/i4b/layer2/i4b_l2timer.c6
-rw-r--r--sys/i4b/layer2/i4b_lme.c6
-rw-r--r--sys/i4b/layer2/i4b_mbuf.c6
-rw-r--r--sys/i4b/layer2/i4b_sframe.c6
-rw-r--r--sys/i4b/layer2/i4b_tei.c6
-rw-r--r--sys/i4b/layer2/i4b_uframe.c6
-rw-r--r--sys/i4b/layer2/i4b_util.c14
-rw-r--r--sys/i4b/layer3/i4b_l2if.c6
-rw-r--r--sys/i4b/layer3/i4b_l3.h6
-rw-r--r--sys/i4b/layer3/i4b_l3fsm.c6
-rw-r--r--sys/i4b/layer3/i4b_l3fsm.h6
-rw-r--r--sys/i4b/layer3/i4b_l3timer.c6
-rw-r--r--sys/i4b/layer3/i4b_l4if.c6
-rw-r--r--sys/i4b/layer3/i4b_q931.c6
-rw-r--r--sys/i4b/layer3/i4b_q931.h6
-rw-r--r--sys/i4b/layer3/i4b_q932fac.c6
-rw-r--r--sys/i4b/layer3/i4b_q932fac.h6
-rw-r--r--sys/i4b/layer4/i4b_i4bdrv.c145
-rw-r--r--sys/i4b/layer4/i4b_l4.c332
-rw-r--r--sys/i4b/layer4/i4b_l4.h6
-rw-r--r--sys/i4b/layer4/i4b_l4mgmt.c6
-rw-r--r--sys/i4b/layer4/i4b_l4timer.c6
76 files changed, 2689 insertions, 501 deletions
diff --git a/sys/i4b/driver/i4b_ctl.c b/sys/i4b/driver/i4b_ctl.c
index 04c63c1..680217e 100644
--- a/sys/i4b/driver/i4b_ctl.c
+++ b/sys/i4b/driver/i4b_ctl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_ctl.c - i4b system control port driver
* ------------------------------------------
*
- * $Id: i4b_ctl.c,v 1.1 1998/12/27 21:46:42 phk Exp $
+ * $Id: i4b_ctl.c,v 1.19 1999/02/14 19:51:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 17:59:15 1998]
+ * last edit-date: [Sun Feb 14 10:02:29 1999]
*
*---------------------------------------------------------------------------*/
@@ -70,6 +70,9 @@
#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
+#elif defined(__bsdi__)
+#include <i4b/i4b_debug.h>
+#include <i4b/i4b_ioctl.h>
#else
#include <machine/bus.h>
#include <sys/device.h>
@@ -116,7 +119,11 @@ static void *devfs_token;
void i4bctlattach __P((void));
int i4bctlopen __P((dev_t dev, int flag, int fmt, struct proc *p));
int i4bctlclose __P((dev_t dev, int flag, int fmt, struct proc *p));
+#ifdef __bsdi__
+int i4bctlioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p));
+#else
int i4bctlioctl __P((dev_t dev, int cmd, caddr_t data, int flag, struct proc *p));
+#endif
#endif /* !FreeBSD */
#if BSD > 199306 && defined(__FreeBSD__)
@@ -137,6 +144,34 @@ SYSINIT(i4bctldev, SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR, &i4bctlinit, NULL)
#endif /* BSD > 199306 && defined(__FreeBSD__) */
+#ifdef __bsdi__
+int i4bctlmatch(struct device *parent, struct cfdata *cf, void *aux);
+void dummy_i4bctlattach(struct device*, struct device *, void *);
+
+#define CDEV_MAJOR 64
+
+static struct cfdriver i4bctlcd =
+ { NULL, "i4bctl", i4bctlmatch, dummy_i4bctlattach, DV_DULL,
+ sizeof(struct cfdriver) };
+struct devsw i4bctlsw =
+ { &i4bctlcd,
+ i4bctlopen, i4bctlclose, noread, nowrite,
+ i4bctlioctl, seltrue, nommap, nostrat,
+ nodump, nopsize, 0, nostop
+};
+
+int
+i4bctlmatch(struct device *parent, struct cfdata *cf, void *aux)
+{
+ printf("i4bctlmatch: aux=0x%x\n", aux);
+ return 1;
+}
+void
+dummy_i4bctlattach(struct device *parent, struct device *self, void *aux)
+{
+ printf("dummy_i4bctlattach: aux=0x%x\n", aux);
+}
+#endif /* __bsdi__ */
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
@@ -190,6 +225,8 @@ i4bctlclose(dev_t dev, int flag, int fmt, struct proc *p)
PDEVSTATIC int
#if defined (__FreeBSD_version) && __FreeBSD_version >= 300003
i4bctlioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+#elif defined(__bsdi__)
+i4bctlioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
#else
i4bctlioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
#endif
diff --git a/sys/i4b/driver/i4b_ipr.c b/sys/i4b/driver/i4b_ipr.c
index df3977c..f7391d5 100644
--- a/sys/i4b/driver/i4b_ipr.c
+++ b/sys/i4b/driver/i4b_ipr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_ipr.c - isdn4bsd IP over raw HDLC ISDN network driver
* ---------------------------------------------------------
*
- * $Id: i4b_ipr.c,v 1.42 1998/12/18 14:20:44 hm Exp $
+ * $Id: i4b_ipr.c,v 1.44 1999/02/14 19:51:01 hm Exp $
*
- * last edit-date: [Fri Dec 18 11:50:47 1998]
+ * last edit-date: [Sun Feb 14 10:02:36 1999]
*
*---------------------------------------------------------------------------*
*
@@ -138,6 +138,10 @@
#define IPR_FMT "ipr%d: "
#define IPR_ARG(sc) ((sc)->sc_if.if_unit)
#define PDEVSTATIC static
+#elif defined(__bsdi__)
+#define IPR_FMT "ipr%d: "
+#define IPR_ARG(sc) ((sc)->sc_if.if_unit)
+#define PDEVSTATIC /* not static */
#else
#define IPR_FMT "%s: "
#define IPR_ARG(sc) ((sc)->sc_if.if_xname)
@@ -217,7 +221,11 @@ PDEVSTATIC void i4biprattach __P((void));
static int i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
#endif
+#ifdef __bsdi__
+static int iprwatchdog(int unit);
+#else
static void iprwatchdog(struct ifnet *ifp);
+#endif
static void ipr_init_linktab(int unit);
static void ipr_tx_queue_empty(int unit);
static int i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct rtentry *rtp);
@@ -262,6 +270,9 @@ i4biprattach()
sc->sc_if.if_next = NULL;
#endif
sc->sc_if.if_unit = i;
+#elif defined(__bsdi__)
+ sc->sc_if.if_name = "ipr";
+ sc->sc_if.if_unit = i;
#else
sprintf(sc->sc_if.if_xname, "ipr%d", i);
sc->sc_if.if_softc = sc;
@@ -354,7 +365,7 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
s = SPLI4B();
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
unit = ifp->if_unit;
sc = &ipr_softc[unit];
#else
@@ -482,7 +493,7 @@ static int
i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
#endif
{
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
struct ipr_softc *sc = &ipr_softc[ifp->if_unit];
#else
struct ipr_softc *sc = ifp->if_softc;
@@ -513,7 +524,7 @@ i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if(sc->sc_if.if_flags & IFF_RUNNING)
{
/* disconnect ISDN line */
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
i4b_l4_drvrdisc(BDRV_IPR, ifp->if_unit);
#else
i4b_l4_drvrdisc(BDRV_IPR, sc->sc_unit);
@@ -615,12 +626,21 @@ iprclearqueues(struct ipr_softc *sc)
/*---------------------------------------------------------------------------*
* watchdog routine
*---------------------------------------------------------------------------*/
+#ifdef __bsdi__
+static int
+iprwatchdog(int unit)
+{
+#else
static void
iprwatchdog(struct ifnet *ifp)
{
+#endif
#ifdef __FreeBSD__
int unit = ifp->if_unit;
struct ipr_softc *sc = &ipr_softc[unit];
+#elif defined(__bsdi__)
+ struct ipr_softc *sc = &ipr_softc[unit];
+ struct ifnet *ifp = &ipr_softc[unit].sc_if;
#else
struct ipr_softc *sc = ifp->if_softc;
int unit = sc->sc_unit;
@@ -652,6 +672,9 @@ iprwatchdog(struct ifnet *ifp)
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
}
sc->sc_if.if_timer = I4BIPRACCTINTVL;
+#ifdef __bsdi__
+ return 0;
+#endif
}
#endif /* I4BIPRACCT */
diff --git a/sys/i4b/driver/i4b_isppp.c b/sys/i4b/driver/i4b_isppp.c
index b1cb2cf..0ea767f 100644
--- a/sys/i4b/driver/i4b_isppp.c
+++ b/sys/i4b/driver/i4b_isppp.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,9 +34,9 @@
* the "cx" driver for Cronyx's HDLC-in-hardware device). This driver
* is only the glue between sppp and i4b.
*
- * $Id: i4b_isppp.c,v 1.20 1998/12/18 14:20:44 hm Exp $
+ * $Id: i4b_isppp.c,v 1.22 1999/02/14 09:44:55 hm Exp $
*
- * last edit-date: [Fri Dec 18 11:47:58 1998]
+ * last edit-date: [Sun Feb 14 10:02:43 1999]
*
*---------------------------------------------------------------------------*/
@@ -341,7 +341,7 @@ i4bisppp_start(struct ifnet *ifp)
{
struct i4bisppp_softc *sc = ifp->if_softc;
struct mbuf *m;
- int s;
+ /* int s; */
int unit = IFP2UNIT(ifp);
if (sppp_isempty(ifp))
@@ -350,9 +350,11 @@ i4bisppp_start(struct ifnet *ifp)
if(sc->sc_state != ST_CONNECTED)
return;
- s = splimp();
- /*ifp->if_flags |= IFF_OACTIVE; - need to clear this somewhere */
- splx(s);
+ /*
+ * s = splimp();
+ * ifp->if_flags |= IFF_OACTIVE; // - need to clear this somewhere
+ * splx(s);
+ */
while ((m = sppp_dequeue(&sc->sc_if)) != NULL)
{
diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c
index 9cf432c..02f91fb 100644
--- a/sys/i4b/driver/i4b_rbch.c
+++ b/sys/i4b/driver/i4b_rbch.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_rbch.c - device driver for raw B channel data
* ---------------------------------------------------
*
- * $Id: i4b_rbch.c,v 1.23 1998/12/14 09:39:10 hm Exp $
+ * $Id: i4b_rbch.c,v 1.25 1999/02/14 19:51:01 hm Exp $
*
- * last edit-date: [Sun Dec 13 10:19:08 1998]
+ * last edit-date: [Sun Feb 14 10:02:49 1999]
*
*---------------------------------------------------------------------------*/
@@ -40,7 +40,7 @@
#include <sys/param.h>
#include <sys/systm.h>
-#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) || !defined(__FreeBSD__)
+#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) || (!defined(__FreeBSD__) && !defined(__bsdi__))
#include <sys/ioccom.h>
#include <sys/poll.h>
#else
@@ -94,6 +94,12 @@ extern cc_t ttydefchars;
#include <i4b/layer4/i4b_l4.h>
/* initialized by L4 */
+#ifdef __bsdi__
+#include <sys/device.h>
+/* XXX FIXME */
+int bootverbose = 0;
+#endif
+
static drvr_link_t rbch_drvr_linktab[NI4BRBCH];
static isdn_link_t *isdn_linktab[NI4BRBCH];
@@ -196,6 +202,34 @@ SYSINIT(i4brbchdev, SI_SUB_DRIVERS,
#endif /* BSD > 199306 && defined(__FreeBSD__) */
+#ifdef __bsdi__
+int i4brbchmatch(struct device *parent, struct cfdata *cf, void *aux);
+void dummy_i4brbchattach(struct device*, struct device *, void *);
+
+#define CDEV_MAJOR 61
+
+static struct cfdriver i4brbchcd =
+ { NULL, "i4brbch", i4brbchmatch, dummy_i4brbchattach, DV_DULL,
+ sizeof(struct cfdriver) };
+struct devsw i4brbchsw =
+ { &i4brbchcd,
+ i4brbchopen, i4brbchclose, i4brbchread, i4brbchwrite,
+ i4brbchioctl, seltrue, nommap, nostrat,
+ nodump, nopsize, 0, nostop
+};
+
+int
+i4brbchmatch(struct device *parent, struct cfdata *cf, void *aux)
+{
+ printf("i4brbchmatch: aux=0x%x\n", aux);
+ return 1;
+}
+void
+dummy_i4brbchattach(struct device *parent, struct device *self, void *aux)
+{
+ printf("dummy_i4brbchattach: aux=0x%x\n", aux);
+}
+#endif /* __bsdi__ */
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
@@ -525,7 +559,7 @@ if(bootverbose)printf("EE-rbch%d: attempting dialout (DTR)\n", unit);
/*---------------------------------------------------------------------------*
* device driver poll
*---------------------------------------------------------------------------*/
-#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) || !defined(__FreeBSD__)
+#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) || (!defined(__FreeBSD__) && !defined(__bsdi__))
PDEVSTATIC int
i4brbchpoll(dev_t dev, int events, struct proc *p)
diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c
index 81b38a6..f7cfd5f 100644
--- a/sys/i4b/driver/i4b_tel.c
+++ b/sys/i4b/driver/i4b_tel.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_tel.c - device driver for ISDN telephony
* --------------------------------------------
*
- * $Id: i4b_tel.c,v 1.18 1998/12/14 10:31:53 hm Exp $
+ * $Id: i4b_tel.c,v 1.22 1999/02/16 10:40:18 hm Exp $
*
- * last edit-date: [Mon Dec 14 11:32:06 1998]
+ * last edit-date: [Tue Feb 16 11:30:35 1999]
*
*---------------------------------------------------------------------------*/
@@ -87,6 +87,8 @@ typedef struct {
#define ST_RDWAITDATA 0x04 /* userland read waiting */
#define ST_WRWAITEMPTY 0x08 /* userland write waiting */
int audiofmt; /* audio format conversion */
+ u_char *rcvttab; /* conversion table on read */
+ u_char *wcvttab; /* conversion table on write */
call_desc_t *cdp; /* call descriptor pointer */
#ifdef DEVFS
void *devfs_token; /* token for DEVFS */
@@ -103,13 +105,19 @@ static void tel_init_linktab(int unit);
static void tel_connect(int unit, void *cdp);
static void tel_disconnect(int unit, void *cdp);
+/* audio format conversion tables */
static unsigned char alaw_ulaw[];
static unsigned char ulaw_alaw[];
+static unsigned char bitreverse[];
#ifndef __FreeBSD__
#define PDEVSTATIC /* - not static - */
PDEVSTATIC void i4btelattach __P((void));
+#ifdef __bsdi__
+PDEVSTATIC int i4btelioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p));
+#else
PDEVSTATIC int i4btelioctl __P((dev_t dev, int cmd, caddr_t data, int flag, struct proc *p));
+#endif
int i4btelopen __P((dev_t dev, int flag, int fmt, struct proc *p));
int i4btelclose __P((dev_t dev, int flag, int fmt, struct proc *p));
int i4btelread __P((dev_t dev, struct uio *uio, int ioflag));
@@ -164,6 +172,36 @@ SYSINIT(i4bteldev, SI_SUB_DRIVERS,
#endif /* BSD > 199306 && defined(__FreeBSD__) */
+#ifdef __bsdi__
+#include <sys/device.h>
+int i4btelmatch(struct device *parent, struct cfdata *cf, void *aux);
+void dummy_i4btelattach(struct device*, struct device *, void *);
+
+#define CDEV_MAJOR 62
+
+static struct cfdriver i4btelcd =
+ { NULL, "i4btel", i4btelmatch, dummy_i4btelattach, DV_DULL,
+ sizeof(struct cfdriver) };
+struct devsw i4btelsw =
+ { &i4btelcd,
+ i4btelopen, i4btelclose, i4btelread, i4btelwrite,
+ i4btelioctl, seltrue, nommap, nostrat,
+ nodump, nopsize, 0, nostop
+};
+
+int
+i4btelmatch(struct device *parent, struct cfdata *cf, void *aux)
+{
+ printf("i4btelmatch: aux=0x%x\n", aux);
+ return 1;
+}
+void
+dummy_i4btelattach(struct device *parent, struct device *self, void *aux)
+{
+ printf("dummy_i4btelattach: aux=0x%x\n", aux);
+}
+#endif /* __bsdi__ */
+
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
@@ -184,6 +222,8 @@ i4btelattach()
{
tel_sc[i].devstate = ST_IDLE;
tel_sc[i].audiofmt = CVT_NONE;
+ tel_sc[i].rcvttab = 0;
+ tel_sc[i].wcvttab = 0;
tel_init_linktab(i);
#ifdef DEVFS
tel_sc[i].devfs_token
@@ -208,9 +248,6 @@ i4btelopen(dev_t dev, int flag, int fmt, struct proc *p)
sc = &tel_sc[unit];
- if(!(sc->devstate & ST_CONNECTED))
- return(EIO);
-
if(sc->devstate & ST_ISOPEN)
return(EBUSY);
@@ -258,6 +295,8 @@ i4btelclose(dev_t dev, int flag, int fmt, struct proc *p)
PDEVSTATIC int
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300003
i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+#elif defined(__bsdi__)
+i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
#else
i4btelioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
#endif
@@ -274,7 +313,26 @@ i4btelioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
break;
case I4B_TEL_SETAUDIOFMT:
- sc->audiofmt = *(int *)data;
+ switch (*(int *)data)
+ {
+ case CVT_NONE:
+ sc->rcvttab = 0;
+ sc->wcvttab = 0;
+ break;
+ case CVT_ALAW2ULAW:
+ sc->rcvttab = alaw_ulaw;
+ sc->wcvttab = ulaw_alaw;
+ break;
+ case CVT_ALAW_CANON:
+ sc->rcvttab = bitreverse;
+ sc->wcvttab = bitreverse;
+ break;
+ default:
+ error = ENODEV;
+ break;
+ }
+ if(error == 0)
+ sc->audiofmt = *(int *)data;
break;
case I4B_TEL_EMPTYINPUTQUEUE:
@@ -308,8 +366,15 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
int error = 0;
tel_sc_t *sc = &tel_sc[minor(dev)];
+#ifdef notdef
+/*
+ * XXX
+ * With this code enabled, one cannot set or get the audio format
+ * while not connected.
+*/
if(!(sc->devstate & ST_CONNECTED))
return(EIO);
+#endif
if(!(sc->devstate & ST_ISOPEN))
return(EIO);
@@ -355,13 +420,13 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
IF_DEQUEUE(sc->isdn_linktab->rx_queue, m);
- if(m && m->m_len)
+ if(m && m->m_len > 0)
{
- if(sc->audiofmt == CVT_ALAW2ULAW)
+ if(sc->rcvttab)
{
int i;
for(i = 0; i < m->m_len; i++)
- m->m_data[i] = alaw_ulaw[(int)m->m_data[i]];
+ mtod(m,u_char *)[i] = sc->rcvttab[mtod(m,u_char *)[i]];
}
error = uiomove(m->m_data, m->m_len, uio);
}
@@ -450,11 +515,11 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
error = uiomove(m->m_data, m->m_len, uio);
- if(sc->audiofmt == CVT_ALAW2ULAW)
+ if(sc->wcvttab)
{
int i;
for(i = 0; i < m->m_len; i++)
- m->m_data[i] = ulaw_alaw[(int)m->m_data[i]];
+ mtod(m,u_char *)[i] = sc->wcvttab[mtod(m,u_char *)[i]];
}
IF_ENQUEUE(sc->isdn_linktab->tx_queue, m);
@@ -633,79 +698,70 @@ tel_init_linktab(int unit)
*===========================================================================*/
/*---------------------------------------------------------------------------*
- * A-law to mu-law conversion
+ * Line format to mu-law conversion
*---------------------------------------------------------------------------*/
-static unsigned char alaw_ulaw[] = {
- 0x002a, 0x00a9, 0x005f, 0x00e3, 0x001f, 0x009f, 0x0048, 0x00c8,
- 0x0039, 0x00b9, 0x006f, 0x00f7, 0x001f, 0x009f, 0x0055, 0x00d7,
- 0x0022, 0x00a1, 0x005b, 0x00dd, 0x001f, 0x009f, 0x0040, 0x00c0,
- 0x0031, 0x00b1, 0x0067, 0x00eb, 0x001f, 0x009f, 0x004e, 0x00cf,
- 0x002e, 0x00ad, 0x0063, 0x00e7, 0x001f, 0x009f, 0x004c, 0x00cc,
- 0x003d, 0x00bd, 0x0077, 0x00ff, 0x001f, 0x009f, 0x0059, 0x00db,
- 0x0026, 0x00a5, 0x005d, 0x00df, 0x001f, 0x009f, 0x0044, 0x00c4,
- 0x0035, 0x00b5, 0x006b, 0x00ef, 0x001f, 0x009f, 0x0051, 0x00d3,
- 0x0028, 0x00a7, 0x005f, 0x00e3, 0x001f, 0x009f, 0x0046, 0x00c6,
- 0x0037, 0x00b7, 0x006f, 0x00f7, 0x001f, 0x009f, 0x0053, 0x00d5,
- 0x0020, 0x009f, 0x005b, 0x00dd, 0x001f, 0x009f, 0x003f, 0x00bf,
- 0x002f, 0x00af, 0x0067, 0x00eb, 0x001f, 0x009f, 0x004d, 0x00ce,
- 0x002c, 0x00ab, 0x0063, 0x00e7, 0x001f, 0x009f, 0x004a, 0x00ca,
- 0x003b, 0x00bb, 0x0077, 0x00ff, 0x001f, 0x009f, 0x0057, 0x00d9,
- 0x0024, 0x00a3, 0x005d, 0x00df, 0x001f, 0x009f, 0x0042, 0x00c2,
- 0x0033, 0x00b3, 0x006b, 0x00ef, 0x001f, 0x009f, 0x004f, 0x00d1,
- 0x002b, 0x00aa, 0x0063, 0x00e3, 0x001f, 0x009f, 0x0049, 0x00c9,
- 0x003a, 0x00ba, 0x0077, 0x00f7, 0x001f, 0x009f, 0x0057, 0x00d7,
- 0x0023, 0x00a2, 0x005d, 0x00dd, 0x001f, 0x009f, 0x0041, 0x00c1,
- 0x0032, 0x00b2, 0x006b, 0x00eb, 0x001f, 0x009f, 0x004f, 0x00cf,
- 0x002f, 0x00ae, 0x0067, 0x00e7, 0x001f, 0x009f, 0x004d, 0x00cd,
- 0x003e, 0x00be, 0x00ff, 0x00ff, 0x001f, 0x009f, 0x005b, 0x00db,
- 0x0027, 0x00a6, 0x005f, 0x00df, 0x001f, 0x009f, 0x0045, 0x00c5,
- 0x0036, 0x00b6, 0x006f, 0x00ef, 0x001f, 0x009f, 0x0053, 0x00d3,
- 0x0029, 0x00a8, 0x005f, 0x00e3, 0x001f, 0x009f, 0x0047, 0x00c7,
- 0x0038, 0x00b8, 0x006f, 0x00f7, 0x001f, 0x009f, 0x0055, 0x00d5,
- 0x0021, 0x00a0, 0x005b, 0x00dd, 0x001f, 0x009f, 0x003f, 0x00bf,
- 0x0030, 0x00b0, 0x0067, 0x00eb, 0x001f, 0x009f, 0x004e, 0x00ce,
- 0x002d, 0x00ac, 0x0063, 0x00e7, 0x001f, 0x009f, 0x004b, 0x00cb,
- 0x003c, 0x00bc, 0x0077, 0x00ff, 0x001f, 0x009f, 0x0059, 0x00d9,
- 0x0025, 0x00a4, 0x005d, 0x00df, 0x001f, 0x009f, 0x0043, 0x00c3,
- 0x0034, 0x00b4, 0x006b, 0x00ef, 0x001f, 0x009f, 0x0051, 0x00d1
+static unsigned char alaw_ulaw[256] = {
+ 0x2a, 0xa9, 0x62, 0xe1, 0x0a, 0x8a, 0x48, 0xc8, 0x39, 0xb9, 0x75, 0xf3, 0x1a, 0x9a, 0x56, 0xd6,
+ 0x22, 0xa1, 0x5d, 0xdc, 0x02, 0x82, 0x40, 0xc0, 0x31, 0xb1, 0x6a, 0xe9, 0x12, 0x92, 0x4f, 0xcf,
+ 0x2e, 0xad, 0x66, 0xe5, 0x0e, 0x8e, 0x4c, 0xcc, 0x3d, 0xbd, 0x7d, 0xfb, 0x1e, 0x9e, 0x5a, 0xda,
+ 0x26, 0xa5, 0x5f, 0xde, 0x06, 0x86, 0x44, 0xc4, 0x35, 0xb5, 0x6e, 0xed, 0x16, 0x96, 0x52, 0xd2,
+ 0x28, 0xa7, 0x60, 0xdf, 0x08, 0x88, 0x46, 0xc6, 0x37, 0xb7, 0x71, 0xef, 0x18, 0x98, 0x54, 0xd4,
+ 0x20, 0x9f, 0x5c, 0xdb, 0x00, 0x80, 0x3f, 0xbf, 0x2f, 0xaf, 0x68, 0xe7, 0x10, 0x90, 0x4e, 0xce,
+ 0x2c, 0xab, 0x64, 0xe3, 0x0c, 0x8c, 0x4a, 0xca, 0x3b, 0xbb, 0x79, 0xf7, 0x1c, 0x9c, 0x58, 0xd8,
+ 0x24, 0xa3, 0x5e, 0xdd, 0x04, 0x84, 0x42, 0xc2, 0x33, 0xb3, 0x6c, 0xeb, 0x14, 0x94, 0x50, 0xd0,
+ 0x2b, 0xaa, 0x63, 0xe2, 0x0b, 0x8b, 0x49, 0xc9, 0x3a, 0xba, 0x77, 0xf5, 0x1b, 0x9b, 0x57, 0xd7,
+ 0x23, 0xa2, 0x5d, 0xdd, 0x03, 0x83, 0x41, 0xc1, 0x32, 0xb2, 0x6b, 0xea, 0x13, 0x93, 0x4f, 0xcf,
+ 0x2f, 0xae, 0x67, 0xe6, 0x0f, 0x8f, 0x4d, 0xcd, 0x3e, 0xbe, 0xff, 0xfd, 0x1f, 0x9f, 0x5b, 0xdb,
+ 0x27, 0xa6, 0x5f, 0xdf, 0x07, 0x87, 0x45, 0xc5, 0x36, 0xb6, 0x6f, 0xee, 0x17, 0x97, 0x53, 0xd3,
+ 0x29, 0xa8, 0x61, 0xe0, 0x09, 0x89, 0x47, 0xc7, 0x38, 0xb8, 0x73, 0xf1, 0x19, 0x99, 0x55, 0xd5,
+ 0x21, 0xa0, 0x5c, 0xdc, 0x01, 0x81, 0x3f, 0xbf, 0x30, 0xb0, 0x69, 0xe8, 0x11, 0x91, 0x4e, 0xce,
+ 0x2d, 0xac, 0x65, 0xe4, 0x0d, 0x8d, 0x4b, 0xcb, 0x3c, 0xbc, 0x7b, 0xf9, 0x1d, 0x9d, 0x59, 0xd9,
+ 0x25, 0xa4, 0x5e, 0xde, 0x05, 0x85, 0x43, 0xc3, 0x34, 0xb4, 0x6d, 0xec, 0x15, 0x95, 0x51, 0xd1
};
+
+/*---------------------------------------------------------------------------*
+ * mu-law to line format conversion
+ *---------------------------------------------------------------------------*/
+static unsigned char ulaw_alaw[256] = {
+ 0x54, 0xd4, 0x14, 0x94, 0x74, 0xf4, 0x34, 0xb4, 0x44, 0xc4, 0x04, 0x84, 0x64, 0xe4, 0x24, 0xa4,
+ 0x5c, 0xdc, 0x1c, 0x9c, 0x7c, 0xfc, 0x3c, 0xbc, 0x4c, 0xcc, 0x0c, 0x8c, 0x6c, 0xec, 0x2c, 0xac,
+ 0xd0, 0x10, 0x90, 0x70, 0xf0, 0x30, 0xb0, 0x40, 0xc0, 0x00, 0x80, 0x60, 0xe0, 0x20, 0xa0, 0x58,
+ 0xd8, 0x18, 0x98, 0x78, 0xf8, 0x38, 0xb8, 0x48, 0xc8, 0x08, 0x88, 0x68, 0xe8, 0x28, 0xa8, 0xd6,
+ 0x16, 0x96, 0x76, 0xf6, 0x36, 0xb6, 0x46, 0xc6, 0x06, 0x86, 0x66, 0xe6, 0x26, 0xa6, 0xde, 0x9e,
+ 0x7e, 0xfe, 0x3e, 0xbe, 0x4e, 0xce, 0x0e, 0x8e, 0x6e, 0xee, 0x2e, 0xae, 0xd2, 0x92, 0xf2, 0xb2,
+ 0xc2, 0x02, 0x82, 0x62, 0xe2, 0x22, 0xa2, 0x5a, 0xda, 0x1a, 0x9a, 0x7a, 0xfa, 0x3a, 0xba, 0x4a,
+ 0x4a, 0xca, 0xca, 0x0a, 0x0a, 0x8a, 0x8a, 0x6a, 0x6a, 0xea, 0xea, 0x2a, 0x2a, 0xaa, 0xab, 0xab,
+ 0x55, 0xd5, 0x15, 0x95, 0x75, 0xf5, 0x35, 0xb5, 0x45, 0xc5, 0x05, 0x85, 0x65, 0xe5, 0x25, 0xa5,
+ 0x5d, 0xdd, 0x1d, 0x9d, 0x7d, 0xfd, 0x3d, 0xbd, 0x4d, 0xcd, 0x0d, 0x8d, 0x6d, 0xed, 0x2d, 0xad,
+ 0x51, 0xd1, 0x11, 0x91, 0x71, 0xf1, 0x31, 0xb1, 0x41, 0xc1, 0x01, 0x81, 0x61, 0xe1, 0x21, 0xa1,
+ 0xd9, 0x19, 0x99, 0x79, 0xf9, 0x39, 0xb9, 0x49, 0xc9, 0x09, 0x89, 0x69, 0xe9, 0x29, 0xa9, 0x57,
+ 0x17, 0x97, 0x77, 0xf7, 0x37, 0xb7, 0x47, 0xc7, 0x07, 0x87, 0x67, 0xe7, 0x27, 0xa7, 0x5f, 0x1f,
+ 0x7f, 0xff, 0x3f, 0xbf, 0x4f, 0xcf, 0x0f, 0x8f, 0x6f, 0xef, 0x2f, 0xaf, 0x53, 0x13, 0x73, 0x33,
+ 0x43, 0xc3, 0x03, 0x83, 0x63, 0xe3, 0x23, 0xa3, 0x5b, 0xdb, 0x1b, 0x9b, 0x7b, 0xfb, 0x3b, 0xbb,
+ 0xbb, 0x4b, 0x4b, 0xcb, 0xcb, 0x0b, 0x0b, 0x8b, 0x8b, 0x6b, 0x6b, 0xeb, 0xeb, 0x2b, 0x2b, 0xab
+};
+
/*---------------------------------------------------------------------------*
- * mu-law to A-law conversion
+ * bit-reverse the sample to convert from/to canonical A-law
*---------------------------------------------------------------------------*/
-static unsigned char ulaw_alaw[] = {
- 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc,
- 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc,
- 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc,
- 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00fc, 0x00ac,
- 0x0050, 0x00d0, 0x0010, 0x0090, 0x0070, 0x00f0, 0x0030, 0x00b0,
- 0x0040, 0x00c0, 0x0000, 0x0080, 0x0060, 0x00e0, 0x0020, 0x00a0,
- 0x00d8, 0x0018, 0x0098, 0x0078, 0x00f8, 0x0038, 0x00b8, 0x0048,
- 0x00c8, 0x0008, 0x0088, 0x0068, 0x00e8, 0x0028, 0x00a8, 0x00d6,
- 0x0096, 0x0076, 0x00f6, 0x0036, 0x00b6, 0x0046, 0x00c6, 0x0006,
- 0x0086, 0x0066, 0x00e6, 0x0026, 0x00a6, 0x00de, 0x009e, 0x00fe,
- 0x00fe, 0x00be, 0x00be, 0x00ce, 0x00ce, 0x008e, 0x008e, 0x00ee,
- 0x00ee, 0x00d2, 0x00d2, 0x00f2, 0x00f2, 0x00c2, 0x00c2, 0x00e2,
- 0x00e2, 0x00e2, 0x00da, 0x00da, 0x00da, 0x00da, 0x00fa, 0x00fa,
- 0x00fa, 0x00fa, 0x00ca, 0x00ca, 0x00ca, 0x00ca, 0x00ea, 0x00ea,
- 0x00ea, 0x00ea, 0x00ea, 0x00ea, 0x00eb, 0x00eb, 0x00eb, 0x00eb,
- 0x00eb, 0x00eb, 0x00eb, 0x00eb, 0x00eb, 0x00eb, 0x00eb, 0x00eb,
- 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd,
- 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd,
- 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd,
- 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd, 0x00fd,
- 0x00d1, 0x0011, 0x0091, 0x0071, 0x00f1, 0x0031, 0x00b1, 0x0041,
- 0x00c1, 0x0001, 0x0081, 0x0061, 0x00e1, 0x0021, 0x00a1, 0x0059,
- 0x00d9, 0x0019, 0x0099, 0x0079, 0x00f9, 0x0039, 0x00b9, 0x0049,
- 0x00c9, 0x0009, 0x0089, 0x0069, 0x00e9, 0x0029, 0x00a9, 0x0057,
- 0x0017, 0x0097, 0x0077, 0x00f7, 0x0037, 0x00b7, 0x0047, 0x00c7,
- 0x0007, 0x0087, 0x0067, 0x00e7, 0x0027, 0x00a7, 0x00df, 0x009f,
- 0x009f, 0x00ff, 0x00ff, 0x00bf, 0x00bf, 0x00cf, 0x00cf, 0x008f,
- 0x008f, 0x00ef, 0x00ef, 0x00af, 0x00af, 0x00d3, 0x00d3, 0x00f3,
- 0x00f3, 0x00f3, 0x00c3, 0x00c3, 0x00c3, 0x00c3, 0x00e3, 0x00e3,
- 0x00e3, 0x00e3, 0x00db, 0x00db, 0x00db, 0x00db, 0x00fb, 0x00fb,
- 0x00fb, 0x00fb, 0x00fb, 0x00fb, 0x00cb, 0x00cb, 0x00cb, 0x00cb,
- 0x00cb, 0x00cb, 0x00cb, 0x00cb, 0x00eb, 0x00eb, 0x00eb, 0x00eb
+static unsigned char bitreverse[256] = {
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
/*===========================================================================*/
diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c
index f64e35d..f50a67a 100644
--- a/sys/i4b/driver/i4b_trace.c
+++ b/sys/i4b/driver/i4b_trace.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4btrc - device driver for trace data read device
* ---------------------------------------------------
*
- * $Id: i4b_trace.c,v 1.14 1998/12/05 18:02:51 hm Exp $
+ * $Id: i4b_trace.c,v 1.16 1999/02/14 19:51:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:01:53 1998]
+ * last edit-date: [Sun Feb 14 10:03:01 1999]
*
* NOTE: the code assumes that SPLI4B >= splimp !
*
@@ -112,8 +112,12 @@ void i4btrcattach __P((void));
int i4btrcopen __P((dev_t dev, int flag, int fmt, struct proc *p));
int i4btrcclose __P((dev_t dev, int flag, int fmt, struct proc *p));
int i4btrcread __P((dev_t dev, struct uio * uio, int ioflag));
+#ifdef __bsdi__
+int i4btrcioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p));
+#else
int i4btrcioctl __P((dev_t dev, int cmd, caddr_t data, int flag, struct proc *p));
#endif
+#endif
#if BSD > 199306 && defined(__FreeBSD__)
#define PDEVSTATIC static
@@ -157,6 +161,36 @@ PSEUDO_SET(i4btrcattach, i4b_trace);
#endif /* BSD > 199306 && defined(__FreeBSD__) */
+#ifdef __bsdi__
+#include <sys/device.h>
+int i4btrcmatch(struct device *parent, struct cfdata *cf, void *aux);
+void dummy_i4btrcattach(struct device*, struct device *, void *);
+
+#define CDEV_MAJOR 60
+
+static struct cfdriver i4btrccd =
+ { NULL, "i4btrc", i4btrcmatch, dummy_i4btrcattach, DV_DULL,
+ sizeof(struct cfdriver) };
+struct devsw i4btrcsw =
+ { &i4btrccd,
+ i4btrcopen, i4btrcclose, i4btrcread, nowrite,
+ i4btrcioctl, seltrue, nommap, nostrat,
+ nodump, nopsize, 0, nostop
+};
+
+int
+i4btrcmatch(struct device *parent, struct cfdata *cf, void *aux)
+{
+ printf("i4btrcmatch: aux=0x%x\n", aux);
+ return 1;
+}
+void
+dummy_i4btrcattach(struct device *parent, struct device *self, void *aux)
+{
+ printf("dummy_i4btrcattach: aux=0x%x\n", aux);
+}
+#endif /* __bsdi__ */
+
int get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf);
/*---------------------------------------------------------------------------*
@@ -424,6 +458,8 @@ i4btrcpoll(dev_t dev, int events, struct proc *p)
PDEVSTATIC int
#if defined (__FreeBSD_version) && __FreeBSD_version >= 300003
i4btrcioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+#elif defined(__bsdi__)
+i4btrcioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
#else
i4btrcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
#endif
diff --git a/sys/i4b/include/i4b_global.h b/sys/i4b/include/i4b_global.h
index 739d78d..e386b38 100644
--- a/sys/i4b/include/i4b_global.h
+++ b/sys/i4b/include/i4b_global.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_global.h - i4b global include file
* --------------------------------------
*
- * $Id: i4b_global.h,v 1.17 1998/12/05 18:02:53 hm Exp $
+ * $Id: i4b_global.h,v 1.19 1999/02/27 11:08:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:03:41 1998]
+ * last edit-date: [Sun Feb 14 10:03:55 1999]
*
*---------------------------------------------------------------------------*/
@@ -58,7 +58,7 @@
#endif /* >= 3 */
#endif /* __FreeBSD__ */
-#if defined(__NetBSD__) || defined (__OpenBSD__)
+#if defined(__NetBSD__) || defined (__OpenBSD__) || defined(__bsdi__)
#define TIMEOUT_FUNC_T void *
#define SECOND time.tv_sec
diff --git a/sys/i4b/include/i4b_isdnq931.h b/sys/i4b/include/i4b_isdnq931.h
index bdc77f0..15d06ee 100644
--- a/sys/i4b/include/i4b_isdnq931.h
+++ b/sys/i4b/include/i4b_isdnq931.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_isdnq931.h - DSS1 layer 3 message types
* -------------------------------------------
*
- * $Id: i4b_isdnq931.h,v 1.4 1998/12/05 18:02:54 hm Exp $
+ * $Id: i4b_isdnq931.h,v 1.5 1999/02/14 09:44:55 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:04:01 1998]
+ * last edit-date: [Sun Feb 14 10:04:01 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/include/i4b_l1l2.h b/sys/i4b/include/i4b_l1l2.h
index 782ca68..5ad09bd 100644
--- a/sys/i4b/include/i4b_l1l2.h
+++ b/sys/i4b/include/i4b_l1l2.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l1l2.h - i4b layer 1 / layer 2 interactions
* ---------------------------------------------------
*
- * $Id: i4b_l1l2.h,v 1.7 1998/12/05 18:02:56 hm Exp $
+ * $Id: i4b_l1l2.h,v 1.8 1999/02/14 09:44:55 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:04:25 1998]
+ * last edit-date: [Sun Feb 14 10:04:07 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/include/i4b_l2l3.h b/sys/i4b/include/i4b_l2l3.h
index 81ab182..4d49612 100644
--- a/sys/i4b/include/i4b_l2l3.h
+++ b/sys/i4b/include/i4b_l2l3.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l2l3.h - i4b layer 2 / layer 3 interactions
* -----------------------------------------------
*
- * $Id: i4b_l2l3.h,v 1.5 1998/12/05 18:02:57 hm Exp $
+ * $Id: i4b_l2l3.h,v 1.6 1999/02/14 09:44:55 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:04:44 1998]
+ * last edit-date: [Sun Feb 14 10:04:13 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/include/i4b_l3l4.h b/sys/i4b/include/i4b_l3l4.h
index 642777c..0f7ac7d 100644
--- a/sys/i4b/include/i4b_l3l4.h
+++ b/sys/i4b/include/i4b_l3l4.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l3l4.h - layer 3 / layer 4 interface
* ------------------------------------------
*
- * $Id: i4b_l3l4.h,v 1.21 1998/12/05 18:02:59 hm Exp $
+ * $Id: i4b_l3l4.h,v 1.23 1999/02/15 09:55:47 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:04:58 1998]
+ * last edit-date: [Sun Feb 14 10:04:19 1999]
*
*---------------------------------------------------------------------------*/
@@ -200,9 +200,7 @@ typedef struct
time_t max_idle_time; /* max time without activity */
/* for outgoing connections: */
- time_t unitlen_time; /* length of a charging unit */
- time_t idle_time; /* idle time before end of unit */
- time_t earlyhup_time; /* safety time zone at end of unit */
+ msg_shorthold_t shorthold_data; /* shorthold data to use */
int aocd_flag; /* AOCD used for unitlength calc*/
time_t last_aocd_time; /* last time AOCD received */
diff --git a/sys/i4b/include/i4b_mbuf.h b/sys/i4b/include/i4b_mbuf.h
index 49ee26d..0d63abb 100644
--- a/sys/i4b/include/i4b_mbuf.h
+++ b/sys/i4b/include/i4b_mbuf.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b - mbuf handling support routines
* --------------------------------------
*
- * $Id: i4b_mbuf.h,v 1.6 1998/12/05 18:03:00 hm Exp $
+ * $Id: i4b_mbuf.h,v 1.7 1999/02/14 09:44:55 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:05:12 1998]
+ * last edit-date: [Sun Feb 14 10:04:26 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/i4b_avm_a1.c b/sys/i4b/layer1/i4b_avm_a1.c
index bb55979..0d20156 100644
--- a/sys/i4b/layer1/i4b_avm_a1.c
+++ b/sys/i4b/layer1/i4b_avm_a1.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1996 Andrew Gordon. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,9 +35,9 @@
* i4b_avm_a1.c - AVM A1/Fritz passive card driver for isdn4bsd
* ------------------------------------------------------------
*
- * $Id: i4b_avm_a1.c,v 1.20 1998/12/16 13:57:21 hm Exp $
+ * $Id: i4b_avm_a1.c,v 1.21 1999/02/14 09:44:58 hm Exp $
*
- * last edit-date: [Wed Dec 16 14:59:59 1998]
+ * last edit-date: [Sun Feb 14 10:25:11 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/i4b_avm_fritz_pci.c b/sys/i4b/layer1/i4b_avm_fritz_pci.c
new file mode 100644
index 0000000..da910b6
--- /dev/null
+++ b/sys/i4b/layer1/i4b_avm_fritz_pci.c
@@ -0,0 +1,1288 @@
+/*
+ * Copyright (c) 1999 Gary Jennejohn. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * 4. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software and/or documentation.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * Fritz!Card PCI specific routines for isic driver
+ * ------------------------------------------------
+ *
+ * $Id: i4b_avm_fritz_pci.c,v 1.1 1999/02/17 14:31:42 hm Exp $
+ *
+ * last edit-date: [Wed Feb 17 15:23:28 1999]
+ *
+ *---------------------------------------------------------------------------*/
+
+#include "isic.h"
+#include "opt_i4b.h"
+
+#if NISIC > 0 && defined(AVM_A1_PCI)
+
+#include <sys/param.h>
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#include <sys/ioccom.h>
+#else
+#include <sys/ioctl.h>
+#endif
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
+
+#include <machine/clock.h>
+#include <i386/isa/isa_device.h>
+#include <pci/pcivar.h> /* for pcici_t */
+
+#include <sys/socket.h>
+#include <net/if.h>
+
+#include <machine/i4b_debug.h>
+#include <machine/i4b_ioctl.h>
+
+#include <i4b/include/i4b_global.h>
+#include <i4b/include/i4b_l1l2.h>
+#include <i4b/include/i4b_mbuf.h>
+
+#include <i4b/layer1/i4b_l1.h>
+#include <i4b/layer1/i4b_isac.h>
+#include <i4b/layer1/i4b_hscx.h>
+
+/* prototypes */
+static void avma1pp_intr(struct isic_softc *);
+static void avma1pp_disable(struct isic_softc *);
+void avma1pp_map_int(pcici_t , void *, unsigned *);
+static void hscx_write_reg(int, u_int, u_int, struct isic_softc *);
+static u_char hscx_read_reg(int, u_int, struct isic_softc *);
+static u_int hscx_read_reg_int(int, u_int, struct isic_softc *);
+static void hscx_read_fifo(int, void *, size_t, struct isic_softc *);
+static void hscx_write_fifo(int, const void *, size_t, struct isic_softc *);
+static void avma1pp_hscx_int_handler(struct isic_softc *);
+static void avma1pp_hscx_intr(int, u_int, struct isic_softc *);
+static void avma1pp_init_linktab(struct isic_softc *);
+static void avma1pp_bchannel_setup(int, int, int, int);
+static void avma1pp_bchannel_start(int, int);
+static void avma1pp_hscx_init(struct isic_softc *, int, int);
+static void avma1pp_bchannel_stat(int, int, bchan_statistics_t *);
+static void avma1pp_fifo(isic_Bchan_t *, struct isic_softc *);
+static void avma1pp_set_linktab(int, int, drvr_link_t *);
+static isdn_link_t * avma1pp_ret_linktab(int, int);
+extern void isicintr_sc(struct isic_softc *);
+
+/*---------------------------------------------------------------------------*
+ * AVM PCI Fritz!Card special registers
+ *---------------------------------------------------------------------------*/
+
+/*
+ * register offsets from i/o base
+ */
+#define STAT0_OFFSET 0x02
+#define STAT1_OFFSET 0x03
+#define ADDR_REG_OFFSET 0x04
+/*#define MODREG_OFFSET 0x06
+#define VERREG_OFFSET 0x07*/
+/* these 2 are used to select an ISAC register set */
+#define ISAC_LO_REG_OFFSET 0x04
+#define ISAC_HI_REG_OFFSET 0x06
+/* offset higher than this goes to the HI register set */
+#define MAX_LO_REG_OFFSET 0x2f
+/* mask for the offset */
+#define ISAC_REGSET_MASK 0x0f
+/* the offset from the base to the ISAC registers */
+#define ISAC_REG_OFFSET 0x10
+/* the offset from the base to the ISAC FIFO */
+#define ISAC_FIFO 0x02
+/* not really the HSCX, but sort of */
+#define HSCX_FIFO 0x00
+#define HSCX_STAT 0x04
+/*
+ * AVM PCI Status Latch 0 read only bits
+ */
+#define ASL_IRQ_ISAC 0x01 /* ISAC interrupt, active low */
+#define ASL_IRQ_HSCX 0x02 /* HSX interrupt, active low */
+#define ASL_IRQ_TIMER 0x04 /* Timer interrupt, active low */
+#define ASL_IRQ_BCHAN ASL_IRQ_HSCX
+/* actually active LOW */
+#define ASL_IRQ_Pending (ASL_IRQ_ISAC | ASL_IRQ_HSCX | ASL_IRQ_TIMER)
+/*
+ * AVM Status Latch 0 write only bits
+ */
+#define ASL_RESET_ALL 0x01 /* reset siemens IC's, active 1 */
+#define ASL_TIMERDISABLE 0x02 /* active high */
+#define ASL_TIMERRESET 0x04 /* active high */
+#define ASL_ENABLE_INT 0x08 /* active high */
+#define ASL_TESTBIT 0x10 /* active high */
+/*
+ * AVM Status Latch 1 write only bits
+ */
+#define ASL1_INTSEL 0x0f /* active high */
+#define ASL1_ENABLE_IOM 0x80 /* active high */
+
+/*
+ * "HSCX" mode bits
+ */
+#define HSCX_MODE_ITF_FLG 0x01
+#define HSCX_MODE_TRANS 0x02
+#define HSCX_MODE_CCR_7 0x04
+#define HSCX_MODE_CCR_16 0x08
+#define HSCX_MODE_TESTLOOP 0x80
+
+/*
+ * "HSCX" status bits
+ */
+#define HSCX_STAT_RME 0x01
+#define HSCX_STAT_RDO 0x10
+#define HSCX_STAT_CRCVFRRAB 0x0E
+#define HSCX_STAT_CRCVFR 0x06
+#define HSCX_STAT_RML_MASK 0x3f00
+
+/*
+ * "HSCX" interrupt bits
+ */
+#define HSCX_INT_XPR 0x80
+#define HSCX_INT_XDU 0x40
+#define HSCX_INT_RPR 0x20
+#define HSCX_INT_MASK 0xE0
+
+/*
+ * "HSCX" command bits
+ */
+#define HSCX_CMD_XRS 0x80
+#define HSCX_CMD_XME 0x01
+#define HSCX_CMD_RRS 0x20
+#define HSCX_CMD_XML_MASK 0x3f00
+
+/*
+ * Commands and parameters are sent to the "HSCX" as a long, but the
+ * fields are handled as bytes.
+ *
+ * The long contains:
+ * (prot << 16)|(txl << 8)|cmd
+ *
+ * where:
+ * prot = protocol to use
+ * txl = transmit length
+ * cmd = the command to be executed
+ *
+ * The fields are defined as u_char in struct isic_softc.
+ *
+ * Macro to coalesce the byte fields into a u_int
+ */
+#define AVMA1PPSETCMDLONG(f) (f) = ((sc->avma1pp_cmd) | (sc->avma1pp_txl << 8) \
+ | (sc->avma1pp_prot << 16))
+
+/* "fake" addresses for the non-existent HSCX */
+/* note: the unit number is in the lower byte for both the ISAC and "HSCX" */
+#define HSCX0FAKE 0xfa000 /* read: fake0 */
+#define HSCX1FAKE 0xfa100 /* read: fake1 */
+#define IS_HSCX_MASK 0xfff00
+
+/*
+ * to prevent deactivating the "HSCX" when both channels are active we
+ * define an HSCX_ACTIVE flag which is or'd into the channel's state
+ * flag in avma1pp_bchannel_setup upon active and cleared upon deactivation.
+ * It is set high to allow room for new flags.
+ */
+#define HSCX_AVMA1PP_ACTIVE 0x1000
+
+/*---------------------------------------------------------------------------*
+ * AVM read fifo routines
+ *---------------------------------------------------------------------------*/
+static void
+avma1pp_read_fifo(void *buf, const void *base, size_t len)
+{
+ int unit;
+ struct isic_softc *sc;
+
+ unit = (int)base & 0xff;
+ sc = &isic_sc[unit];
+
+ /* check whether the target is an HSCX */
+ if (((int)base & IS_HSCX_MASK) == HSCX0FAKE)
+ {
+ hscx_read_fifo(0, buf, len, sc);
+ return;
+ }
+ if (((int)base & IS_HSCX_MASK) == HSCX1FAKE)
+ {
+ hscx_read_fifo(1, buf, len, sc);
+ return;
+ }
+ /* tell the board to access the ISAC fifo */
+ outb(sc->sc_port + ADDR_REG_OFFSET, ISAC_FIFO);
+ insb(sc->sc_port + ISAC_REG_OFFSET, (u_char *)buf, len);
+}
+
+static void
+hscx_read_fifo(int chan, void *buf, size_t len, struct isic_softc *sc)
+{
+ u_int *ip;
+ size_t cnt;
+
+ outl(sc->sc_port + ADDR_REG_OFFSET, chan);
+ ip = (u_int *)buf;
+ cnt = 0;
+ /* what if len isn't a multiple of sizeof(int) and buf is */
+ /* too small ???? */
+ while (cnt < len)
+ {
+ *ip++ = inl(sc->sc_port + ISAC_REG_OFFSET);
+ cnt += 4;
+ }
+}
+
+/*---------------------------------------------------------------------------*
+ * AVM write fifo routines
+ *---------------------------------------------------------------------------*/
+static void
+avma1pp_write_fifo(void *base, const void *buf, size_t len)
+{
+ int unit;
+ struct isic_softc *sc;
+
+ unit = (int)base & 0xff;
+ sc = &isic_sc[unit];
+
+ /* check whether the target is an HSCX */
+ if (((int)base & IS_HSCX_MASK) == HSCX0FAKE)
+ {
+ hscx_write_fifo(0, buf, len, sc);
+ return;
+ }
+ if (((int)base & IS_HSCX_MASK) == HSCX1FAKE)
+ {
+ hscx_write_fifo(1, buf, len, sc);
+ return;
+ }
+ /* tell the board to use the ISAC fifo */
+ outb(sc->sc_port + ADDR_REG_OFFSET, ISAC_FIFO);
+ outsb(sc->sc_port + ISAC_REG_OFFSET, (u_char *)buf, len);
+}
+
+static void
+hscx_write_fifo(int chan, const void *buf, size_t len, struct isic_softc *sc)
+{
+ register u_int *ip;
+ register size_t cnt;
+ isic_Bchan_t *Bchan = &sc->sc_chan[chan];
+
+ sc->avma1pp_cmd &= ~HSCX_CMD_XME;
+ sc->avma1pp_txl = 0;
+ if (len != sc->sc_bfifolen)
+ {
+ if (Bchan->bprot != BPROT_NONE)
+ sc->avma1pp_cmd |= HSCX_CMD_XME;
+ sc->avma1pp_txl = len;
+ }
+
+ cnt = 0; /* borrow cnt */
+ AVMA1PPSETCMDLONG(cnt);
+ hscx_write_reg(chan, HSCX_STAT, cnt, sc);
+
+ ip = (u_int *)buf;
+ cnt = 0;
+ while (cnt < len)
+ {
+ outl(sc->sc_port + ISAC_REG_OFFSET, *ip++);
+ cnt += 4;
+ }
+}
+
+/*---------------------------------------------------------------------------*
+ * AVM write register routines
+ *---------------------------------------------------------------------------*/
+static void
+avma1pp_write_reg(u_char *base, u_int offset, u_int v)
+{
+ int unit;
+ struct isic_softc *sc;
+ u_char reg_bank;
+
+ unit = (int)base & 0xff;
+ sc = &isic_sc[unit];
+
+ /* check whether the target is an HSCX */
+ if (((int)base & IS_HSCX_MASK) == HSCX0FAKE)
+ {
+ hscx_write_reg(0, offset, v, sc);
+ return;
+ }
+ if (((int)base & IS_HSCX_MASK) == HSCX0FAKE)
+ {
+ hscx_write_reg(1, offset, v, sc);
+ return;
+ }
+ /* must be the ISAC */
+ reg_bank = (offset > MAX_LO_REG_OFFSET) ? ISAC_HI_REG_OFFSET:ISAC_LO_REG_OFFSET;
+#ifdef AVMA1PCI_DEBUG
+ printf("write_reg bank %d off %d.. ", reg_bank, offset);
+#endif
+ /* set the register bank */
+ outb(sc->sc_port + ADDR_REG_OFFSET, reg_bank);
+ outb(sc->sc_port + ISAC_REG_OFFSET + (offset & ISAC_REGSET_MASK), v);
+}
+
+static void
+hscx_write_reg(int chan, u_int off, u_int val, struct isic_softc *sc)
+{
+ /* HACK */
+ if (off == H_MASK)
+ return;
+ /* point at the correct channel */
+ outl(sc->sc_port + ADDR_REG_OFFSET, chan);
+ outl(sc->sc_port + ISAC_REG_OFFSET + off, val);
+}
+
+/*---------------------------------------------------------------------------*
+ * AVM read register routines
+ *---------------------------------------------------------------------------*/
+static u_char
+avma1pp_read_reg(u_char *base, u_int offset)
+{
+ int unit;
+ struct isic_softc *sc;
+ u_char reg_bank;
+
+ unit = (int)base & 0xff;
+ sc = &isic_sc[unit];
+
+ /* check whether the target is an HSCX */
+ if (((int)base & IS_HSCX_MASK) == HSCX0FAKE)
+ return(hscx_read_reg(0, offset, sc));
+ if (((int)base & IS_HSCX_MASK) == HSCX1FAKE)
+ return(hscx_read_reg(1, offset, sc));
+ /* must be the ISAC */
+ reg_bank = (offset > MAX_LO_REG_OFFSET) ? ISAC_HI_REG_OFFSET:ISAC_LO_REG_OFFSET;
+#ifdef AVMA1PCI_DEBUG
+ printf("read_reg bank %d off %d.. ", reg_bank, offset);
+#endif
+ /* set the register bank */
+ outb(sc->sc_port + ADDR_REG_OFFSET, reg_bank);
+ return(inb(sc->sc_port + ISAC_REG_OFFSET +
+ (offset & ISAC_REGSET_MASK)));
+}
+
+static u_char
+hscx_read_reg(int chan, u_int off, struct isic_softc *sc)
+{
+ return(hscx_read_reg_int(chan, off, sc) & 0xff);
+}
+
+/*
+ * need to be able to reeturn an int because the RBCH is in the 2nd
+ * byte.
+ */
+static u_int
+hscx_read_reg_int(int chan, u_int off, struct isic_softc *sc)
+{
+ /* HACK */
+ if (off == H_ISTA)
+ return(0);
+ /* point at the correct channel */
+ outl(sc->sc_port + ADDR_REG_OFFSET, chan);
+ return(inl(sc->sc_port + ISAC_REG_OFFSET + off));
+}
+
+/*---------------------------------------------------------------------------*
+ * isic_attach_avma1pp - attach Fritz!Card PCI
+ *---------------------------------------------------------------------------*/
+int
+isic_attach_avma1pp(int unit, u_int iobase1, u_int iobase2)
+{
+ struct isic_softc *sc = &isic_sc[unit];
+ u_int v;
+
+ /* check max unit range */
+
+ if(unit >= ISIC_MAXUNIT)
+ {
+ printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for AVM FRITZ/PCI!\n",
+ unit, unit);
+ return(0);
+ }
+ sc->sc_unit = unit;
+
+ /* setup iobase */
+
+ if((iobase1 <= 0) || (iobase1 > 0xffff))
+ {
+ printf("isic%d: Error, invalid iobase 0x%x specified for AVM FRITZ/PCI!\n",
+ unit, iobase1);
+ return(0);
+ }
+ sc->sc_port = iobase1;
+
+ /* the ISAC lives at offset 0x10, but we can't use that. */
+ /* instead, put the unit number into the lower byte - HACK */
+ sc->sc_isac = (caddr_t)((int)(iobase1 & ~0xff) + unit);
+
+ /* this thing doesn't have an HSCX, so fake the base addresses */
+ /* put the unit number into the lower byte - HACK */
+ HSCX_A_BASE = (caddr_t)(HSCX0FAKE + unit);
+ HSCX_B_BASE = (caddr_t)(HSCX1FAKE + unit);
+
+ /* setup access routines */
+
+ sc->clearirq = NULL;
+ sc->readreg = avma1pp_read_reg;
+ sc->writereg = avma1pp_write_reg;
+
+ sc->readfifo = avma1pp_read_fifo;
+ sc->writefifo = avma1pp_write_fifo;
+
+ /* setup card type */
+
+ sc->sc_cardtyp = CARD_TYPEP_AVMA1PCI;
+
+ /* setup IOM bus type */
+
+ sc->sc_bustyp = BUS_TYPE_IOM2;
+
+ /* set up some other miscellaneous things */
+ sc->sc_ipac = 0;
+ sc->sc_bfifolen = HSCX_FIFO_LEN;
+
+ /* reset the card */
+ /* the Linux driver does this to clear any pending ISAC interrupts */
+ /* see if it helps any - XXXX */
+ v = 0;
+ v = ISAC_READ(I_STAR);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_STAR %x...", v);
+#endif
+ v = ISAC_READ(I_MODE);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_MODE %x...", v);
+#endif
+ v = ISAC_READ(I_ADF2);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_ADF2 %x...", v);
+#endif
+ v = ISAC_READ(I_ISTA);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_ISTA %x...", v);
+#endif
+ if (v & ISAC_ISTA_EXI)
+ {
+ v = ISAC_READ(I_EXIR);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_EXIR %x...", v);
+#endif
+ }
+ v = ISAC_READ(I_CIRR);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_CIRR %x...", v);
+#endif
+ ISAC_WRITE(I_MASK, 0xff);
+ /* the Linux driver does this to clear any pending HSCX interrupts */
+ v = hscx_read_reg_int(0, HSCX_STAT, sc);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: 0 HSCX_STAT %x...", v);
+#endif
+ v = hscx_read_reg_int(1, HSCX_STAT, sc);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: 1 HSCX_STAT %x\n", v);
+#endif
+
+ outb(sc->sc_port + STAT0_OFFSET, ASL_RESET_ALL|ASL_TIMERDISABLE);
+ DELAY(SEC_DELAY/100); /* 10 ms */
+ outb(sc->sc_port + STAT0_OFFSET, ASL_TIMERRESET|ASL_ENABLE_INT|ASL_TIMERDISABLE);
+ DELAY(SEC_DELAY/100); /* 10 ms */
+#ifdef AVMA1PCI_DEBUG
+ outb(sc->sc_port + STAT1_OFFSET, ASL1_ENABLE_IOM|sc->sc_irq);
+ DELAY(SEC_DELAY/100); /* 10 ms */
+ printf("after reset: S1 %#x\n", inb(sc->sc_port + STAT1_OFFSET));
+
+ v = inl(sc->sc_port);
+ printf("isic_attach_avma1pp: v %#x\n", v);
+#endif
+
+ /* from here to the end would normally be done in isic_pciattach */
+
+ /* sc->sc_isac_version = ((ISAC_READ(I_RBCH)) >> 5) & 0x03; */
+ printf("isic%d: ISAC %s (IOM-%c)\n", unit,
+ "2085 Version A1/A2 or 2086/2186 Version 1.1",
+ sc->sc_bustyp == BUS_TYPE_IOM1 ? '1' : '2');
+
+ /* init the ISAC */
+ isic_isac_init(sc);
+
+ /* init the "HSCX" */
+ avma1pp_bchannel_setup(sc->sc_unit, HSCX_CH_A, BPROT_NONE, 0);
+
+ avma1pp_bchannel_setup(sc->sc_unit, HSCX_CH_B, BPROT_NONE, 0);
+
+ /* XXXX - try it here too */
+ /* outb(sc->sc_port + STAT1_OFFSET, ASL1_ENABLE_IOM|sc->sc_irq);
+ DELAY(SEC_DELAY/100); */ /* 10 ms */
+
+ /* can't use the normal B-Channel stuff */
+ avma1pp_init_linktab(sc);
+
+ /* set trace level */
+
+ sc->sc_trace = TRACE_OFF;
+
+ sc->sc_state = ISAC_IDLE;
+
+ sc->sc_ibuf = NULL;
+ sc->sc_ib = NULL;
+ sc->sc_ilen = 0;
+
+ sc->sc_obuf = NULL;
+ sc->sc_op = NULL;
+ sc->sc_ol = 0;
+ sc->sc_freeflag = 0;
+
+ sc->sc_obuf2 = NULL;
+ sc->sc_freeflag2 = 0;
+
+#if defined(__FreeBSD__) && __FreeBSD__ >=3
+ callout_handle_init(&sc->sc_T3_callout);
+ callout_handle_init(&sc->sc_T4_callout);
+#endif
+
+ /* init higher protocol layers */
+
+ MPH_Status_Ind(sc->sc_unit, STI_ATTACH, sc->sc_cardtyp);
+
+ return(1);
+}
+
+/*
+ * this is the real interrupt routine
+ */
+static void
+avma1pp_hscx_intr(int h_chan, u_int stat, struct isic_softc *sc)
+{
+ register isic_Bchan_t *chan = &sc->sc_chan[h_chan];
+ int activity = -1;
+ u_int param = 0;
+
+ DBGL1(L1_H_IRQ, "avma1pp_hscx_intr", ("%#x\n", stat));
+
+ if((stat & HSCX_INT_XDU) && (chan->bprot != BPROT_NONE))/* xmit data underrun */
+ {
+ chan->stat_XDU++;
+ DBGL1(L1_H_XFRERR, "avma1pp_hscx_intr", ("xmit data underrun\n"));
+ /* abort the transmission */
+ sc->avma1pp_txl = 0;
+ sc->avma1pp_cmd |= HSCX_CMD_XRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd &= ~HSCX_CMD_XRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+
+ if (chan->out_mbuf_head != NULL) /* don't continue to transmit this buffer */
+ {
+ i4b_Bfreembuf(chan->out_mbuf_head);
+ chan->out_mbuf_cur = chan->out_mbuf_head = NULL;
+ }
+ }
+
+ /*
+ * The following is based on examination of the Linux driver. Who
+ * knows whether it's entirely correct ?
+ *
+ * The logic here is different than with a "real" HSCX; all kinds
+ * of information (interrupt/status bits) are in stat.
+ * HSCX_INT_RPR indicates a receive interrupt
+ * HSCX_STAT_RDO indicates an overrun condition, abort -
+ * otherwise read the bytes ((stat & HSCX_STZT_RML_MASK) >> 8)
+ * HSCX_STAT_RME indicates end-of-frame and apparently any
+ * CRC/framing errors are only reported in this state.
+ * if ((stat & HSCX_STAT_CRCVFRRAB) != HSCX_STAT_CRCVFR)
+ * CRC/framing error
+ */
+
+ if(stat & HSCX_INT_RPR)
+ {
+ register int fifo_data_len;
+ int error = 0;
+ /* always have to read the FIFO, so use a scratch buffer */
+ u_char scrbuf[HSCX_FIFO_LEN];
+
+ if(stat & HSCX_STAT_RDO)
+ {
+ chan->stat_RDO++;
+ DBGL1(L1_H_XFRERR, "avma1pp_hscx_intr", ("receive data overflow\n"));
+ error++;
+ }
+
+ fifo_data_len = ((stat & HSCX_STAT_RML_MASK) >> 8);
+
+ if(fifo_data_len == 0)
+ fifo_data_len = sc->sc_bfifolen;
+
+ /* ALWAYS read data from HSCX fifo */
+
+ HSCX_RDFIFO(h_chan, scrbuf, fifo_data_len);
+ chan->rxcount += fifo_data_len;
+
+ /* all error conditions checked, now decide and take action */
+
+ if(error == 0)
+ {
+ if(chan->in_mbuf == NULL)
+ {
+ if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL)
+ panic("L1 avma1pp_hscx_intr: RME, cannot allocate mbuf!\n");
+ chan->in_cbptr = chan->in_mbuf->m_data;
+ chan->in_len = 0;
+ }
+
+ if((chan->in_len + fifo_data_len) <= BCH_MAX_DATALEN)
+ {
+ /* OK to copy the data */
+ bcopy(scrbuf, chan->in_cbptr, fifo_data_len);
+ chan->in_cbptr += fifo_data_len;
+ chan->in_len += fifo_data_len;
+
+ /* setup mbuf data length */
+
+ chan->in_mbuf->m_len = chan->in_len;
+ chan->in_mbuf->m_pkthdr.len = chan->in_len;
+
+ if(sc->sc_trace & TRACE_B_RX)
+ {
+ i4b_trace_hdr_t hdr;
+ hdr.unit = sc->sc_unit;
+ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2);
+ hdr.dir = FROM_NT;
+ hdr.count = ++sc->sc_trace_bcount;
+ MICROTIME(hdr.time);
+ MPH_Trace_Ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data);
+ }
+
+ if (stat & HSCX_STAT_RME)
+ {
+ if((stat & HSCX_STAT_CRCVFRRAB) == HSCX_STAT_CRCVFR)
+ {
+ (*chan->drvr_linktab->bch_rx_data_ready)(chan->drvr_linktab->unit);
+ activity = ACT_RX;
+
+ /* mark buffer ptr as unused */
+
+ chan->in_mbuf = NULL;
+ chan->in_cbptr = NULL;
+ chan->in_len = 0;
+ }
+ else
+ {
+ chan->stat_CRC++;
+ DBGL1(L1_H_XFRERR, "avma1pp_hscx_intr", ("CRC/RAB\n"));
+ if (chan->in_mbuf != NULL)
+ {
+ i4b_Bfreembuf(chan->in_mbuf);
+ chan->in_mbuf = NULL;
+ chan->in_cbptr = NULL;
+ chan->in_len = 0;
+ }
+ }
+ }
+ } /* END enough space in mbuf */
+ else
+ {
+ if(chan->bprot == BPROT_NONE)
+ {
+ /* setup mbuf data length */
+
+ chan->in_mbuf->m_len = chan->in_len;
+ chan->in_mbuf->m_pkthdr.len = chan->in_len;
+
+ if(sc->sc_trace & TRACE_B_RX)
+ {
+ i4b_trace_hdr_t hdr;
+ hdr.unit = sc->sc_unit;
+ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2);
+ hdr.dir = FROM_NT;
+ hdr.count = ++sc->sc_trace_bcount;
+ MICROTIME(hdr.time);
+ MPH_Trace_Ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data);
+ }
+
+ /* move rx'd data to rx queue */
+
+ IF_ENQUEUE(&chan->rx_queue, chan->in_mbuf);
+
+ (*chan->drvr_linktab->bch_rx_data_ready)(chan->drvr_linktab->unit);
+
+ if(!(isic_hscx_silence(chan->in_mbuf->m_data, chan->in_mbuf->m_len)))
+ activity = ACT_RX;
+
+ /* alloc new buffer */
+
+ if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL)
+ panic("L1 avma1pp_hscx_intr: RPF, cannot allocate new mbuf!\n");
+
+ /* setup new data ptr */
+
+ chan->in_cbptr = chan->in_mbuf->m_data;
+
+ /* OK to copy the data */
+ bcopy(scrbuf, chan->in_cbptr, fifo_data_len);
+
+ chan->in_cbptr += fifo_data_len;
+ chan->in_len = fifo_data_len;
+
+ chan->rxcount += fifo_data_len;
+ }
+ else
+ {
+ DBGL1(L1_H_XFRERR, "avma1pp_hscx_intr", ("RAWHDLC rx buffer overflow in RPF, in_len=%d\n", chan->in_len));
+ chan->in_cbptr = chan->in_mbuf->m_data;
+ chan->in_len = 0;
+ }
+ }
+ } /* if(error == 0) */
+ else
+ {
+ /* land here for RDO */
+ if (chan->in_mbuf != NULL)
+ {
+ i4b_Bfreembuf(chan->in_mbuf);
+ chan->in_mbuf = NULL;
+ chan->in_cbptr = NULL;
+ chan->in_len = 0;
+ }
+ sc->avma1pp_txl = 0;
+ sc->avma1pp_cmd |= HSCX_CMD_RRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd &= ~HSCX_CMD_RRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ }
+ }
+
+
+ /* transmit fifo empty, new data can be written to fifo */
+
+ if(stat & HSCX_INT_XPR)
+ {
+ /*
+ * for a description what is going on here, please have
+ * a look at isic_bchannel_start() in i4b_bchan.c !
+ */
+
+ /* int len;
+ int nextlen; */
+
+ DBGL1(L1_H_IRQ, "avma1pp_hscx_intr", ("unit %d, chan %d - XPR, Tx Fifo Empty!\n", sc->sc_unit, h_chan));
+
+ if(chan->out_mbuf_cur == NULL) /* last frame is transmitted */
+ {
+ IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head);
+
+ if(chan->out_mbuf_head == NULL)
+ {
+ chan->state &= ~HSCX_TX_ACTIVE;
+ (*chan->drvr_linktab->bch_tx_queue_empty)(chan->drvr_linktab->unit);
+ }
+ else
+ {
+ chan->state |= HSCX_TX_ACTIVE;
+ chan->out_mbuf_cur = chan->out_mbuf_head;
+ chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data;
+ chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len;
+
+ if(sc->sc_trace & TRACE_B_TX)
+ {
+ i4b_trace_hdr_t hdr;
+ hdr.unit = sc->sc_unit;
+ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2);
+ hdr.dir = FROM_TE;
+ hdr.count = ++sc->sc_trace_bcount;
+ MICROTIME(hdr.time);
+ MPH_Trace_Ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data);
+ }
+
+ if(chan->bprot == BPROT_NONE)
+ {
+ if(!(isic_hscx_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len)))
+ activity = ACT_TX;
+ }
+ else
+ {
+ activity = ACT_TX;
+ }
+ }
+ }
+
+ avma1pp_fifo(chan, sc);
+ }
+
+ /* call timeout handling routine */
+
+ if(activity == ACT_RX || activity == ACT_TX)
+ (*chan->drvr_linktab->bch_activity)(chan->drvr_linktab->unit, activity);
+}
+
+/*
+ * this is the main routine which checks each channel and then calls
+ * the real interrupt routine as appropriate
+ */
+static void
+avma1pp_hscx_int_handler(struct isic_softc *sc)
+{
+ u_int stat;
+
+ /* has to be a u_int because the byte count is in the 2nd byte */
+ stat = hscx_read_reg_int(0, HSCX_STAT, sc);
+ if (stat & HSCX_INT_MASK)
+ avma1pp_hscx_intr(0, stat, sc);
+ stat = hscx_read_reg_int(1, HSCX_STAT, sc);
+ if (stat & HSCX_INT_MASK)
+ avma1pp_hscx_intr(1, stat, sc);
+}
+
+static void
+avma1pp_disable(struct isic_softc *sc)
+{
+ outb(sc->sc_port + STAT0_OFFSET, ASL_RESET_ALL|ASL_TIMERDISABLE);
+}
+
+static void
+avma1pp_intr(struct isic_softc *sc)
+{
+ u_char stat;
+
+ stat = inb(sc->sc_port + STAT0_OFFSET);
+ DBGL1(L1_H_IRQ, "avma1pp_intr", ("stat %x\n", stat));
+ /* was there an interrupt from this card ? */
+ if ((stat & ASL_IRQ_Pending) == ASL_IRQ_Pending)
+ return; /* no */
+ /* interrupts are low active */
+ if (!(stat & ASL_IRQ_TIMER))
+ DBGL1(L1_H_IRQ, "avma1pp_intr", ("timer interrupt ???\n"));
+ if (!(stat & ASL_IRQ_HSCX))
+ {
+ DBGL1(L1_H_IRQ, "avma1pp_intr", ("HSCX\n"));
+ avma1pp_hscx_int_handler(sc);
+ }
+ if (!(stat & ASL_IRQ_ISAC))
+ {
+ DBGL1(L1_H_IRQ, "avma1pp_intr", ("ISAC\n"));
+ isicintr_sc(sc);
+ }
+}
+
+void
+avma1pp_map_int(pcici_t config_id, void *pisc, unsigned *net_imask)
+{
+ struct isic_softc *sc = (struct isic_softc *)pisc;
+
+ /* may need the irq later */
+ sc->sc_irq = config_id->intline;
+
+ if(!(pci_map_int(config_id, (void *)avma1pp_intr, sc, net_imask)))
+ {
+ printf("Failed to map interrupt for AVM Fritz!Card PCI\n");
+ /* disable the card */
+ avma1pp_disable(sc);
+ }
+}
+
+static void
+avma1pp_hscx_init(struct isic_softc *sc, int h_chan, int activate)
+{
+ isic_Bchan_t *chan = &sc->sc_chan[h_chan];
+ u_int param = 0;
+
+ DBGL1(L1_BCHAN, "avma1pp_hscx_init", ("unit=%d, channel=%d, %s\n",
+ sc->sc_unit, h_chan, activate ? "activate" : "deactivate"));
+
+ if (activate == 0)
+ {
+ /* only deactivate if both channels are idle */
+ if (sc->sc_chan[HSCX_CH_A].state != HSCX_IDLE ||
+ sc->sc_chan[HSCX_CH_B].state != HSCX_IDLE)
+ {
+ return;
+ }
+ sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS;
+ sc->avma1pp_prot = HSCX_MODE_TRANS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ return;
+ }
+ if(chan->bprot == BPROT_RHDLC)
+ {
+ DBGL1(L1_BCHAN, "avma1pp_hscx_init", ("BPROT_RHDLC\n"));
+
+ /* HDLC Frames, transparent mode 0 */
+ sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS;
+ sc->avma1pp_prot = HSCX_MODE_ITF_FLG;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd = HSCX_CMD_XRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd = 0;
+ }
+ else
+ {
+ DBGL1(L1_BCHAN, "avma1pp_hscx_init", ("BPROT_NONE??\n"));
+
+ /* Raw Telephony, extended transparent mode 1 */
+ sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS;
+ sc->avma1pp_prot = HSCX_MODE_TRANS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd = HSCX_CMD_XRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd = 0;
+ }
+}
+
+static void
+avma1pp_bchannel_setup(int unit, int h_chan, int bprot, int activate)
+{
+#ifdef __FreeBSD__
+ struct isic_softc *sc = &isic_sc[unit];
+#else
+ struct isic_softc *sc = isic_find_sc(unit);
+#endif
+ isic_Bchan_t *chan = &sc->sc_chan[h_chan];
+
+ int s = SPLI4B();
+
+ if(activate == 0)
+ {
+ /* deactivation */
+ chan->state &= ~HSCX_AVMA1PP_ACTIVE;
+ avma1pp_hscx_init(sc, h_chan, activate);
+ }
+
+ DBGL1(L1_BCHAN, "avma1pp_bchannel_setup", ("unit=%d, channel=%d, %s\n",
+ sc->sc_unit, h_chan, activate ? "activate" : "deactivate"));
+
+ /* general part */
+
+ chan->unit = sc->sc_unit; /* unit number */
+ chan->channel = h_chan; /* B channel */
+ chan->bprot = bprot; /* B channel protocol */
+ chan->state = HSCX_IDLE; /* B channel state */
+
+ /* receiver part */
+
+ i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */
+
+ chan->rx_queue.ifq_maxlen = IFQ_MAXLEN;
+
+ chan->rxcount = 0; /* reset rx counter */
+
+ i4b_Bfreembuf(chan->in_mbuf); /* clean rx mbuf */
+
+ chan->in_mbuf = NULL; /* reset mbuf ptr */
+ chan->in_cbptr = NULL; /* reset mbuf curr ptr */
+ chan->in_len = 0; /* reset mbuf data len */
+
+ /* transmitter part */
+
+ i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */
+
+ chan->tx_queue.ifq_maxlen = IFQ_MAXLEN;
+
+ chan->txcount = 0; /* reset tx counter */
+
+ i4b_Bfreembuf(chan->out_mbuf_head); /* clean tx mbuf */
+
+ chan->out_mbuf_head = NULL; /* reset head mbuf ptr */
+ chan->out_mbuf_cur = NULL; /* reset current mbuf ptr */
+ chan->out_mbuf_cur_ptr = NULL; /* reset current mbuf data ptr */
+ chan->out_mbuf_cur_len = 0; /* reset current mbuf data cnt */
+
+ if(activate != 0)
+ {
+ /* activation */
+ avma1pp_hscx_init(sc, h_chan, activate);
+ chan->state |= HSCX_AVMA1PP_ACTIVE;
+ }
+
+ splx(s);
+}
+
+static void
+avma1pp_bchannel_start(int unit, int h_chan)
+{
+#ifdef __FreeBSD__
+ struct isic_softc *sc = &isic_sc[unit];
+#else
+ struct isic_softc *sc = isic_find_sc(unit);
+#endif
+
+ register isic_Bchan_t *chan = &sc->sc_chan[h_chan];
+
+ int s;
+ int activity = -1;
+#if 0 /* moved to avma1pp_fifo */
+ /* the "HSCX" probably only allows writing all bytes at once */
+ /* so we need a scratch buffer to collect the bytes */
+ u_char scrbuf[HSCX_FIFO_LEN];
+ int i;
+ register int next_len;
+ register int len;
+#endif
+
+ s = SPLI4B(); /* enter critical section */
+ if(chan->state & HSCX_TX_ACTIVE) /* already running ? */
+ {
+ splx(s);
+ return; /* yes, leave */
+ }
+
+ /* get next mbuf from queue */
+
+ IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head);
+
+ if(chan->out_mbuf_head == NULL) /* queue empty ? */
+ {
+ splx(s); /* leave critical section */
+ return; /* yes, exit */
+ }
+
+ /* init current mbuf values */
+
+ chan->out_mbuf_cur = chan->out_mbuf_head;
+ chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len;
+ chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data;
+
+ /* activity indicator for timeout handling */
+
+ if(chan->bprot == BPROT_NONE)
+ {
+ if(!(isic_hscx_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len)))
+ activity = ACT_TX;
+ }
+ else
+ {
+ activity = ACT_TX;
+ }
+
+ chan->state |= HSCX_TX_ACTIVE; /* we start transmitting */
+
+ if(sc->sc_trace & TRACE_B_TX) /* if trace, send mbuf to trace dev */
+ {
+ i4b_trace_hdr_t hdr;
+ hdr.unit = unit;
+ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2);
+ hdr.dir = FROM_TE;
+ hdr.count = ++sc->sc_trace_bcount;
+ MICROTIME(hdr.time);
+ MPH_Trace_Ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data);
+ }
+
+ avma1pp_fifo(chan, sc);
+
+ /* call timeout handling routine */
+
+ if(activity == ACT_RX || activity == ACT_TX)
+ (*chan->drvr_linktab->bch_activity)(chan->drvr_linktab->unit, activity);
+
+ splx(s);
+}
+
+/*---------------------------------------------------------------------------*
+ * return the address of isic drivers linktab
+ *---------------------------------------------------------------------------*/
+static isdn_link_t *
+avma1pp_ret_linktab(int unit, int channel)
+{
+#ifdef __FreeBSD__
+ struct isic_softc *sc = &isic_sc[unit];
+#else
+ struct isic_softc *sc = isic_find_sc(unit);
+#endif
+ isic_Bchan_t *chan = &sc->sc_chan[channel];
+
+ return(&chan->isdn_linktab);
+}
+
+/*---------------------------------------------------------------------------*
+ * set the driver linktab in the b channel softc
+ *---------------------------------------------------------------------------*/
+static void
+avma1pp_set_linktab(int unit, int channel, drvr_link_t *dlt)
+{
+#ifdef __FreeBSD__
+ struct isic_softc *sc = &isic_sc[unit];
+#else
+ struct isic_softc *sc = isic_find_sc(unit);
+#endif
+ isic_Bchan_t *chan = &sc->sc_chan[channel];
+
+ chan->drvr_linktab = dlt;
+}
+
+
+/*---------------------------------------------------------------------------*
+ * initialize our local linktab
+ *---------------------------------------------------------------------------*/
+static void
+avma1pp_init_linktab(struct isic_softc *sc)
+{
+ isic_Bchan_t *chan = &sc->sc_chan[HSCX_CH_A];
+ isdn_link_t *lt = &chan->isdn_linktab;
+
+ /* make sure the hardware driver is known to layer 4 */
+ /* avoid overwriting if already set */
+ if (ctrl_types[CTRL_PASSIVE].set_linktab == NULL)
+ {
+ ctrl_types[CTRL_PASSIVE].set_linktab = avma1pp_set_linktab;
+ ctrl_types[CTRL_PASSIVE].get_linktab = avma1pp_ret_linktab;
+ }
+
+ /* local setup */
+ lt->unit = sc->sc_unit;
+ lt->channel = HSCX_CH_A;
+ lt->bch_config = avma1pp_bchannel_setup;
+ lt->bch_tx_start = avma1pp_bchannel_start;
+ lt->bch_stat = avma1pp_bchannel_stat;
+ lt->tx_queue = &chan->tx_queue;
+
+ /* used by non-HDLC data transfers, i.e. telephony drivers */
+ lt->rx_queue = &chan->rx_queue;
+
+ /* used by HDLC data transfers, i.e. ipr and isp drivers */
+ lt->rx_mbuf = &chan->in_mbuf;
+
+ chan = &sc->sc_chan[HSCX_CH_B];
+ lt = &chan->isdn_linktab;
+
+ lt->unit = sc->sc_unit;
+ lt->channel = HSCX_CH_B;
+ lt->bch_config = avma1pp_bchannel_setup;
+ lt->bch_tx_start = avma1pp_bchannel_start;
+ lt->bch_stat = avma1pp_bchannel_stat;
+ lt->tx_queue = &chan->tx_queue;
+
+ /* used by non-HDLC data transfers, i.e. telephony drivers */
+ lt->rx_queue = &chan->rx_queue;
+
+ /* used by HDLC data transfers, i.e. ipr and isp drivers */
+ lt->rx_mbuf = &chan->in_mbuf;
+}
+
+/*
+ * use this instead of isic_bchannel_stat in i4b_bchan.c because it's static
+ */
+static void
+avma1pp_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp)
+{
+#ifdef __FreeBSD__
+ struct isic_softc *sc = &isic_sc[unit];
+#else
+ struct isic_softc *sc = isic_find_sc(unit);
+#endif
+ isic_Bchan_t *chan = &sc->sc_chan[h_chan];
+ int s;
+
+ s = SPLI4B();
+
+ bsp->outbytes = chan->txcount;
+ bsp->inbytes = chan->rxcount;
+
+ chan->txcount = 0;
+ chan->rxcount = 0;
+
+ splx(s);
+}
+
+/*
+ * moved here from avma1pp_bchan_start and avma1pp_hscx_intr
+ */
+static void
+avma1pp_fifo(isic_Bchan_t *chan, struct isic_softc *sc)
+{
+ int len;
+ int nextlen;
+ int i;
+ /* the "HSCX" probably only allows writing all bytes at once */
+ /* so we need a scratch buffer to collect the bytes */
+ u_char scrbuf[HSCX_FIFO_LEN];
+
+ len = 0;
+
+ while(chan->out_mbuf_cur && len != sc->sc_bfifolen)
+ {
+ nextlen = min(chan->out_mbuf_cur_len, sc->sc_bfifolen - len);
+
+#ifdef NOTDEF
+ printf("i:mh=%p, mc=%p, mcp=%p, mcl=%d l=%d nl=%d # ",
+ chan->out_mbuf_head,
+ chan->out_mbuf_cur,
+ chan->out_mbuf_cur_ptr,
+ chan->out_mbuf_cur_len,
+ len,
+ nextlen);
+#endif
+
+ /* collect the data in the scratch buffer */
+ for (i = 0; i < nextlen; i++)
+ scrbuf[i + len] = chan->out_mbuf_cur_ptr[i];
+
+ len += nextlen;
+ chan->txcount += nextlen;
+
+ chan->out_mbuf_cur_ptr += nextlen;
+ chan->out_mbuf_cur_len -= nextlen;
+
+ if(chan->out_mbuf_cur_len == 0)
+ {
+ if((chan->out_mbuf_cur = chan->out_mbuf_cur->m_next) != NULL)
+ {
+ chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data;
+ chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len;
+
+ if(sc->sc_trace & TRACE_B_TX)
+ {
+ i4b_trace_hdr_t hdr;
+ hdr.unit = sc->sc_unit;
+ hdr.type = (chan->channel == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2);
+ hdr.dir = FROM_TE;
+ hdr.count = ++sc->sc_trace_bcount;
+ MICROTIME(hdr.time);
+ MPH_Trace_Ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data);
+ }
+ }
+ else
+ {
+ i4b_Bfreembuf(chan->out_mbuf_head);
+ chan->out_mbuf_head = NULL;
+ }
+ }
+ }
+ /* write what we have from the scratch buf to the "HSCX" fifo */
+
+ /* HSCX_WRFIFO also sets the XME */
+ HSCX_WRFIFO(chan->channel, scrbuf, len);
+}
+
+#endif /* NISIC > 0 && defined(AVM_A1_PCI) */
diff --git a/sys/i4b/layer1/i4b_avm_fritz_pcmcia.c b/sys/i4b/layer1/i4b_avm_fritz_pcmcia.c
index 483eb66..a4ee3e8 100644
--- a/sys/i4b/layer1/i4b_avm_fritz_pcmcia.c
+++ b/sys/i4b/layer1/i4b_avm_fritz_pcmcia.c
@@ -33,9 +33,9 @@
* Fritz!Card pcmcia specific routines for isic driver
* ---------------------------------------------------
*
- * $Id: i4b_avm_fritz_pcmcia.c,v 1.7 1998/12/01 21:25:53 hm Exp $
+ * $Id: i4b_avm_fritz_pcmcia.c,v 1.8 1999/02/14 09:44:58 hm Exp $
*
- * last edit-date: [Tue Dec 1 22:03:51 1998]
+ * last edit-date: [Sun Feb 14 10:25:21 1999]
*
* -ap added support for AVM PCMCIA Fritz!Card
* -mh split into separate file
diff --git a/sys/i4b/layer1/i4b_bchan.c b/sys/i4b/layer1/i4b_bchan.c
index 17ee273..e047c93 100644
--- a/sys/i4b/layer1/i4b_bchan.c
+++ b/sys/i4b/layer1/i4b_bchan.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_bchan.c - B channel handling L1 procedures
* ----------------------------------------------
*
- * $Id: i4b_bchan.c,v 1.28 1998/12/05 18:04:28 hm Exp $
+ * $Id: i4b_bchan.c,v 1.30 1999/02/14 19:51:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:21:57 1998]
+ * last edit-date: [Sun Feb 14 10:25:27 1999]
*
*---------------------------------------------------------------------------*/
@@ -56,7 +56,9 @@
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#else
+#ifndef __bsdi__
#include <machine/bus.h>
+#endif
#include <sys/device.h>
#endif
diff --git a/sys/i4b/layer1/i4b_ctx_s0P.c b/sys/i4b/layer1/i4b_ctx_s0P.c
index f9e6b7f..b5314db 100644
--- a/sys/i4b/layer1/i4b_ctx_s0P.c
+++ b/sys/i4b/layer1/i4b_ctx_s0P.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* isic - I4B Siemens ISDN Chipset Driver for Creatix PnP cards
* ============================================================
*
- * $Id: i4b_ctx_s0P.c,v 1.17 1998/12/16 09:32:50 hm Exp $
+ * $Id: i4b_ctx_s0P.c,v 1.18 1999/02/14 09:44:58 hm Exp $
*
- * last edit-date: [Mon Dec 14 17:26:30 1998]
+ * last edit-date: [Sun Feb 14 10:25:33 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/i4b_drn_ngo.c b/sys/i4b/layer1/i4b_drn_ngo.c
index a5f3d69..75aa990 100644
--- a/sys/i4b/layer1/i4b_drn_ngo.c
+++ b/sys/i4b/layer1/i4b_drn_ngo.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_drn_ngo.c - Dr. Neuhaus Niccy GO@ and SAGEM Cybermod
* --------------------------------------------------------
*
- * $Id: i4b_drn_ngo.c,v 1.19 1998/12/16 09:32:50 hm Exp $
+ * $Id: i4b_drn_ngo.c,v 1.20 1999/02/14 09:44:58 hm Exp $
*
- * last edit-date: [Mon Dec 14 17:26:03 1998]
+ * last edit-date: [Sun Feb 14 10:25:39 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/i4b_dynalink.c b/sys/i4b/layer1/i4b_dynalink.c
index 846e79a..e316682 100644
--- a/sys/i4b/layer1/i4b_dynalink.c
+++ b/sys/i4b/layer1/i4b_dynalink.c
@@ -33,9 +33,9 @@
* isdn4bsd layer1 driver for Dynalink IS64PH isdn TA
* ==================================================
*
- * $Id: i4b_dynalink.c,v 1.8 1998/12/17 04:55:38 hm Exp $
+ * $Id: i4b_dynalink.c,v 1.9 1999/02/14 09:44:58 hm Exp $
*
- * last edit-date: [Thu Dec 17 05:50:39 1998]
+ * last edit-date: [Sun Feb 14 10:26:21 1999]
*
* written by Martijn Plak <tigrfhur@xs4all.nl>
*
diff --git a/sys/i4b/layer1/i4b_elsa_isdnmc.c b/sys/i4b/layer1/i4b_elsa_isdnmc.c
index c6987f5..1924fce 100644
--- a/sys/i4b/layer1/i4b_elsa_isdnmc.c
+++ b/sys/i4b/layer1/i4b_elsa_isdnmc.c
@@ -33,9 +33,9 @@
* ELSA MicroLink ISDN/MC card specific routines
* ---------------------------------------------
*
- * $Id: i4b_elsa_isdnmc.c,v 1.2 1998/12/05 18:04:33 hm Exp $
+ * $Id: i4b_elsa_isdnmc.c,v 1.4 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Tue Dec 1 07:45:53 1998]
+ * last edit-date: [Sun Feb 14 10:26:25 1999]
*
* -mh added support for elsa ISDN/mc
*
@@ -94,6 +94,7 @@ static u_int8_t elsa_isdnmc_read_reg __P((struct isic_softc *sc, int what, bus_s
static void elsa_isdnmc_write_reg __P((struct isic_softc *sc, int what, bus_size_t offs, u_int8_t data));
static void elsa_isdnmc_read_fifo __P((struct isic_softc *sc, int what, void *buf, size_t size));
static void elsa_isdnmc_write_fifo __P((struct isic_softc *sc, int what, const void *data, size_t size));
+static void elsa_isdnmc_clrirq __P((struct isic_softc *sc));
#endif
/*
@@ -107,6 +108,24 @@ static void elsa_isdnmc_write_fifo __P((struct isic_softc *sc, int what, const v
/* This is very similar to the ELSA QuickStep 1000 (ISA) card */
+#ifdef __FreeBSD__
+static void
+elsa_isdnmc_clrirq(void *base)
+{
+}
+#else
+static void
+elsa_isdnmc_clrirq(struct isic_softc *sc)
+{
+ ISAC_WRITE(I_MASK, 0xff);
+ HSCX_WRITE(0, H_MASK, 0xff);
+ HSCX_WRITE(1, H_MASK, 0xff);
+ ISAC_WRITE(I_MASK, ISAC_IMASK);
+ HSCX_WRITE(0, H_MASK, HSCX_A_IMASK);
+ HSCX_WRITE(1, H_MASK, HSCX_B_IMASK);
+}
+#endif
+
/*---------------------------------------------------------------------------*
* read fifo routines
*---------------------------------------------------------------------------*/
@@ -284,7 +303,8 @@ isic_attach_elsaisdnmc(struct pcmcia_isic_softc *psc, struct pcmcia_config_entry
t = sc->sc_maps[0].t;
h = sc->sc_maps[0].h;
- sc->clearirq = NULL;
+ sc->clearirq = elsa_isdnmc_clrirq;
+
sc->readreg = elsa_isdnmc_read_reg;
sc->writereg = elsa_isdnmc_write_reg;
diff --git a/sys/i4b/layer1/i4b_elsa_mcall.c b/sys/i4b/layer1/i4b_elsa_mcall.c
index 36882e9..5ad5620 100644
--- a/sys/i4b/layer1/i4b_elsa_mcall.c
+++ b/sys/i4b/layer1/i4b_elsa_mcall.c
@@ -33,9 +33,9 @@
* ELSA MicroLink MC/all card specific routines
* --------------------------------------------
*
- * $Id: i4b_elsa_mcall.c,v 1.1 1998/12/02 06:44:27 hm Exp $
+ * $Id: i4b_elsa_mcall.c,v 1.2 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Tue Dec 1 07:45:53 1998]
+ * last edit-date: [Sun Feb 14 10:26:29 1999]
*
* -mh started support for ELSA MC/all
*
diff --git a/sys/i4b/layer1/i4b_elsa_qs1i.c b/sys/i4b/layer1/i4b_elsa_qs1i.c
index a6b5181..d43a637 100644
--- a/sys/i4b/layer1/i4b_elsa_qs1i.c
+++ b/sys/i4b/layer1/i4b_elsa_qs1i.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* isic - I4B Siemens ISDN Chipset Driver for ELSA Quickstep 1000pro ISA
* =====================================================================
*
- * $Id: i4b_elsa_qs1i.c,v 1.1 1998/12/27 21:46:45 phk Exp $
+ * $Id: i4b_elsa_qs1i.c,v 1.14 1999/02/14 11:02:04 hm Exp $
*
- * last edit-date: [Mon Dec 14 17:27:08 1998]
+ * last edit-date: [Sun Feb 14 11:59:45 1999]
*
*---------------------------------------------------------------------------*/
@@ -86,7 +86,7 @@
#include <i4b/layer1/i4b_hscx.h>
#ifdef __FreeBSD__
-/* static void i4b_eq1i_clrirq(void* base); */
+static void i4b_eq1i_clrirq(void* base);
#else
static void i4b_eq1i_clrirq(struct isic_softc *sc);
void isic_attach_Eqs1pi __P((struct isic_softc *sc));
@@ -125,13 +125,12 @@ void isic_attach_Eqs1pi __P((struct isic_softc *sc));
* ELSA QuickStep 1000pro/ISA clear IRQ routine
*---------------------------------------------------------------------------*/
#ifdef __FreeBSD__
-#ifdef notdef
static void
i4b_eq1i_clrirq(void* base)
{
outb((u_int)base + ELSA_OFF_IRQ, 0);
}
-#endif
+
#else
static void
i4b_eq1i_clrirq(struct isic_softc *sc)
@@ -402,9 +401,7 @@ isic_probe_Eqs1pi(struct isa_device *dev, unsigned int iobase2)
/* setup access routines */
-/* XXX no "sc_clearirq" in sight... /phk
- sc->sc_clearirq = i4b_eq1i_clrirq;
-*/
+ sc->clearirq = i4b_eq1i_clrirq;
sc->readreg = eqs1pi_read_reg;
sc->writereg = eqs1pi_write_reg;
diff --git a/sys/i4b/layer1/i4b_elsa_qs1p.c b/sys/i4b/layer1/i4b_elsa_qs1p.c
index b2b35d0..43dd343 100644
--- a/sys/i4b/layer1/i4b_elsa_qs1p.c
+++ b/sys/i4b/layer1/i4b_elsa_qs1p.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* isic - I4B Siemens ISDN Chipset Driver for ELSA Quickstep 1000pro PCI
* =====================================================================
*
- * $Id: i4b_elsa_qs1p.c,v 1.4 1998/12/05 18:04:36 hm Exp $
+ * $Id: i4b_elsa_qs1p.c,v 1.5 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:22:41 1998]
+ * last edit-date: [Sun Feb 14 10:26:43 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/i4b_hscx.c b/sys/i4b/layer1/i4b_hscx.c
index ed80a51..29c2f40 100644
--- a/sys/i4b/layer1/i4b_hscx.c
+++ b/sys/i4b/layer1/i4b_hscx.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b - Siemens HSCX chip (B-channel) handling
* --------------------------------------------
*
- * $Id: i4b_hscx.c,v 1.37 1998/12/05 18:04:38 hm Exp $
+ * $Id: i4b_hscx.c,v 1.39 1999/02/14 19:51:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:23:36 1998]
+ * last edit-date: [Sun Feb 14 10:26:49 1999]
*
*---------------------------------------------------------------------------*/
@@ -55,7 +55,9 @@
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#else
+#ifndef __bsdi__
#include <machine/bus.h>
+#endif
#include <sys/device.h>
#endif
diff --git a/sys/i4b/layer1/i4b_hscx.h b/sys/i4b/layer1/i4b_hscx.h
index 1b1640d..b611bf9 100644
--- a/sys/i4b/layer1/i4b_hscx.h
+++ b/sys/i4b/layer1/i4b_hscx.h
@@ -30,9 +30,9 @@
*
*---------------------------------------------------------------------------
*
- * $Id: i4b_hscx.h,v 1.3 1998/02/13 17:00:31 hm Exp $
+ * $Id: i4b_hscx.h,v 1.4 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Thu Feb 5 13:38:50 1998]
+ * last edit-date: [Sun Feb 14 10:26:56 1999]
*
* -hm added AVM config register defs
* -hm split up for rewrite of Siemens chipset driver
diff --git a/sys/i4b/layer1/i4b_ipac.h b/sys/i4b/layer1/i4b_ipac.h
index 79d8bc9..d820271 100644
--- a/sys/i4b/layer1/i4b_ipac.h
+++ b/sys/i4b/layer1/i4b_ipac.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_ipac.h - definitions for the Siemens IPAC PSB2115 chip
* ==========================================================
*
- * $Id: i4b_ipac.h,v 1.4 1998/12/05 18:04:39 hm Exp $
+ * $Id: i4b_ipac.h,v 1.5 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:23:50 1998]
+ * last edit-date: [Sun Feb 14 10:27:03 1999]
*
*---------------------------------------------------------------------------
*/
diff --git a/sys/i4b/layer1/i4b_isac.c b/sys/i4b/layer1/i4b_isac.c
index 4065c9a..71ec0c3 100644
--- a/sys/i4b/layer1/i4b_isac.c
+++ b/sys/i4b/layer1/i4b_isac.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_isac.c - i4b siemens isdn chipset driver ISAC handler
* ---------------------------------------------------------
*
- * $Id: i4b_isac.c,v 1.28 1998/12/05 18:04:41 hm Exp $
+ * $Id: i4b_isac.c,v 1.30 1999/02/14 19:51:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:23:59 1998]
+ * last edit-date: [Sun Feb 14 10:27:09 1999]
*
*---------------------------------------------------------------------------*/
@@ -58,7 +58,9 @@
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#else
+#ifndef __bsdi__
#include <machine/bus.h>
+#endif
#include <sys/device.h>
#endif
diff --git a/sys/i4b/layer1/i4b_isac.h b/sys/i4b/layer1/i4b_isac.h
index 56a4241..942b9cc 100644
--- a/sys/i4b/layer1/i4b_isac.h
+++ b/sys/i4b/layer1/i4b_isac.h
@@ -30,9 +30,9 @@
*
*---------------------------------------------------------------------------
*
- * $Id: i4b_isac.h,v 1.5 1998/03/28 15:11:03 hm Exp $
+ * $Id: i4b_isac.h,v 1.6 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Fri Mar 27 15:52:40 1998]
+ * last edit-date: [Sun Feb 14 10:27:13 1999]
*
* -hm split up for rewrite of Siemens chipset driver
*
diff --git a/sys/i4b/layer1/i4b_isic.c b/sys/i4b/layer1/i4b_isic.c
index 922df79..127fae2 100644
--- a/sys/i4b/layer1/i4b_isic.c
+++ b/sys/i4b/layer1/i4b_isic.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_isic.c - global isic stuff
* ==============================
*
- * $Id: i4b_isic.c,v 1.44 1998/12/20 11:07:59 hm Exp $
+ * $Id: i4b_isic.c,v 1.46 1999/02/14 19:51:02 hm Exp $
*
- * last edit-date: [Fri Dec 18 12:14:07 1998]
+ * last edit-date: [Sun Feb 14 10:27:20 1999]
*
*---------------------------------------------------------------------------*/
@@ -61,9 +61,11 @@
#if defined(__NetBSD__) && defined(amiga)
#include <machine/bus.h>
#else
+#ifndef __bsdi__
#include <dev/isa/isavar.h>
#endif
#endif
+#endif
#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
@@ -87,6 +89,48 @@
void isic_settrace(int unit, int val);
int isic_gettrace(int unit);
+#ifdef __bsdi__
+static int isicmatch(struct device *parent, struct cfdata *cf, void *aux);
+static void isicattach(struct device *parent, struct device *self, void *aux);
+struct cfdriver isiccd =
+ { NULL, "isic", isicmatch, isicattach, DV_IFNET,
+ sizeof(struct isic_softc) };
+
+int isa_isicmatch(struct device *parent, struct cfdata *cf, struct isa_attach_args *);
+int isa_isicattach(struct device *parent, struct device *self, struct isa_attach_args *ia);
+
+static int
+isicmatch(struct device *parent, struct cfdata *cf, void *aux)
+{
+ struct isa_attach_args *ia = (struct isa_attach_args *) aux;
+ if (ia->ia_bustype == BUS_PCMCIA) {
+ ia->ia_irq = IRQNONE;
+ /* return 1; Not yet */
+ return 0; /* for now */
+ }
+ if (ia->ia_bustype == BUS_PNP) {
+ /* return isapnp_isicmatch(parent, cf, ia); */
+ return 0; /* for now */
+ }
+ return isa_isicmatch(parent, cf, ia);
+}
+
+static void
+isicattach(struct device *parent, struct device *self, void *aux)
+{
+ struct isa_attach_args *ia = (struct isa_attach_args *) aux;
+ struct isic_softc *sc = (struct isic_softc *)self;
+
+ sc->sc_flags = sc->sc_dev.dv_flags;
+ isa_isicattach(parent, self, ia);
+ isa_establish(&sc->sc_id, &sc->sc_dev);
+ sc->sc_ih.ih_fun = isicintr;
+ sc->sc_ih.ih_arg = (void *)sc;
+ intr_establish(ia->ia_irq, &sc->sc_ih, DV_NET);
+ /* Could add a shutdown hook here... */
+}
+#endif
+
#ifdef __FreeBSD__
void isicintr_sc(struct isic_softc *sc);
#if !(defined(__FreeBSD_version)) || (defined(__FreeBSD_version) && __FreeBSD_version >= 300006)
diff --git a/sys/i4b/layer1/i4b_isic_isa.c b/sys/i4b/layer1/i4b_isic_isa.c
index c0e11b9..19535f2 100644
--- a/sys/i4b/layer1/i4b_isic_isa.c
+++ b/sys/i4b/layer1/i4b_isic_isa.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,15 +27,17 @@
* i4b_isic_isa.c - ISA bus interface
* ==================================
*
- * $Id: i4b_isic_isa.c,v 1.14 1998/12/20 11:07:59 hm Exp $
+ * $Id: i4b_isic_isa.c,v 1.16 1999/02/14 19:51:02 hm Exp $
*
- * last edit-date: [Fri Dec 18 12:00:26 1998]
+ * last edit-date: [Sun Feb 14 10:27:26 1999]
*
*---------------------------------------------------------------------------*/
#ifdef __FreeBSD__
#include "isic.h"
#include "opt_i4b.h"
+#elif defined(__bsdi__)
+#include "isic.h"
#else
#define NISIC 1
#endif
@@ -56,6 +58,9 @@
#ifdef __FreeBSD__
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
+#elif defined(__bsdi__)
+#include <sys/device.h>
+#include <i386/isa/isavar.h>
#else
#include <sys/device.h>
#if defined(__NetBSD__) && defined(amiga)
@@ -93,7 +98,7 @@ void isicintr ( int unit );
void isicintr_sc(struct isic_softc *sc);
static int isicprobe(struct isa_device *dev);
-int isicattach(struct isa_device *dev);
+static int isicattach(struct isa_device *dev);
struct isa_driver isicdriver = {
isicprobe,
@@ -105,6 +110,8 @@ struct isa_driver isicdriver = {
int next_isic_unit = 0;
struct isic_softc isic_sc[ISIC_MAXUNIT];
+#elif defined(__bsdi__)
+ /* XXX */
#else
#ifdef NetBSD1_3
@@ -196,6 +203,58 @@ isicprobe(struct isa_device *dev)
}
return(ret);
}
+#elif defined(__bsdi__)
+/*---------------------------------------------------------------------------*
+ * isic - non-pnp device driver probe routine
+ *---------------------------------------------------------------------------*/
+int
+isa_isicmatch(struct device *parent, struct cfdata *cf, struct isa_attach_args *ia)
+{
+ int ret = 0;
+
+ switch(cf->cf_flags)
+ {
+#ifdef TEL_S0_8
+ case FLAG_TELES_S0_8:
+ ret = isic_probe_s08(parent, cf, ia);
+ break;
+#endif
+
+#ifdef TEL_S0_16
+ case FLAG_TELES_S0_16:
+ ret = isic_probe_s016(parent, cf, ia);
+ break;
+#endif
+
+#ifdef TEL_S0_16_3
+ case FLAG_TELES_S0_163:
+ ret = isic_probe_s0163(parent, cf, ia);
+ break;
+#endif
+
+#ifdef AVM_A1
+ case FLAG_AVM_A1:
+ ret = isic_probe_avma1(parent, cf, ia);
+ break;
+#endif
+
+#ifdef USR_STI
+ case FLAG_USR_ISDN_TA_INT:
+ ret = isic_probe_usrtai(parent, cf, ia);
+ break;
+#endif
+
+#ifdef ITKIX1
+ case FLAG_ITK_IX1:
+ ret = isic_probe_itkix1(parent, cf, ia);
+ break;
+#endif
+
+ default:
+ break;
+ }
+ return(ret);
+}
#else
@@ -215,7 +274,7 @@ isicprobe(struct isic_attach_args *args)
/*---------------------------------------------------------------------------*
* isic - non-pnp device driver attach routine
*---------------------------------------------------------------------------*/
-int
+static int
isicattach(struct isa_device *dev)
{
return(isic_realattach(dev, 0));
@@ -227,6 +286,13 @@ isicattach(struct isa_device *dev)
int
isic_realattach(struct isa_device *dev, unsigned int iobase2)
+#elif defined(__bsdi__)
+
+/*---------------------------------------------------------------------------*
+ * isic - non-pnp device driver attach routine
+ *---------------------------------------------------------------------------*/
+int
+isa_isicattach(struct device *parent, struct device *self, struct isa_attach_args *ia)
#else /* ! __FreeBSD__ */
int
@@ -242,6 +308,10 @@ isicattach(int flags, struct isic_softc *sc)
#define PARM dev
#define PARM2 dev, iobase2
#define FLAGS dev->id_flags
+#elif defined(__bsdi__)
+ struct isic_softc *sc = (struct isic_softc *)self;
+#define PARM parent, self, ia
+#define FLAGS sc->sc_flags
#else
#define PARM sc
#define PARM2 sc
@@ -338,13 +408,11 @@ isicattach(int flags, struct isic_softc *sc)
break;
#endif
-#ifndef __FreeBSD__
#ifdef TEL_S0_16_3_P
case FLAG_TELES_S0_163_PnP:
ret = isic_attach_s0163P(PARM2);
break;
#endif
-#endif
#ifdef CRTX_S0_P
case FLAG_CREATIX_S0_PnP:
diff --git a/sys/i4b/layer1/i4b_isic_pci.c b/sys/i4b/layer1/i4b_isic_pci.c
index bd6d4fd..b600f30 100644
--- a/sys/i4b/layer1/i4b_isic_pci.c
+++ b/sys/i4b/layer1/i4b_isic_pci.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_isic_pci.c - PCI bus interface
* ==================================
*
- * $Id: i4b_isic_pci.c,v 1.1 1998/12/27 21:46:46 phk Exp $
+ * $Id: i4b_isic_pci.c,v 1.11 1999/02/17 14:31:42 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:24:36 1998]
+ * last edit-date: [Wed Feb 17 15:19:44 1999]
*
*---------------------------------------------------------------------------*/
@@ -82,12 +82,13 @@
#include <i4b/layer1/i4b_hscx.h>
#define PCI_QS1000_ID 0x10001048
+#define PCI_AVMA1_ID 0x0a001244
#define MEM0_MAPOFF 0
#define PORT0_MAPOFF 4
#define PORT1_MAPOFF 12
-static const char* i4b_pci_probe(pcici_t tag, pcidi_t type);
+static char* i4b_pci_probe(pcici_t tag, pcidi_t type);
static void i4b_pci_attach(pcici_t config_id, int unit);
static int isic_pciattach(int unit, u_long type, u_int iobase1, u_int iobase2);
@@ -105,18 +106,24 @@ DATA_SET (pcidevice_set, i4b_pci_driver);
static void isic_pci_intr_sc(struct isic_softc *sc);
+#ifdef AVM_A1_PCI
+extern void avma1pp_map_int(pcici_t, void *, unsigned *);
+#endif
+
/*---------------------------------------------------------------------------*
* PCI probe routine
*---------------------------------------------------------------------------*/
-static const char *
+static char *
i4b_pci_probe(pcici_t tag, pcidi_t type)
{
switch(type)
{
case PCI_QS1000_ID:
- return("ELSA QuickStep 1000pro PCI ISDN adaptor");
- break;
+ return("ELSA QuickStep 1000pro PCI ISDN adapter");
+
+ case PCI_AVMA1_ID:
+ return("AVM Fritz!Card PCI ISDN adapter");
default:
if(bootverbose)
@@ -136,6 +143,7 @@ i4b_pci_attach(pcici_t config_id, int unit)
unsigned short iobase2;
unsigned long type;
struct isic_softc *sc = &isic_sc[unit];
+ u_long reg1, reg2;
if(unit != next_isic_unit)
{
@@ -143,13 +151,35 @@ i4b_pci_attach(pcici_t config_id, int unit)
return;
}
- if(!(pci_map_port(config_id, PCI_MAP_REG_START+PORT0_MAPOFF, &iobase1)))
+ /* IMHO the all following should be done in the low-level driver - GJ */
+ type = pci_conf_read(config_id, PCI_ID_REG);
+
+ /* not all cards have their ports at the same location !!! */
+ switch(type)
+ {
+ case PCI_QS1000_ID:
+ reg1 = PCI_MAP_REG_START+PORT0_MAPOFF;
+ reg2 = PCI_MAP_REG_START+PORT1_MAPOFF;
+ break;
+
+ case PCI_AVMA1_ID:
+ reg1 = PCI_MAP_REG_START+PORT0_MAPOFF;
+ reg2 = 0;
+ break;
+
+ default:
+ reg1 = PCI_MAP_REG_START+PORT0_MAPOFF;
+ reg2 = PCI_MAP_REG_START+PORT1_MAPOFF;
+ break;
+ }
+
+ if(reg1 && !(pci_map_port(config_id, reg1, &iobase1)))
{
printf("i4b_pci_attach: pci_map_port 1 failed!\n");
return;
}
- if(!(pci_map_port(config_id, PCI_MAP_REG_START+PORT1_MAPOFF, &iobase2)))
+ if(reg2 && !(pci_map_port(config_id, reg2, &iobase2)))
{
printf("i4b_pci_attach: pci_map_port 2 failed!\n");
return;
@@ -158,11 +188,19 @@ i4b_pci_attach(pcici_t config_id, int unit)
if(bootverbose)
printf("i4b_pci_attach: unit %d, port0 0x%x, port1 0x%x\n", unit, iobase1, iobase2);
- type = pci_conf_read(config_id, PCI_ID_REG);
-
if((isic_pciattach(unit, type, iobase1, iobase2)) == 0)
return;
+#ifdef AVM_A1_PCI
+ /* the AVM FRTIZ!PCI needs to handle its own interrupts */
+ if (type == PCI_AVMA1_ID)
+ {
+ avma1pp_map_int(config_id, (void *)sc, &net_imask);
+ return;
+ }
+#endif
+
+ /* seems like this should be done before the attach in case it fails */
if(!(pci_map_int(config_id, (void *)isic_pci_intr_sc, (void *)sc, &net_imask)))
return;
}
@@ -201,6 +239,13 @@ isic_pciattach(int unit, u_long type, u_int iobase1, u_int iobase2)
ret = isic_attach_Eqs1pp(unit, iobase1, iobase2);
break;
#endif
+#ifdef AVM_A1_PCI
+ case PCI_AVMA1_ID:
+ ret = isic_attach_avma1pp(unit, iobase1, iobase2);
+ if (ret)
+ next_isic_unit++;
+ return(ret);
+#endif
default:
break;
}
diff --git a/sys/i4b/layer1/i4b_isic_pcmcia.c b/sys/i4b/layer1/i4b_isic_pcmcia.c
index e20964c..98cb22a 100644
--- a/sys/i4b/layer1/i4b_isic_pcmcia.c
+++ b/sys/i4b/layer1/i4b_isic_pcmcia.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1998 Matthias Apitz. All rights reserved.
*
- * Copyright (c) 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1998, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,9 +35,9 @@
* i4b_isic_pcmcia.c - i4b FreeBSD PCMCIA support
* ----------------------------------------------
*
- * $Id: i4b_isic_pcmcia.c,v 1.2 1999/01/12 11:04:59 eivind Exp $
+ * $Id: i4b_isic_pcmcia.c,v 1.4 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Mon Dec 14 17:30:09 1998]
+ * last edit-date: [Sun Feb 14 10:27:42 1999]
*
*---------------------------------------------------------------------------*/
@@ -50,9 +50,11 @@
#if (NISIC > 0) && (NCARD > 0)
#include "apm.h"
-#include <sys/param.h>
#include <sys/select.h>
-#include <i386/isa/isa_device.h>
+#include <pccard/card.h>
+#include <pccard/driver.h>
+#include <pccard/slot.h>
+#include <sys/param.h>
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
#include <sys/ioccom.h>
@@ -63,7 +65,6 @@
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
-#include <sys/module.h>
#include <sys/socket.h>
#include <net/if.h>
#include <machine/clock.h>
@@ -73,10 +74,6 @@
#include <machine/i4b_ioctl.h>
#include <machine/i4b_trace.h>
-#include <pccard/cardinfo.h>
-#include <pccard/slot.h>
-#include <pccard/driver.h>
-
#include <i4b/layer1/i4b_l1.h>
#include <i4b/layer1/i4b_isac.h>
#include <i4b/layer1/i4b_hscx.h>
@@ -85,9 +82,6 @@
#include <i4b/include/i4b_mbuf.h>
#include <i4b/include/i4b_global.h>
-extern int isicattach(struct isa_device *dev);
-extern void isicintr(int unit);
-
/*
* PC-Card (PCMCIA) specific code.
*/
@@ -95,7 +89,16 @@ static int isic_pccard_init __P((struct pccard_devinfo *));
static void isic_unload __P((struct pccard_devinfo *));
static int isic_card_intr __P((struct pccard_devinfo *));
-PCCARD_MODULE(isic, isic_pccard_init, isic_unload, isic_card_intr, 0,net_imask);
+static struct pccard_device isic_info = {
+ "isic",
+ isic_pccard_init,
+ isic_unload,
+ isic_card_intr,
+ 0, /* Attributes - presently unused */
+ &net_imask
+};
+
+DATA_SET(pccarddrv_set, isic_info);
/*
* Initialize the device - called from Slot manager.
@@ -107,6 +110,7 @@ static int isic_pccard_init(devi)
struct pccard_devinfo *devi;
{
struct isa_device *is = &devi->isahd;
+ struct isic_softc *sc = &isic_sc[is->id_unit];
if ((1 << is->id_unit) & opened)
return(EBUSY);
@@ -115,14 +119,11 @@ struct pccard_devinfo *devi;
printf("isic%d: PCMCIA init, irqmask = 0x%x (%d), iobase = 0x%x\n",
is->id_unit, is->id_irq, devi->slt->irq, is->id_iobase);
-#if 0
- /* XXX: problems resolving isic_probe_avma1_pcmcia() /phk */
/*
* look if there is really an AVM PCMCIA Fritz!Card and
* setup the card specific stuff
*/
isic_probe_avma1_pcmcia(is);
-#endif
/* ap:
* XXX what's to do with the return value?
diff --git a/sys/i4b/layer1/i4b_isic_pnp.c b/sys/i4b/layer1/i4b_isic_pnp.c
index ed1892d9..678e7c8 100644
--- a/sys/i4b/layer1/i4b_isic_pnp.c
+++ b/sys/i4b/layer1/i4b_isic_pnp.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 1998 German Tischler. All rights reserved.
*
- * Copyright (c) 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1998, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,9 +37,9 @@
* i4b_isic_pnp.c - i4b pnp support
* --------------------------------
*
- * $Id: i4b_isic_pnp.c,v 1.15 1998/12/20 11:07:59 hm Exp $
+ * $Id: i4b_isic_pnp.c,v 1.16 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Fri Dec 18 20:54:56 1998]
+ * last edit-date: [Sun Feb 14 10:27:52 1999]
*
*---------------------------------------------------------------------------*/
@@ -249,13 +249,11 @@ isic_pnpprobe(struct isa_device *dev, unsigned int iobase2)
switch(dev->id_flags)
{
-#ifndef __FreeBSD__
#ifdef TEL_S0_16_3_P
case FLAG_TELES_S0_163_PnP:
ret = isic_probe_s0163P(dev, iobase2);
break;
#endif
-#endif
#ifdef CRTX_S0_P
case FLAG_CREATIX_S0_PnP:
diff --git a/sys/i4b/layer1/i4b_itk_ix1.c b/sys/i4b/layer1/i4b_itk_ix1.c
index cd70dbf..c46af2b 100644
--- a/sys/i4b/layer1/i4b_itk_ix1.c
+++ b/sys/i4b/layer1/i4b_itk_ix1.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998 Martin Husemann <martin@rumolt.teuto.de>
+ * Copyright (c) 1998, 1999 Martin Husemann <martin@rumolt.teuto.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,9 +26,13 @@
* i4b_itk_ix1.c - ITK ix1 micro passive card driver for isdn4bsd
* --------------------------------------------------------------
*
- * $Id: i4b_itk_ix1.c,v 1.1 1998/12/27 21:46:46 phk Exp $
+ * $Id: i4b_itk_ix1.c,v 1.3 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Wed Dec 16 14:46:36 1998]
+ * last edit-date: [Sun Feb 14 10:28:00 1999]
+ *
+ * mh - created
+ * mh - fixed FreeBSD problems reported by Kevin Sheehan
+ * mh - added probe routine
*
*---------------------------------------------------------------------------
*
@@ -49,7 +53,14 @@
* - read data from or write data to ITK_ISAC_DATA port or ITK_HSCX_DATA port
* The two HSCX channel registers are offset by HSCXA (0x00) and HSCXB (0x40).
*
- * XXX - A reasonable probe routine has to be written.
+ * The probe routine was derived by trial and error from a representative
+ * sample of two cards ;-) The standard way (checking HSCX versions)
+ * was extended by reading a zero from a non existant HSCX register (register
+ * 0xff). Reading the config register gives varying results, so this doesn't
+ * seem to be used as an id register (like the Teles S0/16.3).
+ *
+ * If the probe fails for your card use "options ITK_PROBE_DEBUG" to get
+ * additional debug output.
*
*---------------------------------------------------------------------------*/
@@ -96,25 +107,34 @@
#include <i4b/include/i4b_global.h>
+/* Register offsets */
#define ITK_ISAC_DATA 0
#define ITK_HSCX_DATA 1
#define ITK_ALE 2
#define ITK_CONFIG 3
+
+/* Size of IO range to allocate for this card */
#define ITK_IO_SIZE 4
+/* Register offsets for the two HSCX channels */
#define HSCXA 0
#define HSCXB 0x40
-#ifndef __FreeBSD__
+/*
+ * Local function prototypes
+ */
+#ifdef __FreeBSD__
+/* FreeBSD version */
+static void itkix1_read_fifo(void *buf, const void *base, size_t len);
+static void itkix1_write_fifo(void *base, const void *buf, size_t len);
+static void itkix1_write_reg(u_char *base, u_int offset, u_int v);
+static u_char itkix1_read_reg(u_char *base, u_int offset);
+#else
+/* NetBSD/OpenBSD version */
static void itkix1_read_fifo(struct isic_softc *sc, int what, void *buf, size_t size);
static void itkix1_write_fifo(struct isic_softc *sc, int what, const void *buf, size_t size);
static void itkix1_write_reg(struct isic_softc *sc, int what, bus_size_t offs, u_int8_t data);
static u_int8_t itkix1_read_reg(struct isic_softc *sc, int what, bus_size_t offs);
-#else
-static u_char itkix1_read_reg(u_char *base, u_int offset);
-static void itkix1_write_reg(u_char *base, u_int offset, u_int v);
-static void itkix1_read_fifo(void *base, const void *buf, size_t len);
-static void itkix1_write_fifo(void *base, const void *buf, size_t len);
#endif
/*
@@ -124,18 +144,34 @@ static void itkix1_write_fifo(void *base, const void *buf, size_t len);
int
isic_probe_itkix1(struct isa_device *dev)
{
- u_int8_t hd, cd;
+ u_int8_t hd, hv1, hv2, saveale;
int ret;
+ /* save old value of this port, we're stomping over it */
+ saveale = inb(dev->id_iobase + ITK_ALE);
+
+ /* select invalid register */
+ outb(dev->id_iobase + ITK_ALE, 0xff);
+ /* get HSCX data for this non existent register */
hd = inb(dev->id_iobase + ITK_HSCX_DATA);
- cd = inb(dev->id_iobase + ITK_CONFIG);
+ /* get HSCX version info */
+ outb(dev->id_iobase + ITK_ALE, HSCXA + H_VSTR);
+ hv1 = inb(dev->id_iobase + ITK_HSCX_DATA);
+ outb(dev->id_iobase + ITK_ALE, HSCXB + H_VSTR);
+ hv2 = inb(dev->id_iobase + ITK_HSCX_DATA);
+
+ /* succeed if version bits are OK and we got a zero from the
+ * non existent register */
+ ret = (hd == 0) && ((hv1 & 0x0f) == 0x05) && ((hv2 & 0x0f) == 0x05);
- ret = (hd == 0 && cd == 0xfc);
+ /* retstore save value if we fail (if we succeed the old value
+ * has no meaning) */
+ if (!ret)
+ outb(dev->id_iobase + ITK_ALE, saveale);
-#define ITK_PROBE_DEBUG
#ifdef ITK_PROBE_DEBUG
- printf("\nITK ix1 micro probe: hscx = 0x%02x, config = 0x%02x, would have %s\n",
- hd, cd, ret ? "succeeded" : "failed");
+ printf("\nITK ix1 micro probe: hscx = 0x%02x, v1 = 0x%02x, v2 = 0x%02x, would have %s\n",
+ hd, hv1, hv2, ret ? "succeeded" : "failed");
return 1;
#else
return ret;
@@ -147,18 +183,34 @@ isic_probe_itkix1(struct isic_attach_args *ia)
{
bus_space_tag_t t = ia->ia_maps[0].t;
bus_space_handle_t h = ia->ia_maps[0].h;
- u_int8_t hd, cd;
+ u_int8_t hd, hv1, hv2, saveale;
int ret;
+ /* save old value of this port, we're stomping over it */
+ saveale = bus_space_read_1(t, h, ITK_ALE);
+
+ /* select invalid register */
+ bus_space_write_1(t, h, ITK_ALE, 0xff);
+ /* get HSCX data for this non existent register */
hd = bus_space_read_1(t, h, ITK_HSCX_DATA);
- cd = bus_space_read_1(t, h, ITK_CONFIG);
+ /* get HSCX version info */
+ bus_space_write_1(t, h, ITK_ALE, HSCXA + H_VSTR);
+ hv1 = bus_space_read_1(t, h, ITK_HSCX_DATA);
+ bus_space_write_1(t, h, ITK_ALE, HSCXB + H_VSTR);
+ hv2 = bus_space_read_1(t, h, ITK_HSCX_DATA);
+
+ /* succeed if version bits are OK and we got a zero from the
+ * non existent register */
+ ret = (hd == 0) && ((hv1 & 0x0f) == 0x05) && ((hv2 & 0x0f) == 0x05);
- ret = (hd == 0 && cd == 0xfc);
+ /* retstore save value if we fail (if we succeed the old value
+ * has no meaning) */
+ if (!ret)
+ bus_space_write_1(t, h, ITK_ALE, saveale);
-#define ITK_PROBE_DEBUG
#ifdef ITK_PROBE_DEBUG
- printf("\nITK ix1 micro probe: hscx = 0x%02x, config = 0x%02x, would have %s\n",
- hd, cd, ret ? "succeeded" : "failed");
+ printf("\nITK ix1 micro probe: hscx = 0x%02x, v1 = 0x%02x, v2 = 0x%02x, would have %s\n",
+ hd, hv1, hv2, ret ? "succeeded" : "failed");
return 1;
#else
return ret;
@@ -267,8 +319,8 @@ int isic_attach_itkix1(struct isic_softc *sc)
static void
itkix1_read_fifo(void *buf, const void *base, size_t len)
{
- int port = (u_long)base & ~0x0003;
- switch ((u_long)base & 3) {
+ u_int port = (u_int)base & ~0x0003;
+ switch ((u_int)base & 3) {
case 0: /* ISAC */
outb(port+ITK_ALE, 0);
insb(port+ITK_ISAC_DATA, (u_char *)buf, (u_int)len);
@@ -310,8 +362,8 @@ itkix1_read_fifo(struct isic_softc *sc, int what, void *buf, size_t size)
static void
itkix1_write_fifo(void *base, const void *buf, size_t len)
{
- int port = (u_long)base & ~0x0003;
- switch ((u_long)base & 3) {
+ u_int port = (u_int)base & ~0x0003;
+ switch ((u_int)base & 3) {
case 0: /* ISAC */
outb(port+ITK_ALE, 0);
outsb(port+ITK_ISAC_DATA, (u_char *)buf, (u_int)len);
@@ -352,8 +404,8 @@ static void itkix1_write_fifo(struct isic_softc *sc, int what, const void *buf,
static void
itkix1_write_reg(u_char *base, u_int offset, u_int v)
{
- int port = (u_long)base & ~0x0003;
- switch ((u_long)base & 3) {
+ u_int port = (u_int)base & ~0x0003;
+ switch ((u_int)base & 3) {
case 0: /* ISAC */
outb(port+ITK_ALE, offset);
outb(port+ITK_ISAC_DATA, (u_char)v);
@@ -394,8 +446,8 @@ static void itkix1_write_reg(struct isic_softc *sc, int what, bus_size_t offs, u
static u_char
itkix1_read_reg(u_char *base, u_int offset)
{
- int port = (u_long)base & ~0x0003;
- switch ((u_long)base & 3) {
+ u_int port = (u_int)base & ~0x0003;
+ switch ((u_int)base & 3) {
case 0: /* ISAC */
outb(port+ITK_ALE, offset);
return (inb(port+ITK_ISAC_DATA));
@@ -406,7 +458,6 @@ itkix1_read_reg(u_char *base, u_int offset)
outb(port+ITK_ALE, HSCXB+offset);
return (inb(port+ITK_HSCX_DATA));
}
- panic("itkix1_read_reg: Fallthrough\n");
}
#else
static u_int8_t itkix1_read_reg(struct isic_softc *sc, int what, bus_size_t offs)
diff --git a/sys/i4b/layer1/i4b_l1.c b/sys/i4b/layer1/i4b_l1.c
index 96497c5..79774bb 100644
--- a/sys/i4b/layer1/i4b_l1.c
+++ b/sys/i4b/layer1/i4b_l1.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l1.c - isdn4bsd layer 1 handler
* -----------------------------------
*
- * $Id: i4b_l1.c,v 1.27 1998/12/05 18:04:51 hm Exp $
+ * $Id: i4b_l1.c,v 1.29 1999/02/14 19:51:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:24:52 1998]
+ * last edit-date: [Sun Feb 14 10:28:10 1999]
*
*---------------------------------------------------------------------------*/
@@ -55,7 +55,9 @@
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#else
+#ifndef __bsdi__
#include <machine/bus.h>
+#endif
#include <sys/device.h>
#endif
diff --git a/sys/i4b/layer1/i4b_l1.h b/sys/i4b/layer1/i4b_l1.h
index 2b15ccc..939f960 100644
--- a/sys/i4b/layer1/i4b_l1.h
+++ b/sys/i4b/layer1/i4b_l1.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,15 +27,22 @@
* i4b_l1.h - isdn4bsd layer 1 header file
* ---------------------------------------
*
- * $Id: i4b_l1.h,v 1.54 1998/12/17 04:55:39 hm Exp $
+ * $Id: i4b_l1.h,v 1.57 1999/02/17 14:31:42 hm Exp $
*
- * last edit-date: [Mon Dec 14 10:41:36 1998]
+ * last edit-date: [Wed Feb 17 15:16:48 1999]
*
*---------------------------------------------------------------------------*/
#ifndef I4B_L1_H_
#define I4B_L1_H_
+#ifdef __bsdi__
+#include <sys/device.h> /* XXX */
+#ifndef ISA_NPORT_CHECK /* Double yuck XXX */
+#include <i386/isa/isavar.h> /* XXX */
+#endif
+#endif
+
#include <i4b/include/i4b_l3l4.h>
/*---------------------------------------------------------------------------
@@ -74,9 +81,11 @@
#define MAX_DFRAME_LEN 264 /* max length of a D frame */
+#ifndef __bsdi__
#define min(a,b) ((a)<(b)?(a):(b))
+#endif
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__bsdi__)
/* We try to map as few as possible as small as possible io and/or
memory regions. Each card defines its own interpretation of this
mapping array. At probe time we have a fixed size array, later
@@ -114,7 +123,7 @@ typedef struct
int unit; /* cards unit number */
int channel; /* which channel is this*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
caddr_t hscx; /* HSCX address */
#endif
@@ -173,7 +182,7 @@ typedef struct
*---------------------------------------------------------------------------*/
struct isic_softc
{
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__)
/* We are inherited from this class. All drivers must have this
as their first entry in struct softc. */
struct device sc_dev;
@@ -184,6 +193,13 @@ struct isic_softc
#ifdef __FreeBSD__
int sc_port; /* port base address */
+#elif defined(__bsdi__)
+ struct isadev sc_id; /* ISA/PCI device */
+ struct intrhand sc_ih; /* interrupt vectoring */
+ int sc_flags;
+ int sc_port;
+ caddr_t sc_maddr;
+ int sc_abustype; /* PCI, ISA etcetera */
#else
u_int sc_maddr; /* "memory address" for card config register */
int sc_num_mappings; /* number of io mappings provided */
@@ -208,7 +224,7 @@ struct isic_softc
int sc_init_tries; /* no of out tries to access S0 */
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
caddr_t sc_vmem_addr; /* card RAM virtual memory base */
caddr_t sc_isac; /* ISAC port base addr */
#define ISAC_BASE (sc->sc_isac)
@@ -252,13 +268,21 @@ struct isic_softc
#if defined(__FreeBSD__) && __FreeBSD__ >=3
struct callout_handle sc_T4_callout;
#endif
-
+
+ /*
+ * byte fields for the AVM Fritz!Card PCI. These are packed into
+ * a u_int in the driver.
+ */
+ u_char avma1pp_cmd;
+ u_char avma1pp_txl;
+ u_char avma1pp_prot;
+
int sc_enabled; /* daemon is running */
int sc_ipac; /* flag, running on ipac */
int sc_bfifolen; /* length of b channel fifos */
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
u_char (*readreg)(u_char *, u_int);
void (*writereg)(u_char *, u_int, u_int);
@@ -398,7 +422,61 @@ extern int isic_probe_drnngo ( struct isa_device *dev, unsigned int iobase2);
extern int isic_probe_sws ( struct isa_device *dev );
extern int isic_probe_Eqs1pi(struct isa_device *dev, unsigned int iobase2);
-#else /* not FreeBSD */
+#elif defined(__bsdi__)
+
+extern struct isic_softc *isic_sc[];
+#define isic_find_sc(unit) (isic_sc[(unit)])
+
+#define ATTACHARGS struct device *, struct device *, struct isa_attach_args *
+#define MATCHARGS struct device *, struct cfdata *, struct isa_attach_args *
+extern int isa_isicmatch(MATCHARGS);
+extern int isa_isicattach(ATTACHARGS);
+extern int isicintr(void *);
+extern void isic_recover(struct isic_softc *sc);
+extern int isic_realattach(ATTACHARGS);
+extern int isic_attach_avma1(ATTACHARGS);
+extern int isic_attach_fritzpcmcia(ATTACHARGS);
+extern int isic_attach_Cs0P(ATTACHARGS);
+extern int isic_attach_Dyn(ATTACHARGS);
+extern int isic_attach_s016(ATTACHARGS);
+extern int isic_attach_s0163(ATTACHARGS);
+extern int isic_attach_s0163P(ATTACHARGS);
+extern int isic_attach_s08(ATTACHARGS);
+extern int isic_attach_usrtai(ATTACHARGS);
+extern int isic_attach_itkix1(ATTACHARGS);
+extern int isic_attach_drnngo(ATTACHARGS);
+extern int isic_attach_sws(ATTACHARGS);
+extern int isic_attach_Eqs1pi(ATTACHARGS);
+extern int isic_attach_Eqs1pp(ATTACHARGS);
+extern void isic_bchannel_setup(int unit, int hscx_channel, int bprot, int activate );
+extern void isic_hscx_init(struct isic_softc *sc, int hscx_channel, int activate );
+extern void isic_hscx_irq(struct isic_softc *sc, u_char ista, int hscx_channel, u_char ex_irq );
+extern int isic_hscx_silence(unsigned char *data, int len );
+extern void isic_hscx_cmd(struct isic_softc *sc, int h_chan, unsigned char cmd );
+extern void isic_hscx_waitxfw(struct isic_softc *sc, int h_chan );
+extern void isic_init_linktab(struct isic_softc *sc );
+extern int isic_isac_init(struct isic_softc *sc );
+extern void isic_isac_irq(struct isic_softc *sc, int r );
+extern void isic_isac_l1_cmd(struct isic_softc *sc, int command );
+extern void isic_next_state(struct isic_softc *sc, int event );
+extern char *isic_printstate(struct isic_softc *sc );
+extern int isic_probe_avma1(MATCHARGS);
+extern int isic_probe_avma1_pcmcia(MATCHARGS);
+extern int isic_probe_Cs0P(MATCHARGS);
+extern int isic_probe_Dyn(MATCHARGS);
+extern int isic_probe_s016(MATCHARGS);
+extern int isic_probe_s0163(MATCHARGS);
+extern int isic_probe_s0163P(MATCHARGS);
+extern int isic_probe_s08(MATCHARGS);
+extern int isic_probe_usrtai(MATCHARGS);
+extern int isic_probe_itkix1(MATCHARGS);
+extern int isic_probe_drnngo(MATCHARGS);
+extern int isic_probe_sws(MATCHARGS);
+extern int isic_probe_Eqs1pi(MATCHARGS);
+
+#undef MATCHARGS
+#undef ATTACHARGS
+#else /* not FreeBSD/__bsdi__ */
extern void isic_recover __P((struct isic_softc *sc));
extern int isicattach __P((int flags, struct isic_softc *sc));
diff --git a/sys/i4b/layer1/i4b_l1fsm.c b/sys/i4b/layer1/i4b_l1fsm.c
index 397ce11..f4134e4 100644
--- a/sys/i4b/layer1/i4b_l1fsm.c
+++ b/sys/i4b/layer1/i4b_l1fsm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,13 +27,13 @@
* i4b_l1fsm.c - isdn4bsd layer 1 I.430 state machine
* --------------------------------------------------
*
- * $Id: i4b_l1fsm.c,v 1.26 1998/12/05 18:04:55 hm Exp $
+ * $Id: i4b_l1fsm.c,v 1.28 1999/02/14 19:51:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:25:12 1998]
+ * last edit-date: [Sun Feb 14 10:28:26 1999]
*
*---------------------------------------------------------------------------*/
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__bsdi__)
#include "isic.h"
#else
#define NISIC 1
@@ -57,7 +57,9 @@
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#else
+#ifndef __bsdi__
#include <machine/bus.h>
+#endif
#include <sys/device.h>
#endif
diff --git a/sys/i4b/layer1/i4b_sws.c b/sys/i4b/layer1/i4b_sws.c
index c5182b4..8de9245 100644
--- a/sys/i4b/layer1/i4b_sws.c
+++ b/sys/i4b/layer1/i4b_sws.c
@@ -47,9 +47,9 @@
* EXPERIMENTAL !!!!
* =================
*
- * $Id: i4b_sws.c,v 1.12 1998/12/18 09:32:45 hm Exp $
+ * $Id: i4b_sws.c,v 1.13 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Sun Dec 13 10:49:25 1998]
+ * last edit-date: [Sun Feb 14 10:28:31 1999]
*
* -hm adding driver to i4b
* -hm adjustments for FreeBSD < 2.2.6, no PnP support yet
diff --git a/sys/i4b/layer1/i4b_tel_s016.c b/sys/i4b/layer1/i4b_tel_s016.c
index f77a3c1..e62d6a1 100644
--- a/sys/i4b/layer1/i4b_tel_s016.c
+++ b/sys/i4b/layer1/i4b_tel_s016.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 1996 Gary Jennejohn. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,9 +37,9 @@
* isic - I4B Siemens ISDN Chipset Driver for Teles S0/16 and clones
* =================================================================
*
- * $Id: i4b_tel_s016.c,v 1.12 1998/12/05 18:04:56 hm Exp $
+ * $Id: i4b_tel_s016.c,v 1.13 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Fri Dec 4 10:40:17 1998]
+ * last edit-date: [Sun Feb 14 10:28:38 1999]
*
* -hm clean up
* -hm checked with a Creatix ISDN-S0 (PCB version: mp 130.1)
diff --git a/sys/i4b/layer1/i4b_tel_s0163.c b/sys/i4b/layer1/i4b_tel_s0163.c
index 5fdd329..efe9f34 100644
--- a/sys/i4b/layer1/i4b_tel_s0163.c
+++ b/sys/i4b/layer1/i4b_tel_s0163.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 1996 Gary Jennejohn. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,9 +37,9 @@
* isic - I4B Siemens ISDN Chipset Driver for Teles S0/16.3
* ========================================================
*
- * $Id: i4b_tel_s0163.c,v 1.15 1998/12/05 18:04:58 hm Exp $
+ * $Id: i4b_tel_s0163.c,v 1.18 1999/02/14 19:51:02 hm Exp $
*
- * last edit-date: [Fri Dec 4 10:40:58 1998]
+ * last edit-date: [Sun Feb 14 10:28:45 1999]
*
* -hm clean up
* -hm more cleanup
@@ -69,6 +69,8 @@
#ifdef __FreeBSD__
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
+#elif defined(__bsdi__)
+ /* XXX */
#else
#include <machine/bus.h>
#include <sys/device.h>
@@ -95,7 +97,7 @@
static u_char intr_no[] = { 1, 1, 0, 2, 4, 6, 1, 1, 1, 0, 8, 10, 12, 1, 1, 14 };
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__bsdi__)
static u_int8_t tels0163_read_reg __P((struct isic_softc *sc, int what, bus_size_t offs));
static void tels0163_write_reg __P((struct isic_softc *sc, int what, bus_size_t offs, u_int8_t data));
static void tels0163_read_fifo __P((struct isic_softc *sc, int what, void *buf, size_t size));
@@ -105,7 +107,7 @@ static void tels0163_write_fifo __P((struct isic_softc *sc, int what, const void
/*---------------------------------------------------------------------------*
* Teles S0/16.3 read fifo routine
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
static void
tels0163_read_fifo(void *buf, const void *base, size_t len)
@@ -129,7 +131,7 @@ tels0163_read_fifo(struct isic_softc *sc, int what, void *buf, size_t size)
/*---------------------------------------------------------------------------*
* Teles S0/16.3 write fifo routine
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
static void
tels0163_write_fifo(void *base, const void *buf, size_t len)
@@ -152,7 +154,7 @@ tels0163_write_fifo(struct isic_softc *sc, int what, const void *buf, size_t siz
/*---------------------------------------------------------------------------*
* Teles S0/16.3 ISAC put register routine
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
static void
tels0163_write_reg(u_char *base, u_int offset, u_int v)
@@ -175,7 +177,7 @@ tels0163_write_reg(struct isic_softc *sc, int what, bus_size_t offs, u_int8_t da
/*---------------------------------------------------------------------------*
* Teles S0/16.3 ISAC get register routine
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
static u_char
tels0163_read_reg(u_char *base, u_int offset)
@@ -254,9 +256,9 @@ isic_probe_s0163(struct isa_device *dev)
}
sc->sc_port = dev->id_iobase;
- if((byte = inb(sc->sc_port)) != 0x51)
+ if(((byte = inb(sc->sc_port)) != 0x51) && (byte != 0x10))
{
- printf("isic%d: Error, signature 1 0x%x != 0x51 for Teles S0/16.3!",
+ printf("isic%d: Error, signature 1 0x%x != 0x51 or 0x10 for Teles S0/16.3!",
dev->id_unit, byte);
return(0);
}
@@ -340,6 +342,147 @@ isic_probe_s0163(struct isa_device *dev)
return (1);
}
+#elif defined(__bsdi__)
+
+static int
+set_softc(struct isic_softc *sc, struct isa_attach_args *ia, int unit)
+{
+ sc->sc_irq = ia->ia_irq;
+
+ /* check if we got an iobase */
+
+ switch(ia->ia_iobase)
+ {
+ case 0xd80:
+ case 0xe80:
+ case 0xf80:
+ break;
+
+ default:
+ printf("isic%d: Error, invalid iobase 0x%x specified for Teles S0/16.3!",
+ unit, ia->ia_iobase);
+ return(0);
+ break;
+ }
+ sc->sc_port = ia->ia_iobase;
+
+ /* setup access routines */
+
+ sc->clearirq = NULL;
+ sc->readreg = tels0163_read_reg;
+ sc->writereg = tels0163_write_reg;
+
+ sc->readfifo = tels0163_read_fifo;
+ sc->writefifo = tels0163_write_fifo;
+
+ /* setup card type */
+
+ sc->sc_cardtyp= CARD_TYPEP_16_3;
+
+ /* setup IOM bus type */
+
+ sc->sc_bustyp = BUS_TYPE_IOM2;
+
+ sc->sc_ipac = 0;
+ sc->sc_bfifolen = HSCX_FIFO_LEN;
+
+ /* setup ISAC and HSCX base addr */
+
+ switch(ia->ia_iobase)
+ {
+ case 0xd80:
+ ISAC_BASE = (caddr_t) 0x960;
+ HSCX_A_BASE = (caddr_t) 0x160;
+ HSCX_B_BASE = (caddr_t) 0x560;
+ break;
+
+ case 0xe80:
+ ISAC_BASE = (caddr_t) 0xa60;
+ HSCX_A_BASE = (caddr_t) 0x260;
+ HSCX_B_BASE = (caddr_t) 0x660;
+ break;
+
+ case 0xf80:
+ ISAC_BASE = (caddr_t) 0xb60;
+ HSCX_A_BASE = (caddr_t) 0x360;
+ HSCX_B_BASE = (caddr_t) 0x760;
+ break;
+ }
+ return 1;
+}
+
+int
+isic_probe_s0163(struct device *dev, struct cfdata *cf,
+ struct isa_attach_args *ia)
+{
+ u_char byte;
+ struct isic_softc dummysc, *sc = &dummysc;
+
+ if((intr_no[ffs(ia->ia_irq) - 1]) == 1)
+ {
+ printf("isic%d: Error, invalid IRQ [%d] specified for Teles S0/16.3!\n",
+ cf->cf_unit, ffs(ia->ia_irq)-1);
+ return(0);
+ }
+
+ /* check if memory addr specified */
+
+ if(ia->ia_maddr)
+ {
+ printf("isic%d: Error, mem addr 0x%lx specified for Teles S0/16.3!",
+ cf->cf_unit, (u_long)ia->ia_maddr);
+ return 0;
+ }
+
+ /* Set up a temporary softc for the probe */
+
+ if (set_softc(sc, ia, cf->cf_unit) == 0)
+ return 0;
+
+ if((byte = inb(sc->sc_port)) != 0x51)
+ {
+ printf("isic%d: Error, signature 1 0x%x != 0x51 for Teles S0/16.3!",
+ cf->cf_unit, byte);
+ return(0);
+ }
+
+ if((byte = inb(sc->sc_port + 1)) != 0x93)
+ {
+ printf("isic%d: Error, signature 2 0x%x != 0x93 for Teles S0/16.3!",
+ cf->cf_unit, byte);
+ return(0);
+ }
+
+ if((byte = inb(sc->sc_port + 2)) != 0x1c)
+ {
+ printf("isic%d: Error, signature 3 0x%x != 0x1c for Teles S0/16.3!",
+ cf->cf_unit, byte);
+ return(0);
+ }
+
+ /*
+ * Read HSCX A/B VSTR. Expected value for the S0/16.3 card is
+ * 0x05 or 0x04 (for older 16.3's) in the least significant bits.
+ */
+
+ if( (((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) &&
+ ((HSCX_READ(0, H_VSTR) & 0xf) != 0x4)) ||
+ (((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) &&
+ ((HSCX_READ(1, H_VSTR) & 0xf) != 0x4)) )
+ {
+ printf("isic%d: HSCX VSTR test failed for Teles S0/16.3\n",
+ cf->cf_unit);
+ printf("isic%d: HSC0: VSTR: %#x\n",
+ cf->cf_unit, HSCX_READ(0, H_VSTR));
+ printf("isic%d: HSC1: VSTR: %#x\n",
+ cf->cf_unit, HSCX_READ(1, H_VSTR));
+ return (0);
+ }
+
+ return (1);
+}
+
+
#else
int
@@ -387,6 +530,34 @@ isic_attach_s0163(struct isa_device *dev)
return (1);
}
+#elif defined(__bsdi__)
+
+extern int
+isic_attach_s0163(struct device *parent, struct device *self, struct isa_attach_args *ia)
+{
+ u_char irq;
+ struct isic_softc *sc = (struct isic_softc *)self;
+ int unit = sc->sc_dev.dv_unit;
+
+ /* Commit the probed attachement values */
+
+ if (set_softc(sc, ia, unit) == 0)
+ panic("isic_attach_s0163: set_softc");
+
+ if (((unsigned)sc->sc_unit) >= NISIC)
+ panic("attach isic%d; NISIC=%d", sc->sc_unit, NISIC);
+ isic_sc[sc->sc_unit] = sc;
+ irq = intr_no[ffs(sc->sc_irq) - 1];
+ /* configure IRQ */
+
+ DELAY(SEC_DELAY / 10);
+ outb(sc->sc_port + 4, irq);
+
+ DELAY(SEC_DELAY / 10);
+ outb(sc->sc_port + 4, irq | 0x01);
+
+ return 1;
+}
#else
int
diff --git a/sys/i4b/layer1/i4b_tel_s08.c b/sys/i4b/layer1/i4b_tel_s08.c
index 6115e12..8f4f284 100644
--- a/sys/i4b/layer1/i4b_tel_s08.c
+++ b/sys/i4b/layer1/i4b_tel_s08.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 1996 Gary Jennejohn. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,9 +37,9 @@
* isic - I4B Siemens ISDN Chipset Driver for Teles S0/8 and clones
* ================================================================
*
- * $Id: i4b_tel_s08.c,v 1.13 1998/12/05 18:04:59 hm Exp $
+ * $Id: i4b_tel_s08.c,v 1.14 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Fri Dec 4 10:39:12 1998]
+ * last edit-date: [Sun Feb 14 10:28:53 1999]
*
* -hm clean up
* -hm more cleanup
diff --git a/sys/i4b/layer1/i4b_tel_s0P.c b/sys/i4b/layer1/i4b_tel_s0P.c
index 9bccd77..ffe9bef 100644
--- a/sys/i4b/layer1/i4b_tel_s0P.c
+++ b/sys/i4b/layer1/i4b_tel_s0P.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1997 Andrew Gordon. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -38,9 +38,9 @@
* EXPERIMENTAL !!!
* ================
*
- * $Id: i4b_tel_s0P.c,v 1.12 1998/12/13 09:52:34 hm Exp $
+ * $Id: i4b_tel_s0P.c,v 1.13 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Thu Dec 10 07:11:15 1998]
+ * last edit-date: [Sun Feb 14 10:29:00 1999]
*
* -hm rudimentary PnP support, hint from Andrew Gordon
* -hm more cleanup
diff --git a/sys/i4b/layer1/i4b_usr_sti.c b/sys/i4b/layer1/i4b_usr_sti.c
index db89296..d8b8792 100644
--- a/sys/i4b/layer1/i4b_usr_sti.c
+++ b/sys/i4b/layer1/i4b_usr_sti.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_usr_sti.c - USRobotics Sportster ISDN TA intern (Tina-pp)
* -------------------------------------------------------------
*
- * $Id: i4b_usr_sti.c,v 1.16 1998/12/05 18:05:02 hm Exp $
+ * $Id: i4b_usr_sti.c,v 1.17 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:25:34 1998]
+ * last edit-date: [Sun Feb 14 10:29:05 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/isa_isic.c b/sys/i4b/layer1/isa_isic.c
index 94e4bf7..7165e24 100644
--- a/sys/i4b/layer1/isa_isic.c
+++ b/sys/i4b/layer1/isa_isic.c
@@ -33,9 +33,9 @@
* isa_isic.c - ISA bus frontend for i4b_isic driver
* --------------------------------------------------
*
- * $Id: isa_isic.c,v 1.18 1998/12/16 13:39:47 hm Exp $
+ * $Id: isa_isic.c,v 1.21 1999/02/23 14:51:18 hm Exp $
*
- * last edit-date: [Mon Dec 14 10:53:16 1998]
+ * last edit-date: [Sun Feb 14 10:29:11 1999]
*
* -mh original implementation
* -hm NetBSD patches from Martin
diff --git a/sys/i4b/layer1/isapnp_isic.c b/sys/i4b/layer1/isapnp_isic.c
index 9dfdf68..c340d8f 100644
--- a/sys/i4b/layer1/isapnp_isic.c
+++ b/sys/i4b/layer1/isapnp_isic.c
@@ -33,9 +33,9 @@
* isapnp_isic.c - ISA-P&P bus frontend for i4b_isic driver
* --------------------------------------------------------
*
- * $Id: isapnp_isic.c,v 1.9 1998/12/16 13:39:47 hm Exp $
+ * $Id: isapnp_isic.c,v 1.10 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Mon Dec 14 10:54:23 1998]
+ * last edit-date: [Sun Feb 14 10:29:15 1999]
*
* -mh original implementation
* -hm NetBSD patches from Martin
diff --git a/sys/i4b/layer1/isic_supio.c b/sys/i4b/layer1/isic_supio.c
index 6c58ad2..24cc1de 100644
--- a/sys/i4b/layer1/isic_supio.c
+++ b/sys/i4b/layer1/isic_supio.c
@@ -37,9 +37,9 @@
* But we attach to the supio, so just see "isic".
* -----------------------------------------------
*
- * $Id: isic_supio.c,v 1.5 1998/12/19 12:07:55 hm Exp $
+ * $Id: isic_supio.c,v 1.6 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Mon Nov 16 12:29:19 1998]
+ * last edit-date: [Sun Feb 14 10:29:19 1999]
*
* -is original implementation
*
diff --git a/sys/i4b/layer1/pci_isic.c b/sys/i4b/layer1/pci_isic.c
index 6f929e5..d577592 100644
--- a/sys/i4b/layer1/pci_isic.c
+++ b/sys/i4b/layer1/pci_isic.c
@@ -33,9 +33,9 @@
* pci_isic.c - pcmcia bus frontend for i4b_isic driver
* -------------------------------------------------------
*
- * $Id: pci_isic.c,v 1.1 1998/12/16 13:39:47 hm Exp $
+ * $Id: pci_isic.c,v 1.2 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Mon Nov 16 20:37:32 1998]
+ * last edit-date: [Sun Feb 14 10:29:25 1999]
*
* -mh original implementation
*
diff --git a/sys/i4b/layer1/pcmcia_isic.c b/sys/i4b/layer1/pcmcia_isic.c
index 9d428a1..20b5478 100644
--- a/sys/i4b/layer1/pcmcia_isic.c
+++ b/sys/i4b/layer1/pcmcia_isic.c
@@ -33,9 +33,9 @@
* pcmcia_isic.c - pcmcia bus frontend for i4b_isic driver
* -------------------------------------------------------
*
- * $Id: pcmcia_isic.c,v 1.3 1998/12/05 18:05:04 hm Exp $
+ * $Id: pcmcia_isic.c,v 1.4 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Fri Dec 4 10:38:43 1998]
+ * last edit-date: [Sun Feb 14 10:29:29 1999]
*
* -mh original implementation
*
diff --git a/sys/i4b/layer1/pcmcia_isic.h b/sys/i4b/layer1/pcmcia_isic.h
index 73f52d6..d5953f0 100644
--- a/sys/i4b/layer1/pcmcia_isic.h
+++ b/sys/i4b/layer1/pcmcia_isic.h
@@ -33,9 +33,9 @@
* pcmcia_isic.h - common definitions for pcmcia isic cards
* --------------------------------------------------------
*
- * $Id: pcmcia_isic.h,v 1.1 1998/12/02 06:44:30 hm Exp $
+ * $Id: pcmcia_isic.h,v 1.2 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Mon Nov 30 21:19:14 1998]
+ * last edit-date: [Sun Feb 14 10:29:33 1999]
*
* -mh original implementation
*
diff --git a/sys/i4b/layer2/i4b_iframe.c b/sys/i4b/layer2/i4b_iframe.c
index c5e38d8..887f828 100644
--- a/sys/i4b/layer2/i4b_iframe.c
+++ b/sys/i4b/layer2/i4b_iframe.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_iframe.c - i frame handling routines
* ------------------------------------------
*
- * $Id: i4b_iframe.c,v 1.15 1998/12/05 18:05:06 hm Exp $
+ * $Id: i4b_iframe.c,v 1.16 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:26:16 1998]
+ * last edit-date: [Sun Feb 14 10:31:19 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_l2.c b/sys/i4b/layer2/i4b_l2.c
index 5cdc1c7..875fabb 100644
--- a/sys/i4b/layer2/i4b_l2.c
+++ b/sys/i4b/layer2/i4b_l2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l2.c - ISDN layer 2 (Q.921)
* -------------------------------
*
- * $Id: i4b_l2.c,v 1.23 1998/12/05 18:05:08 hm Exp $
+ * $Id: i4b_l2.c,v 1.24 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:27:00 1998]
+ * last edit-date: [Sun Feb 14 10:31:25 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_l2.h b/sys/i4b/layer2/i4b_l2.h
index ab1dfd7..dd63f43 100644
--- a/sys/i4b/layer2/i4b_l2.h
+++ b/sys/i4b/layer2/i4b_l2.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l2.h - ISDN layer 2 (Q.921) definitions
* ---------------------------------------------
*
- * $Id: i4b_l2.h,v 1.14 1998/12/05 18:05:09 hm Exp $
+ * $Id: i4b_l2.h,v 1.15 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:27:13 1998]
+ * last edit-date: [Sun Feb 14 10:31:31 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_l2fsm.c b/sys/i4b/layer2/i4b_l2fsm.c
index 113167c..dbbe0ca 100644
--- a/sys/i4b/layer2/i4b_l2fsm.c
+++ b/sys/i4b/layer2/i4b_l2fsm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l2fsm.c - layer 2 FSM
* -------------------------
*
- * $Id: i4b_l2fsm.c,v 1.13 1998/12/05 18:05:11 hm Exp $
+ * $Id: i4b_l2fsm.c,v 1.14 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:28:15 1998]
+ * last edit-date: [Sun Feb 14 10:31:37 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_l2fsm.h b/sys/i4b/layer2/i4b_l2fsm.h
index 8f51068..00b82d6 100644
--- a/sys/i4b/layer2/i4b_l2fsm.h
+++ b/sys/i4b/layer2/i4b_l2fsm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l2fsm.h - layer 2 FSM
* -------------------------
*
- * $Id: i4b_l2fsm.h,v 1.3 1998/12/05 18:05:13 hm Exp $
+ * $Id: i4b_l2fsm.h,v 1.4 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:28:39 1998]
+ * last edit-date: [Sun Feb 14 10:31:43 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_l2timer.c b/sys/i4b/layer2/i4b_l2timer.c
index 3b45e807..b9ae4a1 100644
--- a/sys/i4b/layer2/i4b_l2timer.c
+++ b/sys/i4b/layer2/i4b_l2timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l2timer.c - layer 2 timer handling
* --------------------------------------
*
- * $Id: i4b_l2timer.c,v 1.12 1998/12/05 18:05:15 hm Exp $
+ * $Id: i4b_l2timer.c,v 1.13 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:29:13 1998]
+ * last edit-date: [Sun Feb 14 10:31:48 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_lme.c b/sys/i4b/layer2/i4b_lme.c
index b179e94..8c5059e 100644
--- a/sys/i4b/layer2/i4b_lme.c
+++ b/sys/i4b/layer2/i4b_lme.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_lme.c - layer management entity
* -------------------------------------
*
- * $Id: i4b_lme.c,v 1.8 1998/12/05 18:05:19 hm Exp $
+ * $Id: i4b_lme.c,v 1.9 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:29:25 1998]
+ * last edit-date: [Sun Feb 14 10:31:55 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_mbuf.c b/sys/i4b/layer2/i4b_mbuf.c
index 6d085c3..9da6d40 100644
--- a/sys/i4b/layer2/i4b_mbuf.c
+++ b/sys/i4b/layer2/i4b_mbuf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b - mbuf handling support routines
* ------------------------------------
*
- * $Id: i4b_mbuf.c,v 1.10 1998/12/05 18:05:20 hm Exp $
+ * $Id: i4b_mbuf.c,v 1.11 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:29:44 1998]
+ * last edit-date: [Sun Feb 14 10:32:00 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_sframe.c b/sys/i4b/layer2/i4b_sframe.c
index f8d14ba..220be26 100644
--- a/sys/i4b/layer2/i4b_sframe.c
+++ b/sys/i4b/layer2/i4b_sframe.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_sframe.c - s frame handling routines
* ----------------------------------------
*
- * $Id: i4b_sframe.c,v 1.8 1998/12/05 18:05:21 hm Exp $
+ * $Id: i4b_sframe.c,v 1.9 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:30:02 1998]
+ * last edit-date: [Sun Feb 14 10:32:06 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_tei.c b/sys/i4b/layer2/i4b_tei.c
index 5c5b7b8..3742dfd 100644
--- a/sys/i4b/layer2/i4b_tei.c
+++ b/sys/i4b/layer2/i4b_tei.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_tei.c - tei handling procedures
* -----------------------------------
*
- * $Id: i4b_tei.c,v 1.13 1998/12/05 18:05:23 hm Exp $
+ * $Id: i4b_tei.c,v 1.14 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:30:20 1998]
+ * last edit-date: [Sun Feb 14 10:32:12 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_uframe.c b/sys/i4b/layer2/i4b_uframe.c
index 90e7912..1e8619d 100644
--- a/sys/i4b/layer2/i4b_uframe.c
+++ b/sys/i4b/layer2/i4b_uframe.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_uframe.c - routines for handling U-frames
* -----------------------------------------------
*
- * $Id: i4b_uframe.c,v 1.6 1998/12/05 18:05:24 hm Exp $
+ * $Id: i4b_uframe.c,v 1.7 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:30:33 1998]
+ * last edit-date: [Sun Feb 14 10:32:17 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer2/i4b_util.c b/sys/i4b/layer2/i4b_util.c
index 9f8fe19..047e438 100644
--- a/sys/i4b/layer2/i4b_util.c
+++ b/sys/i4b/layer2/i4b_util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_util.c - layer 2 utility routines
* -------------------------------------
*
- * $Id: i4b_util.c,v 1.15 1998/12/05 18:05:26 hm Exp $
+ * $Id: i4b_util.c,v 1.17 1999/02/14 09:45:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:31:10 1998]
+ * last edit-date: [Sun Feb 14 10:32:23 1999]
*
*---------------------------------------------------------------------------*/
@@ -165,6 +165,8 @@ i4b_enquiry_response(l2_softc_t *l2sc)
void
i4b_invoke_retransmission(l2_softc_t *l2sc, int nr)
{
+ int x = SPLI4B();
+
DBGL2(L2_ERROR, "i4b_invoke_retransmission", ("nr = %d\n", nr ));
while(l2sc->vs != nr)
@@ -189,6 +191,8 @@ i4b_invoke_retransmission(l2_softc_t *l2sc, int nr)
i4b_i_frame_queued_up(l2sc);
}
+
+ splx(x);
}
/*---------------------------------------------------------------------------*
@@ -258,13 +262,13 @@ i4b_rxd_ack(l2_softc_t *l2sc, int nr)
{
int s;
+ s = SPLI4B();
+
M128DEC(nr);
if(l2sc->ua_num != nr)
DBGL2(L2_ERROR, "i4b_rxd_ack", ("((N(R)-1)=%d) != (UA=%d) !!!\n", nr, l2sc->ua_num));
- s = SPLI4B();
-
i4b_Dfreembuf(l2sc->ua_frame);
l2sc->ua_num = UA_EMPTY;
diff --git a/sys/i4b/layer3/i4b_l2if.c b/sys/i4b/layer3/i4b_l2if.c
index 33b1340..2633839 100644
--- a/sys/i4b/layer3/i4b_l2if.c
+++ b/sys/i4b/layer3/i4b_l2if.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l2if.c - Layer 3 interface to Layer 2
* -------------------------------------------
*
- * $Id: i4b_l2if.c,v 1.14 1998/12/05 18:05:28 hm Exp $
+ * $Id: i4b_l2if.c,v 1.15 1999/02/14 09:45:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:31:26 1998]
+ * last edit-date: [Sun Feb 14 10:33:13 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_l3.h b/sys/i4b/layer3/i4b_l3.h
index 9d05055..66a40b6 100644
--- a/sys/i4b/layer3/i4b_l3.h
+++ b/sys/i4b/layer3/i4b_l3.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l3.h - layer 3 header file
* ------------------------------
*
- * $Id: i4b_l3.h,v 1.8 1998/12/05 18:05:30 hm Exp $
+ * $Id: i4b_l3.h,v 1.9 1999/02/14 09:45:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:31:41 1998]
+ * last edit-date: [Sun Feb 14 10:33:19 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_l3fsm.c b/sys/i4b/layer3/i4b_l3fsm.c
index e45e119..39c024c 100644
--- a/sys/i4b/layer3/i4b_l3fsm.c
+++ b/sys/i4b/layer3/i4b_l3fsm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l3fsm.c - layer 3 FSM
* -------------------------
*
- * $Id: i4b_l3fsm.c,v 1.13 1998/12/05 18:05:31 hm Exp $
+ * $Id: i4b_l3fsm.c,v 1.14 1999/02/14 09:45:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:32:17 1998]
+ * last edit-date: [Sun Feb 14 10:33:25 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_l3fsm.h b/sys/i4b/layer3/i4b_l3fsm.h
index d69b810..a7553d5 100644
--- a/sys/i4b/layer3/i4b_l3fsm.h
+++ b/sys/i4b/layer3/i4b_l3fsm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l3fsm.c - layer 3 FSM
* -------------------------
*
- * $Id: i4b_l3fsm.h,v 1.5 1998/12/05 18:05:33 hm Exp $
+ * $Id: i4b_l3fsm.h,v 1.6 1999/02/14 09:45:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:32:45 1998]
+ * last edit-date: [Sun Feb 14 10:33:31 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_l3timer.c b/sys/i4b/layer3/i4b_l3timer.c
index 6c1a2d3..dc20d4e 100644
--- a/sys/i4b/layer3/i4b_l3timer.c
+++ b/sys/i4b/layer3/i4b_l3timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l3timer.c - timer and timeout handling for layer 3
* ------------------------------------------------------
*
- * $Id: i4b_l3timer.c,v 1.9 1998/12/05 18:05:35 hm Exp $
+ * $Id: i4b_l3timer.c,v 1.10 1999/02/14 09:45:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:33:00 1998]
+ * last edit-date: [Sun Feb 14 10:33:38 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_l4if.c b/sys/i4b/layer3/i4b_l4if.c
index 55d9bb9..3f0c0cb 100644
--- a/sys/i4b/layer3/i4b_l4if.c
+++ b/sys/i4b/layer3/i4b_l4if.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l4if.c - Layer 3 interface to Layer 4
* -------------------------------------------
*
- * $Id: i4b_l4if.c,v 1.17 1998/12/05 18:05:36 hm Exp $
+ * $Id: i4b_l4if.c,v 1.18 1999/02/14 09:45:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:33:16 1998]
+ * last edit-date: [Sun Feb 14 10:33:44 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_q931.c b/sys/i4b/layer3/i4b_q931.c
index 6c111d1..64ce766 100644
--- a/sys/i4b/layer3/i4b_q931.c
+++ b/sys/i4b/layer3/i4b_q931.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_q931.c - Q931 received messages handling
* --------------------------------------------
*
- * $Id: i4b_q931.c,v 1.18 1998/12/05 18:05:38 hm Exp $
+ * $Id: i4b_q931.c,v 1.19 1999/02/14 09:45:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:33:36 1998]
+ * last edit-date: [Sun Feb 14 10:33:50 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_q931.h b/sys/i4b/layer3/i4b_q931.h
index cb916b0..8c7a8a8 100644
--- a/sys/i4b/layer3/i4b_q931.h
+++ b/sys/i4b/layer3/i4b_q931.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_q931.h - Q931 handling header file
* --------------------------------------
*
- * $Id: i4b_q931.h,v 1.5 1998/12/05 18:05:39 hm Exp $
+ * $Id: i4b_q931.h,v 1.6 1999/02/14 09:45:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:33:53 1998]
+ * last edit-date: [Sun Feb 14 10:33:56 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_q932fac.c b/sys/i4b/layer3/i4b_q932fac.c
index 487ce00..fc28f9f 100644
--- a/sys/i4b/layer3/i4b_q932fac.c
+++ b/sys/i4b/layer3/i4b_q932fac.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_q932fac.c - Q932 facility handling
* --------------------------------------
*
- * $Id: i4b_q932fac.c,v 1.5 1998/12/05 18:05:41 hm Exp $
+ * $Id: i4b_q932fac.c,v 1.6 1999/02/14 09:45:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:34:11 1998]
+ * last edit-date: [Sun Feb 14 10:34:02 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_q932fac.h b/sys/i4b/layer3/i4b_q932fac.h
index d7544a8..7e83fce 100644
--- a/sys/i4b/layer3/i4b_q932fac.h
+++ b/sys/i4b/layer3/i4b_q932fac.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_q932fac.h - Q932 facility handling header file
* --------------------------------------------------
*
- * $Id: i4b_q932fac.h,v 1.5 1998/12/18 17:17:57 hm Exp $
+ * $Id: i4b_q932fac.h,v 1.6 1999/02/14 09:45:02 hm Exp $
*
- * last edit-date: [Fri Dec 18 18:17:23 1998]
+ * last edit-date: [Sun Feb 14 10:34:08 1999]
*
*---------------------------------------------------------------------------
*
diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c
index e48d993..fbbc2dc 100644
--- a/sys/i4b/layer4/i4b_i4bdrv.c
+++ b/sys/i4b/layer4/i4b_i4bdrv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_i4bdrv.c - i4b userland interface driver
* --------------------------------------------
*
- * $Id: i4b_i4bdrv.c,v 1.1 1998/12/27 21:46:52 phk Exp $
+ * $Id: i4b_i4bdrv.c,v 1.37 1999/02/15 09:55:47 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:35:02 1998]
+ * last edit-date: [Mon Feb 15 10:36:25 1999]
*
*---------------------------------------------------------------------------*/
@@ -86,7 +86,7 @@
#include <i4b/layer4/i4b_l4.h>
-#if defined(__FreeBSD__) && (!defined(__FreeBSD_version) || __FreeBSD_version < 300001)
+#if (defined(__FreeBSD__) && (!defined(__FreeBSD_version) || __FreeBSD_version < 300001)) || defined(__bsdi__)
/* do nothing */
#else
#include <sys/poll.h>
@@ -108,10 +108,14 @@ PDEVSTATIC void i4battach __P((void));
PDEVSTATIC int i4bopen __P((dev_t dev, int flag, int fmt, struct proc *p));
PDEVSTATIC int i4bclose __P((dev_t dev, int flag, int fmt, struct proc *p));
PDEVSTATIC int i4bread __P((dev_t dev, struct uio *uio, int ioflag));
+#ifdef __bsdi__
+PDEVSTATIC int i4bioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p));
+#else
PDEVSTATIC int i4bioctl __P((dev_t dev, int cmd, caddr_t data, int flag, struct proc *p));
+#endif
PDEVSTATIC int i4bpoll __P((dev_t dev, int events, struct proc *p));
-#if defined (__OpenBSD__)
+#if defined (__OpenBSD__) || defined(__bsdi__)
PDEVSTATIC int i4bselect(dev_t dev, int rw, struct proc *p);
#endif
@@ -145,6 +149,36 @@ PSEUDO_SET(i4battach, i4b_i4bdrv);
#endif /* __FreeBSD__ */
+#ifdef __bsdi__
+#include <sys/device.h>
+int i4bmatch(struct device *parent, struct cfdata *cf, void *aux);
+void dummy_i4battach(struct device*, struct device *, void *);
+
+#define CDEV_MAJOR 65
+
+static struct cfdriver i4bcd =
+ { NULL, "i4b", i4bmatch, dummy_i4battach, DV_DULL,
+ sizeof(struct cfdriver) };
+struct devsw i4bsw =
+ { &i4bcd,
+ i4bopen, i4bclose, i4bread, nowrite,
+ i4bioctl, i4bselect, nommap, nostrat,
+ nodump, nopsize, 0, nostop
+};
+
+int
+i4bmatch(struct device *parent, struct cfdata *cf, void *aux)
+{
+ printf("i4bmatch: aux=0x%x\n", aux);
+ return 1;
+}
+void
+dummy_i4battach(struct device *parent, struct device *self, void *aux)
+{
+ printf("dummy_i4battach: aux=0x%x\n", aux);
+}
+#endif /* __bsdi__ */
+
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
@@ -246,6 +280,8 @@ i4bread(dev_t dev, struct uio *uio, int ioflag)
PDEVSTATIC int
#if defined (__FreeBSD_version) && __FreeBSD_version >= 300003
i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
+#elif defined(__bsdi__)
+i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
#else
i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
#endif
@@ -289,9 +325,10 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
cd->driver_unit = mcr->driver_unit;
cd->cr = get_rand_cr(ctrl_desc[cd->controller].unit);
- cd->unitlen_time = mcr->unitlen_time;
- cd->idle_time = mcr->idle_time;
- cd->earlyhup_time = mcr->earlyhup_time;
+ cd->shorthold_data.shorthold_algorithm = mcr->shorthold_data.shorthold_algorithm;
+ cd->shorthold_data.unitlen_time = mcr->shorthold_data.unitlen_time;
+ cd->shorthold_data.idle_time = mcr->shorthold_data.idle_time;
+ cd->shorthold_data.earlyhup_time = mcr->shorthold_data.earlyhup_time;
cd->last_aocd_time = 0;
if(mcr->unitlen_method == ULEN_METHOD_DYNAMIC)
@@ -305,8 +342,9 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
cd->dir = DIR_OUTGOING;
- DBGL4(L4_TIMO, "i4bioctl", ("I4B_CONNECT_REQ times, unitlen=%ld idle=%ld earlyhup=%ld\n",
- (long)cd->unitlen_time, (long)cd->idle_time, (long)cd->earlyhup_time));
+ DBGL4(L4_TIMO, "i4bioctl", ("I4B_CONNECT_REQ times, algorithm=%ld unitlen=%ld idle=%ld earlyhup=%ld\n",
+ (long)cd->shorthold_data.shorthold_algorithm, (long)cd->shorthold_data.unitlen_time,
+ (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time));
strcpy(cd->dst_telno, mcr->dst_telno);
strcpy(cd->src_telno, mcr->src_telno);
@@ -376,9 +414,10 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
cd->driver_unit = mcrsp->driver_unit;
cd->max_idle_time = mcrsp->max_idle_time;
- cd->unitlen_time = 0; /* this is incoming */
- cd->idle_time = 0;
- cd->earlyhup_time = 0;
+ cd->shorthold_data.shorthold_algorithm = msg_alg__fix_unit_size;
+ cd->shorthold_data.unitlen_time = 0; /* this is incoming */
+ cd->shorthold_data.idle_time = 0;
+ cd->shorthold_data.earlyhup_time = 0;
cd->isdntxdelay = mcrsp->txdelay;
@@ -467,6 +506,9 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
mtu = (msg_timeout_upd_t *)data;
+ DBGL4(L4_TIMO, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, alg %d, unit %d, idle %d, early %d!\n",
+ mtu->shorthold_data.shorthold_algorithm, mtu->shorthold_data.unitlen_time,
+ mtu->shorthold_data.idle_time, mtu->shorthold_data.earlyhup_time ));
if((cd = cd_by_cdid(mtu->cdid)) == NULL)/* get cd */
{
DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, cdid not found!\n"));
@@ -474,10 +516,62 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
break;
}
+ switch( mtu->shorthold_data.shorthold_algorithm )
+ {
+
+ case msg_alg__fix_unit_size:
+ /*
+ * For this algorithm
+ * unitlen_time, idle_time and earlyhup_time
+ * are used.
+ */
+ if( mtu->shorthold_data.unitlen_time >= 0
+ && mtu->shorthold_data.idle_time > 0
+ && mtu->shorthold_data.earlyhup_time >= 0 )
+ {
+ break;
+ }
+
+ DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, invalid args for fix unit algorithm!\n"));
+ error = EINVAL;
+ break;
+
+ case msg_alg__var_unit_size:
+ /*
+ * For this algorithm
+ * unitlen_time and idle_time are used
+ * both must be positive integers
+ * earlyhup_time is not used and must be 0.
+ */
+ if( mtu->shorthold_data.unitlen_time > 0
+ && mtu->shorthold_data.idle_time > 0
+ && mtu->shorthold_data.earlyhup_time == 0 )
+ {
+ break;
+ }
+
+ DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, invalid args for var unit algorithm!\n"));
+ error = EINVAL;
+ break;
+
+ default:
+ DBGL4(L4_ERR, "i4bioctl", ("I4B_TIMEOUT_UPD ioctl, invalid algorithm!\n"));
+ error = EINVAL;
+ break;
+ }
+
+ /*
+ * any error set above requires us to break
+ * out of the outter switch
+ */
+ if( error != 0 )
+ break;
+
x = SPLI4B();
- cd->unitlen_time = mtu->unitlen_time;
- cd->idle_time = mtu->idle_time;
- cd->earlyhup_time = mtu->earlyhup_time;
+ cd->shorthold_data.shorthold_algorithm = mtu->shorthold_data.shorthold_algorithm;
+ cd->shorthold_data.unitlen_time = mtu->shorthold_data.unitlen_time;
+ cd->shorthold_data.idle_time = mtu->shorthold_data.idle_time;
+ cd->shorthold_data.earlyhup_time = mtu->shorthold_data.earlyhup_time;
splx(x);
break;
}
@@ -546,6 +640,12 @@ i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
(struct isdn_download_request*)data;
int i;
+ if (r->controller < 0 || r->controller >= nctrl)
+ {
+ error = ENODEV;
+ goto download_done;
+ }
+
if(!ctrl_desc[r->controller].N_DOWNLOAD)
{
error = ENODEV;
@@ -605,6 +705,11 @@ download_done:
(struct isdn_diagnostic_request*)data;
req.in_param = req.out_param = NULL;
+ if (r->controller < 0 || r->controller >= nctrl)
+ {
+ error = ENODEV;
+ goto diag_done;
+ }
if(!ctrl_desc[r->controller].N_DIAGNOSTICS)
{
@@ -623,7 +728,9 @@ download_done:
error = ENOMEM;
goto diag_done;
}
- copyin(r->in_param, req.in_param, req.in_param_len);
+ error = copyin(r->in_param, req.in_param, req.in_param_len);
+ if (error)
+ goto diag_done;
}
if(req.out_param_len)
@@ -640,7 +747,7 @@ download_done:
error = ctrl_desc[r->controller].N_DIAGNOSTICS(r->controller, &req);
if(!error && req.out_param_len)
- copyout(req.out_param, r->out_param, req.out_param_len);
+ error = copyout(req.out_param, r->out_param, req.out_param_len);
diag_done:
if(req.in_param)
@@ -664,7 +771,7 @@ diag_done:
#if (defined(__FreeBSD__) && \
(!defined(__FreeBSD_version) || (__FreeBSD_version < 300001))) \
- || defined (__OpenBSD__)
+ || defined (__OpenBSD__) || defined(__bsdi__)
/*---------------------------------------------------------------------------*
* i4bselect - device driver select routine
diff --git a/sys/i4b/layer4/i4b_l4.c b/sys/i4b/layer4/i4b_l4.c
index cecd5f4..1f87461 100644
--- a/sys/i4b/layer4/i4b_l4.c
+++ b/sys/i4b/layer4/i4b_l4.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,15 +27,20 @@
* i4b_l4.c - kernel interface to userland
* -----------------------------------------
*
- * $Id: i4b_l4.c,v 1.33 1998/12/05 18:05:49 hm Exp $
+ * $Id: i4b_l4.c,v 1.36 1999/02/15 09:55:48 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:35:16 1998]
+ * last edit-date: [Mon Feb 15 10:42:37 1999]
*
*---------------------------------------------------------------------------*/
#include "i4b.h"
#include "i4bipr.h"
+#ifdef __bsdi__
+#define NI4BISPPP 0
+#include "ibc.h"
+#else
#include "i4bisppp.h"
+#endif
#include "i4brbch.h"
#include "i4btel.h"
@@ -562,6 +567,12 @@ i4b_link_bchandrvr(call_desc_t *cd)
break;
#endif
+#if defined(__bsdi__) && NIBC > 0
+ case BDRV_IBC:
+ cd->dlt = ibc_ret_linktab(cd->driver_unit);
+ break;
+#endif
+
default:
cd->dlt = NULL;
break;
@@ -603,6 +614,12 @@ i4b_link_bchandrvr(call_desc_t *cd)
i4bisppp_set_linktab(cd->driver_unit, cd->ilt);
break;
#endif
+
+#if defined(__bsdi__) && NIBC > 0
+ case BDRV_IBC:
+ ibc_set_linktab(cd->driver_unit, cd->ilt);
+ break;
+#endif
default:
return(0);
break;
@@ -687,9 +704,15 @@ idletime_state: IST_NONCHK IST_CHECK IST_SAFE
/*---------------------------------------------------------------------------*
* B channel idle check timeout setup
*---------------------------------------------------------------------------*/
+static void i4b_l4_setup_timeout_fix_unit(call_desc_t *cd);
+static void i4b_l4_setup_timeout_var_unit(call_desc_t *cd);
+
static void
i4b_l4_setup_timeout(call_desc_t *cd)
{
+ DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: direction %d, shorthold algorithm %d\n",
+ (long)SECOND, cd->dir, cd->shorthold_data.shorthold_algorithm ));
+
cd->timeout_active = 0;
cd->idletime_state = IST_IDLE;
@@ -704,58 +727,99 @@ i4b_l4_setup_timeout(call_desc_t *cd)
cd->timeout_active = 1;
DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: incoming-call, setup max_idle_time to %ld\n", (long)SECOND, (long)cd->max_idle_time));
}
- else if((cd->dir == DIR_OUTGOING) && (cd->idle_time > 0))
+ else if((cd->dir == DIR_OUTGOING) && (cd->shorthold_data.idle_time > 0))
{
- /* outgoing call */
-
- if((cd->idle_time > 0) && (cd->unitlen_time == 0))
+ switch( cd->shorthold_data.shorthold_algorithm )
{
- /* outgoing call: simple max idletime check */
-
+ default: /* fall into the old fix algorithm */
+ case msg_alg__fix_unit_size:
+ i4b_l4_setup_timeout_fix_unit( cd );
+ break;
+ case msg_alg__var_unit_size:
+ i4b_l4_setup_timeout_var_unit( cd );
+ break;
+ }
+ }
+ else
+ {
+ DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("no idle_timeout configured\n"));
+ }
+}
+
+static void
+i4b_l4_setup_timeout_fix_unit(call_desc_t *cd)
+{
+ /* outgoing call */
+
+ if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0))
+ {
+ /* outgoing call: simple max idletime check */
+
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
- cd->idle_timeout_handle =
+ cd->idle_timeout_handle =
#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
- cd->timeout_active = 1;
- DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, setup idle_time to %ld\n", (long)SECOND, (long)cd->idle_time));
- }
- else if((cd->unitlen_time > 0) && (cd->unitlen_time > (cd->idle_time + cd->earlyhup_time)))
- {
- /* outgoing call: full shorthold mode check */
-
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
+ cd->timeout_active = 1;
+ DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, setup idle_time to %ld\n",
+ (long)SECOND, (long)cd->shorthold_data.idle_time));
+ }
+ else if((cd->shorthold_data.unitlen_time > 0) && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time)))
+ {
+ /* outgoing call: full shorthold mode check */
+
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
- cd->idle_timeout_handle =
+ cd->idle_timeout_handle =
#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->unitlen_time - (cd->idle_time + cd->earlyhup_time)));
- cd->timeout_active = 1;
- cd->idletime_state = IST_NONCHK;
- DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, start %ld sec nocheck window\n",
- (long)SECOND, (long)(cd->unitlen_time - (cd->idle_time + cd->earlyhup_time))));
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time)));
+ cd->timeout_active = 1;
+ cd->idletime_state = IST_NONCHK;
+ DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, start %ld sec nocheck window\n",
+ (long)SECOND, (long)(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time))));
- if(cd->aocd_flag == 0)
- {
- cd->units_type = CHARGE_CALC;
- cd->cunits++;
- i4b_l4_charging_ind(cd);
- }
- }
- else
+ if(cd->aocd_flag == 0)
{
- /* parms somehow got wrong .. */
-
- DBGL4(L4_ERR, "i4b_l4_setup_timeout", ("%ld: ERROR: idletime[%ld]+earlyhup[%ld] > unitlength[%ld]!\n",
- (long)SECOND, (long)cd->idle_time, (long)cd->earlyhup_time, (long)cd->unitlen_time));
+ cd->units_type = CHARGE_CALC;
+ cd->cunits++;
+ i4b_l4_charging_ind(cd);
}
}
else
{
- DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("no idle_timeout configured\n"));
+ /* parms somehow got wrong .. */
+
+ DBGL4(L4_ERR, "i4b_l4_setup_timeout", ("%ld: ERROR: idletime[%ld]+earlyhup[%ld] > unitlength[%ld]!\n",
+ (long)SECOND, (long)cd->shorthold_data.idle_time, (long)cd->shorthold_data.earlyhup_time, (long)cd->shorthold_data.unitlen_time));
}
}
+static void
+i4b_l4_setup_timeout_var_unit(call_desc_t *cd)
+{
+ /* outgoing call: variable unit idletime check */
+
+ /*
+ * start checking for an idle connect one second before the end of the unit.
+ * The one second takes into account of rounding due to the driver only
+ * using the seconds and not the uSeconds of the current time
+ */
+ cd->idletime_state = IST_CHECK; /* move directly to the checking state */
+
+#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
+ cd->idle_timeout_handle =
+#endif
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz * (cd->shorthold_data.unitlen_time - 1) );
+ cd->timeout_active = 1;
+ DBGL4(L4_TIMO, "i4b_l4_setup_timeout", ("%ld: outgoing-call, var idle time - setup to %ld\n",
+ (long)SECOND, (long)cd->shorthold_data.unitlen_time));
+}
+
+
/*---------------------------------------------------------------------------*
* B channel idle check timeout function
*---------------------------------------------------------------------------*/
+static void i4b_idle_check_fix_unit(call_desc_t *cd);
+static void i4b_idle_check_var_unit(call_desc_t *cd);
+
void
i4b_idle_check(call_desc_t *cd)
{
@@ -803,95 +867,151 @@ i4b_idle_check(call_desc_t *cd)
else if(cd->dir == DIR_OUTGOING)
{
+ switch( cd->shorthold_data.shorthold_algorithm )
+ {
+ case msg_alg__fix_unit_size:
+ i4b_idle_check_fix_unit( cd );
+ break;
+ case msg_alg__var_unit_size:
+ i4b_idle_check_var_unit( cd );
+ break;
+ default:
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: bad value for shorthold_algorithm of %d\n",
+ (long)SECOND, cd->shorthold_data.shorthold_algorithm ));
+ i4b_idle_check_fix_unit( cd );
+ break;
+ }
+ }
+ splx(s);
+}
- /* simple idletime calculation */
+static void
+i4b_idle_check_fix_unit(call_desc_t *cd)
+{
+
+ /* simple idletime calculation */
- if((cd->idle_time > 0) && (cd->unitlen_time == 0))
+ if((cd->shorthold_data.idle_time > 0) && (cd->shorthold_data.unitlen_time == 0))
+ {
+ if((cd->last_active_time + cd->shorthold_data.idle_time) <= SECOND)
{
- if((cd->last_active_time + cd->idle_time) <= SECOND)
- {
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, idle timeout, disconnecting!\n", (long)SECOND));
- (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid,
- (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
- i4b_l4_idle_timeout_ind(cd);
- }
- else
- {
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, activity, last_active=%ld, max_idle=%ld\n",
- (long)SECOND, (long)cd->last_active_time, (long)cd->idle_time));
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, idle timeout, disconnecting!\n", (long)SECOND));
+ (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
+ i4b_l4_idle_timeout_ind(cd);
+ }
+ else
+ {
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call-st, activity, last_active=%ld, max_idle=%ld\n",
+ (long)SECOND, (long)cd->last_active_time, (long)cd->shorthold_data.idle_time));
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
- cd->idle_timeout_handle =
+ cd->idle_timeout_handle =
#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
- cd->timeout_active = 1;
- }
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz/2);
+ cd->timeout_active = 1;
}
+ }
- /* full shorthold mode calculation */
+ /* full shorthold mode calculation */
- else if((cd->unitlen_time > 0) && (cd->unitlen_time > (cd->idle_time + cd->earlyhup_time)))
+ else if((cd->shorthold_data.unitlen_time > 0)
+ && (cd->shorthold_data.unitlen_time > (cd->shorthold_data.idle_time + cd->shorthold_data.earlyhup_time)))
+ {
+ switch(cd->idletime_state)
{
- switch(cd->idletime_state)
- {
- case IST_NONCHK: /* end of non-check time */
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
- cd->idle_timeout_handle =
-#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->idle_time));
- cd->idletimechk_start = SECOND;
- cd->idletime_state = IST_CHECK;
- cd->timeout_active = 1;
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idletime check window reached!\n", (long)SECOND));
- break;
- case IST_CHECK: /* end of idletime chk */
- if((cd->last_active_time > cd->idletimechk_start) &&
- (cd->last_active_time <= SECOND))
- { /* activity detected */
+ case IST_NONCHK: /* end of non-check time */
+
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
- cd->idle_timeout_handle =
+ cd->idle_timeout_handle =
#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->earlyhup_time));
- cd->timeout_active = 1;
- cd->idletime_state = IST_SAFE;
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, activity at %ld, wait earlyhup-end\n", (long)SECOND, (long)cd->last_active_time));
- }
- else
- { /* no activity, hangup */
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idle timeout, last activity at %ld\n", (long)SECOND, (long)cd->last_active_time));
- (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid,
- (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
- i4b_l4_idle_timeout_ind(cd);
- cd->idletime_state = IST_IDLE;
- }
- break;
-
- case IST_SAFE: /* end of earlyhup time */
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.idle_time));
+ cd->idletimechk_start = SECOND;
+ cd->idletime_state = IST_CHECK;
+ cd->timeout_active = 1;
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idletime check window reached!\n", (long)SECOND));
+ break;
+
+ case IST_CHECK: /* end of idletime chk */
+ if((cd->last_active_time > cd->idletimechk_start) &&
+ (cd->last_active_time <= SECOND))
+ { /* activity detected */
#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
cd->idle_timeout_handle =
#endif
- timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->unitlen_time - (cd->idle_time+cd->earlyhup_time)));
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.earlyhup_time));
cd->timeout_active = 1;
- cd->idletime_state = IST_NONCHK;
-
- if(cd->aocd_flag == 0)
- {
- cd->units_type = CHARGE_CALC;
- cd->cunits++;
- i4b_l4_charging_ind(cd);
- }
-
- DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, earlyhup end, wait for idletime start\n", (long)SECOND));
- break;
-
- default:
- DBGL4(L4_ERR, "i4b_idle_check", ("outgoing-call: invalid idletime_state value!\n"));
+ cd->idletime_state = IST_SAFE;
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, activity at %ld, wait earlyhup-end\n", (long)SECOND, (long)cd->last_active_time));
+ }
+ else
+ { /* no activity, hangup */
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, idle timeout, last activity at %ld\n", (long)SECOND, (long)cd->last_active_time));
+ (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
+ i4b_l4_idle_timeout_ind(cd);
cd->idletime_state = IST_IDLE;
- break;
}
+ break;
+
+ case IST_SAFE: /* end of earlyhup time */
+
+#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
+ cd->idle_timeout_handle =
+#endif
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz*(cd->shorthold_data.unitlen_time - (cd->shorthold_data.idle_time+cd->shorthold_data.earlyhup_time)));
+ cd->timeout_active = 1;
+ cd->idletime_state = IST_NONCHK;
+
+ if(cd->aocd_flag == 0)
+ {
+ cd->units_type = CHARGE_CALC;
+ cd->cunits++;
+ i4b_l4_charging_ind(cd);
+ }
+
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, earlyhup end, wait for idletime start\n", (long)SECOND));
+ break;
+
+ default:
+ DBGL4(L4_ERR, "i4b_idle_check", ("outgoing-call: invalid idletime_state value!\n"));
+ cd->idletime_state = IST_IDLE;
+ break;
}
}
- splx(s);
+}
+
+static void
+i4b_idle_check_var_unit(call_desc_t *cd)
+{
+ switch(cd->idletime_state)
+ {
+
+ /* see if there has been any activity within the last idle_time seconds */
+ case IST_CHECK:
+ if( cd->last_active_time > (SECOND - cd->shorthold_data.idle_time))
+ { /* activity detected */
+#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
+ cd->idle_timeout_handle =
+#endif
+ /* check again in one second */
+ timeout((TIMEOUT_FUNC_T)i4b_idle_check,(void *)cd, hz );
+ cd->timeout_active = 1;
+ cd->idletime_state = IST_CHECK;
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, var idle timeout - activity at %ld, continuing\n", (long)SECOND, (long)cd->last_active_time));
+ }
+ else
+ { /* no activity, hangup */
+ DBGL4(L4_TIMO, "i4b_idle_check", ("%ld: outgoing-call, var idle timeout - last activity at %ld\n", (long)SECOND, (long)cd->last_active_time));
+ (*ctrl_desc[cd->controller].N_DISCONNECT_REQUEST)(cd->cdid, (CAUSET_I4B << 8) | CAUSE_I4B_NORMAL);
+ i4b_l4_idle_timeout_ind(cd);
+ cd->idletime_state = IST_IDLE;
+ }
+ break;
+
+ default:
+ DBGL4(L4_ERR, "i4b_idle_check", ("outgoing-call: var idle timeout invalid idletime_state value!\n"));
+ cd->idletime_state = IST_IDLE;
+ break;
+ }
}
#endif /* NI4B > 0 */
diff --git a/sys/i4b/layer4/i4b_l4.h b/sys/i4b/layer4/i4b_l4.h
index e4ed863f..d88e64c 100644
--- a/sys/i4b/layer4/i4b_l4.h
+++ b/sys/i4b/layer4/i4b_l4.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l4.h - kernel interface to userland header file
* ---------------------------------------------------
*
- * $Id: i4b_l4.h,v 1.13 1998/12/05 18:05:50 hm Exp $
+ * $Id: i4b_l4.h,v 1.14 1999/02/14 09:45:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:35:34 1998]
+ * last edit-date: [Sun Feb 14 10:35:08 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer4/i4b_l4mgmt.c b/sys/i4b/layer4/i4b_l4mgmt.c
index e8e1a96..6090f29 100644
--- a/sys/i4b/layer4/i4b_l4mgmt.c
+++ b/sys/i4b/layer4/i4b_l4mgmt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l4mgmt.c - layer 4 calldescriptor management utilites
* -----------------------------------------------------------
*
- * $Id: i4b_l4mgmt.c,v 1.23 1998/12/05 18:05:52 hm Exp $
+ * $Id: i4b_l4mgmt.c,v 1.24 1999/02/14 09:45:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:35:50 1998]
+ * last edit-date: [Sun Feb 14 10:35:13 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer4/i4b_l4timer.c b/sys/i4b/layer4/i4b_l4timer.c
index 7a38e13..ddc0256 100644
--- a/sys/i4b/layer4/i4b_l4timer.c
+++ b/sys/i4b/layer4/i4b_l4timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l4timer.c - timer and timeout handling for layer 4
* --------------------------------------------------------
*
- * $Id: i4b_l4timer.c,v 1.10 1998/12/05 18:05:53 hm Exp $
+ * $Id: i4b_l4timer.c,v 1.11 1999/02/14 09:45:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:36:07 1998]
+ * last edit-date: [Sun Feb 14 10:35:20 1999]
*
*---------------------------------------------------------------------------*/
OpenPOWER on IntegriCloud