From owner-freebsd-isdn@FreeBSD.ORG Tue Jan 8 23:42:01 2013 Return-Path: Delivered-To: freebsd-isdn@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8ABC85C2 for ; Tue, 8 Jan 2013 23:42:01 +0000 (UTC) (envelope-from longwitz@incore.de) Received: from dss.incore.de (dss.incore.de [195.145.1.138]) by mx1.freebsd.org (Postfix) with ESMTP id 1DABD343 for ; Tue, 8 Jan 2013 23:42:00 +0000 (UTC) Received: from inetmail.dmz (inetmail.dmz [10.3.0.3]) by dss.incore.de (Postfix) with ESMTP id 1CBED5C754; Wed, 9 Jan 2013 00:41:52 +0100 (CET) X-Virus-Scanned: amavisd-new at incore.de Received: from dss.incore.de ([10.3.0.3]) by inetmail.dmz (inetmail.dmz [10.3.0.3]) (amavisd-new, port 10024) with LMTP id LQ5p6sA2JdMC; Wed, 9 Jan 2013 00:41:48 +0100 (CET) Received: from mail.incore (fwintern.dmz [10.0.0.253]) by dss.incore.de (Postfix) with ESMTP id 712685C62C; Wed, 9 Jan 2013 00:41:48 +0100 (CET) Received: from bsdmhs.longwitz (unknown [192.168.99.6]) by mail.incore (Postfix) with ESMTP id 082AB5083F; Wed, 9 Jan 2013 00:41:47 +0100 (CET) Message-ID: <50ECAEBB.3030604@incore.de> Date: Wed, 09 Jan 2013 00:41:47 +0100 From: Andreas Longwitz User-Agent: Thunderbird 2.0.0.19 (X11/20090113) MIME-Version: 1.0 To: Hans Petter Selasky , freebsd-isdn@freebsd.org Subject: Re: ISDN4BSD (HPS version) is going into ports References: <509E87EF.9070607@incore.de> <201211300844.37917.hselasky@c2i.net> <50BA8DB8.1090004@incore.de> <201212021043.53151.hselasky@c2i.net> In-Reply-To: <201212021043.53151.hselasky@c2i.net> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-isdn@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Using ISDN with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jan 2013 23:42:01 -0000 Hans Petter Selasky wrote: Hi, i have continued to get my AVM Fritz!Card version 2 PCI card working with isdn4bsd using isdnd and there is some progress: D-channel works correct now with isdn4bsd 2.0.6 and the following patch: --- i4b_filter.h.orig 2009-01-09 20:07:38.000000000 +0100 +++ i4b_filter.h 2013-01-08 18:23:01.000000000 +0100 @@ -158,6 +158,12 @@ (f->buf_len) -= (io_len); (f->Z_chip) -= (io_len); + /* Hack: is ihfc1 */ + if((FIFO_NO(f) == d1r) && sc->sc_nametmp[4] == '1' ) { + (f->buf_ptr) -= 1; + (f->buf_len) += 1; + } + return; } We have to read the complete D-channel message from the FIFO of the chip and then ignore always the last byte, because register rstad is always appended to every frame by the chip in transparent mode 0. It would be better to handle this in i4b_avm_pnp.h, but I did not know how to realize this. On my testserver the Fritzcard is ihfc1, therefore the patch includes the condition "sc->sc_nametmp[4] == '1'. > I see that my driver differs a bit from the origin. That's basically my fault, > when I did the porting, I tried to make things simpler. Maybe I have to port > more stuff from the working one. Mostly it requires some 32-bit register magic > instead of 8-bit register access. I'm using transparent mode only for B- > channels, and have optimised away some programming in that regard. > > http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pci/ifpci2.c?annotate=1.19.22.1 > > Can you try the attached patch? I have analyzed the i4b_ifpi2_pci.c source from FreeBSD 6 (nearly identical to the NetBSD source ifpci2.c) and found that your patch brings us a step forward to the way the BSD-source ifpci2.c works. But there are some more differences between isdn4bsd and BSD: 1. Access to the PCI bus via mem in isdn4bsd, via I/O port in BSD. 2. DELAY times on startup is different: 4 ms in isdn4bsd, 10 ms in BSD 3. Initializing the chip is more expansive in BSD, otherwise the register cmdrd is only used in isdn4bsd. 4. In avm_pci_fifo_reset() we write two single bytes, but BSD does one (atomic) four byte read. Particularly we do not write the HSCX_LEN byte between the both written bytes (must set to 0 ?) 5. In avm_pci_b_status_read() - analog to 4. - we read two single bytes, BSD (atomic) four bytes. 6. After an interrupt BSD checks explicit HSCX_INT_MASK before working, Afterwords the use of HSCX_INT_RPR and HSCX_INT_XPR seems a little bit different to me. 7. isdn4bsd and BSD both set HSCX_MODE_TRANS at startup, but BSD changes this to HSCX_MODE_ITF_FLAG (ITF: interframe time fill) at the moment a B-channel is coming up. Simultaneously the HSCX_CMD_RRS bit is dropped (RRS = ?). Especially the last point does not have a counterpart in isdn4bsd - or I am wrong ? -- Andreas Longwitz