Merge branch 'master' into px4io-i2c

This commit is contained in:
px4dev
2013-01-23 18:58:19 -08:00
231 changed files with 15553 additions and 1864 deletions
+169 -2
View File
@@ -1452,7 +1452,7 @@
complex: 'uname -o 2>/dev/null || echo "Other"'
* drivers/usbhost/usbhost_enumerate.c: Add logic to get the VID and PID. This
is necessary in order to support vendor-specific USB devices.
* examplex/wlan, configs/olimex-lpc1766stk/wlan, drivers/usbhost/usbhost_rtl8187.c,
* examples/wlan, configs/olimex-lpc1766stk/wlan, drivers/usbhost/usbhost_rtl8187.c,
Add infrastructure to support RTL18187 wireless USB.
* configs/nucleus2g: backed out USB host changes... wrong board.
* Renamed arc/hc/include/mc9s12ne64 and src/mc9s12ne64 to m9s12. That name is
@@ -1920,7 +1920,7 @@
CONFIG_FAT_LCNAMES is not selected, all filenames are strictly upper
case.
* configs/stm3210e-eval/nsh2: Console is back on UART1; Added
examplex/nx as an NSH "built-in" command as a demonstration.
examples/nx as an NSH "built-in" command as a demonstration.
* fs/fat/fs_fat32dirent.c: Fix an important bug in the directory
allocation (fat_allocatedirentry()). I looks like it could be
initializing the wrong sectors! NOTE: This function was in
@@ -3801,3 +3801,170 @@
to find executables using a relative path.
6.25 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
* graphics/: Adds 5x8 monospace font. This tiny font is useful for graph
labels and for small bitmapped display. Contributed by Petteri
Aimonen.
* configs/stm3220g-eval/nxwm: Converted to use the kconfig-frontends
configuration tool.
* configs/sim/nxwm: Converted to use the kconfig-frontends configuration
tool.
* include/pthread.h: In sys/prctl.h because it is needed by
pthread_[set|get]name_np()
* tools/kconfig.bat: Kludge to run kconfig-frontends from a DOS shell.
* sched/sig_timedwait.c: Should always move the time up to the next
largest number of system ticks. The logic was rounding. Noted by
Petteri Aimonen.
* arch/arm/src/up_head.S: Fix backward conditional compilation. NOTE
there is a issue of ARM9 systems with low vectors and large memories
that will have to be addressed in the future.
* libc/misc/lib_kbdencode.c and lib_kbddecode.c: Add logic to marshal
and serialized "out-of-band" keyboard commands intermixed with normal
ASCII data (not yet hooked into anything).
* drivers/usbhost/usbhost_hidkbd.c: If CONFIG_HIDKBD_ENCODED is
defined, this driver will now use libc/misc/lib_kbdencode.c to
encode special function keys.
* configs/olimex-lpc1766stk/hidkbd: This configuration has been
converted to use the kconfig-frontends configuration tool.
* drivers/lcd/ug-2864hsweg01.c and include/nuttx/lcd/ug-2864hsweg01.h:
Driver for UG-2864HSWEG01 OLED contributed by Darcy Gong.
* configs/stm32f4discovery/src/up_ug2864hsweg01.c: Support for the
UG-2864HSWEG01 OLED for the STM32F4Discovery board.
* drivers/usbhost/usbhost_hidkbd.c: Correct a logic error in how
tasks waiting for read data are awakened.
* libc/misc/lib_kbdencode.c and lib_kbddecode.c: Now handles keypress
events too. However, the USB HID keyboard drier has not yet been
updated to detect key release events. That is kind of tricky in
the USB HID keyboard report data.
* configs/mcu123-214x/nsh: Converted to use the kconfig-frontends
configuration tool.
* configs/zp214xpa: Add basic support for the The0.net ZP213x/4xPA
board (with the LPC2148 and the UG_2864AMBAG01).
* configs/sim/nxlines: Add an nxlines configuration for the
simulator.
* configs/zp214xpa/nxlines: Add an nxlines configuration for the
ZP213x/4xPA (with the LPC2148 and the UG_2864AMBAG01). Working
as of 2012-12-30.
* configs/olimex-lpc1766stk/wlan: Remove non-functional
configuration.
* configs/stm32f4discovery/src and nuttx/drivers/lcd/ug-2864hsweg01.c:
Updates and correctinos for the UG-2864HSWEG01 from Darcy Gong.
* configs/lm326965-ek: All configurations converted to use the
kconfig-frontends configuration tool.
* configs/Kconfig: NSH_MMCSDSPIPORTNO should depend on MMCSD_SPI,
not just SPI (from Jose Pablo Carballo).
* arch/arm/src/arm/Kconfig and armv7m/Kconfig: Add an option for
buildroot toolchains: They may be EABI or OABI.
* include/nuttx/progmem and arch/arm/src/stm32/stm32_flash.c:
Fix a counting bug plus change interface to use either relative
or absolut FLASH addressing (from Freddie Chopin).
* libc/misc/Make.defs: Fix error in conditional for KBD CODEC.
* libc/Kconfig and configs/*/defconfig (several): The default
setting should be CONFIG_LIB_KBDCODEC=n
* tools/configure.c: configure.c can be used to build a work-alike
program as a replacement for configure.sh. This work-alike
program would be used in environments that do not support Bash
scripting (such as the Windows native environment).
* tools/configure.bat: configure.bat is a small Windows batch
file that can be used as a replacement for configure.sh in a
Windows native environment. configure.bat is actually just a
thin layer that execuates configure.exe if it is available. If
configure.exe is not available, then configure.bat will attempt
to build it first.
* arch/arm/src/lpc17xx/lpc17_syscon.h: Correct some typos in bit
definitions (from Rommel Marcelo).
* libc/string/lib_strndup.c: strndup() should use strnlen(), not
strlen(), to determine the size of the string.
* sched/os_bringup.c: Remove support for CONFIG_BUILTIN_APP_START.
This is not really a useful feature and creates a violation of the
OS layered architecture.
* include/unistd.h, arch/arch/src/*: Implement a simple vfork().
On initial checkin, this API is available only for ARM platforms.
* binfmt/binfmt_exec.c: exec() now sets the priority of the new task
to the same priority as the current task (instead of the arbirtrary
value of 50).
* libc/unisted/lib_execv.c and lib_execl.c: New, somewhat flawed,
implementations of execv() and execl().
* tools/cfgdefine.c: Strips quotes from CONFIG_EXECFUNCS_SYMTAB
value.
* arch/arm/include/lm3s/chip.h: Move chip definitions into
public include area for compatibility with other architectures.
* arch/arm/src/lm3s/chip: Move register definition header files
into a new chip/ sub-directory.
* arch/arm/src/lm3s/lm3s_internal.h: Broke up into several
smaller header files.
* arch/arm/src/lm: Rename the arch/arm/src/lm3s directory to
arch/arm/src/lm so that is can support other members of the
Stellaris family.
* libc/spawn: Add file action interfaces needed by posix_spawn().
* sched/clock_time2ticks.c: Another case where time was being
rounded down instead of up (from Mike Smith).
* libc/spawn: Implementation of posix_spawn() is complete but
untested and undocumented.
* drivers/usbdev/pl2303.c: Fix typols in the PL2303 driver
(from Max Holtzberg).
* configs/stm32f4discovery/posix_spawn: Added a configuration
that can be used for testing posix_spawn().
* arch/arm/src/stm32: Bring F1 support for general DMA and serial
DMA in paricular up to parity with F2/F4 (from Mike Smith).
* libc/stdio/lib_libfread.c: Correct some error handling when
lib_fread() was passed a bad stream. Needed to move the
releasing of a semaphore inside of some conditional logic
(cosmetic).
* include/nuttx/sched.h, sched/task_setup.c, and sched/task_exithook.c:
Add support for remembering the parent task and sending
SIGCHLD to the parent when the task exists.
* sched/task_exithook.c: Fixed a *critical* bug. Here is
the scenario: (1) sched_lock() is called increments the lockcount
on the current TCB (i.e., the one at the head of the ready to run
list), (2) sched_mergepending is called which may change the task
at the head of the readytorun list, then (2) sched_unlock() is called
which decrements the lockcount on the wrong TCB. The failure case
that I saw was that pre-emption got disabled in the IDLE thread,
locking up the whole system.
* sched/sched_waitpid.c: Use SIGCHLD instead of a semaphore. This
is a much more spec-compliant implemenation. However, there are
some issues with overruning signals because NuttX does not support
queueing of signals (POSIX does not require it). I think it may
need to.
* sched/sched_waitid.c and sched_wait.c: Add support for waitid()
and wait(). See issues with waitpid() above.
* include/nuttx/fs/fs.h and fs/fs_files.c: Add a dup() method to
the struct mountpt_operations. When dup'ing a file that resides
on a mounted volume, let the file system's dup() method do the
work.
* fs/romfs/fs_romfs.c: Implemented the dup() method for the ROMFS
file system.
* fs/fat/fs_fat32.c, fs/nxffs/nxffs_initialize, and
fs/nfs/nfs_vfsops.c: Add hooks for dup() method (not yet
implemented).
* fs/romfs: Remove the rf_open flag. It looks good, but actually
does nothing.
* fs/fat: Remove the ff_open flag. Same story as for the ROMFS
rf_open flag.
* fs/fat/fs_fat32.c, fs/nxffs/nxffs_initialize, and
fs/nfs/nfs_vfsops.c: Completed implementation of the dup() methods.
There is still no good test available.
* sched/sig_timedwait.c: sigtimedwait() would return a bad signal
number if the signal was already pending when the function was
called.
* configs/ubw32/scripts: All common linker scripts moved to this
scripts sub-directory
* configs/ubw32/ostest: Configuration configured to use the
kconfig-frontends tools.
* arch/mips/src/mips32/up_vfork.c, up_vfork.h, and vfork.S:
Implement vfork() for MIPS32 (no floating point support)
* configs/ubw32/ostest: Enable the vfork() test.
* fs/binfs: Move apps/builtin/binfs.c to fs/binfs/fs_binfs.c
CONFIG_APPS_BINDIR rename CONFIG_FS_BINFS
* include/nuttx/binfmt/builtin.h: Some of the content of
apps/include/apps.h moved to include/nuttx/binfmt/builtin.h
* binfmt/libbuiltin/libbuiltin_utils.c: Move utility builtin
utility functions from apps/builtin/exec_builtins.c to
binfmt/libbuiltin/libbuiltin_utils.c
* binfmt/builtin.c and binfmt/libbuiltin: Add a binary "loader"
that can be used to execute builtin programs from the BINFS
file system.
* configs/sim/nsh: Convert to use kconfig-frontends configuration
tool.
+3 -3
View File
@@ -642,13 +642,13 @@ pass2dep: context tools/mkdeps$(HOSTEXEEXT)
# misc/tools/README.txt for additional information.
config:
$(Q) APPSDIR=${CONFIG_APPS_DIR} conf Kconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-conf Kconfig
oldconfig:
$(Q) APPSDIR=${CONFIG_APPS_DIR} conf --oldconfig Kconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-conf --oldconfig Kconfig
menuconfig:
$(Q) APPSDIR=${CONFIG_APPS_DIR} mconf Kconfig
$(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-mconf Kconfig
# export
#
+11 -8
View File
@@ -252,7 +252,7 @@ LINKLIBS = $(patsubst lib\\%,%,$(NUTTXLIBS))
BIN = nuttx$(EXEEXT)
all: $(BIN)
.PHONY: context clean_context check_context export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean
.PHONY: context clean_context check_context configenv config oldconfig menuconfig export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean
# Target used to copy include\nuttx\math.h. If CONFIG_ARCH_MATH_H is
# defined, then there is an architecture specific math.h header file
@@ -452,7 +452,7 @@ clean_context:
# check_context
#
# This target checks if NuttX has been configured. NuttX is configured using
# the script tools\configure.sh. That script will install certain files in
# the script tools\configure.bat. That script will install certain files in
# the top-level NuttX build directory. This target verifies that those
# configuration files have been installed and that NuttX is ready to be built.
@@ -647,14 +647,17 @@ pass2dep: context tools\mkdeps$(HOSTEXEEXT)
# location: http://ymorin.is-a-geek.org/projects/kconfig-frontends. See
# misc\tools\README.txt for additional information.
config:
$(Q) APPSDIR=${CONFIG_APPS_DIR} conf Kconfig
configenv:
$(Q) set APPSDIR=${CONFIG_APPS_DIR}
oldconfig:
$(Q) APPSDIR=${CONFIG_APPS_DIR} conf --oldconfig Kconfig
config: configenv
$(Q) kconfig-conf Kconfig
menuconfig:
$(Q) APPSDIR=${CONFIG_APPS_DIR} mconf Kconfig
oldconfig: configenv
$(Q) kconfig-conf --oldconfig Kconfig
menuconfig: configenv
$(Q) kconfig-mconf Kconfig
# export
#
+233 -51
View File
@@ -10,6 +10,9 @@ README
o Configuring NuttX
- Instantiating "Canned" Configurations
- NuttX Configuration Tool
- Incompatibilities with Older Configurations
- Converting Older Configurations to use the Configuration Tool
- NuttX Configuration Tool under DOS
o Toolchains
- Cross-Development Toolchains
- NuttX Buildroot Toolchain
@@ -38,6 +41,10 @@ Installing Cygwin
tiny setup.exe program and it does the real, internet installation
for you.
NOTE: NuttX can also be installed and built on a native Windows
system, but with some loss of tool functionality (see the
discussion "Native Windows Build" below).
Some Cygwin installation tips:
1. Install at C:\cygwin
@@ -58,8 +65,9 @@ Installing Cygwin
After installing Cygwin, you will get lots of links for installed
tools and shells. I use the RXVT native shell. It is fast and reliable
and does not require you to run the Cygwin X server (which is neither
fast nor reliable). The rest of these instructions assume that you
are at a bash command line prompt in either Linux or in Cygwin shell.
fast nor reliable). Unless otherwise noted, the rest of these
instructions assume that you are at a bash command line prompt in
either Linux or in Cygwin shell.
Download and Unpack
-------------------
@@ -235,8 +243,8 @@ additional file to the directory the NuttX application package (APPSDIR)):
The appconfig file describes the applications that need to be
built in the appliction directory (APPSDIR). Not all configurations
have an appconfig file. This file is deprecated and will not be
used with new defconfig files produced with the mconf configuration
tool.
used with new defconfig files produced with the kconfig-mconf
configuration tool.
General information about configuring NuttX can be found in:
@@ -249,6 +257,13 @@ easier. It is used as follows:
cd ${TOPDIR}/tools
./configure.sh <board-name>/<config-dir>
There is an alternative Windows batch file that can be used in the
windows native enironment like:
cd ${TOPDIR}\tools
configure.bat <board-name>\<config-dir>
See tools/README.txt for more information about these scripts.
NuttX Configuration Tool
------------------------
@@ -292,6 +307,162 @@ NuttX Configuration Tool
install 'mconf', make certain that your PATH variable includes
a path to that installation directory.
The basic configuration order is "bottom-up":
- Select the build environment,
- Select the processor,
- Select the board,
- Select the supported peripherals
- Configure the device drivers,
- Configure the application options on top of this.
This is pretty straight forward for creating new configurations
but may be less intuitive for modifying existing configurations.
Incompatibilities with Older Configurations
-------------------------------------------
***** WARNING *****
The old legacy, manual configurations and the new kconfig-frontends
configurations are not 100% compatible. Old legacy configurations
can *not* be used with the kconfig-frontends tool: If you run
'make menuconfig' with a legacy configuration the resulting
configuration will probably not be functional.
Q: How can I tell if a configuration is a new kconfig-frontends
configuration or an older, manual configuration?
A: a) New kcondfig-frontends configurations will have this setting
within the defconfig/.config file":
CONFIG_NUTTX_NEWCONFIG=y
b) Only old, manual configurations will have an appconfig file
Converting Older Configurations to use the Configuration Tool
-------------------------------------------------------------
Q: How can I convert a older, manual configuration into a new,
kconfig-frontends toolchain.
A: 1) Look at the appconfig file: Each application path there
will now have to have an enabling setting. For example,
if the old appconfig file had:
CONFIGURED_APPS = examples/ostest
Then the new configuration will need:
CONFIG_EXAMPLES_OSTEST=y
The appconfig file can then be deleted because it will not
be needed after the conversion.
2) Build the cmpconfig utility at tools:
cd tools
make -f Makefile.host cmpconfig
3) Perform these steps repeatedly until you are convinced that
the configurations are the same:
a) Repeat the following until you have account for all of the differences:
cp configs/<board>/<condfiguration>/defconfig .config
make menuconfig (Just exit and save the new .config file)
tools/cmpconfig configs/<board>/<condfiguration>/defconfig .config | grep file1
The final grep will show settings in the old defconfig file that
do not appear in the new .config file (or have a different value
in the new .config file). In the new configuration, you will
probably have to enable certain groups of features. Such
hierarachical enabling options were not part of the older
configuration.
b) Then make sure these all make sense:
tools/cmpconfig configs/<board>/<condfiguration>/defconfig .config | grep file2
The final grep will show settings in the new .config file that
do not appear in the older defconfig file (or have a different value
in the new .config file). Here you should see only the new
hierarachical enabling options (such as CONFIG_SPI or CONFIG_MMCSD)
plus some other internal configuration settings (like CONFIG_ARCH_HAVE_UART0).
You will have to convince yourself that these new settings all make sense.
4) Finally, update the configuration:
cp .config configs/<board>/<condfiguration>/defconfig
rm configs/<board>/<condfiguration>/appconfig
NOTE: You should comment out the line containing the CONFIG_APPS_DIR
in the new defconfig file. Why? Because the application directory
may reside at a different location when the configuration is installed
at some later time.
# CONFIG_APPS_DIR="../apps"
5) The updated configuration can then be instantiated in the normal
fashion:
cd tools
./configure.sh <board>/<condfiguration>
(or configure.bat for the case of the Windows native build).
NOTE: If CONFIG_APPS_DIR is not defined in the defconfig file,
the configure.sh script will find and add the new, correct path to
the application directory (CONFIG_APPS_DIR) when it copies the
defconfig file to the .config file. This is the setting that was
commented out in step 4.
NuttX Configuration Tool under DOS
----------------------------------
Recent versions of NuttX support building NuttX from a native Windows
console window (see "Native Windows Build" below). But kconfig-frontends
is a Linux tool. There have been some successes building a Windows
native version of the kconfig-frontends tool, but that is not ready
for prime time.
At this point, there are only a few options for the Windows user:
1. You can run the configuration tool using Cygwin. However, the
Cygwin Makefile.win will complain so to do this will, you have
to manually edit the .config file:
a. Delete the line: CONFIG_WINDOWS_NATIVE=y
b. Change the apps/ directory path, CONFIG_APPS_DIR to use Unix
style delimiters. For example, change "..\apps" to "../apps"
And of course, after you use the configuration tool you need to
restore CONFIG_WINDOWS_NATIVE=y and the correct CONFIG_APPS_DIR.
2) You can, with some effort, run the the Cygwin kconfig-mconf tool
directly in the Windows console window. In this case, you do not
have to modify the .config file, but there are other complexities:
a. You need to temporarily set the Cgywin directories in the PATH
variable then run kconfig-mconf manually like:
kconfig-mconf Kconfig
There is a Windows bacht file at tools/kconfig.bat that automates
these steps:
tools/kconfig menuconfig
b. There is an issue with accessing DOS environment variables from
the Cygwin kconfig-mconf running in the Windows console. The
following change to the top-level Kconfig file seems to work
around these problems:
config APPSDIR
string
- option env="APPSDIR"
+ default "../apps"
TOOLCHAINS
^^^^^^^^^^
@@ -509,82 +680,93 @@ Native Windows Build
- A few extensions from GNUWin32
In this build, you cannot use a Cygwin or MSYS shell. Rather the build must
be performed in a Windows CMD shell. Here is a better shell than than the
standard issue, CMD shell: ConEmu which can be downloaded from:
be performed in a Windows console window. Here is a better terminal than the
standard issue, CMD.exe terminal: ConEmu which can be downloaded from:
http://code.google.com/p/conemu-maximus5/
Build Tools. The build still relies on some Unix-like commands. I use
the GNUWin32 tools that can be downloaded from http://gnuwin32.sourceforge.net/.
Host Compiler: I use the MingGW compiler which can be downloaded from
Host Compiler: I use the MingGW GCC compiler which can be downloaded from
http://www.mingw.org/. If you are using GNUWin32, then it is recommended
the you not install the optional MSYS components as there may be conflicts.
This capability should still be considered a work in progress because:
(1) It has not been verfied on all targets and tools, and
(2) it still lacks some of the creature-comforts of the more mature environments
(like 'make menuconfig' support. See the section "NuttX Configuration Tool
under DOS" above).
There is an alternative to the setenv.sh script available for the Windows
native environment: tools/configure.bat. See tools/README.txt for additional
information.
Installing GNUWin32
-------------------
The Windows native build will depend upon a few Unix-like tools that can be
provided either by MSYS or GNUWin32. The GNUWin32 are available from
http://gnuwin32.sourceforge.net/. GNUWin32 provides ports of tools with a
GPL or similar open source license to modern MS-Windows (Microsoft Windows
2000 / XP / 2003 / Vista / 2008 / 7). See
http://gnuwin32.sourceforge.net/packages.html for a list of all of the tools
available in the GNUWin32 package.
The Windows native build will depend upon a few Unix-like tools that can be
provided either by MSYS or GNUWin32. The GNUWin32 are available from
http://gnuwin32.sourceforge.net/. GNUWin32 provides ports of tools with a
GPL or similar open source license to modern MS-Windows (Microsoft Windows
2000 / XP / 2003 / Vista / 2008 / 7). See
http://gnuwin32.sourceforge.net/packages.html for a list of all of the tools
available in the GNUWin32 package.
The SourceForge project is located here:
http://sourceforge.net/projects/gnuwin32/. The project is still being
actively supported (although some of the Windows ports have gotten very old).
The SourceForge project is located here:
http://sourceforge.net/projects/gnuwin32/. The project is still being
actively supported (although some of the Windows ports have gotten very old).
Some commercial toolchains include a subset of the GNUWin32 tools in the
installation. My recommendation is that you download the GNUWin32 tools
directly from the sourceforge.net website so that you will know what you are
using and can reproduce your build environment.
Some commercial toolchains include a subset of the GNUWin32 tools in the
installation. My recommendation is that you download the GNUWin32 tools
directly from the sourceforge.net website so that you will know what you are
using and can reproduce your build environment.
GNUWin32 Installation Steps:
GNUWin32 Installation Steps:
The following steps will download and execute the GNUWin32 installer.
The following steps will download and execute the GNUWin32 installer.
1. Download GetGNUWin32-x.x.x.exe from
http://sourceforge.net/projects/getgnuwin32/files/. This is the
installer. The current version as of this writing is 0.6.3.
1. Download GetGNUWin32-x.x.x.exe from
http://sourceforge.net/projects/getgnuwin32/files/. This is the
installer. The current version as of this writing is 0.6.3.
2. Run the installer.
2. Run the installer.
3. Accept the license.
3. Accept the license.
4. Select the installation directory. My recommendation is the
directory that contains this README file (<this-directory>).
4. Select the installation directory. My recommendation is the
directory that contains this README file (<this-directory>).
5. After running GetGNUWin32-0.x.x.exe, you will have a new directory
<this-directory>/GetGNUWin32
5. After running GetGNUWin32-0.x.x.exe, you will have a new directory
<this-directory>/GetGNUWin32
Note the the GNUWin32 installer didn't install GNUWin32. Instead, it
installed another, smarter downloader. That downloader is the GNUWin32
package management tool developed by the Open SSL project.
Note the the GNUWin32 installer didn't install GNUWin32. Instead, it
installed another, smarter downloader. That downloader is the GNUWin32
package management tool developed by the Open SSL project.
The following steps probably should be performed from inside a DOS shell.
The following steps probably should be performed from inside a DOS shell.
6. Change to the directory created by GetGNUWin32-x.x.x.exe
6. Change to the directory created by GetGNUWin32-x.x.x.exe
cd GetGNUWin32
cd GetGNUWin32
7. Execute the download.bat script. The download.bat script will download
about 446 packages! Enough to have a very complete Linux-like environment
under the DOS shell. This will take awhile. This step only downloads
the packages and the next step will install the packages.
7. Execute the download.bat script. The download.bat script will download
about 446 packages! Enough to have a very complete Linux-like environment
under the DOS shell. This will take awhile. This step only downloads
the packages and the next step will install the packages.
download
download
8. This step will install the downloaded packages. The argument of the
install.bat script is the installation location. C:\gnuwin32 is the
standard install location:
8. This step will install the downloaded packages. The argument of the
install.bat script is the installation location. C:\gnuwin32 is the
standard install location:
install C:\gnuwin32
install C:\gnuwin32
NOTE: This installation step will install *all* GNUWin32 packages... far
more than you will ever need. If disc space is a problem for you, you might
need to perform a manual installation of the individual ZIP files that you
will find in the <this directory>/GetGNUWin32/packages directory.
NOTE: This installation step will install *all* GNUWin32 packages... far
more than you will ever need. If disc space is a problem for you, you might
need to perform a manual installation of the individual ZIP files that you
will find in the <this directory>/GetGNUWin32/packages directory.
CYGWIN BUILD PROBLEMS
^^^^^^^^^^^^^^^^^^^^^
+150 -74
View File
@@ -1,4 +1,4 @@
NuttX TODO List (Last updated November 25, 2012)
NuttX TODO List (Last updated January 14, 2013)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@@ -6,21 +6,20 @@ standards, things that could be improved, and ideas for enhancements.
nuttx/
(6) Task/Scheduler (sched/)
(1) On-demand paging (sched/)
(10) Task/Scheduler (sched/)
(1) Memory Managment (mm/)
(2) Signals (sched/, arch/)
(3) Signals (sched/, arch/)
(2) pthreads (sched/)
(2) C++ Support
(6) Binary loaders (binfmt/)
(17) Network (net/, drivers/net)
(4) USB (drivers/usbdev, drivers/usbhost)
(11) Libraries (libc/, )
(12) Libraries (libc/, )
(9) File system/Generic drivers (fs/, drivers/)
(5) Graphics subystem (graphics/)
(1) Pascal add-on (pcode/)
(1) Documentation (Documentation/)
(8) Build system / Toolchains
(7) Build system / Toolchains
(5) Linux/Cywgin simulation (arch/sim)
(6) ARM (arch/arm/)
(1) ARM/C5471 (arch/arm/src/c5471/)
@@ -31,8 +30,8 @@ nuttx/
(2) ARM/LPC313x (arch/arm/src/lpc313x/)
(0) ARM/LPC43x (arch/arm/src/lpc43xx/)
(3) ARM/STR71x (arch/arm/src/str71x/)
(3) ARM/LM3S6918 (arch/arm/src/lm3s/)
(4) ARM/STM32 (arch/arm/src/stm32/)
(3) ARM/LM3S6918 (arch/arm/src/lm/)
(5) ARM/STM32 (arch/arm/src/stm32/)
(3) AVR (arch/avr)
(0) Intel x86 (arch/x86)
(5) 8051 / MCS51 (arch/8051/)
@@ -56,33 +55,9 @@ o Task/Scheduler (sched/)
Title: CHILD PTHREAD TERMINATION
Description: When a tasks exits, shouldn't all of its child pthreads also be
terminated?
Status: Open
Status: Closed. No, this behavior will not be implemented.
Priority: Medium, required for good emulation of process/pthread model.
Title: MMAN.H
Description: Implement sys/mman.h and functions
Status: Open
Priority: Low
Title: WAIT.H
Description: Implement sys/wait.h and functions. Consider implementing wait,
waitpid, waitid. At present, a parent has no information about
child tasks.
Update: A simple but usable version of waitpid() has been included.
This version is not compliant with all specifications and can be
enabled with CONFIG_SCHED_WAITPID.
Status: Open
Priority: Low
Title: MISSING ERRNO SETTINGS
Description: Several APIs do not set errno. Need to review all APIs.
Update: These are being fixed as they are encountered. There is
no accounting of how many interfaces have this problem.
Status: Open
Priority: Medium, required for standard compliance (but makes the
code bigger)
Title: TICKLESS OS
Description: On a side note, I have thought about a tick-less timer for the OS
for a long time. Basically we could replace the periodic system
@@ -107,18 +82,22 @@ o Task/Scheduler (sched/)
3) sched_process_timeslice(). Then there is round-robin time-slicing.
Status: Open
The primary advantage of a tickless OS is that is would allow for
reduce power consumptions. That is because timer interrupts will
usually awaken CPUs from reduced power consumption states.
Status: Open. There will probably be no tickless OS implementation unless
someone gets motivated and drives the change.
Priority: Low
Title: posix_spawn()
Description: This would be a good interface to add to NuttX. It is really
just a re-packaging of the existing, non-standard NuttX exec()
function.
Status: Open
Priority: Medium low.
o On-demand paging (sched/)
^^^^^^^^^^^^^^^^^^^^^^^^^
Title: pause() NON-COMPLIANCE
Description: In the POSIX description of this function is the pause() function
will suspend the calling thread until delivery of a signal whose
action is either to execute a signal-catching function or to
terminate the process. The current implementation only waits for
any non-blocked signal to be received. It should only wake up if
the signal is delivered to a handler.
Status: Open.
Priority: Medium Low.
Title: ON-DEMAND PAGE INCOMPLETE
Description: On-demand paging has recently been incorporated into the RTOS.
@@ -130,19 +109,16 @@ o On-demand paging (sched/)
configs/ea3131/pgnsh and locked directories). There are
some limitations of this testing so I still cannot say that
the feature is fully functional.
Status: Open
Status: Open. This has been put on the shelf for some time.
Priority: Medium-Low
o Other core OS logic
^^^^^^^^^^^^^^^^^^^
Title: GET_ENVIRON_PTR()
Description: get_environ_ptr() (sched/sched_getenvironptr.c) is not implemented.
The representation of the the environment strings selected for
NutX is not compatible with the operation. Some significant
re-design would be required to implement this funcion and that
effort is thought to be not worth the result.
Status: Open
Status: Open. No change is planned.
Priority: Low -- There is no plan to implement this.
Title: TIMER_GETOVERRUN()
@@ -150,6 +126,91 @@ o Other core OS logic
Status: Open
Priority: Low -- There is no plan to implement this.
Title: USER-SPACE WORK QUEUES
Description: There has been some use of work queues that has crept into some
user code. I am thinking of NxWidgets::CNxTimer. That timer
logic was originally implemented (correctly) using POSIX timers,
but was re-implemented using timed work.
The issue is that NxWidgets::CNxTimer is a user-space application
but the work queues are an OS internal feature. This will be a
problem for KERNEL builds. Hooks and definitions have been added
in include/nuttx/wqueue.h to support a user-space work queue, but
the corresponding logic has not been implemented.
The work queue logic will need to be moved from sched/ to libc/wqueue/
Status: Open. No work will probably be done until a functional KERNEL build
that includes NxWisges::CNxTimer is needed.
Priority: Medium Low for now
Title: INCOMPATIBILITES WITH execv() AND execl()
Description: Simplified 'execl()' and 'execv()' functions are provided by
NuttX. NuttX does not support processes and hence the concept
of overlaying a tasks process image with a new process image
does not make any sense. In NuttX, these functions are
wrapper functions that:
1. Call the non-standard binfmt function 'exec', and then
2. exit(0).
As a result, the current implementations of 'execl()' and
'execv()' suffer from some incompatibilities, the most
serious of these is that the exec'ed task will not have
the same task ID as the vfork'ed function. So the parent
function cannot know the ID of the exec'ed task.
Status: Open
Priority: Medium Low for now
Title: RETAINING TASK EXIT STATUS
Description: When a task exists, its exit status should be retained in
so data structure until it is reaped (via waitpid(), or
similar interface) or until the parent thread exists.
You would think that this should be a clone of the existing
pthread join logic. Howver there is no need for zombies
in NuttX so no need to keep the status if the parent has
already exit'ed. Other simplifications:
1. Keep the array/list of return status in the parent
tasks TCB.
2. Use a fixed size array of return status (perhaps the
the enire array is allocated so that that is con
penalty for tasks that have no childre.
At present, exit status is not retained. If waitpid()
is called after the child task has exit'ed it simpley
returns with the ECHLD error. That is not too bad, but
does not tell you what the exit status was.
A work-around is to:
1) Call sched_lock() to disable pre-emption.
2) Start the task (it cannot run because pre-emption is
disbled.
3) Call waitpid();
4) Call sched_unlock() to re-enable pre-emption.
Status: Open
Priority: Low
Title: IMPROVED TASK CONTROL BLOCK STRUCTURE
All task resources that are shared amongst threads have
their own "break-away", reference-counted structure. The
Task Control Block (TCB) of each thread holds a reference
to each breakaway structure (see include/nuttx/sched.h).
It would be more efficent to have one reference counted
structure that holds all of the shared resources.
These are the current shared structures:
- Environment varaibles (struct environ_s)
- PIC data space and address environments (struct dspace_s)
- File descriptors (struct filelist)
- FILE streams (struct streamlist)
- Sockets (struct socketlist)
Status: Open
Priority: Low. This is an enhancement. It would slight reduce
memory usage but would also increase coupling. These
resources are nicely modular now.
o Memory Managment (mm/)
^^^^^^^^^^^^^^^^^^^^^^
@@ -212,7 +273,7 @@ o Memory Managment (mm/)
be required to keep this memory on the correct list (or on
no list at all).
Status: Open
Status: Open. No changes are planned.
Priority: Medium/Low, a good feature to prevent memory leaks but would
have negative impact on memory usage and code size.
@@ -221,8 +282,10 @@ o Signals (sched/, arch/)
Title: STANDARD SIGNALS
Description: 'Standard' signals and signal actions are not supported.
(e.g., SIGINT, SIGCHLD, SIGSEGV, etc).
Status: Open
(e.g., SIGINT, SIGSEGV, etc).
Update: SIG_CHLD is support if configured.
Status: Open. No changes are planned.
Priority: Low, required by standards but not so critical for an
embedded system.
@@ -234,17 +297,25 @@ o Signals (sched/, arch/)
are required by the POSIX standard.
Priority: Low for now
Title: SIGNAL NUMBERING
Description: In signal.h, the range of valid signals is listed as 0-31. However,
in many interfaces, 0 is not a valid signal number. The valid
signal number should be 1-32. The signal set operations would need
to map bits appropriately.
Status: Open
Priority: Low. Even if there are only 31 usable signals, that is still a lot.
o pthreads (sched/)
^^^^^^^^^^^^^^^^^
Title: CANCELLATION POINTS
Description: pthread_cancel(): Should implement cancellation points and
pthread_testcancel()
Status: Open
Status: Open. No changes are planned.
Priority: Low, probably not that useful
Title: PTHREAD_PRIO_PROTECT
Description: Extended pthread_mutexattr_setprotocol() suport PTHREAD_PRIO_PROTECT:
Description: Extended pthread_mutexattr_setprotocol() suport PTHREAD_PRIO_PROTECT:
"When a thread owns one or more mutexes initialized with the
PTHREAD_PRIO_PROTECT protocol, it shall execute at the higher of its
priority or the highest of the priority ceilings of all the mutexes
@@ -260,7 +331,7 @@ o pthreads (sched/)
PTHREAD_PRIO_PROTECT protocol attributes, it shall not be subject to
being moved to the tail of the scheduling queue at its priority in the
event that its original priority is changed."
Status: Open
Status: Open. No changes planned.
Priority: Low -- about zero, probably not that useful. Priority inheritance is
already supported and is a much better solution. And it turns out
that priority protection is just about as complex as priority inheritance.
@@ -442,21 +513,25 @@ o Network (net/, drivers/net)
Title: SOCK_RAW/SOCK_PACKET
Description: Should implement SOCK_RAW, SOCK_PACKET
Status: Open
Status: Open. No changes are planned.
Priority: Low
Tile: MULTIPLE NETWORK INTERFACE SUPPORT
Description: uIP polling issues / Multiple network interface support:
(1) Current logic will not support multiple ethernet drivers.
Each driver should poll on TCP connections connect on the
network supported by the driver; UDP polling should respond
with TX data only if the UDP packet is intended for the
the network supported by the driver.
(2) If there were multiple drivers, polling would occur at
double the rate. Fix by using bound IP address in TCP
connection (lipaddr) and verifying that it is in the subnet
served by the driver.
Status: Open
Status: Open. Nothing will probably be done until I have a platform
with two network interfaces that I need to support.
Priority: Medium, The feature is not important, but it is important
for NuttX to resolve the architectural issues.
@@ -464,7 +539,7 @@ o Network (net/, drivers/net)
Description: sendto() and multiple network interface support:
When polled, would have to assure that the destination IP
is on the subnet served by the polling driver.
Status: Open
Status: Open. This is really part of the above issue.
Priority: Medium, The feature is not important, but it is important
for NuttX to resolve the architectural issues.
@@ -472,7 +547,8 @@ o Network (net/, drivers/net)
Description: IPv6 support is incomplete. Adam Dunkels has recently announced
IPv6 support for uIP (currently only as part of Contiki). Those
changes need to be ported to NuttX.
Status: Open
Status: Open. No work will probably be done until there is a specific
requirement for IPv6.
Priority: Medium
Title: LISTENING FOR UDP BROADCASTS
@@ -488,7 +564,7 @@ o Network (net/, drivers/net)
driver should be throttled. Perhaps the driver should disable
RX interrupts when throttled and re-anable on each poll time.
recvfrom would, of course, have to un-throttle.
Status: Open
Status: Open. This is just a thought experiment. No changes are planned.
Priority: Medium
Title: STANDARDIZE ETHERNET DRIVER STATISTICS
@@ -637,6 +713,15 @@ o USB (drivers/usbdev, drivers/usbhost)
o Libraries (libc/)
^^^^^^^^^^^^^^^^^
Title: SIGNED time_t
Description: The NuttX time_t is type uint32_t. I think this is consistent
with all standards and with normal usage of time_t. However,
according to Wikipedia, time_t is usually implemented as a
signed 32-bit value.
Status: Open
Priority: Very low unless there is some compelling issue that I do not
know about.
Title: ENVIRON
Description: The definition of environ in stdlib.h is bogus and will not
work as it should. This is because the underlying
@@ -1002,20 +1087,6 @@ o Build system
Status: Open, there are some workarounds, but none are good.
Priority: High
Title: configure.sh NOT AVAILABLE IN NATIVE WINDOWS BUILD
Description: configure.sh is a Bash script and cannot be used from a Windows
CMD.exe window. I started a configure.bat script, but I do
not have the batch file programming skills to duplicate some
of the more complex operations.
I also considered adding a configure.c file that could be
compiled and then executed by configure.bat (and configure.sh?).
But I have not gone down that path yet.
The current work-around is to configure under Cygwin.
Status: Open
Priority: High
o Linux/Cywgin simulation (arch/sim)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1370,7 +1441,7 @@ o ARM/STR71x (arch/arm/src/str71x/)
Status: Open
Priority: Medium -- Will be very high if you do SPI access from multiple threads.
o ARM/LM3S6918 (arch/arm/src/lm3s/)
o ARM/LM3S6918 (arch/arm/src/lm/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Title: I2C DRIVER
@@ -1460,6 +1531,11 @@ o ARM/STM32 (arch/arm/src/stm32/)
Status: Open
Priority: Low
Title: STM32 F4 USB OTG FS DEVICE-SIDE DRIVER
Description: This driver is reported to be buggy and to need some TLC.
Status: Open
Priority: High
o AVR (arch/avr)
^^^^^^^^^^^^^^
+23
View File
@@ -16,6 +16,7 @@ config ARCH_8051
config ARCH_ARM
bool "ARM"
select ARCH_HAVE_INTERRUPTSTACK
select ARCH_HAVE_VFORK
---help---
The ARM architectures
@@ -108,6 +109,10 @@ config ARCH_NOINTC
bool
default n
config ARCH_VECNOTIRQ
bool
default n
config ARCH_DMA
bool
default n
@@ -124,6 +129,10 @@ config ADDRENV
bool
default n
config ARCH_HAVE_VFORK
bool
default n
config ARCH_STACKDUMP
bool "Dump stack on assertions"
default n
@@ -136,6 +145,20 @@ config ENDIAN_BIG
---help---
Select if architecture operates using big-endian byte ordering.
config ARCH_HAVE_RAMFUNCS
bool
default n
config ARCH_RAMFUNCS
bool "Copy functions to RAM on startup"
default n
depends on ARCH_HAVE_RAMFUNCS
---help---
Copy some functions to RAM at boot time. This is done in some
architectures to improve performance. In other cases, it is done
so that FLASH can be reconfigured while the MCU executes out of
SRAM.
comment "Board Settings"
config BOARD_LOOPSPERMSEC
+6 -6
View File
@@ -170,12 +170,12 @@ arch/arm - ARM-based micro-controllers
STATUS: This port has stalled because of development tool issues. Coding
is complete on the basic port (timer, serial console, SPI).
arch/arm/include/lm3s and arch/arm/src/lm3s
These directories contain support for the Luminary LMS family, particularly
for the LM3S6918. The initial, release of this port was included in NuttX version
0.4.6. The current port includes timer, serial console, Ethernet, SSI, and microSD
support. There are working configurations the NuttX OS test, to run the NuttShell
(NSH), the NuttX networking test, and the uIP web server.
arch/arm/include/lm and arch/arm/src/lm
These directories contain support for the Luminary LM3S/4F family. The
initial, release of this port was included in NuttX version 0.4.6. The
current port includes timer, serial console, Ethernet, SSI, and microSD
support. There are working configurations the NuttX OS test, to run the
NuttShell (NSH), the NuttX networking test, and the uIP web server.
arch/arm/include/lpc214x and arch/arm/src/lpc214x
These directories provide support for NXP LPC214x family of
+6 -5
View File
@@ -47,12 +47,13 @@ config ARCH_CHIP_KINETIS
select ARCH_CORTEXM4
select ARCH_HAVE_MPU
select ARCH_IRQPRIO
select ARCH_HAVE_RAMFUNCS
select ARCH_RAMFUNCS
---help---
Freescale Kinetis Architectures (ARM Cortex-M4)
config ARCH_CHIP_LM3S
config ARCH_CHIP_LM
bool "TI Stellaris"
select ARCH_CORTEXM3
select ARCH_HAVE_MPU
select ARCH_IRQPRIO
---help---
@@ -151,7 +152,7 @@ config ARCH_CHIP
default "dm320" if ARCH_CHIP_DM320
default "imx" if ARCH_CHIP_IMX
default "kinetis" if ARCH_CHIP_KINETIS
default "lm3s" if ARCH_CHIP_LM3S
default "lm" if ARCH_CHIP_LM
default "lpc17xx" if ARCH_CHIP_LPC17XX
default "lpc214x" if ARCH_CHIP_LPC214X
default "lpc2378" if ARCH_CHIP_LPC2378
@@ -274,8 +275,8 @@ endif
if ARCH_CHIP_KINETIS
source arch/arm/src/kinetis/Kconfig
endif
if ARCH_CHIP_LM3S
source arch/arm/src/lm3s/Kconfig
if ARCH_CHIP_LM
source arch/arm/src/lm/Kconfig
endif
if ARCH_CHIP_LPC17XX
source arch/arm/src/lpc17xx/Kconfig
+8
View File
@@ -49,3 +49,11 @@ config ARMV7M_TOOLCHAIN_RAISONANCE
depends on HOST_WINDOWS
endchoice
config ARMV7M_OABI_TOOLCHAIN
bool "OABI (vs EABI)"
default y
depends on ARMV7M_TOOLCHAIN_BUILDROOT
---help---
Most of the older buildroot toolchains are OABI and are named arm-nuttx-elf- vs. arm-nuttx-eabi-
+10 -9
View File
@@ -53,7 +53,7 @@ ifeq ($(filter y, \
endif
ifeq ($(filter y, \
$(CONFIG_KINETIS_BUILDROOT) \
$(CONFIG_LM3S_BUILDROOT) \
$(CONFIG_LM_BUILDROOT) \
$(CONFIG_LPC17_BUILDROOT) \
$(CONFIG_LPC43_BUILDROOT) \
$(CONFIG_SAM3U_BUILDROOT) \
@@ -77,7 +77,7 @@ ifeq ($(filter y, \
endif
ifeq ($(filter y, \
$(CONFIG_KINETIS_CODESOURCERYL) \
$(CONFIG_LM3S_CODESOURCERYL) \
$(CONFIG_LM_CODESOURCERYL) \
$(CONFIG_LPC17_CODESOURCERYL) \
$(CONFIG_LPC43_CODESOURCERYL) \
$(CONFIG_SAM3U_CODESOURCERYL) \
@@ -88,7 +88,7 @@ ifeq ($(filter y, \
endif
ifeq ($(filter y, \
$(CONFIG_KINETIS_CODESOURCERYW) \
$(CONFIG_LM3S_CODESOURCERYW) \
$(CONFIG_LM_CODESOURCERYW) \
$(CONFIG_LPC17_CODESOURCERYW) \
$(CONFIG_LPC43_CODESOURCERYW) \
$(CONFIG_SAM3U_CODESOURCERYW) \
@@ -99,7 +99,7 @@ ifeq ($(filter y, \
endif
ifeq ($(filter y, \
$(CONFIG_KINETIS_DEVKITARM) \
$(CONFIG_LM3S_DEVKITARM) \
$(CONFIG_LM_DEVKITARM) \
$(CONFIG_LPC17_DEVKITARM) \
$(CONFIG_LPC43_DEVKITARM) \
$(CONFIG_SAM3U_DEVKITARM) \
@@ -160,14 +160,15 @@ endif
# NuttX buildroot under Linux or Cygwin
ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),BUILDROOT)
# OABI
# CROSSDEV = arm-nuttx-elf-
# ARCROSSDEV = arm-nuttx-elf-
# ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
# EABI
ifeq ($(CONFIG_ARMV7M_OABI_TOOLCHAIN),y)
CROSSDEV = arm-nuttx-elf-
ARCROSSDEV = arm-nuttx-elf-
ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft
else
CROSSDEV = arm-nuttx-eabi-
ARCROSSDEV = arm-nuttx-eabi-
ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft
endif
MAXOPTIMIZATION = -Os
endif
+5 -3
View File
@@ -79,9 +79,11 @@ uint32_t *up_doirq(int irq, uint32_t *regs)
uint32_t *savestate;
/* Nested interrupts are not supported in this implementation. If you want
* implemented nested interrupts, you would have to (1) change the way that
* current regs is handled and (2) the design associated with
* CONFIG_ARCH_INTERRUPTSTACK.
* to implement nested interrupts, you would have to (1) change the way that
* current_regs is handled and (2) the design associated with
* CONFIG_ARCH_INTERRUPTSTACK. The savestate variable will not work for
* that purpose as implemented here because only the outermost nested
* interrupt can result in a context switch (it can probably be deleted).
*/
/* Current regs non-zero indicates that we are processing an interrupt;
+142
View File
@@ -0,0 +1,142 @@
/************************************************************************************
* arch/arm/src/armv7-m/vfork.S
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include "up_vfork.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Global Symbols
************************************************************************************/
.syntax unified
.thumb
.file "vfork.S"
.globl up_vfork
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: vfork
*
* Description:
* The vfork() function has the same effect as fork(), except that the behavior is
* undefined if the process created by vfork() either modifies any data other than
* a variable of type pid_t used to store the return value from vfork(), or returns
* from the function in which vfork() was called, or calls any other function before
* successfully calling _exit() or one of the exec family of functions.
*
* This thin layer implements vfork by simply calling up_vfork() with the vfork()
* context as an argument. The overall sequence is:
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
* - Configuration of environment variables
* - Setup the intput parameters for the task.
* - Initialization of the TCB (including call to up_initial_state()
* 4) up_vfork() provides any additional operating context. up_vfork must:
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
*
* Input Paremeters:
* None
*
* Return:
* Upon successful completion, vfork() returns 0 to the child process and returns
* the process ID of the child process to the parent process. Otherwise, -1 is
* returned to the parent, no child process is created, and errno is set to
* indicate the error.
*
************************************************************************************/
.thumb_func
.globl vfork
.type vfork, function
vfork:
/* Create a stack frame */
mov r0, sp /* Save the value of the stack on entry */
sub sp, sp, #VFORK_SIZEOF /* Allocate the structure on the stack */
/* CPU registers */
/* Save the volatile registers */
str r4, [sp, #VFORK_R4_OFFSET]
str r5, [sp, #VFORK_R5_OFFSET]
str r6, [sp, #VFORK_R6_OFFSET]
str r7, [sp, #VFORK_R7_OFFSET]
str r8, [sp, #VFORK_R8_OFFSET]
str r9, [sp, #VFORK_R9_OFFSET]
str r10, [sp, #VFORK_R10_OFFSET]
/* Save the frame pointer, stack pointer, and return address */
str fp, [sp, #VFORK_FP_OFFSET]
str r0, [sp, #VFORK_SP_OFFSET]
str lr, [sp, #VFORK_LR_OFFSET]
/* Floating point registers (not yet) */
/* Then, call up_vfork(), passing it a pointer to the stack structure */
mov r0, sp
bl up_vfork
/* Release the stack data and return the value returned by up_vfork */
ldr lr, [sp, #VFORK_LR_OFFSET]
add sp, sp, #VFORK_SIZEOF
bx lr
.size vfork, .-vfork
.end
+2 -2
View File
@@ -188,7 +188,7 @@ extern uint32_t _ebss; /* End+1 of .bss */
* will create a function named foo that will execute from RAM.
*/
#ifdef CONFIG_BOOT_RAMFUNCS
#ifdef CONFIG_ARCH_RAMFUNCS
# define __ramfunc__ __attribute__ ((section(".ramfunc")))
@@ -204,7 +204,7 @@ extern const uint32_t _framfuncs; /* Copy source address in FLASH */
extern uint32_t _sramfuncs; /* Copy destination start address in RAM */
extern uint32_t _eramfuncs; /* Copy destination start address in RAM */
#endif /* CONFIG_BOOT_RAMFUNCS */
#endif /* CONFIG_ARCH_RAMFUNCS */
#endif /* __ASSEMBLY__ */
/****************************************************************************
+233
View File
@@ -0,0 +1,233 @@
/****************************************************************************
* arch/arm/src/common/up_vfork.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/sched.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include "up_vfork.h"
#include "os_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* ARM requires at least a 4-byte stack alignment. For use with EABI and
* floating point, the stack must be aligned to 8-byte addresses.
*/
#ifndef CONFIG_STACK_ALIGNMENT
/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you
* are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly!
*/
# ifdef __ARM_EABI__
# define CONFIG_STACK_ALIGNMENT 8
# else
# define CONFIG_STACK_ALIGNMENT 4
# endif
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_vfork
*
* Description:
* The vfork() function has the same effect as fork(), except that the
* behavior is undefined if the process created by vfork() either modifies
* any data other than a variable of type pid_t used to store the return
* value from vfork(), or returns from the function in which vfork() was
* called, or calls any other function before successfully calling _exit()
* or one of the exec family of functions.
*
* The overall sequence is:
*
* 1) User code calls vfork(). vfork() collects context information and
* transfers control up up_vfork().
* 2) up_vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
* - Configuration of environment variables
* - Setup the intput parameters for the task.
* - Initialization of the TCB (including call to up_initial_state()
* 4) up_vfork() provides any additional operating context. up_vfork must:
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) up_vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
*
* task_vforkabort() may be called if an error occurs between steps 3 and 6.
*
* Input Paremeters:
* context - Caller context information saved by vfork()
*
* Return:
* Upon successful completion, vfork() returns 0 to the child process and
* returns the process ID of the child process to the parent process.
* Otherwise, -1 is returned to the parent, no child process is created,
* and errno is set to indicate the error.
*
****************************************************************************/
pid_t up_vfork(const struct vfork_s *context)
{
_TCB *parent = (FAR _TCB *)g_readytorun.head;
_TCB *child;
size_t stacksize;
uint32_t newsp;
uint32_t newfp;
uint32_t stackutil;
int ret;
svdbg("r4:%08x r5:%08x r6:%08x r7:%08x\n",
context->r4, context->r5, context->r6, context->r7);
svdbg("r8:%08x r9:%08x r10:%08x\n",
context->r8, context->r9, context->r10);
svdbg("fp:%08x sp:%08x lr:%08x\n",
context->fp, context->sp, context->lr);
/* Allocate and initialize a TCB for the child task. */
child = task_vforksetup((start_t)(context->lr & ~1));
if (!child)
{
sdbg("task_vforksetup failed\n");
return (pid_t)ERROR;
}
svdbg("Parent=%p Child=%p\n", parent, child);
/* Get the size of the parent task's stack. Due to alignment operations,
* the adjusted stack size may be smaller than the stack size originally
* requrested.
*/
stacksize = parent->adj_stack_size + CONFIG_STACK_ALIGNMENT - 1;
/* Allocate the stack for the TCB */
ret = up_create_stack(child, stacksize);
if (ret != OK)
{
sdbg("up_create_stack failed: %d\n", ret);
task_vforkabort(child, -ret);
return (pid_t)ERROR;
}
/* How much of the parent's stack was utilized? The ARM uses
* a push-down stack so that the current stack pointer should
* be lower than the initial, adjusted stack pointer. The
* stack usage should be the difference between those two.
*/
DEBUGASSERT((uint32_t)parent->adj_stack_ptr > context->sp);
stackutil = (uint32_t)parent->adj_stack_ptr - context->sp;
svdbg("stacksize:%d stackutil:%d\n", stacksize, stackutil);
/* Make some feeble effort to perserve the stack contents. This is
* feeble because the stack surely contains invalid pointers and other
* content that will not work in the child context. However, if the
* user follows all of the caveats of vfor() usage, even this feeble
* effort is overkill.
*/
newsp = (uint32_t)child->adj_stack_ptr - stackutil;
memcpy((void *)newsp, (const void *)context->sp, stackutil);
/* Was there a frame pointer in place before? */
if (context->fp <= (uint32_t)parent->adj_stack_ptr &&
context->fp >= (uint32_t)parent->adj_stack_ptr - stacksize)
{
uint32_t frameutil = (uint32_t)parent->adj_stack_ptr - context->fp;
newfp = (uint32_t)child->adj_stack_ptr - frameutil;
}
else
{
newfp = context->fp;
}
svdbg("Old stack base:%08x SP:%08x FP:%08x\n",
parent->adj_stack_ptr, context->sp, context->fp);
svdbg("New stack base:%08x SP:%08x FP:%08x\n",
child->adj_stack_ptr, newsp, newfp);
/* Update the stack pointer, frame pointer, and volatile registers. When
* the child TCB was initialized, all of the values were set to zero.
* up_initial_state() altered a few values, but the return value in R0
* should be cleared to zero, providing the indication to the newly started
* child thread.
*/
child->xcp.regs[REG_R4] = context->r4; /* Volatile register r4 */
child->xcp.regs[REG_R5] = context->r5; /* Volatile register r5 */
child->xcp.regs[REG_R6] = context->r6; /* Volatile register r6 */
child->xcp.regs[REG_R7] = context->r7; /* Volatile register r7 */
child->xcp.regs[REG_R8] = context->r8; /* Volatile register r8 */
child->xcp.regs[REG_R9] = context->r9; /* Volatile register r9 */
child->xcp.regs[REG_R10] = context->r10; /* Volatile register r10 */
child->xcp.regs[REG_FP] = newfp; /* Frame pointer */
child->xcp.regs[REG_SP] = newsp; /* Stack pointer */
/* And, finally, start the child task. On a failure, task_vforkstart()
* will discard the TCB by calling task_vforkabort().
*/
return task_vforkstart(child);
}
+88
View File
@@ -0,0 +1,88 @@
/****************************************************************************
* arch/arm/src/common/up_vfork.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_ARM_VFORK_H
#define __ARCH_ARM_SRC_ARM_VFORK_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define VFORK_R4_OFFSET (0*4) /* Volatile register r4 */
#define VFORK_R5_OFFSET (1*4) /* Volatile register r5 */
#define VFORK_R6_OFFSET (2*4) /* Volatile register r6 */
#define VFORK_R7_OFFSET (3*4) /* Volatile register r7 */
#define VFORK_R8_OFFSET (4*4) /* Volatile register r8 */
#define VFORK_R9_OFFSET (5*4) /* Volatile register r9 */
#define VFORK_R10_OFFSET (6*4) /* Volatile register r10 */
#define VFORK_FP_OFFSET (7*4) /* Frame pointer */
#define VFORK_SP_OFFSET (8*4) /* Stack pointer*/
#define VFORK_LR_OFFSET (9*4) /* Return address*/
#define VFORK_SIZEOF (10*4)
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
struct vfork_s
{
/* CPU registers */
uint32_t r4; /* Volatile register r4 */
uint32_t r5; /* Volatile register r5 */
uint32_t r6; /* Volatile register r6 */
uint32_t r7; /* Volatile register r7 */
uint32_t r8; /* Volatile register r8 */
uint32_t r9; /* Volatile register r9 */
uint32_t r10; /* Volatile register r10 */
uint32_t fp; /* Frame pointer */
uint32_t sp; /* Stack pointer*/
uint32_t lr; /* Return address*/
/* Floating point registers (not yet) */
};
#endif
#endif /* __ARCH_ARM_SRC_ARM_VFORK_H */
+5 -4
View File
@@ -1,7 +1,7 @@
############################################################################
# arch/arm/src/stm32/Make.defs
#
# Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
# Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -39,15 +39,16 @@ else
HEAD_ASRC = stm32_vectors.S
endif
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \
vfork.S
CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c \
up_createstack.c up_mdelay.c up_udelay.c up_exit.c \
up_initialize.c up_initialstate.c up_interruptcontext.c \
up_memfault.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c \
up_releasepending.c up_releasestack.c up_reprioritizertr.c \
up_schedulesigaction.c up_sigdeliver.c up_systemreset.c \
up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c up_svcall.c \
up_stackcheck.c
up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c \
up_svcall.c up_stackcheck.c up_vfork.c
ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y)
CMN_ASRCS += up_exception.S
+23 -14
View File
@@ -35,7 +35,7 @@
/* Provides standard flash access functions, to be used by the flash mtd driver.
* The interface is defined in the include/nuttx/progmem.h
*
*
* Requirements during write/erase operations on FLASH:
* - HSI must be ON.
* - Low Power Modes are not permitted during write/erase
@@ -80,7 +80,7 @@ void stm32_flash_unlock(void)
if (getreg32(STM32_FLASH_CR) & FLASH_CR_LOCK)
{
/* Unlock sequence */
putreg32(FLASH_KEY1, STM32_FLASH_KEYR);
putreg32(FLASH_KEY2, STM32_FLASH_KEYR);
}
@@ -112,6 +112,11 @@ uint16_t up_progmem_pagesize(uint16_t page)
int up_progmem_getpage(uint32_t addr)
{
if (addr >= STM32_FLASH_BASE)
{
addr -= STM32_FLASH_BASE;
}
if (addr >= STM32_FLASH_SIZE)
{
return -EFAULT;
@@ -131,14 +136,14 @@ int up_progmem_erasepage(uint16_t page)
}
/* Get flash ready and begin erasing single page */
if (!(getreg32(STM32_RCC_CR) & RCC_CR_HSION))
{
return -EPERM;
}
stm32_flash_unlock();
modifyreg32(STM32_FLASH_CR, 0, FLASH_CR_PER);
putreg32(page * STM32_FLASH_PAGESIZE, STM32_FLASH_AR);
modifyreg32(STM32_FLASH_CR, 0, FLASH_CR_STRT);
@@ -146,10 +151,10 @@ int up_progmem_erasepage(uint16_t page)
while(getreg32(STM32_FLASH_SR) & FLASH_SR_BSY) up_waste();
modifyreg32(STM32_FLASH_CR, FLASH_CR_PER, 0);
/* Verify */
for (addr = page * STM32_FLASH_PAGESIZE + STM32_FLASH_BASE, count = STM32_FLASH_PAGESIZE;
for (addr = page * STM32_FLASH_PAGESIZE + STM32_FLASH_BASE, count = STM32_FLASH_PAGESIZE;
count; count-=4, addr += 4)
{
if (getreg32(addr) != 0xffffffff)
@@ -173,8 +178,8 @@ int up_progmem_ispageerased(uint16_t page)
}
/* Verify */
for (addr = page * STM32_FLASH_PAGESIZE + STM32_FLASH_BASE, count = STM32_FLASH_PAGESIZE;
for (addr = page * STM32_FLASH_PAGESIZE + STM32_FLASH_BASE, count = STM32_FLASH_PAGESIZE;
count; count--, addr++)
{
if (getreg8(addr) != 0xff)
@@ -200,6 +205,11 @@ int up_progmem_write(uint32_t addr, const void *buf, size_t count)
/* Check for valid address range */
if (addr >= STM32_FLASH_BASE)
{
addr -= STM32_FLASH_BASE;
}
if ((addr+count) >= STM32_FLASH_SIZE)
{
return -EFAULT;
@@ -213,10 +223,10 @@ int up_progmem_write(uint32_t addr, const void *buf, size_t count)
}
stm32_flash_unlock();
modifyreg32(STM32_FLASH_CR, 0, FLASH_CR_PG);
for (addr += STM32_FLASH_BASE; count; count--, hword++, addr+=2)
for (addr += STM32_FLASH_BASE; count; count-=2, hword++, addr+=2)
{
/* Write half-word and wait to complete */
@@ -237,7 +247,6 @@ int up_progmem_write(uint32_t addr, const void *buf, size_t count)
modifyreg32(STM32_FLASH_CR, FLASH_CR_PG, 0);
return -EIO;
}
}
modifyreg32(STM32_FLASH_CR, FLASH_CR_PG, 0);
+14
View File
@@ -49,6 +49,20 @@ if ELF
source binfmt/libelf/Kconfig
endif
config BUILTIN
bool "Support Builtin Applications"
default n
---help---
Enable support for builtin applications. This features assigns a string
name to an application and in addition if FS_BINFS is defined, retaining
those names in a file system from which they can be executed. This feature
is also the underlying requirement to support built-in applications in the
NuttShell (NSH).
if BUILTIN
source binfmt/libbuiltin/Kconfig
endif
endif
config PIC
+2 -1
View File
@@ -1,7 +1,7 @@
############################################################################
# nxflat/Makefile
#
# Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
# Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -65,6 +65,7 @@ DEPPATH = --dep-path .
include libnxflat$(DELIM)Make.defs
include libelf$(DELIM)Make.defs
include libbuiltin$(DELIM)Make.defs
BINFMT_AOBJS = $(BINFMT_ASRCS:.S=$(OBJEXT))
BINFMT_COBJS = $(BINFMT_CSRCS:.c=$(OBJEXT))
+6 -3
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* binfmt/binfmt_exec.c
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,6 @@
#include <nuttx/config.h>
#include <string.h>
#include <sched.h>
#include <debug.h>
#include <errno.h>
@@ -96,6 +95,8 @@ int exec(FAR const char *filename, FAR const char **argv,
struct binary_s bin;
int ret;
/* Load the module into memory */
memset(&bin, 0, sizeof(struct binary_s));
bin.filename = filename;
bin.exports = exports;
@@ -108,7 +109,9 @@ int exec(FAR const char *filename, FAR const char **argv,
return ERROR;
}
ret = exec_module(&bin, 50);
/* Then start the module */
ret = exec_module(&bin);
if (ret < 0)
{
bdbg("ERROR: Failed to execute program '%s'\n", filename);
+12 -8
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* binfmt/binfmt_execmodule.c
*
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -47,6 +47,7 @@
#include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/kmalloc.h>
#include <nuttx/binfmt/binfmt.h>
#include "os_internal.h"
@@ -143,7 +144,7 @@ static inline int exec_ctors(FAR const struct binary_s *binp)
*
****************************************************************************/
int exec_module(FAR const struct binary_s *binp, int priority)
int exec_module(FAR const struct binary_s *binp)
{
FAR _TCB *tcb;
#ifndef CONFIG_CUSTOM_STACK
@@ -167,7 +168,7 @@ int exec_module(FAR const struct binary_s *binp, int priority)
/* Allocate a TCB for the new task. */
tcb = (FAR _TCB*)zalloc(sizeof(_TCB));
tcb = (FAR _TCB*)kzalloc(sizeof(_TCB));
if (!tcb)
{
err = ENOMEM;
@@ -177,7 +178,7 @@ int exec_module(FAR const struct binary_s *binp, int priority)
/* Allocate the stack for the new task */
#ifndef CONFIG_CUSTOM_STACK
stack = (FAR uint32_t*)malloc(binp->stacksize);
stack = (FAR uint32_t*)kmalloc(binp->stacksize);
if (!tcb)
{
err = ENOMEM;
@@ -186,12 +187,12 @@ int exec_module(FAR const struct binary_s *binp, int priority)
/* Initialize the task */
ret = task_init(tcb, binp->filename, priority, stack,
ret = task_init(tcb, binp->filename, binp->priority, stack,
binp->stacksize, binp->entrypt, binp->argv);
#else
/* Initialize the task */
ret = task_init(tcb, binp->filename, priority, stack,
ret = task_init(tcb, binp->filename, binp->priority, stack,
binp->entrypt, binp->argv);
#endif
if (ret < 0)
@@ -201,6 +202,9 @@ int exec_module(FAR const struct binary_s *binp, int priority)
goto errout_with_stack;
}
/* Note that tcb->flags are not modified. 0=normal task */
/* tcb->flags |= TCB_FLAG_TTYPE_TASK; */
/* Add the D-Space address as the PIC base address. By convention, this
* must be the first allocated address space.
*/
@@ -257,14 +261,14 @@ errout_with_stack:
#ifndef CONFIG_CUSTOM_STACK
tcb->stack_alloc_ptr = NULL;
sched_releasetcb(tcb);
free(stack);
kfree(stack);
#else
sched_releasetcb(tcb);
#endif
goto errout;
errout_with_tcb:
free(tcb);
kfree(tcb);
errout:
errno = err;
bdbg("returning errno: %d\n", err);
+43
View File
@@ -66,6 +66,39 @@
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: load_default_priority
*
* Description:
* Set the default priority of the module to be loaded. This may be
* changed (1) by the actions of the binary format's load() method if
* the binary format contains priority informaition, or (2) by the user
* between calls to load_module() and exec_module().
*
* Returned Value:
* Zero (OK) is returned on success; Otherwise, -1 (ERROR) is returned and
* the errno variable is set appropriately.
*
****************************************************************************/
static int load_default_priority(FAR struct binary_s *bin)
{
struct sched_param param;
/* Get the priority of this thread */
ret = sched_getparam(0, &param);
if (ret < 0)
{
bdbg("ERROR: sched_getparam failed: %d\n", errno);
return ERROR;
}
/* Save that as the priority of child thread */
bin->priority = param.sched_priority;
}
/****************************************************************************
* Name: load_absmodule
*
@@ -145,6 +178,16 @@ int load_module(FAR struct binary_s *bin)
if (bin && bin->filename)
#endif
{
/* Set the default priority of the new program. */
ret = load_default_priority(bin)
if (ret < 0)
{
/* The errno is already set in this case */
return ERROR;
}
/* Were we given a relative path? Or an absolute path to the file to
* be loaded? Absolute paths start with '/'.
*/
+196
View File
@@ -0,0 +1,196 @@
/****************************************************************************
* binfmt/builtin.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/binfmt/binfmt.h>
#include <nuttx/binfmt/builtin.h>
#ifdef CONFIG_BUILTIN
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int builtin_loadbinary(FAR struct binary_s *binp);
/****************************************************************************
* Private Data
****************************************************************************/
static struct binfmt_s g_builtin_binfmt =
{
NULL, /* next */
builtin_loadbinary, /* load */
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: builtin_loadbinary
*
* Description:
* Verify that the file is an builtin binary.
*
****************************************************************************/
static int builtin_loadbinary(struct binary_s *binp)
{
FAR const char *filename;
int fd;
int index;
int ret;
bvdbg("Loading file: %s\n", binp->filename);
/* Open the binary file for reading (only) */
fd = open(filename, O_RDONLY);
if (fd < 0)
{
int errval = errno;
bdbg("ERROR: Failed to open binary %s: %d\n", filename, errval);
return -errval;
}
/* If this file is a BINFS file system, then we can recover the name of
* the file using the FIOC_FILENAME ioctl() call.
*/
ret = ioctl(fd, FIOC_FILENAME, (unsigned long)((uintptr_t)&filename));
if (ret < 0)
{
int errval = errno;
bdbg("ERROR: FIOC_FILENAME ioctl failed: %d\n", errval);
return -errval;
}
/* Other file systems may also support FIOC_FILENAME, so the real proof
* is that we can look up the index to this name in g_builtins[].
*/
index = builtin_isavail(filename);
if (index < 0)
{
int errval = errno;
bdbg("ERROR: %s is not a builtin application\n", filename);
return -errval;
}
/* Return the load information. NOTE: that there is no way to configure
* the priority. That is a bug and needs to be fixed.
*/
binp->entrypt = g_builtins[index].main;
binp->stacksize = g_builtins[index].stacksize;
binp->priority = g_builtins[index].priority;
return OK;
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: builtin_initialize
*
* Description:
* Builtin support is built unconditionally. However, it order to
* use this binary format, this function must be called during system
* format in order to register the builtin binary format.
*
* Returned Value:
* This is a NuttX internal function so it follows the convention that
* 0 (OK) is returned on success and a negated errno is returned on
* failure.
*
****************************************************************************/
int builtin_initialize(void)
{
int ret;
/* Register ourselves as a binfmt loader */
bvdbg("Registering Builtin Loader\n");
ret = register_binfmt(&g_builtin_binfmt);
if (ret != 0)
{
bdbg("Failed to register binfmt: %d\n", ret);
}
return ret;
}
/****************************************************************************
* Name: builtin_uninitialize
*
* Description:
* Unregister the builtin binary loader
*
* Returned Value:
* None
*
****************************************************************************/
void builtin_uninitialize(void)
{
unregister_binfmt(&g_builtin_binfmt);
}
#endif /* CONFIG_BUILTIN */
+1 -1
View File
@@ -183,7 +183,7 @@ static int elf_loadbinary(struct binary_s *binp)
bvdbg("Loading file: %s\n", binp->filename);
/* Initialize the xflat library to load the program binary. */
/* Initialize the ELF library to load the program binary. */
ret = elf_init(binp->filename, &loadinfo);
elf_dumploadinfo(&loadinfo);
+4
View File
@@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
+52
View File
@@ -0,0 +1,52 @@
############################################################################
# binfmt/libbuiltin/Make.defs
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# 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
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
ifeq ($(CONFIG_BUILTIN),y)
# Builtin application interfaces
BINFMT_CSRCS += builtin.c
# Builtin library interfaces
BINFMT_CSRCS += libbuiltin_getname.c libbuiltin_isavail.c
# Hook the libbuiltin subdirectory into the build
VPATH += libbuiltin
SUBDIRS += libbuiltin
DEPPATH += --dep-path libbuiltin
endif
@@ -0,0 +1,92 @@
/****************************************************************************
* binfmt/libbuiltin/libbuiltin_getname.c
*
* Originally by:
*
* Copyright (C) 2011 Uros Platise. All rights reserved.
* Author: Uros Platise <uros.platise@isotel.eu>
*
* With subsequent updates, modifications, and general maintenance by:
*
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/binfmt/builtin.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: builtin_getname
*
* Description:
* Return the name of the application at index in the table of builtin
* applications.
*
****************************************************************************/
FAR const char *builtin_getname(int index)
{
if (index < 0 || index >= number_builtins())
{
return NULL;
}
return g_builtins[index].name;
}
@@ -0,0 +1,102 @@
/****************************************************************************
* binfmt/libbuiltin/libbuiltin_isavail.c
*
* Originally by:
*
* Copyright (C) 2011 Uros Platise. All rights reserved.
* Author: Uros Platise <uros.platise@isotel.eu>
*
* With subsequent updates, modifications, and general maintenance by:
*
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <nuttx/binfmt/builtin.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: builtin_isavail
*
* Description:
* Return the index into the table of applications for the applicaiton with
* the name 'appname'.
*
****************************************************************************/
int builtin_isavail(FAR const char *appname)
{
int i;
for (i = 0; g_builtins[i].name; i++)
{
if (!strncmp(g_builtins[i].name, appname, NAME_MAX))
{
return i;
}
}
set_errno(ENOENT);
return ERROR;
}
+52 -11
View File
@@ -334,6 +334,12 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_TASK_NAME_SIZE - Specifies that maximum size of a
task name to save in the TCB. Useful if scheduler
instrumentation is selected. Set to zero to disable.
CONFIG_SCHED_HAVE_PARENT - Remember the ID of the parent thread
when a new child thread is created. This support enables some
additional features (such as SIGCHLD) and modifies the behavior
of other interfaces. For example, it makes waitpid() more
standards complete by restricting the waited-for tasks to the
children of the caller. Default: disabled.
CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY -
Used to initialize the internal time logic.
CONFIG_GREGORIAN_TIME - Enables Gregorian time conversions.
@@ -400,7 +406,7 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_SCHED_WORKSTACKSIZE - The stack size allocated for the worker
thread. Default: CONFIG_IDLETHREAD_STACKSIZE.
CONFIG_SIG_SIGWORK - The signal number that will be used to wake-up
the worker thread. Default: 4
the worker thread. Default: 17
CONFIG_SCHED_LPWORK. If CONFIG_SCHED_WORKQUEUE is defined, then a single
work queue is created by default. If CONFIG_SCHED_LPWORK is also defined
then an additional, lower-priority work queue will also be created. This
@@ -412,7 +418,12 @@ defconfig -- This is a configuration file similar to the Linux
checks for work in units of microseconds. Default: 50*1000 (50 MS).
CONFIG_SCHED_LPWORKSTACKSIZE - The stack size allocated for the lower
priority worker thread. Default: CONFIG_IDLETHREAD_STACKSIZE.
CONFIG_SCHED_WAITPID - Enables the waitpid() API
CONFIG_SCHED_WAITPID - Enables the waitpid() interface in a default,
non-standard mode (non-standard in the sense that the waited for
PID need not be child of the caller). If SCHED_HAVE_PARENT is
also defined, then this setting will modify the behavior or
waitpid() (making more spec compliant) and will enable the
waitid() and wait() interfaces as well.
CONFIG_SCHED_ATEXIT - Enables the atexit() API
CONFIG_SCHED_ATEXIT_MAX - By default if CONFIG_SCHED_ATEXIT is
selected, only a single atexit() function is supported. That number
@@ -426,6 +437,23 @@ defconfig -- This is a configuration file similar to the Linux
where 'app' is the application name. If not defined, CONFIG_USER_ENTRYPOINT
defaults to user_start.
Signal Numbers:
CONFIG_SIG_SIGUSR1 - Value of standard user signal 1 (SIGUSR1).
Default: 1
CONFIG_SIG_SIGUSR2 - Value of standard user signal 2 (SIGUSR2).
Default: 2
CONFIG_SIG_SIGALARM - Default the standard signal used with POSIX
timers (SIGALRM). Default: 3
CONFIG_SIG_SIGCHLD - The SIGCHLD signal is sent to the parent of a child
process when it exits, is interrupted (stopped), or resumes after being
interrupted. Default: 4
CONFIG_SIG_SIGCONDTIMEDOUT - This non-standard signal number is used in
the implementation of pthread_cond_timedwait(). Default 16.
CONFIG_SIG_SIGWORK - SIGWORK is a non-standard signal used to wake up
the internal NuttX worker thread. Default: 17.
Binary Loaders:
CONFIG_BINFMT_DISABLE - By default, support for loadable binary formats
is built.
@@ -1562,7 +1590,7 @@ defconfig -- This is a configuration file similar to the Linux
operation from FLASH but must copy initialized .data sections to RAM.
CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
but copy themselves entirely into RAM for better performance.
CONFIG_BOOT_RAMFUNCS - Other configurations may copy just some functions
CONFIG_ARCH_RAMFUNCS - Other configurations may copy just some functions
into RAM, either for better performance or for errata workarounds.
CONFIG_STACK_ALIGNMENT - Set if the your application has specific
stack alignment requirements (may not be supported
@@ -1936,6 +1964,11 @@ configs/z8f64200100kit
development kit, Z8F6423 part, and the Zilog ZDS-II Windows command line
tools. The development environment is Cygwin under WinXP.
configs/zp214xpa
This port is for the NXP LPC2148 as provided on the The0.net
ZPA213X/4XPA development board. Includes support for the
UG-2864AMBAG01 OLED also from The0.net
Configuring NuttX
^^^^^^^^^^^^^^^^^
@@ -1955,16 +1988,24 @@ tools/configure.sh
There is a script that automates these steps. The following steps will
accomplish the same configuration:
cd tools
./configure.sh <board-name>/<config-dir>
cd tools
./configure.sh <board-name>/<config-dir>
And if configs/<board-name>/<config-dir>/appconfig exists and your
application directory is not in the standard loction (../apps), then
you should also specify the location of the application directory on the
command line like:
There is an alternative Windows batch file that can be used in the
windows native enironment like:
cd tools
./configure.sh -a <app-dir> <board-name>/<config-dir>
cd ${TOPDIR}\tools
configure.bat <board-name>\<config-dir>
See tools/README.txt for more information about these scripts.
And if configs/<board-name>/<config-dir>/appconfig exists and your
application directory is not in the standard loction (../apps), then
you should also specify the location of the application directory on the
command line like:
cd tools
./configure.sh -a <app-dir> <board-name>/<config-dir>
Building Symbol Tables
^^^^^^^^^^^^^^^^^^^^^^
+1
View File
@@ -970,6 +970,7 @@ CONFIG_CDCACM_PRODUCTSTR="PX4 FMU v1.6"
# CONFIG_NSH_FATNSECTORS - FAT FS number of sectors
# CONFIG_NSH_FATMOUNTPT - FAT FS mountpoint
#
CONFIG_BUILTIN=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_STRERROR=y
+2 -1
View File
@@ -140,7 +140,8 @@ menuconfig SPI
bool "SPI Driver Support"
default n
---help---
This selection enables building of the "upper-half" SPI driver.
This selection enables selection of common SPI options. This option
should be enabled by all platforms that support SPI interfaces.
See include/nuttx/spi.h for further SPI driver information.
if SPI
+19
View File
@@ -123,6 +123,25 @@ config STMPE811_I2C
endchoice
config STMPE811_ACTIVELOW
bool "Active Low Interrupt"
default n
---help---
The STMPE811 interrupt is provided by a discrete input (usually a
GPIO interrupt on most MCU architectures). This setting determines
whether the interrupt is active high (or rising edge triggered) or
active low (or falling edge triggered). Default: Active
high/rising edge.
config STMPE811_EDGE
bool "Edge triggered Interrupt"
default n
---help---
The STMPE811 interrupt is provided by a discrete input (usually a
GPIO interrupt on most MCU architectures). This setting determines
whether the interrupt is edge or level triggered. Default: Level
triggered.
config STMPE811_MULTIPLE
bool "Multiple STMPE811 Devices"
default n
+4
View File
@@ -51,6 +51,10 @@ ifeq ($(CONFIG_LCD_UG2864AMBAG01),y)
CSRCS += ug-2864ambag01.c
endif
ifeq ($(CONFIG_LCD_UG2864HSWEG01),y)
CSRCS += ug-2864hsweg01.c
endif
ifeq ($(CONFIG_LCD_UG9664HSWAG01),y)
CSRCS += ug-9664hswag01.c
endif
+4 -4
View File
@@ -428,7 +428,7 @@ static inline void ug2864ambag01_configspi(FAR struct spi_dev_s *spi)
SPI_SETMODE(spi, CONFIG_UG2864AMBAG01_SPIMODE);
SPI_SETBITS(spi, 8);
SPI_SETFREQUENCY(spi, CONFIG_UG2864AMBAG01_FREQUENCY)
SPI_SETFREQUENCY(spi, CONFIG_UG2864AMBAG01_FREQUENCY);
}
#endif
@@ -1035,7 +1035,7 @@ FAR struct lcd_dev_s *ug2864ambag01_initialize(FAR struct spi_dev_s *spi, unsign
/* Configure the SPI */
ug2864ambag01_configspi(spi)
ug2864ambag01_configspi(spi);
/* Lock and select device */
@@ -1148,8 +1148,8 @@ void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color)
/* Transfer one page of the selected color */
(void)SPI_SNDBLOCK(priv->spi, &priv->fb[page * UG2864AMBAG01_XRES],
UG2864AMBAG01_XRES);
(void)SPI_SNDBLOCK(priv->spi, &priv->fb[page * UG2864AMBAG01_XRES],
UG2864AMBAG01_XRES);
}
/* De-select and unlock the device */
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -2,6 +2,7 @@
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
config MMCSD_NSLOTS
int "Number of MMC/SD slots"
default 1
@@ -38,8 +39,9 @@ config MMCSD_HAVECARDDETECT
100% accurate
config MMCSD_SPI
bool "MMC/SD spi transfer support"
bool "MMC/SD SPI transfer support"
default y
depends on SPI
config MMCSD_SPICLOCK
int "MMC/SD maximum SPI clock"
+3
View File
@@ -37,6 +37,8 @@
# Include MTD drivers
ifeq ($(CONFIG_MTD),y)
CSRCS += at45db.c flash_eraseall.c ftl.c m25px.c rammtd.c ramtron.c
ifeq ($(CONFIG_MTD_AT24XX),y)
@@ -60,3 +62,4 @@ endif
DEPPATH += --dep-path mtd
VPATH += :mtd
endif
+2 -2
View File
@@ -523,12 +523,12 @@ static int composite_setup(FAR struct usbdevclass_driver_s *driver,
{
/* Save the configuration and inform the constituent classes */
ret = CLASS_SETUP(priv->dev1, dev, ctrl);
ret = CLASS_SETUP(priv->dev1, dev, ctrl, dataout, outlen);
dispatched = true;
if (ret >= 0)
{
ret = CLASS_SETUP(priv->dev2, dev, ctrl);
ret = CLASS_SETUP(priv->dev2, dev, ctrl, dataout, outlen);
if (ret >= 0)
{
priv->config = value;
+10 -10
View File
@@ -333,7 +333,7 @@ static void usbclass_wrcomplete(FAR struct usbdev_ep_s *ep,
/* USB class device ********************************************************/
static int usbclass_bind(FAR struct usbdevclass_driver_s *driver,
static int usbclass_bind(FAR struct usbdevclass_driver_s *driver,
FAR struct usbdev_s *dev);
static void usbclass_unbind(FAR struct usbdevclass_driver_s *driver,
FAR struct usbdev_s *dev);
@@ -1295,7 +1295,7 @@ static int usbclass_bind(FAR struct usbdevclass_driver_s *driver,
priv->usbdev = dev;
/* Save the reference to our private data structure in EP0 so that it
* can be recovered in ep0 completion events (Unless we are part of
* can be recovered in ep0 completion events (Unless we are part of
* a composite device and, in that case, the composite device owns
* EP0).
*/
@@ -1859,7 +1859,7 @@ static void usbclass_disconnect(FAR struct usbdevclass_driver_s *driver,
* re-enumerated.
*/
DEV_CONNECT(dev);
DEV_CONNECT(dev);
}
/****************************************************************************
@@ -1878,7 +1878,7 @@ static int usbser_setup(FAR struct uart_dev_s *dev)
{
FAR struct pl2303_dev_s *priv;
usbtrace(PL2303_CLASSASPI_SETUP, 0);
usbtrace(PL2303_CLASSAPI_SETUP, 0);
/* Sanity check */
@@ -1919,7 +1919,7 @@ static int usbser_setup(FAR struct uart_dev_s *dev)
static void usbser_shutdown(FAR struct uart_dev_s *dev)
{
usbtrace(PL2303_CLASSASPI_SHUTDOWN, 0);
usbtrace(PL2303_CLASSAPI_SHUTDOWN, 0);
/* Sanity check */
@@ -1941,7 +1941,7 @@ static void usbser_shutdown(FAR struct uart_dev_s *dev)
static int usbser_attach(FAR struct uart_dev_s *dev)
{
usbtrace(PL2303_CLASSASPI_ATTACH, 0);
usbtrace(PL2303_CLASSAPI_ATTACH, 0);
return OK;
}
@@ -1955,7 +1955,7 @@ static int usbser_attach(FAR struct uart_dev_s *dev)
static void usbser_detach(FAR struct uart_dev_s *dev)
{
usbtrace(PL2303_CLASSASPI_DETACH, 0);
usbtrace(PL2303_CLASSAPI_DETACH, 0);
}
/****************************************************************************
@@ -1981,7 +1981,7 @@ static void usbser_rxint(FAR struct uart_dev_s *dev, bool enable)
FAR uart_dev_t *serdev;
irqstate_t flags;
usbtrace(PL2303_CLASSASPI_RXINT, (uint16_t)enable);
usbtrace(PL2303_CLASSAPI_RXINT, (uint16_t)enable);
/* Sanity check */
@@ -2072,7 +2072,7 @@ static void usbser_txint(FAR struct uart_dev_s *dev, bool enable)
{
FAR struct pl2303_dev_s *priv;
usbtrace(PL2303_CLASSASPI_TXINT, (uint16_t)enable);
usbtrace(PL2303_CLASSAPI_TXINT, (uint16_t)enable);
/* Sanity checks */
@@ -2117,7 +2117,7 @@ static bool usbser_txempty(FAR struct uart_dev_s *dev)
{
FAR struct pl2303_dev_s *priv = (FAR struct pl2303_dev_s*)dev->priv;
usbtrace(PL2303_CLASSASPI_TXEMPTY, 0);
usbtrace(PL2303_CLASSAPI_TXEMPTY, 0);
#if CONFIG_DEBUG
if (!priv)
+44 -22
View File
@@ -2,6 +2,7 @@
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
config USBHOST_NPREALLOC
int "Number of pre-allocated class instances"
default 4
@@ -29,64 +30,85 @@ config USBHOST_ISOC_DISABLE
On some architectures, selecting this setting will reduce driver size
by disabling isochronous endpoint support
config USBHOST_HIDKBD
bool "HID keyboad class support"
config USBHOST_MSC
bool "Mass Storage Class Support"
default n
depends on !USBHOST_INT_DISABLE && SCHED_WORKQUEUE && !DISABLE_SIGNALS
depends on !BULK_DISABLE
---help---
Enable support for the keyboard class driver. This also depends on
NFILE_DESCRIPTORS > 0 && SCHED_WORKQUEUE=y
config USBHOST_HIDKBD
bool "HID Keyboard Class Support"
default n
depends on !INT_DISABLE
---help---
Enable support for the keyboard class driver. This also depends on
SCHED_WORKQUEUE && !DISABLE_SIGNALS
if USBHOST_HIDKBD
config HIDKBD_POLLUSEC
bool ""
default n
int "Keyboard Poll Rate (MSEC)"
default 100000
---help---
Device poll rate in microseconds. Default: 100 milliseconds.
Device poll rate in microseconds. Default: 100,000 microseconds.
config HIDKBD_DEFPRIO
bool ""
default n
int "Polling Thread Priority"
default 50
---help---
Priority of the polling thread. Default: 50.
config HIDKBD_STACKSIZE
bool ""
default n
int "Polling thread stack size"
default 1024
---help---
Stack size for polling thread. Default: 1024
config HIDKBD_BUFSIZE
bool ""
default n
int "Scancode Buffer Size"
default 64
---help---
Scancode buffer size. Default: 64.
config HIDKBD_NPOLLWAITERS
bool ""
default n
int "Max Number of Waiters for Poll Event"
default 2
depends on !DISABLE_POLL
---help---
If the poll() method is enabled, this defines the maximum number
of threads that can be waiting for keyboard events. Default: 2.
config HIDKBD_RAWSCANCODES
bool ""
bool "Use Raw Scan Codes"
default n
---help---
If set to y no conversion will be made on the raw keyboard scan
codes. Default: ASCII conversion.
If set to y no conversions will be made on the raw keyboard scan
codes. This option is useful during testing. Default: ASCII conversion.
config HIDKBD_ENCODED
bool "Enocode Special Keys"
default n
depends on !HIDKBD_RAWSCANCODES && LIB_KBDCODEC
---help---
Encode special key press events in the user buffer. In this case,
the user end must decode the encoded special key values using the
interfaces defined in include/nuttx/input/kbd_codec.h. These
special keys include such things as up/down arrows, home and end
keys, etc. If this not defined, only 7-bit print-able and control
ASCII characters will be provided to the user.
config HIDKBD_ALLSCANCODES
bool ""
bool "Use All Scancodes"
default n
---help---
If set to y all 231 possible scancodes will be converted to
something. Default: 104 key US keyboard.
config HIDKBD_NODEBOUNCE
bool ""
bool "Disable Debounce"
default n
---help---
If set to y normal debouncing is disabled. Default:
Debounce enabled (No repeat keys).
USB host mass storage class driver. Requires USBHOST=y,
config USBHOST_BULK_DISABLE=n, NFILE_DESCRIPTORS > 0,
and SCHED_WORKQUEUE=y
endif
+355 -54
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* drivers/usbhost/usbhost_hidkbd.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -62,6 +62,11 @@
#include <nuttx/usb/usbhost.h>
#include <nuttx/usb/hid.h>
#ifdef CONFIG_HIDKBD_ENCODED
# include <nuttx/streams.h>
# include <nuttx/input/kbd_codec.h>
#endif
/* Don't compile if prerequisites are not met */
#if defined(CONFIG_USBHOST) && !defined(CONFIG_USBHOST_INT_DISABLE) && CONFIG_NFILE_DESCRIPTORS > 0
@@ -126,6 +131,22 @@
# endif
#endif
/* We cant support encoding of special characters of unless the Keyboard
* CODEC is enabled.
*/
#ifndef CONFIG_LIB_KBDCODEC
# undef CONFIG_HIDKBD_ENCODED
#endif
/* If we are using raw scancodes, then we cannot support encoding of
* special characters either.
*/
#ifdef CONFIG_HIDKBD_RAWSCANCODES
# undef CONFIG_HIDKBD_ENCODED
#endif
/* Driver support ***********************************************************/
/* This format is used to construct the /dev/kbd[n] device driver path. It
* defined here so that it will be used consistently in all places.
@@ -144,6 +165,23 @@
#define USBHOST_MAX_CREFS 0x7fff
/* Debug ********************************************************************/
/* Both CONFIG_DEBUG_INPUT and CONFIG_DEBUG_USB could apply to this file.
* We assume here that CONFIG_DEBUG_INPUT might be enabled separately, but
* CONFIG_DEBUG_USB implies both.
*/
#ifndef CONFIG_DEBUG_INPUT
# undef idbg
# define idbg udbg
# undef illdbg
# define illdbg ulldbg
# undef ivdbg
# define ivdbg uvdbg
# undef illvdbg
# define illvdbg ullvdbg
#endif
/****************************************************************************
* Private Types
****************************************************************************/
@@ -209,6 +247,16 @@ struct usbhost_state_s
uint8_t kbdbuffer[CONFIG_HIDKBD_BUFSIZE];
};
/* This type is used for encoding special characters */
#ifdef CONFIG_HIDKBD_ENCODED
struct usbhost_outstream_s
{
struct lib_outstream_s stream;
FAR struct usbhost_state_s *priv;
};
#endif
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
@@ -240,7 +288,15 @@ static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, char *dev
/* Keyboard polling thread */
static void usbhost_destroy(FAR void *arg);
static void usbhost_putbuffer(FAR struct usbhost_state_s *priv, uint8_t keycode);
#ifdef CONFIG_HIDKBD_ENCODED
static void usbhost_putstream(FAR struct lib_outstream_s *this, int ch);
#endif
static inline uint8_t usbhost_mapscancode(uint8_t scancode, uint8_t modifier);
#ifdef CONFIG_HIDKBD_ENCODED
static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv,
uint8_t scancode, uint8_t modifier);
#endif
static int usbhost_kbdpoll(int argc, char *argv[]);
/* Helpers for usbhost_connect() */
@@ -346,6 +402,121 @@ static struct usbhost_state_s *g_priv; /* Data passed to thread */
*/
#ifndef CONFIG_HIDKBD_RAWSCANCODES
#ifdef CONFIG_HIDKBD_ENCODED
/* The first and last scancode values with encode-able values */
#define FIRST_ENCODING USBHID_KBDUSE_ENTER /* 0x28 Keyboard Return (ENTER) */
#ifndef CONFIG_HIDKBD_ALLSCANCODES
# define LAST_ENCODING USBHID_KBDUSE_POWER /* 0x66 Keyboard Power */
#else
# define LAST_ENCODING USBHID_KBDUSE_KPDHEXADECIMAL /* 0xdd Keypad Hexadecimal */
#endif
#define USBHID_NUMENCODINGS (LAST_ENCODING - FIRST_ENCODING + 1)
static const uint8_t encoding[USBHID_NUMENCODINGS] =
{
/* 0x28-0x2f: Enter,escape,del,back-tab,space,_,+,{ */
KEYCODE_ENTER, 0, KEYCODE_FWDDEL, KEYCODE_BACKDEL, 0, 0, 0, 0,
/* 0x30-0x37: },|,Non-US tilde,:,",grave tilde,<,> */
0, 0, 0, 0, 0, 0, 0, 0,
/* 0x38-0x3f: /,CapsLock,F1,F2,F3,F4,F5,F6 */
0, KEYCODE_CAPSLOCK, KEYCODE_F1, KEYCODE_F2, KEYCODE_F3, KEYCODE_F4, KEYCODE_F5, KEYCODE_F6,
/* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,ScrollLock */
KEYCODE_F7, KEYCODE_F8, KEYCODE_F9, KEYCODE_F10, KEYCODE_F11, KEYCODE_F12, KEYCODE_PRTSCRN, KEYCODE_SCROLLLOCK,
/* 0x48-0x4f: Pause,Insert,Home,PageUp,DeleteForward,End,PageDown,RightArrow */
KEYCODE_PAUSE, KEYCODE_INSERT, KEYCODE_HOME, KEYCODE_PAGEUP, KEYCODE_FWDDEL, KEYCODE_END, KEYCODE_PAGEDOWN, KEYCODE_RIGHT,
/* 0x50-0x57: LeftArrow,DownArrow,UpArrow,Num Lock,/,*,-,+ */
KEYCODE_LEFT, KEYCODE_DOWN, KEYCODE_UP, KEYCODE_NUMLOCK, 0, 0, 0, 0,
/* 0x58-0x5f: Enter,1-7 */
KEYCODE_ENTER, 0, 0, 0, 0, 0, 0, 0,
/* 0x60-0x66: 8-9,0,.,Non-US \,Application,Power */
0, 0, 0, 0, 0, 0, KEYCODE_POWER,
#ifdef CONFIG_HIDKBD_ALLSCANCODES
0, /* 0x67 = */
/* 0x68-0x6f: F13,F14,F15,F16,F17,F18,F19,F20 */
KEYCODE_F13, KEYCODE_F14, KEYCODE_F15, KEYCODE_F16, KEYCODE_F17, KEYCODE_F18, KEYCODE_F19, KEYCODE_F20,
/* 0x70-0x77: F21,F22,F23,F24,Execute,Help,Menu,Select */
KEYCODE_F21, KEYCODE_F22, KEYCODE_F23, KEYCODE_F24, KEYCODE_EXECUTE, KEYCODE_HELP, KEYCODE_MENU, KEYCODE_SELECT,
/* 0x78-0x7f: Stop,Again,Undo,Cut,Copy,Paste,Find,Mute */
KEYCODE_STOP, KEYCODE_AGAIN, KEYCODE_UNDO, KEYCODE_CUT, KEYCODE_COPY, KEYCODE_PASTE, KEYCODE_FIND, KEYCODE_MUTE,
/* 0x80-0x87: VolUp,VolDown,LCapsLock,lNumLock,LScrollLock,,,=,International1 */
KEYCODE_VOLUP, KEYCODE_VOLDOWN, KEYCODE_LCAPSLOCK, KEYCODE_LNUMLOCK, KEYCODE_LSCROLLLOCK, 0, 0, 0,
/* 0x88-0x8f: International 2-9 */
0, 0, 0, 0, 0, 0, 0, 0,
/* 0x90-0x97: LAN 1-8 */
KEYCODE_LANG1, KEYCODE_LANG2, KEYCODE_LANG3, KEYCODE_LANG4, KEYCODE_LANG5, KEYCODE_LANG6, KEYCODE_LANG7, KEYCODE_LANG8,
/* 0x98-0x9f: LAN 9,Erase,SysReq,Cancel,Clear,Prior,Return,Separator */
0, 0, KEYCODE_SYSREQ, KEYCODE_CANCEL, KEYCODE_CLEAR, 0, KEYCODE_ENTER, 0,
/* 0xa0-0xa7: Out,Oper,Clear,CrSel,Excel,(reserved) */
0, 0, 0, 0, 0, 0, 0, 0,
/* 0xa8-0xaf: (reserved) */
0, 0, 0, 0, 0, 0, 0, 0,
/* 0xb0-0xb7: 00,000,ThouSeparator,DecSeparator,CurrencyUnit,SubUnit,(,) */
0, 0, 0, 0, 0, 0, 0, 0,
/* 0xb8-0xbf: {,},tab,backspace,A-D */
0, 0, 0, KEYCODE_BACKDEL, 0, 0, 0, 0,
/* 0xc0-0xc7: E-F,XOR,^,%,<,>,& */
0, 0, 0, 0, 0, 0, 0, 0,
/* 0xc8-0xcf: &&,|,||,:,#, ,@,! */
0, 0, 0, 0, 0, 0, 0, 0,
/* 0xd0-0xd7: Memory Store,Recall,Clear,Add,Subtract,Muliply,Divide,+/- */
KEYCODE_MEMSTORE, KEYCODE_MEMRECALL, KEYCODE_MEMCLEAR, KEYCODE_MEMADD, KEYCODE_MEMSUB, KEYCODE_MEMMUL, KEYCODE_MEMDIV, KEYCODE_NEGATE,
/* 0xd8-0xdd: Clear,ClearEntry,Binary,Octal,Decimal,Hexadecimal */
KEYCODE_CLEAR, KEYCODE_CLEARENTRY, KEYCODE_BINARY, KEYCODE_OCTAL, KEYCODE_DECIMAL, KEYCODE_HEXADECIMAL
#endif
};
#endif
static const uint8_t ucmap[USBHID_NUMSCANCODES] =
{
0, 0, 0, 0, 'A', 'B', 'C', 'D', /* 0x00-0x07: Reserved, errors, A-D */
@@ -354,12 +525,12 @@ static const uint8_t ucmap[USBHID_NUMSCANCODES] =
'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', /* 0x18-0x1f: U-Z,!,@ */
'#', '$', '%', '^', '&', '*', '(', ')', /* 0x20-0x27: #,$,%,^,&,*,(,) */
'\n', '\033', '\177', 0, ' ', '_', '+', '{', /* 0x28-0x2f: Enter,escape,del,back-tab,space,_,+,{ */
'}', '|', 0, ':', '"', 0, '<', '>', /* 0x30-0x37: },|,Non-US tilde,:,",grave tidle,<,> */
'}', '|', 0, ':', '"', '~', '<', '>', /* 0x30-0x37: },|,Non-US tilde,:,",grave tilde,<,> */
'?', 0, 0, 0, 0, 0, 0, 0, /* 0x38-0x3f: /,CapsLock,F1,F2,F3,F4,F5,F6 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,sScrollLock */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,ScrollLock */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x48-0x4f: Pause,Insert,Home,PageUp,DeleteForward,End,PageDown,RightArrow */
0, 0, 0, 0, '/', '*', '-', '+', /* 0x50-0x57: LeftArrow,DownArrow,UpArrow,Num Lock,/,*,-,+ */
'\n', '1', '2', '3', '4', '4', '6', '7', /* 0x58-0x5f: Enter,1-7 */
'\n', '1', '2', '3', '4', '5', '6', '7', /* 0x58-0x5f: Enter,1-7 */
'8', '9', '0', '.', 0, 0, 0, '=', /* 0x60-0x67: 8-9,0,.,Non-US \,Application,Power,= */
#ifdef CONFIG_HIDKBD_ALLSCANCODES
0, 0, 0, 0, 0, 0, 0, 0, /* 0x68-0x6f: F13,F14,F15,F16,F17,F18,F19,F20 */
@@ -368,7 +539,7 @@ static const uint8_t ucmap[USBHID_NUMSCANCODES] =
0, 0, 0, 0, 0, ',', 0, 0, /* 0x80-0x87: VolUp,VolDown,LCapsLock,lNumLock,LScrollLock,,,=,International1 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x88-0x8f: International 2-9 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x97: LAN 1-8 */
0, 0, 0, 0, 0, 0, '\n', 0, /* 0x98-0x9f: LAN 9,Ease,SysReq,Cancel,Clear,Prior,Return,Separator */
0, 0, 0, 0, 0, 0, '\n', 0, /* 0x98-0x9f: LAN 9,Erase,SysReq,Cancel,Clear,Prior,Return,Separator */
0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xa7: Out,Oper,Clear,CrSel,Excel,(reserved) */
0, 0, 0, 0, 0, 0, 0, 0, /* 0xa8-0xaf: (reserved) */
0, 0, 0, 0, 0, 0, '(', ')', /* 0xb0-0xb7: 00,000,ThouSeparator,DecSeparator,CurrencyUnit,SubUnit,(,) */
@@ -389,12 +560,12 @@ static const uint8_t lcmap[USBHID_NUMSCANCODES] =
'u', 'v', 'w', 'x', 'y', 'z', '1', '2', /* 0x18-0x1f: u-z,1-2 */
'3', '4', '5', '6', '7', '8', '9', '0', /* 0x20-0x27: 3-9,0 */
'\n', '\033', '\177', '\t', ' ', '-', '=', '[', /* 0x28-0x2f: Enter,escape,del,tab,space,-,=,[ */
']', '\\', '\234', ';', '\'', 0, ',', '.', /* 0x30-0x37: ],\,Non-US pound,;,',grave accent,,,. */
']', '\\', '\234', ';', '\'', '`', ',', '.', /* 0x30-0x37: ],\,Non-US pound,;,',grave accent,,,. */
'/', 0, 0, 0, 0, 0, 0, 0, /* 0x38-0x3f: /,CapsLock,F1,F2,F3,F4,F5,F6 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,ScrollLock */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x48-0x4f: Pause,Insert,Home,PageUp,DeleteForward,End,PageDown,RightArrow */
0, 0, 0, 0, '/', '*', '-', '+', /* 0x50-0x57: LeftArrow,DownArrow,UpArrow,Num Lock,/,*,-,+ */
'\n', '1', '2', '3', '4', '4', '6', '7', /* 0x58-0x5f: Enter,1-7 */
'\n', '1', '2', '3', '4', '5', '6', '7', /* 0x58-0x5f: Enter,1-7 */
'8', '9', '0', '.', 0, 0, 0, '=', /* 0x60-0x67: 8-9,0,.,Non-US \,Application,Power,= */
#ifdef CONFIG_HIDKBD_ALLSCANCODES
0, 0, 0, 0, 0, 0, 0, 0, /* 0x68-0x6f: F13,F14,F15,F16,F17,F18,F19,F20 */
@@ -403,7 +574,7 @@ static const uint8_t lcmap[USBHID_NUMSCANCODES] =
0, 0, 0, 0, 0, ',', 0, 0, /* 0x80-0x87: VolUp,VolDown,LCapsLock,lNumLock,LScrollLock,,,=,International1 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x88-0x8f: International 2-9 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x97: LAN 1-8 */
0, 0, 0, 0, 0, 0, '\n', 0, /* 0x98-0x9f: LAN 9,Ease,SysReq,Cancel,Clear,Prior,Return,Separator */
0, 0, 0, 0, 0, 0, '\n', 0, /* 0x98-0x9f: LAN 9,Erase,SysReq,Cancel,Clear,Prior,Return,Separator */
0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xa7: Out,Oper,Clear,CrSel,Excel,(reserved) */
0, 0, 0, 0, 0, 0, 0, 0, /* 0xa8-0xaf: (reserved) */
0, 0, 0, 0, 0, 0, '(', ')', /* 0xb0-0xb7: 00,000,ThouSeparator,DecSeparator,CurrencyUnit,SubUnit,(,) */
@@ -637,6 +808,88 @@ static void usbhost_destroy(FAR void *arg)
usbhost_freeclass(priv);
}
/****************************************************************************
* Name: usbhost_putbuffer
*
* Description:
* Add one character to the user buffer.
*
* Input Parameters:
* priv - Driver internal state
* keycode - The value to add to the user buffer
*
* Returned Values:
* None
*
****************************************************************************/
static void usbhost_putbuffer(FAR struct usbhost_state_s *priv,
uint8_t keycode)
{
register unsigned int head;
register unsigned int tail;
/* Copy the next keyboard character into the user buffer. */
head = priv->headndx;
priv->kbdbuffer[head] = keycode;
/* Increment the head index */
if (++head >= CONFIG_HIDKBD_BUFSIZE)
{
head = 0;
}
/* If the buffer is full, then increment the tail index to make space. Is
* it better to lose old keystrokes or new?
*/
tail = priv->tailndx;
if (tail == head)
{
if (++tail >= CONFIG_HIDKBD_BUFSIZE)
{
tail = 0;
}
/* Save the updated tail index */
priv->tailndx = tail;
}
/* Save the updated head index */
priv->headndx = head;
}
/****************************************************************************
* Name: usbhost_putstream
*
* Description:
* A wrapper for usbhost_putc that is compatibile with the lib_outstream_s
* putc methos.
*
* Input Parameters:
* stream - The struct lib_outstream_s reference
* ch - The character to add to the user buffer
*
* Returned Values:
* None
*
****************************************************************************/
#ifdef CONFIG_HIDKBD_ENCODED
static void usbhost_putstream(FAR struct lib_outstream_s *stream, int ch)
{
FAR struct usbhost_outstream_s *privstream = (FAR struct usbhost_outstream_s *)stream;
DEBUGASSERT(privstream && privstream->priv);
usbhost_putbuffer(privstream->priv, (uint8_t)ch);
stream->nput++;
}
#endif
/****************************************************************************
* Name: usbhost_mapscancode
*
@@ -679,6 +932,58 @@ static inline uint8_t usbhost_mapscancode(uint8_t scancode, uint8_t modifier)
#endif
}
/****************************************************************************
* Name: usbhost_encodescancode
*
* Description:
* Check if the key has a special function encoding and, if it does, add
* the encoded value to the user buffer.
*
* Input Parameters:
* priv - Driver internal state
* scancode - Scan code to be mapped.
* modifier - Ctrl,Alt,Shift,GUI modifier bits
*
* Returned Values:
* None
*
****************************************************************************/
#ifdef CONFIG_HIDKBD_ENCODED
static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv,
uint8_t scancode, uint8_t modifier)
{
uint8_t encoded;
/* Check if the raw scancode is in a valid range */
if (scancode >= FIRST_ENCODING && scancode <= LAST_ENCODING)
{
/* Yes the value is within range */
encoded = encoding[scancode - FIRST_ENCODING];
ivdbg(" scancode: %02x modifier: %02x encoded: %d\n",
scancode, modifier, encoded);
if (encoded)
{
struct usbhost_outstream_s usbstream;
/* And it does correspond to a special function key */
usbstream.stream.put = usbhost_putstream;
usbstream.stream.nput = 0;
usbstream.priv = priv;
/* Add the special function value to the user buffer */
kbd_specpress((enum kbd_keycode_e)encoded,
(FAR struct lib_outstream_s *)&usbstream);
}
}
}
#endif
/****************************************************************************
* Name: usbhost_kbdpoll
*
@@ -704,6 +1009,8 @@ static int usbhost_kbdpoll(int argc, char *argv[])
unsigned int npolls = 0;
#endif
unsigned int nerrors = 0;
bool empty = true;
bool newstate;
int ret;
uvdbg("Started\n");
@@ -717,17 +1024,18 @@ static int usbhost_kbdpoll(int argc, char *argv[])
* running.
*/
priv = g_priv;
DEBUGASSERT(priv != NULL);
priv = g_priv;
DEBUGASSERT(priv != NULL);
priv->polling = true;
priv->crefs++;
usbhost_givesem(&g_syncsem);
sleep(1);
priv->polling = true;
priv->crefs++;
usbhost_givesem(&g_syncsem);
sleep(1);
/* Loop here until the device is disconnected */
uvdbg("Entering poll loop\n");
while (!priv->disconnected)
{
/* Make sure that we have exclusive access to the private data
@@ -784,17 +1092,12 @@ static int usbhost_kbdpoll(int argc, char *argv[])
else if (priv->open)
{
struct usbhid_kbdreport_s *rpt = (struct usbhid_kbdreport_s *)priv->tbuffer;
unsigned int head;
unsigned int tail;
uint8_t ascii;
uint8_t keycode;
int i;
/* Add the newly received keystrokes to our internal buffer */
usbhost_takesem(&priv->exclsem);
head = priv->headndx;
tail = priv->tailndx;
for (i = 0; i < 6; i++)
{
/* Is this key pressed? But not pressed last time?
@@ -828,15 +1131,15 @@ static int usbhost_kbdpoll(int argc, char *argv[])
* or cursor controls in this version of the driver.
*/
ascii = usbhost_mapscancode(rpt->key[i], rpt->modifier);
uvdbg("Key %d: %02x ASCII:%c modifier: %02x\n",
i, rpt->key[i], ascii ? ascii : ' ', rpt->modifier);
keycode = usbhost_mapscancode(rpt->key[i], rpt->modifier);
ivdbg("Key %d: %02x keycode:%c modifier: %02x\n",
i, rpt->key[i], keycode ? keycode : ' ', rpt->modifier);
/* Zero at this point means that the key does not map to a
* printable character.
*/
if (ascii != 0)
if (keycode != 0)
{
/* Handle control characters. Zero after this means
* a valid, NUL character.
@@ -844,36 +1147,28 @@ static int usbhost_kbdpoll(int argc, char *argv[])
if ((rpt->modifier & (USBHID_MODIFER_LCTRL|USBHID_MODIFER_RCTRL)) != 0)
{
ascii &= 0x1f;
keycode &= 0x1f;
}
/* Copy the next keyboard character into the user
* buffer.
*/
priv->kbdbuffer[head] = ascii;
/* Increment the head index */
if (++head >= CONFIG_HIDKBD_BUFSIZE)
{
head = 0;
}
/* If the buffer is full, then increment the tail
* index to make space. Is it better to lose old
* keystrokes or new?
*/
if (tail == head)
{
if (++tail >= CONFIG_HIDKBD_BUFSIZE)
{
tail = 0;
}
}
usbhost_putbuffer(priv, keycode);
}
/* The zero might, however, map to a special keyboard action (such as a
* cursor movement or function key). Attempt to encode the special key.
*/
#ifdef CONFIG_HIDKBD_ENCODED
else
{
usbhost_encodescancode(priv, rpt->key[i], rpt->modifier);
}
#endif
}
/* Save the scancode (or lack thereof) for key debouncing on
* next keyboard report.
*/
@@ -883,9 +1178,10 @@ static int usbhost_kbdpoll(int argc, char *argv[])
#endif
}
/* Did we just transition from no data available to data available? */
/* Is there data available? */
if (head != tail && priv->headndx == priv->tailndx)
newstate = (priv->headndx == priv->tailndx);
if (!newstate)
{
/* Yes.. Is there a thread waiting for keyboard data now? */
@@ -897,15 +1193,18 @@ static int usbhost_kbdpoll(int argc, char *argv[])
priv->waiting = false;
}
/* And wake up any threads waiting for the POLLIN event */
/* Did we just transition from no data available to data
* available? If so, wake up any threads waiting for the
* POLLIN event.
*/
usbhost_pollnotify(priv);
if (empty)
{
usbhost_pollnotify(priv);
}
}
/* Update the head/tail indices */
priv->headndx = head;
priv->tailndx = tail;
empty = newstate;
usbhost_givesem(&priv->exclsem);
}
@@ -958,6 +1257,7 @@ static int usbhost_kbdpoll(int argc, char *argv[])
usbhost_givesem(&priv->exclsem);
}
return 0;
}
@@ -1861,6 +2161,7 @@ static ssize_t usbhost_read(FAR struct file *filep, FAR char *buffer, size_t len
/* Wait for data to be available */
uvdbg("Waiting...\n");
priv->waiting = true;
usbhost_givesem(&priv->exclsem);
usbhost_takesem(&priv->waitsem);
+2 -1
View File
@@ -5,11 +5,12 @@
comment "File system configuration"
source fs/fat/Kconfig
source fs/mmap/Kconfig
source fs/fat/Kconfig
source fs/nfs/Kconfig
source fs/nxffs/Kconfig
source fs/romfs/Kconfig
source fs/binfs/Kconfig
comment "System Logging"
+10 -5
View File
@@ -1,7 +1,7 @@
############################################################################
# fs/Makefile
#
# Copyright (C) 2007, 2008, 2011-2012 Gregory Nutt. All rights reserved.
# Copyright (C) 2007, 2008, 2011-2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -72,6 +72,9 @@ CSRCS += fs_registerdriver.c fs_unregisterdriver.c
CSRCS += fs_registerblockdriver.c fs_unregisterblockdriver.c \
fs_findblockdriver.c fs_openblockdriver.c fs_closeblockdriver.c
DEPPATH =
VPATH = .
include mmap/Make.defs
# Stream support
@@ -91,13 +94,17 @@ endif
# Additional files required is mount-able file systems are supported
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
CSRCS += fs_fsync.c fs_mkdir.c fs_mount.c fs_rename.c fs_rmdir.c \
fs_umount.c fs_unlink.c
CSRCS += fs_foreachmountpoint.c
include fat/Make.defs
include romfs/Make.defs
include nxffs/Make.defs
include nfs/Make.defs
include binfs/Make.defs
endif
endif
@@ -108,8 +115,7 @@ OBJS = $(AOBJS) $(COBJS)
BIN = libfs$(LIBEXT)
SUBDIRS = mmap fat romfs nxffs:nfs
VPATH = mmap:fat:romfs:nxffs:nfs
SUBDIRS = mmap fat romfs nxffs nfs binfs
all: $(BIN)
@@ -123,8 +129,7 @@ $(BIN): $(OBJS)
$(call ARCHIVE, $@, $(OBJS))
.depend: Makefile $(SRCS)
$(Q) $(MKDEP) --dep-path . $(MMAPDEPPATH) $(FATDEPPATH) $(ROMFSDEPPATH) $(NXFFSDEPPATH) $(NFSDEPPATH) \
"$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) $(MKDEP) --dep-path . $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
$(Q) touch $@
depend: .depend
+19
View File
@@ -0,0 +1,19 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
config FS_BINFS
bool "BINFS File System"
default n
depends on BUILTIN
---help---
The BINFS file system is provides access to builtin applications through
the NuttX file system. The BINFS may, for example, be mount at /bin.
Then all of the built-in applications will appear as executable files in
/bin. Then, for example, you list them from NSH like:
nsh> ls -l /bin
If the BINFS BINFMT loader is also enabled, then the builtin applications
can be executed through the normal mechanisms (posix_spawn(), exev(), etc.)
+48
View File
@@ -0,0 +1,48 @@
############################################################################
# fs/binfs/Make.defs
#
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
# 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
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name Nuttx nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
ifeq ($(CONFIG_FS_BINFS),y)
# Files required for BINFS file system support
ASRCS +=
CSRCS += fs_binfs.c
# Include BINFS build support
DEPPATH += --dep-path binfs
VPATH += :binfs
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)binfs}
endif
+446
View File
@@ -0,0 +1,446 @@
/****************************************************************************
* fs/binfs/fs_binfs.c
*
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sys/statfs.h>
#include <sys/stat.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <fcntl.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/binfs.h>
#include <nuttx/fs/dirent.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/binfmt/builtin.h>
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_BINFS)
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static int binfs_open(FAR struct file *filep, const char *relpath,
int oflags, mode_t mode);
static int binfs_close(FAR struct file *filep);
static ssize_t binfs_read(FAR struct file *filep, char *buffer, size_t buflen);
static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp);
static int binfs_opendir(struct inode *mountpt, const char *relpath,
struct fs_dirent_s *dir);
static int binfs_readdir(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir);
static int binfs_rewinddir(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir);
static int binfs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle);
static int binfs_unbind(FAR void *handle, FAR struct inode **blkdriver);
static int binfs_statfs(FAR struct inode *mountpt,
FAR struct statfs *buf);
static int binfs_stat(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct stat *buf);
/****************************************************************************
* Private Variables
****************************************************************************/
/****************************************************************************
* Public Variables
****************************************************************************/
/* See fs_mount.c -- this structure is explicitly externed there.
* We use the old-fashioned kind of initializers so that this will compile
* with any compiler.
*/
const struct mountpt_operations binfs_operations =
{
binfs_open, /* open */
binfs_close, /* close */
binfs_read, /* read */
NULL, /* write */
NULL, /* seek */
binfs_ioctl, /* ioctl */
NULL, /* sync */
binfs_dup, /* dup */
binfs_opendir, /* opendir */
NULL, /* closedir */
binfs_readdir, /* readdir */
binfs_rewinddir, /* rewinddir */
binfs_bind, /* bind */
binfs_unbind, /* unbind */
binfs_statfs, /* statfs */
NULL, /* unlink */
NULL, /* mkdir */
NULL, /* rmdir */
NULL, /* rename */
binfs_stat /* stat */
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: binfs_open
****************************************************************************/
static int binfs_open(FAR struct file *filep, FAR const char *relpath,
int oflags, mode_t mode)
{
int index;
fvdbg("Open '%s'\n", relpath);
/* BINFS is read-only. Any attempt to open with any kind of write
* access is not permitted.
*/
if ((oflags & O_WRONLY) != 0 || (oflags & O_RDONLY) == 0)
{
fdbg("ERROR: Only O_RDONLY supported\n");
return -EACCES;
}
/* Check if the an entry exists with this name in the root directory.
* so the 'relpath' must be the name of the builtin function.
*/
index = builtin_isavail(relpath);
if (index < 0)
{
fdbg("ERROR: Builting %s does not exist\n", relpath);
return -ENOENT;
}
/* Save the index as the open-specific state in filep->f_priv */
filep->f_priv = (FAR void *)index;
return OK;
}
/****************************************************************************
* Name: binfs_close
****************************************************************************/
static int binfs_close(FAR struct file *filep)
{
fvdbg("Closing\n");
return OK;
}
/****************************************************************************
* Name: binfs_read
****************************************************************************/
static ssize_t binfs_read(FAR struct file *filep, char *buffer, size_t buflen)
{
/* Reading is not supported. Just return end-of-file */
fvdbg("Read %d bytes from offset %d\n", buflen, filep->f_pos);
return 0;
}
/****************************************************************************
* Name: binfs_ioctl
****************************************************************************/
static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
int ret;
fvdbg("cmd: %d arg: %08lx\n", cmd, arg);
/* Only one IOCTL command is supported */
if (cmd == FIOC_FILENAME)
{
/* IN: FAR char const ** pointer
* OUT: Pointer to a persistent file name (Guaranteed to persist while
* the file is open).
*/
FAR const char **ptr = (FAR const char **)((uintptr_t)arg);
if (ptr == NULL)
{
ret = -EINVAL;
}
else
{
*ptr = g_builtins[(int)filep->f_priv].name;
ret = OK;
}
}
else
{
ret = -ENOTTY;
}
return ret;
}
/****************************************************************************
* Name: binfs_dup
*
* Description:
* Duplicate open file data in the new file structure.
*
****************************************************************************/
static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp)
{
fvdbg("Dup %p->%p\n", oldp, newp);
/* Copy the index from the old to the new file structure */
newp->f_priv = oldp->f_priv;
return OK;
}
/****************************************************************************
* Name: binfs_opendir
*
* Description:
* Open a directory for read access
*
****************************************************************************/
static int binfs_opendir(struct inode *mountpt, const char *relpath,
struct fs_dirent_s *dir)
{
fvdbg("relpath: \"%s\"\n", relpath ? relpath : "NULL");
/* The requested directory must be the volume-relative "root" directory */
if (relpath && relpath[0] != '\0')
{
return -ENOENT;
}
/* Set the index to the first entry */
dir->u.binfs.fb_index = 0;
return OK;
}
/****************************************************************************
* Name: binfs_readdir
*
* Description: Read the next directory entry
*
****************************************************************************/
static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
{
unsigned int index;
int ret;
/* Have we reached the end of the directory */
index = dir->u.binfs.fb_index;
if (g_builtins[index].name == NULL)
{
/* We signal the end of the directory by returning the
* special error -ENOENT
*/
fvdbg("Entry %d: End of directory\n", index);
ret = -ENOENT;
}
else
{
/* Save the filename and file type */
fvdbg("Entry %d: \"%s\"\n", index, g_builtins[index].name);
dir->fd_dir.d_type = DTYPE_FILE;
strncpy(dir->fd_dir.d_name, g_builtins[index].name, NAME_MAX+1);
/* The application list is terminated by an entry with a NULL name.
* Therefore, there is at least one more entry in the list.
*/
index++;
/* Set up the next directory entry offset. NOTE that we could use the
* standard f_pos instead of our own private fb_index.
*/
dir->u.binfs.fb_index = index;
ret = OK;
}
return ret;
}
/****************************************************************************
* Name: binfs_rewindir
*
* Description: Reset directory read to the first entry
*
****************************************************************************/
static int binfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir)
{
fvdbg("Entry\n");
dir->u.binfs.fb_index = 0;
return OK;
}
/****************************************************************************
* Name: binfs_bind
*
* Description: This implements a portion of the mount operation. This
* function allocates and initializes the mountpoint private data and
* binds the blockdriver inode to the filesystem private data. The final
* binding of the private data (containing the blockdriver) to the
* mountpoint is performed by mount().
*
****************************************************************************/
static int binfs_bind(FAR struct inode *blkdriver, const void *data,
void **handle)
{
fvdbg("Entry\n");
return OK;
}
/****************************************************************************
* Name: binfs_unbind
*
* Description: This implements the filesystem portion of the umount
* operation.
*
****************************************************************************/
static int binfs_unbind(void *handle, FAR struct inode **blkdriver)
{
fvdbg("Entry\n");
return OK;
}
/****************************************************************************
* Name: binfs_statfs
*
* Description: Return filesystem statistics
*
****************************************************************************/
static int binfs_statfs(struct inode *mountpt, struct statfs *buf)
{
fvdbg("Entry\n");
/* Fill in the statfs info */
memset(buf, 0, sizeof(struct statfs));
buf->f_type = BINFS_MAGIC;
buf->f_bsize = 0;
buf->f_blocks = 0;
buf->f_bfree = 0;
buf->f_bavail = 0;
buf->f_namelen = NAME_MAX;
return OK;
}
/****************************************************************************
* Name: binfs_stat
*
* Description: Return information about a file or directory
*
****************************************************************************/
static int binfs_stat(struct inode *mountpt, const char *relpath, struct stat *buf)
{
fvdbg("Entry\n");
/* The requested directory must be the volume-relative "root" directory */
if (relpath && relpath[0] != '\0')
{
/* Check if there is a file with this name. */
if (builtin_isavail(relpath) < 0)
{
return -ENOENT;
}
/* It's a execute-only file name */
buf->st_mode = S_IFREG|S_IXOTH|S_IXGRP|S_IXUSR;
}
else
{
/* It's a read/execute-only directory name */
buf->st_mode = S_IFDIR|S_IROTH|S_IRGRP|S_IRUSR|S_IXOTH|S_IXGRP|S_IXUSR;
}
/* File/directory size, access block size */
buf->st_size = 0;
buf->st_blksize = 0;
buf->st_blocks = 0;
return OK;
}
/****************************************************************************
* Public Functions
****************************************************************************/
#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_BINFS */
+6 -3
View File
@@ -1,7 +1,7 @@
############################################################################
# Make.defs
#
# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
# Copyright (C) 2008, 2011, 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,10 @@ CSRCS += fs_fat32.c fs_fat32dirent.c fs_fat32attrib.c fs_fat32util.c
ASRCS +=
CSRCS += fs_mkfatfs.c fs_configfat.c fs_writefat.c
# Argument for dependency checking
# Include FAT build support
DEPPATH += --dep-path fat
VPATH += :fat
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)fat}
FATDEPPATH = --dep-path fat
endif
+144 -21
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/fat/fs_fat32.c
*
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References:
@@ -86,7 +86,9 @@ static ssize_t fat_write(FAR struct file *filep, const char *buffer,
size_t buflen);
static off_t fat_seek(FAR struct file *filep, off_t offset, int whence);
static int fat_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int fat_sync(FAR struct file *filep);
static int fat_dup(FAR const struct file *oldp, FAR struct file *newp);
static int fat_opendir(struct inode *mountpt, const char *relpath,
struct fs_dirent_s *dir);
@@ -121,28 +123,30 @@ static int fat_stat(struct inode *mountpt, const char *relpath, struct stat
const struct mountpt_operations fat_operations =
{
fat_open,
fat_close,
fat_read,
fat_write,
fat_seek,
fat_ioctl,
fat_sync,
fat_open, /* open */
fat_close, /* close */
fat_read, /* read */
fat_write, /* write */
fat_seek, /* seek */
fat_ioctl, /* ioctl */
fat_opendir,
NULL,
fat_readdir,
fat_rewinddir,
fat_sync, /* sync */
fat_dup, /* dup */
fat_bind,
fat_unbind,
fat_statfs,
fat_opendir, /* opendir */
NULL, /* closedir */
fat_readdir, /* readdir */
fat_rewinddir, /* rewinddir */
fat_unlink,
fat_mkdir,
fat_rmdir,
fat_rename,
fat_stat
fat_bind, /* bind */
fat_unbind, /* unbind */
fat_statfs, /* statfs */
fat_unlink, /* unlinke */
fat_mkdir, /* mkdir */
fat_rmdir, /* rmdir */
fat_rename, /* rename */
fat_stat /* stat */
};
/****************************************************************************
@@ -311,7 +315,6 @@ static int fat_open(FAR struct file *filep, const char *relpath,
/* Initialize the file private data (only need to initialize non-zero elements) */
ff->ff_open = true;
ff->ff_oflags = oflags;
/* Save information that can be used later to recover the directory entry */
@@ -896,6 +899,7 @@ static off_t fat_seek(FAR struct file *filep, off_t offset, int whence)
DEBUGASSERT(fs != NULL);
/* Map the offset according to the whence option */
switch (whence)
{
case SEEK_SET: /* The offset is set to offset bytes. */
@@ -969,6 +973,7 @@ static off_t fat_seek(FAR struct file *filep, off_t offset, int whence)
ret = cluster;
goto errout_with_semaphore;
}
ff->ff_startcluster = cluster;
}
@@ -1230,6 +1235,124 @@ errout_with_semaphore:
return ret;
}
/****************************************************************************
* Name: fat_dup
*
* Description: Duplicate open file data in the new file structure.
*
****************************************************************************/
static int fat_dup(FAR const struct file *oldp, FAR struct file *newp)
{
FAR struct fat_mountpt_s *fs;
FAR struct fat_file_s *oldff;
FAR struct fat_file_s *newff;
int ret;
fvdbg("Dup %p->%p\n", oldp, newp);
/* Sanity checks */
DEBUGASSERT(oldp->f_priv != NULL &&
newp->f_priv == NULL &&
newp->f_inode != NULL);
/* Recover our private data from the struct file instance */
fs = (struct fat_mountpt_s *)oldp->f_inode->i_private;
DEBUGASSERT(fs != NULL);
/* Check if the mount is still healthy */
fat_semtake(fs);
ret = fat_checkmount(fs);
if (ret != OK)
{
goto errout_with_semaphore;
}
/* Recover the old private data from the old struct file instance */
oldff = oldp->f_priv;
/* Create a new instance of the file private date to describe the
* dup'ed file.
*/
newff = (struct fat_file_s *)kmalloc(sizeof(struct fat_file_s));
if (!newff)
{
ret = -ENOMEM;
goto errout_with_semaphore;
}
/* Create a file buffer to support partial sector accesses */
newff->ff_buffer = (uint8_t*)fat_io_alloc(fs->fs_hwsectorsize);
if (!newff->ff_buffer)
{
ret = -ENOMEM;
goto errout_with_struct;
}
/* Copy the rest of the open open file state from the old file structure.
* There are some assumptions and potential issues here:
*
* 1) We assume that the higher level logic has copied the elements of
* the file structure, in particular, the file position.
* 2) There is a problem with ff_size if there are multiple opened
* file structures, each believing they know the size of the file.
* If one instance modifies the file length, then the new size of
* the opened file will be unknown to the other. That is a lurking
* bug!
*
* One good solution to this might be to add a refernce count to the
* file structure. Then, instead of dup'ing the whole structure
* as is done here, just increment the reference count on the
* structure. The would have to be integrated with open logic as
* well, however, so that the same file structure is re-used if the
* file is re-opened.
*/
newff->ff_bflags = 0; /* File buffer flags */
newff->ff_oflags = oldff->ff_oflags; /* File open flags */
newff->ff_sectorsincluster = oldff->ff_sectorsincluster; /* Sectors remaining in cluster */
newff->ff_dirindex = oldff->ff_dirindex; /* Index to directory entry */
newff->ff_currentcluster = oldff->ff_currentcluster; /* Current cluster */
newff->ff_dirsector = oldff->ff_dirsector; /* Sector containing directory entry */
newff->ff_size = oldff->ff_size; /* Size of the file */
newff->ff_startcluster = oldff->ff_startcluster; /* Start cluster of file on media */
newff->ff_currentsector = oldff->ff_currentsector; /* Current sector */
newff->ff_cachesector = 0; /* Sector in file buffer */
/* Attach the private date to the struct file instance */
newp->f_priv = newff;
/* Then insert the new instance into the mountpoint structure.
* It needs to be there (1) to handle error conditions that effect
* all files, and (2) to inform the umount logic that we are busy
* (but a simple reference count could have done that).
*/
newff->ff_next = fs->fs_head;
fs->fs_head = newff->ff_next;
fat_semgive(fs);
return OK;
/* Error exits -- goto's are nasty things, but they sure can make error
* handling a lot simpler.
*/
errout_with_struct:
kfree(newff);
errout_with_semaphore:
fat_semgive(fs);
return ret;
}
/****************************************************************************
* Name: fat_opendir
*
-1
View File
@@ -752,7 +752,6 @@ struct fat_mountpt_s
struct fat_file_s
{
struct fat_file_s *ff_next; /* Retained in a singly linked list */
bool ff_open; /* true: The file is (still) open */
uint8_t ff_bflags; /* The file buffer flags */
uint8_t ff_oflags; /* Flags provided when file was opened */
uint8_t ff_sectorsincluster; /* Sectors remaining in cluster */
+1 -9
View File
@@ -692,8 +692,6 @@ int fat_checkmount(struct fat_mountpt_s *fs)
if (fs && fs->fs_mounted)
{
struct fat_file_s *file;
/* We still think the mount is healthy. Check an see if this is
* still the case
*/
@@ -715,14 +713,8 @@ int fat_checkmount(struct fat_mountpt_s *fs)
/* If we get here, the mount is NOT healthy */
fs->fs_mounted = false;
/* Make sure that this is flagged in every opened file */
for (file = fs->fs_head; file; file = file->ff_next)
{
file->ff_open = false;
}
}
return -ENODEV;
}
+4 -14
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/fs_files.c
*
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -284,14 +284,6 @@ int files_dup(FAR struct file *filep1, FAR struct file *filep2)
goto errout;
}
#ifndef CONFIG_DISABLE_MOUNTPOINT
if (INODE_IS_MOUNTPT(filep1->f_inode))
{
err = ENOSYS; /* Not yet supported */
goto errout;
}
#endif
list = sched_getfiles();
if (!list)
{
@@ -331,18 +323,16 @@ int files_dup(FAR struct file *filep1, FAR struct file *filep2)
if (inode->u.i_ops && inode->u.i_ops->open)
{
#ifndef CONFIG_DISABLE_MOUNTPOINT
#if 0 /* Not implemented */
if (INODE_IS_MOUNTPT(inode))
{
/* Open a file on the mountpoint */
/* Dup the open file on the in the new file structure */
ret = inode->u.i_mops->open(filep2, ?, filep2->f_oflags, ?);
ret = inode->u.i_mops->dup(filep1, filep2);
}
else
#endif
#endif
{
/* Open the pseudo file or device driver */
/* (Re-)open the pseudo file or device driver */
ret = inode->u.i_ops->open(filep2);
}
+7 -8
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/fs_mount.c
*
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -47,10 +47,6 @@
#include <nuttx/fs/fs.h>
#ifdef CONFIG_APPS_BINDIR
# include <apps/apps.h>
#endif
#include "fs_internal.h"
/* At least one filesystem must be defined, or this file will not compile.
@@ -78,7 +74,7 @@
/* These file systems do not require block drivers */
#if defined(CONFIG_FS_NXFFS) || defined(CONFIG_APPS_BINDIR) || defined(CONFIG_NFS)
#if defined(CONFIG_FS_NXFFS) || defined(CONFIG_FS_BINFS) || defined(CONFIG_NFS)
# define NONBDFS_SUPPORT
#endif
@@ -123,6 +119,9 @@ extern const struct mountpt_operations nxffs_operations;
#ifdef CONFIG_NFS
extern const struct mountpt_operations nfs_operations;
#endif
#ifdef CONFIG_FS_BINFS
extern const struct mountpt_operations binfs_operations;
#endif
static const struct fsmap_t g_nonbdfsmap[] =
{
@@ -132,7 +131,7 @@ static const struct fsmap_t g_nonbdfsmap[] =
#ifdef CONFIG_NFS
{ "nfs", &nfs_operations },
#endif
#ifdef CONFIG_APPS_BINDIR
#ifdef CONFIG_FS_BINFS
{ "binfs", &binfs_operations },
#endif
{ NULL, NULL },
@@ -222,7 +221,7 @@ int mount(FAR const char *source, FAR const char *target,
/* Find the specified filesystem. Try the block driver file systems first */
#ifdef BDFS_SUPPORT
if ((mops = mount_findfs(g_bdfsmap, filesystemtype)) != NULL)
if (source && (mops = mount_findfs(g_bdfsmap, filesystemtype)) != NULL)
{
/* Make sure that a block driver argument was provided */
+7 -2
View File
@@ -1,7 +1,7 @@
############################################################################
# fs/mmap/Make.defs
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -40,4 +40,9 @@ ifeq ($(CONFIG_FS_RAMMAP),y)
CSRCS += fs_munmap.c fs_rammap.c
endif
MMAPDEPPATH = --dep-path mmap
# Include MMAP build support
DEPPATH += --dep-path mmap
VPATH += :mmap
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)mmap}
+6 -3
View File
@@ -1,7 +1,7 @@
############################################################################
# Make.defs
#
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -44,7 +44,10 @@ CSRCS +=
ASRCS +=
CSRCS += rpc_clnt.c nfs_util.c nfs_vfsops.c
# Argument for dependency checking
# Include NFS build support
DEPPATH += --dep-path nfs
VPATH += :nfs
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)nfs}
NFSDEPPATH = --dep-path nfs
endif
+2 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/nfs/nfs_node.h
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved.
* Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com>
* Gregory Nutt <gnutt@nuttx.org>
@@ -70,6 +70,7 @@
struct nfsnode
{
struct nfsnode *n_next; /* Retained in a singly linked list. */
uint8_t n_crefs; /* Reference count (for nfs_dup) */
uint8_t n_type; /* File type */
uint8_t n_fhsize; /* Size in bytes of the file handle */
uint8_t n_flags; /* Node flags */
+1 -8
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/nfs/nfs_util.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -213,7 +213,6 @@ int nfs_request(struct nfsmount *nmp, int procnum,
{
struct rpcclnt *clnt = nmp->nm_rpcclnt;
struct nfs_reply_header replyh;
int trylater_delay;
int error;
tryagain:
@@ -250,12 +249,6 @@ tryagain:
if (error == EAGAIN)
{
error = 0;
trylater_delay *= NFS_TIMEOUTMUL;
if (trylater_delay > NFS_MAXTIMEO)
{
trylater_delay = NFS_MAXTIMEO;
}
goto tryagain;
}
+127 -36
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/nfs/nfs_vfsops.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved.
* Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com>
* Gregory Nutt <gnutt@nuttx.org>
@@ -133,6 +133,7 @@ static int nfs_close(FAR struct file *filep);
static ssize_t nfs_read(FAR struct file *filep, char *buffer, size_t buflen);
static ssize_t nfs_write(FAR struct file *filep, const char *buffer,
size_t buflen);
static int nfs_dup(FAR const struct file *oldp, FAR struct file *newp);
static int nfs_opendir(struct inode *mountpt, const char *relpath,
struct fs_dirent_s *dir);
static int nfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir);
@@ -166,7 +167,9 @@ const struct mountpt_operations nfs_operations =
nfs_write, /* write */
NULL, /* seek */
NULL, /* ioctl */
NULL, /* sync */
nfs_dup, /* dup */
nfs_opendir, /* opendir */
NULL, /* closedir */
@@ -357,7 +360,7 @@ static int nfs_filecreate(FAR struct nfsmount *nmp, struct nfsnode *np,
/* Save the attributes in the file data structure */
tmp = *ptr++; /* handle_follows */
tmp = *ptr; /* handle_follows */
if (!tmp)
{
fdbg("WARNING: no file attributes\n");
@@ -367,7 +370,6 @@ static int nfs_filecreate(FAR struct nfsmount *nmp, struct nfsnode *np,
/* Initialize the file attributes */
nfs_attrupdate(np, (FAR struct nfs_fattr *)ptr);
ptr += uint32_increment(sizeof(struct nfs_fattr));
}
/* Any following dir_wcc data is ignored for now */
@@ -410,7 +412,7 @@ static int nfs_filetruncate(FAR struct nfsmount *nmp, struct nfsnode *np)
reqlen += (int)np->n_fhsize;
ptr += uint32_increment(np->n_fhsize);
/* Copy the variable-length attribtes */
/* Copy the variable-length attributes */
*ptr++ = nfs_false; /* Don't change mode */
*ptr++ = nfs_false; /* Don't change uid */
@@ -421,7 +423,7 @@ static int nfs_filetruncate(FAR struct nfsmount *nmp, struct nfsnode *np)
*ptr++ = HTONL(NFSV3SATTRTIME_TOSERVER); /* Use the server's time */
*ptr++ = HTONL(NFSV3SATTRTIME_TOSERVER); /* Use the server's time */
*ptr++ = nfs_false; /* No guard value */
reqlen += 9*sizeof(uint32_t)
reqlen += 9 * sizeof(uint32_t);
/* Perform the SETATTR RPC */
@@ -551,9 +553,9 @@ static int nfs_fileopen(FAR struct nfsmount *nmp, struct nfsnode *np,
static int nfs_open(FAR struct file *filep, FAR const char *relpath,
int oflags, mode_t mode)
{
struct nfsmount *nmp;
struct nfsnode *np = NULL;
int error;
struct nfsmount *nmp;
struct nfsnode *np;
int error;
/* Sanity checks */
@@ -632,6 +634,8 @@ static int nfs_open(FAR struct file *filep, FAR const char *relpath,
* non-zero elements)
*/
np->n_crefs = 1;
/* Attach the private data to the struct file instance */
filep->f_priv = np;
@@ -654,6 +658,7 @@ errout_with_semaphore:
{
kfree(np);
}
nfs_semgive(nmp);
return -error;
}
@@ -675,6 +680,7 @@ static int nfs_close(FAR struct file *filep)
FAR struct nfsnode *np;
FAR struct nfsnode *prev;
FAR struct nfsnode *curr;
int ret;
/* Sanity checks */
@@ -691,42 +697,64 @@ static int nfs_close(FAR struct file *filep)
nfs_semtake(nmp);
/* Find our file structure in the list of file structures containted in the
* mount structure.
/* Decrement the reference count. If the reference count would not
* decrement to zero, then that is all we have to do.
*/
for (prev = NULL, curr = nmp->nm_head; curr; prev = curr, curr = curr->n_next)
{
/* Check if this node is ours */
if (np->n_crefs > 1)
{
np->n_crefs--;
ret = OK;
}
if (np == curr)
{
/* Yes.. remove it from the list of file structures */
/* There are no more references to the file structure. Now we need to
* free up all resources associated with the open file.
*
* First, find our file structure in the list of file structures
* containted in the mount structure.
*/
if (prev)
{
/* Remove from mid-list */
else
{
/* Assume file structure will not be found. This should never happen. */
prev->n_next = np->n_next;
}
else
{
/* Remove from the head of the list */
ret = -EINVAL;
nmp->nm_head = np->n_next;
}
for (prev = NULL, curr = nmp->nm_head;
curr;
prev = curr, curr = curr->n_next)
{
/* Check if this node is ours */
/* Then deallocate the file structure and return success */
if (np == curr)
{
/* Yes.. remove it from the list of file structures */
kfree(np);
nfs_semgive(nmp);
return OK;
}
}
if (prev)
{
/* Remove from mid-list */
fdbg("ERROR: file structure not found in list: %p\n", np);
prev->n_next = np->n_next;
}
else
{
/* Remove from the head of the list */
nmp->nm_head = np->n_next;
}
/* Then deallocate the file structure and return success */
kfree(np);
ret = OK;
break;
}
}
}
filep->f_priv = NULL;
nfs_semgive(nmp);
return EINVAL;
return ret;
}
/****************************************************************************
@@ -757,8 +785,8 @@ static ssize_t nfs_read(FAR struct file *filep, char *buffer, size_t buflen)
/* Recover our private data from the struct file instance */
nmp = (struct nfsmount*) filep->f_inode->i_private;
np = (struct nfsnode*) filep->f_priv;
nmp = (struct nfsmount*)filep->f_inode->i_private;
np = (struct nfsnode*)filep->f_priv;
DEBUGASSERT(nmp != NULL);
@@ -1091,6 +1119,66 @@ errout_with_semaphore:
return -error;
}
/****************************************************************************
* Name: binfs_dup
*
* Description:
* Duplicate open file data in the new file structure.
*
****************************************************************************/
static int nfs_dup(FAR const struct file *oldp, FAR struct file *newp)
{
struct nfsmount *nmp;
FAR struct nfsnode *np;
int error;
fvdbg("Dup %p->%p\n", oldp, newp);
/* Sanity checks */
DEBUGASSERT(oldp->f_priv != NULL && oldp->f_inode != NULL);
/* Recover our private data from the struct file instance */
nmp = (struct nfsmount*)oldp->f_inode->i_private;
np = (struct nfsnode*)oldp->f_priv;
DEBUGASSERT(nmp != NULL);
/* Check if the mount is still healthy */
nfs_semtake(nmp);
error = nfs_checkmount(nmp);
if (error != OK)
{
fdbg("ERROR: nfs_checkmount failed: %d\n", error);
nfs_semgive(nmp);
return -error;
}
/* Increment the reference count on the NFS node structure */
DEBUGASSERT(np->n_crefs < 0xff);
np->n_crefs++;
/* And save this as the file data for the new node */
newp->f_priv = np;
/* Then insert the new instance at the head of the list in the mountpoint
* tructure. It needs to be there (1) to handle error conditions that effect
* all files, and (2) to inform the umount logic that we are busy. We
* cannot unmount the file system if this list is not empty!
*/
np->n_next = nmp->nm_head;
nmp->nm_head = np;
nfs_semgive(nmp);
return OK;
}
/****************************************************************************
* Name: nfs_opendir
*
@@ -1754,12 +1842,15 @@ bad:
{
kfree(nmp->nm_so);
}
if (nmp->nm_rpcclnt)
{
kfree(nmp->nm_rpcclnt);
}
kfree(nmp);
}
return error;
}
+13 -15
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/nfs/rpc_clnt.c
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved.
* Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com>
* Gregory Nutt <gnutt@nuttx.org>
@@ -224,8 +224,6 @@ static int rpcclnt_receive(FAR struct rpcclnt *rpc, FAR struct sockaddr *aname,
static int rpcclnt_reply(FAR struct rpcclnt *rpc, int procid, int prog,
FAR void *reply, size_t resplen)
{
FAR struct rpc_reply_header *replyheader;
uint32_t rxid;
int error;
/* Get the next RPC reply from the socket */
@@ -235,22 +233,22 @@ static int rpcclnt_reply(FAR struct rpcclnt *rpc, int procid, int prog,
{
fdbg("ERROR: rpcclnt_receive returned: %d\n", error);
/* If we failed because of a timeout, then try sending the CALL
* message again.
*/
/* If we failed because of a timeout, then try sending the CALL
* message again.
*/
if (error == EAGAIN || error == ETIMEDOUT)
{
rpc->rc_timeout = true;
}
}
if (error == EAGAIN || error == ETIMEDOUT)
{
rpc->rc_timeout = true;
}
}
/* Get the xid and check that it is an RPC replysvr */
else
{
replyheader = (FAR struct rpc_reply_header *)reply;
rxid = replyheader->rp_xid;
FAR struct rpc_reply_header *replyheader =
(FAR struct rpc_reply_header *)reply;
if (replyheader->rp_direction != rpc_reply)
{
@@ -260,7 +258,7 @@ static int rpcclnt_reply(FAR struct rpcclnt *rpc, int procid, int prog,
}
}
return OK;
return error;
}
/****************************************************************************
@@ -275,7 +273,6 @@ static uint32_t rpcclnt_newxid(void)
{
static uint32_t rpcclnt_xid = 0;
static uint32_t rpcclnt_xid_touched = 0;
int xidp = 0;
srand(time(NULL));
if ((rpcclnt_xid == 0) && (rpcclnt_xid_touched == 0))
@@ -285,6 +282,7 @@ static uint32_t rpcclnt_newxid(void)
}
else
{
int xidp = 0;
do
{
xidp = rand();
+6 -3
View File
@@ -1,7 +1,7 @@
############################################################################
# fs/nxffs/Make.defs
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,10 @@ CSRCS += nxffs_block.c nxffs_blockstats.c nxffs_cache.c nxffs_dirent.c \
nxffs_open.c nxffs_pack.c nxffs_read.c nxffs_reformat.c \
nxffs_stat.c nxffs_unlink.c nxffs_util.c nxffs_write.c
# Argument for dependency checking
# Include NXFFS build support
DEPPATH += --dep-path nxffs
VPATH += :nxffs
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)nxffs}
NXFFSDEPPATH = --dep-path nxffs
endif
+21 -20
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/nxffs/nxffs.h
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References: Linux/Documentation/filesystems/romfs.txt
@@ -1044,6 +1044,7 @@ extern int nxffs_pack(FAR struct nxffs_volume_s *volume);
* - nxffs_read() is defined in nxffs_read.c
* - nxffs_write() is defined in nxffs_write.c
* - nxffs_ioctl() is defined in nxffs_ioctl.c
* - nxffs_dup() is defined in nxffs_open.c
* - nxffs_opendir(), nxffs_readdir(), and nxffs_rewindir() are defined in
* nxffs_dirent.c
* - nxffs_bind() and nxffs_unbind() are defined in nxffs_initialize.c
@@ -1058,25 +1059,25 @@ struct fs_dirent_s;
struct statfs;
struct stat;
extern int nxffs_open(FAR struct file *filep, FAR const char *relpath,
int oflags, mode_t mode);
extern int nxffs_close(FAR struct file *filep);
extern ssize_t nxffs_read(FAR struct file *filep, FAR char *buffer,
size_t buflen);
extern ssize_t nxffs_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
extern int nxffs_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
extern int nxffs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct fs_dirent_s *dir);
extern int nxffs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
extern int nxffs_rewinddir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
extern int nxffs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle);
extern int nxffs_unbind(FAR void *handle, FAR struct inode **blkdriver);
extern int nxffs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf);
extern int nxffs_stat(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct stat *buf);
extern int nxffs_unlink(FAR struct inode *mountpt, FAR const char *relpath);
int nxffs_open(FAR struct file *filep, FAR const char *relpath, int oflags,
mode_t mode);
int nxffs_close(FAR struct file *filep);
ssize_t nxffs_read(FAR struct file *filep, FAR char *buffer, size_t buflen);
ssize_t nxffs_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
int nxffs_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
int nxffs_dup(FAR const struct file *oldp, FAR struct file *newp);
int nxffs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct fs_dirent_s *dir);
int nxffs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
int nxffs_rewinddir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
int nxffs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle);
int nxffs_unbind(FAR void *handle, FAR struct inode **blkdriver);
int nxffs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf);
int nxffs_stat(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct stat *buf);
int nxffs_unlink(FAR struct inode *mountpt, FAR const char *relpath);
#endif /* __FS_NXFFS_NXFFS_H */
+3 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/nxffs/nxffs_initialize.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References: Linux/Documentation/filesystems/romfs.txt
@@ -82,7 +82,9 @@ const struct mountpt_operations nxffs_operations =
nxffs_write, /* write */
NULL, /* seek -- Use f_pos in struct file */
nxffs_ioctl, /* ioctl */
NULL, /* sync -- No buffered data */
nxffs_dup, /* dup */
nxffs_opendir, /* opendir */
NULL, /* closedir */
+62 -3
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/nxffs/nxffs_open.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References: Linux/Documentation/filesystems/romfs.txt
@@ -1023,7 +1023,7 @@ int nxffs_open(FAR struct file *filep, FAR const char *relpath,
#endif
/* Limitation: A file must be opened for reading or writing, but not both.
* There is no general for extending the size of of a file. Extending the
* There is no general way of extending the size of a file. Extending the
* file size of possible if the file to be extended is the last in the
* sequence on FLASH, but since that case is not the general case, no file
* extension is supported.
@@ -1058,6 +1058,64 @@ int nxffs_open(FAR struct file *filep, FAR const char *relpath,
return ret;
}
/****************************************************************************
* Name: binfs_dup
*
* Description:
* Duplicate open file data in the new file structure.
*
****************************************************************************/
int nxffs_dup(FAR const struct file *oldp, FAR struct file *newp)
{
#ifdef CONFIG_DEBUG
FAR struct nxffs_volume_s *volume;
#endif
FAR struct nxffs_ofile_s *ofile;
fvdbg("Dup %p->%p\n", oldp, newp);
/* Sanity checks */
#ifdef CONFIG_DEBUG
DEBUGASSERT(oldp->f_priv == NULL && oldp->f_inode != NULL);
/* Get the mountpoint private data from the NuttX inode reference in the
* file structure
*/
volume = (FAR struct nxffs_volume_s*)oldp->f_inode->i_private;
DEBUGASSERT(volume != NULL);
#endif
/* Recover the open file state from the struct file instance */
ofile = (FAR struct nxffs_ofile_s *)oldp->f_priv;
/* I do not think we need exclusive access to the volume to do this.
* The volume exclsem protects the open file list and, hence, would
* assure that the ofile is stable. However, it is assumed that the
* caller holds a value file descriptor associated with this ofile,
* so it should be stable throughout the life of this function.
*/
/* Limitations: I do not think we have to be concerned about the
* usual NXFFS file limitations here: dup'ing cannot resulting
* in mixed reading and writing to the same file, or multiple
* writer to different file.
*
* I notice that nxffs_wropen will prohibit multiple opens for
* writing. But I do not thing that dup'ing a file already opened
* for writing suffers from any of these issues.
*/
/* Just increment the reference count on the ofile */
ofile->crefs++;
newp->f_priv = (FAR void *)ofile;
return OK;
}
/****************************************************************************
* Name: nxffs_close
*
@@ -1130,9 +1188,10 @@ int nxffs_close(FAR struct file *filep)
ofile->crefs--;
}
filep->f_priv = NULL;
filep->f_priv = NULL;
sem_post(&volume->exclsem);
errout:
return ret;
}
+6 -3
View File
@@ -1,7 +1,7 @@
############################################################################
# fs/romfs/Make.defs
#
# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
# Copyright (C) 2008, 2011, 2013 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
@@ -39,7 +39,10 @@ ifeq ($(CONFIG_FS_ROMFS),y)
ASRCS +=
CSRCS += fs_romfs.c fs_romfsutil.c
# Argument for dependency checking
# Include ROMFS build support
DEPPATH += --dep-path romfs
VPATH += :romfs
CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)romfs}
ROMFSDEPPATH = --dep-path romfs
endif
+181 -77
View File
@@ -56,6 +56,7 @@
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/fs/dirent.h>
@@ -70,24 +71,33 @@
* Private Function Prototypes
****************************************************************************/
static int romfs_open(FAR struct file *filep, const char *relpath,
static int romfs_open(FAR struct file *filep, FAR const char *relpath,
int oflags, mode_t mode);
static int romfs_close(FAR struct file *filep);
static ssize_t romfs_read(FAR struct file *filep, char *buffer, size_t buflen);
static ssize_t romfs_read(FAR struct file *filep, FAR char *buffer,
size_t buflen);
static off_t romfs_seek(FAR struct file *filep, off_t offset, int whence);
static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int romfs_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
static int romfs_opendir(struct inode *mountpt, const char *relpath,
struct fs_dirent_s *dir);
static int romfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir);
static int romfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir);
static int romfs_dup(FAR const struct file *oldp, FAR struct file *newp);
static int romfs_bind(FAR struct inode *blkdriver, const void *data,
void **handle);
static int romfs_unbind(void *handle, FAR struct inode **blkdriver);
static int romfs_statfs(struct inode *mountpt, struct statfs *buf);
static int romfs_opendir(FAR struct inode *mountpt,
FAR const char *relpath,
FAR struct fs_dirent_s *dir);
static int romfs_readdir(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir);
static int romfs_rewinddir(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir);
static int romfs_stat(struct inode *mountpt, const char *relpath, struct stat *buf);
static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle);
static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver);
static int romfs_statfs(FAR struct inode *mountpt,
FAR struct statfs *buf);
static int romfs_stat(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct stat *buf);
/****************************************************************************
* Private Variables
@@ -110,7 +120,9 @@ const struct mountpt_operations romfs_operations =
NULL, /* write */
romfs_seek, /* seek */
romfs_ioctl, /* ioctl */
NULL, /* sync */
romfs_dup, /* dup */
romfs_opendir, /* opendir */
NULL, /* closedir */
@@ -136,13 +148,13 @@ const struct mountpt_operations romfs_operations =
* Name: romfs_open
****************************************************************************/
static int romfs_open(FAR struct file *filep, const char *relpath,
int oflags, mode_t mode)
static int romfs_open(FAR struct file *filep, FAR const char *relpath,
int oflags, mode_t mode)
{
struct romfs_dirinfo_s dirinfo;
struct romfs_mountpt_s *rm;
struct romfs_file_s *rf;
int ret;
struct romfs_dirinfo_s dirinfo;
FAR struct romfs_mountpt_s *rm;
FAR struct romfs_file_s *rf;
int ret;
fvdbg("Open '%s'\n", relpath);
@@ -150,11 +162,11 @@ static int romfs_open(FAR struct file *filep, const char *relpath,
DEBUGASSERT(filep->f_priv == NULL && filep->f_inode != NULL);
/* mountpoint private data from the inode reference from the file
/* Get mountpoint private data from the inode reference from the file
* structure
*/
rm = (struct romfs_mountpt_s*)filep->f_inode->i_private;
rm = (FAR struct romfs_mountpt_s*)filep->f_inode->i_private;
DEBUGASSERT(rm != NULL);
@@ -214,7 +226,7 @@ static int romfs_open(FAR struct file *filep, const char *relpath,
* file.
*/
rf = (struct romfs_file_s *)zalloc(sizeof(struct romfs_file_s));
rf = (FAR struct romfs_file_s *)kzalloc(sizeof(struct romfs_file_s));
if (!rf)
{
fdbg("Failed to allocate private data\n", ret);
@@ -226,8 +238,7 @@ static int romfs_open(FAR struct file *filep, const char *relpath,
* non-zero elements)
*/
rf->rf_open = true;
rf->rf_size = dirinfo.rd_size;
rf->rf_size = dirinfo.rd_size;
/* Get the start of the file data */
@@ -277,9 +288,9 @@ errout_with_semaphore:
static int romfs_close(FAR struct file *filep)
{
struct romfs_mountpt_s *rm;
struct romfs_file_s *rf;
int ret = OK;
FAR struct romfs_mountpt_s *rm;
FAR struct romfs_file_s *rf;
int ret = OK;
fvdbg("Closing\n");
@@ -307,12 +318,12 @@ static int romfs_close(FAR struct file *filep)
if (!rm->rm_xipbase && rf->rf_buffer)
{
free(rf->rf_buffer);
kfree(rf->rf_buffer);
}
/* Then free the file structure itself. */
free(rf);
kfree(rf);
filep->f_priv = NULL;
return ret;
}
@@ -321,19 +332,20 @@ static int romfs_close(FAR struct file *filep)
* Name: romfs_read
****************************************************************************/
static ssize_t romfs_read(FAR struct file *filep, char *buffer, size_t buflen)
static ssize_t romfs_read(FAR struct file *filep, FAR char *buffer,
size_t buflen)
{
struct romfs_mountpt_s *rm;
struct romfs_file_s *rf;
unsigned int bytesread;
unsigned int readsize;
unsigned int nsectors;
uint32_t offset;
size_t bytesleft;
off_t sector;
uint8_t *userbuffer = (uint8_t*)buffer;
int sectorndx;
int ret;
FAR struct romfs_mountpt_s *rm;
FAR struct romfs_file_s *rf;
unsigned int bytesread;
unsigned int readsize;
unsigned int nsectors;
uint32_t offset;
size_t bytesleft;
off_t sector;
FAR uint8_t *userbuffer = (FAR uint8_t*)buffer;
int sectorndx;
int ret;
fvdbg("Read %d bytes from offset %d\n", buflen, filep->f_pos);
@@ -467,10 +479,10 @@ errout_with_semaphore:
static off_t romfs_seek(FAR struct file *filep, off_t offset, int whence)
{
struct romfs_mountpt_s *rm;
struct romfs_file_s *rf;
off_t position;
int ret;
FAR struct romfs_mountpt_s *rm;
FAR struct romfs_file_s *rf;
off_t position;
int ret;
fvdbg("Seek to offset: %d whence: %d\n", offset, whence);
@@ -548,9 +560,9 @@ errout_with_semaphore:
static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
struct romfs_mountpt_s *rm;
struct romfs_file_s *rf;
FAR void **ppv = (FAR void**)arg;
FAR struct romfs_mountpt_s *rm;
FAR struct romfs_file_s *rf;
FAR void **ppv = (FAR void**)arg;
fvdbg("cmd: %d arg: %08lx\n", cmd, arg);
@@ -581,6 +593,95 @@ static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
return -ENOTTY;
}
/****************************************************************************
* Name: romfs_dup
****************************************************************************/
static int romfs_dup(FAR const struct file *oldp, FAR struct file *newp)
{
FAR struct romfs_mountpt_s *rm;
FAR struct romfs_file_s *oldrf;
FAR struct romfs_file_s *newrf;
int ret;
fvdbg("Dup %p->%p\n", oldp, newp);
/* Sanity checks */
DEBUGASSERT(oldp->f_priv != NULL &&
newp->f_priv == NULL &&
newp->f_inode != NULL);
/* Get mountpoint private data from the inode reference from the file
* structure
*/
rm = (FAR struct romfs_mountpt_s*)newp->f_inode->i_private;
DEBUGASSERT(rm != NULL);
/* Check if the mount is still healthy */
romfs_semtake(rm);
ret = romfs_checkmount(rm);
if (ret != OK)
{
fdbg("romfs_checkmount failed: %d\n", ret);
goto errout_with_semaphore;
}
/* Recover the old private data from the old struct file instance */
oldrf = oldp->f_priv;
/* Create an new instance of the file private data to describe the new
* dup'ed file.
*/
newrf = (FAR struct romfs_file_s *)kmalloc(sizeof(struct romfs_file_s));
if (!newrf)
{
fdbg("Failed to allocate private data\n", ret);
ret = -ENOMEM;
goto errout_with_semaphore;
}
/* Copy all file private data (except for the buffer) */
newrf->rf_startoffset = oldrf->rf_startoffset;
newrf->rf_size = oldrf->rf_size;
/* Configure buffering to support access to this file */
ret = romfs_fileconfigure(rm, newrf);
if (ret < 0)
{
fdbg("Failed configure buffering: %d\n", ret);
goto errout_with_semaphore;
}
/* Attach the new private date to the new struct file instance */
newp->f_priv = newrf;
/* Then insert the new instance into the mountpoint structure.
* It needs to be there (1) to handle error conditions that effect
* all files, and (2) to inform the umount logic that we are busy
* (but a simple reference count could have done that).
*/
newrf->rf_next = rm->rm_head;
rm->rm_head = newrf->rf_next;
romfs_semgive(rm);
return OK;
/* Error exits */
errout_with_semaphore:
romfs_semgive(rm);
return ret;
}
/****************************************************************************
* Name: romfs_opendir
*
@@ -589,12 +690,12 @@ static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
*
****************************************************************************/
static int romfs_opendir(struct inode *mountpt, const char *relpath,
struct fs_dirent_s *dir)
static int romfs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct fs_dirent_s *dir)
{
struct romfs_mountpt_s *rm;
struct romfs_dirinfo_s dirinfo;
int ret;
FAR struct romfs_mountpt_s *rm;
FAR struct romfs_dirinfo_s dirinfo;
int ret;
fvdbg("relpath: '%s'\n", relpath);
@@ -654,14 +755,15 @@ errout_with_semaphore:
*
****************************************************************************/
static int romfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
static int romfs_readdir(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir)
{
struct romfs_mountpt_s *rm;
uint32_t linkoffset;
uint32_t next;
uint32_t info;
uint32_t size;
int ret;
FAR struct romfs_mountpt_s *rm;
uint32_t linkoffset;
uint32_t next;
uint32_t info;
uint32_t size;
int ret;
fvdbg("Entry\n");
@@ -749,9 +851,10 @@ errout_with_semaphore:
*
****************************************************************************/
static int romfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir)
static int romfs_rewinddir(FAR struct inode *mountpt,
FAR struct fs_dirent_s *dir)
{
struct romfs_mountpt_s *rm;
FAR struct romfs_mountpt_s *rm;
int ret;
fvdbg("Entry\n");
@@ -788,8 +891,8 @@ static int romfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir)
*
****************************************************************************/
static int romfs_bind(FAR struct inode *blkdriver, const void *data,
void **handle)
static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle)
{
struct romfs_mountpt_s *rm;
int ret;
@@ -813,7 +916,7 @@ static int romfs_bind(FAR struct inode *blkdriver, const void *data,
/* Create an instance of the mountpt state structure */
rm = (struct romfs_mountpt_s *)zalloc(sizeof(struct romfs_mountpt_s));
rm = (FAR struct romfs_mountpt_s *)kzalloc(sizeof(struct romfs_mountpt_s));
if (!rm)
{
fdbg("Failed to allocate mountpoint structure\n");
@@ -857,12 +960,12 @@ static int romfs_bind(FAR struct inode *blkdriver, const void *data,
errout_with_buffer:
if (!rm->rm_xipbase)
{
free(rm->rm_buffer);
kfree(rm->rm_buffer);
}
errout_with_sem:
sem_destroy(&rm->rm_sem);
free(rm);
kfree(rm);
return ret;
}
@@ -874,9 +977,9 @@ errout_with_sem:
*
****************************************************************************/
static int romfs_unbind(void *handle, FAR struct inode **blkdriver)
static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver)
{
struct romfs_mountpt_s *rm = (struct romfs_mountpt_s*)handle;
FAR struct romfs_mountpt_s *rm = (FAR struct romfs_mountpt_s*)handle;
int ret;
fvdbg("Entry\n");
@@ -929,11 +1032,11 @@ static int romfs_unbind(void *handle, FAR struct inode **blkdriver)
if (!rm->rm_xipbase && rm->rm_buffer)
{
free(rm->rm_buffer);
kfree(rm->rm_buffer);
}
sem_destroy(&rm->rm_sem);
free(rm);
kfree(rm);
return OK;
}
@@ -948,10 +1051,10 @@ static int romfs_unbind(void *handle, FAR struct inode **blkdriver)
*
****************************************************************************/
static int romfs_statfs(struct inode *mountpt, struct statfs *buf)
static int romfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf)
{
struct romfs_mountpt_s *rm;
int ret;
FAR struct romfs_mountpt_s *rm;
int ret;
fvdbg("Entry\n");
@@ -1004,11 +1107,12 @@ errout_with_semaphore:
*
****************************************************************************/
static int romfs_stat(struct inode *mountpt, const char *relpath, struct stat *buf)
static int romfs_stat(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct stat *buf)
{
struct romfs_mountpt_s *rm;
struct romfs_dirinfo_s dirinfo;
int ret;
FAR struct romfs_mountpt_s *rm;
FAR struct romfs_dirinfo_s dirinfo;
int ret;
fvdbg("Entry\n");
-1
View File
@@ -159,7 +159,6 @@ struct romfs_mountpt_s
struct romfs_file_s
{
struct romfs_file_s *rf_next; /* Retained in a singly linked list */
bool rf_open; /* true: The file is (still) open */
uint32_t rf_startoffset; /* Offset to the start of the file data */
uint32_t rf_size; /* Size of the file in bytes */
uint32_t rf_cachesector; /* Current sector in the rf_buffer */
+3 -9
View File
@@ -613,7 +613,7 @@ int romfs_fsconfigure(struct romfs_mountpt_s *rm)
}
/****************************************************************************
* Name: romfs_ffileconfigure
* Name: romfs_fileconfigure
*
* Desciption:
* This function is called as part of the ROMFS file open operation It
@@ -649,6 +649,7 @@ int romfs_fileconfigure(struct romfs_mountpt_s *rm, struct romfs_file_s *rf)
return -ENOMEM;
}
}
return OK;
}
@@ -663,7 +664,6 @@ int romfs_fileconfigure(struct romfs_mountpt_s *rm, struct romfs_file_s *rf)
int romfs_checkmount(struct romfs_mountpt_s *rm)
{
struct romfs_file_s *file;
struct inode *inode;
struct geometry geo;
int ret;
@@ -692,14 +692,8 @@ int romfs_checkmount(struct romfs_mountpt_s *rm)
/* If we get here, the mount is NOT healthy */
rm->rm_mounted = false;
/* Make sure that this is flagged in every opened file */
for (file = rm->rm_head; file; file = file->rf_next)
{
file->rf_open = false;
}
}
return -ENODEV;
}
+6
View File
@@ -178,6 +178,12 @@ config NXFONTS_CHARBITS
The number of bits in the character set. Current options are only 7 and 8.
The default is 7.
config NXFONT_MONO5X8
bool "Mono 5x8"
default n
---help---
Tiny mono-spaced 5x8 font (font ID FONTID_MONO5X8 = 18)
config NXFONT_SANS17X22
bool "Sans 17x22"
default n
+3
View File
@@ -124,6 +124,9 @@ gen32bppsources:
$(Q) $(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_BITSPERPIXEL=32 EXTRADEFINES=$(EXTRADEFINES)
genfontsources:
ifeq ($(CONFIG_NXFONT_MONO5X8),y)
@$(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=18 EXTRADEFINES=$(EXTRADEFINES)
endif
ifeq ($(CONFIG_NXFONT_SANS23X27),y)
$(Q) $(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=1 EXTRADEFINES=$(EXTRADEFINES)
endif
+6
View File
@@ -42,6 +42,12 @@ NXFCONV_CSRCS = nxfonts_convert_1bpp.c nxfonts_convert_2bpp.c \
NXFSET_ASRCS =
NXFSET_CSRCS =
# Monospace fonts
ifeq ($(CONFIG_NXFONT_MONO5X8),y)
NXFSET_CSRCS += nxfonts_bitmaps_mono5x8.c
endif
# Sans serif fonts
ifeq ($(CONFIG_NXFONT_SANS17X22),y)
+7
View File
@@ -72,6 +72,13 @@ endif
ifdef NXFONTS_FONTID
# MONO
ifeq ($(NXFONTS_FONTID),18)
NXFONTS_PREFIX := g_mono5x8_
GEN_CSRC = nxfonts_bitmaps_mono5x8.c
endif
# SANS
ifeq ($(NXFONTS_FONTID),14)
+2
View File
@@ -80,6 +80,8 @@
# include "nxfonts_sans17x23b.h"
#elif NXFONTS_FONTID == 17
# include "nxfonts_sans20x27b.h"
#elif NXFONTS_FONTID == 18
# include "nxfonts_mono5x8.h"
#else
# error "No font ID specified"
#endif
+12
View File
@@ -60,6 +60,12 @@
* Private Data
****************************************************************************/
/* MONO */
#ifdef CONFIG_NXFONT_MONO5X8
extern const struct nx_fontpackage_s g_mono5x8_package;
#endif
/* SANS */
#ifdef CONFIG_NXFONT_SANS17X22
@@ -139,6 +145,12 @@ extern const struct nx_fontpackage_s g_serif38x49b_package;
static FAR const struct nx_fontpackage_s *g_fontpackages[] =
{
/* MONO */
#ifdef CONFIG_NXFONT_MONO5X8
&g_mono5x8_package,
#endif
/* SANS */
#ifdef CONFIG_NXFONT_SANS17X22
+815
View File
@@ -0,0 +1,815 @@
/****************************************************************************
* graphics/nxfonts/nxfonts_mono5x8.h
*
* Copyright (C) 2011-2012 NX Engineering, S.A., All rights reserved.
* Author: Petteri Aimonen <jpa@nx.mail.kapsi.fi>
*
* Based on 5x8.pcf.gz from xfonts-base. The file is marked as
* COPYRIGHT "Public domain font. Share and enjoy."
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT}
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING}
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __GRAPHICS_NXFONTS_NXFONTS_MONO5X8_H
#define __GRAPHICS_NXFONTS_NXFONTS_MONO5X8_H
#define NXFONT_ID FONTID_MONO5X8
#define NXFONT_MIN7BIT 33
#define NXFONT_MAX7BIT 126
#define NXFONT_MIN8BIT 161
#define NXFONT_MAX8BIT 255
/* Maximum height and width of any glyph in the set */
#define NXFONT_MAXHEIGHT 8
#define NXFONT_MAXWIDTH 5
/* The width of a space */
#define NXFONT_SPACEWIDTH 5
/* exclam (33) */
#define NXFONT_METRICS_33 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_33 {0x0, 0x20, 0x20, 0x20, 0x20, 0x0, 0x20, 0x0}
/* quotedbl (34) */
#define NXFONT_METRICS_34 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_34 {0x0, 0x50, 0x50, 0x50, 0x0, 0x0, 0x0, 0x0}
/* numbersign (35) */
#define NXFONT_METRICS_35 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_35 {0x50, 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x50, 0x0}
/* dollar (36) */
#define NXFONT_METRICS_36 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_36 {0x20, 0x70, 0xa0, 0x70, 0x28, 0x70, 0x20, 0x0}
/* percent (37) */
#define NXFONT_METRICS_37 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_37 {0x0, 0x40, 0x50, 0x20, 0x50, 0x10, 0x0, 0x0}
/* ampersand (38) */
#define NXFONT_METRICS_38 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_38 {0x40, 0xa0, 0xa0, 0x40, 0xa0, 0xa0, 0x50, 0x0}
/* quotesingle (39) */
#define NXFONT_METRICS_39 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_39 {0x0, 0x20, 0x20, 0x20, 0x0, 0x0, 0x0, 0x0}
/* parenleft (40) */
#define NXFONT_METRICS_40 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_40 {0x0, 0x20, 0x40, 0x40, 0x40, 0x40, 0x20, 0x0}
/* parenright (41) */
#define NXFONT_METRICS_41 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_41 {0x0, 0x40, 0x20, 0x20, 0x20, 0x20, 0x40, 0x0}
/* asterisk (42) */
#define NXFONT_METRICS_42 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_42 {0x0, 0x0, 0x90, 0x60, 0xf0, 0x60, 0x90, 0x0}
/* plus (43) */
#define NXFONT_METRICS_43 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_43 {0x0, 0x0, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x0}
/* comma (44) */
#define NXFONT_METRICS_44 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_44 {0x0, 0x0, 0x0, 0x0, 0x0, 0x30, 0x20, 0x40}
/* hyphen (45) */
#define NXFONT_METRICS_45 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_45 {0x0, 0x0, 0x0, 0x0, 0xf0, 0x0, 0x0, 0x0}
/* period (46) */
#define NXFONT_METRICS_46 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_46 {0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x70, 0x20}
/* slash (47) */
#define NXFONT_METRICS_47 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_47 {0x0, 0x10, 0x10, 0x20, 0x40, 0x80, 0x80, 0x0}
/* zero (48) */
#define NXFONT_METRICS_48 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_48 {0x0, 0x20, 0x50, 0x50, 0x50, 0x50, 0x20, 0x0}
/* one (49) */
#define NXFONT_METRICS_49 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_49 {0x0, 0x20, 0x60, 0x20, 0x20, 0x20, 0x70, 0x0}
/* two (50) */
#define NXFONT_METRICS_50 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_50 {0x0, 0x60, 0x90, 0x10, 0x60, 0x80, 0xf0, 0x0}
/* three (51) */
#define NXFONT_METRICS_51 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_51 {0x0, 0xf0, 0x20, 0x60, 0x10, 0x90, 0x60, 0x0}
/* four (52) */
#define NXFONT_METRICS_52 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_52 {0x0, 0x20, 0x60, 0xa0, 0xf0, 0x20, 0x20, 0x0}
/* five (53) */
#define NXFONT_METRICS_53 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_53 {0x0, 0xf0, 0x80, 0xe0, 0x10, 0x90, 0x60, 0x0}
/* six (54) */
#define NXFONT_METRICS_54 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_54 {0x0, 0x60, 0x80, 0xe0, 0x90, 0x90, 0x60, 0x0}
/* seven (55) */
#define NXFONT_METRICS_55 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_55 {0x0, 0xf0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x0}
/* eight (56) */
#define NXFONT_METRICS_56 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_56 {0x0, 0x60, 0x90, 0x60, 0x90, 0x90, 0x60, 0x0}
/* nine (57) */
#define NXFONT_METRICS_57 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_57 {0x0, 0x60, 0x90, 0x90, 0x70, 0x10, 0x60, 0x0}
/* colon (58) */
#define NXFONT_METRICS_58 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_58 {0x0, 0x0, 0x60, 0x60, 0x0, 0x60, 0x60, 0x0}
/* semicolon (59) */
#define NXFONT_METRICS_59 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_59 {0x0, 0x0, 0x30, 0x30, 0x0, 0x30, 0x20, 0x40}
/* less (60) */
#define NXFONT_METRICS_60 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_60 {0x0, 0x10, 0x20, 0x40, 0x40, 0x20, 0x10, 0x0}
/* equal (61) */
#define NXFONT_METRICS_61 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_61 {0x0, 0x0, 0x0, 0xf0, 0x0, 0xf0, 0x0, 0x0}
/* greater (62) */
#define NXFONT_METRICS_62 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_62 {0x0, 0x40, 0x20, 0x10, 0x10, 0x20, 0x40, 0x0}
/* question (63) */
#define NXFONT_METRICS_63 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_63 {0x0, 0x20, 0x50, 0x10, 0x20, 0x0, 0x20, 0x0}
/* at (64) */
#define NXFONT_METRICS_64 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_64 {0x30, 0x48, 0x98, 0xa8, 0xa8, 0x90, 0x40, 0x30}
/* A (65) */
#define NXFONT_METRICS_65 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_65 {0x0, 0x60, 0x90, 0x90, 0xf0, 0x90, 0x90, 0x0}
/* B (66) */
#define NXFONT_METRICS_66 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_66 {0x0, 0xe0, 0x90, 0xe0, 0x90, 0x90, 0xe0, 0x0}
/* C (67) */
#define NXFONT_METRICS_67 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_67 {0x0, 0x60, 0x90, 0x80, 0x80, 0x90, 0x60, 0x0}
/* D (68) */
#define NXFONT_METRICS_68 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_68 {0x0, 0xe0, 0x90, 0x90, 0x90, 0x90, 0xe0, 0x0}
/* E (69) */
#define NXFONT_METRICS_69 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_69 {0x0, 0xf0, 0x80, 0xe0, 0x80, 0x80, 0xf0, 0x0}
/* F (70) */
#define NXFONT_METRICS_70 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_70 {0x0, 0xf0, 0x80, 0xe0, 0x80, 0x80, 0x80, 0x0}
/* G (71) */
#define NXFONT_METRICS_71 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_71 {0x0, 0x60, 0x90, 0x80, 0xb0, 0x90, 0x60, 0x0}
/* H (72) */
#define NXFONT_METRICS_72 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_72 {0x0, 0x90, 0x90, 0xf0, 0x90, 0x90, 0x90, 0x0}
/* I (73) */
#define NXFONT_METRICS_73 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_73 {0x0, 0x70, 0x20, 0x20, 0x20, 0x20, 0x70, 0x0}
/* J (74) */
#define NXFONT_METRICS_74 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_74 {0x0, 0x70, 0x20, 0x20, 0x20, 0xa0, 0x40, 0x0}
/* K (75) */
#define NXFONT_METRICS_75 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_75 {0x0, 0x90, 0xa0, 0xc0, 0xa0, 0xa0, 0x90, 0x0}
/* L (76) */
#define NXFONT_METRICS_76 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_76 {0x0, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x0}
/* M (77) */
#define NXFONT_METRICS_77 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_77 {0x0, 0x90, 0xf0, 0xf0, 0x90, 0x90, 0x90, 0x0}
/* N (78) */
#define NXFONT_METRICS_78 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_78 {0x0, 0x90, 0xd0, 0xf0, 0xb0, 0xb0, 0x90, 0x0}
/* O (79) */
#define NXFONT_METRICS_79 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_79 {0x0, 0x60, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0}
/* P (80) */
#define NXFONT_METRICS_80 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_80 {0x0, 0xe0, 0x90, 0x90, 0xe0, 0x80, 0x80, 0x0}
/* Q (81) */
#define NXFONT_METRICS_81 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_81 {0x0, 0x60, 0x90, 0x90, 0xd0, 0xb0, 0x60, 0x10}
/* R (82) */
#define NXFONT_METRICS_82 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_82 {0x0, 0xe0, 0x90, 0x90, 0xe0, 0x90, 0x90, 0x0}
/* S (83) */
#define NXFONT_METRICS_83 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_83 {0x0, 0x60, 0x90, 0x40, 0x20, 0x90, 0x60, 0x0}
/* T (84) */
#define NXFONT_METRICS_84 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_84 {0x0, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0}
/* U (85) */
#define NXFONT_METRICS_85 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_85 {0x0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0}
/* V (86) */
#define NXFONT_METRICS_86 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_86 {0x0, 0x90, 0x90, 0x90, 0x90, 0x60, 0x60, 0x0}
/* W (87) */
#define NXFONT_METRICS_87 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_87 {0x0, 0x90, 0x90, 0x90, 0xf0, 0xf0, 0x90, 0x0}
/* X (88) */
#define NXFONT_METRICS_88 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_88 {0x0, 0x90, 0x90, 0x60, 0x60, 0x90, 0x90, 0x0}
/* Y (89) */
#define NXFONT_METRICS_89 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_89 {0x0, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x0}
/* Z (90) */
#define NXFONT_METRICS_90 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_90 {0x0, 0xf0, 0x10, 0x20, 0x40, 0x80, 0xf0, 0x0}
/* bracketleft (91) */
#define NXFONT_METRICS_91 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_91 {0x0, 0x70, 0x40, 0x40, 0x40, 0x40, 0x70, 0x0}
/* backslash (92) */
#define NXFONT_METRICS_92 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_92 {0x0, 0x80, 0x80, 0x40, 0x20, 0x10, 0x10, 0x0}
/* bracketright (93) */
#define NXFONT_METRICS_93 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_93 {0x0, 0x70, 0x10, 0x10, 0x10, 0x10, 0x70, 0x0}
/* asciicircum (94) */
#define NXFONT_METRICS_94 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_94 {0x0, 0x20, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0}
/* underscore (95) */
#define NXFONT_METRICS_95 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_95 {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf0}
/* grave (96) */
#define NXFONT_METRICS_96 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_96 {0x0, 0x40, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0}
/* a (97) */
#define NXFONT_METRICS_97 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_97 {0x0, 0x0, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0}
/* b (98) */
#define NXFONT_METRICS_98 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_98 {0x0, 0x80, 0x80, 0xe0, 0x90, 0x90, 0xe0, 0x0}
/* c (99) */
#define NXFONT_METRICS_99 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_99 {0x0, 0x0, 0x0, 0x30, 0x40, 0x40, 0x30, 0x0}
/* d (100) */
#define NXFONT_METRICS_100 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_100 {0x0, 0x10, 0x10, 0x70, 0x90, 0x90, 0x70, 0x0}
/* e (101) */
#define NXFONT_METRICS_101 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_101 {0x0, 0x0, 0x0, 0x60, 0xb0, 0xc0, 0x60, 0x0}
/* f (102) */
#define NXFONT_METRICS_102 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_102 {0x0, 0x20, 0x50, 0x40, 0xe0, 0x40, 0x40, 0x0}
/* g (103) */
#define NXFONT_METRICS_103 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_103 {0x0, 0x0, 0x0, 0x60, 0x90, 0x70, 0x10, 0x60}
/* h (104) */
#define NXFONT_METRICS_104 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_104 {0x0, 0x80, 0x80, 0xe0, 0x90, 0x90, 0x90, 0x0}
/* i (105) */
#define NXFONT_METRICS_105 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_105 {0x0, 0x20, 0x0, 0x60, 0x20, 0x20, 0x70, 0x0}
/* j (106) */
#define NXFONT_METRICS_106 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_106 {0x0, 0x10, 0x0, 0x10, 0x10, 0x10, 0x50, 0x20}
/* k (107) */
#define NXFONT_METRICS_107 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_107 {0x0, 0x80, 0x80, 0x90, 0xe0, 0x90, 0x90, 0x0}
/* l (108) */
#define NXFONT_METRICS_108 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_108 {0x0, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, 0x0}
/* m (109) */
#define NXFONT_METRICS_109 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_109 {0x0, 0x0, 0x0, 0xd0, 0xa8, 0xa8, 0xa8, 0x0}
/* n (110) */
#define NXFONT_METRICS_110 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_110 {0x0, 0x0, 0x0, 0xe0, 0x90, 0x90, 0x90, 0x0}
/* o (111) */
#define NXFONT_METRICS_111 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_111 {0x0, 0x0, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0}
/* p (112) */
#define NXFONT_METRICS_112 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_112 {0x0, 0x0, 0x0, 0xe0, 0x90, 0xe0, 0x80, 0x80}
/* q (113) */
#define NXFONT_METRICS_113 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_113 {0x0, 0x0, 0x0, 0x70, 0x90, 0x70, 0x10, 0x10}
/* r (114) */
#define NXFONT_METRICS_114 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_114 {0x0, 0x0, 0x0, 0xa0, 0xd0, 0x80, 0x80, 0x0}
/* s (115) */
#define NXFONT_METRICS_115 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_115 {0x0, 0x0, 0x0, 0x30, 0x60, 0x10, 0x60, 0x0}
/* t (116) */
#define NXFONT_METRICS_116 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_116 {0x0, 0x40, 0x40, 0xe0, 0x40, 0x50, 0x20, 0x0}
/* u (117) */
#define NXFONT_METRICS_117 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_117 {0x0, 0x0, 0x0, 0x90, 0x90, 0x90, 0x70, 0x0}
/* v (118) */
#define NXFONT_METRICS_118 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_118 {0x0, 0x0, 0x0, 0x50, 0x50, 0x50, 0x20, 0x0}
/* w (119) */
#define NXFONT_METRICS_119 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_119 {0x0, 0x0, 0x0, 0x88, 0xa8, 0xa8, 0x50, 0x0}
/* x (120) */
#define NXFONT_METRICS_120 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_120 {0x0, 0x0, 0x0, 0x90, 0x60, 0x60, 0x90, 0x0}
/* y (121) */
#define NXFONT_METRICS_121 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_121 {0x0, 0x0, 0x0, 0x90, 0x90, 0x70, 0x90, 0x60}
/* z (122) */
#define NXFONT_METRICS_122 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_122 {0x0, 0x0, 0x0, 0xf0, 0x20, 0x40, 0xf0, 0x0}
/* braceleft (123) */
#define NXFONT_METRICS_123 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_123 {0x30, 0x40, 0x20, 0xc0, 0x20, 0x40, 0x30, 0x0}
/* bar (124) */
#define NXFONT_METRICS_124 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_124 {0x0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0}
/* braceright (125) */
#define NXFONT_METRICS_125 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_125 {0xc0, 0x20, 0x40, 0x30, 0x40, 0x20, 0xc0, 0x0}
/* asciitilde (126) */
#define NXFONT_METRICS_126 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_126 {0x0, 0x50, 0xa0, 0x0, 0x0, 0x0, 0x0, 0x0}
/* exclamdown (161) */
#define NXFONT_METRICS_161 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_161 {0x0, 0x20, 0x0, 0x20, 0x20, 0x20, 0x20, 0x0}
/* cent (162) */
#define NXFONT_METRICS_162 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_162 {0x0, 0x0, 0x20, 0x70, 0xa0, 0xa0, 0x70, 0x20}
/* sterling (163) */
#define NXFONT_METRICS_163 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_163 {0x0, 0x20, 0x50, 0xe0, 0x40, 0x50, 0xa0, 0x0}
/* currency (164) */
#define NXFONT_METRICS_164 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_164 {0x0, 0x0, 0x88, 0x70, 0x50, 0x70, 0x88, 0x0}
/* yen (165) */
#define NXFONT_METRICS_165 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_165 {0x0, 0x88, 0x50, 0xf8, 0x20, 0xf8, 0x20, 0x0}
/* brokenbar (166) */
#define NXFONT_METRICS_166 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_166 {0x20, 0x20, 0x20, 0x0, 0x20, 0x20, 0x20, 0x0}
/* section (167) */
#define NXFONT_METRICS_167 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_167 {0x70, 0x80, 0xe0, 0x90, 0x70, 0x10, 0xe0, 0x0}
/* dieresis (168) */
#define NXFONT_METRICS_168 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_168 {0x0, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
/* copyright (169) */
#define NXFONT_METRICS_169 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_169 {0x0, 0x70, 0xa8, 0xc8, 0xc8, 0xa8, 0x70, 0x0}
/* ordfeminine (170) */
#define NXFONT_METRICS_170 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_170 {0x30, 0x50, 0x30, 0x0, 0x70, 0x0, 0x0, 0x0}
/* guillemotleft (171) */
#define NXFONT_METRICS_171 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_171 {0x0, 0x0, 0x0, 0x50, 0xa0, 0x50, 0x0, 0x0}
/* logicalnot (172) */
#define NXFONT_METRICS_172 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_172 {0x0, 0x0, 0x0, 0x0, 0x70, 0x10, 0x10, 0x0}
/* hyphen (173) */
#define NXFONT_METRICS_173 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_173 {0x0, 0x0, 0x0, 0x0, 0x70, 0x0, 0x0, 0x0}
/* registered (174) */
#define NXFONT_METRICS_174 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_174 {0x0, 0x70, 0xe8, 0xd8, 0xe8, 0xd8, 0x70, 0x0}
/* macron (175) */
#define NXFONT_METRICS_175 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_175 {0x0, 0x70, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}
/* degree (176) */
#define NXFONT_METRICS_176 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_176 {0x0, 0x20, 0x50, 0x20, 0x0, 0x0, 0x0, 0x0}
/* plusminus (177) */
#define NXFONT_METRICS_177 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_177 {0x0, 0x0, 0x20, 0x70, 0x20, 0x0, 0x70, 0x0}
/* twosuperior (178) */
#define NXFONT_METRICS_178 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_178 {0x20, 0x50, 0x10, 0x20, 0x70, 0x0, 0x0, 0x0}
/* threesuperior (179) */
#define NXFONT_METRICS_179 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_179 {0x60, 0x10, 0x60, 0x10, 0x60, 0x0, 0x0, 0x0}
/* acute (180) */
#define NXFONT_METRICS_180 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_180 {0x0, 0x20, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0}
/* mu (181) */
#define NXFONT_METRICS_181 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_181 {0x0, 0x0, 0x0, 0x90, 0x90, 0x90, 0xe0, 0x80}
/* paragraph (182) */
#define NXFONT_METRICS_182 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_182 {0x0, 0x78, 0xe8, 0xe8, 0x68, 0x28, 0x28, 0x0}
/* periodcentered (183) */
#define NXFONT_METRICS_183 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_183 {0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0}
/* cedilla (184) */
#define NXFONT_METRICS_184 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_184 {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x40}
/* onesuperior (185) */
#define NXFONT_METRICS_185 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_185 {0x20, 0x60, 0x20, 0x20, 0x70, 0x0, 0x0, 0x0}
/* ordmasculine (186) */
#define NXFONT_METRICS_186 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_186 {0x20, 0x50, 0x20, 0x0, 0x70, 0x0, 0x0, 0x0}
/* guillemotright (187) */
#define NXFONT_METRICS_187 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_187 {0x0, 0x0, 0x0, 0xa0, 0x50, 0xa0, 0x0, 0x0}
/* onequarter (188) */
#define NXFONT_METRICS_188 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_188 {0x80, 0x80, 0x80, 0xa0, 0x60, 0xf0, 0x20, 0x0}
/* onehalf (189) */
#define NXFONT_METRICS_189 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_189 {0x80, 0x80, 0xa0, 0xd0, 0x10, 0x20, 0x70, 0x0}
/* threequarters (190) */
#define NXFONT_METRICS_190 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_190 {0x80, 0x40, 0x80, 0x60, 0xa0, 0xf0, 0x20, 0x0}
/* questiondown (191) */
#define NXFONT_METRICS_191 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_191 {0x0, 0x20, 0x0, 0x20, 0x40, 0x50, 0x20, 0x0}
/* Agrave (192) */
#define NXFONT_METRICS_192 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_192 {0x40, 0x20, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0}
/* Aacute (193) */
#define NXFONT_METRICS_193 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_193 {0x20, 0x40, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0}
/* Acircumflex (194) */
#define NXFONT_METRICS_194 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_194 {0x60, 0x90, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0}
/* Atilde (195) */
#define NXFONT_METRICS_195 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_195 {0x50, 0xa0, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0}
/* Adieresis (196) */
#define NXFONT_METRICS_196 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_196 {0x90, 0x0, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0}
/* Aring (197) */
#define NXFONT_METRICS_197 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_197 {0x60, 0x90, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0}
/* AE (198) */
#define NXFONT_METRICS_198 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_198 {0x0, 0x70, 0xa0, 0xa0, 0xf0, 0xa0, 0xb0, 0x0}
/* Ccedilla (199) */
#define NXFONT_METRICS_199 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_199 {0x0, 0x60, 0x90, 0x80, 0x80, 0x90, 0x60, 0x40}
/* Egrave (200) */
#define NXFONT_METRICS_200 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_200 {0x40, 0x20, 0xf0, 0x80, 0xe0, 0x80, 0xf0, 0x0}
/* Eacute (201) */
#define NXFONT_METRICS_201 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_201 {0x20, 0x40, 0xf0, 0x80, 0xe0, 0x80, 0xf0, 0x0}
/* Ecircumflex (202) */
#define NXFONT_METRICS_202 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_202 {0x60, 0x90, 0xf0, 0x80, 0xe0, 0x80, 0xf0, 0x0}
/* Edieresis (203) */
#define NXFONT_METRICS_203 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_203 {0x90, 0x0, 0xf0, 0x80, 0xe0, 0x80, 0xf0, 0x0}
/* Igrave (204) */
#define NXFONT_METRICS_204 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_204 {0x40, 0x20, 0x70, 0x20, 0x20, 0x20, 0x70, 0x0}
/* Iacute (205) */
#define NXFONT_METRICS_205 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_205 {0x10, 0x20, 0x70, 0x20, 0x20, 0x20, 0x70, 0x0}
/* Icircumflex (206) */
#define NXFONT_METRICS_206 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_206 {0x20, 0x50, 0x70, 0x20, 0x20, 0x20, 0x70, 0x0}
/* Idieresis (207) */
#define NXFONT_METRICS_207 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_207 {0x50, 0x0, 0x70, 0x20, 0x20, 0x20, 0x70, 0x0}
/* Eth (208) */
#define NXFONT_METRICS_208 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_208 {0x0, 0x70, 0x48, 0xe8, 0x48, 0x48, 0x70, 0x0}
/* Ntilde (209) */
#define NXFONT_METRICS_209 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_209 {0x50, 0xa0, 0x90, 0xd0, 0xb0, 0x90, 0x90, 0x0}
/* Ograve (210) */
#define NXFONT_METRICS_210 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_210 {0x40, 0x20, 0x60, 0x90, 0x90, 0x90, 0x60, 0x0}
/* Oacute (211) */
#define NXFONT_METRICS_211 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_211 {0x20, 0x40, 0x60, 0x90, 0x90, 0x90, 0x60, 0x0}
/* Ocircumflex (212) */
#define NXFONT_METRICS_212 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_212 {0x60, 0x90, 0x60, 0x90, 0x90, 0x90, 0x60, 0x0}
/* Otilde (213) */
#define NXFONT_METRICS_213 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_213 {0x50, 0xa0, 0x60, 0x90, 0x90, 0x90, 0x60, 0x0}
/* Odieresis (214) */
#define NXFONT_METRICS_214 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_214 {0x90, 0x0, 0x60, 0x90, 0x90, 0x90, 0x60, 0x0}
/* multiply (215) */
#define NXFONT_METRICS_215 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_215 {0x0, 0x0, 0x0, 0x0, 0x50, 0x20, 0x50, 0x0}
/* Oslash (216) */
#define NXFONT_METRICS_216 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_216 {0x0, 0x70, 0xb0, 0xb0, 0xd0, 0xd0, 0xe0, 0x0}
/* Ugrave (217) */
#define NXFONT_METRICS_217 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_217 {0x40, 0x20, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0}
/* Uacute (218) */
#define NXFONT_METRICS_218 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_218 {0x20, 0x40, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0}
/* Ucircumflex (219) */
#define NXFONT_METRICS_219 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_219 {0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0}
/* Udieresis (220) */
#define NXFONT_METRICS_220 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_220 {0x90, 0x0, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0}
/* Yacute (221) */
#define NXFONT_METRICS_221 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_221 {0x10, 0x20, 0x88, 0x50, 0x20, 0x20, 0x20, 0x0}
/* Thorn (222) */
#define NXFONT_METRICS_222 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_222 {0x0, 0x80, 0xe0, 0x90, 0x90, 0xe0, 0x80, 0x0}
/* germandbls (223) */
#define NXFONT_METRICS_223 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_223 {0x0, 0x60, 0x90, 0xa0, 0xa0, 0x90, 0xa0, 0x0}
/* agrave (224) */
#define NXFONT_METRICS_224 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_224 {0x40, 0x20, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0}
/* aacute (225) */
#define NXFONT_METRICS_225 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_225 {0x20, 0x40, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0}
/* acircumflex (226) */
#define NXFONT_METRICS_226 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_226 {0x20, 0x50, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0}
/* atilde (227) */
#define NXFONT_METRICS_227 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_227 {0x50, 0xa0, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0}
/* adieresis (228) */
#define NXFONT_METRICS_228 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_228 {0x0, 0x50, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0}
/* aring (229) */
#define NXFONT_METRICS_229 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_229 {0x60, 0x90, 0x60, 0x70, 0x90, 0x90, 0x70, 0x0}
/* ae (230) */
#define NXFONT_METRICS_230 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_230 {0x0, 0x0, 0x0, 0xf0, 0x68, 0xb0, 0x78, 0x0}
/* ccedilla (231) */
#define NXFONT_METRICS_231 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_231 {0x0, 0x0, 0x0, 0x30, 0x40, 0x40, 0x30, 0x20}
/* egrave (232) */
#define NXFONT_METRICS_232 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_232 {0x40, 0x20, 0x0, 0x60, 0xb0, 0xc0, 0x60, 0x0}
/* eacute (233) */
#define NXFONT_METRICS_233 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_233 {0x20, 0x40, 0x0, 0x60, 0xb0, 0xc0, 0x60, 0x0}
/* ecircumflex (234) */
#define NXFONT_METRICS_234 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_234 {0x60, 0x90, 0x0, 0x60, 0xb0, 0xc0, 0x60, 0x0}
/* edieresis (235) */
#define NXFONT_METRICS_235 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_235 {0x0, 0x50, 0x0, 0x60, 0xb0, 0xc0, 0x60, 0x0}
/* igrave (236) */
#define NXFONT_METRICS_236 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_236 {0x40, 0x20, 0x0, 0x60, 0x20, 0x20, 0x70, 0x0}
/* iacute (237) */
#define NXFONT_METRICS_237 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_237 {0x10, 0x20, 0x0, 0x60, 0x20, 0x20, 0x70, 0x0}
/* icircumflex (238) */
#define NXFONT_METRICS_238 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_238 {0x20, 0x50, 0x0, 0x60, 0x20, 0x20, 0x70, 0x0}
/* idieresis (239) */
#define NXFONT_METRICS_239 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_239 {0x0, 0x50, 0x0, 0x60, 0x20, 0x20, 0x70, 0x0}
/* eth (240) */
#define NXFONT_METRICS_240 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_240 {0xa0, 0x40, 0xa0, 0x10, 0x70, 0x90, 0x60, 0x0}
/* ntilde (241) */
#define NXFONT_METRICS_241 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_241 {0x50, 0xa0, 0x0, 0xe0, 0x90, 0x90, 0x90, 0x0}
/* ograve (242) */
#define NXFONT_METRICS_242 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_242 {0x40, 0x20, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0}
/* oacute (243) */
#define NXFONT_METRICS_243 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_243 {0x20, 0x40, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0}
/* ocircumflex (244) */
#define NXFONT_METRICS_244 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_244 {0x60, 0x90, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0}
/* otilde (245) */
#define NXFONT_METRICS_245 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_245 {0x50, 0xa0, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0}
/* odieresis (246) */
#define NXFONT_METRICS_246 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_246 {0x0, 0x90, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0}
/* divide (247) */
#define NXFONT_METRICS_247 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_247 {0x0, 0x0, 0x20, 0x0, 0x70, 0x0, 0x20, 0x0}
/* oslash (248) */
#define NXFONT_METRICS_248 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_248 {0x0, 0x0, 0x0, 0x70, 0xb0, 0xd0, 0xe0, 0x0}
/* ugrave (249) */
#define NXFONT_METRICS_249 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_249 {0x40, 0x20, 0x0, 0x90, 0x90, 0x90, 0x70, 0x0}
/* uacute (250) */
#define NXFONT_METRICS_250 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_250 {0x20, 0x40, 0x0, 0x90, 0x90, 0x90, 0x70, 0x0}
/* ucircumflex (251) */
#define NXFONT_METRICS_251 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_251 {0x60, 0x90, 0x0, 0x90, 0x90, 0x90, 0x70, 0x0}
/* udieresis (252) */
#define NXFONT_METRICS_252 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_252 {0x0, 0x90, 0x0, 0x90, 0x90, 0x90, 0x70, 0x0}
/* yacute (253) */
#define NXFONT_METRICS_253 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_253 {0x20, 0x40, 0x0, 0x90, 0x90, 0x70, 0x90, 0x60}
/* thorn (254) */
#define NXFONT_METRICS_254 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_254 {0x0, 0x80, 0x80, 0xe0, 0x90, 0xe0, 0x80, 0x80}
/* ydieresis (255) */
#define NXFONT_METRICS_255 {1, 5, 8, 0, 0, 0}
#define NXFONT_BITMAP_255 {0x0, 0x90, 0x0, 0x90, 0x90, 0x70, 0x90, 0x60}
#endif
+1 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/arch.h
*
* Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
+7 -1
View File
@@ -117,6 +117,12 @@ struct binary_s
#endif
size_t mapsize; /* Size of the mapped address region (needed for munmap) */
/* Start-up information that is provided by the loader, but may be modified
* by the caller between load_module() and exec_module() calls.
*/
uint8_t priority; /* Task execution priority */
size_t stacksize; /* Size of the stack in bytes (unallocated) */
};
@@ -221,7 +227,7 @@ int unload_module(FAR const struct binary_s *bin);
*
****************************************************************************/
int exec_module(FAR const struct binary_s *bin, int priority);
int exec_module(FAR const struct binary_s *bin);
/****************************************************************************
* Name: exec
+156
View File
@@ -0,0 +1,156 @@
/****************************************************************************
* include/nuttx/binfmt/builtin.h
*
* Originally by:
*
* Copyright (C) 2011 Uros Platise. All rights reserved.
* Author: Uros Platise <uros.platise@isotel.eu>
*
* With subsequent updates, modifications, and general maintenance by:
*
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_BINFMT_BUILTIN_H
#define __INCLUDE_NUTTX_BINFMT_BUILTIN_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
/****************************************************************************
* Public Types
****************************************************************************/
struct builtin_s
{
const char *name; /* Invocation name and as seen under /sbin/ */
int priority; /* Use: SCHED_PRIORITY_DEFAULT */
int stacksize; /* Desired stack size */
main_t main; /* Entry point: main(int argc, char *argv[]) */
};
/****************************************************************************
* Public Data
****************************************************************************/
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
/* The g_builtins[] array holds information about each builtin function. If
* support for builtin functions is enabled in the NuttX configuration, then
* this arrary (along with the number_builtins() function) must be provided
* by the application code.
*/
EXTERN const struct builtin_s g_builtins[];
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Utility Functions Provided to Applications by binfmt/libbuiltin
****************************************************************************/
/****************************************************************************
* Name: builtin_isavail
*
* Description:
* Checks for availabiliy of application registerred during compile time.
*
* Input Parameter:
* filename - Name of the linked-in binary to be started.
*
* Returned Value:
* This is an end-user function, so it follows the normal convention:
* Returns index of builtin application. If it is not found then it
* returns -1 (ERROR) and sets errno appropriately.
*
****************************************************************************/
int builtin_isavail(FAR const char *appname);
/****************************************************************************
* Name: builtin_getname
*
* Description:
* Returns pointer to a name of built-in application pointed by the
* index.
*
* Input Parameter:
* index, from 0 and on ...
*
* Returned Value:
* Returns valid pointer pointing to the app name if index is valid.
* Otherwise NULL is returned.
*
****************************************************************************/
FAR const char *builtin_getname(int index);
/****************************************************************************
* Data Set Access Functions Provided to Applications by binfmt/libbuiltin
****************************************************************************/
/****************************************************************************
* Name: number_builtins
*
* Description:
* Returns the number of builtin functions in the g_builtins[] array. If
* support for builtin functions is enabled in the NuttX configuration,
* then this function (along with g_builtins[]) must be provided by the
* application code.
*
* Input Parameter:
* None
*
* Returned Value:
* The number of entries in the g_builtins[] array. This function does
* not return failures.
*
****************************************************************************/
int number_builtins(void);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __INCLUDE_NUTTX_BINFMT_BUILTIN_H */
+1 -1
View File
@@ -113,7 +113,7 @@
#define USEC2TICK(usec) (((usec)+(USEC_PER_TICK/2))/USEC_PER_TICK) /* Rounds */
#define MSEC2TICK(msec) (((msec)+(MSEC_PER_TICK/2))/MSEC_PER_TICK) /* Rounds */
#define DSEC2TICK(dsec) MSEC2TICK((dsec)*MSEC_PER_DSEC)
#define SEC2TICK(sec) MSEC2TICK((sec)*MSEC_PER_SEC)
#define SEC2TICK(sec) MSEC2TICK((sec)*MSEC_PER_SEC) /* Exact */
#define TICK2NSEC(tick) ((tick)*NSEC_PER_TICK) /* Exact */
#define TICK2USEC(tick) ((tick)*USEC_PER_TICK) /* Exact */
+83
View File
@@ -0,0 +1,83 @@
/****************************************************************************
* include/nuttx/fs/binfs.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_FS_BINFS_H
#define __INCLUDE_NUTTX_FS_BINFS_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_FS_BINFS
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Type Definitions
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
/* The "bindir" is file system that supports access to the builtin applications.
* It is typically mounted under /bin.
*/
EXTERN mountpt_operations;
EXTERN const struct mountpt_operations binfs_operations;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_FS_BINFS */
#endif /* __INCLUDE_NUTTX_FS_BINFS_H */
+3 -3
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/fs/dirent.h
*
* Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -102,7 +102,7 @@ struct fs_romfsdir_s
};
#endif /* CONFIG_FS_ROMFS */
#ifdef CONFIG_APPS_BINDIR
#ifdef CONFIG_FS_BINFS
/* The apps/ pseudo bin/ directory. The state value is simply an index */
struct fs_binfsdir_s
@@ -179,7 +179,7 @@ struct fs_dirent_s
#ifdef CONFIG_FS_ROMFS
struct fs_romfsdir_s romfs;
#endif
#ifdef CONFIG_APPS_BINDIR
#ifdef CONFIG_FS_BINFS
struct fs_binfsdir_s binfs;
#endif
#ifdef CONFIG_FS_NXFFS
+2 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/fs/fs.h
*
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -161,6 +161,7 @@ struct mountpt_operations
*/
int (*sync)(FAR struct file *filp);
int (*dup)(FAR const struct file *oldp, FAR struct file *newp);
/* Directory operations */
+5
View File
@@ -105,6 +105,11 @@
#define FIOC_OPTIMIZE _FIOC(0x0003) /* IN: None
* OUT: None
*/
#define FIOC_FILENAME _FIOC(0x0004) /* IN: FAR const char ** pointer
* OUT: Pointer to a persistent file name
* (Guaranteed to persist while the file
* is open).
*/
#define FIONREAD _FIOC(0x0004) /* IN: Location to return value (int *)
* OUT: Bytes readable from this fd
+347
View File
@@ -0,0 +1,347 @@
/************************************************************************************
* include/nuttx/input/kbd_codec.h
* Serialize and marshaling keyboard data and events
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
#ifndef __INCLUDE_NUTTX_INPUT_KBD_CODEC_H
#define __INCLUDE_NUTTX_INPUT_KBD_CODEC_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/streams.h>
#ifdef CONFIG_LIB_KBDCODEC
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/* These are the special keyboard commands recognized by the CODEC. */
enum kbd_keycode_e
{
KEYCODE_NORMAL = 0, /* Not a special keycode */
/* Delete and Backspace keycodes (in case they may be different than the
* ASCII BKSP and DEL values.
*/
KEYCODE_FWDDEL, /* DELete (forward delete) */
KEYCODE_BACKDEL, /* Backspace (backward delete) */
/* Cursor movement */
KEYCODE_HOME, /* Home */
KEYCODE_END, /* End */
KEYCODE_LEFT, /* Left arrow */
KEYCODE_RIGHT, /* Right arrow */
KEYCODE_UP, /* Up arrow */
KEYCODE_DOWN, /* Down arrow */
KEYCODE_PAGEUP, /* Page up */
KEYCODE_PAGEDOWN, /* Page down */
/* Edit commands */
KEYCODE_INSERT, /* Insert */
KEYCODE_AGAIN, /* Again */
KEYCODE_UNDO, /* Undo */
KEYCODE_REDO, /* Redo */
KEYCODE_CUT, /* Cut */
KEYCODE_COPY, /* Copy */
KEYCODE_PASTE, /* Paste */
KEYCODE_FIND, /* Find */
/* Selection codes */
KEYCODE_ENTER, /* Enter */
KEYCODE_SELECT, /* Select */
KEYCODE_EXECUTE, /* Execute */
/* Keyboard modes */
KEYCODE_CAPSLOCK, /* Caps Lock */
KEYCODE_SCROLLLOCK, /* Scroll Lock */
KEYCODE_NUMLOCK, /* Keypad Num Lock and Clear */
KEYCODE_LCAPSLOCK, /* Locking Caps Lock */
KEYCODE_LNUMLOCK, /* Locking Num Lock */
KEYCODE_LSCROLLLOCK, /* Locking Scroll Lock */
/* Misc control codes */
KEYCODE_POWER, /* Power */
KEYCODE_HELP, /* Help */
KEYCODE_MENU, /* Menu */
KEYCODE_STOP, /* Stop */
KEYCODE_PAUSE, /* Pause */
KEYCODE_BREAK, /* Break */
KEYCODE_CANCEL, /* Cancel */
KEYCODE_PRTSCRN, /* PrintScreen */
KEYCODE_SYSREQ, /* SysReq/Attention */
/* Audio */
KEYCODE_MUTE, /* Mute */
KEYCODE_VOLUP, /* Volume Up */
KEYCODE_VOLDOWN, /* Volume Down */
/* Telephone */
KEYCODE_ANSWER, /* Answer (phone) */
KEYCODE_HANGUP, /* Hang-up (phone) */
/* Calculator */
KEYCODE_CLEAR, /* Clear */
KEYCODE_CLEARENTRY, /* Clear entry */
KEYCODE_NEGATE, /* +/- */
KEYCODE_MEMSTORE, /* Memory store */
KEYCODE_MEMCLEAR, /* Memory clear */
KEYCODE_MEMRECALL, /* Memory recall */
KEYCODE_MEMADD, /* Memory add */
KEYCODE_MEMSUB, /* Memory substract */
KEYCODE_MEMMUL, /* Memory multiply */
KEYCODE_MEMDIV, /* Memory divide */
KEYCODE_BINARY, /* Binary mode */
KEYCODE_OCTAL, /* Octal mode */
KEYCODE_DECIMAL, /* Decimal mode */
KEYCODE_HEXADECIMAL, /* Hexadecimal mode */
/* Languages */
KEYCODE_LANG1, /* LANG1 */
KEYCODE_LANG2, /* LANG2 */
KEYCODE_LANG3, /* LANG3 */
KEYCODE_LANG4, /* LANG4 */
KEYCODE_LANG5, /* LANG5 */
KEYCODE_LANG6, /* LANG6 */
KEYCODE_LANG7, /* LANG7 */
KEYCODE_LANG8, /* LANG8 */
/* Context-specific function keys */
KEYCODE_F1, /* Function key 1 */
KEYCODE_F2, /* Function key 2 */
KEYCODE_F3, /* Function key 3 */
KEYCODE_F4, /* Function key 4 */
KEYCODE_F5, /* Function key 5 */
KEYCODE_F6, /* Function key 6 */
KEYCODE_F7, /* Function key 7 */
KEYCODE_F8, /* Function key 8 */
KEYCODE_F9, /* Function key 9 */
KEYCODE_F10, /* Function key 10 */
KEYCODE_F11, /* Function key 11 */
KEYCODE_F12, /* Function key 12 */
KEYCODE_F13, /* Function key 13 */
KEYCODE_F14, /* Function key 14 */
KEYCODE_F15, /* Function key 15 */
KEYCODE_F16, /* Function key 16 */
KEYCODE_F17, /* Function key 17 */
KEYCODE_F18, /* Function key 18 */
KEYCODE_F19, /* Function key 19 */
KEYCODE_F20, /* Function key 20 */
KEYCODE_F21, /* Function key 21 */
KEYCODE_F22, /* Function key 22 */
KEYCODE_F23, /* Function key 23 */
KEYCODE_F24 /* Function key 24 */
};
#define FIRST_KEYCODE KEYCODE_FWDDEL
#define LAST_KEYCODE KEYCODE_F24
/* kbd_decode() return values */
#define KBD_PRESS 0 /* Key press event */
#define KBD_RELEASE 1 /* Key release event */
#define KBD_SPECPRESS 2 /* Special key press event */
#define KBD_SPECREL 3 /* Special key release event */
#define KBD_ERROR EOF /* Error or end-of-file */
/****************************************************************************
* Public Types
****************************************************************************/
struct kbd_getstate_s
{
uint8_t nch; /* Number of characters in the buffer */
uint8_t ndx; /* Index to next character in the buffer */
uint8_t buf[4]; /* Buffer of ungotten data */
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/****************************************************************************
* The following functions are intended for use by "producer", keyboard
* or keypad drivers to encode information into driver buffers.
****************************************************************************/
/****************************************************************************
* Name: kbd_press
*
* Description:
* Indicates a normal key press event. Put one byte of normal keyboard
* data into the output stream.
*
* Input Parameters:
* ch - The character to be added to the output stream.
* stream - An instance of lib_outstream_s to do the low-level put
* operation.
*
* Returned Value:
* None
*
****************************************************************************/
#define kbd_press(ch, stream) (stream)->put((stream), (int)(ch))
/****************************************************************************
* Name: kbd_release
*
* Description:
* Encode the release of a normal key.
*
* Input Parameters:
* ch - The character associated with the key that was releared.
* stream - An instance of lib_outstream_s to do the low-level put
* operation.
*
* Returned Value:
* None
*
****************************************************************************/
void kbd_release(uint8_t ch, FAR struct lib_outstream_s *stream);
/****************************************************************************
* Name: kbd_specpress
*
* Description:
* Denotes a special key press event. Put one special keyboard command
* into the output stream.
*
* Input Parameters:
* keycode - The command to be added to the output stream.
* stream - An instance of lib_outstream_s to do the low-level put
* operation.
*
* Returned Value:
* None
*
****************************************************************************/
void kbd_specpress(enum kbd_keycode_e keycode,
FAR struct lib_outstream_s *stream);
/****************************************************************************
* Name: kbd_specrel
*
* Description:
* Denotes a special key release event. Put one special keyboard
* command into the output stream.
*
* Input Parameters:
* keycode - The command to be added to the output stream.
* stream - An instance of lib_outstream_s to do the low-level put
* operation.
*
* Returned Value:
* None
*
****************************************************************************/
void kbd_specrel(enum kbd_keycode_e keycode,
FAR struct lib_outstream_s *stream);
/****************************************************************************
* The following functions are intended for use by "consumer" applications
* to remove and decode information from the driver provided buffer.
****************************************************************************/
/****************************************************************************
* Name: kbd_decode
*
* Description:
* Get one byte of data or special command from the driver provided input
* buffer.
*
* Input Parameters:
* stream - An instance of lib_instream_s to do the low-level get
* operation.
* pch - The location to save the returned value. This may be
* either a normal, character code or a special command from enum
* kbd_keycode_e
* state - A user provided buffer to support parsing. This structure
* should be cleared the first time that kbd_decode is called.
*
* Returned Value:
*
* KBD_PRESS - Indicates the successful receipt of normal, keyboard data.
* This corresponds to a keypress event. The returned value in pch is a
* simple byte of text or control data corresponding to the pressed key.
* KBD_RELEASE - Indicates a key release event. The returned value in pch
* is the byte of text or control data corresponding to the released key.
* KBD_SPECPRESS - Indicates the successful receipt of a special keyboard
* command. The returned value in pch is a value from enum kbd_getstate_s.
* KBD_SPECREL - Indicates a special key release event. The returned value
* in pch is a value from enum kbd_getstate_s.
* EOF - An error has getting the next character (reported by the stream).
* Normally indicates the end of file.
*
****************************************************************************/
int kbd_decode(FAR struct lib_instream_s *stream,
FAR struct kbd_getstate_s *state, FAR uint8_t *pch);
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_LIB_KBDCODEC */
#endif /* __INCLUDE_NUTTX_INPUT_KBD_CODEC_H */
+245
View File
@@ -0,0 +1,245 @@
/**************************************************************************************
* include/nuttx/lcd/ug-2864hsweg01.h
* Driver for Univision UG-2864HSWEG01 OLED display (wih SSD1306 controller) in SPI
* mode
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References:
* 1. Product Specification (Preliminary), Part Name: OEL Display Module, Part ID:
* UG-2864HSWEG01, Doc No: SAS1-9046-B, Univision Technology Inc.
* 2. SSD1306, 128 X 64 Dot Matrix OLED/PLED, Preliminary Segment/Common Driver with
* Controller, Solomon Systech
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************************/
#ifndef __INCLUDE_NUTTX_UG_8264HSWEG01_H
#define __INCLUDE_NUTTX_UG_8264HSWEG01_H
/**************************************************************************************
* Included Files
**************************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <nuttx/arch.h>
#ifdef CONFIG_LCD_UG2864HSWEG01
/**************************************************************************************
* Pre-processor Definitions
**************************************************************************************/
/* Configuration **********************************************************************/
/* UG-2864HSWEG01 Configuration Settings:
*
* CONFIG_UG2864HSWEG01_SPIMODE - Controls the SPI mode
* CONFIG_UG2864HSWEG01_FREQUENCY - Define to use a different bus frequency
* CONFIG_UG2864HSWEG01_NINTERFACES - Specifies the number of physical UG-2864HSWEG01
* devices that will be supported.
*
* Required LCD driver settings:
*
* CONFIG_LCD_UG28HSWEG01 - Enable UG-2864HSWEG01 support
* CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted.
* CONFIG_LCD_MAXPOWER must be 1
*
* Option LCD driver settings:
* CONFIG_LCD_LANDSCAPE, CONFIG_LCD_PORTRAIT, CONFIG_LCD_RLANDSCAPE, and
* CONFIG_LCD_RPORTRAIT - Display orientation.
*
* Required SPI driver settings:
* CONFIG_SPI_CMDDATA - Include support for cmd/data selection.
*/
/* SPI Interface
*
* "The serial interface consists of serial clock SCL, serial data SI, A0 and
* CS . SI is shifted into an 8-bit shift register on every rising edge of
* SCL in the order of D7, D6, … and D0. A0 is sampled on every eighth clock
* and the data byte in the shift register is written to the display data RAM
* or command register in the same clock."
*
* MODE 3:
* Clock polarity: High (CPOL=1)
* Clock phase: Sample on trailing (rising edge) (CPHA 1)
*/
#ifndef CONFIG_UG2864HSWEG01_SPIMODE
# define CONFIG_UG2864HSWEG01_SPIMODE SPIDEV_MODE3
#endif
/* "This module determines whether the input data is interpreted as data or
* command. When A0 = “H”, the inputs at D7 - D0 are interpreted as data and be
* written to display RAM. When A0 = “L”, the inputs at D7 - D0 are interpreted
* as command, they will be decoded and be written to the corresponding command
* registers.
*/
#ifndef CONFIG_SPI_CMDDATA
# error "CONFIG_SPI_CMDDATA must be defined in your NuttX configuration"
#endif
/* CONFIG_UG2864HSWEG01_NINTERFACES determines the number of physical interfaces
* that will be supported.
*/
#ifndef CONFIG_UG2864HSWEG01_NINTERFACES
# define CONFIG_UG2864HSWEG01_NINTERFACES 1
#endif
/* Check contrast selection */
#if !defined(CONFIG_LCD_MAXCONTRAST)
# define CONFIG_LCD_MAXCONTRAST 255
#endif
#if CONFIG_LCD_MAXCONTRAST <= 0|| CONFIG_LCD_MAXCONTRAST > 255
# error "CONFIG_LCD_MAXCONTRAST exceeds supported maximum"
#endif
#if CONFIG_LCD_MAXCONTRAST < 255
# warning "Optimal setting of CONFIG_LCD_MAXCONTRAST is 255"
#endif
/* Check power setting */
#if !defined(CONFIG_LCD_MAXPOWER)
# define CONFIG_LCD_MAXPOWER 1
#endif
#if CONFIG_LCD_MAXPOWER != 1
# warning "CONFIG_LCD_MAXPOWER exceeds supported maximum"
# undef CONFIG_LCD_MAXPOWER
# define CONFIG_LCD_MAXPOWER 1
#endif
/* Color is 1bpp monochrome with leftmost column contained in bits 0 */
#ifdef CONFIG_NX_DISABLE_1BPP
# warning "1 bit-per-pixel support needed"
#endif
/* Orientation */
#if defined(CONFIG_LCD_LANDSCAPE)
# undef CONFIG_LCD_PORTRAIT
# undef CONFIG_LCD_RLANDSCAPE
# undef CONFIG_LCD_RPORTRAIT
#elif defined(CONFIG_LCD_PORTRAIT)
# undef CONFIG_LCD_LANDSCAPE
# undef CONFIG_LCD_RLANDSCAPE
# undef CONFIG_LCD_RPORTRAIT
#elif defined(CONFIG_LCD_RLANDSCAPE)
# undef CONFIG_LCD_LANDSCAPE
# undef CONFIG_LCD_PORTRAIT
# undef CONFIG_LCD_RPORTRAIT
#elif defined(CONFIG_LCD_RPORTRAIT)
# undef CONFIG_LCD_LANDSCAPE
# undef CONFIG_LCD_PORTRAIT
# undef CONFIG_LCD_RLANDSCAPE
#else
# define CONFIG_LCD_LANDSCAPE 1
# warning "Assuming landscape orientation"
#endif
/* Some important "colors" */
#define UG_Y1_BLACK 0
#define UG_Y1_WHITE 1
/**************************************************************************************
* Public Types
**************************************************************************************/
/**************************************************************************************
* Public Data
**************************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/**************************************************************************************
* Public Function Prototypes
**************************************************************************************/
/**************************************************************************************
* Name: ug2864hsweg01_initialize
*
* Description:
* Initialize the UG-2864HSWEG01 video hardware. The initial state of the
* OLED is fully initialized, display memory cleared, and the OLED ready
* to use, but with the power setting at 0 (full off == sleep mode).
*
* Input Parameters:
*
* spi - A reference to the SPI driver instance.
* devno - A value in the range of 0 through CONFIG_UG2864HSWEG01_NINTERFACES-1.
* This allows support for multiple OLED devices.
*
* Returned Value:
*
* On success, this function returns a reference to the LCD object for
* the specified OLED. NULL is returned on any failure.
*
**************************************************************************************/
struct lcd_dev_s; /* See include/nuttx/lcd/lcd.h */
struct spi_dev_s; /* See include/nuttx/spi.h */
FAR struct lcd_dev_s *ug2864hsweg01_initialize(FAR struct spi_dev_s *spi,
unsigned int devno);
/************************************************************************************************
* Name: ug2864hsweg01_fill
*
* Description:
* This non-standard method can be used to clear the entire display by writing one
* color to the display. This is much faster than writing a series of runs.
*
* Input Parameters:
* priv - Reference to private driver structure
*
* Assumptions:
* Caller has selected the OLED section.
*
**************************************************************************************/
void ug2864hsweg01_fill(FAR struct lcd_dev_s *dev, uint8_t color);
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_LCD_UG2864HSWEG01 */
#endif /* __INCLUDE_NUTTX_UG_8264HSWEG01_H */
+84 -84
View File
@@ -112,12 +112,12 @@
/* Luminary LM3S6918 built-in PHY: 0x07-0x0f, 0x14-0x16, 0x19-0x1f reserved */
#define MII_LM3S_VSPECIFIC 0x10 /* Vendor-Specific */
#define MII_LM3S_INTCS 0x11 /* Interrupt control/status */
#define MII_LM3S_DIAGNOSTIC 0x12 /* Diagnostic */
#define MII_LM3S_XCVRCONTROL 0x13 /* Transceiver Control */
#define MII_LM3S_LEDCONFIG 0x17 /* LED Configuration */
#define MII_LM3S_MDICONTROL 0x18 /* Ethernet PHY Management MDI/MDIX Control */
#define MII_LM_VSPECIFIC 0x10 /* Vendor-Specific */
#define MII_LM_INTCS 0x11 /* Interrupt control/status */
#define MII_LM_DIAGNOSTIC 0x12 /* Diagnostic */
#define MII_LM_XCVRCONTROL 0x13 /* Transceiver Control */
#define MII_LM_LEDCONFIG 0x17 /* LED Configuration */
#define MII_LM_MDICONTROL 0x18 /* Ethernet PHY Management MDI/MDIX Control */
/* Micrel KS8721: 0x15, 0x1b, and 0x1f */
@@ -323,79 +323,79 @@
/* LM3S6918-specific register bit settings **********************************/
/* LM3S6918 Vendor-Specific, address 0x10 */
#define LM3S_VSPECIFIC_RXCC (1 << 0) /* Bit 0: Receive Clock Control*/
#define LM3S_VSPECIFIC_PCSBP (1 << 1) /* Bit 1: PCS Bypass */
#define LM3S_VSPECIFIC_RVSPOL (1 << 4) /* Bit 4: Receive Data Polarity */
#define LM3S_VSPECIFIC_APOL (1 << 5) /* Bit 5: Auto-Polarity Disable */
#define LM3S_VSPECIFIC_NL10 (1 << 10) /* Bit 10: Natural Loopback Mode */
#define LM3S_VSPECIFIC_SQEI (1 << 11) /* Bit 11: SQE Inhibit Testing */
#define LM3S_VSPECIFIC_TXHIM (1 << 12) /* Bit 12: Transmit High Impedance Mode */
#define LM3S_VSPECIFIC_INPOL (1 << 14) /* Bit 14: Interrupt Polarity Value*/
#define LM3S_VSPECIFIC_RPTR (1 << 15) /* Bit 15: Repeater mode*/
#define LM_VSPECIFIC_RXCC (1 << 0) /* Bit 0: Receive Clock Control*/
#define LM_VSPECIFIC_PCSBP (1 << 1) /* Bit 1: PCS Bypass */
#define LM_VSPECIFIC_RVSPOL (1 << 4) /* Bit 4: Receive Data Polarity */
#define LM_VSPECIFIC_APOL (1 << 5) /* Bit 5: Auto-Polarity Disable */
#define LM_VSPECIFIC_NL10 (1 << 10) /* Bit 10: Natural Loopback Mode */
#define LM_VSPECIFIC_SQEI (1 << 11) /* Bit 11: SQE Inhibit Testing */
#define LM_VSPECIFIC_TXHIM (1 << 12) /* Bit 12: Transmit High Impedance Mode */
#define LM_VSPECIFIC_INPOL (1 << 14) /* Bit 14: Interrupt Polarity Value*/
#define LM_VSPECIFIC_RPTR (1 << 15) /* Bit 15: Repeater mode*/
/* LM3S6918 Interrupt Control/Status, address 0x11 */
#define LM3S_INTCS_ANEGCOMPINT (1 << 0) /* Bit 0: Auto-Negotiation Complete Interrupt */
#define LM3S_INTCS_RFAULTINT (1 << 1) /* Bit 1: Remote Fault Interrupt */
#define LM3S_INTCS_LSCHGINT (1 << 2) /* Bit 2: Link Status Change Interrupt */
#define LM3S_INTCS_LPACKINT (1 << 3) /* Bit 3: LP Acknowledge Interrupt */
#define LM3S_INTCS_PDFINT (1 << 4) /* Bit 4: Parallel Detection Fault Interrupt */
#define LM3S_INTCS_PRXINT (1 << 5) /* Bit 5: Page Receive Interrupt */
#define LM3S_INTCS_RXERINT (1 << 6) /* Bit 6: Receive Error Interrupt */
#define LM3S_INTCS_JABBERINT (1 << 7) /* Bit 7: Jabber Event Interrupt */
#define LM3S_INTCS_ANEGCOMPIE (1 << 8) /* Bit 8: Auto-Negotiation Complete Interrupt Enable */
#define LM3S_INTCS_RFAULTIE (1 << 9) /* Bit 9: Remote Fault Interrupt Enable */
#define LM3S_INTCS_LSCHGIE (1 << 10) /* Bit 10: Link Status Change Interrupt Enable */
#define LM3S_INTCS_LPACKIE (1 << 11) /* Bit 11: LP Acknowledge Interrupt Enable */
#define LM3S_INTCS_PDFIE (1 << 12) /* Bit 12: Parallel Detection Fault Interrupt Enable */
#define LM3S_INTCS_PRXIE (1 << 13) /* Bit 13: Page Received Interrupt Enable */
#define LM3S_INTCS_RXERIE (1 << 14) /* Bit 14: Receive Error Interrupt Enable */
#define LM3S_INTCS_JABBERIE (1 << 15) /* Bit 15: Jabber Interrupt Enable */
#define LM_INTCS_ANEGCOMPINT (1 << 0) /* Bit 0: Auto-Negotiation Complete Interrupt */
#define LM_INTCS_RFAULTINT (1 << 1) /* Bit 1: Remote Fault Interrupt */
#define LM_INTCS_LSCHGINT (1 << 2) /* Bit 2: Link Status Change Interrupt */
#define LM_INTCS_LPACKINT (1 << 3) /* Bit 3: LP Acknowledge Interrupt */
#define LM_INTCS_PDFINT (1 << 4) /* Bit 4: Parallel Detection Fault Interrupt */
#define LM_INTCS_PRXINT (1 << 5) /* Bit 5: Page Receive Interrupt */
#define LM_INTCS_RXERINT (1 << 6) /* Bit 6: Receive Error Interrupt */
#define LM_INTCS_JABBERINT (1 << 7) /* Bit 7: Jabber Event Interrupt */
#define LM_INTCS_ANEGCOMPIE (1 << 8) /* Bit 8: Auto-Negotiation Complete Interrupt Enable */
#define LM_INTCS_RFAULTIE (1 << 9) /* Bit 9: Remote Fault Interrupt Enable */
#define LM_INTCS_LSCHGIE (1 << 10) /* Bit 10: Link Status Change Interrupt Enable */
#define LM_INTCS_LPACKIE (1 << 11) /* Bit 11: LP Acknowledge Interrupt Enable */
#define LM_INTCS_PDFIE (1 << 12) /* Bit 12: Parallel Detection Fault Interrupt Enable */
#define LM_INTCS_PRXIE (1 << 13) /* Bit 13: Page Received Interrupt Enable */
#define LM_INTCS_RXERIE (1 << 14) /* Bit 14: Receive Error Interrupt Enable */
#define LM_INTCS_JABBERIE (1 << 15) /* Bit 15: Jabber Interrupt Enable */
/* LM3S6918 Diagnostic, address 0x12 */
#define LM3S_DIAGNOSTIC_RX_LOCK (1 << 8) /* Bit 8: Receive PLL Lock */
#define LM3S_DIAGNOSTIC_RXSD (1 << 9) /* Bit 9: Receive Detection */
#define LM3S_DIAGNOSTIC_RATE (1 << 10) /* Bit 10: Rate */
#define LM3S_DIAGNOSTIC_DPLX (1 << 11) /* Bit 11: Duplex Mode */
#define LM3S_DIAGNOSTIC_ANEGF (1 << 12) /* Bit 12: Auto-Negotiation Failure */
#define LM_DIAGNOSTIC_RX_LOCK (1 << 8) /* Bit 8: Receive PLL Lock */
#define LM_DIAGNOSTIC_RXSD (1 << 9) /* Bit 9: Receive Detection */
#define LM_DIAGNOSTIC_RATE (1 << 10) /* Bit 10: Rate */
#define LM_DIAGNOSTIC_DPLX (1 << 11) /* Bit 11: Duplex Mode */
#define LM_DIAGNOSTIC_ANEGF (1 << 12) /* Bit 12: Auto-Negotiation Failure */
/* LM3S6918 Transceiver Control, address 0x13 */
#define LM3S_XCVRCONTROL_TXO_SHIFT 14 /* Bits 15-14: Transmit Amplitude Selection */
#define LM3S_XCVRCONTROL_TXO_MASK (3 << LM3S_XCVRCONTROL_TXO_SHIFT)
#define LM3S_XCVRCONTROL_TXO_00DB (0 << LM3S_XCVRCONTROL_TXO_SHIFT) /* Gain 0.0dB of insertion loss */
#define LM3S_XCVRCONTROL_TXO_04DB (1 << LM3S_XCVRCONTROL_TXO_SHIFT) /* Gain 0.4dB of insertion loss */
#define LM3S_XCVRCONTROL_TXO_08DB (2 << LM3S_XCVRCONTROL_TXO_SHIFT) /* Gain 0.8dB of insertion loss */
#define LM3S_XCVRCONTROL_TXO_12DB (3 << LM3S_XCVRCONTROL_TXO_SHIFT) /* Gain 1.2dB of insertion loss */
#define LM_XCVRCONTROL_TXO_SHIFT 14 /* Bits 15-14: Transmit Amplitude Selection */
#define LM_XCVRCONTROL_TXO_MASK (3 << LM_XCVRCONTROL_TXO_SHIFT)
#define LM_XCVRCONTROL_TXO_00DB (0 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 0.0dB of insertion loss */
#define LM_XCVRCONTROL_TXO_04DB (1 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 0.4dB of insertion loss */
#define LM_XCVRCONTROL_TXO_08DB (2 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 0.8dB of insertion loss */
#define LM_XCVRCONTROL_TXO_12DB (3 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 1.2dB of insertion loss */
/* LM3S6918 LED Configuration, address 0x17 */
#define LM3S_LEDCONFIG_LED0_SHIFT (0) /* Bits 3-0: LED0 Source */
#define LM3S_LEDCONFIG_LED0_MASK (0x0f << LM3S_LEDCONFIG_LED0_SHIFT)
#define LM3S_LEDCONFIG_LED0_LINKOK (0 << LM3S_LEDCONFIG_LED0_SHIFT) /* Link OK */
#define LM3S_LEDCONFIG_LED0_RXTX (1 << LM3S_LEDCONFIG_LED0_SHIFT) /* RX or TX activity */
#define LM3S_LEDCONFIG_LED0_100BASET (5 << LM3S_LEDCONFIG_LED0_SHIFT) /* 100BASE-TX mode */
#define LM3S_LEDCONFIG_LED0_10BASET (6 << LM3S_LEDCONFIG_LED0_SHIFT) /* 10BASE-T mode */
#define LM3S_LEDCONFIG_LED0_FDUPLEX (7 << LM3S_LEDCONFIG_LED0_SHIFT) /* Full duplex */
#define LM3S_LEDCONFIG_LED0_OKRXTX (8 << LM3S_LEDCONFIG_LED0_SHIFT) /* Full duplex */
#define LM3S_LEDCONFIG_LED1_SHIFT (4) /* Bits 7-4: LED1 Source */
#define LM3S_LEDCONFIG_LED1_MASK (0x0f << LM3S_LEDCONFIG_LED1_SHIFT)
#define LM3S_LEDCONFIG_LED1_LINKOK (0 << LM3S_LEDCONFIG_LED1_SHIFT) /* Link OK */
#define LM3S_LEDCONFIG_LED1_RXTX (1 << LM3S_LEDCONFIG_LED1_SHIFT) /* RX or TX activity */
#define LM3S_LEDCONFIG_LED1_100BASET (5 << LM3S_LEDCONFIG_LED1_SHIFT) /* 100BASE-TX mode */
#define LM3S_LEDCONFIG_LED1_10BASET (6 << LM3S_LEDCONFIG_LED1_SHIFT) /* 10BASE-T mode */
#define LM3S_LEDCONFIG_LED1_FDUPLEX (7 << LM3S_LEDCONFIG_LED1_SHIFT) /* Full duplex */
#define LM3S_LEDCONFIG_LED1_OKRXTX (8 << LM3S_LEDCONFIG_LED1_SHIFT) /* Full duplex */
#define LM_LEDCONFIG_LED0_SHIFT (0) /* Bits 3-0: LED0 Source */
#define LM_LEDCONFIG_LED0_MASK (0x0f << LM_LEDCONFIG_LED0_SHIFT)
#define LM_LEDCONFIG_LED0_LINKOK (0 << LM_LEDCONFIG_LED0_SHIFT) /* Link OK */
#define LM_LEDCONFIG_LED0_RXTX (1 << LM_LEDCONFIG_LED0_SHIFT) /* RX or TX activity */
#define LM_LEDCONFIG_LED0_100BASET (5 << LM_LEDCONFIG_LED0_SHIFT) /* 100BASE-TX mode */
#define LM_LEDCONFIG_LED0_10BASET (6 << LM_LEDCONFIG_LED0_SHIFT) /* 10BASE-T mode */
#define LM_LEDCONFIG_LED0_FDUPLEX (7 << LM_LEDCONFIG_LED0_SHIFT) /* Full duplex */
#define LM_LEDCONFIG_LED0_OKRXTX (8 << LM_LEDCONFIG_LED0_SHIFT) /* Full duplex */
#define LM_LEDCONFIG_LED1_SHIFT (4) /* Bits 7-4: LED1 Source */
#define LM_LEDCONFIG_LED1_MASK (0x0f << LM_LEDCONFIG_LED1_SHIFT)
#define LM_LEDCONFIG_LED1_LINKOK (0 << LM_LEDCONFIG_LED1_SHIFT) /* Link OK */
#define LM_LEDCONFIG_LED1_RXTX (1 << LM_LEDCONFIG_LED1_SHIFT) /* RX or TX activity */
#define LM_LEDCONFIG_LED1_100BASET (5 << LM_LEDCONFIG_LED1_SHIFT) /* 100BASE-TX mode */
#define LM_LEDCONFIG_LED1_10BASET (6 << LM_LEDCONFIG_LED1_SHIFT) /* 10BASE-T mode */
#define LM_LEDCONFIG_LED1_FDUPLEX (7 << LM_LEDCONFIG_LED1_SHIFT) /* Full duplex */
#define LM_LEDCONFIG_LED1_OKRXTX (8 << LM_LEDCONFIG_LED1_SHIFT) /* Full duplex */
/* LM3S6918 MDI/MDIX Control, address 0x18 */
#define LM3S_MDICONTROL_MDIXSD_SHIFT (0) /* Bits 3-0: Auto-Switching Seed */
#define LM3S_MDICONTROL_MDIXSD_MASK (0x0f << LM3S_MDICONTROL_MDIXSD_SHIFT)
#define LM3S_MDICONTROL_MDIXCM (1 << 4) /* Bit 4: Auto-Switching Complete */
#define LM3S_MDICONTROL_MDIX (1 << 5) /* Bit 5: Auto-Switching Configuration */
#define LM3S_MDICONTROL_AUTOSW (1 << 6) /* Bit 6: Auto-Switching Enable */
#define LM3S_MDICONTROL_PDMODE (1 << 7) /* Bit 7: Parallel Detection Mode */
#define LM_MDICONTROL_MDIXSD_SHIFT (0) /* Bits 3-0: Auto-Switching Seed */
#define LM_MDICONTROL_MDIXSD_MASK (0x0f << LM_MDICONTROL_MDIXSD_SHIFT)
#define LM_MDICONTROL_MDIXCM (1 << 4) /* Bit 4: Auto-Switching Complete */
#define LM_MDICONTROL_MDIX (1 << 5) /* Bit 5: Auto-Switching Configuration */
#define LM_MDICONTROL_AUTOSW (1 << 6) /* Bit 6: Auto-Switching Enable */
#define LM_MDICONTROL_PDMODE (1 << 7) /* Bit 7: Parallel Detection Mode */
/* KS8921-specific register bit settings ************************************/
/* KS8921 MII Control register bit definitions (not in 802.3) */
@@ -430,26 +430,26 @@
/* KS8921 10BASE-TX PHY control register */
#define KS8721_10BTCR_BIT0 (1 << 0) /* Bit 0: xxx */
#define KS8721_10BTCR_BIT1 (1 << 1) /* Bit 1: xxx */
#define KS8721_10BTCR_MODE_SHIFT (2) /* Bits 2-4: Operation Mode Indication */
#define KS8721_10BTCR_MODE_MASK (7 << KS8721_10BTCR_MODE_SHIFT)
# define KS8721_10BTCR_MODE_ANEG (0 << KS8721_10BTCR_MODE_SHIFT) /* Still in auto-negotiation */
# define KS8721_10BTCR_MODE_10BTHD (1 << KS8721_10BTCR_MODE_SHIFT) /* 10BASE-T half-duplex */
# define KS8721_10BTCR_MODE_100BTHD (2 << KS8721_10BTCR_MODE_SHIFT) /* 100BASE_t half-duplex */
# define KS8721_10BTCR_MODE_DEFAULT (3 << KS8721_10BTCR_MODE_SHIFT) /* Default */
# define KS8721_10BTCR_MODE_10BTFD (5 << KS8721_10BTCR_MODE_SHIFT) /* 10BASE-T full duplex */
# define KS8721_10BTCR_MODE_100BTFD (6 << KS8721_10BTCR_MODE_SHIFT) /* 100BASE-T full duplex */
# define KS8721_10BTCR_MODE_ISOLATE (7 << KS8721_10BTCR_MODE_SHIFT) /* PHY/MII isolate */
#define KS8721_10BTCR_ISOLATE (1 << 5) /* Bit 5: PHY isolate */
#define KS8721_10BTCR_PAUSE (1 << 6) /* Bit 6: Enable pause */
#define KS8721_10BTCR_ANEGCOMP (1 << 7) /* Bit 7: Auto-negotiation complete */
#define KS8721_10BTCR_JABBERE (1 << 8) /* Bit 8: Enable Jabber */
#define KS8721_10BTCR_INTLVL (1 << 9) /* Bit 9: Interrupt level */
#define KS8721_10BTCR_POWER (1 << 10) /* Bit 10: Power saving */
#define KS8721_10BTCR_FORCE (1 << 11) /* Bit 11: Force link */
#define KS8721_10BTCR_ENERGY (1 << 12) /* Bit 12: Energy detect */
#define KS8721_10BTCR_PAIRSWAPD (1 << 13) /* Bit 13: Pairswap disable */
#define KS8721_10BTCR_BIT0 (1 << 0) /* Bit 0: xxx */
#define KS8721_10BTCR_BIT1 (1 << 1) /* Bit 1: xxx */
#define KS8721_10BTCR_MODE_SHIFT (2) /* Bits 2-4: Operation Mode Indication */
#define KS8721_10BTCR_MODE_MASK (7 << KS8721_10BTCR_MODE_SHIFT)
# define KS8721_10BTCR_MODE_ANEG (0 << KS8721_10BTCR_MODE_SHIFT) /* Still in auto-negotiation */
# define KS8721_10BTCR_MODE_10BTHD (1 << KS8721_10BTCR_MODE_SHIFT) /* 10BASE-T half-duplex */
# define KS8721_10BTCR_MODE_100BTHD (2 << KS8721_10BTCR_MODE_SHIFT) /* 100BASE_t half-duplex */
# define KS8721_10BTCR_MODE_DEFAULT (3 << KS8721_10BTCR_MODE_SHIFT) /* Default */
# define KS8721_10BTCR_MODE_10BTFD (5 << KS8721_10BTCR_MODE_SHIFT) /* 10BASE-T full duplex */
# define KS8721_10BTCR_MODE_100BTFD (6 << KS8721_10BTCR_MODE_SHIFT) /* 100BASE-T full duplex */
# define KS8721_10BTCR_MODE_ISOLATE (7 << KS8721_10BTCR_MODE_SHIFT) /* PHY/MII isolate */
#define KS8721_10BTCR_ISOLATE (1 << 5) /* Bit 5: PHY isolate */
#define KS8721_10BTCR_PAUSE (1 << 6) /* Bit 6: Enable pause */
#define KS8721_10BTCR_ANEGCOMP (1 << 7) /* Bit 7: Auto-negotiation complete */
#define KS8721_10BTCR_JABBERE (1 << 8) /* Bit 8: Enable Jabber */
#define KS8721_10BTCR_INTLVL (1 << 9) /* Bit 9: Interrupt level */
#define KS8721_10BTCR_POWER (1 << 10) /* Bit 10: Power saving */
#define KS8721_10BTCR_FORCE (1 << 11) /* Bit 11: Force link */
#define KS8721_10BTCR_ENERGY (1 << 12) /* Bit 12: Energy detect */
#define KS8721_10BTCR_PAIRSWAPD (1 << 13) /* Bit 13: Pairswap disable */
/****************************************************************************
* Type Definitions
+11
View File
@@ -113,6 +113,11 @@
#elif defined(CONFIG_NXFONT_SERIF38X49B)
# define NXFONT_DEFAULT FONTID_SERIF38X49B
/* Mono-space fonts */
#elif defined(CONFIG_NXFONT_MONO5X8)
# define NXFONT_DEFAULT FONTID_MONO5X8
#endif
/****************************************************************************
@@ -125,6 +130,12 @@ enum nx_fontid_e
{
FONTID_DEFAULT = 0 /* The default font */
/* Monospace fonts */
#ifdef CONFIG_NXFONT_MONO5X8
, FONTID_MONO5X8 = 18 /* The 5x8 monospace font */
#endif
/* Sans Serif fonts */
#ifdef CONFIG_NXFONT_SANS17X22
+2 -2
View File
@@ -99,7 +99,7 @@ uint16_t up_progmem_pagesize(uint16_t page);
* Address to page conversion
*
* Input Parameters:
* addr - Address without flash offet (aligned to page0)
* addr - Address with of without flash offset (absolute or aligned to page0)
*
* Returned Value:
* Page or negative value on error. The following errors are reported
@@ -165,7 +165,7 @@ int up_progmem_ispageerased(uint16_t page);
* the address be aligned inside the page boundaries.
*
* Input Parameters:
* addr - Address without flash offet (aligned to page0)
* addr - Address with or without flash offset (absolute or aligned to page0)
* buf - Pointer to buffer
* count - Number of bytes to write *
*
+32 -2
View File
@@ -1,7 +1,7 @@
/********************************************************************************
* include/nuttx/sched.h
*
* Copyright (C) 2007-2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -202,6 +202,10 @@ struct _TCB
/* Task Management Fields *****************************************************/
pid_t pid; /* This is the ID of the thread */
#ifdef CONFIG_SCHED_HAVE_PARENT
pid_t parent; /* This is the ID of the parent thread */
uint16_t nchildren; /* This is the number active children */
#endif
start_t start; /* Thread start function */
entry_t entry; /* Entry Point into the thread */
@@ -223,7 +227,7 @@ struct _TCB
# endif
#endif
#ifdef CONFIG_SCHED_WAITPID
#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT)
sem_t exitsem; /* Support for waitpid */
int *stat_loc; /* Location to return exit status */
#endif
@@ -382,6 +386,32 @@ EXTERN FAR struct streamlist *sched_getstreams(void);
EXTERN FAR struct socketlist *sched_getsockets(void);
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
/* Internal vfork support.The overall sequence is:
*
* 1) User code calls vfork(). vfork() is provided in architecture-specific
* code.
* 2) vfork()and calls task_vforksetup().
* 3) task_vforksetup() allocates and configures the child task's TCB. This
* consists of:
* - Allocation of the child task's TCB.
* - Initialization of file descriptors and streams
* - Configuration of environment variables
* - Setup the intput parameters for the task.
* - Initialization of the TCB (including call to up_initial_state()
* 4) vfork() provides any additional operating context. vfork must:
* - Allocate and initialize the stack
* - Initialize special values in any CPU registers that were not
* already configured by up_initial_state()
* 5) vfork() then calls task_vforkstart()
* 6) task_vforkstart() then executes the child thread.
*
* task_vforkabort() may be called if an error occurs between steps 3 and 6.
*/
FAR _TCB *task_vforksetup(start_t retaddr);
pid_t task_vforkstart(FAR _TCB *child);
void task_vforkabort(FAR _TCB *child, int errcode);
/* sched_foreach will enumerate over each task and provide the
* TCB of each task to a user callback functions. Interrupts
* will be disabled throughout this enumeration!
+1 -1
View File
@@ -619,7 +619,7 @@
#define USBHID_KBDUSE_RCTRL 0xe4 /* Keyboard RightControl */
#define USBHID_KBDUSE_RSHIFT 0xe5 /* Keyboard RightShift */
#define USBHID_KBDUSE_RALT 0xe6 /* Keyboard RightAlt */
#define USBHID_KBDUSE_RGUI 0xe7 /* Keyboard Right GUI*/
#define USBHID_KBDUSE_RGUI 0xe7 /* Keyboard Right GUI */
#define USBHID_KBDUSE_MAX 0xe7
+1 -1
View File
@@ -68,7 +68,7 @@
* CONFIG_SCHED_WORKSTACKSIZE - The stack size allocated for the worker
* thread. Default: CONFIG_IDLETHREAD_STACKSIZE.
* CONFIG_SIG_SIGWORK - The signal number that will be used to wake-up
* the worker thread. Default: 4
* the worker thread. Default: 17
*
* CONFIG_SCHED_LPWORK. If CONFIG_SCHED_WORKQUEUE is defined, then a single
* work queue is created by default. If CONFIG_SCHED_LPWORK is also defined
+78 -74
View File
@@ -41,15 +41,17 @@
********************************************************************************/
#include <nuttx/config.h> /* Default settings */
#include <nuttx/compiler.h> /* Compiler settings */
#include <nuttx/compiler.h> /* Compiler settings, noreturn_function */
#include <sys/types.h> /* Needed for general types */
#include <sys/prctl.h> /* Needed by pthread_[set|get]name_np */
#include <stdint.h> /* C99 fixed width integer types */
#include <stdbool.h> /* C99 boolean types */
#include <unistd.h> /* For getpid */
#include <semaphore.h> /* Needed for sem_t */
#include <signal.h> /* Needed for sigset_t */
#include <time.h> /* Needed for struct timespec */
#include <nuttx/compiler.h> /* For noreturn_function */
/********************************************************************************
* Compilation Switches
@@ -58,10 +60,11 @@
/* Standard POSIX switches */
#ifndef _POSIX_THREADS
#define _POSIX_THREADS
# define _POSIX_THREADS
#endif
#ifndef _POSIX_THREAD_ATTR_STACKSIZE
#define _POSIX_THREAD_ATTR_STACKSIZE
# define _POSIX_THREAD_ATTR_STACKSIZE
#endif
/********************************************************************************
@@ -153,10 +156,8 @@
********************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
extern "C"
{
#endif
/* pthread-specific types */
@@ -245,28 +246,29 @@ struct sched_param; /* Defined in sched.h */
* the individual attributes used by a given implementation.
*/
EXTERN int pthread_attr_init(FAR pthread_attr_t *attr);
int pthread_attr_init(FAR pthread_attr_t *attr);
/* An attributes object can be deleted when it is no longer needed. */
EXTERN int pthread_attr_destroy(pthread_attr_t *attr);
int pthread_attr_destroy(pthread_attr_t *attr);
/* Set or obtain the default scheduling algorithm */
EXTERN int pthread_attr_setschedpolicy(FAR pthread_attr_t *attr, int policy);
EXTERN int pthread_attr_getschedpolicy(FAR pthread_attr_t *attr, int *policy);
EXTERN int pthread_attr_setschedparam(FAR pthread_attr_t *attr,
FAR const struct sched_param *param);
EXTERN int pthread_attr_getschedparam(FAR pthread_attr_t *attr,
FAR struct sched_param *param);
EXTERN int pthread_attr_setinheritsched(FAR pthread_attr_t *attr, int inheritsched);
EXTERN int pthread_attr_getinheritsched(FAR const pthread_attr_t *attr,
FAR int *inheritsched);
int pthread_attr_setschedpolicy(FAR pthread_attr_t *attr, int policy);
int pthread_attr_getschedpolicy(FAR pthread_attr_t *attr, int *policy);
int pthread_attr_setschedparam(FAR pthread_attr_t *attr,
FAR const struct sched_param *param);
int pthread_attr_getschedparam(FAR pthread_attr_t *attr,
FAR struct sched_param *param);
int pthread_attr_setinheritsched(FAR pthread_attr_t *attr,
int inheritsched);
int pthread_attr_getinheritsched(FAR const pthread_attr_t *attr,
FAR int *inheritsched);
/* Set or obtain the default stack size */
EXTERN int pthread_attr_setstacksize(FAR pthread_attr_t *attr, long stacksize);
EXTERN int pthread_attr_getstacksize(FAR pthread_attr_t *attr, long *stackaddr);
int pthread_attr_setstacksize(FAR pthread_attr_t *attr, long stacksize);
int pthread_attr_getstacksize(FAR pthread_attr_t *attr, long *stackaddr);
/* To create a thread object and runnable thread, a routine must be specified
* as the new thread's start routine. An argument may be passed to this
@@ -275,34 +277,33 @@ EXTERN int pthread_attr_getstacksize(FAR pthread_attr_t *attr, long *stackaddr);
* about the kind of thread being created.
*/
EXTERN int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
pthread_startroutine_t startroutine,
pthread_addr_t arg);
int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
pthread_startroutine_t startroutine, pthread_addr_t arg);
/* A thread object may be "detached" to specify that the return value and
* completion status will not be requested.
*/
EXTERN int pthread_detach(pthread_t thread);
int pthread_detach(pthread_t thread);
/* A thread may terminate it's own execution or the execution of another
* thread.
*/
EXTERN void pthread_exit(pthread_addr_t value) noreturn_function;
EXTERN int pthread_cancel(pthread_t thread);
EXTERN int pthread_setcancelstate(int state, FAR int *oldstate);
EXTERN void pthread_testcancel(void);
void pthread_exit(pthread_addr_t value) noreturn_function;
int pthread_cancel(pthread_t thread);
int pthread_setcancelstate(int state, FAR int *oldstate);
void pthread_testcancel(void);
/* A thread can await termination of another thread and retrieve the return
* value of the thread.
*/
EXTERN int pthread_join(pthread_t thread, FAR pthread_addr_t *value);
int pthread_join(pthread_t thread, FAR pthread_addr_t *value);
/* A thread may tell the scheduler that its processor can be made available. */
EXTERN void pthread_yield(void);
void pthread_yield(void);
/* A thread may obtain a copy of its own thread handle. */
@@ -314,91 +315,94 @@ EXTERN void pthread_yield(void);
/* Thread scheduling parameters */
EXTERN int pthread_getschedparam(pthread_t thread, FAR int *policy,
FAR struct sched_param *param);
EXTERN int pthread_setschedparam(pthread_t thread, int policy,
FAR const struct sched_param *param);
EXTERN int pthread_setschedprio(pthread_t thread, int prio);
int pthread_getschedparam(pthread_t thread, FAR int *policy,
FAR struct sched_param *param);
int pthread_setschedparam(pthread_t thread, int policy,
FAR const struct sched_param *param);
int pthread_setschedprio(pthread_t thread, int prio);
/* Thread-specific Data Interfaces */
EXTERN int pthread_key_create(FAR pthread_key_t *key,
CODE void (*destructor)(FAR void*));
EXTERN int pthread_setspecific(pthread_key_t key, FAR void *value);
EXTERN FAR void *pthread_getspecific(pthread_key_t key);
EXTERN int pthread_key_delete(pthread_key_t key);
int pthread_key_create(FAR pthread_key_t *key,
CODE void (*destructor)(FAR void*));
int pthread_setspecific(pthread_key_t key, FAR void *value);
FAR void *pthread_getspecific(pthread_key_t key);
int pthread_key_delete(pthread_key_t key);
/* Create, operate on, and destroy mutex attributes. */
EXTERN int pthread_mutexattr_init(FAR pthread_mutexattr_t *attr);
EXTERN int pthread_mutexattr_destroy(FAR pthread_mutexattr_t *attr);
EXTERN int pthread_mutexattr_getpshared(FAR pthread_mutexattr_t *attr, FAR int *pshared);
EXTERN int pthread_mutexattr_setpshared(FAR pthread_mutexattr_t *attr, int pshared);
int pthread_mutexattr_init(FAR pthread_mutexattr_t *attr);
int pthread_mutexattr_destroy(FAR pthread_mutexattr_t *attr);
int pthread_mutexattr_getpshared(FAR pthread_mutexattr_t *attr,
FAR int *pshared);
int pthread_mutexattr_setpshared(FAR pthread_mutexattr_t *attr,
int pshared);
#ifdef CONFIG_MUTEX_TYPES
EXTERN int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type);
EXTERN int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type);
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
#endif
/* The following routines create, delete, lock and unlock mutexes. */
EXTERN int pthread_mutex_init(FAR pthread_mutex_t *mutex, FAR pthread_mutexattr_t *attr);
EXTERN int pthread_mutex_destroy(FAR pthread_mutex_t *mutex);
EXTERN int pthread_mutex_lock(FAR pthread_mutex_t *mutex);
EXTERN int pthread_mutex_trylock(FAR pthread_mutex_t *mutex);
EXTERN int pthread_mutex_unlock(FAR pthread_mutex_t *mutex);
int pthread_mutex_init(FAR pthread_mutex_t *mutex,
FAR pthread_mutexattr_t *attr);
int pthread_mutex_destroy(FAR pthread_mutex_t *mutex);
int pthread_mutex_lock(FAR pthread_mutex_t *mutex);
int pthread_mutex_trylock(FAR pthread_mutex_t *mutex);
int pthread_mutex_unlock(FAR pthread_mutex_t *mutex);
/* Operations on condition variables */
EXTERN int pthread_condattr_init(FAR pthread_condattr_t *attr);
EXTERN int pthread_condattr_destroy(FAR pthread_condattr_t *attr);
int pthread_condattr_init(FAR pthread_condattr_t *attr);
int pthread_condattr_destroy(FAR pthread_condattr_t *attr);
/* A thread can create and delete condition variables. */
EXTERN int pthread_cond_init(FAR pthread_cond_t *cond, FAR pthread_condattr_t *attr);
EXTERN int pthread_cond_destroy(FAR pthread_cond_t *cond);
int pthread_cond_init(FAR pthread_cond_t *cond, FAR pthread_condattr_t *attr);
int pthread_cond_destroy(FAR pthread_cond_t *cond);
/* A thread can signal to and broadcast on a condition variable. */
EXTERN int pthread_cond_broadcast(FAR pthread_cond_t *cond);
EXTERN int pthread_cond_signal(FAR pthread_cond_t *cond);
int pthread_cond_broadcast(FAR pthread_cond_t *cond);
int pthread_cond_signal(FAR pthread_cond_t *cond);
/* A thread can wait for a condition variable to be signalled or broadcast. */
EXTERN int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex);
int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex);
/* A thread can perform a timed wait on a condition variable. */
EXTERN int pthread_cond_timedwait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex,
FAR const struct timespec *abstime);
int pthread_cond_timedwait(FAR pthread_cond_t *cond,
FAR pthread_mutex_t *mutex,
FAR const struct timespec *abstime);
/* Barrier attributes */
EXTERN int pthread_barrierattr_destroy(FAR pthread_barrierattr_t *attr);
EXTERN int pthread_barrierattr_init(FAR pthread_barrierattr_t *attr);
EXTERN int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr,
FAR int *pshared);
EXTERN int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr,
int pshared);
int pthread_barrierattr_destroy(FAR pthread_barrierattr_t *attr);
int pthread_barrierattr_init(FAR pthread_barrierattr_t *attr);
int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr,
FAR int *pshared);
int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr,
int pshared);
/* Barriers */
EXTERN int pthread_barrier_destroy(FAR pthread_barrier_t *barrier);
EXTERN int pthread_barrier_init(FAR pthread_barrier_t *barrier,
int pthread_barrier_destroy(FAR pthread_barrier_t *barrier);
int pthread_barrier_init(FAR pthread_barrier_t *barrier,
FAR const pthread_barrierattr_t *attr,
unsigned int count);
EXTERN int pthread_barrier_wait(FAR pthread_barrier_t *barrier);
int pthread_barrier_wait(FAR pthread_barrier_t *barrier);
/* Pthread initialization */
EXTERN int pthread_once(FAR pthread_once_t *once_control,
int pthread_once(FAR pthread_once_t *once_control,
CODE void (*init_routine)(void));
/* Pthread signal management APIs */
EXTERN int pthread_kill(pthread_t thread, int sig);
EXTERN int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);
int pthread_kill(pthread_t thread, int sig);
int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);
#undef EXTERN
#ifdef __cplusplus
}
#endif
+7 -3
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/semaphore.h
*
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -103,9 +103,13 @@ typedef struct sem_s sem_t;
/* Initializers */
#ifdef CONFIG_PRIORITY_INHERITANCE
# define SEM_INITIALIZER(c) {(c), SEMHOLDER_INITIALIZER}
# if CONFIG_SEM_PREALLOCHOLDERS > 0
# define SEM_INITIALIZER(c) {(c), NULL} /* semcount, hhead */
# else
# define SEM_INITIALIZER(c) {(c), SEMHOLDER_INITIALIZER} /* semcount, holder */
# endif
#else
# define SEM_INITIALIZER(c) {(c)}
# define SEM_INITIALIZER(c) {(c)} /* semcount */
#endif
/****************************************************************************
+45 -23
View File
@@ -66,44 +66,56 @@
/* A few of the real time signals are used within the OS. They have
* default values that can be overridden from the configuration file. The
* rest are all user signals:
* rest are all user signals.
*
* These are semi-standard signal definitions:
*/
#ifndef CONFIG_SIG_SIGUSR1
#define SIGUSR1 0 /* User signal 1 */
# define SIGUSR1 1 /* User signal 1 */
#else
#define SIGUSR1 CONFIG_SIG_SIGUSR1
# define SIGUSR1 CONFIG_SIG_SIGUSR1
#endif
#ifndef CONFIG_SIG_SIGUSR2
#define SIGUSR2 1 /* User signal 2 */
# define SIGUSR2 2 /* User signal 2 */
#else
#define SIGUSR2 CONFIG_SIG_SIGUSR2
# define SIGUSR2 CONFIG_SIG_SIGUSR2
#endif
#ifndef CONFIG_SIG_SIGALARM
#define SIGALRM 2 /* Default signal used with POSIX timers (used only */
# define SIGALRM 3 /* Default signal used with POSIX timers (used only */
/* no other signal is provided) */
#else
#define SIGALRM CONFIG_SIG_SIGALARM
# define SIGALRM CONFIG_SIG_SIGALARM
#endif
#ifndef CONFIG_DISABLE_PTHREAD
#ifndef CONFIG_SIG_SIGCONDTIMEDOUT
#define SIGCONDTIMEDOUT 3 /* Used in the implementation of pthread_cond_timedwait */
#else
#define SIGCONDTIMEDOUT CONFIG_SIG_SIGCONDTIMEDOUT
#ifdef CONFIG_SCHED_HAVE_PARENT
# ifndef CONFIG_SIG_SIGCHLD
# define SIGCHLD 4 /* Used by child threads to signal parent thread */
# else
# define SIGCHLD CONFIG_SIG_SIGCHLD
# endif
#endif
/* The following are non-standard signal definitions */
#ifndef CONFIG_DISABLE_PTHREAD
# ifndef CONFIG_SIG_SIGCONDTIMEDOUT
# define SIGCONDTIMEDOUT 16 /* Used in the implementation of pthread_cond_timedwait */
# else
# define SIGCONDTIMEDOUT CONFIG_SIG_SIGCONDTIMEDOUT
# endif
#endif
/* SIGWORK is used to wake up various internal, NuttX worker thread */
#if defined(CONFIG_SCHED_WORKQUEUE) || defined(CONFIG_PAGING)
#ifndef CONFIG_SIG_SIGWORK
#define SIGWORK 4 /* Used to wake up the work queue */
#else
#define SIGWORK CONFIG_SIG_SIGWORK
#endif
# ifndef CONFIG_SIG_SIGWORK
# define SIGWORK 17 /* Used to wake up the work queue */
# else
# define SIGWORK CONFIG_SIG_SIGWORK
# endif
#endif
/* sigprocmask() "how" definitions. Only one of the following can be specified: */
@@ -122,12 +134,18 @@
/* These are the possible values of the signfo si_code field */
#define SI_USER 0 /* Signal sent from kill, raise, or abort */
#define SI_QUEUE 1 /* Signal sent from sigqueue */
#define SI_TIMER 2 /* Signal is result of timer expiration */
#define SI_ASYNCIO 3 /* Signal is the result of asynch IO completion */
#define SI_MESGQ 4 /* Signal generated by arrival of a message on an */
/* empty message queue */
#define SI_USER 0 /* Signal sent from kill, raise, or abort */
#define SI_QUEUE 1 /* Signal sent from sigqueue */
#define SI_TIMER 2 /* Signal is result of timer expiration */
#define SI_ASYNCIO 3 /* Signal is the result of asynch IO completion */
#define SI_MESGQ 4 /* Signal generated by arrival of a message on an */
/* empty message queue */
#define CLD_EXITED 5 /* Child has exited (SIGCHLD only) */
#define CLD_KILLED 6 /* Child was killed (SIGCHLD only) */
#define CLD_DUMPED 7 /* Child terminated abnormally (SIGCHLD only) */
#define CLD_TRAPPED 8 /* Traced child has trapped (SIGCHLD only) */
#define CLD_STOPPED 9 /* Child has stopped (SIGCHLD only) */
#define CLD_CONTINUED 10 /* Stopped child had continued (SIGCHLD only) */
/* Values for the sigev_notify field of struct sigevent */
@@ -175,6 +193,10 @@ struct siginfo
uint8_t si_signo; /* Identifies signal */
uint8_t si_code; /* Source: SI_USER, SI_QUEUE, SI_TIMER, SI_ASYNCIO, or SI_MESGQ */
union sigval si_value; /* Data passed with signal */
#ifdef CONFIG_SCHED_HAVE_PARENT
pid_t si_pid; /* Sending task ID */
int si_status; /* Exit value or signal (SIGCHLD only). */
#endif
};
typedef struct siginfo siginfo_t;
+198
View File
@@ -0,0 +1,198 @@
/****************************************************************************
* include/spawn.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_SPAWN_H
#define __INCLUDE_SPAWN_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <signal.h>
#include <errno.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* "The spawn.h header shall define the flags that may be set in a
* posix_spawnattr_t object using the posix_spawnattr_setflags() function:"
*/
#define POSIX_SPAWN_RESETIDS (1 << 0) /* 1: Reset effective user ID */
#define POSIX_SPAWN_SETPGROUP (1 << 1) /* 1: Set process group */
#define POSIX_SPAWN_SETSCHEDPARAM (1 << 2) /* 1: Set task's priority */
#define POSIX_SPAWN_SETSCHEDULER (1 << 3) /* 1: Set task's scheduler policy */
#define POSIX_SPAWN_SETSIGDEF (1 << 4) /* 1: Set default signal actions */
#define POSIX_SPAWN_SETSIGMASK (1 << 5) /* 1: Set sigmask */
/****************************************************************************
* Type Definitions
****************************************************************************/
/* "The spawn.h header shall define the posix_spawnattr_t and
* posix_spawn_file_actions_t types used in performing spawn operations.
*
* The internal structure underlying the posix_spawnattr_t is exposed here
* because the user will be required to allocate this memory.
*/
struct posix_spawnattr_s
{
uint8_t flags;
uint8_t priority;
uint8_t policy;
#ifndef CONFIG_DISABLE_SIGNALS
sigset_t sigmask;
#endif
};
typedef struct posix_spawnattr_s posix_spawnattr_t;
/* posix_spawn_file_actions_addclose(), posix_spawn_file_actions_adddup2(),
* and posix_spawn_file_actions_addopen() will allocate memory and append
* a new file action to an instance of posix_spawn_file_actions_t. The
* internal representation of these structures is not exposed to the user.
* The user need only know that the size sizeof(posix_spawn_file_actions_t)
* will hold a pointer to data.
*/
typedef FAR void *posix_spawn_file_actions_t;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/* "The following shall be declared as functions and may also be defined as
* macros. Function prototypes shall be provided."
*/
#ifdef __cplusplus
extern "C"
{
#endif
/* posix_spawn[p] interfaces ************************************************/
#ifdef CONFIG_BINFMT_EXEPATH
int posix_spawnp(FAR pid_t *pid, FAR const char *path,
FAR const posix_spawn_file_actions_t *file_actions,
FAR const posix_spawnattr_t *attr,
FAR char *const argv[], FAR char *const envp[]);
#define posix_spawn(pid,path,file_actions,attr,argv,envp) \
posix_spawnp(pid,path,file_actions,attr,argv,envp)
#else
int posix_spawn(FAR pid_t *pid, FAR const char *path,
FAR const posix_spawn_file_actions_t *file_actions,
FAR const posix_spawnattr_t *attr,
FAR char *const argv[], FAR char *const envp[]);
#endif
/* File action interfaces ***************************************************/
/* File action initialization and destruction */
int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions);
int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_actions);
/* Add file action interfaces */
int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actions,
int fd);
int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_actions,
int fd1, int fd2);
int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *file_actions,
int fd, FAR const char *path, int oflags, mode_t mode);
/* Spawn attributes interfaces **********************************************/
/* Spawn attributes initialization and destruction */
int posix_spawnattr_init(FAR posix_spawnattr_t *attr);
/* int posix_spawnattr_destroy(FAR posix_spawnattr_t *); */
#ifdef CONFIG_DEBUG
# define posix_spawnattr_destroy(attr) (attr ? 0 : EINVAL)
#else
# define posix_spawnattr_destroy(attr) (0)
#endif
/* Get spawn attributes interfaces */
int posix_spawnattr_getflags(FAR const posix_spawnattr_t *attr, FAR short *flags);
#define posix_spawnattr_getpgroup(attr,group) (ENOSYS)
int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *attr,
FAR struct sched_param *param);
int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *attr,
FAR int *policy);
#define posix_spawnattr_getsigdefault(attr,sigdefault) (ENOSYS)
#ifndef CONFIG_DISABLE_SIGNALS
int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *attr,
FAR sigset_t *sigmask);
#else
# define posix_spawnattr_getsigmask(attr,sigmask) (ENOSYS)
#endif
/* Set spawn attributes interfaces */
int posix_spawnattr_setflags(FAR posix_spawnattr_t *attr, short flags);
#define posix_spawnattr_setpgroup(attr,group) (ENOSYS)
int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *attr,
FAR const struct sched_param *param);
int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *attr, int policy);
#define posix_spawnattr_setsigdefault(attr,sigdefault) (ENOSYS)
#ifndef CONFIG_DISABLE_SIGNALS
int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr,
FAR const sigset_t *sigmask);
#else
# define posix_spawnattr_setsigmask(attr,sigmask) (ENOSYS)
#endif
/* Non standard debug functions */
#ifdef CONFIG_DEBUG
void posix_spawn_file_actions_dump(FAR posix_spawn_file_actions_t *file_actions);
void posix_spawnattr_dump(FAR posix_spawnattr_t *attr);
#else
# define posix_spawn_file_actions_dump(fa)
# define posix_spawnattr_dump(a)
#endif
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_SPAWN_H */
+2 -2
View File
@@ -90,8 +90,8 @@
# define bool _Bool8
#endif
#define true 1
#define false 0
#define true (bool)1
#define false (bool)0
#define __bool_true_false_are_defined 1
+3 -1
View File
@@ -154,7 +154,9 @@ typedef uint16_t dev_t;
typedef uint16_t ino_t;
/* pid_t is used for process IDs and process group IDs */
/* pid_t is used for process IDs and process group IDs. It must be signed because
* negative PID values are used to represent invalid PIDs.
*/
typedef int pid_t;
+5 -5
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/sys/wait.h
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -66,7 +66,7 @@
#define WTERMSIG(s) (false) /* Return signal number that caused process to terminate */
/* The following symbolic constants are possible values for the options
* argument to waitpi(1) (1) and/or waitid() (2),
* argument to waitpid() (1) and/or waitid() (2),
*/
#define WCONTINUED (1 << 0) /* Status for child that has been continued (1)(2) */
@@ -104,9 +104,9 @@ extern "C" {
#define EXTERN extern
#endif
EXTERN pid_t wait(int *stat_loc);
EXTERN int waitid(idtype_t idtype, id_t id, siginfo_t *siginfo, int options);
EXTERN pid_t waitpid(pid_t pid, int *stat_loc, int options);
EXTERN pid_t wait(FAR int *stat_loc);
EXTERN int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options);
EXTERN pid_t waitpid(pid_t pid, FAR int *stat_loc, int options);
#undef EXTERN
#if defined(__cplusplus)
+15 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/unistd.h
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -129,6 +129,7 @@ EXTERN int optopt; /* unrecognized option character */
/* Task Control Interfaces */
EXTERN pid_t vfork(void);
EXTERN pid_t getpid(void);
EXTERN void _exit(int status) noreturn_function;
EXTERN unsigned int sleep(unsigned int seconds);
@@ -159,6 +160,19 @@ EXTERN FAR char *getcwd(FAR char *buf, size_t size);
EXTERN int unlink(FAR const char *pathname);
EXTERN int rmdir(FAR const char *pathname);
/* Execution of programs from files */
#ifdef CONFIG_LIBC_EXECFUNCS
EXTERN int execl(FAR const char *path, ...);
EXTERN int execv(FAR const char *path, FAR char *const argv[]);
/* Non-standard functions to manage symbol tables */
struct symtab_s; /* See include/nuttx/binfmt/symtab.h */
EXTERN void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols);
EXTERN void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols);
#endif
/* Other */
EXTERN int getopt(int argc, FAR char *const argv[], FAR const char *optstring);
+89
View File
@@ -3,6 +3,8 @@
# see misc/tools/kconfig-language.txt.
#
comment "Standard C Library Options"
config STDIO_BUFFER_SIZE
int "C STDIO buffer size"
default 64
@@ -69,6 +71,67 @@ config EOL_IS_EITHER_CRLF
endchoice
config LIBC_EXECFUNCS
bool "Enable exec[l|v] / posix_spawn() Support"
default n
depends on !BINFMT_DISABLE
---help---
Enable support for the exec[l|v] family of functions that can be
used to start other programs, terminating the current program and
the posix_spawn() familty of functions that can be used start other
programs without terminating the current program. The typical
usage of the exec[l|v] functions is (1) first call vfork() to create
a new thread, then (2) call exec[l|v] to replace the new thread with
a program from the file system.
NOTE 1: This two step process start is completely unnecessary in
NuttX and is provided only for compatibily with Unix systems. These
functions are essentially just wrapper functions that (1) call the
non-standard binfmt function 'exec', and then (2) exit(0). Since
the new thread will be terminated by the exec[l|v] call, it really
served no purpose other than to suport Unix compatility.
The posix_spawn() functions do not have this inefficiency.
NOTE 2: Support for exec[l|v] and posix_spawn() is conditional
because they require additional support for symbol tables that
will not be available in the typical system.
if LIBC_EXECFUNCS
config EXECFUNCS_SYMTAB
string "Symbol table used by exec[l|v]"
default "g_symtab"
---help---
The exec[l|v] and posix_spawn() functions are wrapper functions that
call the non-standard binfmt function 'exec'). The binfmt
function 'exec' needs to have (1) a symbol table that provides the
list of symbols exported by the base code, and (2) the number of
symbols in that table. This selection provides the name of that
symbol table.
config EXECFUNCS_NSYMBOLS
int "Number of Symbols in the Table"
default 0
---help---
The exec[l|v] and posix_spawn() functions are wrapper functions that
call the non-standard binfmt function 'exec'). The binfmt
function 'exec' needs to have (1) a symbol table that provides the
list of symbols exported by the base code, and (2) the number of
symbols in that table. This selection provides the number of
symbols in the symbol table.
config POSIX_SPAWN_STACKSIZE
int "posix_spawn Stack Size"
default 1024
---help---
If posix_spawn[p] uses I/O redirection options, then it will require
an intermediary/proxy task to muck with the file descriptors. This
configuration item specifies the stack size used for the proxy. Default:
1024 bytes.
endif
config LIBC_STRERROR
bool "Enable strerror"
default n
@@ -273,3 +336,29 @@ config ARCH_BZERO
of bzero().
endif
comment "Non-standard Helper Functions"
config LIB_KBDCODEC
bool "Keyboard CODEC"
default n
---help---
In NuttX, a keyboard/keypad driver is simply a character driver that
may have an (optional) encoding/decoding layer on the data returned
by the character driver. A keyboard may return simple text data
(alphabetic, numeric, and punctuaction) or control characters
(enter, control-C, etc.). We can think about this the normal
"in-band" keyboard data stream. However, in addition, most
keyboards support actions that cannot be represented as text data.
Such actions include things like cursor controls (home, up arrow,
page down, etc.), editing functions (insert, delete, etc.), volume
controls, (mute, volume up, etc.) and other special functions. We
can think about this as special, "out-of-band" keyboard commands.
In this case, some special encoding may be required to multiplex
the in-band text data and out-of-band command streams.
This option enables the functions that implement the encoding and
decoding of keyboard data. These are the interfaces prototyped in
include/nuttx/input/kbd_codec.h. While not correctly a part of
the C library, it is included here because the decoding side of this
interface must be accessible by end user programs.
+1
View File
@@ -57,6 +57,7 @@ include time/Make.defs
include libgen/Make.defs
include dirent/Make.defs
include termios/Make.defs
include spawn/Make.defs
include queue/Make.defs
include misc/Make.defs
+1 -1
View File
@@ -4,7 +4,7 @@
#
config LIBM
bool "Math library"
bool "Standard Math library"
default n
depends on !ARCH_MATH_H
---help---

Some files were not shown because too many files have changed in this diff Show More