diff options
-rw-r--r-- | nuttx/ChangeLog | 4 | ||||
-rwxr-xr-x | nuttx/Documentation/README.html | 5 | ||||
-rwxr-xr-x | nuttx/README.txt | 2 | ||||
-rw-r--r-- | nuttx/arch/mips/src/pic32mx/pic32mx-irq.c | 2 | ||||
-rw-r--r-- | nuttx/configs/README.txt | 9 | ||||
-rw-r--r-- | nuttx/lib/stdio/lib_fclose.c | 34 | ||||
-rw-r--r-- | nuttx/lib/stdio/lib_libfflush.c | 2 |
7 files changed, 40 insertions, 18 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index c91093852..5c8b5c535 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -2155,4 +2155,8 @@ do not work with R61580 LCD. * configs/pic32-starterkit: Beginning of a configuratin for the Microchip PIC32 Ethernet Starter Kit. + * lib/stdio/lib_fclose.c: fclose() always returns an error (EOF) when it + closes a read-only file. This is because it calls flush() which will + fail on read-only files. No harm is done other that a bad value is + returned. diff --git a/nuttx/Documentation/README.html b/nuttx/Documentation/README.html index 2cd1908c4..c8b740c23 100755 --- a/nuttx/Documentation/README.html +++ b/nuttx/Documentation/README.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttX README Files</i></font></big></h1> - <p>Last Updated: September 21, 2011</p> + <p>Last Updated: October 10, 2011</p> </td> </tr> </table> @@ -126,11 +126,12 @@ | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/olimex-strp711/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- pcblogic-pic32mx/ | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/pcblogic-pic32mx/README.txt?view=log"><b><i>README.txt</i></b></a> + | | |- pic32-starterkit/ + | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/pic32-starterkit/README.txt?view=log"><b><i>README.txt</i></b></a> | | |- pjrc-8051/ | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/pjrc-8051/include/README.txt?view=log">include/README.txt</a> | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/pjrc-8051/src/README.txt?view=log">src/README.txt</a> | | | `- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/pjrc-8051/README.txt?view=log"><b><i>README.txt</i></b></a> - | | |- qemu-i486/ | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/qemu-i486/include/README.txt?view=log">include/README.txt</a> | | | |- <a href="http://nuttx.svn.sourceforge.net/viewvc/nuttx/trunk/nuttx/configs/qemu-i486/src/README.txt?view=log">src/README.txt</a> diff --git a/nuttx/README.txt b/nuttx/README.txt index fe94337c4..63f78cd21 100755 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -413,6 +413,8 @@ nuttx | | `- README.txt | |- pcblogic-pic32mx/ | | `- README.txt + | |- pic32-starterkit/ + | | `- README.txt | |- pjrc-8051/ | | |- include/README.txt | | |- src/README.txt diff --git a/nuttx/arch/mips/src/pic32mx/pic32mx-irq.c b/nuttx/arch/mips/src/pic32mx/pic32mx-irq.c index 75f7367ff..98c554c78 100644 --- a/nuttx/arch/mips/src/pic32mx/pic32mx-irq.c +++ b/nuttx/arch/mips/src/pic32mx/pic32mx-irq.c @@ -97,7 +97,7 @@ void up_irqinitialize(void) putreg32(0xffff, PIC32MX_INT_IEC0CLR); putreg32(0xffff, PIC32MX_INT_IEC1CLR); -#ifdef PIC32MX_INT_IEC1CLR +#ifdef PIC32MX_INT_IEC2CLR putreg32(0xffff, PIC32MX_INT_IEC2CLR); #endif diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index c18bde321..f19fa28ee 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -1321,7 +1321,14 @@ configs/pcblogic-pic32mx STATUS: Code complete but testing has been stalled due to tool related problems (PICkit 2 does not work with the PIC32). -confgis/qemu-i486 +configs/pic32-starterkit + + This README file discusses the port of NuttX to the Microchip PIC32 Ethernet + Starter Kit (DM320004) with the Multimedia Expansion Board (MEB, DM320005). + Advanced USB Storage. See www.microchip.com for further information. + +configs/qemu-i486 + Port of NuttX to QEMU in i486 mode. This port will also run on real i486 hardwared (Google the Bifferboard). diff --git a/nuttx/lib/stdio/lib_fclose.c b/nuttx/lib/stdio/lib_fclose.c index 06f970e11..8cecb8af3 100644 --- a/nuttx/lib/stdio/lib_fclose.c +++ b/nuttx/lib/stdio/lib_fclose.c @@ -2,7 +2,7 @@ * lib/stdio/lib_fclose.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -41,6 +41,7 @@ #include <unistd.h> #include <stdlib.h> +#include <fcntl.h> #include <string.h> #include <errno.h> @@ -70,29 +71,36 @@ int fclose(FAR FILE *stream) { int err = EINVAL; int ret = ERROR; + int status; /* Verify that a stream was provided. */ if (stream) { - /* Flush the stream */ - - ret = lib_fflush(stream, true); - err = errno; + /* Check that the underlying file descriptor corresponds to an an open + * file. + */ + + ret = OK; + if (stream->fs_filedes >= 0) + { + /* If the stream was opened for writing, then flush the stream */ - /* Close the underlying file descriptor */ + if ((stream->fs_oflags & O_WROK) != 0) + { + ret = lib_fflush(stream, true); + err = errno; + } - if (stream->fs_filedes > 0) - { - /* Close the file and save the return status */ + /* Close the underlying file descriptor and save the return status */ - int status = close(stream->fs_filedes); + status = close(stream->fs_filedes); - /* If close() returns an error but flush() did not then make - * sure that we return the close() error condition. + /* If close() returns an error but flush() did not then make sure + * that we return the close() error condition. */ - if (ret == 0) + if (ret == OK) { ret = status; err = errno; diff --git a/nuttx/lib/stdio/lib_libfflush.c b/nuttx/lib/stdio/lib_libfflush.c index 3e9de538a..ddfc6c8ff 100644 --- a/nuttx/lib/stdio/lib_libfflush.c +++ b/nuttx/lib/stdio/lib_libfflush.c @@ -2,7 +2,7 @@ * lib/stdio/lib_libfflush.c * * Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> + * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions |