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]
Other format: [Raw text]

Problems with cyg_io_read


Hi,
   Initially I wrote a small program that displays a
test string on /dev/haldiag and /dev/ser1. the
/dev/ser1 was connected to a windows machine with
hyperterminal and the /dev/haldiag was basically a gdb
session from a linux machine. This setup worked and I
was able to see the test string on the hyperterminal.
But then I tried to do a cyg_io_read on the /dev/ser1.
I typed a few characters on the hyperterminal but the
read call is just blocked. 
I also tried minicom instead of the hyperterminal, but
minicom wouldn't connect properly to the /dev/ttyS1
when gdb session is on, and vice versa too.
Can anybody please clarify me on what I'm doing wrong?

I have attached my code below.

Thanks.

Giri.

/********* code snippet ***************/

int main (void) {
        cyg_io_handle_t serialA;
        Cyg_ErrNo errA;
        cyg_io_handle_t serialB;
        Cyg_ErrNo errB;

        const char test_string[] = "serial A  to
gdb\n";
        const char test_string2[10];
        cyg_uint32 len = strlen(test_string);
        cyg_uint32 len2 = 2;
        printf("Starting serial example\n");
        errA = cyg_io_lookup( "/dev/haldiag", &serialA
);

        if (ENOERR == errA)   {
                printf("Found /dev/haldiag. Writing
string....\n");
       }

        errB = cyg_io_lookup( "/dev/ser1", &serialB );
        if (ENOERR == errB)  {
                printf("Found /dev/ser1 Writing
string....\n");
        }

        printf("starting to errB\n");
cyg_io_read(serialB, &test_string2, &len2);
        printf("the string is  %s\n", test_string2);
read\n");

return 0;

}





	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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