From 529a1cf7339541eaee3d189a3b97d9c544ba7810 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 Mar 2011 18:31:26 +0000 Subject: apps/ update from Uros git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3392 42af7a65-404d-4744-a932-0658087f49c3 --- apps/Makefile | 34 +++--- apps/README.txt | 34 ++++-- apps/exec_nuttapp.c | 2 +- apps/free/Makefile | 103 ++++++++++++++++++ apps/free/README.txt | 6 ++ apps/free/free.c | 93 ++++++++++++++++ apps/ramtron/Makefile | 103 ++++++++++++++++++ apps/ramtron/README.txt | 7 ++ apps/ramtron/ramtron.c | 97 +++++++++++++++++ apps/sdcard/Makefile | 103 ++++++++++++++++++ apps/sdcard/README.txt | 7 ++ apps/sdcard/sdcard.c | 110 +++++++++++++++++++ nuttx/ChangeLog | 7 +- nuttx/Documentation/NuttX.html | 6 ++ nuttx/configs/vsn/include/board.h | 41 ++++++- nuttx/configs/vsn/include/nsh_romfsimg.h | 178 +++++++++++++++---------------- nuttx/configs/vsn/include/rcS.template | 4 + nuttx/configs/vsn/nsh/defconfig | 2 + nuttx/configs/vsn/src/Makefile | 2 +- nuttx/configs/vsn/src/README.txt | 10 -- nuttx/configs/vsn/src/nsh.c | 4 +- nuttx/configs/vsn/src/power.c | 4 +- nuttx/configs/vsn/src/sysclock.c | 8 +- nuttx/examples/nsh/nsh.h | 10 -- nuttx/examples/nsh/nsh_apps.c | 2 +- nuttx/examples/nsh/nsh_main.c | 3 +- nuttx/include/apps/apps.h | 135 +++++++++++++++++++++++ nuttx/include/apps/nsh.h | 91 ++++++++++++++++ nuttx/include/nuttx/nuttapp.h | 139 ------------------------ nuttx/sched/os_bringup.c | 25 ++++- 30 files changed, 1074 insertions(+), 296 deletions(-) create mode 100644 apps/free/Makefile create mode 100644 apps/free/README.txt create mode 100644 apps/free/free.c create mode 100644 apps/ramtron/Makefile create mode 100644 apps/ramtron/README.txt create mode 100644 apps/ramtron/ramtron.c create mode 100644 apps/sdcard/Makefile create mode 100644 apps/sdcard/README.txt create mode 100644 apps/sdcard/sdcard.c create mode 100644 nuttx/include/apps/apps.h create mode 100644 nuttx/include/apps/nsh.h delete mode 100644 nuttx/include/nuttx/nuttapp.h diff --git a/apps/Makefile b/apps/Makefile index 6622932a0..11d06217b 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -47,25 +47,17 @@ endif BUILTIN_APPS_BUILT = BUILTIN_APPS_DIR = -ifeq ($(CONFIG_BUILTIN_APPS_NUTTX),y) +ifeq ($(CONFIG_BUILTIN_APPS),y) -# BUILTIN_APPS is the list of all configured built-in directories/built action +# CONFIGURED_APPS is the list of all configured built-in directories/built action +# It is created by the configured appconfig file (a copy of which appears in this +# directoy as .config) -BUILTIN_APPS = +CONFIGURED_APPS = +-include .config -ifeq ($(CONFIG_BUILTIN_APPS_HELLO),y) -BUILTIN_APPS += hello/.built_always -endif - -ifeq ($(CONFIG_BUILTIN_APPS_POWEROFF),y) -BUILTIN_APPS += poweroff/.built_always -endif - -ifeq ($(CONFIG_BUILTIN_APPS_JVM),y) -BUILTIN_APPS += jvm/.built_always -endif - -# AVAILABLE_APPS is the list of currently available application directories +# AVAILABLE_APPS is the list of currently available application directories. It +# is the same as CONFIGURED_APPS, but filtered to exclude any non-existent apps AVAILABLE_APPS = @@ -78,12 +70,14 @@ BUILTIN_APPS_DIR += ${shell echo $1 | cut -d'/' -f1} endef define BUILTIN_ADD_BUILT -BUILTIN_APPS_BUILT += ${shell echo $1 | cut -d'/' -f2} +BUILTIN_APPS_BUILT += $1 endef -# Create the list of applications to build +# (1) Create the list of available applications (AVAILABLE_APPS), (2) Add each +# available app to the list of to build (BUILTIN_APPS_DIR), and (3) Add the +# "built" indication for each app (BUILTIN_APPS_BUILT). -$(foreach BUILTIN, $(BUILTIN_APPS), $(eval $(call ADD_AVAILABLE,$(BUILTIN)))) +$(foreach BUILTIN, $(CONFIGURED_APPS), $(eval $(call ADD_AVAILABLE,$(BUILTIN)))) $(foreach APP, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_APP,$(APP)))) $(foreach BUILT, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_BUILT,$(BUILT)))) @@ -91,7 +85,6 @@ $(foreach BUILT, $(AVAILABLE_APPS), $(eval $(call BUILTIN_ADD_BUILT,$(BUILT)))) endif - ROOTDEPPATH = --dep-path . ASRCS = CSRCS = exec_nuttapp.c @@ -142,6 +135,7 @@ clean: $(call CLEAN) distclean: clean + @rm -r .config @rm -f Make.dep .depend @rm -f exec_nuttapp_list.h @rm -f exec_nuttapp_proto.h diff --git a/apps/README.txt b/apps/README.txt index 1eda70f9a..272addcb1 100644 --- a/apps/README.txt +++ b/apps/README.txt @@ -1,4 +1,3 @@ - Application Folder ================== @@ -6,27 +5,42 @@ This folder provides various applications found in sub-directories. Application entry points with their requirements are gathered together in in two files: + - exec_nuttapp_proto.h Entry points, prototype function - exec_nuttapp_list.h Application specific information and requirements Information is collected during the make .depend process. To execute an application function: - exec_nuttapp() is defined in the include/nuttx/nuttapp.h + + exec_nuttapp() is defined in the nuttx/include/apps/apps.h NuttShell provides transparent method of invoking the command, when the following option is enabled: + CONFIG_EXAMPLES_NSH_BUILTIN_APPS=y -To select which application to be included in the build process set your -preferences in the nuttx/.config file as: +in the NuttX configuration. + +A special configuration file is used to configure which applications +are to be included in the build. This file is configs///appconfig. +The existence of the appconfig file in the board configuration directory +is sufficient to enable building of applications. + +The appconfig file is copied into the apps/ directory as .config when +NuttX is configured. .config is included in the toplevel apps/Makefile. +As a minimum, this configuration file must define files to add to the +CONFIGURED_APPS list like: + + CONFIGURED_APPS += hello/.built_always poweroff/.built_always jvm/.built_always + +The form of each entry is / when: + + is the name of a subdirectory in the apps directory, and + + is a make dependency. This will be "touch"-ed each time + that the sub-directory is rebuilt. -To include applications under the nuttx apps directory: - CONFIG_BUILTIN_APPS_NUTTX=y/n - -where each application can be controlled as: - CONFIG_BUILTIN_APPS_=y/n - When the user defines an option: CONFIG_BUILTIN_APP_START= diff --git a/apps/exec_nuttapp.c b/apps/exec_nuttapp.c index 84e592256..d688a0669 100644 --- a/apps/exec_nuttapp.c +++ b/apps/exec_nuttapp.c @@ -38,7 +38,7 @@ ****************************************************************************/ #include -#include +#include #include #include diff --git a/apps/free/Makefile b/apps/free/Makefile new file mode 100644 index 000000000..33b2c564c --- /dev/null +++ b/apps/free/Makefile @@ -0,0 +1,103 @@ +############################################################################ +# Makefile +# +# Copyright (C) 2011 Uros Platise. All rights reserved. +# Author: Uros Platise +# Gregory Nutt +# +# 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. +# +############################################################################ + +# TODO, this makefile should run make under the app dirs, instead of +# sourcing the Make.defs! + +-include $(TOPDIR)/Make.defs +include ../Make.defs + +ifeq ($(WINTOOL),y) +INCDIROPT = -w +endif + +# Hello Application +# TODO: appname can be automatically extracted from the directory name + +APPNAME = free +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 768 + +ASRCS = +CSRCS = free.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +BIN = ../libapps$(LIBEXT) + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +$(BIN): $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $@, $${obj}); \ + done ; ) + @touch .built + +.built: $(BIN) + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) \ + $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ + +# Register application +depend: .depend + +clean: + @rm -f $(BIN) *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/free/README.txt b/apps/free/README.txt new file mode 100644 index 000000000..dd92a94ae --- /dev/null +++ b/apps/free/README.txt @@ -0,0 +1,6 @@ + +This application provides UNIX style memory free information. + + Source: NuttX + Author: Gregory Nutt + Date: 17. March 2011 diff --git a/apps/free/free.c b/apps/free/free.c new file mode 100644 index 000000000..fa5288cdd --- /dev/null +++ b/apps/free/free.c @@ -0,0 +1,93 @@ +/**************************************************************************** + * free/free.c + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 + +#include +#include + + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: cmd_free + ****************************************************************************/ + +int free_main(int argc, char **argv) +{ + struct mallinfo mem; + +#ifdef CONFIG_CAN_PASS_STRUCTS + mem = mallinfo(); +#else + (void)mallinfo(&mem); +#endif + + printf(" total used free largest\n"); + printf("Mem: %11d%11d%11d%11d\n", + mem.arena, mem.uordblks, mem.fordblks, mem.mxordblk); + + return OK; +} diff --git a/apps/ramtron/Makefile b/apps/ramtron/Makefile new file mode 100644 index 000000000..d2430f747 --- /dev/null +++ b/apps/ramtron/Makefile @@ -0,0 +1,103 @@ +############################################################################ +# Makefile +# +# Copyright (C) 2011 Uros Platise. All rights reserved. +# Author: Uros Platise +# Gregory Nutt +# +# 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. +# +############################################################################ + +# TODO, this makefile should run make under the app dirs, instead of +# sourcing the Make.defs! + +-include $(TOPDIR)/Make.defs +include ../Make.defs + +ifeq ($(WINTOOL),y) +INCDIROPT = -w +endif + +# Hello Application +# TODO: appname can be automatically extracted from the directory name + +APPNAME = ramtron +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 1024 + +ASRCS = +CSRCS = ramtron.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +BIN = ../libapps$(LIBEXT) + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +$(BIN): $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $@, $${obj}); \ + done ; ) + @touch .built + +.built: $(BIN) + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) \ + $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ + +# Register application +depend: .depend + +clean: + @rm -f $(BIN) *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/ramtron/README.txt b/apps/ramtron/README.txt new file mode 100644 index 000000000..152774b66 --- /dev/null +++ b/apps/ramtron/README.txt @@ -0,0 +1,7 @@ + +This application provides RAMTRON tool/lib to start, stop or to perform +RAMTRON custom operations. + + Source: NuttX + Author: Uros Platise + Date: 18. March 2011 diff --git a/apps/ramtron/ramtron.c b/apps/ramtron/ramtron.c new file mode 100644 index 000000000..323a42247 --- /dev/null +++ b/apps/ramtron/ramtron.c @@ -0,0 +1,97 @@ +/**************************************************************************** + * ramtron/ramtron.c + * + * Copyright (C) 2011 Uros Platise. All rights reserved. + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * + * Authors: Uros Platise + * Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include +#include + + +int ramtron_start(int spino) +{ + FAR struct spi_dev_s *spi; + FAR struct mtd_dev_s *mtd; + int retval; + + /* Get the SPI port */ + + spi = up_spiinitialize(spino); + if (!spi) + { + printf("RAMTRON: Failed to initialize SPI%d\n", spino); + return -ENODEV; + } + printf("RAMTRON: Initialized SPI%d\n", spino); + + mtd = (struct mtd_dev_s *)ramtron_initialize(spi); + if (!mtd) + { + printf("RAMTRON: Device not found\n"); + return -ENODEV; + } + printf("RAMTRON: FM25V10 of size 128 kB\n"); + //printf("RAMTRON: %s of size %d B\n", ramtron_getpart(mtd), ramtron_getsize(mtd) ); + + retval = ftl_initialize(0, NULL, mtd); + printf("RAMTRON: FTL Initialized (returns with %d)\n", retval); + + return OK; +} + + +int ramtron_main(int argc, char *argv[]) +{ + int spino; + + if (argc == 3) { + spino = atoi(argv[2]); + + if (!strcmp(argv[1], "start")) { + return ramtron_start(spino); + } + } + + // todo: write protect + printf("%s: \n", argv[0]); + return -1; +} diff --git a/apps/sdcard/Makefile b/apps/sdcard/Makefile new file mode 100644 index 000000000..9df8cbe98 --- /dev/null +++ b/apps/sdcard/Makefile @@ -0,0 +1,103 @@ +############################################################################ +# Makefile +# +# Copyright (C) 2011 Uros Platise. All rights reserved. +# Author: Uros Platise +# Gregory Nutt +# +# 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. +# +############################################################################ + +# TODO, this makefile should run make under the app dirs, instead of +# sourcing the Make.defs! + +-include $(TOPDIR)/Make.defs +include ../Make.defs + +ifeq ($(WINTOOL),y) +INCDIROPT = -w +endif + +# Hello Application +# TODO: appname can be automatically extracted from the directory name + +APPNAME = sdcard +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 1024 + +ASRCS = +CSRCS = sdcard.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +BIN = ../libapps$(LIBEXT) + +ROOTDEPPATH = --dep-path . + +# Common build + +VPATH = + +all: .built + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +$(BIN): $(OBJS) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $@, $${obj}); \ + done ; ) + @touch .built + +.built: $(BIN) + +.depend: Makefile $(SRCS) + @$(MKDEP) $(ROOTDEPPATH) \ + $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + @touch $@ + +# Register application +depend: .depend + +clean: + @rm -f $(BIN) *.o *~ .*.swp .built + $(call CLEAN) + +distclean: clean + @rm -f Make.dep .depend + +-include Make.dep diff --git a/apps/sdcard/README.txt b/apps/sdcard/README.txt new file mode 100644 index 000000000..332aa26cf --- /dev/null +++ b/apps/sdcard/README.txt @@ -0,0 +1,7 @@ + +This application provides SDcard tool/lib to start, stop, eject or insert +a memory card. + + Source: NuttX + Author: Uros Platise + Date: 18. March 2011 diff --git a/apps/sdcard/sdcard.c b/apps/sdcard/sdcard.c new file mode 100644 index 000000000..bf3e82a07 --- /dev/null +++ b/apps/sdcard/sdcard.c @@ -0,0 +1,110 @@ +/**************************************************************************** + * sdcard/sdcard.c + * + * Copyright (C) 2011 Uros Platise. All rights reserved. + * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * + * Authors: Uros Platise + * Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#ifdef CONFIG_STM32_SDIO +# include +# include +#endif + + + +/* Create device device for the SDIO-based MMC/SD block driver */ + +int sdcard_start(int slotno) +{ + FAR struct sdio_dev_s *sdio; + int ret; + + /* First, get an instance of the SDIO interface */ + + sdio = sdio_initialize(slotno); + if (!sdio) + { + printf("SDIO: Failed to initialize slot %d\n", slotno); + return -ENODEV; + } + printf("SDIO: Initialized slot %d\n", slotno); + + /* Now bind the SPI interface to the MMC/SD driver */ + + ret = mmcsd_slotinitialize(slotno, sdio); + if (ret != OK) + { + printf("SDIO: Failed to bind to the MMC/SD driver: %d\n", ret); + return ret; + } + printf("SDIO: Successfully bound to the MMC/SD driver\n"); + + /* Then let's guess and say that there is a card in the slot. I need to check to + * see if the VSN board supports a GPIO to detect if there is a card in + * the slot. + */ + sdio_mediachange(sdio, true); + + return OK; +} + + +int sdcard_main(int argc, char *argv[]) +{ + int slotno; + + if (argc == 3) { + slotno = atoi(argv[2]); + + if (!strcmp(argv[1], "start")) { + return sdcard_start(slotno); + } + else if (!strcmp(argv[1], "stop")) { + } + else if (!strcmp(argv[1], "insert")) { + } + else if (!strcmp(argv[1], "eject")) { + } + } + + printf("%s: \n", argv[0]); + return -1; +} diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index f89473ba2..11056a44c 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -1591,4 +1591,9 @@ where the GPL driver(s) can be re-installed into the NuttX source tree. By re-installing the driver, you agree to the GPL licsensing and all of its implications. - + * Makefile, apps/Makefile, tools/configure.sh -- add logic to copy + configs///appdir to apps/.config and to simply the + application configuration logic. + * examples/nsh and apps/nshlib - Move the core NuttShell (NSH) logic + out of the exemples directory and into the apps/directory where + it belongs. diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index ac90b8003..61b6e1d3e 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -2218,6 +2218,12 @@ nuttx-5.20 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> where the GPL driver(s) can be re-installed into the NuttX source tree. By re-installing the driver, you agree to the GPL licsensing and all of its implications. + * Makefile, apps/Makefile, tools/configure.sh -- add logic to copy + configs/<board>/<config>/appdir to apps/.config and to simply the + application configuration logic. + * examples/nsh and apps/nshlib - Move the core NuttShell (NSH) logic + out of the exemples directory and into the apps/directory where + it belongs. apps-5.20 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/configs/vsn/include/board.h b/nuttx/configs/vsn/include/board.h index 5c07f075e..f5c690f1e 100644 --- a/nuttx/configs/vsn/include/board.h +++ b/nuttx/configs/vsn/include/board.h @@ -56,14 +56,49 @@ * Definitions ************************************************************************************/ -/* Board Configuration: +/* Board Peripheral Assignment + * + * RS232/Power connector: * - USART1, is the default bootloader and console + * + * Sensor Connector: + * Digital: + * - GPIOs: PB10, PB11 (or even TIM2 CH3 and CH4) + * - USART3 + * - I2C2 + * Analog: + * - ADC1 + * Supporting Analog Circuitry (not seen outside) + * - RefTap (TIM3_CH3) + * - Power PWM Out (TIM8_CH1 / TIM3_CH1) + * - Filtered Out (TIM3_CH4) + * (TIM8 could run at lower frequency, while TIM3 must run at highest possible) + * - Gain selection muxed with SDcard I/Os. + * + * Radio connector: + * - UART3 / UART4 + * - SPI2 + * - I2C1 (remapped pins vs. Expansion connector) + * - CAN + * - TIM4 CH[3:4] + * + * Expansion connector: + * - WakeUp Pin + * - System Wide Reset * - SPI1 is wired to expansion port - * - SPI2 is used for radio module + * - I2C1 + * - USART2 [Rx, Tx, CTS, RTS] + * - DAC [0:1] + * - ADC2 on pins [0:7] + * - TIM2 Channels [1:4] + * - TIM5 Channels [1:4] + * + * Onboard Components: * - SPI3 has direct connection with FRAM * - SDCard, conencts the microSD and shares the control lines with Sensor Interface * to select Amplifier Gain - * - ... + * - ADC3 is used also for power management (can be shared with ADC1 on sensor connector + * if not used) */ /* Clocking *************************************************************************/ diff --git a/nuttx/configs/vsn/include/nsh_romfsimg.h b/nuttx/configs/vsn/include/nsh_romfsimg.h index 102d2a144..2ac240ec8 100755 --- a/nuttx/configs/vsn/include/nsh_romfsimg.h +++ b/nuttx/configs/vsn/include/nsh_romfsimg.h @@ -1,89 +1,89 @@ -unsigned char romfs_img[] = { - 0x2d, 0x72, 0x6f, 0x6d, 0x31, 0x66, 0x73, 0x2d, 0x00, 0x00, 0x01, 0xf0, - 0x38, 0x85, 0x3a, 0x23, 0x4e, 0x53, 0x48, 0x49, 0x6e, 0x69, 0x74, 0x56, - 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xff, 0x97, - 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0x80, 0x2e, 0x2e, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, - 0x68, 0x2d, 0x96, 0x03, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x64, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0x40, - 0x2e, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x60, - 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xfe, 0xe0, 0x2e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, - 0x8d, 0x9c, 0xab, 0xe7, 0x72, 0x63, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x63, 0x68, 0x6f, - 0x20, 0x22, 0x56, 0x53, 0x4e, 0x20, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x20, - 0x31, 0x2e, 0x32, 0x2c, 0x20, 0x77, 0x77, 0x77, 0x2e, 0x6e, 0x65, 0x74, - 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x22, 0x0a, - 0x0a, 0x23, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, - 0x52, 0x41, 0x4d, 0x44, 0x49, 0x53, 0x4b, 0x20, 0x61, 0x6e, 0x64, 0x20, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x69, 0x74, 0x20, 0x61, 0x74, 0x20, - 0x2f, 0x74, 0x6d, 0x70, 0x0a, 0x23, 0x6d, 0x6b, 0x72, 0x64, 0x20, 0x2d, - 0x6d, 0x20, 0x31, 0x20, 0x2d, 0x73, 0x20, 0x35, 0x31, 0x32, 0x20, 0x34, - 0x30, 0x0a, 0x23, 0x6d, 0x6b, 0x66, 0x61, 0x74, 0x66, 0x73, 0x20, 0x2f, - 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x31, 0x0a, 0x23, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x20, 0x2d, 0x74, 0x20, 0x76, 0x66, 0x61, 0x74, 0x20, - 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x31, 0x20, 0x2f, 0x74, - 0x6d, 0x70, 0x0a, 0x0a, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x4d, 0x6f, - 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x46, 0x52, 0x41, 0x4d, 0x20, - 0x74, 0x6f, 0x20, 0x2f, 0x75, 0x73, 0x72, 0x20, 0x61, 0x6e, 0x64, 0x20, - 0x53, 0x44, 0x63, 0x61, 0x72, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x2f, 0x73, - 0x64, 0x63, 0x61, 0x72, 0x64, 0x22, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x20, 0x2d, 0x74, 0x20, 0x76, 0x66, 0x61, 0x74, 0x20, 0x2f, 0x64, 0x65, - 0x76, 0x2f, 0x6d, 0x74, 0x64, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x30, 0x20, - 0x2f, 0x75, 0x73, 0x72, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x2d, - 0x74, 0x20, 0x76, 0x66, 0x61, 0x74, 0x20, 0x2f, 0x64, 0x65, 0x76, 0x2f, - 0x6d, 0x6d, 0x63, 0x73, 0x64, 0x30, 0x20, 0x2f, 0x73, 0x64, 0x63, 0x61, - 0x72, 0x64, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 -}; -unsigned int romfs_img_len = 1024; +unsigned char romfs_img[] = { + 0x2d, 0x72, 0x6f, 0x6d, 0x31, 0x66, 0x73, 0x2d, 0x00, 0x00, 0x02, 0x10, + 0x85, 0xc5, 0xa3, 0x6a, 0x4e, 0x53, 0x48, 0x49, 0x6e, 0x69, 0x74, 0x56, + 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xff, 0x97, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0x80, 0x2e, 0x2e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x68, 0x2d, 0x96, 0x03, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x64, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xd1, 0xff, 0x40, + 0x2e, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x60, + 0x00, 0x00, 0x00, 0x00, 0xd1, 0xff, 0xfe, 0xe0, 0x2e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x30, + 0x8d, 0x9c, 0xab, 0xc6, 0x72, 0x63, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x63, 0x68, 0x6f, + 0x20, 0x22, 0x56, 0x53, 0x4e, 0x20, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x20, + 0x31, 0x2e, 0x32, 0x2c, 0x20, 0x77, 0x77, 0x77, 0x2e, 0x6e, 0x65, 0x74, + 0x63, 0x6c, 0x61, 0x6d, 0x70, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x22, 0x0a, + 0x0a, 0x23, 0x20, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, + 0x52, 0x41, 0x4d, 0x44, 0x49, 0x53, 0x4b, 0x20, 0x61, 0x6e, 0x64, 0x20, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x69, 0x74, 0x20, 0x61, 0x74, 0x20, + 0x2f, 0x74, 0x6d, 0x70, 0x0a, 0x23, 0x6d, 0x6b, 0x72, 0x64, 0x20, 0x2d, + 0x6d, 0x20, 0x31, 0x20, 0x2d, 0x73, 0x20, 0x35, 0x31, 0x32, 0x20, 0x34, + 0x30, 0x0a, 0x23, 0x6d, 0x6b, 0x66, 0x61, 0x74, 0x66, 0x73, 0x20, 0x2f, + 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x31, 0x0a, 0x23, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x20, 0x2d, 0x74, 0x20, 0x76, 0x66, 0x61, 0x74, 0x20, + 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x72, 0x61, 0x6d, 0x31, 0x20, 0x2f, 0x74, + 0x6d, 0x70, 0x0a, 0x0a, 0x65, 0x63, 0x68, 0x6f, 0x20, 0x22, 0x4d, 0x6f, + 0x75, 0x6e, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x46, 0x52, 0x41, 0x4d, 0x20, + 0x74, 0x6f, 0x20, 0x2f, 0x75, 0x73, 0x72, 0x20, 0x61, 0x6e, 0x64, 0x20, + 0x53, 0x44, 0x63, 0x61, 0x72, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x2f, 0x73, + 0x64, 0x63, 0x61, 0x72, 0x64, 0x22, 0x0a, 0x0a, 0x72, 0x61, 0x6d, 0x74, + 0x72, 0x6f, 0x6e, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, 0x33, 0x0a, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x2d, 0x74, 0x20, 0x76, 0x66, 0x61, + 0x74, 0x20, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x6d, 0x74, 0x64, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x30, 0x20, 0x2f, 0x75, 0x73, 0x72, 0x0a, 0x0a, 0x73, + 0x64, 0x63, 0x61, 0x72, 0x64, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x20, + 0x30, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x20, 0x2d, 0x74, 0x20, 0x76, + 0x66, 0x61, 0x74, 0x20, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x6d, 0x6d, 0x63, + 0x73, 0x64, 0x30, 0x20, 0x2f, 0x73, 0x64, 0x63, 0x61, 0x72, 0x64, 0x0a, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; +unsigned int romfs_img_len = 1024; diff --git a/nuttx/configs/vsn/include/rcS.template b/nuttx/configs/vsn/include/rcS.template index 83005bd40..32f0df4e1 100755 --- a/nuttx/configs/vsn/include/rcS.template +++ b/nuttx/configs/vsn/include/rcS.template @@ -6,5 +6,9 @@ echo "VSN Board 1.2, www.netclamps.com" #mount -t vfat /dev/ramXXXMKRDMINORXXX XXXRDMOUNTPOUNTXXX echo "Mounting FRAM to /usr and SDcard to /sdcard" + +ramtron start 3 mount -t vfat /dev/mtdblock0 /usr + +sdcard start 0 mount -t vfat /dev/mmcsd0 /sdcard diff --git a/nuttx/configs/vsn/nsh/defconfig b/nuttx/configs/vsn/nsh/defconfig index cb6f02c8e..f73401372 100755 --- a/nuttx/configs/vsn/nsh/defconfig +++ b/nuttx/configs/vsn/nsh/defconfig @@ -544,6 +544,7 @@ CONFIG_MMCSD_HAVECARDDETECT=n # CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window # CONFIG_NET_ARPTAB_SIZE - The size of the ARP table # CONFIG_NET_BROADCAST - Broadcast support +# CONFIG_NET_LLH_LEN - The link level header length # CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates # CONFIG_NET=n @@ -564,6 +565,7 @@ CONFIG_NET_STATISTICS=y #CONFIG_NET_RECEIVE_WINDOW= #CONFIG_NET_ARPTAB_SIZE=8 CONFIG_NET_BROADCAST=n +#CONFIG_NET_LLH_LEN=14 #CONFIG_NET_FWCACHE_SIZE=2 # diff --git a/nuttx/configs/vsn/src/Makefile b/nuttx/configs/vsn/src/Makefile index 1a2005d60..f12a8bcef 100644 --- a/nuttx/configs/vsn/src/Makefile +++ b/nuttx/configs/vsn/src/Makefile @@ -44,7 +44,7 @@ ASRCS = AOBJS = $(ASRCS:.S=$(OBJEXT)) CSRCS = sysclock.c boot.c leds.c buttons.c spi.c \ - usbdev.c sdcard.c ramtron.c power.c + usbdev.c power.c ifeq ($(CONFIG_EXAMPLES_NSH_ARCHINIT),y) CSRCS += nsh.c diff --git a/nuttx/configs/vsn/src/README.txt b/nuttx/configs/vsn/src/README.txt index f08e8fe06..bacf82c17 100644 --- a/nuttx/configs/vsn/src/README.txt +++ b/nuttx/configs/vsn/src/README.txt @@ -10,13 +10,3 @@ Execution starts in the following order: - boot, performs initial chip and board initialization - ... - nsh, as central application last. - - - - -JTAG options: -============= - -CONFIG_STM32_JTAG_FULL_ENABLE // Complete parallel and serial -CONFIG_STM32_JTAG_NOJNTRST_ENABLE // no JNTRST pin -CONFIG_STM32_JTAG_SW_ENABLE // serial (dual pin) only (can coexist besides the FRAM on SPI3) diff --git a/nuttx/configs/vsn/src/nsh.c b/nuttx/configs/vsn/src/nsh.c index 96f9f3d4d..d29368833 100644 --- a/nuttx/configs/vsn/src/nsh.c +++ b/nuttx/configs/vsn/src/nsh.c @@ -82,8 +82,8 @@ int nsh_archinitialize(void) { - up_ramtron(); - up_sdcard(); +// up_ramtron(); +// up_sdcard(); return OK; } diff --git a/nuttx/configs/vsn/src/power.c b/nuttx/configs/vsn/src/power.c index c7c73448a..2e5ed1d13 100644 --- a/nuttx/configs/vsn/src/power.c +++ b/nuttx/configs/vsn/src/power.c @@ -81,11 +81,11 @@ void board_power_off(void) // \todo - // stop backgorund processes + // stop background processes irqsave(); // switch to internal HSI and get the PD0 and PD1 as GPIO - stm32_board_select_hsi(); + sysclock_select_hsi(); // trigger shutdown with pull-up resistor (not push-pull!) and wait. stm32_gpiowrite(GPIO_PCLR, true); diff --git a/nuttx/configs/vsn/src/sysclock.c b/nuttx/configs/vsn/src/sysclock.c index 79cc80ff2..928282b12 100644 --- a/nuttx/configs/vsn/src/sysclock.c +++ b/nuttx/configs/vsn/src/sysclock.c @@ -65,7 +65,7 @@ * * \return Nothing, operation is always successful. */ -void stm32_board_select_hsi(void) +void sysclock_select_hsi(void) { uint32_t regval; @@ -144,7 +144,7 @@ void stm32_board_select_hsi(void) * \retval -1 External clock is not provided * \retval -2 Could not lock to external clock */ -int stm32_board_select_hse(void) +int sysclock_select_hse(void) { uint32_t regval; @@ -168,7 +168,7 @@ int stm32_board_select_hse(void) * so spawn a task for that... once cc1101 is restarted signal an event * to restart clock. */ -void stm32_board_hse_lost(void) +void sysclock_hse_lost(void) { } @@ -181,5 +181,5 @@ void stm32_board_hse_lost(void) */ void stm32_board_clockconfig(void) { - stm32_board_select_hsi(); + sysclock_select_hsi(); } diff --git a/nuttx/examples/nsh/nsh.h b/nuttx/examples/nsh/nsh.h index a6824f1b7..ea05da31b 100644 --- a/nuttx/examples/nsh/nsh.h +++ b/nuttx/examples/nsh/nsh.h @@ -333,16 +333,6 @@ extern int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, FAR char *argv[]); #endif -/* I/O interfaces */ - -#ifdef CONFIG_EXAMPLES_NSH_CONSOLE -extern int nsh_consolemain(int argc, char *argv[]); -#endif - -#ifdef CONFIG_EXAMPLES_NSH_TELNET -extern int nsh_telnetmain(int argc, char *argv[]); -#endif - /* Working directory support */ #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) diff --git a/nuttx/examples/nsh/nsh_apps.c b/nuttx/examples/nsh/nsh_apps.c index d1ce1d955..58f44414a 100644 --- a/nuttx/examples/nsh/nsh_apps.c +++ b/nuttx/examples/nsh/nsh_apps.c @@ -47,7 +47,7 @@ #include #include -#include +#include #include "nsh.h" diff --git a/nuttx/examples/nsh/nsh_main.c b/nuttx/examples/nsh/nsh_main.c index 85b84d4b2..2544baf5b 100644 --- a/nuttx/examples/nsh/nsh_main.c +++ b/nuttx/examples/nsh/nsh_main.c @@ -57,8 +57,9 @@ #endif #ifdef CONFIG_EXAMPLES_NSH_BUILTIN_APPS -# include +# include #endif +#include #include "nsh.h" diff --git a/nuttx/include/apps/apps.h b/nuttx/include/apps/apps.h new file mode 100644 index 000000000..d8f8681c2 --- /dev/null +++ b/nuttx/include/apps/apps.h @@ -0,0 +1,135 @@ +/**************************************************************************** + * include/apps/apps.h + * + * Copyright(C) 2011 Uros Platise. All rights reserved. + * Author: Uros Platise + * + * 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_APPS_APPS_H +#define __INCLUDE_APPS_APPS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct nuttapp_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 Functions + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Name: check for availability of builtin NuttX application + * + * 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. + * + ****************************************************************************/ + +EXTERN int nuttapp_isavail(FAR const char *appname); + +/**************************************************************************** + * Name: get name of built-in application + * + * 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. + * + ****************************************************************************/ + +EXTERN const char * nuttapp_getname(int index); + +/**************************************************************************** + * Name: execute builtin NuttX application + * + * Description: + * Executes builtin application registerred during compile time. + * New application is run in a separate task context (and thread). + * + * Input Parameter: + * filename - Name of the linked-in binary to be started. + * argv - Argument list + * + * Returned Value: + * This is an end-user function, so it follows the normal convention: + * Returns the PID of the exec'ed module. On failure, it.returns + * -1 (ERROR) and sets errno appropriately. + * + ****************************************************************************/ + +EXTERN int exec_nuttapp(FAR const char *appname, FAR const char *argv[]); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __INCLUDE_APPS_APPS_H */ diff --git a/nuttx/include/apps/nsh.h b/nuttx/include/apps/nsh.h new file mode 100644 index 000000000..d8e857841 --- /dev/null +++ b/nuttx/include/apps/nsh.h @@ -0,0 +1,91 @@ +/**************************************************************************** + * include/apps/nsh.h + * + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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_APPS_NSHLIB_H +#define __INCLUDE_APPS_NSHLIB_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/* Interfaces needed to initialize and execute the NuttShell (NSH). + * + * nsh_initialize() - This function function should be called one during + * application start-up prior to executing nsh_consolemain() or + * nsh_telnetmain(). + */ + +EXTERN void nsh_initialize(void); + +/* The following interfaces maybe to called or started with task_start to + * start an NSH instance. + * + * nsh_consolemain() starts NSH on the console (/dev/console). + * nsh_telnetmain() starts a telnet daemon that will allow multiple + * connections via telnet. + * + * These functions do not return. + */ + +EXTERN int nsh_consolemain(int argc, char *argv[]); +EXTERN int nsh_telnetmain(int argc, char *argv[]); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_APPS_NSHLIB_H */ diff --git a/nuttx/include/nuttx/nuttapp.h b/nuttx/include/nuttx/nuttapp.h deleted file mode 100644 index 1d6497283..000000000 --- a/nuttx/include/nuttx/nuttapp.h +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** - * include/nuttx/nuttapp.h - * - * Copyright(C) 2011 Uros Platise. All rights reserved. - * Author: Uros Platise - * - * 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 __NUTTX_NUTTAPP_H -#define __NUTTX_NUTTAPP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -struct nuttapp_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 Functions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - - -/**************************************************************************** - * Name: check for availability of builtin NuttX application - * - * 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. - * - ****************************************************************************/ - -EXTERN int nuttapp_isavail(FAR const char *appname); - - -/**************************************************************************** - * Name: get name of built-in application - * - * 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. - * - ****************************************************************************/ - -EXTERN const char * nuttapp_getname(int index); - - -/**************************************************************************** - * Name: execute builtin NuttX application - * - * Description: - * Executes builtin application registerred during compile time. - * New application is run in a separate task context (and thread). - * - * Input Parameter: - * filename - Name of the linked-in binary to be started. - * argv - Argument list - * - * Returned Value: - * This is an end-user function, so it follows the normal convention: - * Returns the PID of the exec'ed module. On failure, it.returns - * -1 (ERROR) and sets errno appropriately. - * - ****************************************************************************/ - -EXTERN int exec_nuttapp(FAR const char *appname, FAR const char *argv[]); - - -#undef EXTERN -#if defined(__cplusplus) -} -#endif -#endif /* __NUTTX_NUTAPP_H */ diff --git a/nuttx/sched/os_bringup.c b/nuttx/sched/os_bringup.c index fa9b24915..c9d84c223 100644 --- a/nuttx/sched/os_bringup.c +++ b/nuttx/sched/os_bringup.c @@ -120,7 +120,10 @@ int os_bringup(void) { - int init_taskid; +#if defined(CONFIG_BUILTIN_APPS) && defined(CONFIG_BUILTIN_APP_START) + static const char *argv[3] = {NULL, "init", NULL}; +#endif + int init_taskid; /* Start the page fill worker thread that will resolve page faults. * This should always be the first thread started because it may @@ -154,8 +157,14 @@ int os_bringup(void) svdbg("Starting init thread\n"); #if defined(CONFIG_BUILTIN_APPS) && defined(CONFIG_BUILTIN_APP_START) - init_taskid = exec_nuttapp(CONFIG_BUILTIN_APP_START, (const char **)NULL); + /* Start the built-in application, passing an "init" argument, so that + * application can distinguish different run-levels + */ + + init_taskid = exec_nuttapp(CONFIG_BUILTIN_APP_START, argv); #else + /* Start the default application at user_start() */ + init_taskid = START_TASK("init", SCHED_PRIORITY_DEFAULT, CONFIG_USERMAIN_STACKSIZE, (main_t)user_start, (const char **)NULL); @@ -165,3 +174,15 @@ int os_bringup(void) } +Index: sched/os_bringup.c +=================================================================== +--- sched/os_bringup.c (revision 3388) ++++ sched/os_bringup.c (working copy) +@@ -154,7 +154,14 @@ + svdbg("Starting init thread\n"); + + #if defined(CONFIG_BUILTIN_APPS_NUTTX) && defined(CONFIG_BUILTIN_APP_START) +- init_taskid = exec_nuttapp(CONFIG_BUILTIN_APP_START, (const char **)NULL); + #else + init_taskid = START_TASK("init", SCHED_PRIORITY_DEFAULT, + CONFIG_USERMAIN_STACKSIZE, -- cgit v1.2.3