This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A "pipe" like object for eCos?


On 2008-05-29, Andrew Lunn <andrew@lunn.ch> wrote:
> On Thu, May 29, 2008 at 06:27:30PM +0000, Grant Edwards wrote:
>> I find myself in need of a "pipe" like object in an eCos
>> application (one that doesn't have file I/O and Posix support
>> enabled).  All I need is a simple circular buffer in RAM with
>> blocking and non-blocking read/write methods.  Am I correct in
>> my conclusion that eCos doesn't have something like that as
>> part of it's core functionality?
>> 
>> I haven't found anything like that in the docs, but I thought
>> I'd double-check before I go off and write something...
>
> There was a pipe implementation contributed. I spent some time
> cleaning it up a few years ago. Try the attachment.

That looks pretty close to what I need, except it doesn't
support non-blocking write (AFAICT).

Does anybody else find the BSD select() API extremely clumsy
when one simply wants to do something like a non-blocking write
or a read with a timeout?

It sure seems like a cyg_io_read() or cyg_io_write() with a
timeout value (e.g. negative is blocking, zero is non-blocking,
positive is timeout in system ticks) would be a lot cleaner and
less error-prone than having to configure the fileio package
and then messing about with fdset macros and a timeval struct.
Even then, it seems you don't get non-blocking write semantics
unless you call select for every single byte you want to write.

In the original eCos I/O subsystem design, how was one supposed
to do non-blocking read/write operations or read/write
operations with timeouts?  I ended up added those features to
my serial driver, but it was a bit of a kludge that was done
"behind the curtains" by setting various flags/values with
cyg_io_set_config() before calling cyg_io_read/write().

-- 
Grant Edwards                   grante             Yow! I just went below the
                                  at               poverty line!
                               visi.com            


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]