Unix Programming - Accessing RS-232 Line Status Register using ioctl()?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2005 > Accessing RS-232 Line Status Register using ioctl()?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Accessing RS-232 Line Status Register using ioctl()?
JH Trauntvein

2005-12-21, 5:57 pm

I am porting a program from win32 that makes use of rs-232 hardware.
One of the things this program does is to look for UART report comms
errors (these come in on the UART line status register). I have read
"Serial programming Guide for POSIX Operating Systems" and there found
out that the modem status register can be polled using ioctl but there
is no mention of the line status register. Does that mean that the
information in the line status register is not available through the
standard driver or is there other information that I have not yet
found?

This information is important to my program because things like serial
framing errors and overrun errors are reported through this register.
My application uses these things to report errors to the user and also
to help determine if the wrong baud rate is selected.

Regards,

Jon Trauntvein

Gordon Burditt

2005-12-21, 8:49 pm

>I am porting a program from win32 that makes use of rs-232 hardware.
>One of the things this program does is to look for UART report comms
>errors

(these come in on the UART line status register).

You say that like there is One True Serial Port with One True
Set of Hardware. This is unlikely to be true. What bits go
with what register is going to be chipset-dependent.

>I have read
>"Serial programming Guide for POSIX Operating Systems" and there found
>out that the modem status register


No, there isn't "THE modem status register" (which is sorta like
THE key on the keyboard), but you can control some of the RS-232
lines which may or may not exist on a serial port.

>can be polled using ioctl but there
>is no mention of the line status register.
>Does that mean that the
>information in the line status register is not available through the
>standard driver or is there other information that I have not yet
>found?


What information do you think that is?

>This information is important to my program because things like serial
>framing errors and overrun errors are reported through this register.


These are also associated with a particular character and
that information is likely to be erased when the driver accepts
the next character.

>My application uses these things to report errors to the user and also
>to help determine if the wrong baud rate is selected.


The termios(4) interface lets you set a number of modes, including:

INPCK - enable checking of parity errors
PARMRK - mark parity and framing errors
A character X with a framing or parity error is received as
three characters, 0377, 0000, and X. Assuming you don't have
ISTRIP set, a valid 0377 character is received as two 0377
characters, making it impossible for a real data sequence to
look like a parity error. A BREAK sequence looks like a received
0 byte with a framing error.

Gordon L. Burditt
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com