public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] how to read from serial port 2 !!
@ 2003-09-19  5:14 mohanlal jangir
  2003-09-19  8:18 ` Eric Doenges
  0 siblings, 1 reply; 4+ messages in thread
From: mohanlal jangir @ 2003-09-19  5:14 UTC (permalink / raw)
  To: ecos-discuss

I have gdb communicationg with redboot on serial port 1 (ARM Integrator
board). All printfs are dumped on serial port1 via gdb (this is output
channel set with configtool). Now I want my application to read from serial
port 2 (serial port 1 can't be used as gdb doesn't allow this while remote
debugging). How can read from serial port 2?

Regards
Mohanlal

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

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

* Re: [ECOS] how to read from serial port 2 !!
  2003-09-19  5:14 [ECOS] how to read from serial port 2 !! mohanlal jangir
@ 2003-09-19  8:18 ` Eric Doenges
  2003-09-20  1:52   ` mohanlal jangir
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Doenges @ 2003-09-19  8:18 UTC (permalink / raw)
  To: mohanlal jangir; +Cc: ecos-discuss

mohanlal jangir wrote:
> I have gdb communicationg with redboot on serial port 1 (ARM Integrator
> board). All printfs are dumped on serial port1 via gdb (this is output
> channel set with configtool). Now I want my application to read from serial
> port 2 (serial port 1 can't be used as gdb doesn't allow this while remote
> debugging). How can read from serial port 2?

You have three choices:

- Reroute stdin/stdout to serial port 2 by setting the default console
   device to /dev/ttyS1 and then use the normal stdio C library
   functions. In order to do this, you must enable tty support for port 2
   with configtool.

- Open the appropriate device file using POSIX file IO calls. This will
   require including the appropriate packages for POSIX file IO. Please
   note that while I believe this should work, I've never tried it
   myself.

- Use eCos' IO API and talk to the serial port 2 device directly.
-- 
--------------------------------------------------------------------
|     Eric Doenges              |     DynaPel Laboratories GmbH    |
|     Tel: +49 89 962428 23     |     Fraunhoferstrasse 9/2        |
|     Fax: +49 89 962428 90     |     D - 85737 Ismaning, Germany  |
--------------------------------------------------------------------


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

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

* Re: [ECOS] how to read from serial port 2 !!
  2003-09-19  8:18 ` Eric Doenges
@ 2003-09-20  1:52   ` mohanlal jangir
  2003-09-22  7:20     ` Eric Doenges
  0 siblings, 1 reply; 4+ messages in thread
From: mohanlal jangir @ 2003-09-20  1:52 UTC (permalink / raw)
  To: Eric Doenges; +Cc: ecos-discuss


> mohanlal jangir wrote:
> > I want my application to read from serial
> > port 2 (serial port 1 can't be used as gdb doesn't allow this while
remote
> > debugging). How can read from serial port 2?
>
>
> - Reroute stdin/stdout to serial port 2 by setting the default console
>    device to /dev/ttyS1 and then use the normal stdio C library
>    functions.
I did change CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT to 1 (serial
port 2) while left CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL to 0(serial port
1). But still printf messages coming on serial port 1 where gdb is
connected.

>    In order to do this, you must enable tty support for port 2
>    with configtool.
Do I need to change anything else apart from the above mentioned changes.
Inside "serial device drivers" package, I see options like "TTY mode channel
#(0-2)" etc. But these are not selected for any channel, so I don't think I
need to select any of them for serial port 2.

> - Open the appropriate device file using POSIX file IO calls. This will
>    require including the appropriate packages for POSIX file IO. Please
>    note that while I believe this should work, I've never tried it
>    myself.
I don't know, which is appropriate device file for serial port 2. I tried to
look into redboot code and found use of macros like
CYGACC_CALL_IF_SET_CONSOLE_COMM but did not find their definition. Where are
they defined? Where should I look for * appropriate device* for serial port
2

Regards
Mohanlal

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

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

* Re: [ECOS] how to read from serial port 2 !!
  2003-09-20  1:52   ` mohanlal jangir
@ 2003-09-22  7:20     ` Eric Doenges
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Doenges @ 2003-09-22  7:20 UTC (permalink / raw)
  To: mohanlal jangir; +Cc: ecos-discuss

mohanlal jangir wrote:

> I did change CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT to 1 (serial
> port 2) while left CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL to 0(serial port
> 1). But still printf messages coming on serial port 1 where gdb is
> connected.

I don't know how the HAL virtual vectors work, but I don't think you are
changing the correct options. Fire up 'configtool' and go to the
"Serial device drivers" section. There. enable "TTY mode" for channel
#1. Also there, you can see that eCos names it's serial device drivers
/dev/serX by default, with X being the number of the port (note that
eCos starts counting at zero instead of one).

However, this is _not_ enough to redirect standard in & out. To do so,
you must also tell the standard C library which device to use. Go to the
"Standard C library" section and then select "ISO C library standard
input/output functions". You need to change the option "default console
device"; set this to /dev/tty1. You could also use /dev/ser1 directly;
however then you do not have the line editor that TTY mode supplies.

> Do I need to change anything else apart from the above mentioned changes.
> Inside "serial device drivers" package, I see options like "TTY mode channel
> #(0-2)" etc. But these are not selected for any channel, so I don't think I
> need to select any of them for serial port 2.

Well, if you want to use TTY mode for a serial channel then obviously
you must select that option if it is not already selected.

> I don't know, which is appropriate device file for serial port 2. I tried to
> look into redboot code and found use of macros like
> CYGACC_CALL_IF_SET_CONSOLE_COMM but did not find their definition. Where are
> they defined? Where should I look for * appropriate device* for serial port
> 2

Look at the "Serial device drivers" section in configtool (see above).
Since there isn't all that much useful eCos documentation around, you
will eventually end up looking at the source code. For device drivers,
the device name eCos uses is usually defined in the platform-specific
.inl file, found in the
<...>/packages/devs/<device type>/<platform>/<target>/.../include/
hierachy.
-- 
--------------------------------------------------------------------
|     Eric Doenges              |     DynaPel Laboratories GmbH    |
|     Tel: +49 89 962428 23     |     Fraunhoferstrasse 9/2        |
|     Fax: +49 89 962428 90     |     D - 85737 Ismaning, Germany  |
--------------------------------------------------------------------


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

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

end of thread, other threads:[~2003-09-22  7:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-19  5:14 [ECOS] how to read from serial port 2 !! mohanlal jangir
2003-09-19  8:18 ` Eric Doenges
2003-09-20  1:52   ` mohanlal jangir
2003-09-22  7:20     ` Eric Doenges

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).