This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Serial Application
- To: "Ecos-Discuss (E-mail)" <ecos-discuss at sources dot redhat dot com>
- Subject: [ECOS] Serial Application
- From: Ho Shui Choy Stanley PS03B NCS <scho at ncs dot com dot sg>
- Date: Wed, 25 Apr 2001 18:05:49 +0800
I modified the serial.c example to receive data from one serial port and
transmit it on the other.
I am not getting anything on the other port. I am using windows
hyperterminal to test the codes.
Below is the codes.
err = cyg_io_lookup( "/dev/haldiag", &handle );
if (ENOERR == err) {
printf("Found /dev/haldiag. Writing string....\n");
err = cyg_io_write( handle, test_string, &len );
}
if (ENOERR == err) {
printf("I think I wrote the string. Did you see it?\n");
}
err = cyg_io_lookup( "/dev/ser1", &serial );
if (ENOERR == err) {
printf("Found /dev/ser1. Writing string....\n");
err = cyg_io_write( serial, test_string, &len );
}
while (1) {
buf_len = 1;
cyg_io_read(serial, in_buffer, &buf_len);
buf_len = 1;
cyg_io_write(handle, in_buffer, &buf_len);
buf_len = 2;
cyg_io_write(handle, "\n\r", &buf_len);
}
Thanks
Stanley