Add apps/poweroff lpc17 hardware handshake
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3380 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
901d085151
commit
5a0ff44cc3
@ -5,6 +5,9 @@
|
||||
|
||||
5.20 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* README cosmetics
|
||||
* hello world minor changes
|
||||
* Makefile cosmetics (I am slowly adding the Darjeeling JVM)
|
||||
* README.txt -- README cosmetics
|
||||
* hello/ -- hello world minor changes
|
||||
* Makefile -- Makefile cosmetics (I am slowly adding the Darjeeling JVM)
|
||||
* Make.defs -- New file adds common make definitions for applications.
|
||||
* hello/Makefile -- Now uses new Make.defs definitions. Added README.txt.
|
||||
* apps/poweroff -- New application to turn off board power.
|
41
Make.defs
Executable file
41
Make.defs
Executable file
@ -0,0 +1,41 @@
|
||||
############################################################################
|
||||
# apps/Make.defs
|
||||
# Common make definitions provided to all applications
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
define REGISTER
|
||||
@echo "Register: $1"
|
||||
@echo "{ .name = $1, .priority = $2, .stacksize = $3, .main = $4 }," >> ../exec_nuttapp_list.h
|
||||
@echo "EXTERN int $4(int argc, char *argv[]);" >> ../exec_nuttapp_proto.h
|
||||
endef
|
38
Makefile
38
Makefile
@ -49,23 +49,44 @@ BUILTIN_APPS_DIR =
|
||||
|
||||
ifeq ($(CONFIG_BUILTIN_APPS_NUTTX),y)
|
||||
|
||||
# Individual application: HELLO
|
||||
# BUILTIN_APPS is the list of all configured built-in directories/built action
|
||||
|
||||
BUILTIN_APPS =
|
||||
|
||||
ifeq ($(CONFIG_BUILTIN_APPS_HELLO),y)
|
||||
BUILTIN_APPS_DIR += hello
|
||||
BUILTIN_APPS_BUILT += hello/.built_always
|
||||
BUILTIN_APPS += hello/.built_always
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BUILTIN_APPS_POWEROFF),y)
|
||||
BUILTIN_APPS_DIR += poweroff
|
||||
BUILTIN_APPS_BUILT += poweroff/.built_always
|
||||
BUILTIN_APPS += poweroff/.built_always
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BUILTIN_APPS_JVM),y)
|
||||
BUILTIN_APPS_DIR += jvm
|
||||
BUILTIN_APPS_BUILT += jvm/.built_always
|
||||
BUILTIN_APPS += jvm/.built_always
|
||||
endif
|
||||
|
||||
# AVAILABLE_APPS is the list of currently available application directories
|
||||
|
||||
AVAILABLE_APPS =
|
||||
|
||||
define ADD_AVAILABLE
|
||||
AVAILABLE_APPS += ${shell DIR=`echo $1 | cut -d'/' -f1`; if [ -r $$DIR/Makefile ]; then echo "$1"; fi}
|
||||
endef
|
||||
|
||||
define BUILTIN_ADD_APP
|
||||
BUILTIN_APPS_DIR += ${shell echo $1 | cut -d'/' -f1}
|
||||
endef
|
||||
|
||||
define BUILTIN_ADD_BUILT
|
||||
BUILTIN_APPS_BUILT += ${shell echo $1 | cut -d'/' -f2}
|
||||
endef
|
||||
|
||||
# Create the list of applications to build
|
||||
|
||||
$(foreach BUILTIN, $(BUILTIN_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))))
|
||||
|
||||
# end of application list
|
||||
|
||||
endif
|
||||
@ -122,5 +143,8 @@ clean:
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
@rm -f exec_nuttapp_list.h
|
||||
@rm -f exec_nuttapp_proto.h
|
||||
|
||||
-include Make.dep
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
# sourcing the Make.defs!
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
include ../Make.defs
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
INCDIROPT = -w
|
||||
@ -86,9 +87,8 @@ $(BIN): $(OBJS)
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) \
|
||||
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(call REGISTER, $(APPNAME), $(PRIORITY), $(STACKSIZE), $(APPNAME)_main)
|
||||
@touch $@
|
||||
echo "{ .name = \""$(APPNAME)"\", .priority = "$(PRIORITY)", .stacksize = "$(STACKSIZE)", .main = "$(APPNAME)"_main }," >> ../exec_nuttapp_list.h
|
||||
echo "EXTERN int "$(APPNAME)"_main(int argc, char *argv[]);" >> ../exec_nuttapp_proto.h
|
||||
|
||||
# Register application
|
||||
depend: .depend
|
||||
|
5
hello/README.txt
Normal file
5
hello/README.txt
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
This application provides Hello Builtin Application skeleton
|
||||
|
||||
Source: NuttX
|
||||
Date: 13. March 2011
|
103
poweroff/Makefile
Normal file
103
poweroff/Makefile
Normal file
@ -0,0 +1,103 @@
|
||||
############################################################################
|
||||
# Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||
# Author: Uros Platise <uros.platise@isotel.eu>
|
||||
# Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# 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 = poweroff
|
||||
PRIORITY = SCHED_PRIORITY_DEFAULT
|
||||
STACKSIZE = 768
|
||||
|
||||
ASRCS =
|
||||
CSRCS = poweroff.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
|
5
poweroff/README.txt
Normal file
5
poweroff/README.txt
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
This application provides poweroff command
|
||||
|
||||
Source: NuttX
|
||||
Date: 13. March 2011
|
42
poweroff/poweroff.c
Normal file
42
poweroff/poweroff.c
Normal file
@ -0,0 +1,42 @@
|
||||
/****************************************************************************
|
||||
* poweroff/poweroff.c
|
||||
*
|
||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||
* Author: Uros Platise <uros.platise@isotel.eu>
|
||||
*
|
||||
* 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 <arch/board/power.h>
|
||||
|
||||
int poweroff_main(int argc, char *argv[])
|
||||
{
|
||||
board_power_off();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user