public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] short reads on serial port..
@ 2000-10-26  9:59 Dave Airlie
  2000-10-26 12:17 ` Jonathan Larmour
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Airlie @ 2000-10-26  9:59 UTC (permalink / raw)
  To: ecos-discuss

Does eCos support short reads? .. I want to read from the serial port for
a max len of 127 bytes, but if there is nothing there I want to
block until something appears .... I suppose I want to use select. .. but
I don't want to use select :-).....

Should I use select, what does it drag in the way of extra stuff to my
build ... I don't want to have to add POSIX stuff really...

Is there another way? 

Thanks,
Dave.

-- 
      David Airlie, Software Engineer, Parthus Technologies plc.,
       Mary Rosse Centre, National Tech Park, Limerick, Ireland.
   t: +353-61-508116 / f: +353-61-508101 / David.Airlie@parthus.com

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

* Re: [ECOS] short reads on serial port..
  2000-10-26  9:59 [ECOS] short reads on serial port Dave Airlie
@ 2000-10-26 12:17 ` Jonathan Larmour
  2000-10-26 12:57   ` Grant Edwards
  2000-10-26 13:01   ` Dave Airlie
  0 siblings, 2 replies; 6+ messages in thread
From: Jonathan Larmour @ 2000-10-26 12:17 UTC (permalink / raw)
  To: Dave Airlie; +Cc: ecos-discuss

Dave Airlie wrote:
> 
> Does eCos support short reads? .. I want to read from the serial port for
> a max len of 127 bytes, but if there is nothing there I want to
> block until something appears .... I suppose I want to use select. .. but
> I don't want to use select :-).....
> 
> Should I use select, what does it drag in the way of extra stuff to my
> build ... I don't want to have to add POSIX stuff really...
> 
> Is there another way?

Um, serial reads do block by default. If you want to wait on multiple
devices but avoid select, you could use multiple threads using blocking
reads, which then signal your original thread when data arrives.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

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

* Re: [ECOS] short reads on serial port..
  2000-10-26 12:17 ` Jonathan Larmour
@ 2000-10-26 12:57   ` Grant Edwards
  2000-10-26 13:04     ` Jonathan Larmour
  2000-10-26 13:01   ` Dave Airlie
  1 sibling, 1 reply; 6+ messages in thread
From: Grant Edwards @ 2000-10-26 12:57 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: Dave Airlie, ecos-discuss

On Thu, Oct 26, 2000 at 08:16:58PM +0100, Jonathan Larmour wrote:

> > Should I use select, what does it drag in the way of extra stuff to my
> > build ... I don't want to have to add POSIX stuff really...
> 
> Um, serial reads do block by default. If you want to wait on multiple
> devices but avoid select, you could use multiple threads using blocking
> reads, which then signal your original thread when data arrives.

Does the serial driver support select?

-- 
Grant Edwards
grante@visi.com

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

* Re: [ECOS] short reads on serial port..
  2000-10-26 12:17 ` Jonathan Larmour
  2000-10-26 12:57   ` Grant Edwards
@ 2000-10-26 13:01   ` Dave Airlie
  2000-10-26 13:09     ` Jonathan Larmour
  1 sibling, 1 reply; 6+ messages in thread
From: Dave Airlie @ 2000-10-26 13:01 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: ecos-discuss

k> > Should I use select, what does it drag in the way of extra stuff to
my
> > build ... I don't want to have to add POSIX stuff really...
> > 
> > Is there another way?
> 
> Um, serial reads do block by default. If you want to wait on multiple
> devices but avoid select, you could use multiple threads using blocking
> reads, which then signal your original thread when data arrives.
>

yes but they block for the number of bytes you request .. so if I want a
max of 127 bytes they block up to 127 bytes, they can't return when they
get data.. I know I could probably could some mess with reading 1 byte and
then checking how much was left .. but I'd say it would be a bit messy ...

Dave.


 > Jifl
> 

-- 
      David Airlie, Software Engineer, Parthus Technologies plc.,
       Mary Rosse Centre, National Tech Park, Limerick, Ireland.
   t: +353-61-508116 / f: +353-61-508101 / David.Airlie@parthus.com

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

* Re: [ECOS] short reads on serial port..
  2000-10-26 12:57   ` Grant Edwards
@ 2000-10-26 13:04     ` Jonathan Larmour
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Larmour @ 2000-10-26 13:04 UTC (permalink / raw)
  To: Grant Edwards; +Cc: Dave Airlie, ecos-discuss

Grant Edwards wrote:
> 
> On Thu, Oct 26, 2000 at 08:16:58PM +0100, Jonathan Larmour wrote:
> 
> > > Should I use select, what does it drag in the way of extra stuff to my
> > > build ... I don't want to have to add POSIX stuff really...
> >
> > Um, serial reads do block by default. If you want to wait on multiple
> > devices but avoid select, you could use multiple threads using blocking
> > reads, which then signal your original thread when data arrives.
> 
> Does the serial driver support select?

In CVS, yes it should.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

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

* Re: [ECOS] short reads on serial port..
  2000-10-26 13:01   ` Dave Airlie
@ 2000-10-26 13:09     ` Jonathan Larmour
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Larmour @ 2000-10-26 13:09 UTC (permalink / raw)
  To: Dave Airlie; +Cc: ecos-discuss

Dave Airlie wrote:
> 
> k> > Should I use select, what does it drag in the way of extra stuff to
> my
> > > build ... I don't want to have to add POSIX stuff really...
> > >
> > > Is there another way?
> >
> > Um, serial reads do block by default. If you want to wait on multiple
> > devices but avoid select, you could use multiple threads using blocking
> > reads, which then signal your original thread when data arrives.
> 
> yes but they block for the number of bytes you request .. so if I want a
> max of 127 bytes they block up to 127 bytes, they can't return when they
> get data.. I know I could probably could some mess with reading 1 byte and
> then checking how much was left .. but I'd say it would be a bit messy ...

Well, a bit yes. The eCos version of select itself should be quite
efficient. The problem is that it operates on fd's so that pulls in all the
other file I/O stuff, plug-in filesystem support, devfs etc.

Maybe you'd find it easier just to hack
io/serial/current/src/common/serial.c and change every mention of
cyg_selwakeup() to some function of your own.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

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

end of thread, other threads:[~2000-10-26 13:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-26  9:59 [ECOS] short reads on serial port Dave Airlie
2000-10-26 12:17 ` Jonathan Larmour
2000-10-26 12:57   ` Grant Edwards
2000-10-26 13:04     ` Jonathan Larmour
2000-10-26 13:01   ` Dave Airlie
2000-10-26 13:09     ` 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).