2001-01-05 15:49:52 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1997, 2000 Hellmuth Michaelis. 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* i4b_rbch.c - device driver for raw B channel data
|
|
|
|
* ---------------------------------------------------
|
|
|
|
*
|
2009-03-18 13:22:21 +03:00
|
|
|
* $Id: i4b_rbch.c,v 1.25 2009/03/18 10:22:43 cegger Exp $
|
2001-01-05 15:49:52 +03:00
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*
|
|
|
|
* last edit-date: [Fri Jan 5 11:33:47 2001]
|
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
|
2001-11-13 03:56:55 +03:00
|
|
|
#include <sys/cdefs.h>
|
2009-03-18 13:22:21 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: i4b_rbch.c,v 1.25 2009/03/18 10:22:43 cegger Exp $");
|
2001-11-13 03:56:55 +03:00
|
|
|
|
2002-03-16 19:55:51 +03:00
|
|
|
#include "isdnbchan.h"
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2002-03-16 19:55:51 +03:00
|
|
|
#if NISDNBCHAN > 0
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
|
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <sys/uio.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/mbuf.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/tty.h>
|
|
|
|
|
|
|
|
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
|
|
|
#include <sys/callout.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined (__NetBSD__) || defined (__OpenBSD__)
|
|
|
|
#define termioschars(t) memcpy((t)->c_cc, &ttydefchars, sizeof((t)->c_cc))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) && __FreeBSD__ == 3
|
|
|
|
#include "opt_devfs.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEVFS
|
|
|
|
#include <sys/devfsext.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __FreeBSD__ */
|
|
|
|
|
|
|
|
#ifdef __NetBSD__
|
|
|
|
#include <sys/filio.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
#include <machine/i4b_ioctl.h>
|
|
|
|
#include <machine/i4b_rbch_ioctl.h>
|
|
|
|
#include <machine/i4b_debug.h>
|
|
|
|
#else
|
|
|
|
#include <netisdn/i4b_ioctl.h>
|
|
|
|
#include <netisdn/i4b_rbch_ioctl.h>
|
|
|
|
#include <netisdn/i4b_debug.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <netisdn/i4b_global.h>
|
|
|
|
#include <netisdn/i4b_mbuf.h>
|
|
|
|
#include <netisdn/i4b_l3l4.h>
|
|
|
|
|
|
|
|
#include <netisdn/i4b_l4.h>
|
|
|
|
|
|
|
|
#ifdef __bsdi__
|
|
|
|
#include <sys/device.h>
|
|
|
|
#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__) && __FreeBSD__ >= 3
|
|
|
|
#include <sys/filio.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define I4BRBCHACCT 1 /* enable accounting messages */
|
|
|
|
#define I4BRBCHACCTINTVL 2 /* accounting msg interval in secs */
|
|
|
|
|
|
|
|
static struct rbch_softc {
|
|
|
|
|
|
|
|
int sc_unit; /* unit number */
|
|
|
|
|
|
|
|
int sc_devstate; /* state of driver */
|
|
|
|
#define ST_IDLE 0x00
|
|
|
|
#define ST_CONNECTED 0x01
|
|
|
|
#define ST_ISOPEN 0x02
|
|
|
|
#define ST_RDWAITDATA 0x04
|
|
|
|
#define ST_WRWAITEMPTY 0x08
|
|
|
|
#define ST_NOBLOCK 0x10
|
|
|
|
|
|
|
|
int sc_bprot; /* B-ch protocol used */
|
|
|
|
|
|
|
|
call_desc_t *sc_cd; /* Call Descriptor */
|
2002-03-17 23:54:04 +03:00
|
|
|
isdn_link_t *sc_ilt; /* B-channel driver/state */
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
struct termios it_in;
|
|
|
|
|
|
|
|
struct ifqueue sc_hdlcq; /* hdlc read queue */
|
|
|
|
#define I4BRBCHMAXQLEN 10
|
|
|
|
|
|
|
|
struct selinfo selp; /* select / poll */
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) && __FreeBSD__ == 3
|
|
|
|
#ifdef DEVFS
|
|
|
|
void *devfs_token; /* device filesystem */
|
2005-02-27 01:31:44 +03:00
|
|
|
#endif
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if I4BRBCHACCT
|
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
struct callout_handle sc_callout;
|
2005-02-27 01:31:44 +03:00
|
|
|
#endif
|
2001-01-05 15:49:52 +03:00
|
|
|
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
|
|
|
struct callout sc_callout;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int sc_iinb; /* isdn driver # of inbytes */
|
|
|
|
int sc_ioutb; /* isdn driver # of outbytes */
|
|
|
|
int sc_linb; /* last # of bytes rx'd */
|
|
|
|
int sc_loutb; /* last # of bytes tx'd */
|
|
|
|
int sc_fn; /* flag, first null acct */
|
2005-02-27 01:31:44 +03:00
|
|
|
#endif
|
2002-03-16 19:55:51 +03:00
|
|
|
} rbch_softc[NISDNBCHAN];
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2002-03-17 12:45:58 +03:00
|
|
|
static void rbch_rx_data_rdy(void *softc);
|
|
|
|
static void rbch_tx_queue_empty(void *softc);
|
|
|
|
static void rbch_connect(void *softc, void *cdp);
|
|
|
|
static void rbch_disconnect(void *softc, void *cdp);
|
|
|
|
static void rbch_clrq(void *softc);
|
2002-03-17 23:54:04 +03:00
|
|
|
static void rbch_activity(void *softc, int rxtx);
|
|
|
|
static void rbch_dialresponse(void *softc, int status, cause_t cause);
|
|
|
|
static void rbch_updown(void *softc, int updown);
|
|
|
|
static void rbch_set_linktab(void *softc, isdn_link_t *ilt);
|
|
|
|
static void* rbch_get_softc(int unit);
|
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#ifndef __FreeBSD__
|
|
|
|
#define PDEVSTATIC /* - not static - */
|
|
|
|
#define IOCTL_CMD_T u_long
|
2009-03-14 17:45:51 +03:00
|
|
|
void isdnbchanattach(void);
|
|
|
|
int isdnbchanopen(dev_t dev, int flag, int fmt, struct lwp *l);
|
|
|
|
int isdnbchanclose(dev_t dev, int flag, int fmt, struct lwp *l);
|
|
|
|
int isdnbchanread(dev_t dev, struct uio *uio, int ioflag);
|
|
|
|
int isdnbchanwrite(dev_t dev, struct uio *uio, int ioflag);
|
|
|
|
int isdnbchanioctl(dev_t dev, IOCTL_CMD_T cmd, void *arg, int flag, struct lwp* l);
|
2001-01-05 15:49:52 +03:00
|
|
|
#ifdef OS_USES_POLL
|
2009-03-14 17:45:51 +03:00
|
|
|
int isdnbchanpoll(dev_t dev, int events, struct lwp *l);
|
|
|
|
int isdnbchankqfilter(dev_t dev, struct knote *kn);
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2009-03-14 17:45:51 +03:00
|
|
|
PDEVSTATIC int isdnbchanselect(dev_t dev, int rw, struct lwp *l);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2002-09-06 17:18:43 +04:00
|
|
|
#ifdef __NetBSD__
|
|
|
|
const struct cdevsw isdnbchan_cdevsw = {
|
|
|
|
isdnbchanopen, isdnbchanclose, isdnbchanread, isdnbchanwrite,
|
2006-10-16 16:23:00 +04:00
|
|
|
isdnbchanioctl, nostop, notty, isdnbchanpoll, nommap, nokqfilter,
|
|
|
|
D_OTHER
|
2002-09-06 17:18:43 +04:00
|
|
|
};
|
|
|
|
#endif /* __NetBSD__ */
|
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
#if BSD > 199306 && defined(__FreeBSD__)
|
|
|
|
#define PDEVSTATIC static
|
|
|
|
#define IOCTL_CMD_T u_long
|
|
|
|
|
2002-03-16 19:55:51 +03:00
|
|
|
PDEVSTATIC d_open_t isdnbchanopen;
|
|
|
|
PDEVSTATIC d_close_t isdnbchanclose;
|
|
|
|
PDEVSTATIC d_read_t isdnbchanread;
|
|
|
|
PDEVSTATIC d_read_t isdnbchanwrite;
|
|
|
|
PDEVSTATIC d_ioctl_t isdnbchanioctl;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#ifdef OS_USES_POLL
|
2002-03-16 19:55:51 +03:00
|
|
|
PDEVSTATIC d_poll_t isdnbchanpoll;
|
|
|
|
#define POLLFIELD isdnbchanpoll
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2002-03-16 19:55:51 +03:00
|
|
|
PDEVSTATIC d_select_t isdnbchanselect;
|
|
|
|
#define POLLFIELD isdnbchanselect
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define CDEV_MAJOR 57
|
|
|
|
|
|
|
|
#if defined(__FreeBSD__) && __FreeBSD__ >= 4
|
2002-03-16 19:55:51 +03:00
|
|
|
static struct cdevsw isdnbchan_cdevsw = {
|
|
|
|
/* open */ isdnbchanopen,
|
|
|
|
/* close */ isdnbchanclose,
|
|
|
|
/* read */ isdnbchanread,
|
|
|
|
/* write */ isdnbchanwrite,
|
|
|
|
/* ioctl */ isdnbchanioctl,
|
2001-01-05 15:49:52 +03:00
|
|
|
/* poll */ POLLFIELD,
|
|
|
|
/* mmap */ nommap,
|
|
|
|
/* strategy */ nostrategy,
|
2002-03-16 19:55:51 +03:00
|
|
|
/* name */ "isdnbchan",
|
2001-01-05 15:49:52 +03:00
|
|
|
/* maj */ CDEV_MAJOR,
|
|
|
|
/* dump */ nodump,
|
|
|
|
/* psize */ nopsize,
|
|
|
|
/* flags */ 0,
|
|
|
|
/* bmaj */ -1
|
|
|
|
};
|
|
|
|
#else
|
2002-03-16 19:55:51 +03:00
|
|
|
static struct cdevsw isdnbchan_cdevsw = {
|
|
|
|
isdnbchanopen, isdnbchanclose, isdnbchanread, isdnbchanwrite,
|
|
|
|
isdnbchanioctl, nostop, noreset, nodevtotty,
|
|
|
|
POLLFIELD, nommap, NULL, "isdnbchan", NULL, -1
|
2001-01-05 15:49:52 +03:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2002-03-16 19:55:51 +03:00
|
|
|
static void isdnbchanattach(void *);
|
|
|
|
PSEUDO_SET(isdnbchanattach, i4b_rbch);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* DEVICE DRIVER ROUTINES
|
|
|
|
*===========================================================================*/
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* initialization at kernel load time
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-16 19:55:51 +03:00
|
|
|
isdnbchaninit(void *unused)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
#if defined(__FreeBSD__) && __FreeBSD__ >= 4
|
2002-03-16 19:55:51 +03:00
|
|
|
cdevsw_add(&isdnbchan_cdevsw);
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
|
|
|
dev_t dev = makedev(CDEV_MAJOR, 0);
|
2002-03-16 19:55:51 +03:00
|
|
|
cdevsw_add(&dev, &isdnbchan_cdevsw, NULL);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2002-03-16 19:55:51 +03:00
|
|
|
SYSINIT(isdnbchandev, SI_SUB_DRIVERS,
|
|
|
|
SI_ORDER_MIDDLE+CDEV_MAJOR, &isdnbchaninit, NULL);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#endif /* BSD > 199306 && defined(__FreeBSD__) */
|
|
|
|
|
|
|
|
#ifdef __bsdi__
|
2002-03-16 19:55:51 +03:00
|
|
|
int isdnbchanmatch(struct device *parent, struct cfdata *cf, void *aux);
|
|
|
|
void dummy_isdnbchanattach(struct device*, struct device *, void *);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
#define CDEV_MAJOR 61
|
|
|
|
|
2002-03-16 19:55:51 +03:00
|
|
|
static struct cfdriver isdnbchancd =
|
|
|
|
{ NULL, "isdnbchan", isdnbchanmatch, dummy_isdnbchanattach, DV_DULL,
|
2001-01-05 15:49:52 +03:00
|
|
|
sizeof(struct cfdriver) };
|
2005-02-27 01:31:44 +03:00
|
|
|
struct devsw isdnbchansw =
|
2002-03-16 19:55:51 +03:00
|
|
|
{ &isdnbchancd,
|
|
|
|
isdnbchanopen, isdnbchanclose, isdnbchanread, isdnbchanwrite,
|
|
|
|
isdnbchanioctl, seltrue, nommap, nostrat,
|
2001-01-05 15:49:52 +03:00
|
|
|
nodump, nopsize, 0, nostop
|
|
|
|
};
|
|
|
|
|
|
|
|
int
|
2002-03-16 19:55:51 +03:00
|
|
|
isdnbchanmatch(struct device *parent, struct cfdata *cf, void *aux)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-16 19:55:51 +03:00
|
|
|
printf("isdnbchanmatch: aux=0x%x\n", aux);
|
2001-01-05 15:49:52 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
void
|
2002-03-16 19:55:51 +03:00
|
|
|
dummy_isdnbchanattach(struct device *parent, struct device *self, void *aux)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-16 19:55:51 +03:00
|
|
|
printf("dummy_isdnbchanattach: aux=0x%x\n", aux);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
#endif /* __bsdi__ */
|
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
|
|
|
|
static const struct isdn_l4_driver_functions
|
|
|
|
rbch_driver_functions = {
|
|
|
|
rbch_rx_data_rdy,
|
|
|
|
rbch_tx_queue_empty,
|
|
|
|
rbch_activity,
|
|
|
|
rbch_connect,
|
|
|
|
rbch_disconnect,
|
|
|
|
rbch_dialresponse,
|
|
|
|
rbch_updown,
|
|
|
|
rbch_get_softc,
|
|
|
|
rbch_set_linktab,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static int rbch_driver_id = -1;
|
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* interface attach routine
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
PDEVSTATIC void
|
|
|
|
#ifdef __FreeBSD__
|
2002-03-16 19:55:51 +03:00
|
|
|
isdnbchanattach(void *dummy)
|
2001-01-05 15:49:52 +03:00
|
|
|
#else
|
2009-03-18 13:22:21 +03:00
|
|
|
isdnbchanattach(void)
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
rbch_driver_id = isdn_l4_driver_attach("isdnbchan", NISDNBCHAN, &rbch_driver_functions);
|
|
|
|
|
2002-03-16 19:55:51 +03:00
|
|
|
for(i=0; i < NISDNBCHAN; i++)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
#if __FreeBSD__ == 3
|
|
|
|
|
|
|
|
#ifdef DEVFS
|
|
|
|
rbch_softc[i].devfs_token =
|
2002-03-16 19:55:51 +03:00
|
|
|
devfs_add_devswf(&isdnbchan_cdevsw, i, DV_CHR,
|
2001-01-05 15:49:52 +03:00
|
|
|
UID_ROOT, GID_WHEEL, 0600,
|
2002-03-16 19:55:51 +03:00
|
|
|
"isdnbchan%d", i);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#else
|
2002-03-16 19:55:51 +03:00
|
|
|
make_dev(&isdnbchan_cdevsw, i,
|
|
|
|
UID_ROOT, GID_WHEEL, 0600, "isdnbchan%d", i);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if I4BRBCHACCT
|
|
|
|
#if defined(__FreeBSD__)
|
|
|
|
callout_handle_init(&rbch_softc[i].sc_callout);
|
|
|
|
#endif
|
|
|
|
#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
|
2007-07-10 00:51:58 +04:00
|
|
|
callout_init(&rbch_softc[i].sc_callout, 0);
|
2008-03-01 17:16:49 +03:00
|
|
|
selinit(&rbch_softc[i].selp);
|
2001-01-05 15:49:52 +03:00
|
|
|
#endif
|
|
|
|
rbch_softc[i].sc_fn = 1;
|
|
|
|
#endif
|
|
|
|
rbch_softc[i].sc_unit = i;
|
|
|
|
rbch_softc[i].sc_devstate = ST_IDLE;
|
|
|
|
rbch_softc[i].sc_hdlcq.ifq_maxlen = I4BRBCHMAXQLEN;
|
|
|
|
rbch_softc[i].it_in.c_ispeed = rbch_softc[i].it_in.c_ospeed = 64000;
|
|
|
|
termioschars(&rbch_softc[i].it_in);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* open rbch device
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
PDEVSTATIC int
|
2006-11-16 04:32:37 +03:00
|
|
|
isdnbchanopen(dev_t dev, int flag, int fmt,
|
|
|
|
struct lwp *l)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
int unit = minor(dev);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2002-03-16 19:55:51 +03:00
|
|
|
if(unit >= NISDNBCHAN)
|
2001-01-05 15:49:52 +03:00
|
|
|
return(ENXIO);
|
|
|
|
|
|
|
|
if(rbch_softc[unit].sc_devstate & ST_ISOPEN)
|
|
|
|
return(EBUSY);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
rbch_clrq(unit);
|
|
|
|
#endif
|
|
|
|
|
2005-02-27 01:31:44 +03:00
|
|
|
rbch_softc[unit].sc_devstate |= ST_ISOPEN;
|
|
|
|
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, open", unit);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* close rbch device
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
PDEVSTATIC int
|
2006-11-16 04:32:37 +03:00
|
|
|
isdnbchanclose(dev_t dev, int flag, int fmt,
|
|
|
|
struct lwp *l)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
int unit = minor(dev);
|
|
|
|
struct rbch_softc *sc = &rbch_softc[unit];
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if(sc->sc_devstate & ST_CONNECTED)
|
2002-03-17 23:54:04 +03:00
|
|
|
i4b_l4_drvrdisc(sc->sc_cd->cdid);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2005-02-27 01:31:44 +03:00
|
|
|
sc->sc_devstate &= ~ST_ISOPEN;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2002-03-17 12:45:58 +03:00
|
|
|
rbch_clrq(sc);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "channel %d, closed", unit);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* read from rbch device
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
PDEVSTATIC int
|
2006-11-16 04:32:37 +03:00
|
|
|
isdnbchanread(dev_t dev, struct uio *uio, int ioflag)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
struct mbuf *m;
|
|
|
|
int error = 0;
|
|
|
|
int unit = minor(dev);
|
|
|
|
struct ifqueue *iqp;
|
|
|
|
struct rbch_softc *sc = &rbch_softc[unit];
|
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
int s;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, enter read", unit);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
s = splnet();
|
2001-01-05 15:49:52 +03:00
|
|
|
if(!(sc->sc_devstate & ST_ISOPEN))
|
|
|
|
{
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, read while not open", unit);
|
|
|
|
return(EIO);
|
|
|
|
}
|
|
|
|
|
|
|
|
if((sc->sc_devstate & ST_NOBLOCK))
|
|
|
|
{
|
|
|
|
if(!(sc->sc_devstate & ST_CONNECTED)) {
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
return(EWOULDBLOCK);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(sc->sc_bprot == BPROT_RHDLC)
|
|
|
|
iqp = &sc->sc_hdlcq;
|
|
|
|
else
|
2005-02-27 01:31:44 +03:00
|
|
|
iqp = sc->sc_ilt->rx_queue;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
if(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN)) {
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
return(EWOULDBLOCK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while(!(sc->sc_devstate & ST_CONNECTED))
|
|
|
|
{
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, wait read init", unit);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2007-03-04 08:59:00 +03:00
|
|
|
if((error = tsleep((void *) &rbch_softc[unit],
|
2001-01-05 15:49:52 +03:00
|
|
|
TTIPRI | PCATCH,
|
|
|
|
"rrrbch", 0 )) != 0)
|
|
|
|
{
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep", unit, error);
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(sc->sc_bprot == BPROT_RHDLC)
|
|
|
|
iqp = &sc->sc_hdlcq;
|
|
|
|
else
|
2005-02-27 01:31:44 +03:00
|
|
|
iqp = sc->sc_ilt->rx_queue;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
while(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN))
|
|
|
|
{
|
|
|
|
sc->sc_devstate |= ST_RDWAITDATA;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, wait read data", unit);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2007-03-04 08:59:00 +03:00
|
|
|
if((error = tsleep((void *) &sc->sc_ilt->rx_queue,
|
2001-01-05 15:49:52 +03:00
|
|
|
TTIPRI | PCATCH,
|
|
|
|
"rrbch", 0 )) != 0)
|
|
|
|
{
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep read", unit, error);
|
|
|
|
sc->sc_devstate &= ~ST_RDWAITDATA;
|
|
|
|
return(error);
|
2002-03-19 02:28:03 +03:00
|
|
|
} else if (!(sc->sc_devstate & ST_CONNECTED)) {
|
|
|
|
splx(s);
|
|
|
|
return 0;
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IF_DEQUEUE(iqp, m);
|
|
|
|
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, read %d bytes", unit, m->m_len);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if(m && m->m_len)
|
|
|
|
{
|
|
|
|
error = uiomove(m->m_data, m->m_len, uio);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, error %d uiomove", unit, error);
|
|
|
|
error = EIO;
|
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if(m)
|
|
|
|
i4b_Bfreembuf(m);
|
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* write to rbch device
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
PDEVSTATIC int
|
2006-11-16 04:32:37 +03:00
|
|
|
isdnbchanwrite(dev_t dev, struct uio * uio, int ioflag)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
struct mbuf *m;
|
|
|
|
int error = 0;
|
|
|
|
int unit = minor(dev);
|
|
|
|
struct rbch_softc *sc = &rbch_softc[unit];
|
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
int s;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, write", unit);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
s = splnet();
|
2001-01-05 15:49:52 +03:00
|
|
|
if(!(sc->sc_devstate & ST_ISOPEN))
|
|
|
|
{
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, write while not open", unit);
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
return(EIO);
|
|
|
|
}
|
|
|
|
|
|
|
|
if((sc->sc_devstate & ST_NOBLOCK))
|
|
|
|
{
|
|
|
|
if(!(sc->sc_devstate & ST_CONNECTED)) {
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
return(EWOULDBLOCK);
|
|
|
|
}
|
2002-03-17 23:54:04 +03:00
|
|
|
if(IF_QFULL(sc->sc_ilt->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) {
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
return(EWOULDBLOCK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while(!(sc->sc_devstate & ST_CONNECTED))
|
|
|
|
{
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, write wait init", unit);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2007-03-04 08:59:00 +03:00
|
|
|
error = tsleep((void *) &rbch_softc[unit],
|
2001-01-05 15:49:52 +03:00
|
|
|
TTIPRI | PCATCH,
|
|
|
|
"wrrbch", 0 );
|
|
|
|
if(error == ERESTART) {
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
return (ERESTART);
|
|
|
|
}
|
|
|
|
else if(error == EINTR)
|
|
|
|
{
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, EINTR during wait init", unit);
|
|
|
|
return(EINTR);
|
|
|
|
}
|
|
|
|
else if(error)
|
|
|
|
{
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep init", unit, error);
|
|
|
|
return(error);
|
|
|
|
}
|
2007-03-04 08:59:00 +03:00
|
|
|
tsleep((void *) &rbch_softc[unit], TTIPRI | PCATCH, "xrbch", (hz*1));
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
while(IF_QFULL(sc->sc_ilt->tx_queue) && (sc->sc_devstate & ST_ISOPEN))
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
sc->sc_devstate |= ST_WRWAITEMPTY;
|
|
|
|
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, write queue full", unit);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2007-03-04 08:59:00 +03:00
|
|
|
if ((error = tsleep((void *) &sc->sc_ilt->tx_queue,
|
2001-01-05 15:49:52 +03:00
|
|
|
TTIPRI | PCATCH,
|
|
|
|
"wrbch", 0)) != 0) {
|
|
|
|
sc->sc_devstate &= ~ST_WRWAITEMPTY;
|
|
|
|
if(error == ERESTART)
|
|
|
|
{
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
return(ERESTART);
|
|
|
|
}
|
|
|
|
else if(error == EINTR)
|
|
|
|
{
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, EINTR during wait write", unit);
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
else if(error)
|
|
|
|
{
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep write", unit, error);
|
|
|
|
return(error);
|
|
|
|
}
|
2002-03-19 02:28:03 +03:00
|
|
|
else if (!(sc->sc_devstate & ST_CONNECTED)) {
|
|
|
|
splx(s);
|
|
|
|
return 0;
|
|
|
|
}
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!(sc->sc_devstate & ST_ISOPEN))
|
|
|
|
{
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, not open anymore", unit);
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2001-01-05 15:49:52 +03:00
|
|
|
return(EIO);
|
|
|
|
}
|
|
|
|
|
|
|
|
if((m = i4b_Bgetmbuf(BCH_MAX_DATALEN)) != NULL)
|
|
|
|
{
|
|
|
|
m->m_len = min(BCH_MAX_DATALEN, uio->uio_resid);
|
|
|
|
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, write %d bytes", unit, m->m_len);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
error = uiomove(m->m_data, m->m_len, uio);
|
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
if(IF_QFULL(sc->sc_ilt->tx_queue))
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2005-02-27 01:31:44 +03:00
|
|
|
m_freem(m);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-17 23:54:04 +03:00
|
|
|
IF_ENQUEUE(sc->sc_ilt->tx_queue, m);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
(*sc->sc_ilt->bchannel_driver->bch_tx_start)(sc->sc_ilt->l1token, sc->sc_ilt->channel);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* rbch device ioctl handlibg
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
PDEVSTATIC int
|
2007-03-04 08:59:00 +03:00
|
|
|
isdnbchanioctl(dev_t dev, IOCTL_CMD_T cmd, void *data, int flag,
|
2006-11-16 04:32:37 +03:00
|
|
|
struct lwp *l)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
int error = 0;
|
|
|
|
int unit = minor(dev);
|
|
|
|
struct rbch_softc *sc = &rbch_softc[unit];
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
switch(cmd)
|
|
|
|
{
|
|
|
|
case FIOASYNC: /* Set async mode */
|
|
|
|
if (*(int *)data)
|
|
|
|
{
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, setting async mode", unit);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, clearing async mode", unit);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FIONBIO:
|
|
|
|
if (*(int *)data)
|
|
|
|
{
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, setting non-blocking mode", unit);
|
|
|
|
sc->sc_devstate |= ST_NOBLOCK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, clearing non-blocking mode", unit);
|
|
|
|
sc->sc_devstate &= ~ST_NOBLOCK;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TIOCCDTR: /* Clear DTR */
|
|
|
|
if(sc->sc_devstate & ST_CONNECTED)
|
|
|
|
{
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, disconnecting for DTR down", unit);
|
2002-03-17 23:54:04 +03:00
|
|
|
i4b_l4_drvrdisc(sc->sc_cd->cdid);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case I4B_RBCH_DIALOUT:
|
|
|
|
{
|
2005-12-17 08:37:17 +03:00
|
|
|
size_t x;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2005-12-17 08:37:17 +03:00
|
|
|
for (x = 0; x < TELNO_MAX && ((char *)data)[x]; x++)
|
2001-01-05 15:49:52 +03:00
|
|
|
;
|
2005-12-17 08:37:17 +03:00
|
|
|
if (x)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 23:54:04 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "%d, attempting dialout to %s", unit, (char *)data);
|
2005-12-17 08:37:17 +03:00
|
|
|
i4b_l4_dialoutnumber(rbch_driver_id, unit, x, (char *)data);
|
2001-01-05 15:49:52 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* fall through to SDTR */
|
|
|
|
}
|
|
|
|
|
|
|
|
case TIOCSDTR: /* Set DTR */
|
|
|
|
NDBGL4(L4_RBCHDBG, "unit %d, attempting dialout (DTR)", unit);
|
2002-03-17 23:54:04 +03:00
|
|
|
i4b_l4_dialout(rbch_driver_id, unit);
|
2001-01-05 15:49:52 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case TIOCSETA: /* Set termios struct */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TIOCGETA: /* Get termios struct */
|
|
|
|
*(struct termios *)data = sc->it_in;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TIOCMGET:
|
|
|
|
*(int *)data = TIOCM_LE|TIOCM_DTR|TIOCM_RTS|TIOCM_CTS|TIOCM_DSR;
|
|
|
|
if (sc->sc_devstate & ST_CONNECTED)
|
|
|
|
*(int *)data |= TIOCM_CD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case I4B_RBCH_VR_REQ:
|
|
|
|
{
|
|
|
|
msg_vr_req_t *mvr;
|
|
|
|
|
|
|
|
mvr = (msg_vr_req_t *)data;
|
|
|
|
|
|
|
|
mvr->version = VERSION;
|
|
|
|
mvr->release = REL;
|
2005-02-27 01:31:44 +03:00
|
|
|
mvr->step = STEP;
|
2001-01-05 15:49:52 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default: /* Unknown stuff */
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "(minor=%d) ioctl, unknown cmd %lx", unit, (u_long)cmd);
|
2001-01-05 15:49:52 +03:00
|
|
|
error = EINVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef OS_USES_POLL
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* device driver poll
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
PDEVSTATIC int
|
2005-12-11 15:16:03 +03:00
|
|
|
isdnbchanpoll(dev_t dev, int events, struct lwp *l)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
int revents = 0; /* Events we found */
|
|
|
|
int s;
|
|
|
|
int unit = minor(dev);
|
|
|
|
struct rbch_softc *sc = &rbch_softc[unit];
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
/* We can't check for anything but IN or OUT */
|
|
|
|
|
|
|
|
s = splhigh();
|
|
|
|
|
|
|
|
if(!(sc->sc_devstate & ST_ISOPEN))
|
|
|
|
{
|
|
|
|
splx(s);
|
|
|
|
return(POLLNVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Writes are OK if we are connected and the
|
|
|
|
* transmit queue can take them
|
|
|
|
*/
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if((events & (POLLOUT|POLLWRNORM)) &&
|
|
|
|
(sc->sc_devstate & ST_CONNECTED) &&
|
2002-03-17 23:54:04 +03:00
|
|
|
!IF_QFULL(sc->sc_ilt->tx_queue))
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
revents |= (events & (POLLOUT|POLLWRNORM));
|
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
/* ... while reads are OK if we have any data */
|
|
|
|
|
|
|
|
if((events & (POLLIN|POLLRDNORM)) &&
|
|
|
|
(sc->sc_devstate & ST_CONNECTED))
|
|
|
|
{
|
|
|
|
struct ifqueue *iqp;
|
|
|
|
|
|
|
|
if(sc->sc_bprot == BPROT_RHDLC)
|
|
|
|
iqp = &sc->sc_hdlcq;
|
|
|
|
else
|
2005-02-27 01:31:44 +03:00
|
|
|
iqp = sc->sc_ilt->rx_queue;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
if(!IF_QEMPTY(iqp))
|
|
|
|
revents |= (events & (POLLIN|POLLRDNORM));
|
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if(revents == 0)
|
2005-12-11 15:16:03 +03:00
|
|
|
selrecord(l, &sc->selp);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
splx(s);
|
|
|
|
return(revents);
|
|
|
|
}
|
|
|
|
|
2002-10-23 13:10:23 +04:00
|
|
|
static void
|
|
|
|
filt_i4brbchdetach(struct knote *kn)
|
|
|
|
{
|
|
|
|
struct rbch_softc *sc = kn->kn_hook;
|
|
|
|
int s;
|
|
|
|
|
|
|
|
s = splhigh();
|
2002-11-26 22:49:00 +03:00
|
|
|
SLIST_REMOVE(&sc->selp.sel_klist, kn, knote, kn_selnext);
|
2002-10-23 13:10:23 +04:00
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2006-11-16 04:32:37 +03:00
|
|
|
filt_i4brbchread(struct knote *kn, long hint)
|
2002-10-23 13:10:23 +04:00
|
|
|
{
|
|
|
|
struct rbch_softc *sc = kn->kn_hook;
|
|
|
|
struct ifqueue *iqp;
|
|
|
|
|
|
|
|
if ((sc->sc_devstate & ST_CONNECTED) == 0)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
if (sc->sc_bprot == BPROT_RHDLC)
|
|
|
|
iqp = &sc->sc_hdlcq;
|
|
|
|
else
|
2005-02-27 01:31:44 +03:00
|
|
|
iqp = sc->sc_ilt->rx_queue;
|
2002-10-23 13:10:23 +04:00
|
|
|
|
|
|
|
if (IF_QEMPTY(iqp))
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct filterops i4brbchread_filtops =
|
|
|
|
{ 1, NULL, filt_i4brbchdetach, filt_i4brbchread };
|
|
|
|
|
|
|
|
static int
|
2006-11-16 04:32:37 +03:00
|
|
|
filt_i4brbchwrite(struct knote *kn, long hint)
|
2002-10-23 13:10:23 +04:00
|
|
|
{
|
|
|
|
struct rbch_softc *sc = kn->kn_hook;
|
|
|
|
|
|
|
|
if ((sc->sc_devstate & ST_CONNECTED) == 0)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
if (IF_QFULL(sc->sc_ilt->tx_queue))
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
kn->kn_data = 0; /* XXXLUKEM (thorpej): what to put here? */
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct filterops i4brbchwrite_filtops =
|
|
|
|
{ 1, NULL, filt_i4brbchdetach, filt_i4brbchwrite };
|
|
|
|
|
|
|
|
int
|
|
|
|
isdnbchankqfilter(dev_t dev, struct knote *kn)
|
|
|
|
{
|
|
|
|
struct rbch_softc *sc = &rbch_softc[minor(dev)];
|
|
|
|
struct klist *klist;
|
|
|
|
int s;
|
|
|
|
|
|
|
|
switch (kn->kn_filter) {
|
|
|
|
case EVFILT_READ:
|
2002-11-26 22:49:00 +03:00
|
|
|
klist = &sc->selp.sel_klist;
|
2002-10-23 13:10:23 +04:00
|
|
|
kn->kn_fop = &i4brbchread_filtops;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVFILT_WRITE:
|
2002-11-26 22:49:00 +03:00
|
|
|
klist = &sc->selp.sel_klist;
|
2002-10-23 13:10:23 +04:00
|
|
|
kn->kn_fop = &i4brbchwrite_filtops;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2007-12-05 20:19:46 +03:00
|
|
|
return (EINVAL);
|
2002-10-23 13:10:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
kn->kn_hook = sc;
|
|
|
|
|
|
|
|
s = splhigh();
|
|
|
|
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
|
|
|
|
splx(s);
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
#else /* OS_USES_POLL */
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* device driver select
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
PDEVSTATIC int
|
2005-12-11 15:16:03 +03:00
|
|
|
isdnbchanselect(dev_t dev, int rw, struct lwp *l)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
int unit = minor(dev);
|
|
|
|
struct rbch_softc *sc = &rbch_softc[unit];
|
|
|
|
int s;
|
|
|
|
|
|
|
|
s = splhigh();
|
|
|
|
|
|
|
|
if(!(sc->sc_devstate & ST_ISOPEN))
|
|
|
|
{
|
|
|
|
splx(s);
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "(minor=%d) not open anymore", unit);
|
2001-01-05 15:49:52 +03:00
|
|
|
return(1);
|
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if(sc->sc_devstate & ST_CONNECTED)
|
|
|
|
{
|
|
|
|
struct ifqueue *iqp;
|
|
|
|
|
|
|
|
switch(rw)
|
|
|
|
{
|
|
|
|
case FREAD:
|
|
|
|
if(sc->sc_bprot == BPROT_RHDLC)
|
|
|
|
iqp = &sc->sc_hdlcq;
|
|
|
|
else
|
2005-02-27 01:31:44 +03:00
|
|
|
iqp = isdn_linktab[unit]->rx_queue;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2005-12-11 15:16:03 +03:00
|
|
|
selrecord(l, &sc->selp);
|
2001-01-05 15:49:52 +03:00
|
|
|
splx(s);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* OS_USES_POLL */
|
|
|
|
|
|
|
|
#if I4BRBCHACCT
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* watchdog routine
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
|
|
|
rbch_timeout(struct rbch_softc *sc)
|
|
|
|
{
|
|
|
|
bchan_statistics_t bs;
|
|
|
|
|
2005-02-27 01:31:44 +03:00
|
|
|
/* get # of bytes in and out from the HSCX driver */
|
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
(*sc->sc_ilt->bchannel_driver->bch_stat)
|
|
|
|
(sc->sc_ilt->l1token, sc->sc_ilt->channel, &bs);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
sc->sc_ioutb += bs.outbytes;
|
|
|
|
sc->sc_iinb += bs.inbytes;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
|
|
|
if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
int ri = (sc->sc_iinb - sc->sc_linb)/I4BRBCHACCTINTVL;
|
|
|
|
int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BRBCHACCTINTVL;
|
|
|
|
|
|
|
|
if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb))
|
|
|
|
sc->sc_fn = 0;
|
|
|
|
else
|
|
|
|
sc->sc_fn = 1;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
sc->sc_linb = sc->sc_iinb;
|
|
|
|
sc->sc_loutb = sc->sc_ioutb;
|
|
|
|
|
2002-03-17 14:08:31 +03:00
|
|
|
if (sc->sc_cd)
|
|
|
|
i4b_l4_accounting(sc->sc_cd->cdid, ACCT_DURING,
|
|
|
|
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_ioutb, sc->sc_iinb);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
START_TIMER(sc->sc_callout, rbch_timeout, sc, I4BRBCHACCTINTVL*hz);
|
|
|
|
}
|
|
|
|
#endif /* I4BRBCHACCT */
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* ISDN INTERFACE ROUTINES
|
|
|
|
*===========================================================================*/
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is called from L4 handler at connect time
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
rbch_connect(void *softc, void *cdp)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
call_desc_t *cd = (call_desc_t *)cdp;
|
2002-03-17 12:45:58 +03:00
|
|
|
struct rbch_softc *sc = softc;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
sc->sc_bprot = cd->bprot;
|
|
|
|
|
|
|
|
#if I4BRBCHACCT
|
|
|
|
if(sc->sc_bprot == BPROT_RHDLC)
|
2005-02-27 01:31:44 +03:00
|
|
|
{
|
2001-01-05 15:49:52 +03:00
|
|
|
sc->sc_iinb = 0;
|
|
|
|
sc->sc_ioutb = 0;
|
|
|
|
sc->sc_linb = 0;
|
|
|
|
sc->sc_loutb = 0;
|
|
|
|
|
|
|
|
START_TIMER(sc->sc_callout, rbch_timeout, sc, I4BRBCHACCTINTVL*hz);
|
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
#endif
|
2001-01-05 15:49:52 +03:00
|
|
|
if(!(sc->sc_devstate & ST_CONNECTED))
|
|
|
|
{
|
2003-10-03 20:38:44 +04:00
|
|
|
NDBGL4(L4_RBCHDBG, "B channel %d at ISDN %d, wakeup",
|
|
|
|
cd->channelid, cd->isdnif);
|
2001-01-05 15:49:52 +03:00
|
|
|
sc->sc_devstate |= ST_CONNECTED;
|
|
|
|
sc->sc_cd = cdp;
|
2007-03-04 08:59:00 +03:00
|
|
|
wakeup((void *)sc);
|
2008-03-01 17:16:49 +03:00
|
|
|
selnotify(&sc->selp, 0, 0);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is called from L4 handler at disconnect time
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
rbch_disconnect(void *softc, void *cdp)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
call_desc_t *cd = cdp;
|
|
|
|
struct rbch_softc *sc = softc;
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
int s;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if(cd != sc->sc_cd)
|
|
|
|
{
|
2003-10-03 20:38:44 +04:00
|
|
|
NDBGL4(L4_RBCHDBG, "B channel %d at ISDN %d not active",
|
|
|
|
cd->channelid, cd->isdnif);
|
2001-01-05 15:49:52 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
s = splnet();
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2003-10-03 20:38:44 +04:00
|
|
|
NDBGL4(L4_RBCHDBG, "B channel %d at ISDN %d disconnect",
|
|
|
|
cd->channelid, cd->isdnif);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
sc->sc_devstate &= ~ST_CONNECTED;
|
|
|
|
|
|
|
|
#if I4BRBCHACCT
|
2002-03-17 14:08:31 +03:00
|
|
|
if (sc->sc_cd)
|
|
|
|
i4b_l4_accounting(sc->sc_cd->cdid, ACCT_FINAL,
|
|
|
|
sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_ioutb, sc->sc_iinb);
|
2001-01-05 15:49:52 +03:00
|
|
|
|
|
|
|
STOP_TIMER(sc->sc_callout, rbch_timeout, sc);
|
2005-02-27 01:31:44 +03:00
|
|
|
#endif
|
2002-03-17 14:08:31 +03:00
|
|
|
|
|
|
|
sc->sc_cd = NULL;
|
2002-03-19 02:28:03 +03:00
|
|
|
if (sc->sc_devstate & ST_RDWAITDATA)
|
|
|
|
wakeup(&sc->sc_ilt->rx_queue);
|
|
|
|
if (sc->sc_devstate & ST_WRWAITEMPTY)
|
|
|
|
wakeup(&sc->sc_ilt->tx_queue);
|
2002-03-17 14:08:31 +03:00
|
|
|
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2002-03-19 02:28:03 +03:00
|
|
|
|
2008-03-01 17:16:49 +03:00
|
|
|
selnotify(&sc->selp, 0, 0);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* feedback from daemon in case of dial problems
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2006-11-16 04:32:37 +03:00
|
|
|
rbch_dialresponse(void *softc, int status,
|
|
|
|
cause_t cause)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* interface up/down
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2006-11-16 04:32:37 +03:00
|
|
|
rbch_updown(void *softc, int updown)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is called from the HSCX interrupt handler
|
|
|
|
* when a new frame (mbuf) has been received and is to be put on
|
|
|
|
* the rx queue.
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
rbch_rx_data_rdy(void *softc)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
struct rbch_softc *sc = softc;
|
|
|
|
|
|
|
|
if(sc->sc_bprot == BPROT_RHDLC)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
|
|
|
register struct mbuf *m;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2002-03-17 23:54:04 +03:00
|
|
|
if((m = *sc->sc_ilt->rx_mbuf) == NULL)
|
2001-01-05 15:49:52 +03:00
|
|
|
return;
|
|
|
|
|
|
|
|
m->m_pkthdr.len = m->m_len;
|
|
|
|
|
2002-03-17 12:45:58 +03:00
|
|
|
if(IF_QFULL(&sc->sc_hdlcq))
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "(minor=%d) hdlc rx queue full!", sc->sc_unit);
|
2001-01-05 15:49:52 +03:00
|
|
|
m_freem(m);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
IF_ENQUEUE(&sc->sc_hdlcq, m);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
2005-02-27 01:31:44 +03:00
|
|
|
}
|
2001-01-05 15:49:52 +03:00
|
|
|
|
2002-03-17 12:45:58 +03:00
|
|
|
if(sc->sc_devstate & ST_RDWAITDATA)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "(minor=%d) wakeup", sc->sc_unit);
|
|
|
|
sc->sc_devstate &= ~ST_RDWAITDATA;
|
2007-03-04 08:59:00 +03:00
|
|
|
wakeup((void *) &sc->sc_ilt->rx_queue);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "(minor=%d) NO wakeup", sc->sc_unit);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
2008-03-01 17:16:49 +03:00
|
|
|
selnotify(&sc->selp, 0, 0);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is called from the HSCX interrupt handler
|
|
|
|
* when the last frame has been sent out and there is no
|
|
|
|
* further frame (mbuf) in the tx queue.
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
rbch_tx_queue_empty(void *softc)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
struct rbch_softc *sc = softc;
|
|
|
|
|
|
|
|
if(sc->sc_devstate & ST_WRWAITEMPTY)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "(minor=%d): wakeup", sc->sc_unit);
|
|
|
|
sc->sc_devstate &= ~ST_WRWAITEMPTY;
|
2007-03-04 08:59:00 +03:00
|
|
|
wakeup((void *) &sc->sc_ilt->tx_queue);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
NDBGL4(L4_RBCHDBG, "(minor=%d) NO wakeup", sc->sc_unit);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
2008-03-01 17:16:49 +03:00
|
|
|
selnotify(&sc->selp, 0, 0);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* this routine is called from the HSCX interrupt handler
|
|
|
|
* each time a packet is received or transmitted
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2006-11-16 04:32:37 +03:00
|
|
|
rbch_activity(void *softc, int rxtx)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
struct rbch_softc *sc = softc;
|
|
|
|
|
|
|
|
if (sc->sc_cd)
|
|
|
|
sc->sc_cd->last_active_time = SECOND;
|
2008-03-01 17:16:49 +03:00
|
|
|
selnotify(&sc->selp, 0, 0);
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* clear an hdlc rx queue for a rbch unit
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static void
|
2002-03-17 12:45:58 +03:00
|
|
|
rbch_clrq(void *softc)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 12:45:58 +03:00
|
|
|
struct rbch_softc *sc = softc;
|
2001-01-05 15:49:52 +03:00
|
|
|
struct mbuf *m;
|
2001-01-19 15:44:44 +03:00
|
|
|
int s;
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
for(;;)
|
|
|
|
{
|
2001-01-19 15:44:44 +03:00
|
|
|
s = splnet();
|
2002-03-17 12:45:58 +03:00
|
|
|
IF_DEQUEUE(&sc->sc_hdlcq, m);
|
2001-01-19 15:44:44 +03:00
|
|
|
splx(s);
|
2005-02-27 01:31:44 +03:00
|
|
|
|
2001-01-05 15:49:52 +03:00
|
|
|
if(m)
|
|
|
|
m_freem(m);
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* setup the isdn_linktab for this driver
|
|
|
|
*---------------------------------------------------------------------------*/
|
2002-03-17 23:54:04 +03:00
|
|
|
static void
|
|
|
|
rbch_set_linktab(void *softc, isdn_link_t *ilt)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 23:54:04 +03:00
|
|
|
struct rbch_softc *sc = softc;
|
|
|
|
sc->sc_ilt = ilt;
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
|
|
|
* initialize this drivers linktab
|
|
|
|
*---------------------------------------------------------------------------*/
|
2002-03-17 23:54:04 +03:00
|
|
|
static void*
|
|
|
|
rbch_get_softc(int unit)
|
2001-01-05 15:49:52 +03:00
|
|
|
{
|
2002-03-17 23:54:04 +03:00
|
|
|
return &rbch_softc[unit];
|
2001-01-05 15:49:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
2002-03-16 19:55:51 +03:00
|
|
|
#endif /* NISDNBCHAN > 0 */
|