[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: interacting with serial driver

> Well, the case is, i want to do, what "open" or "write" or "read" does at
> the lowest level, just above the driver.

At the very core "open" just turns on the DTR on the serial port.
"Write" essentially just does a outb(SERIAL_DATA_PORT) and a status check,
and "read" is tricky. It will block you till enough chars are available
(depending on whether you have non-blocking mode set in "open"), and when
the serial interrupt occurs the driver will actually read the chars and
put them in the buffer. Eventually waking up your prog when enough are

You can do what the "open" and "write" do in userland, but you won't be
able to service interrupts from userland. AFAIK, you can put 8250 (and
hence 16550) in polled I/O modes too, and can do the polling from
userland. But you will *hog* the CPU in doing so, and you hvae to be root
to touch I/O ports directly..