2 * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 *---------------------------------------------------------------------------
27 * i4b_rbch.c - device driver for raw B channel data
28 * ---------------------------------------------------
30 * $FreeBSD: src/sys/i4b/driver/i4b_rbch.c,v 1.10.2.3 2001/08/12 16:22:48 hm Exp $
32 * last edit-date: [Sat Aug 11 18:06:57 2001]
34 *---------------------------------------------------------------------------*/
36 #include "use_i4brbch.h"
40 #include <sys/param.h>
41 #include <sys/systm.h>
45 #include <sys/kernel.h>
47 #include <sys/socket.h>
50 #include <sys/thread2.h>
51 #include <sys/vnode.h>
53 #include <net/i4b/include/machine/i4b_ioctl.h>
54 #include <net/i4b/include/machine/i4b_rbch_ioctl.h>
55 #include <net/i4b/include/machine/i4b_debug.h>
57 #include "../include/i4b_global.h"
58 #include "../include/i4b_mbuf.h"
59 #include "../include/i4b_l3l4.h"
60 #include "../layer4/i4b_l4.h"
62 #include <sys/event.h>
63 #include <sys/filio.h>
65 static drvr_link_t rbch_drvr_linktab[NI4BRBCH];
66 static isdn_link_t *isdn_linktab[NI4BRBCH];
68 #define I4BRBCHACCT 1 /* enable accounting messages */
69 #define I4BRBCHACCTINTVL 2 /* accounting msg interval in secs */
71 static struct rbch_softc {
73 int sc_unit; /* unit number */
75 int sc_devstate; /* state of driver */
77 #define ST_CONNECTED 0x01
78 #define ST_ISOPEN 0x02
79 #define ST_RDWAITDATA 0x04
80 #define ST_WRWAITEMPTY 0x08
81 #define ST_NOBLOCK 0x10
83 int sc_bprot; /* B-ch protocol used */
85 call_desc_t *sc_cd; /* Call Descriptor */
89 struct ifqueue sc_hdlcq; /* hdlc read queue */
90 #define I4BRBCHMAXQLEN 10
92 struct kqinfo kqp; /* select / poll / kevent */
95 struct callout sc_timeout;
97 int sc_iinb; /* isdn driver # of inbytes */
98 int sc_ioutb; /* isdn driver # of outbytes */
99 int sc_linb; /* last # of bytes rx'd */
100 int sc_loutb; /* last # of bytes tx'd */
101 int sc_fn; /* flag, first null acct */
103 } rbch_softc[NI4BRBCH];
105 static void rbch_rx_data_rdy(int unit);
106 static void rbch_tx_queue_empty(int unit);
107 static void rbch_connect(int unit, void *cdp);
108 static void rbch_disconnect(int unit, void *cdp);
109 static void rbch_init_linktab(int unit);
110 static void rbch_clrq(int unit);
112 #define PDEVSTATIC static
113 #define IOCTL_CMD_T u_long
115 PDEVSTATIC d_open_t i4brbchopen;
116 PDEVSTATIC d_close_t i4brbchclose;
117 PDEVSTATIC d_read_t i4brbchread;
118 PDEVSTATIC d_write_t i4brbchwrite;
119 PDEVSTATIC d_ioctl_t i4brbchioctl;
120 PDEVSTATIC d_kqfilter_t i4brbchkqfilter;
122 PDEVSTATIC void i4brbchkfilt_detach(struct knote *);
123 PDEVSTATIC int i4brbchkfilt_read(struct knote *, long);
124 PDEVSTATIC int i4brbchkfilt_write(struct knote *, long);
126 static struct dev_ops i4brbch_ops = {
128 .d_open = i4brbchopen,
129 .d_close = i4brbchclose,
130 .d_read = i4brbchread,
131 .d_write = i4brbchwrite,
132 .d_ioctl = i4brbchioctl,
133 .d_kqfilter = i4brbchkqfilter
136 static void i4brbchattach(void *);
137 PSEUDO_SET(i4brbchattach, i4b_rbch);
139 /*===========================================================================*
140 * DEVICE DRIVER ROUTINES
141 *===========================================================================*/
143 /*---------------------------------------------------------------------------*
144 * interface attach routine
145 *---------------------------------------------------------------------------*/
147 i4brbchattach(void *dummy)
151 #ifndef HACK_NO_PSEUDO_ATTACH_MSG
152 kprintf("i4brbch: %d raw B channel access device(s) attached\n", NI4BRBCH);
155 for(i=0; i < NI4BRBCH; i++)
157 make_dev(&i4brbch_ops, i,
158 UID_ROOT, GID_WHEEL, 0600, "i4brbch%d", i);
161 callout_init(&rbch_softc[i].sc_timeout);
162 rbch_softc[i].sc_fn = 1;
164 rbch_softc[i].sc_unit = i;
165 rbch_softc[i].sc_devstate = ST_IDLE;
166 rbch_softc[i].sc_hdlcq.ifq_maxlen = I4BRBCHMAXQLEN;
167 rbch_softc[i].it_in.c_ispeed = rbch_softc[i].it_in.c_ospeed = 64000;
168 termioschars(&rbch_softc[i].it_in);
169 rbch_init_linktab(i);
173 /*---------------------------------------------------------------------------*
175 *---------------------------------------------------------------------------*/
177 i4brbchopen(struct dev_open_args *ap)
179 cdev_t dev = ap->a_head.a_dev;
180 int unit = minor(dev);
185 if(rbch_softc[unit].sc_devstate & ST_ISOPEN)
192 rbch_softc[unit].sc_devstate |= ST_ISOPEN;
194 NDBGL4(L4_RBCHDBG, "unit %d, open", unit);
199 /*---------------------------------------------------------------------------*
201 *---------------------------------------------------------------------------*/
203 i4brbchclose(struct dev_close_args *ap)
205 cdev_t dev = ap->a_head.a_dev;
206 int unit = minor(dev);
207 struct rbch_softc *sc = &rbch_softc[unit];
209 if(sc->sc_devstate & ST_CONNECTED)
210 i4b_l4_drvrdisc(BDRV_RBCH, unit);
212 sc->sc_devstate &= ~ST_ISOPEN;
216 NDBGL4(L4_RBCHDBG, "unit %d, closed", unit);
221 /*---------------------------------------------------------------------------*
222 * read from rbch device
223 *---------------------------------------------------------------------------*/
225 i4brbchread(struct dev_read_args *ap)
227 cdev_t dev = ap->a_head.a_dev;
228 struct uio *uio = ap->a_uio;
231 int unit = minor(dev);
233 struct rbch_softc *sc = &rbch_softc[unit];
237 NDBGL4(L4_RBCHDBG, "unit %d, enter read", unit);
240 if(!(sc->sc_devstate & ST_ISOPEN))
243 NDBGL4(L4_RBCHDBG, "unit %d, read while not open", unit);
247 if((sc->sc_devstate & ST_NOBLOCK) || (ap->a_ioflag & IO_NDELAY))
249 if(!(sc->sc_devstate & ST_CONNECTED)) {
254 if(sc->sc_bprot == BPROT_RHDLC)
257 iqp = isdn_linktab[unit]->rx_queue;
259 if(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN)) {
266 while(!(sc->sc_devstate & ST_CONNECTED))
268 NDBGL4(L4_RBCHDBG, "unit %d, wait read init", unit);
270 if((error = tsleep((caddr_t) &rbch_softc[unit],
271 PCATCH, "rrrbch", 0 )) != 0)
274 NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep", unit, error);
279 if(sc->sc_bprot == BPROT_RHDLC)
282 iqp = isdn_linktab[unit]->rx_queue;
284 while(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN))
286 sc->sc_devstate |= ST_RDWAITDATA;
288 NDBGL4(L4_RBCHDBG, "unit %d, wait read data", unit);
290 if((error = tsleep((caddr_t) &isdn_linktab[unit]->rx_queue,
291 PCATCH, "rrbch", 0 )) != 0)
294 NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep read", unit, error);
295 sc->sc_devstate &= ~ST_RDWAITDATA;
303 NDBGL4(L4_RBCHDBG, "unit %d, read %d bytes", unit, m->m_len);
307 error = uiomove(m->m_data, m->m_len, uio);
311 NDBGL4(L4_RBCHDBG, "unit %d, error %d uiomove", unit, error);
323 /*---------------------------------------------------------------------------*
324 * write to rbch device
325 *---------------------------------------------------------------------------*/
327 i4brbchwrite(struct dev_write_args *ap)
329 cdev_t dev = ap->a_head.a_dev;
330 struct uio *uio = ap->a_uio;
333 int unit = minor(dev);
334 struct rbch_softc *sc = &rbch_softc[unit];
338 NDBGL4(L4_RBCHDBG, "unit %d, write", unit);
341 if(!(sc->sc_devstate & ST_ISOPEN))
343 NDBGL4(L4_RBCHDBG, "unit %d, write while not open", unit);
348 if((sc->sc_devstate & ST_NOBLOCK) || (ap->a_ioflag & IO_NDELAY))
350 if(!(sc->sc_devstate & ST_CONNECTED)) {
354 if(IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) {
361 while(!(sc->sc_devstate & ST_CONNECTED))
363 NDBGL4(L4_RBCHDBG, "unit %d, write wait init", unit);
365 error = tsleep((caddr_t) &rbch_softc[unit],
366 PCATCH, "wrrbch", 0 );
367 if(error == ERESTART) {
371 else if(error == EINTR)
374 NDBGL4(L4_RBCHDBG, "unit %d, EINTR during wait init", unit);
380 NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep init", unit, error);
383 tsleep((caddr_t) &rbch_softc[unit], PCATCH, "xrbch", (hz*1));
386 while(IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN))
388 sc->sc_devstate |= ST_WRWAITEMPTY;
390 NDBGL4(L4_RBCHDBG, "unit %d, write queue full", unit);
392 if ((error = tsleep((caddr_t) &isdn_linktab[unit]->tx_queue,
393 PCATCH, "wrbch", 0)) != 0) {
394 sc->sc_devstate &= ~ST_WRWAITEMPTY;
395 if(error == ERESTART)
400 else if(error == EINTR)
403 NDBGL4(L4_RBCHDBG, "unit %d, EINTR during wait write", unit);
409 NDBGL4(L4_RBCHDBG, "unit %d, error %d tsleep write", unit, error);
416 if(!(sc->sc_devstate & ST_ISOPEN))
418 NDBGL4(L4_RBCHDBG, "unit %d, not open anymore", unit);
423 if((m = i4b_Bgetmbuf(BCH_MAX_DATALEN)) != NULL)
425 m->m_len = (int)szmin(BCH_MAX_DATALEN, uio->uio_resid);
427 NDBGL4(L4_RBCHDBG, "unit %d, write %d bytes", unit, m->m_len);
429 error = uiomove(m->m_data, (size_t)m->m_len, uio);
431 if(IF_QFULL(isdn_linktab[unit]->tx_queue))
434 IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m);
435 (*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel);
443 /*---------------------------------------------------------------------------*
444 * rbch device ioctl handlibg
445 *---------------------------------------------------------------------------*/
447 i4brbchioctl(struct dev_ioctl_args *ap)
449 cdev_t dev = ap->a_head.a_dev;
451 int unit = minor(dev);
452 struct rbch_softc *sc = &rbch_softc[unit];
456 case FIOASYNC: /* Set async mode */
457 if (*(int *)ap->a_data)
459 NDBGL4(L4_RBCHDBG, "unit %d, setting async mode", unit);
463 NDBGL4(L4_RBCHDBG, "unit %d, clearing async mode", unit);
467 case TIOCCDTR: /* Clear DTR */
468 if(sc->sc_devstate & ST_CONNECTED)
470 NDBGL4(L4_RBCHDBG, "unit %d, disconnecting for DTR down", unit);
471 i4b_l4_drvrdisc(BDRV_RBCH, unit);
475 case I4B_RBCH_DIALOUT:
479 for (l = 0; l < TELNO_MAX && ((char *)ap->a_data)[l]; l++)
483 NDBGL4(L4_RBCHDBG, "unit %d, attempting dialout to %s", unit, (char *)ap->a_data);
484 i4b_l4_dialoutnumber(BDRV_RBCH, unit, l, (char *)ap->a_data);
487 /* fall through to SDTR */
490 case TIOCSDTR: /* Set DTR */
491 NDBGL4(L4_RBCHDBG, "unit %d, attempting dialout (DTR)", unit);
492 i4b_l4_dialout(BDRV_RBCH, unit);
495 case TIOCSETA: /* Set termios struct */
498 case TIOCGETA: /* Get termios struct */
499 *(struct termios *)ap->a_data = sc->it_in;
503 *(int *)ap->a_data = TIOCM_LE|TIOCM_DTR|TIOCM_RTS|TIOCM_CTS|TIOCM_DSR;
504 if (sc->sc_devstate & ST_CONNECTED)
505 *(int *)ap->a_data |= TIOCM_CD;
508 case I4B_RBCH_VR_REQ:
512 mvr = (msg_vr_req_t *)ap->a_data;
514 mvr->version = VERSION;
520 default: /* Unknown stuff */
521 NDBGL4(L4_RBCHDBG, "unit %d, ioctl, unknown cmd %lx", unit, ap->a_cmd);
528 /*---------------------------------------------------------------------------*
530 *---------------------------------------------------------------------------*/
531 static struct filterops i4brbchkfiltops_read =
532 { FILTEROP_ISFD, NULL, i4brbchkfilt_detach, i4brbchkfilt_read };
533 static struct filterops i4brbchkfiltops_write =
534 { FILTEROP_ISFD, NULL, i4brbchkfilt_detach, i4brbchkfilt_write };
537 i4brbchkqfilter(struct dev_kqfilter_args *ap)
539 cdev_t dev = ap->a_head.a_dev;
540 int unit = minor(dev);
541 struct rbch_softc *sc = &rbch_softc[unit];
542 struct knote *kn = ap->a_kn;
547 switch (kn->kn_filter) {
549 kn->kn_fop = &i4brbchkfiltops_read;
550 kn->kn_hook = (caddr_t)dev;
553 kn->kn_fop = &i4brbchkfiltops_write;
554 kn->kn_hook = (caddr_t)dev;
557 ap->a_result = EOPNOTSUPP;
561 klist = &sc->kqp.ki_note;
562 knote_insert(klist, kn);
568 i4brbchkfilt_detach(struct knote *kn)
570 cdev_t dev = (cdev_t)kn->kn_hook;
571 int unit = minor(dev);
572 struct rbch_softc *sc = &rbch_softc[unit];
575 klist = &sc->kqp.ki_note;
576 knote_remove(klist, kn);
580 i4brbchkfilt_read(struct knote *kn, long hint)
582 cdev_t dev = (cdev_t)kn->kn_hook;
583 int unit = minor(dev);
584 struct rbch_softc *sc = &rbch_softc[unit];
589 if (!(sc->sc_devstate & ST_ISOPEN)) {
591 kn->kn_flags |= EV_ERROR;
596 if (sc->sc_devstate & ST_CONNECTED) {
599 if(sc->sc_bprot == BPROT_RHDLC)
602 iqp = isdn_linktab[unit]->rx_queue;
614 i4brbchkfilt_write(struct knote *kn, long hint)
616 cdev_t dev = (cdev_t)kn->kn_hook;
617 int unit = minor(dev);
618 struct rbch_softc *sc = &rbch_softc[unit];
623 if (!(sc->sc_devstate & ST_ISOPEN)) {
625 kn->kn_flags |= EV_ERROR;
631 * Writes are OK if we are connected and the
632 * transmit queue can take them
634 if ((sc->sc_devstate & ST_CONNECTED) &&
635 !IF_QFULL(isdn_linktab[unit]->tx_queue))
646 /*---------------------------------------------------------------------------*
648 *---------------------------------------------------------------------------*/
650 rbch_timeout(struct rbch_softc *sc)
652 bchan_statistics_t bs;
653 int unit = sc->sc_unit;
655 /* get # of bytes in and out from the HSCX driver */
657 (*isdn_linktab[unit]->bch_stat)
658 (isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
660 sc->sc_ioutb += bs.outbytes;
661 sc->sc_iinb += bs.inbytes;
663 if((sc->sc_iinb != sc->sc_linb) || (sc->sc_ioutb != sc->sc_loutb) || sc->sc_fn)
665 int ri = (sc->sc_iinb - sc->sc_linb)/I4BRBCHACCTINTVL;
666 int ro = (sc->sc_ioutb - sc->sc_loutb)/I4BRBCHACCTINTVL;
668 if((sc->sc_iinb == sc->sc_linb) && (sc->sc_ioutb == sc->sc_loutb))
673 sc->sc_linb = sc->sc_iinb;
674 sc->sc_loutb = sc->sc_ioutb;
676 i4b_l4_accounting(BDRV_RBCH, unit, ACCT_DURING,
677 sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_ioutb, sc->sc_iinb);
679 callout_reset(&sc->sc_timeout, I4BRBCHACCTINTVL * hz,
680 (void *)rbch_timeout, sc);
682 #endif /* I4BRBCHACCT */
684 /*===========================================================================*
685 * ISDN INTERFACE ROUTINES
686 *===========================================================================*/
688 /*---------------------------------------------------------------------------*
689 * this routine is called from L4 handler at connect time
690 *---------------------------------------------------------------------------*/
692 rbch_connect(int unit, void *cdp)
694 call_desc_t *cd = (call_desc_t *)cdp;
695 struct rbch_softc *sc = &rbch_softc[unit];
697 sc->sc_bprot = cd->bprot;
700 if(sc->sc_bprot == BPROT_RHDLC)
707 callout_reset(&sc->sc_timeout, I4BRBCHACCTINTVL * hz,
708 (void *)rbch_timeout, sc);
711 if(!(sc->sc_devstate & ST_CONNECTED))
713 NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit);
714 sc->sc_devstate |= ST_CONNECTED;
720 /*---------------------------------------------------------------------------*
721 * this routine is called from L4 handler at disconnect time
722 *---------------------------------------------------------------------------*/
724 rbch_disconnect(int unit, void *cdp)
726 call_desc_t *cd = (call_desc_t *)cdp;
727 struct rbch_softc *sc = &rbch_softc[unit];
733 NDBGL4(L4_RBCHDBG, "rbch%d: channel %d not active",
734 cd->driver_unit, cd->channelid);
740 NDBGL4(L4_RBCHDBG, "unit %d, disconnect", unit);
742 sc->sc_devstate &= ~ST_CONNECTED;
747 i4b_l4_accounting(BDRV_RBCH, unit, ACCT_FINAL,
748 sc->sc_ioutb, sc->sc_iinb, 0, 0, sc->sc_ioutb, sc->sc_iinb);
749 callout_stop(&sc->sc_timeout);
754 /*---------------------------------------------------------------------------*
755 * feedback from daemon in case of dial problems
756 *---------------------------------------------------------------------------*/
758 rbch_dialresponse(int unit, int status, cause_t cause)
762 /*---------------------------------------------------------------------------*
764 *---------------------------------------------------------------------------*/
766 rbch_updown(int unit, int updown)
770 /*---------------------------------------------------------------------------*
771 * this routine is called from the HSCX interrupt handler
772 * when a new frame (mbuf) has been received and is to be put on
774 *---------------------------------------------------------------------------*/
776 rbch_rx_data_rdy(int unit)
778 if(rbch_softc[unit].sc_bprot == BPROT_RHDLC)
782 if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
785 m->m_pkthdr.len = m->m_len;
787 if(IF_QFULL(&(rbch_softc[unit].sc_hdlcq)))
789 NDBGL4(L4_RBCHDBG, "unit %d: hdlc rx queue full!", unit);
794 IF_ENQUEUE(&(rbch_softc[unit].sc_hdlcq), m);
798 if(rbch_softc[unit].sc_devstate & ST_RDWAITDATA)
800 NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit);
801 rbch_softc[unit].sc_devstate &= ~ST_RDWAITDATA;
802 wakeup((caddr_t) &isdn_linktab[unit]->rx_queue);
806 NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit);
808 KNOTE(&rbch_softc[unit].kqp.ki_note, 0);
811 /*---------------------------------------------------------------------------*
812 * this routine is called from the HSCX interrupt handler
813 * when the last frame has been sent out and there is no
814 * further frame (mbuf) in the tx queue.
815 *---------------------------------------------------------------------------*/
817 rbch_tx_queue_empty(int unit)
819 if(rbch_softc[unit].sc_devstate & ST_WRWAITEMPTY)
821 NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit);
822 rbch_softc[unit].sc_devstate &= ~ST_WRWAITEMPTY;
823 wakeup((caddr_t) &isdn_linktab[unit]->tx_queue);
827 NDBGL4(L4_RBCHDBG, "unit %d, NO wakeup", unit);
829 KNOTE(&rbch_softc[unit].kqp.ki_note, 0);
832 /*---------------------------------------------------------------------------*
833 * this routine is called from the HSCX interrupt handler
834 * each time a packet is received or transmitted
835 *---------------------------------------------------------------------------*/
837 rbch_activity(int unit, int rxtx)
839 if (rbch_softc[unit].sc_cd)
840 rbch_softc[unit].sc_cd->last_active_time = SECOND;
841 KNOTE(&rbch_softc[unit].kqp.ki_note, 0);
844 /*---------------------------------------------------------------------------*
845 * clear an hdlc rx queue for a rbch unit
846 *---------------------------------------------------------------------------*/
853 IF_DRAIN(&rbch_softc[unit].sc_hdlcq);
857 /*---------------------------------------------------------------------------*
858 * return this drivers linktab address
859 *---------------------------------------------------------------------------*/
861 rbch_ret_linktab(int unit)
863 rbch_init_linktab(unit);
864 return(&rbch_drvr_linktab[unit]);
867 /*---------------------------------------------------------------------------*
868 * setup the isdn_linktab for this driver
869 *---------------------------------------------------------------------------*/
871 rbch_set_linktab(int unit, isdn_link_t *ilt)
873 isdn_linktab[unit] = ilt;
876 /*---------------------------------------------------------------------------*
877 * initialize this drivers linktab
878 *---------------------------------------------------------------------------*/
880 rbch_init_linktab(int unit)
882 rbch_drvr_linktab[unit].unit = unit;
883 rbch_drvr_linktab[unit].bch_rx_data_ready = rbch_rx_data_rdy;
884 rbch_drvr_linktab[unit].bch_tx_queue_empty = rbch_tx_queue_empty;
885 rbch_drvr_linktab[unit].bch_activity = rbch_activity;
886 rbch_drvr_linktab[unit].line_connected = rbch_connect;
887 rbch_drvr_linktab[unit].line_disconnected = rbch_disconnect;
888 rbch_drvr_linktab[unit].dial_response = rbch_dialresponse;
889 rbch_drvr_linktab[unit].updown_ind = rbch_updown;
892 /*===========================================================================*/
894 #endif /* NI4BRBCH > 0 */