Messages in this thread | | | Date | Wed, 26 Jan 2000 09:22:18 -0500 | Subject | Re: Serial Device Driver Entry Hooks | From | tytso@mit ... |
| |
Date: Fri, 21 Jan 2000 00:03:59 +0000 From: Keith James Robertson <kjrobert@abio.com>
I am developing a device driver for a serial device. However, I am confused by stacking of the lower level serial drivers and how to interface with the appropriate one and have been unable to find much documentation on serial drivers. A solution to all of my questions would likely be solved by someone pointing me to a kernel space serial device driver that requires looking at and changing values in the serial UART control registers (ie device supports multiple speeds, pnp).
If you're writing a device driver for a serial device that plugs into an RS-232 driver, the first question is should it be a kernel-level driver at all? In general, if you can do it in user space, you probably should do it there. If you just need to control the baud rate, parity, start/stop bits, etc., then a user space program which talks to /dev/ttySx using the POSIX termios interface is the right choice.
If for some reasons you do need to be in the kernel, but you're still using standard termios controls, the next level of abstraction down is to make a new line discpline. Examples of line discplines are PPP, SLIP, etc. This has the advantage that it will work with any serial board, including intelligent serial boards such as the Comtrol Rocketport, Cyclades, boards, etc.
The only time you should really write your own low-level device driver is if you have a specific board which doesn't use an existing standard UART. I'll note that since you mentioned PNP, there will shortly be a new version of the serial driver released into the 2.3 mainline (and available as a stand-alone driver for Linux 2.2) that will support standard PNP boards which use 8250/16550 compatible uarts.
So, you need to give us a lot more details before we can really give you advice about what's the best way to about things.
- Ted
- 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/
| |