From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Robert Cragie" To: "Ho Shui Choy Stanley PS03B NCS" , "'Jonathan Larmour'" Cc: "Ecos-Discuss (E-mail)" Subject: RE: [ECOS] Serial Application Date: Fri, 27 Apr 2001 03:12:00 -0000 Message-id: References: <19C34CD863B1D4118E2800508BAF663A0112F61C@STONE> X-SW-Source: 2001-04/msg00466.html See inline comments. > -----Original Message----- > From: ecos-discuss-owner@sources.redhat.com > [ mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of Ho Shui Choy > Stanley PS03B NCS > Sent: 27 April 2001 02:21 > To: 'Jonathan Larmour' > Cc: Ecos-Discuss (E-mail) > Subject: RE: [ECOS] Serial Application > > > Ok > > Below is the code, those statements mark with an "*" did execute > When I call printf or cyg_io_write to /dev/haldiag, I see the messages on > COM1 on the hyperterminal, which is connected to serial port 0 on > my target. > COM2 is connected to second serial port on my target. > > I have tried to look up both ser0 and ser1, both returned with no error. > When I do a cyg_io_write to them nothing get displayed on the > hyperterminal. > > * 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 ); I can't see you actually setting 'len' before the call to cyg_io_write() here (see below)... > } > > 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"); > > >>Not this statement, nothing is receive through serial_1 > err = cyg_io_write( serial, test_string, &len ); I can't see you actually setting 'len' before the call to cyg_io_write() here. You set 'len' to be the desired length to write. It returns with the actual length written in 'len': len = strlen(test_string); err = cyg_io_write( serial, test_string, &len ); Looking at the source, if len is passed as 0, cyg_io_write() will simply return ENOERR without doing anything. The comment says that passing len=0 simply verifies the method exists. This doesn't explain why cyg_io_write() to /dev/haldiag works (I assume it does), unless it is handled differently in the call. Robert Cragie Design Engineer Jennic Ltd. Furnival Street Sheffield S1 4QT United Kingdom Tel: +44 (0) 114 281 4512 Fax: +44 (0) 114 281 2951 mailto:rcc@jennic.com http://www.jennic.com