public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: [ECOS] Serial application
@ 2001-05-09 17:54 Ho Shui Choy Stanley PS03B NCS
  2001-05-09 19:33 ` Jonathan Larmour
  0 siblings, 1 reply; 16+ messages in thread
From: Ho Shui Choy Stanley PS03B NCS @ 2001-05-09 17:54 UTC (permalink / raw)
  To: 'Jonathan Larmour'; +Cc: Ecos-Discuss (E-mail)

But with the non blocking option select, the serial device is initialize
with a blocking value of "true" which is in the serial_init function.

-----Original Message-----
From: Jonathan Larmour [ mailto:jlarmour@redhat.com ]
Sent: Thursday, May 10, 2001 03:28
To: Ho Shui Choy Stanley PS03B NCS
Cc: Ecos-Discuss (E-mail)
Subject: Re: [ECOS] Serial application


Ho Shui Choy Stanley PS03B NCS wrote:
> 
> Here is what I changed.
> 
> in /io/serial/current/src/common/serial.c
> 
> serial_read {
> ...
> ...
> #ifdef CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
>                 if (cbuf->blocking) {   <- previously checking for false
>                     *len = size;        // characters actually read
>                     res = -EAGAIN;
>                     break;
>                 }
> #endif // CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING

But the check _should_ be for !cbuf->blocking surely?

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

^ permalink raw reply	[flat|nested] 16+ messages in thread
* RE: [ECOS] Serial application
@ 2001-05-08 17:53 Ho Shui Choy Stanley PS03B NCS
  2001-05-09 12:27 ` Jonathan Larmour
  0 siblings, 1 reply; 16+ messages in thread
From: Ho Shui Choy Stanley PS03B NCS @ 2001-05-08 17:53 UTC (permalink / raw)
  To: 'Jonathan Larmour'; +Cc: Ecos-Discuss (E-mail)

Here is what I changed.

in /io/serial/current/src/common/serial.c

serial_read {
...
...
#ifdef CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
                if (cbuf->blocking) {   <- previously checking for false
                    *len = size;        // characters actually read
                    res = -EAGAIN;
                    break;
                }
#endif // CYGOPT_IO_SERIAL_SUPPORT_NONBLOCKING
...
...
}

the same goes to serial_write


-----Original Message-----
From: Jonathan Larmour [ mailto:jlarmour@redhat.com ]
Sent: Tuesday, May 08, 2001 21:29
To: Ho Shui Choy Stanley PS03B NCS
Cc: Ecos-Discuss (E-mail)
Subject: Re: [ECOS] Serial application


Ho Shui Choy Stanley PS03B NCS wrote:
> 
> Solve the problem already. Somehow in
/io/serial/currentsrc/common/serial.c,
> in serial_read function, the checking for blocking was wrong.

Don't keep us on tenter-hooks :-). What was the change?

Thanks for debugging it.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

^ permalink raw reply	[flat|nested] 16+ messages in thread
* RE: [ECOS] Serial application
@ 2001-05-08  1:43 Ho Shui Choy Stanley PS03B NCS
  0 siblings, 0 replies; 16+ messages in thread
From: Ho Shui Choy Stanley PS03B NCS @ 2001-05-08  1:43 UTC (permalink / raw)
  To: Ecos-Discuss (E-mail)

After I made the corrections, the application ran well in external RAM but
when I transfer the codes to the flash it run for a few seconds then nothing
is output but the program is still running


-----Original Message-----
From: Ho Shui Choy Stanley PS03B NCS [ mailto:scho@ncs.com.sg ]
Sent: Tuesday, May 08, 2001 14:52
To: Ecos-Discuss (E-mail)
Subject: RE: [ECOS] Serial application


Solve the problem already. Somehow in /io/serial/currentsrc/common/serial.c,
in serial_read function, the checking for blocking was wrong.

-----Original Message-----
From: Ho Shui Choy Stanley PS03B NCS [ mailto:scho@ncs.com.sg ]
Sent: Tuesday, May 08, 2001 14:04
To: Ecos-Discuss (E-mail)
Subject: [ECOS] Serial application


I wrote a test program to test the serial port on my platform (AT91EB40).
This program simply transfer data received from one port to the other. I
have two threads, each will monitor one serial port. Below is the codes.

Thread 1:
static void simple_prog1(CYG_ADDRESS data)
{
    cyg_uint32 buf_len;
    cyg_uint8 in_buffer[10];

    while (1) {
        buf_len = 1;
        cyg_io_read(serial1, in_buffer, &buf_len);
        buf_len = 1;
        cyg_io_write(serial0, in_buffer, &buf_len);
    }
}

Thread 2:
static void simple_prog2(CYG_ADDRESS data)
{
    cyg_uint32 buf_len;
    cyg_uint8 in_buffer[10];

    while (1) {
        buf_len = 1;
        cyg_io_read(serial0, in_buffer, &buf_len);
        buf_len = 1;
        cyg_io_write(serial1, in_buffer, &buf_len);
    }
}

When I start the program, it just run for a few seconds then stops. Can
anyone tell me what's wrong?

Thanks
Stanley
> ____________________________
> This email (including all attachments) contains confidential information
> which may be privileged. It is intended solely for the identified
> recipient(s) to whom it is addressed. If you are not an intended
> recipient, please reply to us immediately and delete this message from
> your system. You may not copy or use it for any purpose, or otherwise
> disclose its contents to any person. 
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread
* RE: [ECOS] Serial application
@ 2001-05-07 23:52 Ho Shui Choy Stanley PS03B NCS
  2001-05-08  6:30 ` Jonathan Larmour
  0 siblings, 1 reply; 16+ messages in thread
From: Ho Shui Choy Stanley PS03B NCS @ 2001-05-07 23:52 UTC (permalink / raw)
  To: Ecos-Discuss (E-mail)

Solve the problem already. Somehow in /io/serial/currentsrc/common/serial.c,
in serial_read function, the checking for blocking was wrong.

-----Original Message-----
From: Ho Shui Choy Stanley PS03B NCS [ mailto:scho@ncs.com.sg ]
Sent: Tuesday, May 08, 2001 14:04
To: Ecos-Discuss (E-mail)
Subject: [ECOS] Serial application


I wrote a test program to test the serial port on my platform (AT91EB40).
This program simply transfer data received from one port to the other. I
have two threads, each will monitor one serial port. Below is the codes.

Thread 1:
static void simple_prog1(CYG_ADDRESS data)
{
    cyg_uint32 buf_len;
    cyg_uint8 in_buffer[10];

    while (1) {
        buf_len = 1;
        cyg_io_read(serial1, in_buffer, &buf_len);
        buf_len = 1;
        cyg_io_write(serial0, in_buffer, &buf_len);
    }
}

Thread 2:
static void simple_prog2(CYG_ADDRESS data)
{
    cyg_uint32 buf_len;
    cyg_uint8 in_buffer[10];

    while (1) {
        buf_len = 1;
        cyg_io_read(serial0, in_buffer, &buf_len);
        buf_len = 1;
        cyg_io_write(serial1, in_buffer, &buf_len);
    }
}

When I start the program, it just run for a few seconds then stops. Can
anyone tell me what's wrong?

Thanks
Stanley
> ____________________________
> This email (including all attachments) contains confidential information
> which may be privileged. It is intended solely for the identified
> recipient(s) to whom it is addressed. If you are not an intended
> recipient, please reply to us immediately and delete this message from
> your system. You may not copy or use it for any purpose, or otherwise
> disclose its contents to any person. 
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread
* [ECOS] Serial application
@ 2001-05-07 23:04 Ho Shui Choy Stanley PS03B NCS
  0 siblings, 0 replies; 16+ messages in thread
From: Ho Shui Choy Stanley PS03B NCS @ 2001-05-07 23:04 UTC (permalink / raw)
  To: Ecos-Discuss (E-mail)

I wrote a test program to test the serial port on my platform (AT91EB40).
This program simply transfer data received from one port to the other. I
have two threads, each will monitor one serial port. Below is the codes.

Thread 1:
static void simple_prog1(CYG_ADDRESS data)
{
    cyg_uint32 buf_len;
    cyg_uint8 in_buffer[10];

    while (1) {
        buf_len = 1;
        cyg_io_read(serial1, in_buffer, &buf_len);
        buf_len = 1;
        cyg_io_write(serial0, in_buffer, &buf_len);
    }
}

Thread 2:
static void simple_prog2(CYG_ADDRESS data)
{
    cyg_uint32 buf_len;
    cyg_uint8 in_buffer[10];

    while (1) {
        buf_len = 1;
        cyg_io_read(serial0, in_buffer, &buf_len);
        buf_len = 1;
        cyg_io_write(serial1, in_buffer, &buf_len);
    }
}

When I start the program, it just run for a few seconds then stops. Can
anyone tell me what's wrong?

Thanks
Stanley
> ____________________________
> This email (including all attachments) contains confidential information
> which may be privileged. It is intended solely for the identified
> recipient(s) to whom it is addressed. If you are not an intended
> recipient, please reply to us immediately and delete this message from
> your system. You may not copy or use it for any purpose, or otherwise
> disclose its contents to any person. 
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread
* RE: [ECOS] Serial Application
@ 2001-04-26 18:23 Ho Shui Choy Stanley PS03B NCS
  2001-04-27  3:12 ` Robert Cragie
  2001-04-27  3:30 ` Carlos Camargo
  0 siblings, 2 replies; 16+ messages in thread
From: Ho Shui Choy Stanley PS03B NCS @ 2001-04-26 18:23 UTC (permalink / raw)
  To: 'Jonathan Larmour'; +Cc: Ecos-Discuss (E-mail)

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 );
    }
        
    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 );
    }

    if (ENOERR == err) {
*        printf("I think I wrote the string to serial 1. Did you see
it?\n");
    }

Thanks
Stanley

-----Original Message-----
From: Jonathan Larmour [ mailto:jlarmour@redhat.com ]
Sent: Friday, April 27, 2001 02:14
To: Ho Shui Choy Stanley PS03B NCS
Cc: Ecos-Discuss (E-mail)
Subject: Re: [ECOS] Serial Application


Ho Shui Choy Stanley PS03B NCS wrote:
> 
> The flow control was disabled.
> 
> I receive the printf statements on /dev/haldiag. When I do a lookup on
ser0
> or ser1 there is no error. Even if /dev/haldiag is tied to ser0 or ser1, I
> should have got the message on that port but nothing is coming out.

I'm still not clear on exactly what you do see. Does /dev/haldiag itself
work? Does the initial cyg_io_write work?

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

^ permalink raw reply	[flat|nested] 16+ messages in thread
* RE: [ECOS] Serial Application
@ 2001-04-25 21:18 Ho Shui Choy Stanley PS03B NCS
  2001-04-26 11:14 ` Jonathan Larmour
  0 siblings, 1 reply; 16+ messages in thread
From: Ho Shui Choy Stanley PS03B NCS @ 2001-04-25 21:18 UTC (permalink / raw)
  To: 'Jonathan Larmour'; +Cc: Ecos-Discuss (E-mail)

The flow control was disabled.

I receive the printf statements on /dev/haldiag. When I do a lookup on ser0
or ser1 there is no error. Even if /dev/haldiag is tied to ser0 or ser1, I
should have got the message on that port but nothing is coming out.


-----Original Message-----
From: Jonathan Larmour [ mailto:jlarmour@redhat.com ]
Sent: Thursday, April 26, 2001 00:15
To: Ho Shui Choy Stanley PS03B NCS
Cc: Ecos-Discuss (E-mail)
Subject: Re: [ECOS] Serial Application


Ho Shui Choy Stanley PS03B NCS wrote:
> 
> 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.

Make sure you haven't got flow control enabled in hyperterminal.

Do you not get *anything*? Not even the initial cyg_io_write? Are you sure
/dev/haldiag and /dev/ser1 are different ports on your board? i.e. is it
maybe /dev/ser2? or even /dev/ser0?

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

^ permalink raw reply	[flat|nested] 16+ messages in thread
* [ECOS] Serial Application
@ 2001-04-25  3:07 Ho Shui Choy Stanley PS03B NCS
  2001-04-25  9:15 ` Jonathan Larmour
  0 siblings, 1 reply; 16+ messages in thread
From: Ho Shui Choy Stanley PS03B NCS @ 2001-04-25  3:07 UTC (permalink / raw)
  To: Ecos-Discuss (E-mail)

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2001-05-09 19:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-09 17:54 [ECOS] Serial application Ho Shui Choy Stanley PS03B NCS
2001-05-09 19:33 ` Jonathan Larmour
  -- strict thread matches above, loose matches on Subject: below --
2001-05-08 17:53 Ho Shui Choy Stanley PS03B NCS
2001-05-09 12:27 ` Jonathan Larmour
2001-05-08  1:43 Ho Shui Choy Stanley PS03B NCS
2001-05-07 23:52 Ho Shui Choy Stanley PS03B NCS
2001-05-08  6:30 ` Jonathan Larmour
2001-05-07 23:04 Ho Shui Choy Stanley PS03B NCS
2001-04-26 18:23 [ECOS] Serial Application Ho Shui Choy Stanley PS03B NCS
2001-04-27  3:12 ` Robert Cragie
2001-04-27  3:30 ` Carlos Camargo
2001-04-27  4:13   ` Robert Cragie
2001-04-25 21:18 Ho Shui Choy Stanley PS03B NCS
2001-04-26 11:14 ` Jonathan Larmour
2001-04-25  3:07 Ho Shui Choy Stanley PS03B NCS
2001-04-25  9:15 ` Jonathan Larmour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).