summaryrefslogtreecommitdiffstats
path: root/sys/i4b/driver
diff options
context:
space:
mode:
authorhm <hm@FreeBSD.org>1999-03-07 16:08:20 +0000
committerhm <hm@FreeBSD.org>1999-03-07 16:08:20 +0000
commit7e46cf5dd7cad6e069e50c85ee9a31ca260848fb (patch)
tree03a43e3e3e7f8598823a4548c687c6e4558751c8 /sys/i4b/driver
parente2549f2539bc2e4543d92ba29f33e4313595b4d4 (diff)
downloadFreeBSD-src-7e46cf5dd7cad6e069e50c85ee9a31ca260848fb.zip
FreeBSD-src-7e46cf5dd7cad6e069e50c85ee9a31ca260848fb.tar.gz
update the i4b kernel part to i4b release 0.71.00
Diffstat (limited to 'sys/i4b/driver')
-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
6 files changed, 292 insertions, 104 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
OpenPOWER on IntegriCloud