tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: reuse of linux tty serial driver in NetBSD!



On Wed, 18 Feb 2009 01:39:11 -0800 (PST)
Bits Pilani <mailto635%yahoo.com@localhost> wrote:

> Is there any documentation about the tty drivers in NetBSD? 
> Also is there a simple skeleton tty driver that can be used as a reference to 
> implement a serial tty driver. 
> 
> If I have a linux tty driver, how much of that can be re-used in NetBSD?

What I can remember off the top of my head are tty(4) and pty(4) manual
pages, also documenting the various ioctl(2)'s, linedisc(9) which is
for kernel-land, openpty(3)/pty(4) if you'll be driving tty(4) devices
from userland...  Also, the termios(4) interface is compatible between
Linux and NetBSD (the ioctls might not map identically, however).

An example tty-loopback.c (using two pty(4)s to control two tty(4)s)
may be found here:
http://cvs.pulsar-zone.net/cgi-bin/cvsweb.cgi/mmondor/mmsoftware/util/tty-loopback.c?rev=1.2;content-type=text%2Fx-cvsweb-markup

If you must write a kernel-space tty(4) driver, some existing ones
might be used as example:

$ pwd
/usr/src/sys/dev
$ find . -iname '*tty*'
./arcbios/arcbios_tty.c
./hpc/hpf1275a_tty.c
./ic/z8530tty.c
./ir/irframe_tty.c
./sun/kbd_ms_ttyvar.h

Possibly others here can point to more obvious examples.
-- 
Matt


Home | Main Index | Thread Index | Old Index