Subject: Re: [q] Speed of modem port
To: Shunsuke Masuda <mi-nami@mahoroba.or.jp>
From: Bill Studenmund <wrstuden@loki.stanford.edu>
List: port-mac68k
Date: 12/05/1997 11:16:31
> Following your instruction and recompiling a kernel,I told 
> Booter1.11.0 to set the speed of modem port to 230400,
> dmesg said,
> >zsc0 channel 0: d_speed 9600 DCD clk 0 CTS clk 0
> >zstty0 at zsc0 channel 0
> >zsc0 channel 1: d_speed 9600 DCD clk 0 CTS clk 0
> >zstty1 at zsc0 channel 1
> 
> I thought this happened because function "zs_cn_check_speed" returns 0
> when "mac68k_machine.modem_d_speed" which Booter setenvs as 
> SERIAL_MODEM_DSPEED is 230400.

That's because the console code ONLY knows how to use the baud rate
generator on the internal clock. The patch I sent doesn't change that.

The patch enables programs using the tty driver to choose 230400 and
115200 as speeds.

> So I changed "zs_defspeed" to 230400,recompiled with ZSMACDEBUG,
> then
> >zsc0 channel 0: d_speed 230400 DCD clk 0 CTS clk 0
> >zstty0 at zsc0 channel 0
> >zsc0 channel 1: d_speed 230400 DCD clk 0 CTS clk 0
> >zstty1 at zsc0 channel 1

You've made serial console and serial echo useless. Change zs_defspeed
back. The printout works as it's just printing what you entered; there's
no bounds checking.

I assume you want to use something like ppp or lpd or getty at 230400.
All of these programs will set the serial port's speed to a speed of
your choosing.  The patch I sent will make that work w/ 115200 and
230400. You can do that regardless of what the default speed is.

> .....(snip).....
> >Checking for rate 230400. Found source #0.
> >Rate is  230400, tc is   65535, source no.  0, flags    4
> >Registers are: 4 40, 11 0, 14 0
> >
> >Checking for rate 230400. Found source #0.
> >Rate is  230400, tc is   65535, source no.  0, flags    4
> >Registers are: 4 40, 11 0, 14 0
> 
> I'm not sure if it is working, and am afraid of my misunderstanding.

Hook it up to something running at 230400 and see. :-)

This message is trying to tell you that the speed checking is looking
for a way to generate 230400, to within 5%. It found that clock source
0 (the internal clock) will do it. With that source, it can generate
230400 (no relative error in this case). "tc is" means the Baud Rate
Generator's constant is 65535, which is ok as we're directly dividing the
clock. "flags" represents any special flags relating to this clock
source (like it's "external", meaning the m.d. code has to set things up
for the m.i. driver to activate or deactivate the clock source). In this
case, it just says that the source involvs directly dividing the clock
source.

The "Registers" bit describes the clock-source-related bits in various
chip registers. 0x40 in register 4 means we're dividing the clock
source by 16. 0x0 in 11 means that both the transmit and receive clocks
are using the Receive clock source (correct), and 0x0 in 14 means the
BRG is turned off.

Looks ok.

Take care,

Bill