ISDN4BSD (HPS version) is going into ports

Andreas Longwitz longwitz at incore.de
Tue Jan 8 23:42:01 UTC 2013


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:  <AVM Fritz!Card version 2 PCI> 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



More information about the freebsd-isdn mailing list