Fix serial read behavior
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1275 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
2197c62693
commit
6e3d0b9ec1
|
@ -567,4 +567,8 @@
|
|||
* Add poll() and select() APIs (in the initial check-in, these work only with character devices)
|
||||
* Add poll() methods to /dev/null, /dev/zero, pipes, fifos, and serial drivers.
|
||||
* Add examples/poll for testing poll() and select()
|
||||
* Fix hostile behavior of getc, fgetc, getchar, etc.: the serial driver was waiting for a
|
||||
full buffer of read data before return. This means that getc would stall when it needed
|
||||
to refill the input buffer. The old behavior (read full blocks) might be useful in other
|
||||
contexts, so it is still available within the driver as a configuration option.
|
||||
|
||||
|
|
|
@ -1203,6 +1203,10 @@ nuttx-0.3.19 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
|||
* Add poll() and select() APIs (in the initial check-in, these work only with character devices)
|
||||
* Add poll() methods to /dev/null, /dev/zero, pipes, fifos, and serial drivers.
|
||||
* Add examples/poll for testing poll() and select()
|
||||
* Fix hostile behavior of getc, fgetc, getchar, etc.: the serial driver was waiting for a
|
||||
full buffer of read data before return. This means that getc would stall when it needed
|
||||
to refill the input buffer. The old behavior (read full blocks) might be useful in other
|
||||
contexts, so it is still available within the driver as a configuration option.
|
||||
|
||||
pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
|
|
50
nuttx/TODO
50
nuttx/TODO
|
@ -9,13 +9,14 @@ NuttX TODO List (Last updated November 17, 2008)
|
|||
(1) C++ Support
|
||||
(12) Network (net/, netutils/)
|
||||
(1) USB (drivers/usbdev)
|
||||
(3) Libraries (lib/)
|
||||
(4) Libraries (lib/)
|
||||
(6) File system/Generic drivers (fs/, drivers/)
|
||||
(1) Pascal add-on (pcode/)
|
||||
(2) Documentation (Documentation/)
|
||||
(3) Build system
|
||||
(2) NuttShell (NSH) (examples/nsh)
|
||||
(1) Other Applications & Tests (examples/)
|
||||
(2) Linux/Cywgin simulation (arch/sim)
|
||||
(2) ARM (arch/arm/)
|
||||
(1) ARM/C5471 (arch/arm/src/c5471/)
|
||||
(1) ARM/DM320 (arch/arm/src/dm320/)
|
||||
|
@ -230,13 +231,19 @@ o Libraries (lib/)
|
|||
Status: Open
|
||||
Priority: Medium
|
||||
|
||||
Description: Buffered C, character-oriented I/O is not very useful when
|
||||
dealing with a console. The behavior is to read a full buffer
|
||||
of data then return the individual characters from the buffer.
|
||||
But that is very hostile when working with a human interface.
|
||||
Description: fgets implementation does not use C-buffered I/O, but rather
|
||||
talks to serial driver directly via read(). It includes VT-100
|
||||
specific editting commands. This gets should be renamed readlin()
|
||||
and a more generic fgets() should be implemented.
|
||||
Status: Open
|
||||
Priority: Medium. Workarounds: Set CONFIG_STDIO_BUFFER_SIZE=0 in the
|
||||
configuration file.
|
||||
Priority: Low (unless you are using mixed C-buffered I/O with fgets and
|
||||
fgetc, for example).
|
||||
|
||||
Description: Need some minimal termios support... at a minimum, enough to
|
||||
switch between raw and "normal" modes to support behavior like
|
||||
that needed for readline().
|
||||
Status: Open
|
||||
Priority: Low
|
||||
|
||||
o File system / Generic drivers (fs/, drivers/)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -318,16 +325,21 @@ o Build system
|
|||
Priority: Low
|
||||
|
||||
Description: Dependencies do not work correctly under configs/<board>/src
|
||||
(same as arch/<arch>/src/board). Seems to be worse using SDCC.
|
||||
(same as arch/<arch>/src/board).
|
||||
Status: Open
|
||||
Priority: Medium (maybe higher for z80 target)
|
||||
|
||||
Description: It would be nice to de-couple some of the behaviors enabled by
|
||||
CONFIG_DEBUG. For example, CONFIG_DEBUG turns on debug output,
|
||||
but also disables optimization make the binary much bigger.
|
||||
Status: Low. There workaround is easy.. just edit the configuration's
|
||||
Status: Open
|
||||
Priority: Low. There workaround is easy.. just edit the configuration's
|
||||
Make.def file to control the behavior that you want.
|
||||
Priority: Very low.
|
||||
|
||||
Description: Need a NuttX configuration tool. The number of configuration
|
||||
settings has become quite large and difficult to manage manually.
|
||||
Status: Open
|
||||
Priority: Medium-low
|
||||
|
||||
o NuttShell (NSH) (examples/nsh)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -351,6 +363,24 @@ o Other Applications & Tests (examples/)
|
|||
incorrectly on the Cywgin-based simulation platform (but works
|
||||
fine on the Linux-based simulation platform).
|
||||
|
||||
o Linux/Cywgin simulation (arch/sim)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Description: Need to implement timing. Use system timing resources to fake
|
||||
a NuttX real time clock. At present, the timer is driven in
|
||||
non-realtime (like 1000x realtime) and causes some behavior
|
||||
differences from real platforms.
|
||||
Status: Open
|
||||
Priority: Low (because the simulator is only a test/development platform)
|
||||
|
||||
Description: The simulated serial driver also has some odd behavior. It
|
||||
will stall for a long time on reads when the C stdio buffers are
|
||||
being refilled. This only effects the behavior of things like
|
||||
fgetc(). Workaround: Set CONFIG_STDIO_BUFFER_SIZE=0, suppressing
|
||||
all C buffered I/O.
|
||||
Status: Open
|
||||
Priority: Low (because the simulator is only a test/development platform)
|
||||
|
||||
o ARM (arch/arm/)
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
|
@ -318,8 +318,9 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEV_SERIAL_FULLBLOCKS
|
||||
/* No... then we would have to wait to get receive more data.
|
||||
* If the user has specified the O_NONBLOCK option, then do not
|
||||
* If the user has specified the O_NONBLOCK option, then just
|
||||
* return what we have.
|
||||
*/
|
||||
|
||||
|
@ -333,15 +334,36 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen
|
|||
{
|
||||
recvd = -EAGAIN;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#else
|
||||
/* No... the circular buffer is empty. Have we returned anything
|
||||
* to the caller?
|
||||
*/
|
||||
|
||||
/* Break out of the loop and return the number of bytes
|
||||
else if (recvd > 0)
|
||||
{
|
||||
/* Yes.. break out of the loop and return the number of bytes
|
||||
* received up to the wait condition.
|
||||
*/
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise we are going to wait */
|
||||
/* No... then we would have to wait to get receive some data.
|
||||
* If the user has specified the O_NONBLOCK option, then do not
|
||||
* wait.
|
||||
*/
|
||||
|
||||
else if (filep->f_oflags & O_NONBLOCK)
|
||||
{
|
||||
/* Break out of the loop returning -EAGAIN */
|
||||
|
||||
recvd = -EAGAIN;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
/* Otherwise we are going to have to wait for data to arrive */
|
||||
|
||||
else
|
||||
{
|
||||
|
|
|
@ -124,8 +124,7 @@ examples/serloop
|
|||
|
||||
* CONFIG_EXAMPLES_SERLOOP_BUFIO
|
||||
Use C buffered I/O (getchar/putchar) vs. raw console I/O
|
||||
(read/read). The behavior of the NuttX getchar() call is
|
||||
very hostile unless you also set CONFIG_STDIO_BUFFER_SIZE=0.
|
||||
(read/read).
|
||||
|
||||
examples/udp
|
||||
^^^^^^^^^^^^
|
||||
|
|
Loading…
Reference in New Issue