This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Interrupts and Serial Ports
Andrew,
Thanks for the response. I'm pretty sure I am using the full driver and
not the one for diagnostic output. I have the ports set up as /dev/ser0
and /dev/ser1 in the config
tool. I just need to know the correct way to read data from the port.
I have set up a handle to the port using the cyg_io_lookup function and
configuring
it to 9600 baud ( plus the other parameters such as stop bits etc ) and
set up
for non blocking reads. I am looping through the cyg_io_read function at
a rapid
rate but am still not reading anything. I know that polling is not the
best way to do
this but I don't know how to set up an interrupt driven scheme since the
driver is
already using the interrupt vector. Is there a way to hook onto this
interrupt vector
so that I can use this interrupt to signal the arrival of data at the port?
Thanks
Steve
Andrew Lunn wrote:
On Fri, Nov 05, 2004 at 08:33:07AM -0500, Steve Knowlton wrote:
I have an EB40A board. I am trying to read an incoming data stream on
Serial Port 1
that arrives about every 15 sec. I can see the Rx LED on the port
flashing every time
a packet arrives.
I am trying to read data coming into the port using cyg_io_read using a
polling method.
I was reading the documentation on the ecos serial driver and it claims
that the
incoming data is buffered until it is read. Is this true because it
doesn't seem to work
that way. I never seem to read anything from the port. I have tried both
blocking
and non blocking reads. Occassionally I get a -11 error which means that
the data is
not available and that the user should try again later. The returned
length is always 0 so
that seems to prove that I am not reading anything.
This does not seem to be a very good method and I was wondering if there
is an ecos interrrupt routine I can use that would execute whenever data
arrives at the port.
Presumably ecos assigns an interrupt vector for the port. If so, how can
I use this?
eCos comes with two serial drivers. There is a very basic one as part
of the HAL. This is designed for diagnostic output and is
polled. There is also a full serial driver which is interrupt
driver. You should make use of this full serial driver and you should
then get better results.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss