This example writes a text string to serial port of ARM9. The program is written using EABI GCC Cross C Compiler (http://www.codesourcery.com). OpenPort(), ReadPort(), WritePort(), GetBaud() auxiliary functions have been implemented by BiPOM in comm.c source file to simplify port access.
Usage:
WriteSerial
Toolkit:ARM Development System
Location:\bipom\devtools\GCC\AT91SAM9\Examples\Linux\WriteSerial\comm.c
// initial setup int hPort = OpenPort(Port.c_str(), Baud, DataBits, StopBits, Parity); if(hPort < 0) { printf("\r\nFailed open port: '%s'", Port.c_str()); return 1; } // write data to port int n = WritePort(hPort, (char*)Text.c_str(), Text.length(), 1); if(n != Text.length()) { printf("\r\nCannot send data to port (n=%d)", n); return 1; } printf("\r\nData was sent successfully"); // close port close(hPort);