Re: 921Kbps on Linux: is it possible ?!?!

Ken Pizzini (ken@halcyon.com)
Fri, 16 Oct 1998 12:58:53 -0600


On Thu, 15 Oct 1998 14:37:21 +0200 (MEST),
Rogier Wolff <R.E.Wolff@BitWizard.nl> wrote:
>tytso@mit.edu wrote:
>> Date: Tue, 13 Oct 1998 10:55:30 -0700 (PDT)
>> From: Linux Lists <lists@cyclades.com>
>>
>> I've noticed that in the linux/include/asm/termbits.h there is no
>> definition for a baud rate of 921.6Kbps (it only goes up to 460.8Kbps).
>> Therefore, it's not possible to use setserial to set a serial port to this
>> speed ... is it ?!?!
>
>> The definition of termbits is so that program can directly specify a
>> speed using the POSIX standard interfaces. Yes, it's true that
>> right now there isn't a termbits assignment for 921.6 kbps. Given
>> that very few boards, and even fewer peripherals, actually support
>> such a speed, I haven't bothered to add it. Note that if we do need
>> to add it, both kernel support and libc support are required.
>
>One poster already indicated that he has the need for such rates.
>
>Remember "640k must be enough for everyone"?
>
>Because changing the kernel and the libc interface takes so much time,
>we need to define those interfaces as soon as possible.

If we need to update libc and the kernel anyway, could we please
do this right this time? Let's define a new libc interface:
int tcsetspeed(int filedes, unsigned long speed);
unsigned long tcgetspeed(int filedes);

[Or, if we want to allow independent input and output rates:
int tcsetspeed(int filedes, unsigned long ispeed, unsigned long ospeed);
unsigned long tcgetispeed(int filedes);
unsigned long tcgetospeed(int filedes);
]

[Hmmm... The "unsigned long" should probably be something like "bps_t".]

These can be supported in the kernel with new TIOSETBPS (with the
bps rate as a parameter) and TIOGETBPS ioctl()s in the serial driver.
I leave it up to the serial driver gurus to determine how far off the
clock division can be from an integer before they decide to return -1
(EINVAL?), and of course it will have to be an error to request a
rate beyond the capabilities of the device.

This allows an application to use whatever arbritrary bps rate it
thinks it needs (provided the device can support the rate), and
allows for rates up to 4,294,967,295 bps on a 32-bit machine,
and 2**64-1 bps on a 64-bit machine, which should exceed any
possible need for quite some time to come ;-).

Comments?

--Ken Pizzini

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/