public inbox for gentoo-embedded@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-embedded] displaying serial port status
@ 2010-04-21 17:14 Relson, David
  2010-04-21 18:51 ` Bob Dunlop
  0 siblings, 1 reply; 3+ messages in thread
From: Relson, David @ 2010-04-21 17:14 UTC (permalink / raw
  To: gentoo-embedded

Gretings,

In the old days when we used direct port I/O to perform serial port actions, code like the following would display the port's status:

#define BASE    0x03F8     /* COM1 port base address */
#define LS_REG (BASE+5)    /* Line Status Register   */

void ShowLineStatus(void)
{
    int status = inportb(LS_REG);
    if (status & 0x02) printf("Overrun Error\n");
    if (status & 0x04) printf("Parity Error\n");
    if (status & 0x08) printf("Framing Error\n");
    if (status & 0x10) printf("Break Interrupt\n");
    if (status & 0x80) printf("Timeout Error\n");
}

How does one perform the same thing for /dev/ttyS0 (or any other serial port)?

I've been looking at various ioctl's, but haven't yet spotted one that provides information on overrun errors, parity errors, etc.

Thanks in advance!
 
David




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-21 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-21 17:14 [gentoo-embedded] displaying serial port status Relson, David
2010-04-21 18:51 ` Bob Dunlop
2010-04-21 19:24   ` Relson, David

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox