From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Edwards To: harri.siirtola@vtt.fi Cc: Jonathan Larmour , Greg Marsden , ecos-discuss@sources.redhat.com Subject: Re: [ECOS] Serial I/O read Date: Wed, 26 Sep 2001 07:44:00 -0000 Message-id: <20010926094727.A14849@visi.com> References: <3.0.32.20010926115941.00994490@vttmail.vtt.fi> X-SW-Source: 2001-09/msg00674.html On Wed, Sep 26, 2001 at 11:59:43AM +0300, harri.siirtola@vtt.fi wrote: > At 20:07 25.9.2001 +0100, Jonathan Larmour wrote: > >Greg Marsden wrote: > >> > >> Is there a way that I can request a read of a block of > >> characters from a serial port and have the read function > >> return when it has between 1 and blockLen characters. > >> > >> Most Unix and Win32 api's support this mode, Ecos seems to wait > >> until a full buffer is available or it returns immediately with > >> no characters in non blocking mode. > > > >The only way to get that type of behaviour with eCos at present is to use > >the file I/O package and select() followed by a non-blocking read(). > > > >Jifl > > Another way is to establish an rx semaphore and posting it in the serial > DSR. A receiver thread (or function) counting this semaphore (and reading > the rx reg) can stop on any char count received. Adding the semi-blocking read mode to the "generic" part of the serial driver should be really trivial: change one line of code in serial.c and add a two lines to an include file somewhere. If I could run the current CVS snapshot, I'd go ahead and do it. But, updating to the current CVS snapshot isn't at the top of my list yet. -- Grant Edwards grante@visi.com