NetBSD Problem Report #1475

From gnats  Tue Sep 19 03:55:53 1995
Received: from uran.informatik.uni-bonn.de (root@uran.informatik.uni-bonn.de [131.220.8.49]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id DAA09416 for <gnats-bugs@gnats.netbsd.org>; Tue, 19 Sep 1995 03:55:46 -0400
Message-Id: <199509190737.JAA00306@beverly.rhein.de>
Date: Tue, 19 Sep 1995 09:37:34 +0200
From: Ignatios Souvatzis <is@beverly.rhein.de>
Reply-To: is@beverly.rhein.de
To: gnats-bugs@gnats.netbsd.org
Subject: Amiga internal allows wrong and forbids right baud settings
X-Send-Pr-Version: 3.2

>Number:         1475
>Category:       port-amiga
>Synopsis:       Amiga internal allows wrong and forbids right baud settings
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 19 04:05:02 +0000 1995
>Closed-Date:    Wed Apr 24 11:34:07 +0000 1996
>Last-Modified:  Wed Apr 24 11:37:30 +0000 1996
>Originator:     Ignatios Souvatzis
>Release:        950913
>Organization:
	private
>Environment:
System: NetBSD beverly 1.0A NetBSD 1.0A (BEVERLY) #171: Tue Sep 19 08:47:25 MET DST 1995 is@beverly:/usr/src/sys/arch/amiga/compile/BEVERLY amiga


>Description:
	The Amiga builtin serial hardware can be set from about 110 bps 
to (theoretically) 3500000 bps, by adjusting a timer's divisor. The driver, however,
a) restricts the baud rates to the values in a table
b) allows 50bps and 75bps, giving wrong divisors for them.

E.g., setting the MIDI baud rate of 31250 (?) is impossible.

>How-To-Repeat:
	stty 50 < /dev/tty00; stty < /dev/tty00 outputs 50 (should give invalid parameter)
	stty 31250 < /dev/tty00; stty < /dev/tty00 outputs invalid parameter (should give 
		31250)

>Fix:

Apply this fix:

===================================================================
RCS file: RCS/ser.c,v
retrieving revision 1.1
diff -c -r1.1 ser.c
*** ser.c	1995/09/19 06:44:19	1.1
--- ser.c	1995/09/19 07:16:25
***************
*** 35,41 ****
   *	@(#)ser.c	7.12 (Berkeley) 6/27/91
   */
  /*
!  * XXX This file needs major cleanup it will never ervice more than one
   * XXX unit.
   */

--- 35,41 ----
   *	@(#)ser.c	7.12 (Berkeley) 6/27/91
   */
  /*
!  * XXX This file needs major cleanup it will never service more than one
   * XXX unit.
   */

***************
*** 99,128 ****
  struct	tty ser_cons;
  struct	tty *ser_tty[NSER];

- struct speedtab serspeedtab[] = {
- 	0,	0,
- 	50,	SERBRD(50),
- 	75,	SERBRD(75),
- 	110,	SERBRD(110),
- 	134,	SERBRD(134),
- 	150,	SERBRD(150),
- 	200,	SERBRD(200),
- 	300,	SERBRD(300),
- 	600,	SERBRD(600),
- 	1200,	SERBRD(1200),
- 	1800,	SERBRD(1800),
- 	2400,	SERBRD(2400),
- 	4800,	SERBRD(4800),
- 	9600,	SERBRD(9600),
- 	19200,	SERBRD(19200),
- 	38400,	SERBRD(38400),
- 	57600,	SERBRD(57600),
- 	76800,	SERBRD(76800),
- 	115200,	SERBRD(115200),
- 	-1,	-1
- };
- 
- 
  /* 
   * Since this UART is not particularly bright (to put it nicely), we'll
   * have to do parity stuff on our own.	This table contains the 8th bit
--- 99,104 ----
***************
*** 694,702 ****

  	cflag = t->c_cflag;
  	unit = SERUNIT(tp->t_dev);
- 	ospeed = ttspeedtab(t->c_ospeed, serspeedtab);

! 	if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
  		return(EINVAL);

  	/* 
--- 670,683 ----

  	cflag = t->c_cflag;
  	unit = SERUNIT(tp->t_dev);

! 	if (t->c_ospeed > 0) {
! 		if (t->c_ospeed < 110)
! 			return(EINVAL);
! 		ospeed = SERBRD(t->c_ospeed);
! 	}
! 
! 	if (t->c_ispeed && t->c_ispeed != t->c_ospeed)
  		return(EINVAL);

  	/* 
***************
*** 712,718 ****
  	custom.intena = INTF_SETCLR | INTF_RBF | INTF_TBE;
  	last_ciab_pra = ciab.pra;

! 	if (ospeed == 0)
  		(void)sermctl(tp->t_dev, 0, DMSET);	/* hang up line */
  	else {
  		/* 
--- 693,699 ----
  	custom.intena = INTF_SETCLR | INTF_RBF | INTF_TBE;
  	last_ciab_pra = ciab.pra;

! 	if (t->c_ospeed == 0)
  		(void)sermctl(tp->t_dev, 0, DMSET);	/* hang up line */
  	else {
  		/* 
***************
*** 1014,1020 ****
  	/*
  	 * might want to fiddle with the CIA later ???
  	 */
! 	custom.serper = ttspeedtab(rate, serspeedtab);
  	splx(s);
  }

--- 995,1001 ----
  	/*
  	 * might want to fiddle with the CIA later ???
  	 */
! 	custom.serper = (rate>=110 ? SERBRD(rate) : 0);
  	splx(s);
  }

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: is 
State-Changed-When: Wed Apr 24 07:34:07 EDT 1996 
State-Changed-Why:  
Applied fix. 
>Unformatted:
 Ignatios Souvatzis

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.