Subject: Re: sys/dev/ic/z8530tty.c 1.52 -> 1.53 is broken.
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Dr. Bill Studenmund <wrstuden@loki.stanford.edu>
List: tech-kern
Date: 01/25/1999 16:35:34
On Mon, 25 Jan 1999, Jonathan Stone wrote:

> If this really is an attribute of how Mac hardware wires up external
> clock signals, then shouldn't the Mac-specific attach frontends be
> telling the MI code about that via an attach-time flag, rather than
> a #if 0/ #if 1 compile-time option?

It's not a compile-time option. :-) The #if covers code I had put into
z8530tty.c before 1.3, which Charles stuck in an #if 0 when he made the
com and z8530tty drivers work about the same.

Here's the code in question:

#if 1 
        if (ISSET(cs->cs_rr0_mask, ZSRR0_DCD))
                SET(tmp15, ZSWR15_DCD_IE); 
        else
                CLR(tmp15, ZSWR15_DCD_IE);
        if (ISSET(cs->cs_rr0_mask, ZSRR0_CTS))
                SET(tmp15, ZSWR15_CTS_IE);
        else
                CLR(tmp15, ZSWR15_CTS_IE);
#else
        SET(tmp15, ZSWR15_DCD_IE | ZSWR15_CTS_IE);
#endif

The now-activated code will enable/disable interrupts as per the bits in
cs->cs_rr0_mask. cs_rr0_mask contains the csr bits which, when changed,
generate a status soft interupt. If we're doing cXXXcts flow control, then
ZSRR0_CTS is in there. If we're doing mdmbuf flow control or are talking
to a modem, then ZSRR0_DCD is in there.

The way the mac68k (and eventually macppc) drivers work is that if an
external clock source is present on one of these pins, then the
corresponding csr bit is never going to show up in cs_rr0_mask, so we'll
never enable interrupts on these pins.

Since I want to get a MIDI keyboard to use w/ my mac, I care that this
stuff works (MIDI interfaces for mac serial ports feed either a 2 MHz, 1
MHz or 0.5 MHz clock on one of the pins which lets the serial port
generate the 31.25 kb/s data rate for MIDI). :-)

This change shouldn't make a difference for other platforms. Please let me
know if it does.

If I get a chance, I'll try for all of the stuff Charles mentioned. Though
someone can beat me to it. :-)

Take care,

Bill