diff options
author | hm <hm@FreeBSD.org> | 1999-05-20 10:14:57 +0000 |
---|---|---|
committer | hm <hm@FreeBSD.org> | 1999-05-20 10:14:57 +0000 |
commit | 2077acfca034178f39e3fa4e86cb8d371f44737c (patch) | |
tree | 730187a2063473cb0d2e7cac998a9a4307285426 /sys/i4b/driver | |
parent | 5ea75aea8a2633cc0acf9dd870c1e1db1abd6a21 (diff) | |
download | FreeBSD-src-2077acfca034178f39e3fa4e86cb8d371f44737c.zip FreeBSD-src-2077acfca034178f39e3fa4e86cb8d371f44737c.tar.gz |
upgrade isdn4bsd from version 0.71 to the just released version 0.81
Diffstat (limited to 'sys/i4b/driver')
-rw-r--r-- | sys/i4b/driver/i4b_ctl.c | 13 | ||||
-rw-r--r-- | sys/i4b/driver/i4b_ipr.c | 50 | ||||
-rw-r--r-- | sys/i4b/driver/i4b_isppp.c | 48 | ||||
-rw-r--r-- | sys/i4b/driver/i4b_rbch.c | 77 | ||||
-rw-r--r-- | sys/i4b/driver/i4b_tel.c | 903 | ||||
-rw-r--r-- | sys/i4b/driver/i4b_trace.c | 10 |
6 files changed, 776 insertions, 325 deletions
diff --git a/sys/i4b/driver/i4b_ctl.c b/sys/i4b/driver/i4b_ctl.c index 680217e..37a18a9 100644 --- a/sys/i4b/driver/i4b_ctl.c +++ b/sys/i4b/driver/i4b_ctl.c @@ -27,9 +27,9 @@ * i4b_ctl.c - i4b system control port driver * ------------------------------------------ * - * $Id: i4b_ctl.c,v 1.19 1999/02/14 19:51:01 hm Exp $ + * $Id: i4b_ctl.c,v 1.20 1999/04/26 10:16:54 hm Exp $ * - * last edit-date: [Sun Feb 14 10:02:29 1999] + * last edit-date: [Mon Apr 26 11:16:28 1999] * *---------------------------------------------------------------------------*/ @@ -90,7 +90,8 @@ static int openflag = 0; static d_open_t i4bctlopen; static d_close_t i4bctlclose; static d_ioctl_t i4bctlioctl; -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 + +#ifdef OS_USES_POLL static d_poll_t i4bctlpoll; #endif @@ -98,7 +99,7 @@ static d_poll_t i4bctlpoll; static struct cdevsw i4bctl_cdevsw = { i4bctlopen, i4bctlclose, noread, nowrite, i4bctlioctl, nostop, nullreset, nodevtotty, -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 +#ifdef OS_USES_POLL i4bctlpoll, nommap, NULL, "i4bctl", NULL, -1 }; #else noselect, nommap, NULL, "i4bctl", NULL, -1 }; @@ -326,15 +327,17 @@ i4bctlioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) #endif DO_I4B_DEBUG } +#if defined(__FreeBSD__) && defined(OS_USES_POLL) + /*---------------------------------------------------------------------------* * i4bctlpoll - device driver poll routine *---------------------------------------------------------------------------*/ -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 static int i4bctlpoll (dev_t dev, int events, struct proc *p) { return (ENODEV); } + #endif #endif /* NI4BCTL > 0 */ diff --git a/sys/i4b/driver/i4b_ipr.c b/sys/i4b/driver/i4b_ipr.c index 9182a54..a427605 100644 --- a/sys/i4b/driver/i4b_ipr.c +++ b/sys/i4b/driver/i4b_ipr.c @@ -27,9 +27,9 @@ * i4b_ipr.c - isdn4bsd IP over raw HDLC ISDN network driver * --------------------------------------------------------- * - * $Id: i4b_ipr.c,v 1.2 1999/03/07 16:08:13 hm Exp $ + * $Id: i4b_ipr.c,v 1.51 1999/05/06 08:24:45 hm Exp $ * - * last edit-date: [Sun Feb 14 10:02:36 1999] + * last edit-date: [Thu May 6 10:09:20 1999] * *---------------------------------------------------------------------------* * @@ -207,12 +207,22 @@ enum ipr_states { ST_CONNECTED_A, /* connected to remote */ }; +#if defined(__FreeBSD__) || defined(__bsdi__) +#define THE_UNIT sc->sc_if.if_unit +#else +#define THE_UNIT sc->sc_unit +#endif + #ifdef __FreeBSD__ #if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 # define IOCTL_CMD_T u_long #else +#ifdef __NetBSD__ +# define IOCTL_CMD_T u_long +#else # define IOCTL_CMD_T int #endif +#endif PDEVSTATIC void i4biprattach(void *); PSEUDO_SET(i4biprattach, i4b_ipr); static int i4biprioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data); @@ -571,7 +581,12 @@ i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case IPRIOCSMAXCID: { struct proc *p = curproc; /* XXX */ + +#if defined(__FreeBSD_version) && __FreeBSD_version >= 400005 if((error = suser(p)) != 0) +#else + if((error = suser(p->p_ucred, &p->p_acflag)) != 0) +#endif return (error); sl_compress_setup(sc->sc_compr, *(int *)data); } @@ -686,15 +701,14 @@ iprwatchdog(struct ifnet *ifp) * start transmitting after connect *---------------------------------------------------------------------------*/ static void -i4bipr_connect_startio(int unit) +i4bipr_connect_startio(struct ipr_softc *sc) { - struct ipr_softc *sc = &ipr_softc[unit]; int s = SPLI4B(); if(sc->sc_state == ST_CONNECTED_W) { sc->sc_state = ST_CONNECTED_A; - ipr_tx_queue_empty(unit); + ipr_tx_queue_empty(THE_UNIT); } splx(s); @@ -748,7 +762,7 @@ ipr_connect(int unit, void *cdp) if(sc->sc_cdp->isdntxdelay > 0) { - timeout((TIMEOUT_FUNC_T)i4bipr_connect_startio, (void *)unit, sc->sc_cdp->isdntxdelay /* hz*1 */); + timeout((TIMEOUT_FUNC_T)i4bipr_connect_startio, (void *)sc, sc->sc_cdp->isdntxdelay /* hz*1 */); } else { @@ -803,13 +817,19 @@ ipr_disconnect(int unit, void *cdp) * in case of dial problems *---------------------------------------------------------------------------*/ static void -ipr_dialresponse(int unit, int status) +ipr_dialresponse(int unit, int status, cause_t cause) { struct ipr_softc *sc = &ipr_softc[unit]; sc->sc_dialresp = status; DBGL4(L4_IPRDBG, "ipr_dialresponse", ("ipr%d: last=%d, this=%d\n", unit, sc->sc_lastdialresp, sc->sc_dialresp)); + + if(status != DSTAT_NONE) + { + DBGL4(L4_IPRDBG, "ipr_dialresponse", ("ipr%d: clearing queues\n", unit)); + iprclearqueues(sc); + } } /*---------------------------------------------------------------------------* @@ -1076,12 +1096,20 @@ ipr_tx_queue_empty(int unit) } #endif x = 1; - - IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m); - sc->sc_if.if_obytes += m->m_pkthdr.len; + if(IF_QFULL(isdn_linktab[unit]->tx_queue)) + { + DBGL4(L4_IPRDBG, "ipr_rx_data_rdy", ("ipr%d: tx queue full!\n", unit)); + m_freem(m); + } + else + { + IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m); - sc->sc_if.if_opackets++; + sc->sc_if.if_obytes += m->m_pkthdr.len; + + sc->sc_if.if_opackets++; + } } if(x) diff --git a/sys/i4b/driver/i4b_isppp.c b/sys/i4b/driver/i4b_isppp.c index 0ea767f..9dc0eff 100644 --- a/sys/i4b/driver/i4b_isppp.c +++ b/sys/i4b/driver/i4b_isppp.c @@ -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.22 1999/02/14 09:44:55 hm Exp $ + * $Id: i4b_isppp.c,v 1.27 1999/05/03 08:48:25 hm Exp $ * - * last edit-date: [Sun Feb 14 10:02:43 1999] + * last edit-date: [Sun May 2 10:52:57 1999] * *---------------------------------------------------------------------------*/ @@ -63,7 +63,7 @@ #include <net/if_types.h> #include <net/netisr.h> #include <net/route.h> -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) #include <net/if_sppp.h> #else #include <i4b/sppp/if_sppp.h> @@ -83,9 +83,11 @@ #ifdef __FreeBSD__ #include <machine/i4b_ioctl.h> #include <machine/i4b_cause.h> +#include <machine/i4b_debug.h> #else #include <i4b/i4b_ioctl.h> #include <i4b/i4b_cause.h> +#include <i4b/i4b_debug.h> #endif #include <i4b/include/i4b_global.h> @@ -373,11 +375,19 @@ i4bisppp_start(struct ifnet *ifp) microtime(&ifp->if_lastchange); - IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m); + if(IF_QFULL(isdn_linktab[unit]->tx_queue)) + { + DBGL4(L4_ISPDBG, "i4bisppp_start", ("isp%d, tx queue full!\n", unit)); + m_freem(m); + } + else + { + IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m); - sc->sc_if.if_obytes += m->m_pkthdr.len; - sc->sc_outb += m->m_pkthdr.len; - sc->sc_if.if_opackets++; + sc->sc_if.if_obytes += m->m_pkthdr.len; + sc->sc_outb += m->m_pkthdr.len; + sc->sc_if.if_opackets++; + } } isdn_linktab[unit]->bch_tx_start(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel); @@ -553,10 +563,7 @@ i4bisppp_disconnect(int unit, void *cdp) /* new stuff to check that the active channel is being closed */ if (cd != sc->sc_cdp) { -#ifdef I4BISPPPDISCDEBUG - printf("i4bisppp_disconnect: isppp%d channel%d not active\n", - cd->driver_unit, cd->channelid); -#endif + DBGL4(L4_ISPDBG, "i4bisppp_disconnect", ("isp%d, channel%d not active!\n", unit, cd->channelid)); splx(s); return; } @@ -587,9 +594,24 @@ i4bisppp_disconnect(int unit, void *cdp) * in case of dial problems *---------------------------------------------------------------------------*/ static void -i4bisppp_dialresponse(int unit, int status) +i4bisppp_dialresponse(int unit, int status, cause_t cause) { -/* struct i4bisppp_softc *sc = &i4bisppp_softc[unit]; */ + struct i4bisppp_softc *sc = &i4bisppp_softc[unit]; + + DBGL4(L4_ISPDBG, "i4bisppp_dialresponse", ("isp%d: status=%d, cause=%d\n", unit, status, cause)); + + if(status != DSTAT_NONE) + { + struct mbuf *m; + + DBGL4(L4_ISPDBG, "i4bisppp_dialresponse", ("isp%d: clearing queues\n", unit)); + + if(!(sppp_isempty(&sc->sc_if))) + { + while((m = sppp_dequeue(&sc->sc_if)) != NULL) + m_freem(m); + } + } } /*---------------------------------------------------------------------------* diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c index 02f91fb..42a9f0c 100644 --- a/sys/i4b/driver/i4b_rbch.c +++ b/sys/i4b/driver/i4b_rbch.c @@ -27,9 +27,9 @@ * i4b_rbch.c - device driver for raw B channel data * --------------------------------------------------- * - * $Id: i4b_rbch.c,v 1.25 1999/02/14 19:51:01 hm Exp $ + * $Id: i4b_rbch.c,v 1.31 1999/05/06 13:07:59 hm Exp $ * - * last edit-date: [Sun Feb 14 10:02:49 1999] + * last edit-date: [Thu May 6 13:40:22 1999] * *---------------------------------------------------------------------------*/ @@ -40,18 +40,6 @@ #include <sys/param.h> #include <sys/systm.h> -#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) || (!defined(__FreeBSD__) && !defined(__bsdi__)) -#include <sys/ioccom.h> -#include <sys/poll.h> -#else -#include <sys/fcntl.h> -#include <sys/ioctl.h> -#endif - -#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) -#include <sys/filio.h> -#endif - #include <sys/conf.h> #include <sys/uio.h> #include <sys/kernel.h> @@ -100,6 +88,19 @@ extern cc_t ttydefchars; int bootverbose = 0; #endif +#ifdef OS_USES_POLL +#include <sys/ioccom.h> +#include <sys/poll.h> +#else +#include <sys/fcntl.h> +#include <sys/ioctl.h> +#endif + +#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) +#include <sys/filio.h> +#endif + + static drvr_link_t rbch_drvr_linktab[NI4BRBCH]; static isdn_link_t *isdn_linktab[NI4BRBCH]; @@ -143,7 +144,12 @@ int i4brbchclose __P((dev_t dev, int flag, int fmt, struct proc *p)); int i4brbchread __P((dev_t dev, struct uio *uio, int ioflag)); int i4brbchwrite __P((dev_t dev, struct uio *uio, int ioflag)); int i4brbchioctl __P((dev_t dev, IOCTL_CMD_T cmd, caddr_t arg, int flag, struct proc* pr)); +#ifdef OS_USES_POLL int i4brbchpoll __P((dev_t dev, int events, struct proc *p)); +#else +/* XXX fix "static" to PDEVSTATIC */ +static int i4brbchselect __P((dev_t dev, int rw, struct proc *p)); +#endif #endif #if BSD > 199306 && defined(__FreeBSD__) @@ -160,7 +166,7 @@ PDEVSTATIC d_read_t i4brbchread; PDEVSTATIC d_read_t i4brbchwrite; PDEVSTATIC d_ioctl_t i4brbchioctl; -#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) || !defined(__FreeBSD__) +#ifdef OS_USES_POLL PDEVSTATIC d_poll_t i4brbchpoll; #else PDEVSTATIC d_select_t i4brbchselect; @@ -170,7 +176,7 @@ PDEVSTATIC d_select_t i4brbchselect; static struct cdevsw i4brbch_cdevsw = { i4brbchopen, i4brbchclose, i4brbchread, i4brbchwrite, i4brbchioctl, nostop, noreset, nodevtotty, -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 +#ifdef OS_USES_POLL i4brbchpoll, nommap, NULL, "i4brbch", NULL, -1 #else i4brbchselect, nommap, NULL, "i4brbch", NULL, -1 @@ -486,7 +492,14 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag) error = uiomove(m->m_data, m->m_len, uio); - IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m); + if(IF_QFULL(isdn_linktab[unit]->tx_queue)) + { + m_freem(m); + } + else + { + IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m); + } (*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel); } @@ -556,11 +569,11 @@ if(bootverbose)printf("EE-rbch%d: attempting dialout (DTR)\n", unit); return(error); } +#ifdef OS_USES_POLL + /*---------------------------------------------------------------------------* * device driver poll *---------------------------------------------------------------------------*/ -#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) || (!defined(__FreeBSD__) && !defined(__bsdi__)) - PDEVSTATIC int i4brbchpoll(dev_t dev, int events, struct proc *p) { @@ -570,9 +583,6 @@ i4brbchpoll(dev_t dev, int events, struct proc *p) /* We can't check for anything but IN or OUT */ - if((events & (POLLIN|POLLOUT)) == 0) - return(POLLNVAL); - s = splhigh(); if(!(rbch_softc[unit].sc_devstate & ST_ISOPEN)) @@ -586,16 +596,16 @@ i4brbchpoll(dev_t dev, int events, struct proc *p) * transmit queue can take them */ - if((events & POLLOUT) && + if((events & (POLLOUT|POLLWRNORM)) && (rbch_softc[unit].sc_devstate & ST_CONNECTED) && !IF_QFULL(isdn_linktab[unit]->tx_queue)) { - revents |= POLLOUT; + revents |= (events & (POLLOUT|POLLWRNORM)); } /* ... while reads are OK if we have any data */ - if((events & POLLIN) && + if((events & (POLLIN|POLLRDNORM)) && (rbch_softc[unit].sc_devstate & ST_CONNECTED)) { struct ifqueue *iqp; @@ -606,7 +616,7 @@ i4brbchpoll(dev_t dev, int events, struct proc *p) iqp = isdn_linktab[unit]->rx_queue; if(!IF_QEMPTY(iqp)) - revents |= POLLIN; + revents |= (events & (POLLIN|POLLRDNORM)); } if(revents == 0) @@ -616,11 +626,12 @@ i4brbchpoll(dev_t dev, int events, struct proc *p) return(revents); } -#else +#else /* OS_USES_POLL */ /*---------------------------------------------------------------------------* * device driver select *---------------------------------------------------------------------------*/ +/* XXX fix "static" to PDEVSTATIC */ static int i4brbchselect(dev_t dev, int rw, struct proc *p) { @@ -649,23 +660,31 @@ i4brbchselect(dev_t dev, int rw, struct proc *p) iqp = isdn_linktab[unit]->rx_queue; if(!IF_QEMPTY(iqp)) + { + splx(s); return(1); + } break; case FWRITE: if(!IF_QFULL(isdn_linktab[unit]->rx_queue)) + { + splx(s); return(1); + } break; default: + splx(s); return 0; } } selrecord(p, &rbch_softc[unit].selp); + splx(s); return(0); } -#endif /* defined(__FreeBSD_version) && __FreeBSD_version >= 300001 */ +#endif /* OS_USES_POLL */ /*===========================================================================* * ISDN INTERFACE ROUTINES @@ -707,7 +726,7 @@ rbch_disconnect(int unit, void *cdp) * feedback from daemon in case of dial problems *---------------------------------------------------------------------------*/ static void -rbch_dialresponse(int unit, int status) +rbch_dialresponse(int unit, int status, cause_t cause) { } diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c index f7cfd5f..a548338 100644 --- a/sys/i4b/driver/i4b_tel.c +++ b/sys/i4b/driver/i4b_tel.c @@ -27,9 +27,9 @@ * i4b_tel.c - device driver for ISDN telephony * -------------------------------------------- * - * $Id: i4b_tel.c,v 1.22 1999/02/16 10:40:18 hm Exp $ + * $Id: i4b_tel.c,v 1.40 1999/05/06 08:24:45 hm Exp $ * - * last edit-date: [Tue Feb 16 11:30:35 1999] + * last edit-date: [Thu May 6 09:30:13 1999] * *---------------------------------------------------------------------------*/ @@ -42,10 +42,12 @@ #include <sys/param.h> #include <sys/systm.h> -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 +#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 || defined(__NetBSD__) #include <sys/ioccom.h> +#include <sys/poll.h> #else #include <sys/ioctl.h> +#include <sys/fcntl.h> #endif #include <sys/conf.h> @@ -65,37 +67,76 @@ #include <sys/devfsext.h> #endif +#ifdef __bsdi__ +#include <sys/device.h> +#endif + #ifdef __FreeBSD__ #include <machine/i4b_ioctl.h> #include <machine/i4b_tel_ioctl.h> +#include <machine/i4b_debug.h> #else #include <i4b/i4b_ioctl.h> #include <i4b/i4b_tel_ioctl.h> +#include <i4b/i4b_debug.h> #endif #include <i4b/include/i4b_global.h> #include <i4b/include/i4b_mbuf.h> #include <i4b/include/i4b_l3l4.h> +#include <i4b/layer4/i4b_l4.h> + +/* minor number: lower 6 bits = unit number */ + +#include <i4b/layer4/i4b_l4.h> + +#define UNITBITS 6 +#define UNITMASK 0x3f +#define UNIT(n) (minor(n) & UNITMASK) + +/* minor number: upper 2 bits = function number */ + +#define FUNCMASK 0x03 +#define FUNC(n) (((minor(n)) >> UNITBITS) & FUNCMASK) + +#define FUNCTEL 0 /* 0 = normal i4btel device */ +#define FUNCDIAL 1 /* 1 = i4bteld dialout device */ + +#define NOFUNCS 2 /* number of device classes */ + typedef struct { - drvr_link_t drvr_linktab; /* driver linktab */ - isdn_link_t *isdn_linktab; /* isdn linktab */ + + /* used only in func = FUNCTEL */ + + drvr_link_t drvr_linktab; /* driver linktab */ + isdn_link_t *isdn_linktab; /* isdn linktab */ + 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 */ + + /* used only in func = FUNCDIAL */ + + char result; /* result code for dial dev */ + + /* used in func = FUNCDIAL and func = FUNCTEL*/ + int devstate; /* state of this unit */ #define ST_IDLE 0x00 /* idle */ #define ST_CONNECTED 0x01 /* isdn connected state */ #define ST_ISOPEN 0x02 /* userland opened */ #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 */ + + struct selinfo selp; /* select / poll */ + #ifdef DEVFS void *devfs_token; /* token for DEVFS */ #endif } tel_sc_t; -static tel_sc_t tel_sc[NI4BTEL]; +static tel_sc_t tel_sc[NI4BTEL][NOFUNCS]; /* forward decl */ @@ -106,48 +147,62 @@ 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 a2u_tab[]; +static unsigned char u2a_tab[]; 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)); int i4btelwrite __P((dev_t dev, struct uio * uio, int ioflag)); + +#ifdef OS_USES_POLL +int i4btelpoll __P((dev_t dev, int events, struct proc *p)); +#else +int i4btelsel __P((dev_t dev, int rw, struct proc *p)); #endif + +#endif /* __FreeBSD__ */ + + #if BSD > 199306 && defined(__FreeBSD__) + #define PDEVSTATIC static PDEVSTATIC d_open_t i4btelopen; PDEVSTATIC d_close_t i4btelclose; PDEVSTATIC d_read_t i4btelread; PDEVSTATIC d_read_t i4btelwrite; PDEVSTATIC d_ioctl_t i4btelioctl; -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 +#ifdef OS_USES_POLL PDEVSTATIC d_poll_t i4btelpoll; +#else +PDEVSTATIC d_select_t i4btelsel; #endif #define CDEV_MAJOR 56 static struct cdevsw i4btel_cdevsw = { i4btelopen, i4btelclose, i4btelread, i4btelwrite, i4btelioctl, nostop, noreset, nodevtotty, -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 +#ifdef OS_USES_POLL i4btelpoll, nommap, NULL, "i4btel", NULL, -1 #else - noselect, nommap, NULL, "i4btel", NULL, -1 + i4btelsel, nommap, NULL, "i4btel", NULL, -1 #endif }; PDEVSTATIC void i4btelinit(void *unused); - PDEVSTATIC void i4btelattach(void *); + PSEUDO_SET(i4btelattach, i4b_tel); /*===========================================================================* @@ -173,7 +228,8 @@ SYSINIT(i4bteldev, SI_SUB_DRIVERS, #endif /* BSD > 199306 && defined(__FreeBSD__) */ #ifdef __bsdi__ -#include <sys/device.h> + +int i4btelsel(dev_t dev, int rw, struct proc *p); int i4btelmatch(struct device *parent, struct cfdata *cf, void *aux); void dummy_i4btelattach(struct device*, struct device *, void *); @@ -185,21 +241,23 @@ static struct cfdriver i4btelcd = struct devsw i4btelsw = { &i4btelcd, i4btelopen, i4btelclose, i4btelread, i4btelwrite, - i4btelioctl, seltrue, nommap, nostrat, + i4btelioctl, i4btelsel, nommap, nostrat, nodump, nopsize, 0, nostop }; int i4btelmatch(struct device *parent, struct cfdata *cf, void *aux) { - printf("i4btelmatch: aux=0x%x\n", aux); + DBGL4(L4_TELDBG, "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); + DBGL4(L4_TELDBG, "dummy_i4btelattach", ("aux=0x%x\n", aux)); } + #endif /* __bsdi__ */ /*---------------------------------------------------------------------------* @@ -212,7 +270,7 @@ i4btelattach(void *dummy) i4btelattach() #endif { - int i; + int i, j; #ifndef HACK_NO_PSEUDO_ATTACH_MSG printf("i4btel: %d ISDN telephony interface device(s) attached\n", NI4BTEL); @@ -220,17 +278,22 @@ i4btelattach() for(i=0; i < NI4BTEL; i++) { - 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); + for(j=0; j < NOFUNCS; j++) + { + tel_sc[i][j].devstate = ST_IDLE; + tel_sc[i][j].audiofmt = CVT_NONE; + tel_sc[i][j].rcvttab = 0; + tel_sc[i][j].wcvttab = 0; + tel_sc[i][j].result = 0; + tel_init_linktab(i); #ifdef DEVFS - tel_sc[i].devfs_token - = devfs_add_devswf(&i4btel_cdevsw, i, DV_CHR, + +/* XXX */ tel_sc[i][j].devfs_token + = devfs_add_devswf(&i4btel_cdevsw, i, DV_CHR, UID_ROOT, GID_WHEEL, 0600, "i4btel%d", i); #endif + } } } @@ -240,19 +303,26 @@ i4btelattach() PDEVSTATIC int i4btelopen(dev_t dev, int flag, int fmt, struct proc *p) { - int unit = minor(dev); + int unit = UNIT(dev); + int func = FUNC(dev); + tel_sc_t *sc; if(unit > NI4BTEL) return(ENXIO); - sc = &tel_sc[unit]; + sc = &tel_sc[unit][func]; if(sc->devstate & ST_ISOPEN) return(EBUSY); sc->devstate |= ST_ISOPEN; + if(func == FUNCDIAL) + { + sc->result = 0; + } + return(0); } @@ -262,16 +332,18 @@ i4btelopen(dev_t dev, int flag, int fmt, struct proc *p) PDEVSTATIC int i4btelclose(dev_t dev, int flag, int fmt, struct proc *p) { - int unit = minor(dev); + int unit = UNIT(dev); + int func = FUNC(dev); tel_sc_t *sc; int error = 0; if(unit > NI4BTEL) return(ENXIO); - sc = &tel_sc[unit]; + sc = &tel_sc[unit][func]; - if(sc->isdn_linktab != NULL && sc->isdn_linktab->tx_queue != NULL) + if((func == FUNCTEL) && + (sc->isdn_linktab != NULL && sc->isdn_linktab->tx_queue != NULL)) { while(!(IF_QEMPTY(sc->isdn_linktab->tx_queue))) { @@ -285,7 +357,9 @@ i4btelclose(dev_t dev, int flag, int fmt, struct proc *p) } sc->devstate &= ~ST_WRWAITEMPTY; } + sc->devstate &= ~ST_ISOPEN; + return(error); } @@ -301,57 +375,76 @@ i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) i4btelioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) #endif { + int unit = UNIT(dev); + int func = FUNC(dev); int error = 0; struct mbuf *m; int s; - tel_sc_t *sc = &tel_sc[minor(dev)]; - switch(cmd) - { - case I4B_TEL_GETAUDIOFMT: - *(int *)data = sc->audiofmt; - break; - - case I4B_TEL_SETAUDIOFMT: - 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: - s = splimp(); - while((sc->devstate & ST_CONNECTED) && - (sc->devstate & ST_ISOPEN) && - !IF_QEMPTY(sc->isdn_linktab->rx_queue)) - { - IF_DEQUEUE(sc->isdn_linktab->rx_queue, m); - if(m) - i4b_Bfreembuf(m); - } - splx(s); - break; + tel_sc_t *sc = &tel_sc[unit][func]; - default: - error = ENOTTY; - break; + if(func == FUNCTEL) + { + switch(cmd) + { + case I4B_TEL_GETAUDIOFMT: + *(int *)data = sc->audiofmt; + break; + + case I4B_TEL_SETAUDIOFMT: + switch (*(int *)data) + { + case CVT_NONE: + sc->rcvttab = 0; + sc->wcvttab = 0; + break; + case CVT_ALAW2ULAW: + /* ISDN: a-law */ + /* user: u-law */ + sc->rcvttab = a2u_tab; + sc->wcvttab = u2a_tab; + break; + case CVT_ULAW2ALAW: + /* ISDN: u-law */ + /* user: a-law */ + sc->rcvttab = u2a_tab; + sc->wcvttab = a2u_tab; + break; + default: + error = ENODEV; + break; + } + if(error == 0) + sc->audiofmt = *(int *)data; + break; + + case I4B_TEL_EMPTYINPUTQUEUE: + s = splimp(); + while((sc->devstate & ST_CONNECTED) && + (sc->devstate & ST_ISOPEN) && + !IF_QEMPTY(sc->isdn_linktab->rx_queue)) + { + IF_DEQUEUE(sc->isdn_linktab->rx_queue, m); + if(m) + i4b_Bfreembuf(m); + } + splx(s); + break; + + default: + error = ENOTTY; + break; + } } + else if(func == FUNCDIAL) + { + switch(cmd) + { + default: + error = ENOTTY; + break; + } + } return(error); } @@ -361,187 +454,380 @@ i4btelioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p) PDEVSTATIC int i4btelread(dev_t dev, struct uio *uio, int ioflag) { + int unit = UNIT(dev); + int func = FUNC(dev); + struct mbuf *m; int s; 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 + tel_sc_t *sc = &tel_sc[unit][func]; + if(!(sc->devstate & ST_ISOPEN)) return(EIO); -#ifdef NOTDEF - while(!(sc->devstate & ST_CONNECTED)) + if(func == FUNCTEL) { - if((error = tsleep((caddr_t) &sc->devstate, - TTIPRI | PCATCH, - "rrtel", 0 )) != 0) + while(IF_QEMPTY(sc->isdn_linktab->rx_queue) && + (sc->devstate & ST_ISOPEN) && + (sc->devstate & ST_CONNECTED)) { - return(error); + sc->devstate |= ST_RDWAITDATA; + + DBGL4(L4_TELDBG, "i4btelread", ("i4btel%d, queue empty!\n", unit)); + + if((error = tsleep((caddr_t) &sc->isdn_linktab->rx_queue, + TTIPRI | PCATCH, + "rtel", 0 )) != 0) + { + sc->devstate &= ~ST_RDWAITDATA; + return(error); + } } - } -#endif + + if(!(sc->devstate & ST_ISOPEN)) + { + return(EIO); + } + + if(!(sc->devstate & ST_CONNECTED)) + { + return(EIO); + } + + s = splimp(); + + IF_DEQUEUE(sc->isdn_linktab->rx_queue, m); + + if(m && m->m_len > 0) + { + register int i; + + for(i = 0; i < m->m_len; i++) + { + /* always reverse bit order from line */ + mtod(m,u_char *)[i] = bitreverse[mtod(m,u_char *)[i]]; + + /* convert if necessary */ + if(sc->rcvttab) + mtod(m,u_char *)[i] = sc->rcvttab[mtod(m,u_char *)[i]]; + } + error = uiomove(m->m_data, m->m_len, uio); - while(IF_QEMPTY(sc->isdn_linktab->rx_queue) && - (sc->devstate & ST_ISOPEN) && - (sc->devstate & ST_CONNECTED)) + DBGL4(L4_TELDBG, "i4btelread", ("i4btel%d, mbuf (%d bytes), uiomove %d!\n", unit, m->m_len, error)); + } + else + { + DBGL4(L4_TELDBG, "i4btelread", ("i4btel%d, empty mbuf from queue!\n", unit)); + error = EIO; + } + + if(m) + i4b_Bfreembuf(m); + + splx(s); + } + else if(func == FUNCDIAL) { - sc->devstate |= ST_RDWAITDATA; + while((sc->result == 0) && (sc->devstate & ST_ISOPEN)) + { + sc->devstate |= ST_RDWAITDATA; + + if((error = tsleep((caddr_t) &sc->result, + TTIPRI | PCATCH, + "rtel1", 0 )) != 0) + { + sc->devstate &= ~ST_RDWAITDATA; + return(error); + } + } + + if(!(sc->devstate & ST_ISOPEN)) + { + return(EIO); + } + + s = splimp(); - if((error = tsleep((caddr_t) &sc->isdn_linktab->rx_queue, - TTIPRI | PCATCH, - "rtel", 0 )) != 0) + if(sc->result != 0) { - sc->devstate &= ~ST_RDWAITDATA; - return(error); + error = uiomove(&sc->result, 1, uio); + sc->result = 0; } + else + { + error = EIO; + } + + splx(s); } + return(error); +} +/*---------------------------------------------------------------------------* + * write to tel device + *---------------------------------------------------------------------------*/ +PDEVSTATIC int +i4btelwrite(dev_t dev, struct uio * uio, int ioflag) +{ + int unit = UNIT(dev); + int func = FUNC(dev); + struct mbuf *m; + int s; + int error = 0; + tel_sc_t *sc = &tel_sc[unit][func]; + if(!(sc->devstate & ST_ISOPEN)) { return(EIO); } - if(!(sc->devstate & ST_CONNECTED)) + if(func == FUNCTEL) { - return(EIO); - } + if(!(sc->devstate & ST_CONNECTED)) + return(EIO); + + while((IF_QFULL(sc->isdn_linktab->tx_queue)) && + (sc->devstate & ST_ISOPEN)) + { + sc->devstate |= ST_WRWAITEMPTY; + + if((error = tsleep((caddr_t) &sc->isdn_linktab->tx_queue, + TTIPRI | PCATCH, "wtel", 0)) != 0) + { + sc->devstate &= ~ST_WRWAITEMPTY; + return(error); + } + } - s = splimp(); + if(!(sc->devstate & ST_ISOPEN)) + { + return(EIO); + } + + if(!(sc->devstate & ST_CONNECTED)) + { + return(EIO); + } - IF_DEQUEUE(sc->isdn_linktab->rx_queue, m); + s = splimp(); + + if((m = i4b_Bgetmbuf(BCH_MAX_DATALEN)) != NULL) + { + register int i; + + m->m_len = min(BCH_MAX_DATALEN, uio->uio_resid); + + error = uiomove(m->m_data, m->m_len, uio); + + for(i = 0; i < m->m_len; i++) + { + /* convert if necessary */ + if(sc->wcvttab) + mtod(m,u_char *)[i] = sc->wcvttab[mtod(m,u_char *)[i]]; - if(m && m->m_len > 0) + /* always reverse bitorder to line */ + mtod(m,u_char *)[i] = bitreverse[mtod(m,u_char *)[i]]; + } + + if(IF_QFULL(sc->isdn_linktab->tx_queue)) + { + m_freem(m); + } + else + { + IF_ENQUEUE(sc->isdn_linktab->tx_queue, m); + } + + (*sc->isdn_linktab->bch_tx_start)(sc->isdn_linktab->unit, sc->isdn_linktab->channel); + } + + splx(s); + } + else if(func == FUNCDIAL) { - if(sc->rcvttab) +#define CMDBUFSIZ 80 + char cmdbuf[CMDBUFSIZ]; + int len = min(CMDBUFSIZ-1, uio->uio_resid); + + error = uiomove(cmdbuf, len, uio); + + if(cmdbuf[0] == CMD_DIAL) { - int i; - for(i = 0; i < m->m_len; i++) - mtod(m,u_char *)[i] = sc->rcvttab[mtod(m,u_char *)[i]]; - } - error = uiomove(m->m_data, m->m_len, uio); + i4b_l4_dialoutnumber(BDRV_TEL, unit, len-1, &cmdbuf[1]); + } + else if(cmdbuf[0] == CMD_HUP) + { + i4b_l4_drvrdisc(BDRV_TEL, unit); + } } else { error = EIO; - } - - if(m) - i4b_Bfreembuf(m); - - splx(s); - + } + return(error); } +#ifdef OS_USES_POLL /*---------------------------------------------------------------------------* - * write to tel device + * device driver poll *---------------------------------------------------------------------------*/ PDEVSTATIC int -i4btelwrite(dev_t dev, struct uio * uio, int ioflag) +i4btelpoll(dev_t dev, int events, struct proc *p) { - struct mbuf *m; + int revents = 0; /* Events we found */ int s; - int error = 0; - tel_sc_t *sc = &tel_sc[minor(dev)]; + int unit = UNIT(dev); + int func = FUNC(dev); + + tel_sc_t *sc = &tel_sc[unit][func]; - if(!(sc->devstate & ST_CONNECTED)) - return(EIO); + s = splhigh(); if(!(sc->devstate & ST_ISOPEN)) { - return(EIO); + DBGL4(L4_TELDBG, "i4btelpoll", ("i4btel%d, !ST_ISOPEN\n", unit)); + splx(s); + return(0); } -#ifdef NOTDEF - while(!(sc->devstate & ST_CONNECTED)) + if(func == FUNCTEL) { - if((error = tsleep((caddr_t) &sc->devstate, - TTIPRI | PCATCH, - "wrtel", 0 )) != 0) - { - return(error); - } - /* - * XXX the originations B channel gets much earlier - * switched thru than the destinations B channel, so - * if the origination starts to send at once, some - * 200 bytes (at my site) or so get lost, so i delay - * a bit before sending. (-hm) + * Writes are OK if we are connected and the + * transmit queue can take them */ + + if((events & (POLLOUT|POLLWRNORM)) && + (sc->devstate & ST_CONNECTED) && + (sc->isdn_linktab != NULL) && + (!IF_QFULL(sc->isdn_linktab->tx_queue))) + { + DBGL4(L4_TELDBG, "i4btelpoll", ("i4btel%d, POLLOUT\n", unit)); + revents |= (events & (POLLOUT|POLLWRNORM)); + } - tsleep((caddr_t) &sc->devstate, TTIPRI | PCATCH, "xtel", (hz*1)); + /* ... while reads are OK if we have any data */ + + if((events & (POLLIN|POLLRDNORM)) && + (sc->devstate & ST_CONNECTED) && + (sc->isdn_linktab != NULL) && + (!IF_QEMPTY(sc->isdn_linktab->rx_queue))) + { + DBGL4(L4_TELDBG, "i4btelpoll", ("i4btel%d, POLLIN\n", unit)); + revents |= (events & (POLLIN|POLLRDNORM)); + } + + if(revents == 0) + { + DBGL4(L4_TELDBG, "i4btelpoll", ("i4btel%d, selrecord\n", unit)); + selrecord(p, &sc->selp); + } } -#endif - - while((IF_QFULL(sc->isdn_linktab->tx_queue)) && - (sc->devstate & ST_ISOPEN)) + else if(func == FUNCDIAL) { - sc->devstate |= ST_WRWAITEMPTY; + if(events & (POLLOUT|POLLWRNORM)) + { + DBGL4(L4_TELDBG, "i4btelpoll", ("i4bteld%d, POLLOUT\n", unit)); + revents |= (events & (POLLOUT|POLLWRNORM)); + } - if((error = tsleep((caddr_t) &sc->isdn_linktab->tx_queue, - TTIPRI | PCATCH, "wtel", 0)) != 0) + if(events & (POLLIN|POLLRDNORM)) + { + DBGL4(L4_TELDBG, "i4btelpoll", ("i4bteld%d, POLLIN, result = %d\n", unit, sc->result)); + if(sc->result != 0) + revents |= (events & (POLLIN|POLLRDNORM)); + } + + if(revents == 0) { - sc->devstate &= ~ST_WRWAITEMPTY; - return(error); + DBGL4(L4_TELDBG, "i4btelpoll", ("i4bteld%d, selrecord\n", unit)); + selrecord(p, &sc->selp); } } + splx(s); + return(revents); +} - if(!(sc->devstate & ST_ISOPEN)) - { - return(EIO); - } +#else /* OS_USES_POLL */ - if(!(sc->devstate & ST_CONNECTED)) - { - return(EIO); - } +/*---------------------------------------------------------------------------* + * device driver select + *---------------------------------------------------------------------------*/ +PDEVSTATIC int +i4btelsel(dev_t dev, int rw, struct proc *p) +{ + int s; + int unit = UNIT(dev); + int func = FUNC(dev); - s = splimp(); + tel_sc_t *sc = &tel_sc[unit][func]; + + s = splhigh(); - if((m = i4b_Bgetmbuf(BCH_MAX_DATALEN)) != NULL) + if (!(sc->devstate & ST_ISOPEN)) { - m->m_len = min(BCH_MAX_DATALEN, uio->uio_resid); + DBGL4(L4_TELDBG, "i4btelsel", ("i4btel%d, !ST_ISOPEN\n", unit)); + splx(s); + return(0); + } - error = uiomove(m->m_data, m->m_len, uio); + if (func == FUNCTEL) + { + /* Don't even bother if we're not connected */ + if (!(sc->devstate & ST_CONNECTED) || sc->isdn_linktab == NULL) + { + splx(s); + return 0; + } - if(sc->wcvttab) + if (rw == FREAD) { - int i; - for(i = 0; i < m->m_len; i++) - mtod(m,u_char *)[i] = sc->wcvttab[mtod(m,u_char *)[i]]; - } - - IF_ENQUEUE(sc->isdn_linktab->tx_queue, m); + if (!IF_QEMPTY(sc->isdn_linktab->rx_queue)) + { + DBGL4(L4_TELDBG, "i4btelsel", ("i4btel%d, FREAD\n", unit)); + splx(s); + return 1; + } + } + else if (rw == FWRITE) + { + if (!IF_QFULL(sc->isdn_linktab->tx_queue)) + { + DBGL4(L4_TELDBG, "i4btelsel", ("i4btel%d, FWRITE\n", unit)); + splx(s); + return 1; + } + } + } + else if (func == FUNCDIAL) + { + if (rw == FWRITE) + { + DBGL4(L4_TELDBG, "i4btelsel", ("i4bteld%d, FWRITE\n", unit)); + splx(s); + return 1; + } - (*sc->isdn_linktab->bch_tx_start)(sc->isdn_linktab->unit, sc->isdn_linktab->channel); + if (rw == FREAD) + { + DBGL4(L4_TELDBG, "i4btelsel", ("i4bteld%d, FREAD, result = %d\n", unit, sc->result)); + if (sc->result != 0) + { + splx(s); + return 1; + } + } } + DBGL4(L4_TELDBG, "i4btelsel", ("i4bteld%d, selrecord\n", unit)); + selrecord(p, &sc->selp); splx(s); - - return(error); + return 0; } -/*---------------------------------------------------------------------------* - * poll - *---------------------------------------------------------------------------*/ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 -PDEVSTATIC int -i4btelpoll (dev_t dev, int events, struct proc *p) -{ - return (ENODEV); -} -#endif +#endif /* OS_USES_POLL */ /*===========================================================================* * ISDN INTERFACE ROUTINES @@ -553,19 +839,29 @@ i4btelpoll (dev_t dev, int events, struct proc *p) static void tel_connect(int unit, void *cdp) { - tel_sc_t *sc = &tel_sc[unit]; + tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; + /* audio device */ + sc->cdp = (call_desc_t *)cdp; -#ifdef NOTDEF - if(!(sc->devstate & ST_CONNECTED)) + sc->devstate |= ST_CONNECTED; + + /* dialer device */ + + sc = &tel_sc[unit][FUNCDIAL]; + + if(sc->devstate == ST_ISOPEN) { - sc->devstate |= ST_CONNECTED; - wakeup((caddr_t) &sc->devstate); + sc->result = RSP_CONN; + + if(sc->devstate & ST_RDWAITDATA) + { + sc->devstate &= ~ST_RDWAITDATA; + wakeup((caddr_t) &sc->result); + } + selwakeup(&sc->selp); } -#else - sc->devstate |= ST_CONNECTED; -#endif } /*---------------------------------------------------------------------------* @@ -576,8 +872,10 @@ tel_disconnect(int unit, void *cdp) { /* call_desc_t *cd = (call_desc_t *)cdp; */ - tel_sc_t *sc = &tel_sc[unit]; - + tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; + + /* audio device */ + sc->devstate &= ~ST_CONNECTED; if(sc->devstate & ST_RDWAITDATA) @@ -591,14 +889,45 @@ tel_disconnect(int unit, void *cdp) sc->devstate &= ~ST_WRWAITEMPTY; wakeup((caddr_t) &sc->isdn_linktab->tx_queue); } + + /* dialer device */ + + sc = &tel_sc[unit][FUNCDIAL]; + + if(sc->devstate == ST_ISOPEN) + { + sc->result = RSP_HUP; + + if(sc->devstate & ST_RDWAITDATA) + { + sc->devstate &= ~ST_RDWAITDATA; + wakeup((caddr_t) &sc->result); + } + selwakeup(&sc->selp); + } } /*---------------------------------------------------------------------------* * feedback from daemon in case of dial problems *---------------------------------------------------------------------------*/ static void -tel_dialresponse(int unit, int status) -{ +tel_dialresponse(int unit, int status, cause_t cause) +{ + tel_sc_t *sc = &tel_sc[unit][FUNCDIAL]; + + DBGL4(L4_TELDBG, "tel_dialresponse", ("i4btel%d, status=%d, cause=0x%4x\n", unit, status, cause)); + + if((sc->devstate == ST_ISOPEN) && status) + { + sc->result = RSP_NOA; + + if(sc->devstate & ST_RDWAITDATA) + { + sc->devstate &= ~ST_RDWAITDATA; + wakeup((caddr_t) &sc->result); + } + selwakeup(&sc->selp); + } } /*---------------------------------------------------------------------------* @@ -617,13 +946,14 @@ tel_updown(int unit, int updown) static void tel_rx_data_rdy(int unit) { - tel_sc_t *sc = &tel_sc[unit]; + tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; if(sc->devstate & ST_RDWAITDATA) { sc->devstate &= ~ST_RDWAITDATA; wakeup((caddr_t) &sc->isdn_linktab->rx_queue); } + selwakeup(&sc->selp); } /*---------------------------------------------------------------------------* @@ -634,13 +964,14 @@ tel_rx_data_rdy(int unit) static void tel_tx_queue_empty(int unit) { - tel_sc_t *sc = &tel_sc[unit]; + tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; if(sc->devstate & ST_WRWAITEMPTY) { sc->devstate &= ~ST_WRWAITEMPTY; wakeup((caddr_t) &sc->isdn_linktab->tx_queue); } + selwakeup(&sc->selp); } /*---------------------------------------------------------------------------* @@ -650,7 +981,8 @@ tel_tx_queue_empty(int unit) static void tel_activity(int unit, int rxtx) { - tel_sc[unit].cdp->last_active_time = SECOND; + if(tel_sc[unit][FUNCTEL].cdp) + tel_sc[unit][FUNCTEL].cdp->last_active_time = SECOND; } /*---------------------------------------------------------------------------* @@ -659,7 +991,7 @@ tel_activity(int unit, int rxtx) drvr_link_t * tel_ret_linktab(int unit) { - tel_sc_t *sc = &tel_sc[unit]; + tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; tel_init_linktab(unit); return(&sc->drvr_linktab); @@ -671,7 +1003,7 @@ tel_ret_linktab(int unit) void tel_set_linktab(int unit, isdn_link_t *ilt) { - tel_sc_t *sc = &tel_sc[unit]; + tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; sc->isdn_linktab = ilt; } @@ -681,7 +1013,7 @@ tel_set_linktab(int unit, isdn_link_t *ilt) static void tel_init_linktab(int unit) { - tel_sc_t *sc = &tel_sc[unit]; + tel_sc_t *sc = &tel_sc[unit][FUNCTEL]; sc->drvr_linktab.unit = unit; sc->drvr_linktab.bch_rx_data_ready = tel_rx_data_rdy; @@ -694,74 +1026,121 @@ tel_init_linktab(int unit) } /*===========================================================================* - * AUDIO FORMAT CONVERSION + * AUDIO FORMAT CONVERSION (produced by running g711conv) *===========================================================================*/ /*---------------------------------------------------------------------------* - * Line format to mu-law conversion + * A-law to u-law conversion *---------------------------------------------------------------------------*/ -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 +static unsigned char a2u_tab[256] = { +/* 00 */ 0x2a, 0x2b, 0x28, 0x29, 0x2e, 0x2f, 0x2c, 0x2d, +/* 08 */ 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25, +/* 10 */ 0x39, 0x3a, 0x37, 0x38, 0x3d, 0x3e, 0x3b, 0x3c, +/* 18 */ 0x31, 0x32, 0x30, 0x30, 0x35, 0x36, 0x33, 0x34, +/* 20 */ 0x0a, 0x0b, 0x08, 0x09, 0x0e, 0x0f, 0x0c, 0x0d, +/* 28 */ 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, +/* 30 */ 0x1a, 0x1b, 0x18, 0x19, 0x1e, 0x1f, 0x1c, 0x1d, +/* 38 */ 0x12, 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, +/* 40 */ 0x62, 0x63, 0x60, 0x61, 0x66, 0x67, 0x64, 0x65, +/* 48 */ 0x5d, 0x5d, 0x5c, 0x5c, 0x5f, 0x5f, 0x5e, 0x5e, +/* 50 */ 0x74, 0x76, 0x70, 0x72, 0x7c, 0x7e, 0x78, 0x7a, +/* 58 */ 0x6a, 0x6b, 0x68, 0x69, 0x6e, 0x6f, 0x6c, 0x6d, +/* 60 */ 0x48, 0x49, 0x46, 0x47, 0x4c, 0x4d, 0x4a, 0x4b, +/* 68 */ 0x40, 0x41, 0x3f, 0x3f, 0x44, 0x45, 0x42, 0x43, +/* 70 */ 0x56, 0x57, 0x54, 0x55, 0x5a, 0x5b, 0x58, 0x59, +/* 78 */ 0x4f, 0x4f, 0x4e, 0x4e, 0x52, 0x53, 0x50, 0x51, +/* 80 */ 0xaa, 0xab, 0xa8, 0xa9, 0xae, 0xaf, 0xac, 0xad, +/* 88 */ 0xa2, 0xa3, 0xa0, 0xa1, 0xa6, 0xa7, 0xa4, 0xa5, +/* 90 */ 0xb9, 0xba, 0xb7, 0xb8, 0xbd, 0xbe, 0xbb, 0xbc, +/* 98 */ 0xb1, 0xb2, 0xb0, 0xb0, 0xb5, 0xb6, 0xb3, 0xb4, +/* a0 */ 0x8a, 0x8b, 0x88, 0x89, 0x8e, 0x8f, 0x8c, 0x8d, +/* a8 */ 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85, +/* b0 */ 0x9a, 0x9b, 0x98, 0x99, 0x9e, 0x9f, 0x9c, 0x9d, +/* b8 */ 0x92, 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, +/* c0 */ 0xe2, 0xe3, 0xe0, 0xe1, 0xe6, 0xe7, 0xe4, 0xe5, +/* c8 */ 0xdd, 0xdd, 0xdc, 0xdc, 0xdf, 0xdf, 0xde, 0xde, +/* d0 */ 0xf4, 0xf6, 0xf0, 0xf2, 0xfc, 0xfe, 0xf8, 0xfa, +/* d8 */ 0xea, 0xeb, 0xe8, 0xe9, 0xee, 0xef, 0xec, 0xed, +/* e0 */ 0xc8, 0xc9, 0xc6, 0xc7, 0xcc, 0xcd, 0xca, 0xcb, +/* e8 */ 0xc0, 0xc1, 0xbf, 0xbf, 0xc4, 0xc5, 0xc2, 0xc3, +/* f0 */ 0xd6, 0xd7, 0xd4, 0xd5, 0xda, 0xdb, 0xd8, 0xd9, +/* f8 */ 0xcf, 0xcf, 0xce, 0xce, 0xd2, 0xd3, 0xd0, 0xd1 }; - /*---------------------------------------------------------------------------* - * mu-law to line format conversion + * u-law to A-law 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 +static unsigned char u2a_tab[256] = { +/* 00 */ 0x2a, 0x2b, 0x28, 0x29, 0x2e, 0x2f, 0x2c, 0x2d, +/* 08 */ 0x22, 0x23, 0x20, 0x21, 0x26, 0x27, 0x24, 0x25, +/* 10 */ 0x3a, 0x3b, 0x38, 0x39, 0x3e, 0x3f, 0x3c, 0x3d, +/* 18 */ 0x32, 0x33, 0x30, 0x31, 0x36, 0x37, 0x34, 0x35, +/* 20 */ 0x0a, 0x0b, 0x08, 0x09, 0x0e, 0x0f, 0x0c, 0x0d, +/* 28 */ 0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, +/* 30 */ 0x1b, 0x18, 0x19, 0x1e, 0x1f, 0x1c, 0x1d, 0x12, +/* 38 */ 0x13, 0x10, 0x11, 0x16, 0x17, 0x14, 0x15, 0x6a, +/* 40 */ 0x68, 0x69, 0x6e, 0x6f, 0x6c, 0x6d, 0x62, 0x63, +/* 48 */ 0x60, 0x61, 0x66, 0x67, 0x64, 0x65, 0x7a, 0x78, +/* 50 */ 0x7e, 0x7f, 0x7c, 0x7d, 0x72, 0x73, 0x70, 0x71, +/* 58 */ 0x76, 0x77, 0x74, 0x75, 0x4b, 0x49, 0x4f, 0x4d, +/* 60 */ 0x42, 0x43, 0x40, 0x41, 0x46, 0x47, 0x44, 0x45, +/* 68 */ 0x5a, 0x5b, 0x58, 0x59, 0x5e, 0x5f, 0x5c, 0x5d, +/* 70 */ 0x52, 0x52, 0x53, 0x53, 0x50, 0x50, 0x51, 0x51, +/* 78 */ 0x56, 0x56, 0x57, 0x57, 0x54, 0x54, 0x55, 0x55, +/* 80 */ 0xaa, 0xab, 0xa8, 0xa9, 0xae, 0xaf, 0xac, 0xad, +/* 88 */ 0xa2, 0xa3, 0xa0, 0xa1, 0xa6, 0xa7, 0xa4, 0xa5, +/* 90 */ 0xba, 0xbb, 0xb8, 0xb9, 0xbe, 0xbf, 0xbc, 0xbd, +/* 98 */ 0xb2, 0xb3, 0xb0, 0xb1, 0xb6, 0xb7, 0xb4, 0xb5, +/* a0 */ 0x8a, 0x8b, 0x88, 0x89, 0x8e, 0x8f, 0x8c, 0x8d, +/* a8 */ 0x82, 0x83, 0x80, 0x81, 0x86, 0x87, 0x84, 0x85, +/* b0 */ 0x9b, 0x98, 0x99, 0x9e, 0x9f, 0x9c, 0x9d, 0x92, +/* b8 */ 0x93, 0x90, 0x91, 0x96, 0x97, 0x94, 0x95, 0xea, +/* c0 */ 0xe8, 0xe9, 0xee, 0xef, 0xec, 0xed, 0xe2, 0xe3, +/* c8 */ 0xe0, 0xe1, 0xe6, 0xe7, 0xe4, 0xe5, 0xfa, 0xf8, +/* d0 */ 0xfe, 0xff, 0xfc, 0xfd, 0xf2, 0xf3, 0xf0, 0xf1, +/* d8 */ 0xf6, 0xf7, 0xf4, 0xf5, 0xcb, 0xc9, 0xcf, 0xcd, +/* e0 */ 0xc2, 0xc3, 0xc0, 0xc1, 0xc6, 0xc7, 0xc4, 0xc5, +/* e8 */ 0xda, 0xdb, 0xd8, 0xd9, 0xde, 0xdf, 0xdc, 0xdd, +/* f0 */ 0xd2, 0xd2, 0xd3, 0xd3, 0xd0, 0xd0, 0xd1, 0xd1, +/* f8 */ 0xd6, 0xd6, 0xd7, 0xd7, 0xd4, 0xd4, 0xd5, 0xd5 }; /*---------------------------------------------------------------------------* - * bit-reverse the sample to convert from/to canonical A-law + * reverse bits in a byte *---------------------------------------------------------------------------*/ 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 +/* 00 */ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, +/* 08 */ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, +/* 10 */ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, +/* 18 */ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, +/* 20 */ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, +/* 28 */ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, +/* 30 */ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, +/* 38 */ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, +/* 40 */ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, +/* 48 */ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, +/* 50 */ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, +/* 58 */ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, +/* 60 */ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, +/* 68 */ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, +/* 70 */ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, +/* 78 */ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, +/* 80 */ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, +/* 88 */ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, +/* 90 */ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, +/* 98 */ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, +/* a0 */ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, +/* a8 */ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, +/* b0 */ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, +/* b8 */ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, +/* c0 */ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, +/* c8 */ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, +/* d0 */ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, +/* d8 */ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, +/* e0 */ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, +/* e8 */ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, +/* f0 */ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, +/* f8 */ 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 f50a67a..fe94d14 100644 --- a/sys/i4b/driver/i4b_trace.c +++ b/sys/i4b/driver/i4b_trace.c @@ -27,9 +27,9 @@ * i4btrc - device driver for trace data read device * --------------------------------------------------- * - * $Id: i4b_trace.c,v 1.16 1999/02/14 19:51:01 hm Exp $ + * $Id: i4b_trace.c,v 1.18 1999/04/28 08:23:21 hm Exp $ * - * last edit-date: [Sun Feb 14 10:03:01 1999] + * last edit-date: [Wed Apr 28 10:21:09 1999] * * NOTE: the code assumes that SPLI4B >= splimp ! * @@ -125,7 +125,7 @@ static d_open_t i4btrcopen; static d_close_t i4btrcclose; static d_read_t i4btrcread; static d_ioctl_t i4btrcioctl; -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 +#ifdef OS_USES_POLL static d_poll_t i4btrcpoll; #endif @@ -133,7 +133,7 @@ static d_poll_t i4btrcpoll; static struct cdevsw i4btrc_cdevsw = { i4btrcopen, i4btrcclose, i4btrcread, nowrite, i4btrcioctl, nostop, noreset, nodevtotty, -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 +#ifdef OS_USES_POLL i4btrcpoll, nommap, NULL, "i4btrc", NULL, -1 #else noselect, nommap, NULL, "i4btrc", NULL, -1 @@ -441,10 +441,10 @@ i4btrcread(dev_t dev, struct uio * uio, int ioflag) return(error); } +#if defined(__FreeBSD__) && defined(OS_USES_POLL) /*---------------------------------------------------------------------------* * poll device *---------------------------------------------------------------------------*/ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001 PDEVSTATIC int i4btrcpoll(dev_t dev, int events, struct proc *p) { |