2010年3月15日 星期一

SerialPort dianostics under Linux

SerialPort diagnostics under Linux is not so easy as under Windows. Windows SDK supports some useful(but not so safely) API, but Linux not.

External loopback test and baud rate test is very easy while serial redirection not enabled. But serial redirection always through some login messages to UART and make diagnostics failed. The command setterm -msg off would help. But if test failed, the linux API not support CTS or some read to clear commands, and it will affect following serial ports tests.

Internal loopback diagnostics under Linux should use direct IO to access MCR to enable internal loopback.

So, if anyone want to write some serial diagnostoics, he should use inb/outb/inl/outl instead of open/read/write. And it will save time and performance.

沒有留言: