Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Fritz!PCI v2.0 ISDN driver from FreeBSD.
details: https://anonhg.NetBSD.org/src/rev/42a9c6fa21c5
branches: trunk
changeset: 538691:42a9c6fa21c5
user: leo <leo%NetBSD.org@localhost>
date: Fri Oct 25 21:03:47 2002 +0000
description:
Fritz!PCI v2.0 ISDN driver from FreeBSD.
diffstat:
sys/arch/i386/conf/GENERIC_ISDN | 5 +-
sys/conf/files | 17 +-
sys/dev/ic/isacsx.c | 675 +++++++++++++++++++
sys/dev/ic/isacsx.h | 595 +++++++++++++++++
sys/dev/ic/isic_l1.c | 20 +-
sys/dev/ic/isic_l1.h | 9 +-
sys/dev/ic/isic_l1fsm.c | 35 +-
sys/dev/pci/files.pci | 8 +-
sys/dev/pci/ifpci2.c | 1327 +++++++++++++++++++++++++++++++++++++++
9 files changed, 2673 insertions(+), 18 deletions(-)
diffs (truncated from 2843 to 300 lines):
diff -r 2a126d28c312 -r 42a9c6fa21c5 sys/arch/i386/conf/GENERIC_ISDN
--- a/sys/arch/i386/conf/GENERIC_ISDN Fri Oct 25 21:02:45 2002 +0000
+++ b/sys/arch/i386/conf/GENERIC_ISDN Fri Oct 25 21:03:47 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC_ISDN,v 1.10 2002/10/01 12:56:40 fvdl Exp $
+# $NetBSD: GENERIC_ISDN,v 1.11 2002/10/25 21:03:47 leo Exp $
#
# GENERIC kernel with all supported ISDN devices and drivers
@@ -57,6 +57,9 @@
# AVM Fritz!PCI card
ifpci* at pci?
+# AVM Fritz!PCI V2 card
+ifritz* at pci?
+
#
#---------------------------------------------------------------------
# Supported PCMCIA cards:
diff -r 2a126d28c312 -r 42a9c6fa21c5 sys/conf/files
--- a/sys/conf/files Fri Oct 25 21:02:45 2002 +0000
+++ b/sys/conf/files Fri Oct 25 21:03:47 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.574 2002/10/23 09:12:56 jdolecek Exp $
+# $NetBSD: files,v 1.575 2002/10/25 21:03:47 leo Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -875,14 +875,21 @@
define passive_isdn # files needed by passive cards (XXX - protocol
# specific)
+# The isac found on the Fritz V2.0 Card.
+define nisacsx
+file dev/ic/isacsx.c nisacsx needs-flag
+
+# The 'standard' isac
+define nisac
+file dev/ic/isac.c nisac needs-flag
+
# ISDN cards based on the Siemens ISAC/HSCX chipset (or lookalikes)
#
-device isic: isdndev, passive_isdn
+device isic: isdndev, passive_isdn, nisac
file dev/ic/isic.c isic
-file dev/ic/isac.c isic|ifpci
-file dev/ic/isic_l1.c isic|ifpci
-file dev/ic/isic_l1fsm.c isic|ifpci
+file dev/ic/isic_l1.c isic|ifpci|ifritz
+file dev/ic/isic_l1fsm.c isic|ifpci|ifritz
file dev/ic/hscx.c isic
file dev/ic/isic_bchan.c isic
diff -r 2a126d28c312 -r 42a9c6fa21c5 sys/dev/ic/isacsx.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/ic/isacsx.c Fri Oct 25 21:03:47 2002 +0000
@@ -0,0 +1,675 @@
+/* $NetBSD: isacsx.c,v 1.1 2002/10/25 21:03:48 leo Exp $ */
+/*
+ * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 2001 Gary Jennejohn. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 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_ifpi2_isac.c - i4b Fritz PCI Version 2 ISACSX handler
+ * --------------------------------------------
+ *
+ * $Id: isacsx.c,v 1.1 2002/10/25 21:03:48 leo Exp $
+ *
+ * $FreeBSD: src/sys/i4b/layer1/ifpi2/i4b_ifpi2_isacsx.c,v 1.3 2002/09/02 00:52:07 brooks Exp $
+ *
+ *
+ *---------------------------------------------------------------------------*/
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: isacsx.c,v 1.1 2002/10/25 21:03:48 leo Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+
+
+#include <net/if.h>
+
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
+#include <sys/callout.h>
+#endif
+
+#ifdef __FreeBSD__
+#include <machine/i4b_debug.h>
+#include <machine/i4b_ioctl.h>
+#include <machine/i4b_trace.h>
+
+#include <i4b/layer1/i4b_l1.h>
+
+#include <i4b/layer1/isic/i4b_isic.h>
+#include <i4b/layer1/isic/i4b_hscx.h>
+
+#include <i4b/layer1/ifpi2/i4b_ifpi2_ext.h>
+#include <i4b/layer1/ifpi2/i4b_ifpi2_isacsx.h>
+
+#include <i4b/include/i4b_global.h>
+#include <i4b/include/i4b_mbuf.h>
+#else
+#include <machine/bus.h>
+
+#include <netisdn/i4b_debug.h>
+#include <netisdn/i4b_ioctl.h>
+#include <netisdn/i4b_trace.h>
+
+#include <netisdn/i4b_global.h>
+#include <netisdn/i4b_l2.h>
+#include <netisdn/i4b_l1l2.h>
+#include <netisdn/i4b_mbuf.h>
+
+#include <dev/ic/isacsx.h>
+#include <dev/ic/isic_l1.h>
+#include <dev/ic/hscx.h>
+
+#endif
+
+static u_char isic_isacsx_exir_hdlr(register struct isic_softc *sc, u_char exir);
+static void isic_isacsx_ind_hdlr(register struct isic_softc *sc, int ind);
+
+/* the ISACSX has 2 mask registers of interest - cannot use ISAC_IMASK */
+unsigned char isacsx_imaskd;
+unsigned char isacsx_imask;
+
+/*---------------------------------------------------------------------------*
+ * ISACSX interrupt service routine
+ *---------------------------------------------------------------------------*/
+void
+isic_isacsx_irq(struct isic_softc *sc, int ista)
+{
+ register u_char c = 0;
+ register u_char istad = 0;
+
+ NDBGL1(L1_F_MSG, "%s: ista = 0x%02x", sc->sc_dev.dv_xname, ista);
+
+ /* was it an HDLC interrupt ? */
+ if (ista & ISACSX_ISTA_ICD)
+ {
+ istad = ISAC_READ(I_ISTAD);
+ NDBGL1(L1_F_MSG, "%s: istad = 0x%02x", sc->sc_dev.dv_xname, istad);
+
+ if(istad & (ISACSX_ISTAD_RFO|ISACSX_ISTAD_XMR|ISACSX_ISTAD_XDU))
+ {
+ /* not really EXIR, but very similar */
+ c |= isic_isacsx_exir_hdlr(sc, istad);
+ }
+ }
+
+ if(istad & ISACSX_ISTAD_RME) /* receive message end */
+ {
+ register int rest;
+ u_char rsta;
+
+ /* get rx status register */
+
+ rsta = ISAC_READ(I_RSTAD);
+
+ /* Check for Frame and CRC valid */
+ if((rsta & ISACSX_RSTAD_MASK) != (ISACSX_RSTAD_VFR|ISACSX_RSTAD_CRC))
+ {
+ int error = 0;
+
+ if(!(rsta & ISACSX_RSTAD_VFR)) /* VFR error */
+ {
+ error++;
+ NDBGL1(L1_I_ERR, "%s: Frame not valid error", sc->sc_dev.dv_xname);
+ }
+
+ if(!(rsta & ISACSX_RSTAD_CRC)) /* CRC error */
+ {
+ error++;
+ NDBGL1(L1_I_ERR, "%s: CRC error", sc->sc_dev.dv_xname);
+ }
+
+ if(rsta & ISACSX_RSTAD_RDO) /* ReceiveDataOverflow */
+ {
+ error++;
+ NDBGL1(L1_I_ERR, "%s: Data Overrun error", sc->sc_dev.dv_xname);
+ }
+
+ if(rsta & ISACSX_RSTAD_RAB) /* ReceiveABorted */
+ {
+ error++;
+ NDBGL1(L1_I_ERR, "%s: Receive Aborted error", sc->sc_dev.dv_xname);
+ }
+
+ if(error == 0)
+ NDBGL1(L1_I_ERR, "%s: RME unknown error, RSTAD = 0x%02x!", sc->sc_dev.dv_xname, rsta);
+
+ i4b_Dfreembuf(sc->sc_ibuf);
+
+ c |= ISACSX_CMDRD_RMC|ISACSX_CMDRD_RRES;
+
+ sc->sc_ibuf = NULL;
+ sc->sc_ib = NULL;
+ sc->sc_ilen = 0;
+
+ ISAC_WRITE(I_CMDRD, ISACSX_CMDRD_RMC|ISACSX_CMDRD_RRES);
+
+ return;
+ }
+
+ rest = (ISAC_READ(I_RBCLD) & (ISACSX_FIFO_LEN-1));
+
+ if(rest == 0)
+ rest = ISACSX_FIFO_LEN;
+
+ if(sc->sc_ibuf == NULL)
+ {
+ if((sc->sc_ibuf = i4b_Dgetmbuf(rest)) != NULL)
+ sc->sc_ib = sc->sc_ibuf->m_data;
+ else
+ panic("isic_isacsx_irq: RME, i4b_Dgetmbuf returns NULL!\n");
+ sc->sc_ilen = 0;
+ }
+
+ if(sc->sc_ilen <= (MAX_DFRAME_LEN - rest))
+ {
+ ISAC_RDFIFO(sc->sc_ib, rest);
+ /* the last byte contains status, strip it */
+ sc->sc_ilen += rest - 1;
+
+ sc->sc_ibuf->m_pkthdr.len =
+ sc->sc_ibuf->m_len = sc->sc_ilen;
+
+ if(sc->sc_trace & TRACE_D_RX)
+ {
+ i4b_trace_hdr hdr;
+
+ memset(&hdr, 0, sizeof hdr);
+ hdr.type = TRC_CH_D;
+ hdr.dir = FROM_NT;
+ hdr.count = ++sc->sc_trace_dcount;
+ isdn_layer2_trace_ind(&sc->sc_l2, sc->sc_l3token, &hdr, sc->sc_ibuf->m_len, sc->sc_ibuf->m_data);
+ }
+
+ c |= ISACSX_CMDRD_RMC;
+
+ if(sc->sc_intr_valid == ISIC_INTR_VALID &&
+ (((struct isdn_l3_driver*)sc->sc_l3token)->protocol != PROTOCOL_D64S))
+ {
+ isdn_layer2_data_ind(&sc->sc_l2, sc->sc_l3token, sc->sc_ibuf);
+ }
+ else
+ {
+ i4b_Dfreembuf(sc->sc_ibuf);
+ }
+ }
+ else
+ {
+ NDBGL1(L1_I_ERR, "RME, input buffer overflow!");
+ i4b_Dfreembuf(sc->sc_ibuf);
+ c |= ISACSX_CMDRD_RMC|ISACSX_CMDRD_RRES;
+ }
+
+ sc->sc_ibuf = NULL;
+ sc->sc_ib = NULL;
+ sc->sc_ilen = 0;
+ }
+
+ if(istad & ISACSX_ISTAD_RPF) /* receive fifo full */
+ {
+ if(sc->sc_ibuf == NULL)
+ {
+ if((sc->sc_ibuf = i4b_Dgetmbuf(MAX_DFRAME_LEN)) != NULL)
+ sc->sc_ib= sc->sc_ibuf->m_data;
+ else
+ panic("isic_isacsx_irq: RPF, i4b_Dgetmbuf returns NULL!\n");
+ sc->sc_ilen = 0;
+ }
+
+ if(sc->sc_ilen <= (MAX_DFRAME_LEN - ISACSX_FIFO_LEN))
+ {
Home |
Main Index |
Thread Index |
Old Index