This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Serial Application


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]