diff options
Diffstat (limited to 'apps/examples')
280 files changed, 1779 insertions, 38280 deletions
diff --git a/apps/examples/adc/Makefile b/apps/examples/adc/Makefile index 69862b383..6357dfc3d 100644 --- a/apps/examples/adc/Makefile +++ b/apps/examples/adc/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/adc/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -92,17 +90,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/adc/adc_main.c b/apps/examples/adc/adc_main.c index 553658fee..404fba8c1 100644 --- a/apps/examples/adc/adc_main.c +++ b/apps/examples/adc/adc_main.c @@ -289,7 +289,7 @@ int adc_main(int argc, char *argv[]) { message("adc_main: open %s failed: %d\n", g_adcstate.devpath, errno); errval = 2; - goto errout; + goto errout_with_dev; } /* Now loop the appropriate number of times, displaying the collected @@ -357,11 +357,6 @@ int adc_main(int argc, char *argv[]) } } - close(fd); - return OK; - - /* Error exits */ - errout_with_dev: close(fd); diff --git a/apps/examples/buttons/Makefile b/apps/examples/buttons/Makefile index 77c1cd67d..25d1ef2c2 100644 --- a/apps/examples/buttons/Makefile +++ b/apps/examples/buttons/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/buttons/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -92,17 +90,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/can/Makefile b/apps/examples/can/Makefile index 8924797e3..c6dc5af84 100644 --- a/apps/examples/can/Makefile +++ b/apps/examples/can/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/can/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -92,17 +90,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/cdcacm/.context b/apps/examples/cdcacm/.context new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/apps/examples/cdcacm/.context diff --git a/apps/examples/cdcacm/Makefile b/apps/examples/cdcacm/Makefile index e8d03807d..3fa886d56 100644 --- a/apps/examples/cdcacm/Makefile +++ b/apps/examples/cdcacm/Makefile @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -84,7 +80,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -95,18 +93,17 @@ $(COBJS): %$(OBJEXT): %.c context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/composite/Kconfig b/apps/examples/composite/Kconfig deleted file mode 100644 index d2d62043c..000000000 --- a/apps/examples/composite/Kconfig +++ /dev/null @@ -1,14 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_COMPOSITE - bool "USB composite class driver example" - default n - ---help--- - Enable the USB compsite class driver example - -if EXAMPLES_COMPOSITE -endif - diff --git a/apps/examples/composite/Makefile b/apps/examples/composite/Makefile deleted file mode 100644 index 016ccbe3e..000000000 --- a/apps/examples/composite/Makefile +++ /dev/null @@ -1,114 +0,0 @@ -############################################################################ -# apps/examples/composite/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# USB device mass storage example - -ASRCS = -CSRCS = composite_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# USB storage built-in application info - -APPNAME1 = conn -PRIORITY1 = SCHED_PRIORITY_DEFAULT -STACKSIZE1 = 2048 - -APPNAME2 = disconn -PRIORITY2 = SCHED_PRIORITY_DEFAULT -STACKSIZE2 = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main) - $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/composite/composite.h b/apps/examples/composite/composite.h deleted file mode 100644 index 73a4453be..000000000 --- a/apps/examples/composite/composite.h +++ /dev/null @@ -1,259 +0,0 @@ -/**************************************************************************** - * examples/composite/composite.h - * - * 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 __EXAMPLES_COMPOSITE_COMPOSITE_H -#define __EXAMPLES_COMPOSITE_COMPOSITE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> -#include <stdlib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* OS/Driver configuration checkes */ - -#ifndef CONFIG_USBDEV -# error "USB device support is not enabled (CONFIG_USBDEV)" -#endif - -#ifndef CONFIG_USBDEV_COMPOSITE -# error "USB composite device support is not enabled (CONFIG_USBDEV_COMPOSITE)" -#endif - -#ifndef CONFIG_CDCACM -# error "USB CDC/ACM serial device support is not enabled (CONFIG_CDCACM)" -#endif - -#ifndef CONFIG_CDCACM_COMPOSITE -# error "USB CDC/ACM serial composite device support is not enabled (CONFIG_CDCACM_COMPOSITE)" -#endif - -#ifndef CONFIG_USBMSC -# error "USB mass storage device support is not enabled (CONFIG_USBMSC)" -#endif - -#ifndef CONFIG_USBMSC_COMPOSITE -# error "USB mass storage composite device support is not enabled (CONFIG_USBMSC_COMPOSITE)" -#endif - -/* Example MSC default values */ - -#ifndef CONFIG_EXAMPLES_COMPOSITE_NLUNS -# define CONFIG_EXAMPLES_COMPOSITE_NLUNS 1 -#endif - -#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 -# define CONFIG_EXAMPLES_COMPOSITE_DEVMINOR1 0 -#endif - -#ifndef CONFIG_EXAMPLES_COMPOSITE_DEVPATH1 -# define CONFIG_EXAMPLES_COMPOSITE_DEVPATH1 "/dev/mmcsd0" -#endif - -#if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 1 -# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR2 -# error "CONFIG_EXAMPLES_COMPOSITE_DEVMINOR2 for LUN=2" -# endif -# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVPATH2 -# error "CONFIG_EXAMPLES_COMPOSITE_DEVPATH2 for LUN=2" -# endif -# if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 2 -# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVMINOR3 -# error "CONFIG_EXAMPLES_COMPOSITE_DEVMINOR2 for LUN=3" -# endif -# ifndef CONFIG_EXAMPLES_COMPOSITE_DEVPATH2 -# error "CONFIG_EXAMPLES_COMPOSITE_DEVPATH2 for LUN=3" -# endif -# if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 3 -# error "CONFIG_EXAMPLES_COMPOSITE_NLUNS must be {1,2,3}" -# endif -# endif -#endif - -#ifndef CONFIG_EXAMPLES_COMPOSITE_BUFLEN -# define CONFIG_EXAMPLES_COMPOSITE_BUFLEN 256 -#endif - -/* Example MSC default values */ - -#ifndef CONFIG_EXAMPLES_COMPOSITE_TTYUSB -# define CONFIG_EXAMPLES_COMPOSITE_TTYUSB 0 -#endif - -#ifndef CONFIG_EXAMPLES_COMPOSITE_SERDEV -# if CONFIG_EXAMPLES_COMPOSITE_TTYUSB != 0 -# error "Serial device unknown (CONFIG_EXAMPLES_COMPOSITE_SERDEV)" -# elif defined(CONFIG_CDCACM) -# define CONFIG_EXAMPLES_COMPOSITE_SERDEV "/dev/ttyACM0" -# else -# define CONFIG_EXAMPLES_COMPOSITE_SERDEV "/dev/ttyUSB0" -# endif -#endif - -#ifndef CONFIG_EXAMPLES_COMPOSITE_BUFSIZE -# define CONFIG_EXAMPLES_COMPOSITE_BUFSIZE 256 -#endif - -/* Trace initialization *****************************************************/ - -#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACEINIT -# define TRACE_INIT_BITS (TRACE_INIT_BIT) -#else -# define TRACE_INIT_BITS (0) -#endif - -#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT) - -#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACECLASS -# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT) -#else -# define TRACE_CLASS_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACETRANSFERS -# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|TRACE_READ_BIT|\ - TRACE_WRITE_BIT|TRACE_COMPLETE_BIT) -#else -# define TRACE_TRANSFER_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACECONTROLLER -# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT) -#else -# define TRACE_CONTROLLER_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_COMPOSITE_TRACEINTERRUPTS -# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT) -#else -# define TRACE_INTERRUPT_BITS (0) -#endif - -#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\ - TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS) - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# define msgflush() -# else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define msgflush() -# else -# define message printf -# define msgflush() fflush(stdout) -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* All global variables used by this example are packed into a structure in - * order to avoid name collisions. - */ - -struct composite_state_s -{ - /* This is the handle that references to this particular USB composite driver - * instance. It is only needed if the example is built using - * CONFIG_NSH_BUILTIN_APPS. In this case, the value of the driver handle - * must be remembered between the 'conn' and 'disconn' commands. - */ - - FAR void *cmphandle; /* Composite device handle */ - FAR void *mschandle; /* Mass storage device handle */ - - /* Serial file descriptors */ - -#if !defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_DISABLE_SIGNALS) - int outfd; /* Blocking write-only */ - int infd; /* Non-blockig read-only */ -#endif - - /* Heap usage samples. These are useful for checking USB storage memory - * usage and for tracking down memoryh leaks. - */ - -#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM - struct mallinfo mmstart; /* Memory usage before the connection */ - struct mallinfo mmprevious; /* The last memory usage sample */ - struct mallinfo mmcurrent; /* The current memory usage sample */ -#endif - - /* Serial I/O buffer */ - -#if !defined(CONFIG_NSH_BUILTIN_APPS) || defined(CONFIG_DISABLE_SIGNALS) - uint8_t serbuf[CONFIG_EXAMPLES_COMPOSITE_BUFSIZE]; -#endif -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* All global variables used by this example are packed into a structure in - * order to avoid name collisions. - */ - -extern struct composite_state_s g_composite; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: composite_archinitialize - * - * Description: - * Perform architecture specific initialization. - * - ****************************************************************************/ - -extern int composite_archinitialize(void); - -#endif /* __EXAMPLES_COMPOSITE_COMPOSITE_H */ diff --git a/apps/examples/composite/composite_main.c b/apps/examples/composite/composite_main.c deleted file mode 100644 index b965eacb7..000000000 --- a/apps/examples/composite/composite_main.c +++ /dev/null @@ -1,851 +0,0 @@ -/**************************************************************************** - * examples/usbstorage/composite_main.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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/usb/usbdev.h> -#include <nuttx/usb/composite.h> -#include <nuttx/usb/cdcacm.h> -#include <nuttx/usb/usbmsc.h> -#include <nuttx/usb/usbdev_trace.h> - -#include "composite.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/* All global variables used by this example are packed into a structure in - * order to avoid name collisions. - */ - -struct composite_state_s g_composite; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: show_memory_usage - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM -static void show_memory_usage(struct mallinfo *mmbefore, - struct mallinfo *mmafter) -{ - int diff; - - message(" total used free largest\n"); - message("Before:%11d%11d%11d%11d\n", - mmbefore->arena, mmbefore->uordblks, mmbefore->fordblks, mmbefore->mxordblk); - message("After: %11d%11d%11d%11d\n", - mmafter->arena, mmafter->uordblks, mmafter->fordblks, mmafter->mxordblk); - - diff = mmbefore->uordblks - mmafter->uordblks; - if (diff < 0) - { - message("Change:%11d allocated\n", -diff); - } - else if (diff > 0) - { - message("Change:%11d freed\n", diff); - } -} -#else -# define show_memory_usage(mm1, mm2) -#endif - -/**************************************************************************** - * Name: check_test_memory_usage - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM -static void check_test_memory_usage(FAR const char *msg) -{ - /* Get the current memory usage */ - -#ifdef CONFIG_CAN_PASS_STRUCTS - g_composite.mmcurrent = mallinfo(); -#else - (void)mallinfo(&g_composite.mmcurrent); -#endif - - /* Show the change from the previous time */ - - message("\%s:\n", msg); - show_memory_usage(&g_composite.mmprevious, &g_composite.mmcurrent); - - /* Set up for the next test */ - -#ifdef CONFIG_CAN_PASS_STRUCTS - g_composite.mmprevious = g_composite.mmcurrent; -#else - memcpy(&g_composite.mmprevious, &g_composite.mmcurrent, sizeof(struct mallinfo)); -#endif -} -#else -# define check_test_memory_usage(msg) -#endif - -/**************************************************************************** - * Name: check_test_memory_usage - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM -static void final_memory_usage(FAR const char *msg) -{ - /* Get the current memory usage */ - -#ifdef CONFIG_CAN_PASS_STRUCTS - g_composite.mmcurrent = mallinfo(); -#else - (void)mallinfo(&g_composite.mmcurrent); -#endif - - /* Show the change from the previous time */ - - message("\n%s:\n", msg); - show_memory_usage(&g_composite.mmstart, &g_composite.mmcurrent); -} -#else -# define final_memory_usage(msg) -#endif - -/**************************************************************************** - * Name: composite_enumerate - ****************************************************************************/ - -#ifdef CONFIG_USBDEV_TRACE -static int composite_enumerate(struct usbtrace_s *trace, void *arg) -{ - switch (trace->event) - { - case TRACE_DEVINIT: - message("USB controller initialization: %04x\n", trace->value); - break; - - case TRACE_DEVUNINIT: - message("USB controller un-initialization: %04x\n", trace->value); - break; - - case TRACE_DEVREGISTER: - message("usbdev_register(): %04x\n", trace->value); - break; - - case TRACE_DEVUNREGISTER: - message("usbdev_unregister(): %04x\n", trace->value); - break; - - case TRACE_EPCONFIGURE: - message("Endpoint configure(): %04x\n", trace->value); - break; - - case TRACE_EPDISABLE: - message("Endpoint disable(): %04x\n", trace->value); - break; - - case TRACE_EPALLOCREQ: - message("Endpoint allocreq(): %04x\n", trace->value); - break; - - case TRACE_EPFREEREQ: - message("Endpoint freereq(): %04x\n", trace->value); - break; - - case TRACE_EPALLOCBUFFER: - message("Endpoint allocbuffer(): %04x\n", trace->value); - break; - - case TRACE_EPFREEBUFFER: - message("Endpoint freebuffer(): %04x\n", trace->value); - break; - - case TRACE_EPSUBMIT: - message("Endpoint submit(): %04x\n", trace->value); - break; - - case TRACE_EPCANCEL: - message("Endpoint cancel(): %04x\n", trace->value); - break; - - case TRACE_EPSTALL: - message("Endpoint stall(true): %04x\n", trace->value); - break; - - case TRACE_EPRESUME: - message("Endpoint stall(false): %04x\n", trace->value); - break; - - case TRACE_DEVALLOCEP: - message("Device allocep(): %04x\n", trace->value); - break; - - case TRACE_DEVFREEEP: - message("Device freeep(): %04x\n", trace->value); - break; - - case TRACE_DEVGETFRAME: - message("Device getframe(): %04x\n", trace->value); - break; - - case TRACE_DEVWAKEUP: - message("Device wakeup(): %04x\n", trace->value); - break; - - case TRACE_DEVSELFPOWERED: - message("Device selfpowered(): %04x\n", trace->value); - break; - - case TRACE_DEVPULLUP: - message("Device pullup(): %04x\n", trace->value); - break; - - case TRACE_CLASSBIND: - message("Class bind(): %04x\n", trace->value); - break; - - case TRACE_CLASSUNBIND: - message("Class unbind(): %04x\n", trace->value); - break; - - case TRACE_CLASSDISCONNECT: - message("Class disconnect(): %04x\n", trace->value); - break; - - case TRACE_CLASSSETUP: - message("Class setup(): %04x\n", trace->value); - break; - - case TRACE_CLASSSUSPEND: - message("Class suspend(): %04x\n", trace->value); - break; - - case TRACE_CLASSRESUME: - message("Class resume(): %04x\n", trace->value); - break; - - case TRACE_CLASSRDCOMPLETE: - message("Class RD request complete: %04x\n", trace->value); - break; - - case TRACE_CLASSWRCOMPLETE: - message("Class WR request complete: %04x\n", trace->value); - break; - - default: - switch (TRACE_ID(trace->event)) - { - case TRACE_CLASSAPI_ID: /* Other class driver system API calls */ - message("Class API call %d: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_CLASSSTATE_ID: /* Track class driver state changes */ - message("Class state %d: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_INTENTRY_ID: /* Interrupt handler entry */ - message("Interrrupt %d entry: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_INTDECODE_ID: /* Decoded interrupt trace->event */ - message("Interrrupt decode %d: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_INTEXIT_ID: /* Interrupt handler exit */ - message("Interrrupt %d exit: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_OUTREQQUEUED_ID: /* Request queued for OUT endpoint */ - message("EP%d OUT request queued: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_INREQQUEUED_ID: /* Request queued for IN endpoint */ - message("EP%d IN request queued: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_READ_ID: /* Read (OUT) action */ - message("EP%d OUT read: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_WRITE_ID: /* Write (IN) action */ - message("EP%d IN write: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_COMPLETE_ID: /* Request completed */ - message("EP%d request complete: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_DEVERROR_ID: /* USB controller driver error event */ - message("Controller error: %02x:%04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_CLSERROR_ID: /* USB class driver error event */ - message("Class error: %02x:%04x\n", TRACE_DATA(trace->event), trace->value); - break; - - default: - message("Unrecognized event: %02x:%02x:%04x\n", - TRACE_ID(trace->event) >> 8, TRACE_DATA(trace->event), trace->value); - break; - } - } - return OK; -} -#endif - -/**************************************************************************** - * Name: dumptrace - * - * Description: - * Dump collected trace data. - * - ****************************************************************************/ - -#ifdef CONFIG_USBDEV_TRACE -static int dumptrace(void) -{ - int ret; - - ret = usbtrace_enumerate(composite_enumerate, NULL); - if (ret < 0) - { - message("dumptrace: usbtrace_enumerate failed: %d\n", -ret); - } - return ret; -} -#else -# define dumptrace() (OK) -#endif - -/**************************************************************************** - * Name: open_serial - ****************************************************************************/ - -#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_DISABLE_SIGNALS) -static int open_serial(void) -{ - int errcode; -#ifdef CONFIG_USBDEV_TRACE - int ret; -#endif - - /* Open the USB serial device for writing (blocking) */ - - do - { - message("open_serial: Opening USB serial driver\n"); - g_composite.outfd = open(CONFIG_EXAMPLES_COMPOSITE_SERDEV, O_WRONLY); - if (g_composite.outfd < 0) - { - errcode = errno; - message("open_serial: ERROR: Failed to open %s for writing: %d\n", - CONFIG_EXAMPLES_COMPOSITE_SERDEV, errcode); - - /* ENOTCONN means that the USB device is not yet connected */ - - if (errcode == ENOTCONN) - { - message("open_serial: Not connected. Wait and try again.\n"); - sleep(5); - } - else - { - /* Give up on other errors */ - - message("open_serial: Aborting\n"); - return -errcode; - } - } - - /* If USB tracing is enabled, then dump all collected trace data to - * stdout. - */ - -#ifdef CONFIG_USBDEV_TRACE - ret = dumptrace(); - if (ret < 0) - { - return ret; - } -#endif - } - while (g_composite.outfd < 0); - - /* Open the USB serial device for reading (non-blocking) */ - - g_composite.infd = open(CONFIG_EXAMPLES_COMPOSITE_SERDEV, O_RDONLY|O_NONBLOCK); - if (g_composite.infd < 0) - { - errcode = errno; - message("open_serial: ERROR: Failed to open%s for reading: %d\n", - CONFIG_EXAMPLES_COMPOSITE_SERDEV, errcode); - close(g_composite.outfd); - return -errcode; - } - - message("open_serial: Successfully opened the serial driver\n"); - return OK; -} -#endif - -/**************************************************************************** - * Name: echo_serial - ****************************************************************************/ - -static int echo_serial(void) -{ - ssize_t bytesread; - ssize_t byteswritten; - int errcode; - - /* Read data */ - - bytesread = read(g_composite.infd, g_composite.serbuf, CONFIG_EXAMPLES_COMPOSITE_BUFSIZE); - if (bytesread < 0) - { - errcode = errno; - if (errcode != EAGAIN) - { - message("echo_serial: ERROR: read failed: %d\n", errcode); - return -errcode; - } - return OK; - } - - /* Echo data */ - - byteswritten = write(g_composite.outfd, g_composite.serbuf, bytesread); - if (byteswritten < 0) - { - errcode = errno; - message("echo_serial: ERROR: write failed: %d\n", errcode); - return -errcode; - } - else if (byteswritten != bytesread) - { - message("echo_serial: ERROR: read size: %d write size: %d\n", - bytesread, byteswritten); - } - return OK; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: board_mscclassobject - * - * Description: - * If the mass storage class driver is part of composite device, then - * its instantiation and configuration is a multi-step, board-specific, - * process (See comments for usbmsc_configure below). In this case, - * board-specific logic must provide board_mscclassobject(). - * - * board_mscclassobject() is called from the composite driver. It must - * encapsulate the instantiation and configuration of the mass storage - * class and the return the mass storage device's class driver instance - * to the composite dirver. - * - * Input Parameters: - * classdev - The location to return the mass storage class' device - * instance. - * - * Returned Value: - * 0 on success; a negated errno on failure - * - ****************************************************************************/ - -int board_mscclassobject(FAR struct usbdevclass_driver_s **classdev) -{ - int ret; - - DEBUGASSERT(g_composite.mschandle == NULL); - - /* Initialize USB trace output IDs */ - - usbtrace_enable(TRACE_BITSET); - check_test_memory_usage("After usbtrace_enable()"); - - /* Configure the mass storage device */ - - message("board_mscclassobject: Configuring with NLUNS=%d\n", CONFIG_EXAMPLES_COMPOSITE_NLUNS); - ret = usbmsc_configure(CONFIG_EXAMPLES_COMPOSITE_NLUNS, &g_composite.mschandle); - if (ret < 0) - { - message("board_mscclassobject: usbmsc_configure failed: %d\n", -ret); - return ret; - } - message("board_mscclassobject: MSC handle=%p\n", g_composite.mschandle); - check_test_memory_usage("After usbmsc_configure()"); - - /* Bind the LUN(s) */ - - message("board_mscclassobject: Bind LUN=0 to %s\n", CONFIG_EXAMPLES_COMPOSITE_DEVPATH1); - ret = usbmsc_bindlun(g_composite.mschandle, CONFIG_EXAMPLES_COMPOSITE_DEVPATH1, 0, 0, 0, false); - if (ret < 0) - { - message("board_mscclassobject: usbmsc_bindlun failed for LUN 1 using %s: %d\n", - CONFIG_EXAMPLES_COMPOSITE_DEVPATH1, -ret); - usbmsc_uninitialize(g_composite.mschandle); - return ret; - } - check_test_memory_usage("After usbmsc_bindlun()"); - -#if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 1 - - message("board_mscclassobject: Bind LUN=1 to %s\n", CONFIG_EXAMPLES_COMPOSITE_DEVPATH2); - ret = usbmsc_bindlun(g_composite.mschandle, CONFIG_EXAMPLES_COMPOSITE_DEVPATH2, 1, 0, 0, false); - if (ret < 0) - { - message("board_mscclassobject: usbmsc_bindlun failed for LUN 2 using %s: %d\n", - CONFIG_EXAMPLES_COMPOSITE_DEVPATH2, -ret); - usbmsc_uninitialize(g_composite.mschandle); - return ret; - } - check_test_memory_usage("After usbmsc_bindlun() #2"); - -#if CONFIG_EXAMPLES_COMPOSITE_NLUNS > 2 - - message("board_mscclassobject: Bind LUN=2 to %s\n", CONFIG_EXAMPLES_COMPOSITE_DEVPATH3); - ret = usbmsc_bindlun(g_composite.mschandle, CONFIG_EXAMPLES_COMPOSITE_DEVPATH3, 2, 0, 0, false); - if (ret < 0) - { - message("board_mscclassobject: usbmsc_bindlun failed for LUN 3 using %s: %d\n", - CONFIG_EXAMPLES_COMPOSITE_DEVPATH3, -ret); - usbmsc_uninitialize(g_composite.mschandle); - return ret; - } - check_test_memory_usage("After usbmsc_bindlun() #3"); - -#endif -#endif - - /* Get the mass storage device's class object */ - - ret = usbmsc_classobject(g_composite.mschandle, classdev); - if (ret < 0) - { - message("board_mscclassobject: usbmsc_classobject failed: %d\n", -ret); - usbmsc_uninitialize(g_composite.mschandle); - } - check_test_memory_usage("After usbmsc_classobject()"); - return ret; -} - -/**************************************************************************** - * Name: board_mscuninitialize - * - * Description: - * Un-initialize the USB storage class driver. This is just an application- - * specific wrapper aboutn usbmsc_unitialize() that is called form the composite - * device logic. - * - * Input Parameters: - * classdev - The class driver instrance previously give to the composite - * driver by board_mscclassobject(). - * - * Returned Value: - * None - * - ****************************************************************************/ - -void board_mscuninitialize(FAR struct usbdevclass_driver_s *classdev) -{ - DEBUGASSERT(g_composite.mschandle != NULL && - g_composite.mschandle == (FAR void *)classdev); - usbmsc_uninitialize(g_composite.mschandle); -} - -/**************************************************************************** - * Name: board_cdcclassobject - * - * Description: - * If the CDC serial class driver is part of composite device, then - * board-specific logic must provide board_cdcclassobject(). In the simplest - * case, board_cdcclassobject() is simply a wrapper around cdcacm_classobject() - * that provides the correct device minor number. - * - * Input Parameters: - * classdev - The location to return the CDC serial class' device - * instance. - * - * Returned Value: - * 0 on success; a negated errno on failure - * - ****************************************************************************/ - -int board_cdcclassobject(FAR struct usbdevclass_driver_s **classdev) -{ - int ret; - - /* Initialize the USB serial driver */ - - message("board_cdcclassobject: Initializing USB serial driver\n"); - ret = cdcacm_classobject(CONFIG_EXAMPLES_COMPOSITE_TTYUSB, classdev); - if (ret < 0) - { - message("board_cdcclassobject: ERROR: Failed to create the USB serial device: %d\n", -ret); - } - return ret; -} - -/**************************************************************************** - * Name: board_cdcuninitialize - * - * Description: - * Un-initialize the USB serial class driver. This is just an application- - * specific wrapper aboutn cdcadm_unitialize() that is called form the composite - * device logic. - * - * Input Parameters: - * classdev - The class driver instrance previously give to the composite - * driver by board_cdcclassobject(). - * - * Returned Value: - * None - * - ****************************************************************************/ - -void board_cdcuninitialize(FAR struct usbdevclass_driver_s *classdev) -{ - DEBUGASSERT(classdev != NULL); - cdcacm_uninitialize(classdev); -} - -/**************************************************************************** - * conn_main - * - * Description: - * This is the main program that configures the USB mass storage device - * and exports the LUN(s). If CONFIG_NSH_BUILTIN_APPS is defined - * in the NuttX configuration, then this program can be executed by - * entering the "msconn" command at the NSH console. - * - ****************************************************************************/ - -int conn_main(int argc, char *argv[]) -{ - int ret; - - /* If this program is implemented as the NSH 'msconn' command, then we need to - * do a little error checking to assure that we are not being called re-entrantly. - */ - -#ifdef CONFIG_NSH_BUILTIN_APPS - - /* Check if there is a non-NULL USB mass storage device handle (meaning that the - * USB mass storage device is already configured). - */ - - if (g_composite.cmphandle) - { - message("conn_main: ERROR: Already connected\n"); - return 1; - } -#endif - -#ifdef CONFIG_EXAMPLES_COMPOSITE_DEBUGMM -# ifdef CONFIG_CAN_PASS_STRUCTS - g_composite.mmstart = mallinfo(); - g_composite.mmprevious = g_composite.mmstart; -# else - (void)mallinfo(&g_composite.mmstart); - memcpy(&g_composite.mmprevious, &g_composite.mmstart, sizeof(struct mallinfo)); -# endif -#endif - - /* Perform architecture-specific initialization */ - - message("conn_main: Performing architecture-specific intialization\n"); - ret = composite_archinitialize(); - if (ret < 0) - { - message("conn_main: composite_archinitialize failed: %d\n", -ret); - return 1; - } - check_test_memory_usage("After composite_archinitialize()"); - - /* Initialize the USB composite device device */ - - g_composite.cmphandle = composite_initialize(); - if (!g_composite.cmphandle) - { - message("conn_main: composite_initialize failed\n"); - return 1; - } - check_test_memory_usage("After composite_initialize()"); - -#if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0 - /* If USB tracing is enabled and tracing of initial USB events is specified, - * then dump all collected trace data to stdout - */ - - sleep(5); - ret = dumptrace(); - if (ret < 0) - { - goto errout; - } -#endif - - /* It this program was configued as an NSH command, then just exit now. - * Also, if signals are not enabled (and, hence, sleep() is not supported. - * then we have not real option but to exit now. - */ - -#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_DISABLE_SIGNALS) - - /* Otherwise, this thread will hang around and monitor the USB activity */ - - /* Open the serial driver */ - - ret = open_serial(); - if (ret < 0) - { - goto errout; - } - - /* Now looping */ - - for (;;) - { - /* Sleep for a bit */ - - msgflush(); - sleep(5); - - /* Echo any serial data */ - - ret = echo_serial(); - if (ret < 0) - { - goto errout; - } - - /* Dump trace data */ - -# ifdef CONFIG_USBDEV_TRACE - message("\n" "conn_main: USB TRACE DATA:\n"); - ret = dumptrace(); - if (ret < 0) - { - goto errout; - } - check_test_memory_usage("After usbtrace_enumerate()"); -# else - message("conn_main: Still alive\n"); -# endif - } -#else - - message("conn_main: Connected\n"); - check_test_memory_usage("After composite device connection"); -#endif - - /* Dump debug memory usage */ - - message("conn_main: Exiting\n"); -#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_DISABLE_SIGNALS) - close(g_composite.infd); - close(g_composite.outfd); -#endif -#ifdef CONFIG_NSH_BUILTIN_APPS -#endif - final_memory_usage("Final memory usage"); - return 0; - -errout: -#if !defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_DISABLE_SIGNALS) - close(g_composite.infd); - close(g_composite.outfd); -#endif - composite_uninitialize(g_composite.cmphandle); - final_memory_usage("Final memory usage"); - return 1; -} - -/**************************************************************************** - * disconn_main - * - * Description: - * This is a program entry point that will disconnet the USB mass storage - * device. This program is only available if CONFIG_NSH_BUILTIN_APPS - * is defined in the NuttX configuration. In that case, this program can - * be executed by entering the "msdis" command at the NSH console. - * - ****************************************************************************/ - -#ifdef CONFIG_NSH_BUILTIN_APPS -int disconn_main(int argc, char *argv[]) -{ - /* First check if the USB mass storage device is already connected */ - - if (!g_composite.cmphandle) - { - message("disconn_main: ERROR: Not connected\n"); - return 1; - } - check_test_memory_usage("Since MS connection"); - - /* Then disconnect the device and uninitialize the USB mass storage driver */ - - composite_uninitialize(g_composite.cmphandle); - g_composite.mshandle = NULL; - message("disconn_main: Disconnected\n"); - check_test_memory_usage("After composite_uninitialize()"); - - /* Dump debug memory usage */ - - final_memory_usage("Final memory usage"); - return 0; -} -#endif diff --git a/apps/examples/elf/tests/task/Makefile b/apps/examples/control_demo/Makefile index c30fa8076..6e40e645f 100644 --- a/apps/examples/elf/tests/task/Makefile +++ b/apps/examples/control_demo/Makefile @@ -1,8 +1,6 @@ ############################################################################ -# examples/elf/tests/task/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt <gnutt@nuttx.org> +# Copyright (C) 2012 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -14,7 +12,7 @@ # 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 +# 3. Neither the name PX4 nor the names of its contributors may be # used to endorse or promote products derived from this software # without specific prior written permission. # @@ -33,27 +31,12 @@ # ############################################################################ --include $(TOPDIR)/Make.defs - -BIN = task - -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) - -all: $(BIN) - -$(OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ - -$(BIN): $(OBJS) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ +# +# Basic example application +# -clean: - $(call DELFILE, $(BIN)) - $(call CLEAN) +APPNAME = control_demo +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 -install: - $(Q) mkdir -p $(ROMFS_DIR) - $(Q) install $(BIN) $(ROMFS_DIR)/$(BIN) +include $(APPDIR)/mk/app.mk diff --git a/apps/examples/control_demo/control_demo.cpp b/apps/examples/control_demo/control_demo.cpp new file mode 100644 index 000000000..d9c773c05 --- /dev/null +++ b/apps/examples/control_demo/control_demo.cpp @@ -0,0 +1,168 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Author: @author Example User <mail@example.com> + * + * 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 PX4 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. + * + ****************************************************************************/ + +/** + * @file control_demo.cpp + * Demonstration of control library + */ + +#include <nuttx/config.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <systemlib/systemlib.h> +#include <controllib/fixedwing.hpp> +#include <systemlib/param/param.h> +#include <drivers/drv_hrt.h> +#include <math.h> + +static bool thread_should_exit = false; /**< Deamon exit flag */ +static bool thread_running = false; /**< Deamon status flag */ +static int deamon_task; /**< Handle of deamon task / thread */ + +/** + * Deamon management function. + */ +extern "C" __EXPORT int control_demo_main(int argc, char *argv[]); + +/** + * Mainloop of deamon. + */ +int control_demo_thread_main(int argc, char *argv[]); + +/** + * Test function + */ +void test(); + +/** + * Print the correct usage. + */ +static void usage(const char *reason); + +static void +usage(const char *reason) +{ + if (reason) + fprintf(stderr, "%s\n", reason); + + fprintf(stderr, "usage: control_demo {start|stop|status} [-p <additional params>]\n\n"); + exit(1); +} + +/** + * The deamon app only briefly exists to start + * the background job. The stack size assigned in the + * Makefile does only apply to this management task. + * + * The actual stack size should be set in the call + * to task_create(). + */ +int control_demo_main(int argc, char *argv[]) +{ + + if (argc < 1) + usage("missing command"); + + if (!strcmp(argv[1], "start")) { + + if (thread_running) { + printf("control_demo already running\n"); + /* this is not an error */ + exit(0); + } + + thread_should_exit = false; + deamon_task = task_spawn("control_demo", + SCHED_DEFAULT, + SCHED_PRIORITY_MAX - 10, + 4096, + control_demo_thread_main, + (argv) ? (const char **)&argv[2] : (const char **)NULL); + exit(0); + } + + if (!strcmp(argv[1], "test")) { + test(); + exit(0); + } + + if (!strcmp(argv[1], "stop")) { + thread_should_exit = true; + exit(0); + } + + if (!strcmp(argv[1], "status")) { + if (thread_running) { + printf("\tcontrol_demo app is running\n"); + + } else { + printf("\tcontrol_demo app not started\n"); + } + + exit(0); + } + + usage("unrecognized command"); + exit(1); +} + +int control_demo_thread_main(int argc, char *argv[]) +{ + + printf("[control_Demo] starting\n"); + + using namespace control; + + fixedwing::BlockMultiModeBacksideAutopilot autopilot(NULL, "FWB"); + + thread_running = true; + + while (!thread_should_exit) { + autopilot.update(); + } + + printf("[control_demo] exiting.\n"); + + thread_running = false; + + return 0; +} + +void test() +{ + printf("beginning control lib test\n"); + control::basicBlocksTest(); +} diff --git a/apps/examples/control_demo/params.c b/apps/examples/control_demo/params.c new file mode 100644 index 000000000..4eec456fb --- /dev/null +++ b/apps/examples/control_demo/params.c @@ -0,0 +1,63 @@ +#include <systemlib/param/param.h> + +// currently tuned for easystar from arkhangar in HIL +//https://github.com/arktools/arkhangar + +// 16 is max name length + +// gyro low pass filter +PARAM_DEFINE_FLOAT(FWB_P_LP, 10.0f); // roll rate low pass cut freq +PARAM_DEFINE_FLOAT(FWB_Q_LP, 10.0f); // pitch rate low pass cut freq +PARAM_DEFINE_FLOAT(FWB_R_LP, 10.0f); // yaw rate low pass cut freq + +// yaw washout +PARAM_DEFINE_FLOAT(FWB_R_HP, 1.0f); // yaw rate high pass + +// stabilization mode +PARAM_DEFINE_FLOAT(FWB_P2AIL, 0.1f); // roll rate 2 aileron +PARAM_DEFINE_FLOAT(FWB_Q2ELV, 0.1f); // pitch rate 2 elevator +PARAM_DEFINE_FLOAT(FWB_R2RDR, 0.1f); // yaw rate 2 rudder + +// psi -> phi -> p +PARAM_DEFINE_FLOAT(FWB_PSI2PHI, 2.0f); // heading 2 roll +PARAM_DEFINE_FLOAT(FWB_PHI2P, 2.0f); // roll to roll rate +PARAM_DEFINE_FLOAT(FWB_PHI_LIM_MAX, 1.0f); // roll limit + +// velocity -> theta +PARAM_DEFINE_FLOAT(FWB_V2THE_P, 0.5f); +PARAM_DEFINE_FLOAT(FWB_V2THE_I, 0.0f); +PARAM_DEFINE_FLOAT(FWB_V2THE_D, 0.0f); +PARAM_DEFINE_FLOAT(FWB_V2THE_D_LP, 0.0f); +PARAM_DEFINE_FLOAT(FWB_V2THE_I_MAX, 0.0f); +PARAM_DEFINE_FLOAT(FWB_THE_MIN, -1.0f); +PARAM_DEFINE_FLOAT(FWB_THE_MAX, 1.0f); + + +// theta -> q +PARAM_DEFINE_FLOAT(FWB_THE2Q_P, 1.0f); +PARAM_DEFINE_FLOAT(FWB_THE2Q_I, 0.0f); +PARAM_DEFINE_FLOAT(FWB_THE2Q_D, 0.0f); +PARAM_DEFINE_FLOAT(FWB_THE2Q_D_LP, 0.0f); +PARAM_DEFINE_FLOAT(FWB_THE2Q_I_MAX, 0.0f); + +// h -> thr +PARAM_DEFINE_FLOAT(FWB_H2THR_P, 0.005f); +PARAM_DEFINE_FLOAT(FWB_H2THR_I, 0.001f); +PARAM_DEFINE_FLOAT(FWB_H2THR_D, 0.01f); +PARAM_DEFINE_FLOAT(FWB_H2THR_D_LP, 1.0f); +PARAM_DEFINE_FLOAT(FWB_H2THR_I_MAX, 250.0f); + +// crosstrack +PARAM_DEFINE_FLOAT(FWB_XT2YAW_MAX, 1.0f); +PARAM_DEFINE_FLOAT(FWB_XT2YAW, 0.01f); + +// speed command +PARAM_DEFINE_FLOAT(FWB_V_MIN, 20.0f); +PARAM_DEFINE_FLOAT(FWB_V_CMD, 22.0f); +PARAM_DEFINE_FLOAT(FWB_V_MAX, 24.0f); + +// trim +PARAM_DEFINE_FLOAT(FWB_TRIM_AIL, 0.0f); +PARAM_DEFINE_FLOAT(FWB_TRIM_ELV, 0.0f); +PARAM_DEFINE_FLOAT(FWB_TRIM_RDR, 0.0f); +PARAM_DEFINE_FLOAT(FWB_TRIM_THR, 0.7f); diff --git a/apps/examples/cxxtest/Kconfig b/apps/examples/cxxtest/Kconfig deleted file mode 100644 index e8aa3d8f1..000000000 --- a/apps/examples/cxxtest/Kconfig +++ /dev/null @@ -1,14 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_CXXTEST - bool "C++ test program" - default n - depends on HAVE_CXX - ---help--- - Enable the C++ test program - -if EXAMPLES_CXXTEST -endif diff --git a/apps/examples/cxxtest/Makefile b/apps/examples/cxxtest/Makefile deleted file mode 100644 index f0764b6e9..000000000 --- a/apps/examples/cxxtest/Makefile +++ /dev/null @@ -1,125 +0,0 @@ -############################################################################ -# apps/examples/cxxtest/Makefile -# -# Copyright (C) 2009-2012 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# CXX test program - -ASRCS = -CSRCS = -CXXSRCS = cxxtest_main.cxx - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) -CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) -OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# cxxtest built-in application info - -APPNAME = cxxtest -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean chkcxx - -chkcxx: -ifneq ($(CONFIG_HAVE_CXX),y) - @echo "" - @echo "In order to use this example, you toolchain must support must" - @echo "" - @echo " (1) Explicitly select CONFIG_HAVE_CXX to build in C++ support" - @echo " (2) Define CXX, CXXFLAGS, and COMPILEXX in the Make.defs file" - @echo " of the configuration that you are using." - @echo "" - @exit 1 -endif - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -$(CXXOBJS): %$(OBJEXT): %.cxx - $(call COMPILEXX, $<, $@) - -.built: chkcxx $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/cxxtest/cxxtest_main.cxx b/apps/examples/cxxtest/cxxtest_main.cxx deleted file mode 100644 index 9c2974826..000000000 --- a/apps/examples/cxxtest/cxxtest_main.cxx +++ /dev/null @@ -1,227 +0,0 @@ -//*************************************************************************** -// examples/cxxtest/main.cxx -// -// Copyright (C) 2012 Gregory Nutt. All rights reserved. -// Author: Qiang Yu, http://rgmp.sourceforge.net/wiki/index.php/Main_Page -// -// 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/init.h> -#include <nuttx/arch.h> - -#include <iostream> -#include <vector> -#include <map> -#include <stdexcept> -#include <cassert> - -using namespace std; - -//*************************************************************************** -// Definitions -//*************************************************************************** - -//*************************************************************************** -// Private Classes -//*************************************************************************** - -class Base -{ -public: - virtual void printBase(void) {}; -}; - -class Extend : public Base -{ -public: - void printExtend(void) - { - cout << "extend" << endl; - } -}; - -//*************************************************************************** -// Private Data -//*************************************************************************** - -//*************************************************************************** -// Public Functions -//*************************************************************************** - -//*************************************************************************** -// Name: test_iostream -//***************************************************************************/ - -static void test_iostream(void) -{ - cout << "test iostream===========================" << endl; - cout << "Hello, this is only a test" << endl; - cout << "Print an int: " << 190 << endl; - cout << "Print a char: " << 'd' << endl; - -#if 0 - int a; - string s; - - cout << "Please type in an int:" << endl; - cin >> a; - cout << "You type in: " << a << endl; - cout << "Please type in a string:" << endl; - cin >> s; - cout << "You type in: " << s << endl; -#endif -} - -//*************************************************************************** -// Name: test_stl -//***************************************************************************/ - -static void test_stl(void) -{ - cout << "test vector=============================" << endl; - - vector<int> v1; - assert(v1.empty()); - - v1.push_back(1); - assert(!v1.empty()); - - v1.push_back(2); - v1.push_back(3); - v1.push_back(4); - assert(v1.size() == 4); - - v1.pop_back(); - assert(v1.size() == 3); - - cout << "v1=" << v1[0] << ' ' << v1[1] << ' ' << v1[2] << endl; - assert(v1[2] == 3); - - vector<int> v2 = v1; - assert(v2 == v1); - - string words[4] = {"Hello", "World", "Good", "Luck"}; - vector<string> v3(words, words + 4); - vector<string>::iterator it; - for (it = v3.begin(); it != v3.end(); it++) - { - cout << *it << ' '; - } - - cout << endl; - assert(v3[1] == "World"); - - cout << "test map================================" << endl; - - map<int,string> m1; - m1[12] = "Hello"; - m1[24] = "World"; - assert(m1.size() == 2); - assert(m1[24] == "World"); -} - -//*************************************************************************** -// Name: test_rtti -//***************************************************************************/ - -static void test_rtti(void) -{ - cout << "test rtti===============================" << endl; - Base *a = new Base(); - Base *b = new Extend(); - assert(a); - assert(b); - - Extend *t = dynamic_cast<Extend *>(a); - assert(t == NULL); - - t = dynamic_cast<Extend *>(b); - assert(t); - t->printExtend(); - - delete a; - delete b; -} - -//*************************************************************************** -// Name: test_exception -//***************************************************************************/ - -#ifdef CONFIG_UCLIBCXX_EXCEPTION -static void test_exception(void) -{ - cout << "test exception==========================" << endl; - try - { - throw runtime_error("runtime error"); - } - - catch (runtime_error &e) - { - cout << "Catch exception: " << e.what() << endl; - } -} -#endif - -//*************************************************************************** -// Public Functions -//*************************************************************************** - -//*************************************************************************** -// Name: cxxtest_main -//***************************************************************************/ - -extern "C" -{ - int cxxtest_main(int argc, char *argv[]) - { - // If C++ initialization for static constructors is supported, then do - // that first - -#ifdef CONFIG_HAVE_CXXINITIALIZE - up_cxxinitialize(); -#endif - - test_iostream(); - test_stl(); - test_rtti(); -#ifdef CONFIG_UCLIBCXX_EXCEPTION - test_exception(); -#endif - - return 0; - } -} - diff --git a/apps/examples/dhcpd/Kconfig b/apps/examples/dhcpd/Kconfig deleted file mode 100644 index 10f513eca..000000000 --- a/apps/examples/dhcpd/Kconfig +++ /dev/null @@ -1,14 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_DHCPD - bool "DHCP server example" - default n - ---help--- - Enable the DHCP server example - -if EXAMPLES_DHCPD -endif - diff --git a/apps/examples/dhcpd/Makefile b/apps/examples/dhcpd/Makefile deleted file mode 100644 index a41db5cdd..000000000 --- a/apps/examples/dhcpd/Makefile +++ /dev/null @@ -1,109 +0,0 @@ -############################################################################ -# apps/examples/dhcpd/Makefile -# -# Copyright (C) 2009-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# DHCP Daemon Example - -ASRCS = -CSRCS = target.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# DHCPD built-in application info - -APPNAME = dhcpd -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/dhcpd/Makefile.host b/apps/examples/dhcpd/Makefile.host deleted file mode 100644 index 9c074f42b..000000000 --- a/apps/examples/dhcpd/Makefile.host +++ /dev/null @@ -1,62 +0,0 @@ -############################################################################ -# apps/examples/dhcpd/Makefile.host -# -# Copyright (C) 2007, 2009, 2011 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. -# -############################################################################ - -# TOPDIR must be defined on the make command line - -include $(TOPDIR)/Make.defs - -OBJS = host.o1 dhcpd.o1 -BIN = dhcpd - -HOSTCFLAGS += -DCONFIG_NETUTILS_DHCPD_HOST=1 -HOSTCFLAGS += -DCONFIG_NETUTILS_DHCPD_INTERFACE=\"eth1\" -HOSTCFLAGS += -DHAVE_SO_REUSEADDR=1 -HOSTCFLAGS += -DHAVE_SO_BROADCAST=1 - -VPATH = $(TOPDIR)/netutils/dhcpd:. - -all: $(BIN) -.PHONY: clean context clean_context distclean - -$(OBJS): %.o1: %.c - $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ - -$(BIN): $(OBJS) - $(HOSTCC) $(HOSTLDFLAGS) $^ -o $@ - -clean: - @rm -f $(BIN).* *.o1 *~ - - diff --git a/apps/examples/dhcpd/host.c b/apps/examples/dhcpd/host.c deleted file mode 100644 index 479a845c1..000000000 --- a/apps/examples/dhcpd/host.c +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** - * examples/dhcpd/host.c - * - * Copyright (C) 2007, 2009, 2011 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 Gregory Nutt 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 - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -extern int dhcpd_run(void); - -/**************************************************************************** - * main - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - dhcpd_run(); - return 0; -} diff --git a/apps/examples/dhcpd/target.c b/apps/examples/dhcpd/target.c deleted file mode 100644 index 37758d041..000000000 --- a/apps/examples/dhcpd/target.c +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** - * examples/dhcpd/target.c - * - * Copyright (C) 2009, 2011 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 Gregory Nutt 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 <netinet/in.h> -#include <arpa/inet.h> -#include <net/if.h> - -#include <apps/netutils/uiplib.h> -#include <apps/netutils/dhcpd.h> - -/**************************************************************************** - * Preprocessor Definitions - ****************************************************************************/ - -/* Configuation Checkes *****************************************************/ -/* BEWARE: - * There are other configuration settings needed in netutils/dhcpd/dhcpdc.c, - * but there are default values for those so we cannot check them here. - */ - -#ifndef CONFIG_EXAMPLES_DHCPD_IPADDR -# error "You must define CONFIG_EXAMPLES_DHCPD_IPADDR" -#endif - -#ifndef CONFIG_EXAMPLES_DHCPD_DRIPADDR -# error "You must define CONFIG_EXAMPLES_DHCPD_DRIPADDR" -#endif - -#ifndef CONFIG_EXAMPLES_DHCPD_NETMASK -# error "You must define CONFIG_EXAMPLES_DHCPD_NETMASK" -#endif - -#ifndef CONFIG_NET -# error "You must define CONFIG_NET" -#endif - -#ifndef CONFIG_NET_UDP -# error "You must define CONFIG_NET_UDP" -#endif - -#ifndef CONFIG_NET_BROADCAST -# error "You must define CONFIG_NET_BROADCAST" -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Name: dhcpd_main - ****************************************************************************/ - -int dhcpd_main(int argc, char *argv[]) -{ - struct in_addr addr; -#if defined(CONFIG_EXAMPLES_DHCPD_NOMAC) - uint8_t mac[IFHWADDRLEN]; -#endif - -/* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_DHCPD_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up our host address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_DHCPD_IPADDR); - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_DHCPD_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_DHCPD_NETMASK); - uip_setnetmask("eth0", &addr); - - /* Then start the server */ - - dhcpd_run(); - return 0; -} diff --git a/apps/examples/discover/Kconfig b/apps/examples/discover/Kconfig deleted file mode 100644 index 1cbb7f120..000000000 --- a/apps/examples/discover/Kconfig +++ /dev/null @@ -1,45 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_DISCOVER - bool "UDP Discovery Example" - default n - depends on NET_UDP - select NETUTILS_DISCOVER - ---help--- - Enable the netutils/discover utility. This example initializes and - starts the UDP discover daemon. This daemon is useful for - discovering devices in local networks, especially with DHCP - configured devices. It listens for UDP broadcasts which also can - include a device class so that groups of devices can be discovered. - It is also possible to address all classes with a kind of broadcast - discover. - -config EXAMPLES_DISCOVER_DHCPC - bool "DHCP Client" - default n - depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS - select NETUTILS_DHCPC - select NETUTILS_RESOLV - -config EXAMPLES_DISCOVER_NOMAC - bool "Use Canned MAC Address" - default n - depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS - -config EXAMPLES_DISCOVER_IPADDR - hex "Target IP address" - default 0x0a000002 - depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS && !EXAMPLES_DISCOVER_DHCPC - -config EXAMPLES_DISCOVER_DRIPADDR - hex "Default Router IP address (Gateway)" - default 0x0a000001 - depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS - -config EXAMPLES_DISCOVER_NETMASK - hex "Network Mask" - default 0xffffff00 - depends on EXAMPLES_DISCOVER && !NSH_BUILTIN_APPS diff --git a/apps/examples/discover/Makefile b/apps/examples/discover/Makefile deleted file mode 100644 index 2ce52a18e..000000000 --- a/apps/examples/discover/Makefile +++ /dev/null @@ -1,109 +0,0 @@ -############################################################################ -# apps/examples/discover/Makefile -# -# Copyright (C) 2012 Max Holtzberg. All rights reserved. -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. -# -# Authors: Max Holtzberg <mh@uvc.de> -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# Discover built-in application info - -APPNAME = discover -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -ASRCS = -CSRCS = discover_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/discover/discover_main.c b/apps/examples/discover/discover_main.c deleted file mode 100644 index 259a93d98..000000000 --- a/apps/examples/discover/discover_main.c +++ /dev/null @@ -1,188 +0,0 @@ -/**************************************************************************** - * examples/discover/discover_main.c - * - * Copyright (C) 2012 Max Holtzberg. All rights reserved. - * Copyright (C) 2008, 2011-2012 Gregory Nutt. All rights reserved. - * - * Authors: Max Holtzberg <mh@uvc.de> - * 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 <stdint.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <time.h> -#include <debug.h> - -#include <net/if.h> -#include <nuttx/net/uip/uip.h> -#include <nuttx/net/uip/uip-arp.h> - -#include <apps/netutils/uiplib.h> -#include <apps/netutils/discover.h> - -#ifdef CONFIG_EXAMPLES_DISCOVER_DHCPC -# include <arpa/inet.h> -#endif - -/* Here we include the header file for the application(s) we use in - * our project as defined in the config/<board-name>/defconfig file - */ - -/* DHCPC may be used in conjunction with any other feature (or not) */ - -#ifdef CONFIG_EXAMPLES_DISCOVER_DHCPC -# include <apps/netutils/resolv.h> -# include <apps/netutils/dhcpc.h> -#endif - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * discover_main - ****************************************************************************/ - -int discover_main(int argc, char *argv[]) -{ - /* If this task is excecutated as an NSH built-in function, then the - * network has already been configured by NSH's start-up logic. - */ - -#ifndef CONFIG_NSH_BUILTIN_APPS - struct in_addr addr; -#if defined(CONFIG_EXAMPLES_DISCOVER_DHCPC) || defined(CONFIG_EXAMPLES_DISCOVER_NOMAC) - uint8_t mac[IFHWADDRLEN]; -#endif -#ifdef CONFIG_EXAMPLES_DISCOVER_DHCPC - void *handle; -#endif - -/* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_DISCOVER_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up our host address */ - -#ifdef CONFIG_EXAMPLES_DISCOVER_DHCPC - addr.s_addr = 0; -#else - addr.s_addr = HTONL(CONFIG_EXAMPLES_DISCOVER_IPADDR); -#endif - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_DISCOVER_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_DISCOVER_NETMASK); - uip_setnetmask("eth0", &addr); - -#ifdef CONFIG_EXAMPLES_DISCOVER_DHCPC - /* Set up the resolver */ - - resolv_init(); - - /* Get the MAC address of the NIC */ - - uip_getmacaddr("eth0", mac); - - /* Set up the DHCPC modules */ - - handle = dhcpc_open(&mac, IFHWADDRLEN); - - /* Get an IP address. Note: there is no logic here for renewing the address in this - * example. The address should be renewed in ds.lease_time/2 seconds. - */ - - printf("Getting IP address\n"); - if (handle) - { - struct dhcpc_state ds; - (void)dhcpc_request(handle, &ds); - uip_sethostaddr("eth1", &ds.ipaddr); - - if (ds.netmask.s_addr != 0) - { - uip_setnetmask("eth0", &ds.netmask); - } - - if (ds.default_router.s_addr != 0) - { - uip_setdraddr("eth0", &ds.default_router); - } - - if (ds.dnsaddr.s_addr != 0) - { - resolv_conf(&ds.dnsaddr); - } - - dhcpc_close(handle); - printf("IP: %s\n", inet_ntoa(ds.ipaddr)); - } - -#endif /* CONFIG_EXAMPLES_DISCOVER_DHCPC */ -#endif /* CONFIG_NSH_BUILTIN_APPS */ - - if (discover_start() < 0) - { - ndbg("Could not start discover daemon.\n"); - return ERROR; - } - - return OK; -} - diff --git a/apps/examples/elf/Kconfig b/apps/examples/elf/Kconfig deleted file mode 100644 index c62a98486..000000000 --- a/apps/examples/elf/Kconfig +++ /dev/null @@ -1,29 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_ELF - bool "ELF Loader Example" - default n - ---help--- - Enable the ELF loader example - -if EXAMPLES_ELF -config EXAMPLES_ELF_DEVMINOR - int "ROMFS Minor Device Number" - default 0 - ---help--- - The minor device number of the ROMFS block. For example, the N in /dev/ramN. - Used for registering the RAM block driver that will hold the ROMFS file system - containing the ELF executables to be tested. Default: 0 - -config EXAMPLES_ELF_DEVPATH - string "ROMFS Devie Path" - default "/dev/ram0" - ---help--- - The path to the ROMFS block driver device. This must match EXAMPLES_ELF_DEVMINOR. - Used for registering the RAM block driver that will hold the ROMFS file system - containing the ELF executables to be tested. Default: "/dev/ram0" - -endif diff --git a/apps/examples/elf/Makefile b/apps/examples/elf/Makefile deleted file mode 100644 index 1467bf008..000000000 --- a/apps/examples/elf/Makefile +++ /dev/null @@ -1,110 +0,0 @@ -############################################################################ -# apps/examples/elf/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# ELF Example - -ASRCS = -CSRCS = elf_main.c symtab.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . --dep-path tests - -# Build targets - -VPATH = tests - -all: .built -.PHONY: really_build clean_tests clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -# This is a little messy. The build is broken into two pieces: (1) the -# tests/ subdir build that auto-generates several files, and (2) the real -# build. This is done because we need a fresh build context after auto- -# generating the source files. - -really_build: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.built: - @$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) - @$(MAKE) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" really_build - -context: - -# We can't make dependencies in this directory because the required -# header files may not yet exist. - -.depend: - @touch $@ - -depend: .depend - -clean_tests: - @$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) clean - -clean: clean_tests - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/elf/elf_main.c b/apps/examples/elf/elf_main.c deleted file mode 100644 index 66a47592c..000000000 --- a/apps/examples/elf/elf_main.c +++ /dev/null @@ -1,344 +0,0 @@ -/**************************************************************************** - * examples/elf/elf_main.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 <nuttx/compiler.h> - -#include <sys/mount.h> - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <pthread.h> -#include <debug.h> -#include <errno.h> - -#include <nuttx/ramdisk.h> -#include <nuttx/binfmt/binfmt.h> -#include <nuttx/binfmt/elf.h> -#include <nuttx/binfmt/symtab.h> - -#include "tests/romfs.h" -#include "tests/dirlist.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Check configuration. This is not all of the configuration settings that - * are required -- only the more obvious. - */ - -#if CONFIG_NFILE_DESCRIPTORS < 1 -# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" -#endif - -#ifdef CONFIG_BINFMT_DISABLE -# error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!" -#endif - -#ifndef CONFIG_ELF -# error "You must select CONFIG_ELF in your configuration file" -#endif - -#ifndef CONFIG_FS_ROMFS -# error "You must select CONFIG_FS_ROMFS in your configuration file" -#endif - -#ifdef CONFIG_DISABLE_MOUNTPOINT -# error "You must not disable mountpoints via CONFIG_DISABLE_MOUNTPOINT in your configuration file" -#endif - -#ifdef CONFIG_BINFMT_DISABLE -# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file" -#endif - -/* Describe the ROMFS file system */ - -#define SECTORSIZE 512 -#define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE) -#define MOUNTPT "/mnt/romfs" - -#ifndef CONFIG_EXAMPLES_ELF_DEVMINOR -# define CONFIG_EXAMPLES_ELF_DEVMINOR 0 -#endif - -#ifndef CONFIG_EXAMPLES_ELF_DEVPATH -# define CONFIG_EXAMPLES_ELF_DEVPATH "/dev/ram0" -#endif - -/* If CONFIG_DEBUG is enabled, use dbg instead of printf so that the - * output will be synchronous with the debug output. - */ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(format, arg...) dbg(format, ##arg) -# define err(format, arg...) dbg(format, ##arg) -# else -# define message(format, arg...) printf(format, ##arg) -# define err(format, arg...) fprintf(stderr, format, ##arg) -# endif -#else -# ifdef CONFIG_DEBUG -# define message dbg -# define err dbg -# else -# define message printf -# define err printf -# endif -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static unsigned int g_mminitial; /* Initial memory usage */ -static unsigned int g_mmstep; /* Memory Usage at beginning of test step */ - -static const char delimiter[] = - "****************************************************************************"; - -#ifndef CONFIG_BINFMT_EXEPATH -static char fullpath[128]; -#endif - -/**************************************************************************** - * Symbols from Auto-Generated Code - ****************************************************************************/ - -extern const struct symtab_s exports[]; -extern const int nexports; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: mm_update - ****************************************************************************/ - -static void mm_update(FAR unsigned int *previous, FAR const char *msg) -{ - struct mallinfo mmcurrent; - - /* Get the current memory usage */ - -#ifdef CONFIG_CAN_PASS_STRUCTS - mmcurrent = mallinfo(); -#else - (void)mallinfo(&mmcurrent); -#endif - - /* Show the change from the previous time */ - - printf("\nMemory Usage %s:\n", msg); - printf(" Before: %8u After: %8u Change: %8d\n", - *previous, mmcurrent.uordblks, (int)mmcurrent.uordblks - (int)*previous); - - /* Set up for the next test */ - - *previous = mmcurrent.uordblks; -} - -/**************************************************************************** - * Name: mm_initmonitor - ****************************************************************************/ - -static void mm_initmonitor(void) -{ - struct mallinfo mmcurrent; - -#ifdef CONFIG_CAN_PASS_STRUCTS - mmcurrent = mallinfo(); -#else - (void)mallinfo(&mmcurrent); -#endif - - g_mminitial = mmcurrent.uordblks; - g_mmstep = mmcurrent.uordblks; - - printf("Initial memory usage: %d\n", mmcurrent.uordblks); -} - -/**************************************************************************** - * Name: testheader - ****************************************************************************/ - -static inline void testheader(FAR const char *progname) -{ - message("\n%s\n* Executing %s\n%s\n\n", delimiter, progname, delimiter); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: elf_main - ****************************************************************************/ - -int elf_main(int argc, char *argv[]) -{ - struct binary_s bin; - int ret; - int i; - - /* Initialize the memory monitor */ - - mm_initmonitor(); - - /* Initialize the ELF binary loader */ - - message("Initializing the ELF binary loader\n"); - ret = elf_initialize(); - if (ret < 0) - { - err("ERROR: Initialization of the ELF loader failed: %d\n", ret); - exit(1); - } - - mm_update(&g_mmstep, "after elf_initialize"); - - /* Create a ROM disk for the ROMFS filesystem */ - - message("Registering romdisk at /dev/ram%d\n", CONFIG_EXAMPLES_ELF_DEVMINOR); - ret = romdisk_register(CONFIG_EXAMPLES_ELF_DEVMINOR, (FAR uint8_t *)romfs_img, - NSECTORS(romfs_img_len), SECTORSIZE); - if (ret < 0) - { - err("ERROR: romdisk_register failed: %d\n", ret); - elf_uninitialize(); - exit(1); - } - - mm_update(&g_mmstep, "after romdisk_register"); - - /* Mount the file system */ - - message("Mounting ROMFS filesystem at target=%s with source=%s\n", - MOUNTPT, CONFIG_EXAMPLES_ELF_DEVPATH); - - ret = mount(CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, "romfs", MS_RDONLY, NULL); - if (ret < 0) - { - err("ERROR: mount(%s,%s,romfs) failed: %s\n", - CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, errno); - elf_uninitialize(); - } - - mm_update(&g_mmstep, "after mount"); - - /* Does the system support the PATH variable? Has the PATH variable - * already been set? If YES and NO, then set the PATH variable to - * the ROMFS mountpoint. - */ - -#if defined(CONFIG_BINFMT_EXEPATH) && !defined(CONFIG_PATH_INITIAL) - (void)setenv("PATH", MOUNTPT, 1); -#endif - - /* Now excercise every program in the ROMFS file system */ - - for (i = 0; dirlist[i]; i++) - { - /* Output a seperated so that we can clearly discrinmate the output of - * this program from the others. - */ - - testheader(dirlist[i]); - - /* Initialize the binary_s structure */ - - memset(&bin, 0, sizeof(struct binary_s)); - - /* If the binary loader does not support the PATH variable, then - * create the full path to the executable program. Otherwise, - * use the relative path so that the binary loader will have to - * search the PATH variable to find the executable. - */ - -#ifdef CONFIG_BINFMT_EXEPATH - bin.filename = dirlist[i]; -#else - snprintf(fullpath, 128, "%s/%s", MOUNTPT, dirlist[i]); - bin.filename = fullpath; -#endif - bin.exports = exports; - bin.nexports = nexports; - - /* Load the ELF module */ - - ret = load_module(&bin); - if (ret < 0) - { - err("ERROR: Failed to load program '%s'\n", dirlist[i]); - exit(1); - } - - mm_update(&g_mmstep, "after load_module"); - - /* Execute the ELF module */ - - ret = exec_module(&bin, 50); - - mm_update(&g_mmstep, "after exec_module"); - - if (ret < 0) - { - err("ERROR: Failed to execute program '%s'\n", dirlist[i]); - } - else - { - message("Wait a bit for test completion\n"); - sleep(4); - } - - unload_module(&bin); - mm_update(&g_mmstep, "after unload_module"); - } - - mm_update(&g_mmstep, "End-of-Test"); - return 0; -} diff --git a/apps/examples/elf/tests/Makefile b/apps/examples/elf/tests/Makefile deleted file mode 100644 index 778dd6480..000000000 --- a/apps/examples/elf/tests/Makefile +++ /dev/null @@ -1,120 +0,0 @@ -############################################################################ -# apps/examples/elf/tests/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -ALL_SUBDIRS = errno hello helloxx longjmp mutex pthread signal task struct -BUILD_SUBDIRS = errno hello task struct - -ifeq ($(CONFIG_HAVE_CXX),y) -BUILD_SUBDIRS += helloxx -endif - -ifeq ($(CONFIG_EXAMPLES_ELF_LONGJMP),y) -BUILD_SUBDIRS += longjmp -endif - -ifneq ($(CONFIG_DISABLE_PTHREAD),y) -BUILD_SUBDIRS += mutex pthread -endif - -ifneq ($(CONFIG_DISABLE_SIGNALS),y) -BUILD_SUBDIRS += signal -endif - -ELF_DIR = $(APPDIR)/examples/elf -TESTS_DIR = $(ELF_DIR)/tests -ROMFS_DIR = $(TESTS_DIR)/romfs -ROMFS_IMG = $(TESTS_DIR)/romfs.img -ROMFS_HDR = $(TESTS_DIR)/romfs.h -DIRLIST_HDR = $(TESTS_DIR)/dirlist.h -SYMTAB_SRC = $(TESTS_DIR)/symtab.c - -define DIR_template -$(1)_$(2): - @$(MAKE) -C $(1) $(3) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" CROSSDEV=$(CROSSDEV) -endef - -all: $(ROMFS_HDR) $(DIRLIST_HDR) $(SYMTAB_SRC) -.PHONY: all build clean install populate - -$(foreach DIR, $(BUILD_SUBDIRS), $(eval $(call DIR_template,$(DIR),build, all))) -$(foreach DIR, $(ALL_SUBDIRS), $(eval $(call DIR_template,$(DIR),clean,clean))) -$(foreach DIR, $(BUILD_SUBDIRS), $(eval $(call DIR_template,$(DIR),install,install))) - -# Build program(s) in each sud-directory - -build: $(foreach DIR, $(BUILD_SUBDIRS), $(DIR)_build) - -# Install each program in the romfs directory - -install: $(foreach DIR, $(BUILD_SUBDIRS), $(DIR)_install) - -# Create the romfs directory - -$(ROMFS_DIR): - @mkdir $(ROMFS_DIR) - -# Populate the romfs directory - -populate: $(ROMFS_DIR) build install - -# Create the romfs.img file from the populated romfs directory - -$(ROMFS_IMG): populate - @genromfs -f $@ -d $(ROMFS_DIR) -V "ELFTEST" - -# Create the romfs.h header file from the romfs.img file - -$(ROMFS_HDR) : $(ROMFS_IMG) - @(cd $(TESTS_DIR); xxd -i romfs.img | sed -e "s/^unsigned/static const unsigned/g" >$@) - -# Create the dirlist.h header file from the romfs directory - -$(DIRLIST_HDR) : populate - @$(TESTS_DIR)/mkdirlist.sh $(ROMFS_DIR) >$@ - -# Create the exported symbol table list from the derived *-thunk.S files - -$(SYMTAB_SRC): build - @$(TESTS_DIR)/mksymtab.sh -t varlist.tmp $(ROMFS_DIR) >$@ - -# Clean each subdirectory - -clean: $(foreach DIR, $(ALL_SUBDIRS), $(DIR)_clean) - @rm -f $(ROMFS_HDR) $(ROMFS_IMG) $(SYMTAB_SRC) varlist.tmp - @rm -rf $(ROMFS_DIR) $(DIRLIST_HDR) diff --git a/apps/examples/elf/tests/errno/errno.c b/apps/examples/elf/tests/errno/errno.c deleted file mode 100644 index adc88ddd3..000000000 --- a/apps/examples/elf/tests/errno/errno.c +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * examples/elf/tests/errno/errno.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 <stdio.h> -#include <stdlib.h> -#include <errno.h> - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -static const char g_nonexistent[] = "aflav-sautga-ay"; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - FILE *test_stream; - - /* Try using stdout and stderr explicitly. These are global variables - * exported from the base code. - */ - - fprintf(stdout, "Hello, World on stdout\n"); - fprintf(stderr, "Hello, World on stderr\n"); - - /* Try opening a non-existent file using buffered IO. */ - - test_stream = fopen(g_nonexistent, "r"); - if (test_stream) - { - fprintf(stderr, "Hmm... Delete \"%s\" and try this again\n", - g_nonexistent); - exit(1); - } - - /* Now print the errno on stderr. Errno is also a global - * variable exported by the base code. - */ - - fprintf(stderr, "We failed to open \"%s!\" errno is %d\n", - g_nonexistent, errno); - - return 0; -} diff --git a/apps/examples/elf/tests/hello/hello.c b/apps/examples/elf/tests/hello/hello.c deleted file mode 100644 index 6b1d079d8..000000000 --- a/apps/examples/elf/tests/hello/hello.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * examples/elf/tests/hello/hello.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 <stdio.h> -#include <stdlib.h> - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - int i; - - /* Mandatory "Hello, world!" */ - - puts("Getting ready to say \"Hello, world\"\n"); - printf("Hello, world!\n"); - puts("It has been said.\n"); - - /* Print arguments */ - - printf("argc\t= %d\n", argc); - printf("argv\t= 0x%p\n", argv); - - for (i = 0; i < argc; i++) - { - printf("argv[%d]\t= ", i); - if (argv[i]) - { - printf("(0x%p) \"%s\"\n", argv[i], argv[i]); - } - else - { - printf("NULL?\n"); - } - } - - printf("argv[%d]\t= 0x%p\n", argc, argv[argc]); - printf("Goodbye, world!\n"); - return 0; -} diff --git a/apps/examples/elf/tests/helloxx/Makefile b/apps/examples/elf/tests/helloxx/Makefile deleted file mode 100644 index cce33d843..000000000 --- a/apps/examples/elf/tests/helloxx/Makefile +++ /dev/null @@ -1,128 +0,0 @@ -############################################################################ -# examples/elf/tests/helloxx/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN1 = hello++1 -BIN2 = hello++2 -ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) -BIN3 = hello++3 -endif -#BIN4 = hello++4 -ALL_BIN = $(BIN1) $(BIN2) $(BIN3) $(BIN4) - -SRCS1 = $(BIN1).c -OBJS1 = $(SRCS1:.c=.o) - -SRCS2 = $(BIN2).c -OBJS2 = $(SRCS2:.c=.o) - -ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) -SRCS3 = $(BIN3).c -OBJS3 = $(SRCS3:.c=.o) -endif - -#SRCS4 = $(BIN4).c -#OBJS4 = $(SRCS4:.c=.o) - -SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) -OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) - -LIBSTDC_STUBS_DIR = $(TOPDIR)/libxx -LIBSTDC_STUBS_LIB = $(LIBSTDC_STUBS_DIR)/liblibxx.a - -all: $(BIN1) $(BIN2) $(BIN3) $(BIN4) - -$(OBJS): %.o: %.cpp - @echo "CC: $<" - $(Q) $(CXX) -c $(CXXELFFLAGS) $< -o $@ - -# This contains libstdc++ stubs to that you can build C++ code -# without actually having libstdc++ - -$(LIBSTDC_STUBS_LIB): - $(Q) $(MAKE) -C $(LIBSTDC_STUBS_DIR) TOPDIR=$(TOPDIR) - -# BIN1 and BIN2 link just like C code because they contain no -# static constructors. BIN1 is equivalent to a C hello world; -# BIN2 contains a class that implements hello world, but it is -# not statically initialized. - -$(BIN1): $(OBJS1) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ - -$(BIN2): $(OBJS2) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ - -# BIN3 is equivalent to BIN2 except that is uses static initializers - -ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) -$(BIN3): $(OBJS3) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ -endif - -# BIN4 is similar to BIN3 except that it uses the streams code from libstdc++ -# -# NOTE: libstdc++ is not available for NuttX as of this writing -# -#$(BIN4): $(OBJS4) -# @echo "LD: $<" -# $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN1)) - $(call DELFILE, $(BIN2)) - $(call DELFILE, $(BIN3)) - $(call DELFILE, $(BIN4)) - $(call CLEAN) - -install: $(ALL_BIN) - $(Q) mkdir -p $(ROMFS_DIR) - $(Q) install $(BIN1) $(ROMFS_DIR)/$(BIN1) - $(Q) install $(BIN2) $(ROMFS_DIR)/$(BIN2) -ifeq ($(CONFIG_BINFMT_CONSTRUCTORS),y) - $(Q) install $(BIN3) $(ROMFS_DIR)/$(BIN3) -endif -# $(Q) install $(BIN4) $(ROMFS_DIR)/$(BIN4) - - - - - - - diff --git a/apps/examples/elf/tests/helloxx/hello++1.cpp b/apps/examples/elf/tests/helloxx/hello++1.cpp deleted file mode 100644 index 9ab9d4ded..000000000 --- a/apps/examples/elf/tests/helloxx/hello++1.cpp +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// examples/elf/tests/helloxx/hello++1.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. -// -///////////////////////////////////////////////////////////////////////////// -// -// This is an trivial version of "Hello, World" program. It illustrates -// that we can build C programs using the C++ compiler. -// -// - Building a C++ program to use the C library -// - No class creation -// - NO Streams -// - NO Static constructor and destructors -// -///////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// -// Included Files -///////////////////////////////////////////////////////////////////////////// - -#include <cstdio> - -///////////////////////////////////////////////////////////////////////////// -// Public Functions -///////////////////////////////////////////////////////////////////////////// - -int main(int argc, char **argv) -{ - printf("Hello, World!\n"); - return 0; -} diff --git a/apps/examples/elf/tests/helloxx/hello++2.cpp b/apps/examples/elf/tests/helloxx/hello++2.cpp deleted file mode 100644 index f1268dda5..000000000 --- a/apps/examples/elf/tests/helloxx/hello++2.cpp +++ /dev/null @@ -1,123 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// examples/elf/tests/helloxx/hello++2.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. -// -///////////////////////////////////////////////////////////////////////////// -// -// This is an another trivial version of "Hello, World" design. It illustrates -// -// - Building a C++ program to use the C library -// - Basic class creation -// - NO Streams -// - NO Static constructor and destructors -// -///////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// -// Included Files -///////////////////////////////////////////////////////////////////////////// - -#include <cstdio> - -///////////////////////////////////////////////////////////////////////////// -// Classes -///////////////////////////////////////////////////////////////////////////// - -class CThingSayer -{ - const char *szWhatToSay; -public: - CThingSayer(void) - { - printf("CThingSayer::CThingSayer: I am!\n"); - szWhatToSay = (const char*)NULL; - } - - ~CThingSayer(void) - { - printf("CThingSayer::~CThingSayer: I cease to be\n"); - if (szWhatToSay) - { - printf("CThingSayer::~CThingSayer: I will never say '%s' again\n", - szWhatToSay); - } - szWhatToSay = (const char*)NULL; - } - - void Initialize(const char *czSayThis) - { - printf("CThingSayer::Initialize: When told, I will say '%s'\n", - czSayThis); - szWhatToSay = czSayThis; - } - - void SayThing(void) - { - printf("CThingSayer::SayThing: I am now saying '%s'\n", szWhatToSay); - } -}; - -///////////////////////////////////////////////////////////////////////////// -// Public Functions -///////////////////////////////////////////////////////////////////////////// - -int main(int argc, char **argv) -{ - CThingSayer *MyThingSayer; - - printf("main: Started. Creating MyThingSayer\n"); - - // Create an instance of the CThingSayer class - // We should see the message from constructor, CThingSayer::CThingSayer(), - - MyThingSayer = new CThingSayer; - printf("main: Created MyThingSayer=0x%08lx\n", (long)MyThingSayer); - - // Tell MyThingSayer that "Hello, World!" is the string to be said - - printf("main: Calling MyThingSayer->Initialize\n");; - MyThingSayer->Initialize("Hello, World!"); - - // Tell MyThingSayer to say the thing we told it to say - - printf("main: Calling MyThingSayer->SayThing\n");; - MyThingSayer->SayThing(); - - // We should see the message from the destructor, - // CThingSayer::~CThingSayer(), AFTER we see the following - - printf("main: Destroying MyThingSayer\n"); - delete MyThingSayer; - - printf("main: Returning\n");; - return 0; -} diff --git a/apps/examples/elf/tests/helloxx/hello++3.cpp b/apps/examples/elf/tests/helloxx/hello++3.cpp deleted file mode 100644 index 6661a3fd1..000000000 --- a/apps/examples/elf/tests/helloxx/hello++3.cpp +++ /dev/null @@ -1,132 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// examples/elf/tests/helloxx/hello++3.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. -// -///////////////////////////////////////////////////////////////////////////// -// -// This is an another trivial version of "Hello, World" design. It illustrates -// -// - Building a C++ program to use the C library and stdio -// - Basic class creation with virtual methods. -// - Static constructor and destructors (in main program only) -// - NO Streams -// -///////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// -// Included Files -///////////////////////////////////////////////////////////////////////////// - -#include <cstdio> - -///////////////////////////////////////////////////////////////////////////// -// Classes -///////////////////////////////////////////////////////////////////////////// - -class CThingSayer -{ - const char *szWhatToSay; -public: - CThingSayer(void); - virtual ~CThingSayer(void); - virtual void Initialize(const char *czSayThis); - virtual void SayThing(void); -}; - -// A static instance of the CThingSayer class. This instance MUST -// be constructed by the system BEFORE the program is started at -// main() and must be destructed by the system AFTER the main() -// returns to the system - -static CThingSayer MyThingSayer; - -// These are implementations of the methods of the CThingSayer class - -CThingSayer::CThingSayer(void) -{ - printf("CThingSayer::CThingSayer: I am!\n"); - szWhatToSay = (const char*)NULL; -} - -CThingSayer::~CThingSayer(void) -{ - printf("CThingSayer::~CThingSayer: I cease to be\n"); - if (szWhatToSay) - { - printf("CThingSayer::~CThingSayer: I will never say '%s' again\n", - szWhatToSay); - } - szWhatToSay = (const char*)NULL; -} - -void CThingSayer::Initialize(const char *czSayThis) -{ - printf("CThingSayer::Initialize: When told, I will say '%s'\n", - czSayThis); - szWhatToSay = czSayThis; -} - -void CThingSayer::SayThing(void) -{ - printf("CThingSayer::SayThing: I am now saying '%s'\n", szWhatToSay); -} - -///////////////////////////////////////////////////////////////////////////// -// Public Functions -///////////////////////////////////////////////////////////////////////////// - -int main(int argc, char **argv) -{ - // We should see the message from constructor, CThingSayer::CThingSayer(), - // BEFORE we see the following messages. That is proof that the - // C++ static initializer is working - - printf("main: Started. MyThingSayer should already exist\n"); - - // Tell MyThingSayer that "Hello, World!" is the string to be said - - printf("main: Calling MyThingSayer.Initialize\n");; - MyThingSayer.Initialize("Hello, World!"); - - // Tell MyThingSayer to say the thing we told it to say - - printf("main: Calling MyThingSayer.SayThing\n");; - MyThingSayer.SayThing(); - - // We are finished, return. We should see the message from the - // destructor, CThingSayer::~CThingSayer(), AFTER we see the following - // message. That is proof that the C++ static destructor logic - // is working - - printf("main: Returning. MyThingSayer should be destroyed\n");; - return 0; -} diff --git a/apps/examples/elf/tests/helloxx/hello++4.cpp b/apps/examples/elf/tests/helloxx/hello++4.cpp deleted file mode 100644 index 7db2564ed..000000000 --- a/apps/examples/elf/tests/helloxx/hello++4.cpp +++ /dev/null @@ -1,150 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// examples/elf/tests/helloxx/hello++4.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. -// -///////////////////////////////////////////////////////////////////////////// -// -// This is an excessively complex version of "Hello, World" design to -// illustrate some basic properties of C++: -// -// - Building a C++ program -// - Streams / statically linked libstdc++ -// - Static constructor and destructors (in main program only) -// -///////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// -// Included Files -///////////////////////////////////////////////////////////////////////////// - -#include <cstdio> -#include <iostream> - -#ifndef NULL -# define NULL ((void*)0L) -#endif - -///////////////////////////////////////////////////////////////////////////// -// Classes -///////////////////////////////////////////////////////////////////////////// - -using namespace std; - -// A hello world sayer class - -class CThingSayer -{ - const char *szWhatToSay; -public: - CThingSayer(void); - virtual ~CThingSayer(void); - virtual void Initialize(const char *czSayThis); - virtual void SayThing(void); -}; - -///////////////////////////////////////////////////////////////////////////// -// Private Data -///////////////////////////////////////////////////////////////////////////// - -// A static instance of the CThingSayer class. This instance MUST -// be constructed by the system BEFORE the program is started at -// main() and must be destructed by the system AFTER the main() -// returns to the system - -static CThingSayer MyThingSayer; - -///////////////////////////////////////////////////////////////////////////// -// Method Implementations -///////////////////////////////////////////////////////////////////////////// - -// These are implementations of the methods of the CThingSayer class - -CThingSayer::CThingSayer(void) -{ - cout << "CThingSayer::CThingSayer: I am!" << endl; - szWhatToSay = (const char*)NULL; -} - -CThingSayer::~CThingSayer(void) -{ - cout << "CThingSayer::~CThingSayer: I cease to be" << endl; - if (szWhatToSay) - { - cout << "CThingSayer::~CThingSayer: I will never say '" - << szWhatToSay << "' again" << endl; - } - szWhatToSay = (const char*)NULL; -} - -void CThingSayer::Initialize(const char *czSayThis) -{ - cout << "CThingSayer::Initialize: When told, I will say '" - << czSayThis << "'" << endl; - szWhatToSay = czSayThis; -} - -void CThingSayer::SayThing(void) -{ - cout << "CThingSayer::SayThing: I am now saying '" - << szWhatToSay << "'" << endl; -} - -///////////////////////////////////////////////////////////////////////////// -// Public Functions -///////////////////////////////////////////////////////////////////////////// - -int main(int argc, char **argv) -{ - // We should see the message from constructor, CThingSayer::CThingSayer(), - // BEFORE we see the following messages. That is proof that the - // C++ static initializer is working - - cout << "main: Started" << endl; - - // Tell MyThingSayer that "Hello, World!" is the string to be said - - cout << "main: Calling MyThingSayer.Initialize" << endl; - MyThingSayer.Initialize("Hello, World!"); - - // Tell MyThingSayer to say the thing we told it to say - - cout << "main: Calling MyThingSayer.SayThing" << endl; - MyThingSayer.SayThing(); - - // We are finished, return. We should see the message from the - // destructor, CThingSayer::~CThingSayer(), AFTER we see the following - // message. That is proof that the C++ static destructor logic - // is working - - cout << "main: Returning" << endl; - return 0; -} diff --git a/apps/examples/elf/tests/longjmp/Makefile b/apps/examples/elf/tests/longjmp/Makefile deleted file mode 100644 index 6ddbf9b8d..000000000 --- a/apps/examples/elf/tests/longjmp/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -############################################################################ -# examples/elf/tests/longjmp/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = longjmp - -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) - -all: $(BIN) - -$(OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ - -$(BIN): $(OBJS) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call CLEAN) - -install: - $(Q) mkdir -p $(ROMFS_DIR) - $(Q) install $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/apps/examples/elf/tests/longjmp/longjmp.c b/apps/examples/elf/tests/longjmp/longjmp.c deleted file mode 100644 index 74d5594c4..000000000 --- a/apps/examples/elf/tests/longjmp/longjmp.c +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** - * examples/elf/tests/longjmp/longjmp.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 <stdio.h> -#include <setjmp.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define MAIN_VAL 47 -#define FUNC_VAL 92 -#define LEAF_VAL 163 - -#define FUNCTION_ARG MAIN_VAL -#define LEAF_ARG (FUNCTION_ARG + FUNC_VAL) -#define SETJMP_RETURN (LEAF_ARG + LEAF_VAL) - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static jmp_buf env; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static int leaf(int *some_arg) -{ - int some_local_variable = *some_arg + LEAF_VAL; - - printf("leaf: received %d\n", *some_arg); - - if (*some_arg != LEAF_ARG) - printf("leaf: ERROR: expected %d\n", LEAF_ARG); - - printf("leaf: Calling longjmp() with %d\n", some_local_variable); - - longjmp(env, some_local_variable); - - /* We should not get here */ - - return -ERROR; -} - -static int function(int some_arg) -{ - int some_local_variable = some_arg + FUNC_VAL; - int retval; - - printf("function: received %d\n", some_arg); - - if (some_arg != FUNCTION_ARG) - printf("function: ERROR: expected %d\n", FUNCTION_ARG); - - printf("function: Calling leaf() with %d\n", some_local_variable); - - retval = leaf(&some_local_variable); - - printf("function: ERROR -- leaf returned!\n"); - return retval; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - int value; - - printf("main: Calling setjmp\n"); - value = setjmp(env); - printf("main: setjmp returned %d\n", value); - - if (value == 0) - { - printf("main: Normal setjmp return\n"); - printf("main: Calling function with %d\n", MAIN_VAL); - function(MAIN_VAL); - printf("main: ERROR -- function returned!\n"); - return 1; - } - else if (value != SETJMP_RETURN) - { - printf("main: ERROR: Expected %d\n", SETJMP_RETURN); - return 1; - } - else - { - printf("main: SUCCESS: setjmp return from longjmp call\n"); - return 0; - } -} - diff --git a/apps/examples/elf/tests/mkdirlist.sh b/apps/examples/elf/tests/mkdirlist.sh deleted file mode 100755 index c790e74c4..000000000 --- a/apps/examples/elf/tests/mkdirlist.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -usage="Usage: %0 <romfs-dir-path>" - -dir=$1 -if [ -z "$dir" ]; then - echo "ERROR: Missing <romfs-dir-path>" - echo "" - echo $usage - exit 1 -fi - -if [ ! -d "$dir" ]; then - echo "ERROR: Directory $dir does not exist" - echo "" - echo $usage - exit 1 -fi - -echo "#ifndef __EXAMPLES_ELF_TESTS_DIRLIST_H" -echo "#define __EXAMPLES_ELF_TESTS_DIRLIST_H" -echo "" -echo "static const char *dirlist[] =" -echo "{" - -for file in `ls $dir`; do - echo " \"$file\"," -done - -echo " NULL" -echo "};" -echo "" -echo "#endif /* __EXAMPLES_ELF_TESTS_DIRLIST_H */" - - diff --git a/apps/examples/elf/tests/mksymtab.sh b/apps/examples/elf/tests/mksymtab.sh deleted file mode 100755 index 56be10f73..000000000 --- a/apps/examples/elf/tests/mksymtab.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -usage="Usage: $0 [-t <tmp-file>] <test-dir-path>" - -# Check for the optional tempory file name - -tmpfile=varlist.tmp -if [ "X${1}" = "X-t" ]; then - shift - tmpfile=$1 - shift - - if [ -z "$tmpfile" ]; then - echo "ERROR: Missing <tmpfile>" - echo "" - echo $usage - exit 1 - fi -fi - -# Check for the required ROMFS directory path - -dir=$1 -if [ -z "$dir" ]; then - echo "ERROR: Missing <test-dir-path>" - echo "" - echo $usage - exit 1 -fi - -if [ ! -d "$dir" ]; then - echo "ERROR: Directory $dir does not exist" - echo "" - echo $usage - exit 1 -fi - -# Extract all of the undefined symbols from the ELF files and create a -# list of sorted, unique undefined variable names. - -varlist=`find ${dir} -executable -type f | xargs nm | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 | sort | uniq` - -# Now output the symbol table as a structure in a C source file. All -# undefined symbols are declared as void* types. If the toolchain does -# any kind of checking for function vs. data objects, then this could -# faile - -echo "#include <nuttx/compiler.h>" -echo "#include <nuttx/binfmt/symtab.h>" -echo "" - -for var in $varlist; do - echo "extern void *${var};" -done - -echo "" -echo "const struct symtab_s exports[] = " -echo "{" - -for var in $varlist; do - echo " {\"${var}\", &${var}}," -done - -echo "};" -echo "" -echo "const int nexports = sizeof(exports) / sizeof(struct symtab_s);" - diff --git a/apps/examples/elf/tests/mutex/mutex.c b/apps/examples/elf/tests/mutex/mutex.c deleted file mode 100644 index 2446e62eb..000000000 --- a/apps/examples/elf/tests/mutex/mutex.c +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** - * examples/elf/tests/mutex/mutex.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 <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <pthread.h> - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static pthread_mutex_t mut; -static volatile int my_mutex = 0; -static unsigned long nloops[2] = {0, 0}; -static unsigned long nerrors[2] = {0, 0}; -static volatile bool bendoftest; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/* NOTE: it is necessary for functions that are referred to by function pointers - * pointer to be declared with global scope (at least for ARM). Otherwise, - * a relocation type that is not supported by ELF is generated by GCC. - */ - -void thread_func(void *parameter) -{ - int my_id = (int)parameter; - int my_ndx = my_id - 1; - int i; - - /* Loop 20 times. There is a 100 MS delay in the loop so this should - * take about 2 seconds. The main thread will stop this thread after - * 2 seconds by setting bendoftest in any event. - */ - - for (i = 0; i < 20 && !bendoftest; i++); - { - if ((pthread_mutex_lock(&mut)) != 0) - { - printf("ERROR thread %d: pthread_mutex_lock failed\n", my_id); - } - - if (my_mutex == 1) - { - printf("ERROR thread=%d: " - "my_mutex should be zero, instead my_mutex=%d\n", - my_id, my_mutex); - nerrors[my_ndx]++; - } - - my_mutex = 1; - usleep(100000); - my_mutex = 0; - - if ((pthread_mutex_unlock(&mut)) != 0) - { - printf("ERROR thread %d: pthread_mutex_unlock failed\n", my_id); - } - - nloops[my_ndx]++; - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - pthread_t thread1; - pthread_t thread2; - - /* Initialize the mutex */ - - pthread_mutex_init(&mut, NULL); - - /* Start two thread instances */ - - printf("Starting thread 1\n"); - bendoftest = false; - if ((pthread_create(&thread1, NULL, (void*)thread_func, (void*)1)) != 0) - { - fprintf(stderr, "Error in thread#1 creation\n"); - } - - printf("Starting thread 2\n"); - if ((pthread_create(&thread2, NULL, (void*)thread_func, (void*)2)) != 0) - { - fprintf(stderr, "Error in thread#2 creation\n"); - } - - /* Wait a bit for the threads to do their thing. */ - - sleep(2); - - /* Then ask them politely to stop running */ - - printf("Stopping threads\n"); - bendoftest = true; - pthread_join(thread1, NULL); - pthread_join(thread2, NULL); - - printf("\tThread1\tThread2\n"); - printf("Loops\t%ld\t%ld\n", nloops[0], nloops[1]); - printf("Errors\t%ld\t%ld\n", nerrors[0], nerrors[1]); - - return 0; -} - diff --git a/apps/examples/elf/tests/pthread/Makefile b/apps/examples/elf/tests/pthread/Makefile deleted file mode 100644 index 05c7c4650..000000000 --- a/apps/examples/elf/tests/pthread/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -############################################################################ -# examples/elf/tests/pthread/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = pthread - -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) - -all: $(BIN) - -$(OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ - -$(BIN): $(OBJS) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call CLEAN) - -install: - $(Q) mkdir -p $(ROMFS_DIR) - $(Q) install $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/apps/examples/elf/tests/pthread/pthread.c b/apps/examples/elf/tests/pthread/pthread.c deleted file mode 100644 index f9a23ff33..000000000 --- a/apps/examples/elf/tests/pthread/pthread.c +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** - * examples/elf/tests/pthread/pthread.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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <pthread.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define CHILD_ARG ((void*)0x12345678) -#define CHILD_RET ((void*)0x87654321) - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -enum exit_values_e -{ - TESTRESULT_SUCCESS = 0, - TESTRESULT_PTHREAD_ATTR_INIT_FAIL, - TESTRESULT_PTHREAD_CREATE_FAIL, - TESTRESULT_PTHREAD_JOIN_FAIL, - TESTRESULT_CHILD_ARG_FAIL, - TESTRESULT_CHILD_RETVAL_FAIL, -}; - -/**************************************************************************** - * External Functions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/* NOTE: it is necessary for functions that are referred to by function pointers - * pointer to be declared with global scope (at least for ARM). Otherwise, - * a relocation type that is not supported by ELF is generated by GCC. - */ - -void *child_start_routine(void *arg) -{ - printf("CHILD: started with arg=%d\n", (int)arg); - - if (arg != CHILD_ARG) - { - printf("CHILD: expected arg=%d\n", (int)CHILD_ARG); - return (void*)TESTRESULT_CHILD_ARG_FAIL; - } - sleep(2); - - printf("CHILD: returning %d\n", (int)CHILD_RET); - pthread_exit(CHILD_RET); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - pthread_attr_t attr; - pthread_t thread; - void *retval; - int status; - - puts("PARENT: started\n"); - - status = pthread_attr_init(&attr); - if (status != 0) - { - printf("PARENT: pthread_attr_init() returned %d\n", status); - exit(TESTRESULT_PTHREAD_ATTR_INIT_FAIL); - } - - printf("PARENT: calling pthread_start with arg=%d\n", (int)CHILD_ARG); - status = pthread_create(&thread, &attr, child_start_routine, CHILD_ARG); - if (status != 0) - { - printf("PARENT: pthread_create() returned %d\n", status); - exit(TESTRESULT_PTHREAD_CREATE_FAIL); - } - - status = pthread_join(thread, &retval); - if (status != 0) - { - printf("PARENT pthread_join() returned %d\n", status); - - exit(TESTRESULT_PTHREAD_JOIN_FAIL); - } - - printf("PARENT child exitted with %d\n", (int)retval); - if (retval != CHILD_RET) - { - printf("PARENT child thread did not exit with %d\n", (int)CHILD_RET); - exit(TESTRESULT_CHILD_RETVAL_FAIL); - } - - puts("PARENT returning success\n"); - return TESTRESULT_SUCCESS; -} diff --git a/apps/examples/elf/tests/signal/Makefile b/apps/examples/elf/tests/signal/Makefile deleted file mode 100644 index 55ef2e5b9..000000000 --- a/apps/examples/elf/tests/signal/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -############################################################################ -# examples/elf/tests/signal/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = signal - -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) - -all: $(BIN) - -$(OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ - -$(BIN): $(OBJS) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call CLEAN) - -install: - $(Q) mkdir -p $(ROMFS_DIR) - $(Q) install $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/apps/examples/elf/tests/signal/signal.c b/apps/examples/elf/tests/signal/signal.c deleted file mode 100644 index b40da7a86..000000000 --- a/apps/examples/elf/tests/signal/signal.c +++ /dev/null @@ -1,265 +0,0 @@ -/**************************************************************************** - * examples/elf/tests/signal/signal.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 <sys/types.h> - -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#define USEC_PER_MSEC 1000 -#define MSEC_PER_SEC 1000 -#define USEC_PER_SEC (USEC_PER_MSEC * MSEC_PER_SEC) -#define SHORT_DELAY (USEC_PER_SEC / 3) - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static int sigusr1_rcvd = 0; -static int sigusr2_rcvd = 0; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: siguser_action - ***************************************************************************/ - -/* NOTE: it is necessary for functions that are referred to by function pointers - * pointer to be declared with global scope (at least for ARM). Otherwise, - * a relocation type that is not supported by ELF is generated by GCC. - */ - -void siguser_action(int signo, siginfo_t *siginfo, void *arg) -{ - printf("siguser_action: Received signo=%d siginfo=%p arg=%p\n", - signo, siginfo, arg); - - if (signo == SIGUSR1) - { - printf(" SIGUSR1 received\n"); - sigusr2_rcvd = 1; - } - else if (signo == SIGUSR2) - { - printf(" SIGUSR2 received\n"); - sigusr1_rcvd = 2; - } - else - { - printf(" ERROR: Unexpected signal\n"); - } - - if (siginfo) - { - printf("siginfo:\n"); - printf(" si_signo = %d\n", siginfo->si_signo); - printf(" si_code = %d\n", siginfo->si_code); - printf(" si_value = %d\n", siginfo->si_value.sival_int); - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: main - ****************************************************************************/ - -int main(int argc, char **argv) -{ - struct sigaction act; - struct sigaction oact1; - struct sigaction oact2; - pid_t mypid = getpid(); - union sigval sigval; - int status; - - printf("Setting up signal handlers from pid=%d\n", mypid); - - /* Set up so that siguser_action will respond to SIGUSR1 */ - - memset(&act, 0, sizeof(struct sigaction)); - act.sa_sigaction = siguser_action; - act.sa_flags = SA_SIGINFO; - - (void)sigemptyset(&act.sa_mask); - - status = sigaction(SIGUSR1, &act, &oact1); - if (status != 0) - { - fprintf(stderr, "Failed to install SIGUSR1 handler, errno=%d\n", - errno); - exit(2); - } - - printf("Old SIGUSR1 sighandler at %p\n", oact1.sa_handler); - printf("New SIGUSR1 sighandler at %p\n", siguser_action); - - /* Set up so that siguser_action will respond to SIGUSR2 */ - - status = sigaction(SIGUSR2, &act, &oact2); - if (status != 0) - { - fprintf(stderr, "Failed to install SIGUSR2 handler, errno=%d\n", - errno); - exit(2); - } - - printf("Old SIGUSR2 sighandler at %p\n", oact2.sa_handler); - printf("New SIGUSR2 sighandler at %p\n", siguser_action); - printf("Raising SIGUSR1 from pid=%d\n", mypid); - - fflush(stdout); usleep(SHORT_DELAY); - - /* Send SIGUSR1 to ourselves via kill() */ - - printf("Kill-ing SIGUSR1 from pid=%d\n", mypid); - status = kill(0, SIGUSR1); - if (status != 0) - { - fprintf(stderr, "Failed to kill SIGUSR1, errno=%d\n", errno); - exit(3); - } - - usleep(SHORT_DELAY); - printf("SIGUSR1 raised from pid=%d\n", mypid); - - /* Verify that we received SIGUSR1 */ - - if (sigusr1_rcvd == 0) - { - fprintf(stderr, "SIGUSR1 not received\n"); - exit(4); - } - - sigusr1_rcvd = 0; - - /* Send SIGUSR2 to ourselves */ - - printf("sigqueue-ing SIGUSR2 from pid=%d\n", mypid); - fflush(stdout); usleep(SHORT_DELAY); - - /* Send SIGUSR2 to ourselves via sigqueue() */ - - sigval.sival_int = 87; - status = sigqueue(mypid, SIGUSR2, sigval); - if (status != 0) - { - fprintf(stderr, "Failed to queue SIGUSR2, errno=%d\n", errno); - exit(5); - } - - usleep(SHORT_DELAY); - printf("SIGUSR2 queued from pid=%d, sigval=87\n", mypid); - - /* Verify that SIGUSR2 was received */ - - if (sigusr2_rcvd == 0) - { - fprintf(stderr, "SIGUSR2 not received\n"); - exit(6); - } - - sigusr2_rcvd = 0; - - /* Remove the siguser_action handler and replace the SIGUSR2 - * handler with sigusr2_sighandler. - */ - - printf("Resetting SIGUSR2 signal handler from pid=%d\n", mypid); - - status = sigaction(SIGUSR2, &oact2, &act); - if (status != 0) - { - fprintf(stderr, "Failed to install SIGUSR1 handler, errno=%d\n", - errno); - exit(2); - } - - printf("Old SIGUSR1 sighandler at %p\n", act.sa_handler); - printf("New SIGUSR1 sighandler at %p\n", oact1.sa_handler); - - /* Verify that the handler that was removed was siguser_action */ - - if ((void*)act.sa_handler != (void*)siguser_action) - { - fprintf(stderr, - "Old SIGUSR2 signal handler (%p) is not siguser_action (%p)\n", - act.sa_handler, siguser_action); - exit(8); - } - - /* Send SIGUSR2 to ourselves via kill() */ - - printf("Killing SIGUSR2 from pid=%d\n", mypid); - fflush(stdout); usleep(SHORT_DELAY); - - status = kill(mypid, SIGUSR2); - if (status != 0) - { - fprintf(stderr, "Failed to kill SIGUSR2, errno=%d\n", errno); - exit(9); - } - - usleep(SHORT_DELAY); - printf("SIGUSR2 killed from pid=%d\n", mypid); - - /* Verify that SIGUSR2 was received */ - - if (sigusr2_rcvd == 0) - { - fprintf(stderr, "SIGUSR2 not received\n"); - exit(10); - } - - sigusr2_rcvd = 0; - - return 0; -} diff --git a/apps/examples/elf/tests/struct/Makefile b/apps/examples/elf/tests/struct/Makefile deleted file mode 100644 index 369fcb368..000000000 --- a/apps/examples/elf/tests/struct/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -############################################################################ -# examples/elf/tests/hello/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -CELFFLAGS += -I. - -BIN = struct -SRCS = struct_main.c struct_dummy.c -OBJS = $(SRCS:.c=.o) - -all: $(BIN) - -$(OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ - -$(BIN): $(OBJS) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call CLEAN) - -install: - $(Q) mkdir -p $(ROMFS_DIR) - $(Q) install $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/apps/examples/elf/tests/struct/struct.h b/apps/examples/elf/tests/struct/struct.h deleted file mode 100644 index 60ef3e5bd..000000000 --- a/apps/examples/elf/tests/struct/struct.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** - * examples/elf/tests/struct/struct.h - * - * 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 __EXAMPLES_ELF_TESTS_STRUCT_STRUCT_H -#define __EXAMPLES_ELF_TESTS_STRUCT_STRUCT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define DUMMY_SCALAR_VALUE1 42 -#define DUMMY_SCALAR_VALUE2 87 -#define DUMMY_SCALAR_VALUE3 117 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -typedef void (*dummy_t)(void); - -struct struct_dummy_s -{ - int n; /* This is a simple scalar value (DUMMY_SCALAR_VALUE3) */ -}; - -struct struct_s -{ - int n; /* This is a simple scalar value (DUMMY_SCALAR_VALUE1) */ - const int *pn; /* This is a pointer to a simple scalar value */ - const struct struct_dummy_s *ps; /* This is a pointer to a structure */ - dummy_t pf; /* This is a pointer to a function */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -extern int dummy_scalar; /* (DUMMY_SCALAR_VALUE2) */ -extern const struct struct_dummy_s dummy_struct; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -extern void dummyfunc(void); -extern const struct struct_s *getstruct(void); - -#endif /* __EXAMPLES_ELF_TESTS_STRUCT_STRUCT_H */ - - diff --git a/apps/examples/elf/tests/struct/struct_dummy.c b/apps/examples/elf/tests/struct/struct_dummy.c deleted file mode 100644 index 8a82c2074..000000000 --- a/apps/examples/elf/tests/struct/struct_dummy.c +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** - * examples/elf/tests/struct/struct_dummy.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 <stdio.h> -#include <stdlib.h> - -#include "struct.h" - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -const struct struct_s dummy = -{ - DUMMY_SCALAR_VALUE1, - &dummy_scalar, - &dummy_struct, - (dummy_t)dummyfunc -}; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -const struct struct_s *getstruct(void) -{ - return &dummy; -} - diff --git a/apps/examples/elf/tests/struct/struct_main.c b/apps/examples/elf/tests/struct/struct_main.c deleted file mode 100644 index 99b1bc622..000000000 --- a/apps/examples/elf/tests/struct/struct_main.c +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** - * examples/elf/tests/struct/struct_main.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 <stdio.h> -#include <stdlib.h> - -#include "struct.h" - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -const struct struct_dummy_s dummy_struct = -{ - DUMMY_SCALAR_VALUE3 -}; - -int dummy_scalar = DUMMY_SCALAR_VALUE2; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - const struct struct_s *mystruct = getstruct(); - - printf("Calling getstruct()\n"); - mystruct = getstruct(); - printf("getstruct returned %p\n", mystruct); - printf(" n = %d (vs %d) %s\n", - mystruct->n, DUMMY_SCALAR_VALUE1, - mystruct->n == DUMMY_SCALAR_VALUE1 ? "PASS" : "FAIL"); - - printf(" pn = %p (vs %p) %s\n", - mystruct->pn, &dummy_scalar, - mystruct->pn == &dummy_scalar ? "PASS" : "FAIL"); - if (mystruct->pn == &dummy_scalar) - { - printf(" *pn = %d (vs %d) %s\n", - *mystruct->pn, DUMMY_SCALAR_VALUE2, - *mystruct->pn == DUMMY_SCALAR_VALUE2 ? "PASS" : "FAIL"); - } - - printf(" ps = %p (vs %p) %s\n", - mystruct->ps, &dummy_struct, - mystruct->ps == &dummy_struct ? "PASS" : "FAIL"); - if (mystruct->ps == &dummy_struct) - { - printf(" ps->n = %d (vs %d) %s\n", - mystruct->ps->n, DUMMY_SCALAR_VALUE3, - mystruct->ps->n == DUMMY_SCALAR_VALUE3 ? "PASS" : "FAIL"); - } - - printf(" pf = %p (vs %p) %s\n", - mystruct->pf, dummyfunc, - mystruct->pf == dummyfunc ? "PASS" : "FAIL"); - if (mystruct->pf == dummyfunc) - { - printf("Calling mystruct->pf()\n"); - mystruct->pf(); - } - - printf("Exit-ing\n"); - return 0; -} - -void dummyfunc(void) -{ - printf("In dummyfunc() -- PASS\n"); -} - - diff --git a/apps/examples/elf/tests/task/task.c b/apps/examples/elf/tests/task/task.c deleted file mode 100644 index 15802fc00..000000000 --- a/apps/examples/elf/tests/task/task.c +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** - * examples/elf/tests/task/parent.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 <sys/types.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sched.h> -#include <semaphore.h> -#include <errno.h> - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static char child_name[] = "child"; -static char child_arg[] = "Hello from your parent!"; -static sem_t g_sem; - -#if CONFIG_TASK_NAME_SIZE == 0 -static char no_name[] = "<noname>"; -#endif - -/**************************************************************************** - * Privite Functions - ****************************************************************************/ - -/* NOTE: it is necessary for functions that are referred to by function pointers - * pointer to be declared with global scope (at least for ARM). Otherwise, - * a relocation type that is not supported by ELF is generated by GCC. - */ - - int child_task(int argc, char **argv) -{ - printf("Child: execv was successful!\n"); - printf("Child: argc=%d\n", argc); - - if (argc != 2) - { - printf("Child: expected argc to be 2\n"); - printf("Child: Exit-ting with status=2\n"); - exit(2); - } - printf("Child: argv[0]=\"%s\"\n", argv[0]); - -#if CONFIG_TASK_NAME_SIZE == 0 - if (strcmp(argv[0], no_name) != 0) - { - printf("Child: expected argv[0] to be \"%s\"\n", no_name); - printf("Child: Exit-ting with status=3\n"); - exit(3); - } -#else - if (strncmp(argv[0], child_name, CONFIG_TASK_NAME_SIZE) != 0) - { - printf("Child: expected argv[0] to be \"%s\"\n", child_name); - printf("Child: Exit-ting with status=3\n"); - exit(3); - } -#endif - - printf("Child: argv[1]=\"%s\"\n", argv[1]); - - if (strcmp(argv[1], child_arg) != 0) - { - printf("Child: expected argv[1] to be \"%s\"\n", child_arg); - printf("Child: Exit-ting with status=4\n"); - exit(4); - } - - printf("Child: Exit-ting with status=0\n"); - sem_post(&g_sem); - return 0; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - pid_t parent_pid = getpid(); - char *child_argv[2]; - pid_t child_pid; - - printf("Parent: Started, pid=%d\n", parent_pid); - - sem_init(&g_sem, 0, 0); - - printf("Parent: Calling task_create()\n"); - - child_argv[0] = child_arg; - child_argv[1] = 0; - child_pid = task_create(child_name, 50, 512, child_task, (const char**)child_argv); - if (child_pid < 0) - { - printf("Parent: task_create failed: %d\n", errno); - } - - printf("Parent: Waiting for child (pid=%d)\n", child_pid); - sem_wait(&g_sem); - printf("Parent: Exit-ing\n"); - sem_destroy(&g_sem); - return 0; -} - diff --git a/apps/examples/ftpc/Kconfig b/apps/examples/ftpc/Kconfig deleted file mode 100644 index 59fbbaa84..000000000 --- a/apps/examples/ftpc/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_FTPC - bool "FTP client example" - default n - ---help--- - Enable the FTP client example - -if EXAMPLES_FTPC -endif diff --git a/apps/examples/ftpc/Makefile b/apps/examples/ftpc/Makefile deleted file mode 100644 index 29960fb94..000000000 --- a/apps/examples/ftpc/Makefile +++ /dev/null @@ -1,109 +0,0 @@ -############################################################################ -# apps/examples/ftpc/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# FTPC Client Application - -APPNAME = ftpc -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 4096 - -ASRCS = -CSRCS = ftpc_main.c ftpc_cmds.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: context depend clean distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -# Register application - -.context: - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ - -context: .context - -# Create dependencies - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, .context) - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/ftpc/ftpc.h b/apps/examples/ftpc/ftpc.h deleted file mode 100644 index 429976ad0..000000000 --- a/apps/examples/ftpc/ftpc.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** - * apps/examples/ftpc/ftpc.h - * - * Copyright (C) 2011 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 __APPS_EXAMPLES_FTPC_FTPC_H -#define __APPS_EXAMPLES_FTPC_FTPC_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <sys/types.h> - -#include <stdio.h> -#include <stdint.h> -#include <stdbool.h> -#include <errno.h> - -#include <apps/ftpc.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Maximum size of one command line */ - -#ifndef CONFIG_FTPC_LINELEN -# define CONFIG_FTPC_LINELEN 80 -#endif - -/* If CONFIG_STDIO_LINEBUFFER is defined, the STDIO buffer will be flushed - * on each new line. Otherwise, STDIO needs to be explicitly flushed to - * see the output in context. - */ - -#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && \ - CONFIG_STDIO_BUFFER_SIZE > 0 && !defined(CONFIG_STDIO_LINEBUFFER) -# define FFLUSH() fflush(stdout) -#else -# define FFLUSH() -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -typedef int (*cmd_t)(SESSION handle, int argc, char **argv); - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* FTP command handlers */ - -extern int cmd_rlogin(SESSION handle, int argc, char **argv); -extern int cmd_rquit(SESSION handle, int argc, char **argv); -extern int cmd_rchdir(SESSION handle, int argc, char **argv); -extern int cmd_rpwd(SESSION handle, int argc, char **argv); -extern int cmd_rcdup(SESSION handle, int argc, char **argv); -extern int cmd_rmkdir(SESSION handle, int argc, char **argv); - -extern int cmd_rrmdir(SESSION handle, int argc, char **argv); -extern int cmd_runlink(SESSION handle, int argc, char **argv); -extern int cmd_rchmod(SESSION handle, int argc, char **argv); -extern int cmd_rrename(SESSION handle, int argc, char **argv); -extern int cmd_rsize(SESSION handle, int argc, char **argv); -extern int cmd_rtime(SESSION handle, int argc, char **argv); -extern int cmd_ridle(SESSION handle, int argc, char **argv); -extern int cmd_rnoop(SESSION handle, int argc, char **argv); -extern int cmd_rhelp(SESSION handle, int argc, char **argv); -extern int cmd_rls(SESSION handle, int argc, char **argv); -extern int cmd_rget(SESSION handle, int argc, char **argv); -extern int cmd_rput(SESSION handle, int argc, char **argv); - -#endif /* __APPS_EXAMPLES_FTPC_FTPC_H */ diff --git a/apps/examples/ftpc/ftpc_cmds.c b/apps/examples/ftpc/ftpc_cmds.c deleted file mode 100644 index df05f45d2..000000000 --- a/apps/examples/ftpc/ftpc_cmds.c +++ /dev/null @@ -1,398 +0,0 @@ -/**************************************************************************** - * examples/ftpc/ftpc_cmds.c - * - * Copyright (C) 2011 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include <apps/ftpc.h> - -#include "ftpc.h" - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: cmd_rlogin - ****************************************************************************/ - -int cmd_rlogin(SESSION handle, int argc, char **argv) -{ - struct ftpc_login_s login = {NULL, NULL, NULL, true}; - - login.uname = argv[1]; - if (argc > 2) - { - login.pwd = argv[2]; - } - - return ftpc_login(handle, &login); -} - -/**************************************************************************** - * Name: cmd_rquit - ****************************************************************************/ - -int cmd_rquit(SESSION handle, int argc, char **argv) -{ - int ret = ftpc_quit(handle); - if (ret < 0) - { - printf("quit failed: %d\n", errno); - } - printf("Exitting...\n"); - exit(0); - return ERROR; -} - -/**************************************************************************** - * Name: cmd_rchdir - ****************************************************************************/ - -int cmd_rchdir(SESSION handle, int argc, char **argv) -{ - return ftpc_chdir(handle, argv[1]); -} - -/**************************************************************************** - * Name: cmd_rpwd - ****************************************************************************/ - -int cmd_rpwd(SESSION handle, int argc, char **argv) -{ - FAR char *pwd = ftpc_rpwd(handle); - if (pwd) - { - printf("PWD: %s\n", pwd); - free(pwd); - return OK; - } - return ERROR; -} - -/**************************************************************************** - * Name: cmd_rcdup - ****************************************************************************/ - -int cmd_rcdup(SESSION handle, int argc, char **argv) -{ - return ftpc_cdup(handle); -} - -/**************************************************************************** - * Name: cmd_rmkdir - ****************************************************************************/ - -int cmd_rmkdir(SESSION handle, int argc, char **argv) -{ - return ftpc_mkdir(handle, argv[1]); -} - -/**************************************************************************** - * Name: cmd_rrmdir - ****************************************************************************/ - -int cmd_rrmdir(SESSION handle, int argc, char **argv) -{ - return ftpc_rmdir(handle, argv[1]); -} - -/**************************************************************************** - * Name: cmd_runlink - ****************************************************************************/ - -int cmd_runlink(SESSION handle, int argc, char **argv) -{ - return ftpc_unlink(handle, argv[1]); -} - -/**************************************************************************** - * Name: cmd_rchmod - ****************************************************************************/ - -int cmd_rchmod(SESSION handle, int argc, char **argv) -{ - return ftpc_chmod(handle, argv[1], argv[2]); -} - -/**************************************************************************** - * Name: cmd_rrename - ****************************************************************************/ - -int cmd_rrename(SESSION handle, int argc, char **argv) -{ - return ftpc_rename(handle, argv[1], argv[2]); -} - -/**************************************************************************** - * Name: cmd_rsize - ****************************************************************************/ - -int cmd_rsize(SESSION handle, int argc, char **argv) -{ - off_t size = ftpc_filesize(handle, argv[1]); - printf("SIZE: %lu\n", size); - return OK; -} - -/**************************************************************************** - * Name: cmd_rtime - ****************************************************************************/ - -int cmd_rtime(SESSION handle, int argc, char **argv) -{ - time_t filetime = ftpc_filetime(handle, argv[1]); - printf("TIME: %lu\n", (long)filetime); - return OK; -} - -/**************************************************************************** - * Name: cmd_ridle - ****************************************************************************/ - -int cmd_ridle(SESSION handle, int argc, char **argv) -{ - unsigned int idletime = 0; - - if (argc > 1) - { - idletime = atoi(argv[1]); - } - - return ftpc_idle(handle, idletime); -} - -/**************************************************************************** - * Name: cmd_rnoop - ****************************************************************************/ - -int cmd_rnoop(SESSION handle, int argc, char **argv) -{ - return ftpc_noop(handle); -} - -/**************************************************************************** - * Name: cmd_rhelp - ****************************************************************************/ - -int cmd_rhelp(SESSION handle, int argc, char **argv) -{ - FAR const char *cmd = NULL; - int ret; - - if (argc > 1) - { - cmd = argv[1]; - } - - ret = ftpc_help(handle, cmd); - if (ret == OK) - { - FAR char *msg = ftpc_response(handle); - puts(msg); - free(msg); - } - - return ret; -} - -/**************************************************************************** - * Name: cmd_rls - ****************************************************************************/ - -int cmd_rls(SESSION handle, int argc, char **argv) -{ - FAR struct ftpc_dirlist_s *dirlist; - FAR char *dirname = NULL; - int i; - - /* Get the directory listing */ - - if (argc > 1) - { - dirname = argv[1]; - } - - dirlist = ftpc_listdir(handle, dirname); - if (!dirlist) - { - return ERROR; - } - - /* Print the directory listing */ - - printf("%s/\n", dirname ? dirname : "."); - for (i = 0; i < dirlist->nnames; i++) - { - printf(" %s\n", dirlist->name[i]); - } - FFLUSH(); - - /* We are responsible for freeing the directory structure allocated by - * ftpc_listdir(). - */ - - ftpc_dirfree(dirlist); - return OK; -} - -/**************************************************************************** - * Name: cmd_rget - ****************************************************************************/ - -int cmd_rget(SESSION handle, int argc, char **argv) -{ - FAR const char *rname; - FAR const char *lname = NULL; - int xfrmode = FTPC_XFRMODE_ASCII; - int option; - - while ((option = getopt(argc, argv, "ab")) != ERROR) - { - if (option == 'a') - { - xfrmode = FTPC_XFRMODE_ASCII; - } - else if (option == 'b') - { - xfrmode = FTPC_XFRMODE_BINARY; - } - else - { - printf("%s: Unrecognized option: '%c'\n", "put", option); - return ERROR; - } - } - - /* There should be one or two parameters remaining on the command line */ - - if (optind >= argc) - { - printf("%s: Missing required arguments\n", "get"); - return ERROR; - } - - rname = argv[optind]; - optind++; - - if (optind < argc) - { - lname = argv[optind]; - optind++; - } - - if (optind != argc) - { - printf("%s: Too many arguments\n", "get"); - return ERROR; - } - - /* Perform the transfer */ - - return ftpc_getfile(handle, rname, lname, FTPC_GET_NORMAL, xfrmode); -} - -/**************************************************************************** - * Name: cmd_rput - ****************************************************************************/ - -int cmd_rput(SESSION handle, int argc, char **argv) -{ - FAR const char *lname; - FAR const char *rname = NULL; - int xfrmode = FTPC_XFRMODE_ASCII; - int option; - - while ((option = getopt(argc, argv, "ab")) != ERROR) - { - if (option == 'a') - { - xfrmode = FTPC_XFRMODE_ASCII; - } - else if (option == 'b') - { - xfrmode = FTPC_XFRMODE_BINARY; - } - else - { - printf("%s: Unrecognized option: '%c'\n", "put", option); - return ERROR; - } - } - - /* There should be one or two parameters remaining on the command line */ - - if (optind >= argc) - { - printf("%s: Missing required arguments\n", "get"); - return ERROR; - } - - lname = argv[optind]; - optind++; - - if (optind < argc) - { - rname = argv[optind]; - optind++; - } - - if (optind != argc) - { - printf("%s: Too many arguments\n "); - return ERROR; - } - - /* Perform the transfer */ - - return ftp_putfile(handle, lname, rname, FTPC_PUT_NORMAL, xfrmode); -} diff --git a/apps/examples/ftpc/ftpc_main.c b/apps/examples/ftpc/ftpc_main.c deleted file mode 100644 index 866a69cdb..000000000 --- a/apps/examples/ftpc/ftpc_main.c +++ /dev/null @@ -1,455 +0,0 @@ -/**************************************************************************** - * examples/ftpc/ftpc_main.c - * - * 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 - * 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -#include <arpa/inet.h> -#include <apps/ftpc.h> - -#include <apps/readline.h> - -#include "ftpc.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define FTPC_MAX_ARGUMENTS 4 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -struct cmdmap_s -{ - const char *cmd; /* Name of the command */ - cmd_t handler; /* Function that handles the command */ - uint8_t minargs; /* Minimum number of arguments (including command) */ - uint8_t maxargs; /* Maximum number of arguments (including command) */ - const char *usage; /* Usage instructions for 'help' command */ -}; - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const char g_delim[] = " \t\n"; - -static int cmd_lhelp(SESSION handle, int argc, char **argv); -static int cmd_lunrecognized(SESSION handle, int argc, char **argv); - -static const struct cmdmap_s g_cmdmap[] = -{ - { "cd", cmd_rchdir, 2, 2, "<directory>" }, - { "chmod", cmd_rchmod, 3, 3, "<permissions> <path>" }, - { "get", cmd_rget, 2, 4, "[-a|b] <rname> [<lname>]" }, - { "help", cmd_lhelp, 1, 2, "" }, - { "idle", cmd_ridle, 1, 2, "[<idletime>]" }, - { "login", cmd_rlogin, 2, 3, "<uname> [<password>]" }, - { "ls", cmd_rls, 1, 2, "[<dirpath>]" }, - { "quit", cmd_rquit, 1, 1, "" }, - { "mkdir", cmd_rmkdir, 2, 2, "<directory>" }, - { "noop", cmd_rnoop, 1, 1, "" }, - { "put", cmd_rput, 2, 4, "[-a|b] <lname> [<rname>]" }, - { "pwd", cmd_rpwd, 1, 1, "" }, - { "rename", cmd_rrename, 3, 3, "<oldname> <newname>" }, - { "rhelp", cmd_rhelp, 1, 2, "[<command>]" }, - { "rm", cmd_runlink, 2, 2, "" }, - { "rmdir", cmd_rrmdir, 2, 2, "<directory>" }, - { "size", cmd_rsize, 2, 2, "<filepath>" }, - { "time", cmd_rtime, 2, 2, "<filepath>" }, - { "up", cmd_rcdup, 1, 1, "" }, - { NULL, NULL, 1, 1, NULL } -}; - -static char g_line[CONFIG_FTPC_LINELEN]; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: cmd_lhelp - ****************************************************************************/ - -static int cmd_lhelp(SESSION handle, int argc, char **argv) -{ - const struct cmdmap_s *ptr; - - printf("Local FTPC commands:\n"); - for (ptr = g_cmdmap; ptr->cmd; ptr++) - { - if (ptr->usage) - { - printf(" %s %s\n", ptr->cmd, ptr->usage); - } - else - { - printf(" %s\n", ptr->cmd); - } - } - return OK; -} - -/**************************************************************************** - * Name: cmd_lunrecognized - ****************************************************************************/ - -static int cmd_lunrecognized(SESSION handle, int argc, char **argv) -{ - printf("Command %s unrecognized\n", argv[0]); - return ERROR; -} - -/**************************************************************************** - * Name: ftpc_argument - ****************************************************************************/ - -char *ftpc_argument(char **saveptr) -{ - char *pbegin = *saveptr; - char *pend = NULL; - const char *term; - - /* Find the beginning of the next token */ - - for (; - *pbegin && strchr(g_delim, *pbegin) != NULL; - pbegin++); - - /* If we are at the end of the string with nothing - * but delimiters found, then return NULL. - */ - - if (!*pbegin) - { - return NULL; - } - - /* Does the token begin with '#' -- comment */ - - else if (*pbegin == '#') - { - /* Return NULL meaning that we are at the end of the line */ - - *saveptr = pbegin; - pbegin = NULL; - } - else - { - /* Otherwise, we are going to have to parse to find the end of - * the token. Does the token begin with '"'? - */ - - if (*pbegin == '"') - { - /* Yes.. then only another '"' can terminate the string */ - - pbegin++; - term = "\""; - } - else - { - /* No, then any of the usual terminators will terminate the argument */ - - term = g_delim; - } - - /* Find the end of the string */ - - for (pend = pbegin + 1; - *pend && strchr(term, *pend) == NULL; - pend++); - - /* pend either points to the end of the string or to - * the first delimiter after the string. - */ - - if (*pend) - { - /* Turn the delimiter into a null terminator */ - - *pend++ = '\0'; - } - - /* Save the pointer where we left off */ - - *saveptr = pend; - - } - - /* Return the beginning of the token. */ - - return pbegin; -} - -/**************************************************************************** - * Name: ftpc_execute - ****************************************************************************/ - -static int ftpc_execute(SESSION handle, int argc, char *argv[]) -{ - const struct cmdmap_s *cmdmap; - const char *cmd; - cmd_t handler = cmd_lunrecognized; - int ret; - - /* The form of argv is: - * - * argv[0]: The command name. This is argv[0] when the arguments - * are, finally, received by the command handler - * argv[1]: The beginning of argument (up to FTPC_MAX_ARGUMENTS) - * argv[argc]: NULL terminating pointer - */ - - cmd = argv[0]; - - /* See if the command is one that we understand */ - - for (cmdmap = g_cmdmap; cmdmap->cmd; cmdmap++) - { - if (strcmp(cmdmap->cmd, cmd) == 0) - { - /* Check if a valid number of arguments was provided. We - * do this simple, imperfect checking here so that it does - * not have to be performed in each command. - */ - - if (argc < cmdmap->minargs) - { - /* Fewer than the minimum number were provided */ - - printf("Too few arguments for '%s'\n", cmd); - return ERROR; - } - else if (argc > cmdmap->maxargs) - { - /* More than the maximum number were provided */ - - printf("Too many arguments for '%s'\n", cmd); - return ERROR; - } - else - { - /* A valid number of arguments were provided (this does - * not mean they are right). - */ - - handler = cmdmap->handler; - break; - } - } - } - - ret = handler(handle, argc, argv); - if (ret < 0) - { - printf("%s failed: %d\n", cmd, errno); - } - return ret; -} - -/**************************************************************************** - * Name: ftpc_parse - ****************************************************************************/ - -int ftpc_parse(SESSION handle, char *cmdline) -{ - FAR char *argv[FTPC_MAX_ARGUMENTS+1]; - FAR char *saveptr; - FAR char *cmd; - int argc; - int ret; - - /* Initialize parser state */ - - memset(argv, 0, FTPC_MAX_ARGUMENTS*sizeof(FAR char *)); - - /* Parse out the command at the beginning of the line */ - - saveptr = cmdline; - cmd = ftpc_argument(&saveptr); - - /* Check if any command was provided -OR- if command processing is - * currently disabled. - */ - - if (!cmd) - { - /* An empty line is not an error */ - - return OK; - } - - /* Parse all of the arguments following the command name. */ - - argv[0] = cmd; - for (argc = 1; argc < FTPC_MAX_ARGUMENTS; argc++) - { - argv[argc] = ftpc_argument(&saveptr); - if (!argv[argc]) - { - break; - } - } - argv[argc] = NULL; - - /* Check if the maximum number of arguments was exceeded */ - - if (argc > FTPC_MAX_ARGUMENTS) - { - printf("Too many arguments\n"); - ret = -EINVAL; - } - else - { - /* Then execute the command */ - - ret = ftpc_execute(handle, argc, argv); - } - - return ret; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int ftpc_main(int argc, char **argv, char **envp) -{ - struct ftpc_connect_s connect = {{0}, 0}; - SESSION handle; - FAR char *ptr; -#ifndef CONFIG_EXAMPLES_FTPC_FGETS - int ret; -#endif - - if (argc != 2) - { - printf("Usage:\n"); - printf(" %s xx.xx.xx.xx[:pp]\n", argv[0]); - printf("Where\n"); - printf(" xx.xx.xx.xx is the IP address of the FTP server\n"); - printf(" pp is option port to use with the FTP server\n"); - exit(1); - } - - /* Check if the argument includes a port number */ - - ptr = strchr(argv[1], ':'); - if (ptr) - { - *ptr = '\0'; - connect.port = atoi(ptr+1); - } - - /* In any event, we can now extract the IP address from the comman-line */ - - connect.addr.s_addr = inet_addr(argv[1]); - - /* Connect to the FTP server */ - - handle = ftpc_connect(&connect); - if (!handle) - { - printf("Failed to connect to the server: %d\n", errno); - exit(1); - } - - /* Present a greeting */ - - printf("NuttX FTP Client:\n"); - FFLUSH(); - - /* Setting optind to -1 is a non-standard, backdoor way to reinitialize - * getopt(). getopt() is not thread safe and we have no idea what state - * it is in now! - */ - - optind = -1; - - /* Then enter the command line parsing loop */ - - for (;;) - { - /* Display the prompt string */ - - fputs("nfc> ", stdout); - FFLUSH(); - - /* Get the next line of input */ - -#ifdef CONFIG_EXAMPLES_FTPC_FGETS - /* fgets returns NULL on end-of-file or any I/O error */ - - if (fgets(g_line, CONFIG_FTPC_LINELEN, stdin) == NULL) - { - printf("ERROR: fgets failed: %d\n", errno); - return 1; - } -#else - ret = readline(g_line, CONFIG_FTPC_LINELEN, stdin, stdout); - - /* Readline normally returns the number of characters read, - * but will return 0 on end of file or a negative value - * if an error occurs. Either will cause the session to - * terminate. - */ - - if (ret <= 0) - { - printf("ERROR: readline failed: %d\n", ret); - return 1; - } -#endif - else - { - /* Parse and process the command */ - - (void)ftpc_parse(handle, g_line); - FFLUSH(); - } - } - - return 0; -} diff --git a/apps/examples/ftpd/Kconfig b/apps/examples/ftpd/Kconfig deleted file mode 100644 index 5b2a2f95f..000000000 --- a/apps/examples/ftpd/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_FTPD - bool "FTP server example" - default n - ---help--- - Enable the FTP server example - -if EXAMPLES_FTPD -endif diff --git a/apps/examples/ftpd/Makefile b/apps/examples/ftpd/Makefile deleted file mode 100644 index 0b43b85a9..000000000 --- a/apps/examples/ftpd/Makefile +++ /dev/null @@ -1,104 +0,0 @@ -############################################################################ -# apps/examples/ftpd/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# Hello, World! Example - -ASRCS = -CSRCS = ftpd_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built - -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,ftpd_start,SCHED_PRIORITY_DEFAULT,2048,ftpd_start) - $(call REGISTER,ftpd_stop,SCHED_PRIORITY_DEFAULT,2048,ftpd_stop) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/ftpd/ftpd.h b/apps/examples/ftpd/ftpd.h deleted file mode 100644 index ad20bdfb1..000000000 --- a/apps/examples/ftpd/ftpd.h +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** - * apps/examples/ftpd/ftpd.h - * Interface for the Contiki ftpd. - * - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 __APPS_EXAMPLES_FTPD_FTPD_H -#define __APPS_EXAMPLES_FTPD_FTPD_H - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <stdbool.h> -#include <stdlib.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_EXAMPLES_FTPD_PRIO - Priority of the FTP daemon. - * Default: SCHED_PRIORITY_DEFAULT - * CONFIG_EXAMPLES_FTPD_STACKSIZE - Stack size allocated for the - * FTP daemon. Default: 2048 - * CONFIG_EXAMPLES_FTPD_NONETINIT - Define to suppress configuration of the - * network by apps/examples/ftpd. You would need to suppress network - * configuration if the network is configuration prior to running the - * example. - * - * If CONFIG_EXAMPLES_FTPD_NONETINIT is not defined, then the following may - * be specified to customized the network configuration: - * - * CONFIG_EXAMPLES_FTPD_NOMAC - If the hardware has no MAC address of its - * own, define this =y to provide a bogus address for testing. - * CONFIG_EXAMPLES_FTPD_IPADDR - The target IP address. Default 10.0.0.2 - * CONFIG_EXAMPLES_FTPD_DRIPADDR - The default router address. Default - * 10.0.0.1 - * CONFIG_EXAMPLES_FTPD_NETMASK - The network mask. Default: 255.255.255.0 - */ - -#ifndef CONFIG_EXAMPLES_FTPD_PRIO -# define CONFIG_EXAMPLES_FTPD_PRIO SCHED_PRIORITY_DEFAULT -#endif - -#ifndef CONFIG_EXAMPLES_FTPD_STACKSIZE -# define CONFIG_EXAMPLES_FTPD_STACKSIZE 2048 -#endif - -#ifndef CONFIG_EXAMPLES_FTPD_CLIENTPRIO -# define CONFIG_EXAMPLES_FTPD_CLIENTPRIO SCHED_PRIORITY_DEFAULT -#endif - -#ifndef CONFIG_EXAMPLES_FTPD_CLIENTSTACKSIZE -# define CONFIG_EXAMPLES_FTPD_CLIENTSTACKSIZE 2048 -#endif - -/* NSH always initializes the network */ - -#if defined(CONFIG_NSH_BUILTIN_APPS) && !defined(CONFIG_EXAMPLES_FTPD_NONETINIT) -# define CONFIG_EXAMPLES_FTPD_NONETINIT 1 -#endif - -#ifdef CONFIG_EXAMPLES_FTPD_NONETINIT -# undef CONFIG_EXAMPLES_FTPD_IPADDR -# undef CONFIG_EXAMPLES_FTPD_DRIPADDR -# undef CONFIG_EXAMPLES_FTPD_NETMASK -#else -# ifndef CONFIG_EXAMPLES_FTPD_IPADDR -# define CONFIG_EXAMPLES_FTPD_IPADDR 0x0a000002 -# endif -# ifndef CONFIG_EXAMPLES_FTPD_DRIPADDR -# define CONFIG_EXAMPLES_FTPD_DRIPADDR 0x0a000001 -# endif -# ifndef CONFIG_EXAMPLES_FTPD_NETMASK -# define CONFIG_EXAMPLES_FTPD_NETMASK 0xffffff00 -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* This structure describes one entry in a table of accounts */ - -struct fptd_account_s -{ - uint8_t flags; - FAR const char *user; - FAR const char *password; - FAR const char *home; -}; - -/* To minimize the probability of name collisitions, all FTPD example - * global data is maintained in single structure. - */ - -struct ftpd_globals_s -{ - bool initialized; /* True: Networking is initialized. The - * network must be initialized only once. - */ -#ifdef CONFIG_NSH_BUILTIN_APPS - volatile bool stop; /* True: Request daemon to exit */ - volatile bool running; /* True: The daemon is running */ -#endif - pid_t pid; /* Task ID of the FTPD daemon. The value - * -1 is a redundant indication that the - * daemon is not running. - */ -}; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* To minimize the probability of name collisitions, all FTPD example - * global data is maintained in a single instance of a structure. - */ - -extern struct ftpd_globals_s g_ftpdglob; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __APPS_EXAMPLES_FTPD_FTPD_H */ diff --git a/apps/examples/ftpd/ftpd_main.c b/apps/examples/ftpd/ftpd_main.c deleted file mode 100644 index 1907da18c..000000000 --- a/apps/examples/ftpd/ftpd_main.c +++ /dev/null @@ -1,292 +0,0 @@ -/**************************************************************************** - * examples/telnetd/shell.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 of the Institute 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 INSTITUTE 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 INSTITUTE 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 <sys/types.h> - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sched.h> -#include <errno.h> -#include <debug.h> - -#include <netinet/in.h> - -#include <apps/netutils/uiplib.h> -#include <apps/netutils/ftpd.h> - -#include "ftpd.h" - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const struct fptd_account_s g_ftpdaccounts[] = -{ - { FTPD_ACCOUNTFLAG_SYSTEM, "root", "abc123", NULL }, - { FTPD_ACCOUNTFLAG_GUEST, "ftp", NULL, NULL }, - { FTPD_ACCOUNTFLAG_GUEST, "anonymous", NULL, NULL }, -}; -#define NACCOUNTS (sizeof(g_ftpdaccounts) / sizeof(struct fptd_account_s)) - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* To minimize the probability of name collisitions, all FTPD example - * global data is maintained in a single instance of a structure. - */ - -struct ftpd_globals_s g_ftpdglob; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ -/**************************************************************************** - * Name: fptd_netinit - ****************************************************************************/ - -static void fptd_netinit(void) -{ -#ifndef CONFIG_EXAMPLES_FTPD_NONETINIT - struct in_addr addr; -#ifdef CONFIG_EXAMPLES_FTPD_NOMAC - uint8_t mac[IFHWADDRLEN]; -#endif - -/* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_FTPD_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up our host address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_FTPD_IPADDR); - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_FTPD_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_FTPD_NETMASK); - uip_setnetmask("eth0", &addr); -#endif /* CONFIG_EXAMPLES_FTPD_NONETINIT */ -} - -/**************************************************************************** - * Name: ftpd_accounts - ****************************************************************************/ - -static void ftpd_accounts(FTPD_SESSION handle) -{ - FAR const struct fptd_account_s *account; - int i; - - printf("Adding accounts:\n"); - for (i = 0; i < NACCOUNTS; i++) - { - account = &g_ftpdaccounts[i]; - - printf("%d. %s account: USER=%s PASSWORD=%s HOME=%s\n", i+1, - (account->flags & FTPD_ACCOUNTFLAG_SYSTEM) != 0 ? "Root" : "User", - (!account->user) ? "(none)" : account->user, - (!account->password) ? "(none)" : account->password, - (!account->home) ? "(none)" : account->home); - - ftpd_adduser(handle, account->flags, account->user, - account->password, account->home); - } -} - -/**************************************************************************** - * Name: ftpd_daemon - ****************************************************************************/ - -int ftpd_daemon(int s_argc, char **s_argv) -{ - FTPD_SESSION handle; - int ret; - - /* The FTPD daemon has been started */ - -#ifdef CONFIG_NSH_BUILTIN_APPS - g_ftpdglob.running = true; -#endif - printf("FTP daemon [%d] started\n", g_ftpdglob.pid); - - /* Open FTPD */ - - handle = ftpd_open(); - if (!handle) - { - printf("FTP daemon [%d] failed to open FTPD\n", g_ftpdglob.pid); -#ifdef CONFIG_NSH_BUILTIN_APPS - g_ftpdglob.running = false; - g_ftpdglob.stop = false; -#endif - g_ftpdglob.pid = -1; - return EXIT_FAILURE; - } - - /* Configure acounts */ - - (void)ftpd_accounts(handle); - - /* Then drive the FTPD server. */ - -#ifdef CONFIG_NSH_BUILTIN_APPS - while (g_ftpdglob.stop == 0) -#else - for (;;) -#endif - { - /* If ftpd_session returns success, it means that a new FTP session - * has been started. - */ - - ret = ftpd_session(handle, 5000); - - /* If any interesting happened (i.e., any thing other than a timeout), - * then report the interesting event. - */ - - if (ret != -ETIMEDOUT) - { - printf("FTP daemon [%d] ftpd_session returned %d\n", g_ftpdglob.pid, ret); - } - } - - /* Close the FTPD server and exit (we can get here only if - * CONFIG_NSH_BUILTIN_APPS is defined). - */ - -#ifdef CONFIG_NSH_BUILTIN_APPS - printf("FTP daemon [%d] stopping\n", g_ftpdglob.pid); - g_ftpdglob.running = false; - g_ftpdglob.stop = false; - g_ftpdglob.pid = -1; - ftpd_close(handle); -#endif - return EXIT_SUCCESS; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ -/**************************************************************************** - * Name: ftpd_main - ****************************************************************************/ - -int ftpd_main(int s_argc, char **s_argv) -{ - /* Check if we have already initialized the network */ - - if (!g_ftpdglob.initialized) - { - - /* Bring up the network */ - - printf("Initializing the network\n"); - fptd_netinit(); - - /* Initialize daemon state */ - - g_ftpdglob.initialized = true; - g_ftpdglob.pid = -1; -#ifdef CONFIG_NSH_BUILTIN_APPS - g_ftpdglob.stop = false; - g_ftpdglob.running = false; -#endif - } - - /* Then start the new daemon (if it is not already running) */ - -#ifdef CONFIG_NSH_BUILTIN_APPS - if (g_ftpdglob.stop && g_ftpdglob.running) - { - printf("Waiting for FTP daemon [%d] to stop\n", g_ftpdglob.pid); - return EXIT_FAILURE; - } - else -#endif - if (!g_ftpdglob.running) - { - printf("Starting the FTP daemon\n"); - g_ftpdglob.pid = TASK_CREATE("FTP daemon", CONFIG_EXAMPLES_FTPD_PRIO, - CONFIG_EXAMPLES_FTPD_STACKSIZE, - ftpd_daemon, NULL); - if (g_ftpdglob.pid < 0) - { - printf("Failed to start the FTP daemon: %d\n", errno); - return EXIT_FAILURE; - } - } - else - { - printf("FTP daemon [%d] is running\n", g_ftpdglob.pid); - } - - return EXIT_SUCCESS; -} - -/**************************************************************************** - * Name: ftpd_stop - ****************************************************************************/ - -#ifdef CONFIG_NSH_BUILTIN_APPS -int ftpd_stop(int s_argc, char **s_argv) -{ - if (!g_ftpdglob.initialized || !g_ftpdglob.running) - { - printf("The FTP daemon not running\n"); - return EXIT_FAILURE; - } - - printf("Stopping the FTP daemon, pid=%d\n", g_ftpdglob.pid); - g_ftpdglob.stop = true; - return EXIT_SUCCESS; -} -#endif diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile index 560b0da35..1d78d723e 100644 --- a/apps/examples/hello/Makefile +++ b/apps/examples/hello/Makefile @@ -54,14 +54,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -92,17 +90,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/helloxx/Makefile b/apps/examples/helloxx/Makefile index 062da7d58..8e85eab23 100644 --- a/apps/examples/helloxx/Makefile +++ b/apps/examples/helloxx/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/helloxx/Makefile # -# Copyright (C) 2009-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -50,14 +50,10 @@ CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -73,7 +69,7 @@ STACKSIZE = 2048 VPATH = all: .built -.PHONY: clean depend distclean chkcxx +.PHONY: clean depend disclean chkcxx chkcxx: ifneq ($(CONFIG_HAVE_CXX),y) @@ -97,7 +93,9 @@ $(CXXOBJS): %$(OBJEXT): %.cxx $(call COMPILEXX, $<, $@) .built: chkcxx $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -109,17 +107,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/hidkbd/Kconfig b/apps/examples/hidkbd/Kconfig deleted file mode 100644 index 503d9d9d9..000000000 --- a/apps/examples/hidkbd/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_HIDKBD - bool "USB HID keyboard example" - default n - ---help--- - Enable the USB HID keyboard example - -if EXAMPLES_HIDKBD -endif diff --git a/apps/examples/hidkbd/Makefile b/apps/examples/hidkbd/Makefile deleted file mode 100644 index 7663250c7..000000000 --- a/apps/examples/hidkbd/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -############################################################################ -# apps/examples/hidkbd/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# USB Host HID keyboard Example - -ASRCS = -CSRCS = hidkbd_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/hidkbd/hidkbd_main.c b/apps/examples/hidkbd/hidkbd_main.c deleted file mode 100644 index e744a495c..000000000 --- a/apps/examples/hidkbd/hidkbd_main.c +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** - * examples/hidkbd/null_main.c - * - * Copyright (C) 2011 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 Gregory Nutt 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/stat.h> - -#include <stdio.h> -#include <unistd.h> -#include <fcntl.h> -#include <sched.h> -#include <errno.h> - -#include <nuttx/usb/usbhost.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Sanity checking */ - -#ifndef CONFIG_USBHOST -# error "CONFIG_USBHOST is not defined" -#endif - -#ifdef CONFIG_USBHOST_INT_DISABLE -# error "Interrupt endpoints are disabled (CONFIG_USBHOST_INT_DISABLE)" -#endif - -#ifndef CONFIG_NFILE_DESCRIPTORS -# error "CONFIG_NFILE_DESCRIPTORS > 0 needed" -#endif - -/* Provide some default values for other configuration settings */ - -#ifndef CONFIG_EXAMPLES_HIDKBD_DEFPRIO -# define CONFIG_EXAMPLES_HIDKBD_DEFPRIO 50 -#endif - -#ifndef CONFIG_EXAMPLES_HIDKBD_STACKSIZE -# define CONFIG_EXAMPLES_HIDKBD_STACKSIZE 1024 -#endif - -#ifndef CONFIG_EXAMPLES_HIDKBD_DEVNAME -# define CONFIG_EXAMPLES_HIDKBD_DEVNAME "/dev/kbda" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static struct usbhost_driver_s *g_drvr; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: hidkbd_waiter - * - * Description: - * Wait for USB devices to be connected. - * - ****************************************************************************/ - -static int hidkbd_waiter(int argc, char *argv[]) -{ - bool connected = false; - int ret; - - printf("hidkbd_waiter: Running\n"); - for (;;) - { - /* Wait for the device to change state */ - - ret = DRVR_WAIT(g_drvr, connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - printf("hidkbd_waiter: %s\n", connected ? "connected" : "disconnected"); - - /* Did we just become connected? */ - - if (connected) - { - /* Yes.. enumerate the newly connected device */ - - (void)DRVR_ENUMERATE(g_drvr); - } - } - - /* Keep the compiler from complaining */ - - return 0; -} - -/**************************************************************************** - * Name: hidkbd_main - ****************************************************************************/ - -int hidkbd_main(int argc, char *argv[]) -{ - char buffer[256]; - pid_t pid; - ssize_t nbytes; - int fd; - int ret; - - /* First, register all of the USB host HID keyboard class driver */ - - printf("hidkbd_main: Register class drivers\n"); - ret = usbhost_kbdinit(); - if (ret != OK) - { - printf("hidkbd_main: Failed to register the KBD class\n"); - } - - /* Then get an instance of the USB host interface */ - - printf("hidkbd_main: Initialize USB host keyboard driver\n"); - g_drvr = usbhost_initialize(0); - if (g_drvr) - { - /* Start a thread to handle device connection. */ - - printf("hidkbd_main: Start hidkbd_waiter\n"); - -#ifndef CONFIG_CUSTOM_STACK - pid = task_create("usbhost", CONFIG_EXAMPLES_HIDKBD_DEFPRIO, - CONFIG_EXAMPLES_HIDKBD_STACKSIZE, - (main_t)hidkbd_waiter, (const char **)NULL); -#else - pid = task_create("usbhost", CONFIG_EXAMPLES_HIDKBD_DEFPRIO, - (main_t)hidkbd_waiter, (const char **)NULL); -#endif - - /* Now just sleep. Eventually logic here will open the kbd device and - * perform the HID keyboard test. - */ - - for (;;) - { - /* Open the keyboard device. Loop until the device is successfully - * opened. - */ - - do - { - printf("Opening device %s\n", CONFIG_EXAMPLES_HIDKBD_DEVNAME); - fd = open(CONFIG_EXAMPLES_HIDKBD_DEVNAME, O_RDONLY); - if (fd < 0) - { - printf("Failed: %d\n", errno); - fflush(stdout); - sleep(3); - } - } - while (fd < 0); - - printf("Device %s opened\n", CONFIG_EXAMPLES_HIDKBD_DEVNAME); - fflush(stdout); - - /* Loop until there is a read failure */ - - do - { - /* Read a buffer of data */ - - nbytes = read(fd, buffer, 256); - if (nbytes > 0) - { - /* On success, echo the buffer to stdout */ - - (void)write(1, buffer, nbytes); - } - } - while (nbytes >= 0); - - printf("Closing device %s: %d\n", CONFIG_EXAMPLES_HIDKBD_DEVNAME, (int)nbytes); - fflush(stdout); - close(fd); - } - } - return 0; -} diff --git a/apps/examples/igmp/Kconfig b/apps/examples/igmp/Kconfig deleted file mode 100644 index d94121376..000000000 --- a/apps/examples/igmp/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_IGMP - bool "IGMP example" - default n - ---help--- - Enable the IGMP example - -if EXAMPLES_IGMP -endif diff --git a/apps/examples/igmp/Makefile b/apps/examples/igmp/Makefile deleted file mode 100644 index 3715e1d34..000000000 --- a/apps/examples/igmp/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -############################################################################ -# apps/examples/igmp/Makefile -# -# Copyright (C) 2010, 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# IGMP Networking Example - -ASRCS = -CSRCS = igmp.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/igmp/igmp.c b/apps/examples/igmp/igmp.c deleted file mode 100644 index ebb4feb07..000000000 --- a/apps/examples/igmp/igmp.c +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** - * examples/igmp/igmp.c - * - * Copyright (C) 2010-2011 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 <stdio.h> -#include <unistd.h> -#include <debug.h> - -#include <net/if.h> -#include <nuttx/net/uip/uip.h> -#include <apps/netutils/uiplib.h> -#include <apps/netutils/ipmsfilter.h> - -#include "igmp.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Check if the destination address is a multicast address - * - * - IPv4: multicast addresses lie in the class D group -- The address range - * 224.0.0.0 to 239.255.255.255 (224.0.0.0/4) - * - * - IPv6 multicast addresses are have the high-order octet of the - * addresses=0xff (ff00::/8.) - */ - -#if ((CONFIG_EXAMPLES_IGMP_GRPADDR & 0xffff0000) < 0xe0000000ul) || \ - ((CONFIG_EXAMPLES_IGMP_GRPADDR & 0xffff0000) > 0xeffffffful) -# error "Bad range for IGMP group address" -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * igmp_main - ****************************************************************************/ - -int igmp_main(int argc, char *argv[]) -{ - struct in_addr addr; -#if defined(CONFIG_EXAMPLES_IGMP_NOMAC) - uint8_t mac[IFHWADDRLEN]; -#endif - - message("Configuring Ethernet...\n"); - - /* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_IGMP_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up our host address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_IPADDR); - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_NETMASK); - uip_setnetmask("eth0", &addr); - - /* Not much of a test for now */ - /* Join the group */ - - message("Join group...\n"); - addr.s_addr = HTONL(CONFIG_EXAMPLES_IGMP_GRPADDR); - ipmsfilter("eth0", &addr, MCAST_INCLUDE); - - /* Wait a while */ - - message("Wait for timeout...\n"); - sleep(5); - - /* Leave the group */ - - message("Leave group...\n"); - ipmsfilter("eth0", &addr, MCAST_EXCLUDE); - - /* Wait a while */ - - sleep(5); - message("Exiting...\n"); - return 0; -} diff --git a/apps/examples/igmp/igmp.h b/apps/examples/igmp/igmp.h deleted file mode 100644 index 093f58c1f..000000000 --- a/apps/examples/igmp/igmp.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** - * examples/igmp/igmp.h - * - * Copyright (C) 2010 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 __EXAMPLES_IGMP_H -#define __EXAMPLES_IGMP_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <debug.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Used lib_rawprintf() so that there is no confusion from buffered IO */ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# define message(...) lib_rawprintf(__VA_ARGS__) -#else -# define message lib_rawprintf -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __EXAMPLES_IGMP_H */ diff --git a/apps/examples/json/Kconfig b/apps/examples/json/Kconfig deleted file mode 100644 index 6d948f0d7..000000000 --- a/apps/examples/json/Kconfig +++ /dev/null @@ -1,14 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_JSON - bool "JSON example" - default n - select NETUTILS_JSON - ---help--- - An example for the netutils/json library. - -if EXAMPLES_JSON -endif diff --git a/apps/examples/json/Makefile b/apps/examples/json/Makefile deleted file mode 100644 index c3e9203f9..000000000 --- a/apps/examples/json/Makefile +++ /dev/null @@ -1,106 +0,0 @@ -############################################################################ -# apps/examples/json/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# cJSON built-in application info - -APPNAME = json -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -ASRCS = -CSRCS = json_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/json/README b/apps/examples/json/README deleted file mode 100644 index de9a0b2ed..000000000 --- a/apps/examples/json/README +++ /dev/null @@ -1,258 +0,0 @@ -apps/examples/json/README.txt -============================= - -This directory contains logic taken from the cJSON project: - -http://sourceforge.net/projects/cjson/ - -This corresponds to SVN revision r42 (with lots of changes for NuttX coding -standards). As of r42, the SVN repository was last updated on 2011-10-10 -so I presume that the code is stable and there is no risk of maintaining -duplicate logic in the NuttX repository. - -Contents -======== - - o License - o Welcome to cJSON - -License -======= - - Copyright (c) 2009 Dave Gamble - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - -Welcome to cJSON -================ - -cJSON aims to be the dumbest possible parser that you can get your job done with. -It's a single file of C, and a single header file. - -JSON is described best here: http://www.json.org/ -It's like XML, but fat-free. You use it to move data around, store things, or just -generally represent your program's state. - -First up, how do I build? -Add cJSON.c to your project, and put cJSON.h somewhere in the header search path. -For example, to build the test app: - -gcc cJSON.c test.c -o test -lm -./test - -As a library, cJSON exists to take away as much legwork as it can, but not get in your way. -As a point of pragmatism (i.e. ignoring the truth), I'm going to say that you can use it -in one of two modes: Auto and Manual. Let's have a quick run-through. - -I lifted some JSON from this page: http://www.json.org/fatfree.html -That page inspired me to write cJSON, which is a parser that tries to share the same -philosophy as JSON itself. Simple, dumb, out of the way. - -Some JSON: -{ - "name": "Jack (\"Bee\") Nimble", - "format": { - "type": "rect", - "width": 1920, - "height": 1080, - "interlace": false, - "frame rate": 24 - } -} - -Assume that you got this from a file, a webserver, or magic JSON elves, whatever, -you have a char * to it. Everything is a cJSON struct. -Get it parsed: - cJSON *root = cJSON_Parse(my_json_string); - -This is an object. We're in C. We don't have objects. But we do have structs. -What's the framerate? - - cJSON *format = cJSON_GetObjectItem(root,"format"); - int framerate = cJSON_GetObjectItem(format,"frame rate")->valueint; - -Want to change the framerate? - cJSON_GetObjectItem(format,"frame rate")->valueint=25; - -Back to disk? - char *rendered=cJSON_Print(root); - -Finished? Delete the root (this takes care of everything else). - cJSON_Delete(root); - -That's AUTO mode. If you're going to use Auto mode, you really ought to check pointers -before you dereference them. If you want to see how you'd build this struct in code? - cJSON *root,*fmt; - root=cJSON_CreateObject(); - cJSON_AddItemToObject(root, "name", cJSON_CreateString("Jack (\"Bee\") Nimble")); - cJSON_AddItemToObject(root, "format", fmt=cJSON_CreateObject()); - cJSON_AddStringToObject(fmt,"type", "rect"); - cJSON_AddNumberToObject(fmt,"width", 1920); - cJSON_AddNumberToObject(fmt,"height", 1080); - cJSON_AddFalseToObject (fmt,"interlace"); - cJSON_AddNumberToObject(fmt,"frame rate", 24); - -Hopefully we can agree that's not a lot of code? There's no overhead, no unnecessary setup. -Look at test.c for a bunch of nice examples, mostly all ripped off the json.org site, and -a few from elsewhere. - -What about manual mode? First up you need some detail. -Let's cover how the cJSON objects represent the JSON data. -cJSON doesn't distinguish arrays from objects in handling; just type. -Each cJSON has, potentially, a child, siblings, value, a name. - -The root object has: Object Type and a Child -The Child has name "name", with value "Jack ("Bee") Nimble", and a sibling: -Sibling has type Object, name "format", and a child. -That child has type String, name "type", value "rect", and a sibling: -Sibling has type Number, name "width", value 1920, and a sibling: -Sibling has type Number, name "height", value 1080, and a sibling: -Sibling hs type False, name "interlace", and a sibling: -Sibling has type Number, name "frame rate", value 24 - -Here's the structure: -typedef struct cJSON { - struct cJSON *next,*prev; - struct cJSON *child; - - int type; - - char *valuestring; - int valueint; - double valuedouble; - - char *string; -} cJSON; - -By default all values are 0 unless set by virtue of being meaningful. - -next/prev is a doubly linked list of siblings. next takes you to your sibling, -prev takes you back from your sibling to you. -Only objects and arrays have a "child", and it's the head of the doubly linked list. -A "child" entry will have prev==0, but next potentially points on. The last sibling has next=0. -The type expresses Null/True/False/Number/String/Array/Object, all of which are #defined in -cJSON.h - -A Number has valueint and valuedouble. If you're expecting an int, read valueint, if not read -valuedouble. - -Any entry which is in the linked list which is the child of an object will have a "string" -which is the "name" of the entry. When I said "name" in the above example, that's "string". -"string" is the JSON name for the 'variable name' if you will. - -Now you can trivially walk the lists, recursively, and parse as you please. -You can invoke cJSON_Parse to get cJSON to parse for you, and then you can take -the root object, and traverse the structure (which is, formally, an N-tree), -and tokenise as you please. If you wanted to build a callback style parser, this is how -you'd do it (just an example, since these things are very specific): - -void parse_and_callback(cJSON *item,const char *prefix) -{ - while (item) - { - char *newprefix=malloc(strlen(prefix)+strlen(item->name)+2); - sprintf(newprefix,"%s/%s",prefix,item->name); - int dorecurse=callback(newprefix, item->type, item); - if (item->child && dorecurse) parse_and_callback(item->child,newprefix); - item=item->next; - free(newprefix); - } -} - -The prefix process will build you a separated list, to simplify your callback handling. -The 'dorecurse' flag would let the callback decide to handle sub-arrays on it's own, or -let you invoke it per-item. For the item above, your callback might look like this: - -int callback(const char *name,int type,cJSON *item) -{ - if (!strcmp(name,"name")) { /* populate name */ } - else if (!strcmp(name,"format/type") { /* handle "rect" */ } - else if (!strcmp(name,"format/width") { /* 800 */ } - else if (!strcmp(name,"format/height") { /* 600 */ } - else if (!strcmp(name,"format/interlace") { /* false */ } - else if (!strcmp(name,"format/frame rate") { /* 24 */ } - return 1; -} - -Alternatively, you might like to parse iteratively. -You'd use: - -void parse_object(cJSON *item) -{ - int i; for (i=0;i<cJSON_GetArraySize(item);i++) - { - cJSON *subitem=cJSON_GetArrayItem(item,i); - // handle subitem. - } -} - -Or, for PROPER manual mode: - -void parse_object(cJSON *item) -{ - cJSON *subitem=item->child; - while (subitem) - { - // handle subitem - if (subitem->child) parse_object(subitem->child); - - subitem=subitem->next; - } -} - -Of course, this should look familiar, since this is just a stripped-down version -of the callback-parser. - -This should cover most uses you'll find for parsing. The rest should be possible -to infer.. and if in doubt, read the source! There's not a lot of it! ;) - -In terms of constructing JSON data, the example code above is the right way to do it. -You can, of course, hand your sub-objects to other functions to populate. -Also, if you find a use for it, you can manually build the objects. -For instance, suppose you wanted to build an array of objects? - -cJSON *objects[24]; - -cJSON *Create_array_of_anything(cJSON **items,int num) -{ - int i;cJSON *prev, *root=cJSON_CreateArray(); - for (i=0;i<24;i++) - { - if (!i) root->child=objects[i]; - else prev->next=objects[i], objects[i]->prev=prev; - prev=objects[i]; - } - return root; -} - -and simply: Create_array_of_anything(objects,24); - -cJSON doesn't make any assumptions about what order you create things in. -You can attach the objects, as above, and later add children to each -of those objects. - -As soon as you call cJSON_Print, it renders the structure to text. - -The test.c code shows how to handle a bunch of typical cases. If you uncomment -the code, it'll load, parse and print a bunch of test files, also from json.org, -which are more complex than I'd care to try and stash into a const char array[]. - -Enjoy cJSON! - -- Dave Gamble, Aug 2009 diff --git a/apps/examples/json/json_main.c b/apps/examples/json/json_main.c deleted file mode 100644 index 443be387b..000000000 --- a/apps/examples/json/json_main.c +++ /dev/null @@ -1,325 +0,0 @@ -/**************************************************************************** - * apps/examples/json/json_main.c - * - * This file is a part of NuttX: - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Ported by: Darcy Gong - * - * And derives from the cJSON Project which has an MIT license: - * - * Copyright (c) 2009 Dave Gamble - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include <apps/netutils/cJSON.h> - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/* Used by some code below as an example datatype. */ - -struct record -{ - const char *precision; - double lat; - double lon; - const char *address; - const char *city; - const char *state; - const char *zip; - const char *country; -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: doit - * - * Description: - * Parse text to JSON, then render back to text, and print! - * - ****************************************************************************/ - -static void doit(const char *text) -{ - char *out; - cJSON *json; - json = cJSON_Parse(text); - if (!json) - { - printf("Error before: [%s]\n", cJSON_GetErrorPtr()); - } - else - { - out = cJSON_Print(json); - cJSON_Delete(json); - printf("%s\n", out); - free(out); - } -} - -/**************************************************************************** - * Name: dofile - * - * Description: - * Read a file, parse, render back, etc. - * - ****************************************************************************/ - -#if 0 /* Not used */ -static void dofile(char *filename) -{ - FILE *f = fopen(filename, "rb"); - fseek(f, 0, SEEK_END); - long len = ftell(f); - fseek(f, 0, SEEK_SET); - char *data = malloc(len + 1); - fread(data, 1, len, f); - fclose(f); - doit(data); - free(data); -} -#endif - -/**************************************************************************** - * Name: create_objects - * - * Description: - * Create a bunch of objects as demonstration. - * - ****************************************************************************/ - -static void create_objects(void) -{ - cJSON *root; - cJSON *fmt; - cJSON *img; - cJSON *thm; - cJSON *fld; - char *out; - int i; - - /* Our "days of the week" array */ - - static const char *strings[7] = - { - "Sunday", "Monday", "Tuesday", "Wednesday", - "Thursday", "Friday", "Saturday" - }; - - /* Our matrix: */ - - static const int numbers[3][3] = { {0, -1, 0}, {1, 0, 0}, {0, 0, 1} }; - - /* Our "gallery" item: */ - - static const int ids[4] = { 116, 943, 234, 38793 }; - - /* Our array of "records": */ - - static const struct record fields[2] = - { - {"zip", 37.7668, -1.223959e+2, "", "SAN FRANCISCO", "CA", "94107", "US"}, - {"zip", 37.371991, -1.22026e+2, "", "SUNNYVALE", "CA", "94085", "US"} - }; - - /* Here we construct some JSON standards, from the JSON site. */ - /* Our "Video" datatype: */ - - root = cJSON_CreateObject(); - cJSON_AddItemToObject(root, "name", cJSON_CreateString("Jack (\"Bee\") Nimble")); - cJSON_AddItemToObject(root, "format", fmt = cJSON_CreateObject()); - cJSON_AddStringToObject(fmt, "type", "rect"); - cJSON_AddNumberToObject(fmt, "width", 1920); - cJSON_AddNumberToObject(fmt, "height", 1080); - cJSON_AddFalseToObject(fmt, "interlace"); - cJSON_AddNumberToObject(fmt, "frame rate", 24); - out = cJSON_Print(root); - cJSON_Delete(root); - printf("%s\n", out); - free(out); - - /* Print to text, Delete the cJSON, print it, release the string. */ - - root = cJSON_CreateStringArray(strings, 7); - out = cJSON_Print(root); - cJSON_Delete(root); - printf("%s\n", out); - free(out); - - root = cJSON_CreateArray(); - for (i = 0; i < 3; i++) - { - cJSON_AddItemToArray(root, cJSON_CreateIntArray(numbers[i], 3)); - } - -/*cJSON_ReplaceItemInArray(root,1,cJSON_CreateString("Replacement")); */ - out = cJSON_Print(root); - cJSON_Delete(root); - printf("%s\n", out); - free(out); - - root = cJSON_CreateObject(); - cJSON_AddItemToObject(root, "Image", img = cJSON_CreateObject()); - cJSON_AddNumberToObject(img, "Width", 800); - cJSON_AddNumberToObject(img, "Height", 600); - cJSON_AddStringToObject(img, "Title", "View from 15th Floor"); - cJSON_AddItemToObject(img, "Thumbnail", thm = cJSON_CreateObject()); - cJSON_AddStringToObject(thm, "Url", "http:/*www.example.com/image/481989943"); - cJSON_AddNumberToObject(thm, "Height", 125); - cJSON_AddStringToObject(thm, "Width", "100"); - cJSON_AddItemToObject(img, "IDs", cJSON_CreateIntArray(ids, 4)); - out = cJSON_Print(root); - cJSON_Delete(root); - printf("%s\n", out); - free(out); - - root = cJSON_CreateArray(); - for (i = 0; i < 2; i++) - { - cJSON_AddItemToArray(root, fld = cJSON_CreateObject()); - cJSON_AddStringToObject(fld, "precision", fields[i].precision); - cJSON_AddNumberToObject(fld, "Latitude", fields[i].lat); - cJSON_AddNumberToObject(fld, "Longitude", fields[i].lon); - cJSON_AddStringToObject(fld, "Address", fields[i].address); - cJSON_AddStringToObject(fld, "City", fields[i].city); - cJSON_AddStringToObject(fld, "State", fields[i].state); - cJSON_AddStringToObject(fld, "Zip", fields[i].zip); - cJSON_AddStringToObject(fld, "Country", fields[i].country); - } - -/*cJSON_ReplaceItemInObject(cJSON_GetArrayItem(root,1),"City",cJSON_CreateIntArray(ids,4)); */ - out = cJSON_Print(root); - cJSON_Delete(root); - printf("%s\n", out); - free(out); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ -/**************************************************************************** - * Name: - * - * Description: - * - * - ****************************************************************************/ - -int json_main(int argc, const char *argv[]) -{ - /* a bunch of json: */ - - static const char text1[] = - "{\n" - " \"name\": \"Jack (\\\"Bee\\\") Nimble\",\n" - " \"format\": {\n" - " \"type\": \"rect\",\n" - " \"width\": 1920,\n" - " \"height\": 1080,\n" - " \"interlace\": false,\n" - " \"frame rate\": 24\n" - " }\n" - "}"; - - static const char text2[] = - "[\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"]"; - - static const char text3[] = - "[\n" - " [0, -1, 0],\n" - " [1, 0, 0],\n" - " [0, 0, 1]\n" - "]\n"; - - static const char text4[] = - "{\n" - " \"Image\": {\n" - " \"Width\": 800,\n" - " \"Height\": 600,\n" - " \"Title\": \"View from 15th Floor\",\n" - " \"Thumbnail\": {\n" - " \"Url\": \"http:/*www.example.com/image/481989943\",\n" - " \"Height\": 125,\n" - " \"Width\": \"100\"\n" - " },\n" - " \"IDs\": [116, 943, 234, 38793]\n" - " }\n" - "}"; - - static const char text5[] = - "[\n" - " {\n" - " \"precision\": \"zip\",\n" - " \"Latitude\": 37.7668,\n" - " \"Longitude\": -122.3959,\n" - " \"Address\": \"\",\n" - " \"City\": \"SAN FRANCISCO\",\n" - " \"State\": \"CA\",\n" - " \"Zip\": \"94107\",\n" - " \"Country\": \"US\"\n" - " },\n" - " {\n" - " \"precision\": \"zip\",\n" - " \"Latitude\": 37.371991,\n" - " \"Longitude\": -122.026020,\n" - " \"Address\": \"\",\n" - " \"City\": \"SUNNYVALE\",\n" - " \"State\": \"CA\",\n" - " \"Zip\": \"94085\",\n" - " \"Country\": \"US\"\n" - " }\n" - "]"; - - /* Process each json textblock by parsing, then rebuilding: */ doit(text1); - - doit(text2); - doit(text3); - doit(text4); - doit(text5); - - /* Parse standard testfiles: */ - -#if 0 /* Not yet */ - dofile("../../tests/test1"); - dofile("../../tests/test2"); - dofile("../../tests/test3"); - dofile("../../tests/test4"); - dofile("../../tests/test5"); -#endif - - /* Now some samplecode for building objects concisely: */ - - create_objects(); - return 0; -} diff --git a/apps/examples/kalman_demo/KalmanNav.cpp b/apps/examples/kalman_demo/KalmanNav.cpp new file mode 100644 index 000000000..c2faa89de --- /dev/null +++ b/apps/examples/kalman_demo/KalmanNav.cpp @@ -0,0 +1,627 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * + * 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 PX4 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. + * + ****************************************************************************/ + +/** + * @file KalmanNav.cpp + * + * kalman filter navigation code + */ + +#include <poll.h> + +#include "KalmanNav.hpp" + +// constants +static const float omega = 7.2921150e-5f; // earth rotation rate, rad/s +static const float R = 6.371000e6f; // earth radius, m +static const float RSq = 4.0589641e13f; // radius squared +static const float g = 9.8f; // gravitational accel. m/s^2 + +KalmanNav::KalmanNav(SuperBlock *parent, const char *name) : + SuperBlock(parent, name), + // ekf matrices + F(9, 9), + G(9, 6), + P(9, 9), + V(6, 6), + // attitude measurement ekf matrices + HAtt(6, 9), + RAtt(6, 6), + // gps measurement ekf matrices + HGps(6, 9), + RGps(6, 6), + // attitude representations + C_nb(), + q(), + // subscriptions + _sensors(&getSubscriptions(), ORB_ID(sensor_combined), 5), // limit to 200 Hz + _gps(&getSubscriptions(), ORB_ID(vehicle_gps_position), 1000), // limit to 1 Hz + _param_update(&getSubscriptions(), ORB_ID(parameter_update), 1000), // limit to 1 Hz + // publications + _pos(&getPublications(), ORB_ID(vehicle_global_position)), + _att(&getPublications(), ORB_ID(vehicle_attitude)), + // timestamps + _pubTimeStamp(hrt_absolute_time()), + _fastTimeStamp(hrt_absolute_time()), + _slowTimeStamp(hrt_absolute_time()), + _attTimeStamp(hrt_absolute_time()), + _outTimeStamp(hrt_absolute_time()), + // frame count + _navFrames(0), + // state + fN(0), fE(0), fD(0), + phi(0), theta(0), psi(0), + vN(0), vE(0), vD(0), + lat(0), lon(0), alt(0), + // parameters for ground station + _vGyro(this, "V_GYRO"), + _vAccel(this, "V_ACCEL"), + _rMag(this, "R_MAG"), + _rGpsV(this, "R_GPS_V"), + _rGpsGeo(this, "R_GPS_GEO"), + _rGpsAlt(this, "R_GPS_ALT"), + _rAccel(this, "R_ACCEL") +{ + using namespace math; + + // initial state covariance matrix + P = Matrix::identity(9) * 1.0f; + + // wait for gps lock + while (1) { + updateSubscriptions(); + + if (_gps.fix_type > 2) break; + + printf("[kalman_demo] waiting for gps lock\n"); + usleep(1000000); + } + + // initial state + phi = 0.0f; + theta = 0.0f; + psi = 0.0f; + vN = _gps.vel_n; + vE = _gps.vel_e; + vD = _gps.vel_d; + setLatDegE7(_gps.lat); + setLonDegE7(_gps.lon); + setAltE3(_gps.alt); + + // initialize quaternions + q = Quaternion(EulerAngles(phi, theta, psi)); + + // initialize dcm + C_nb = Dcm(q); + + // initialize F to identity + F = Matrix::identity(9); + + // HGps is constant + HGps(0, 3) = 1.0f; + HGps(1, 4) = 1.0f; + HGps(2, 5) = 1.0f; + HGps(3, 6) = 1.0f; + HGps(4, 7) = 1.0f; + HGps(5, 8) = 1.0f; + + // initialize all parameters + updateParams(); +} + +void KalmanNav::update() +{ + using namespace math; + + struct pollfd fds[2]; + fds[0].fd = _sensors.getHandle(); + fds[0].events = POLLIN; + fds[1].fd = _param_update.getHandle(); + fds[1].events = POLLIN; + + // poll 20 milliseconds for new data + int ret = poll(fds, 2, 20); + + // check return value + if (ret < 0) { + // XXX this is seriously bad - should be an emergency + return; + + } else if (ret == 0) { // timeout + // run anyway + } else if (ret > 0) { + // update params when requested + if (fds[1].revents & POLLIN) { + printf("updating params\n"); + updateParams(); + } + + // if no new sensor data, return + if (!(fds[0].revents & POLLIN)) return; + } + + // get new timestamp + uint64_t newTimeStamp = hrt_absolute_time(); + + // check updated subscriptions + bool gpsUpdate = _gps.updated(); + + // get new information from subscriptions + // this clears update flag + updateSubscriptions(); + + // count fast frames + _navFrames += 1; + + // fast prediciton step + // note, using sensors timestamp so we can account + // for packet lag + float dtFast = (_sensors.timestamp - _fastTimeStamp) / 1.0e6f; + _fastTimeStamp = _sensors.timestamp; + predictFast(dtFast); + + // slow prediction step + float dtSlow = (_sensors.timestamp - _slowTimeStamp) / 1.0e6f; + + if (dtSlow > 1.0f / 200) { // 200 Hz + _slowTimeStamp = _sensors.timestamp; + predictSlow(dtSlow); + } + + // gps correction step + if (gpsUpdate) { + correctGps(); + } + + // attitude correction step + if (_sensors.timestamp - _attTimeStamp > 1e6 / 1) { // 1 Hz + _attTimeStamp = _sensors.timestamp; + correctAtt(); + } + + // publication + if (newTimeStamp - _pubTimeStamp > 1e6 / 50) { // 50 Hz + _pubTimeStamp = newTimeStamp; + updatePublications(); + } + + // output + if (newTimeStamp - _outTimeStamp > 1e6) { // 1 Hz + _outTimeStamp = newTimeStamp; + printf("nav: %4d Hz\n", _navFrames); + _navFrames = 0; + } +} + +void KalmanNav::updatePublications() +{ + using namespace math; + + // position publication + _pos.timestamp = _pubTimeStamp; + _pos.time_gps_usec = _gps.timestamp; + _pos.valid = true; + _pos.lat = getLatDegE7(); + _pos.lon = getLonDegE7(); + _pos.alt = float(alt); + _pos.relative_alt = float(alt); // TODO, make relative + _pos.vx = vN; + _pos.vy = vE; + _pos.vz = vD; + _pos.hdg = psi; + + // attitude publication + _att.timestamp = _pubTimeStamp; + _att.roll = phi; + _att.pitch = theta; + _att.yaw = psi; + _att.rollspeed = _sensors.gyro_rad_s[0]; + _att.pitchspeed = _sensors.gyro_rad_s[1]; + _att.yawspeed = _sensors.gyro_rad_s[2]; + // TODO, add gyro offsets to filter + _att.rate_offsets[0] = 0.0f; + _att.rate_offsets[1] = 0.0f; + _att.rate_offsets[2] = 0.0f; + + for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) + _att.R[i][j] = C_nb(i, j); + + for (int i = 0; i < 4; i++) _att.q[i] = q(i); + + _att.R_valid = true; + _att.q_valid = true; + _att.counter = _navFrames; + + // update publications + SuperBlock::updatePublications(); +} + +void KalmanNav::predictFast(float dt) +{ + using namespace math; + Vector3 w(_sensors.gyro_rad_s); + + // attitude + q = q + q.derivative(w) * dt; + + // renormalize quaternion if needed + if (fabsf(q.norm() - 1.0f) > 1e-4f) { + q = q.unit(); + } + + // C_nb update + C_nb = Dcm(q); + + // euler update + EulerAngles euler(C_nb); + phi = euler.getPhi(); + theta = euler.getTheta(); + psi = euler.getPsi(); + + // specific acceleration in nav frame + Vector3 accelB(_sensors.accelerometer_m_s2); + Vector3 accelN = C_nb * accelB; + fN = accelN(0); + fE = accelN(1); + fD = accelN(2); + + // trig + float sinL = sinf(lat); + float cosL = cosf(lat); + + // position update + // neglects angular deflections in local gravity + // see Titerton pg. 70 + float LDot = vN / (R + float(alt)); + float lDot = vE / (cosL * (R + float(alt))); + float vNDot = fN - vE * (2 * omega + + lDot) * sinL + + vD * LDot; + float vDDot = fD - vE * (2 * omega + lDot) * cosL - + vN * LDot + g; + float vEDot = fE + vN * (2 * omega + lDot) * sinL + + vDDot * (2 * omega * cosL); + + // rectangular integration + vN += vNDot * dt; + vE += vEDot * dt; + vD += vDDot * dt; + lat += double(LDot * dt); + lon += double(lDot * dt); + alt += double(-vD * dt); +} + +void KalmanNav::predictSlow(float dt) +{ + using namespace math; + + // trig + float sinL = sinf(lat); + float cosL = cosf(lat); + float cosLSq = cosL * cosL; + float tanL = tanf(lat); + + // F Matrix + // Titterton pg. 291 + // + // difference from Jacobian + // multiplity by dt for all elements + // add 1.0 to diagonal elements + + F(0, 1) = (-(omega * sinL + vE * tanL / R)) * dt; + F(0, 2) = (vN / R) * dt; + F(0, 4) = (1.0f / R) * dt; + F(0, 6) = (-omega * sinL) * dt; + F(0, 8) = (-vE / RSq) * dt; + + F(1, 0) = (omega * sinL + vE * tanL / R) * dt; + F(1, 2) = (omega * cosL + vE / R) * dt; + F(1, 3) = (-1.0f / R) * dt; + F(1, 8) = (vN / RSq) * dt; + + F(2, 0) = (-vN / R) * dt; + F(2, 1) = (-omega * cosL - vE / R) * dt; + F(2, 4) = (-tanL / R) * dt; + F(2, 6) = (-omega * cosL - vE / (R * cosLSq)) * dt; + F(2, 8) = (vE * tanL / RSq) * dt; + + F(3, 1) = (-fD) * dt; + F(3, 2) = (fE) * dt; + F(3, 3) = 1.0f + (vD / R) * dt; // on diagonal + F(3, 4) = (-2 * (omega * sinL + vE * tanL / R)) * dt; + F(3, 5) = (vN / R) * dt; + F(3, 6) = (-vE * (2 * omega * cosL + vE / (R * cosLSq))) * dt; + F(3, 8) = ((vE * vE * tanL - vN * vD) / RSq) * dt; + + F(4, 0) = (fD) * dt; + F(4, 2) = (-fN) * dt; + F(4, 3) = (2 * omega * sinL + vE * tanL / R) * dt; + F(4, 4) = 1.0f + ((vN * tanL + vD) / R) * dt; // on diagonal + F(4, 5) = (2 * omega * cosL + vE / R) * dt; + F(4, 6) = (2 * omega * (vN * cosL - vD * sinL) + + vN * vE / (R * cosLSq)) * dt; + F(4, 8) = (-vE * (vN * tanL + vD) / RSq) * dt; + + F(5, 0) = (-fE) * dt; + F(5, 1) = (fN) * dt; + F(5, 3) = (-2 * vN / R) * dt; + F(5, 4) = (-2 * (omega * cosL + vE / R)) * dt; + F(5, 6) = (2 * omega * vE * sinL) * dt; + F(5, 8) = ((vN * vN + vE * vE) / RSq) * dt; + + F(6, 3) = (1 / R) * dt; + F(6, 8) = (-vN / RSq) * dt; + + F(7, 4) = (1 / (R * cosL)) * dt; + F(7, 6) = (vE * tanL / (R * cosL)) * dt; + F(7, 8) = (-vE / (cosL * RSq)) * dt; + + F(8, 5) = (-1) * dt; + + // G Matrix + // Titterton pg. 291 + G(0, 0) = -C_nb(0, 0) * dt; + G(0, 1) = -C_nb(0, 1) * dt; + G(0, 2) = -C_nb(0, 2) * dt; + G(1, 0) = -C_nb(1, 0) * dt; + G(1, 1) = -C_nb(1, 1) * dt; + G(1, 2) = -C_nb(1, 2) * dt; + G(2, 0) = -C_nb(2, 0) * dt; + G(2, 1) = -C_nb(2, 1) * dt; + G(2, 2) = -C_nb(2, 2) * dt; + + G(3, 3) = C_nb(0, 0) * dt; + G(3, 4) = C_nb(0, 1) * dt; + G(3, 5) = C_nb(0, 2) * dt; + G(4, 3) = C_nb(1, 0) * dt; + G(4, 4) = C_nb(1, 1) * dt; + G(4, 5) = C_nb(1, 2) * dt; + G(5, 3) = C_nb(2, 0) * dt; + G(5, 4) = C_nb(2, 1) * dt; + G(5, 5) = C_nb(2, 2) * dt; + + // predict equations for kalman filter + P = F * P * F.transpose() + G * V * G.transpose(); +} + +void KalmanNav::correctAtt() +{ + using namespace math; + + // trig + float cosPhi = cosf(phi); + float cosTheta = cosf(theta); + float cosPsi = cosf(psi); + float sinPhi = sinf(phi); + float sinTheta = sinf(theta); + float sinPsi = sinf(psi); + + // mag measurement + Vector3 zMag(_sensors.magnetometer_ga); + zMag = zMag.unit(); + + // mag predicted measurement + // choosing some typical magnetic field properties, + // TODO dip/dec depend on lat/ lon/ time + static const float dip = 60.0f / M_RAD_TO_DEG_F; // dip, inclination with level + static const float dec = 0.0f / M_RAD_TO_DEG_F; // declination, clockwise rotation from north + float bN = cosf(dip) * cosf(dec); + float bE = cosf(dip) * sinf(dec); + float bD = sinf(dip); + Vector3 bNav(bN, bE, bD); + Vector3 zMagHat = (C_nb.transpose() * bNav).unit(); + + // accel measurement + Vector3 zAccel(_sensors.accelerometer_m_s2); + zAccel = zAccel.unit(); + + // accel predicted measurement + Vector3 zAccelHat = (C_nb.transpose() * Vector3(0, 0, -1)).unit(); + + // combined measurement + Vector zAtt(6); + Vector zAttHat(6); + + for (int i = 0; i < 3; i++) { + zAtt(i) = zMag(i); + zAtt(i + 3) = zAccel(i); + zAttHat(i) = zMagHat(i); + zAttHat(i + 3) = zAccelHat(i); + } + + // HMag , HAtt (0-2,:) + float tmp1 = + cosPsi * cosTheta * bN + + sinPsi * cosTheta * bE - + sinTheta * bD; + HAtt(0, 1) = -( + cosPsi * sinTheta * bN + + sinPsi * sinTheta * bE + + cosTheta * bD + ); + HAtt(0, 2) = -cosTheta * (sinPsi * bN - cosPsi * bE); + HAtt(1, 0) = + (cosPhi * cosPsi * sinTheta + sinPhi * sinPsi) * bN + + (cosPhi * sinPsi * sinTheta - sinPhi * cosPsi) * bE + + cosPhi * cosTheta * bD; + HAtt(1, 1) = sinPhi * tmp1; + HAtt(1, 2) = -( + (sinPhi * sinPsi * sinTheta + cosPhi * cosPsi) * bN - + (sinPhi * cosPsi * sinTheta - cosPhi * sinPsi) * bE + ); + HAtt(2, 0) = -( + (sinPhi * cosPsi * sinTheta - cosPhi * sinPsi) * bN + + (sinPhi * sinPsi * sinTheta + cosPhi * cosPsi) * bE + + (sinPhi * cosTheta) * bD + ); + HAtt(2, 1) = cosPhi * tmp1; + HAtt(2, 2) = -( + (cosPhi * sinPsi * sinTheta - sinPhi * cosTheta) * bN - + (cosPhi * cosPsi * sinTheta + sinPhi * sinPsi) * bE + ); + + // HAccel , HAtt (3-5,:) + HAtt(3, 1) = cosTheta; + HAtt(4, 0) = -cosPhi * cosTheta; + HAtt(4, 1) = sinPhi * sinTheta; + HAtt(5, 0) = sinPhi * cosTheta; + HAtt(5, 1) = cosPhi * sinTheta; + + // compute correction + Vector y = zAtt - zAttHat; // residual + Matrix S = HAtt * P * HAtt.transpose() + RAtt; // residual covariance + Matrix K = P * HAtt.transpose() * S.inverse(); + Vector xCorrect = K * y; + + // check correciton is sane + for (size_t i = 0; i < xCorrect.getRows(); i++) { + float val = xCorrect(i); + + if (isnan(val) || isinf(val)) { + // abort correction and return + printf("[kalman_demo] numerical failure in att correction\n"); + return; + } + } + + // correct state + phi += xCorrect(PHI); + theta += xCorrect(THETA); + psi += xCorrect(PSI); + + // update state covariance + P = P - K * HAtt * P; + + // fault detection + float beta = y.dot(S.inverse() * y); + printf("attitude: beta = %8.4f\n", (double)beta); + + if (beta > 10.0f) { + //printf("fault in attitude: beta = %8.4f\n", (double)beta); + //printf("y:\n"); y.print(); + } + + // update quaternions from euler + // angle correction + q = Quaternion(EulerAngles(phi, theta, psi)); +} + +void KalmanNav::correctGps() +{ + using namespace math; + Vector y(6); + y(0) = _gps.vel_n - vN; + y(1) = _gps.vel_e - vE; + y(2) = _gps.vel_d - vD; + y(3) = double(_gps.lat) / 1.0e7 / M_RAD_TO_DEG - lat; + y(4) = double(_gps.lon) / 1.0e7 / M_RAD_TO_DEG - lon; + y(5) = double(_gps.alt) / 1.0e3 - alt; + + // compute correction + Matrix S = HGps * P * HGps.transpose() + RGps; // residual covariance + Matrix K = P * HGps.transpose() * S.inverse(); + Vector xCorrect = K * y; + + // check correction is sane + for (size_t i = 0; i < xCorrect.getRows(); i++) { + float val = xCorrect(i); + + if (isnan(val) || isinf(val)) { + // abort correction and return + printf("[kalman_demo] numerical failure in gps correction\n"); + // fallback to GPS + vN = _gps.vel_n; + vE = _gps.vel_e; + vD = _gps.vel_d; + setLatDegE7(_gps.lat); + setLonDegE7(_gps.lon); + setAltE3(_gps.alt); + return; + } + } + + // correct state + vN += xCorrect(VN); + vE += xCorrect(VE); + vD += xCorrect(VD); + lat += double(xCorrect(LAT)); + lon += double(xCorrect(LON)); + alt += double(xCorrect(ALT)); + + // update state covariance + P = P - K * HGps * P; + + // fault detetcion + float beta = y.dot(S.inverse() * y); + printf("gps: beta = %8.4f\n", (double)beta); + + if (beta > 100.0f) { + //printf("fault in gps: beta = %8.4f\n", (double)beta); + //printf("y:\n"); y.print(); + } +} + +void KalmanNav::updateParams() +{ + using namespace math; + using namespace control; + SuperBlock::updateParams(); + + // gyro noise + V(0, 0) = _vGyro.get(); // gyro x, rad/s + V(1, 1) = _vGyro.get(); // gyro y + V(2, 2) = _vGyro.get(); // gyro z + + // accel noise + V(3, 3) = _vAccel.get(); // accel x, m/s^2 + V(4, 4) = _vAccel.get(); // accel y + V(5, 5) = _vAccel.get(); // accel z + + // magnetometer noise + RAtt(0, 0) = _rMag.get(); // normalized direction + RAtt(1, 1) = _rMag.get(); + RAtt(2, 2) = _rMag.get(); + + // accelerometer noise + RAtt(3, 3) = _rAccel.get(); // normalized direction + RAtt(4, 4) = _rAccel.get(); + RAtt(5, 5) = _rAccel.get(); + + // gps noise + RGps(0, 0) = _rGpsV.get(); // vn, m/s + RGps(1, 1) = _rGpsV.get(); // ve + RGps(2, 2) = _rGpsV.get(); // vd + RGps(3, 3) = _rGpsGeo.get(); // L, rad + RGps(4, 4) = _rGpsGeo.get(); // l, rad + RGps(5, 5) = _rGpsAlt.get(); // h, m +} diff --git a/apps/examples/kalman_demo/KalmanNav.hpp b/apps/examples/kalman_demo/KalmanNav.hpp new file mode 100644 index 000000000..dc4a81f4a --- /dev/null +++ b/apps/examples/kalman_demo/KalmanNav.hpp @@ -0,0 +1,116 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * + * 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 PX4 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. + * + ****************************************************************************/ + +/** + * @file KalmanNav.hpp + * + * kalman filter navigation code + */ + +#pragma once + +//#define MATRIX_ASSERT +//#define VECTOR_ASSERT + +#include <nuttx/config.h> + +#include <mathlib/mathlib.h> +#include <controllib/blocks.hpp> +#include <controllib/block/BlockParam.hpp> +#include <controllib/block/UOrbSubscription.hpp> +#include <controllib/block/UOrbPublication.hpp> + +#include <uORB/topics/vehicle_attitude.h> +#include <uORB/topics/vehicle_global_position.h> +#include <uORB/topics/sensor_combined.h> +#include <uORB/topics/vehicle_gps_position.h> +#include <uORB/topics/parameter_update.h> + +#include <drivers/drv_hrt.h> +#include <poll.h> +#include <unistd.h> + +class KalmanNav : public control::SuperBlock +{ +public: + KalmanNav(SuperBlock *parent, const char *name); + virtual ~KalmanNav() {}; + void update(); + virtual void updatePublications(); + void predictFast(float dt); + void predictSlow(float dt); + void correctAtt(); + void correctGps(); + virtual void updateParams(); +protected: + math::Matrix F; + math::Matrix G; + math::Matrix P; + math::Matrix V; + math::Matrix HAtt; + math::Matrix RAtt; + math::Matrix HGps; + math::Matrix RGps; + math::Dcm C_nb; + math::Quaternion q; + control::UOrbSubscription<sensor_combined_s> _sensors; + control::UOrbSubscription<vehicle_gps_position_s> _gps; + control::UOrbSubscription<parameter_update_s> _param_update; + control::UOrbPublication<vehicle_global_position_s> _pos; + control::UOrbPublication<vehicle_attitude_s> _att; + uint64_t _pubTimeStamp; + uint64_t _fastTimeStamp; + uint64_t _slowTimeStamp; + uint64_t _attTimeStamp; + uint64_t _outTimeStamp; + uint16_t _navFrames; + float fN, fE, fD; + // states + enum {PHI = 0, THETA, PSI, VN, VE, VD, LAT, LON, ALT}; + float phi, theta, psi; + float vN, vE, vD; + double lat, lon, alt; + control::BlockParam<float> _vGyro; + control::BlockParam<float> _vAccel; + control::BlockParam<float> _rMag; + control::BlockParam<float> _rGpsV; + control::BlockParam<float> _rGpsGeo; + control::BlockParam<float> _rGpsAlt; + control::BlockParam<float> _rAccel; + int32_t getLatDegE7() { return int32_t(lat * 1.0e7 * M_RAD_TO_DEG); } + void setLatDegE7(int32_t val) { lat = val / 1.0e7 / M_RAD_TO_DEG; } + int32_t getLonDegE7() { return int32_t(lon * 1.0e7 * M_RAD_TO_DEG); } + void setLonDegE7(int32_t val) { lon = val / 1.0e7 / M_RAD_TO_DEG; } + int32_t getAltE3() { return int32_t(alt * 1.0e3); } + void setAltE3(int32_t val) { alt = double(val) / 1.0e3; } +}; diff --git a/apps/examples/elf/tests/hello/Makefile b/apps/examples/kalman_demo/Makefile index 5cd80411b..99c34d934 100644 --- a/apps/examples/elf/tests/hello/Makefile +++ b/apps/examples/kalman_demo/Makefile @@ -1,8 +1,6 @@ ############################################################################ -# examples/elf/tests/hello/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt <gnutt@nuttx.org> +# Copyright (C) 2012 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -14,7 +12,7 @@ # 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 +# 3. Neither the name PX4 nor the names of its contributors may be # used to endorse or promote products derived from this software # without specific prior written permission. # @@ -33,27 +31,12 @@ # ############################################################################ --include $(TOPDIR)/Make.defs - -BIN = hello - -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) - -all: $(BIN) - -$(OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ - -$(BIN): $(OBJS) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ +# +# Basic example application +# -clean: - $(call DELFILE, $(BIN)) - $(call CLEAN) +APPNAME = kalman_demo +PRIORITY = SCHED_PRIORITY_MAX - 30 +STACKSIZE = 2048 -install: - $(Q) mkdir -p $(ROMFS_DIR) - $(Q) install $(BIN) $(ROMFS_DIR)/$(BIN) +include $(APPDIR)/mk/app.mk diff --git a/apps/examples/kalman_demo/kalman_demo.cpp b/apps/examples/kalman_demo/kalman_demo.cpp new file mode 100644 index 000000000..581b68b01 --- /dev/null +++ b/apps/examples/kalman_demo/kalman_demo.cpp @@ -0,0 +1,152 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Author: @author Example User <mail@example.com> + * + * 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 PX4 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. + * + ****************************************************************************/ + +/** + * @file kalman_demo.cpp + * Demonstration of control library + */ + +#include <nuttx/config.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <systemlib/systemlib.h> +#include <systemlib/param/param.h> +#include <drivers/drv_hrt.h> +#include <math.h> +#include "KalmanNav.hpp" + +static bool thread_should_exit = false; /**< Deamon exit flag */ +static bool thread_running = false; /**< Deamon status flag */ +static int deamon_task; /**< Handle of deamon task / thread */ + +/** + * Deamon management function. + */ +extern "C" __EXPORT int kalman_demo_main(int argc, char *argv[]); + +/** + * Mainloop of deamon. + */ +int kalman_demo_thread_main(int argc, char *argv[]); + +/** + * Print the correct usage. + */ +static void usage(const char *reason); + +static void +usage(const char *reason) +{ + if (reason) + fprintf(stderr, "%s\n", reason); + + fprintf(stderr, "usage: kalman_demo {start|stop|status} [-p <additional params>]\n\n"); + exit(1); +} + +/** + * The deamon app only briefly exists to start + * the background job. The stack size assigned in the + * Makefile does only apply to this management task. + * + * The actual stack size should be set in the call + * to task_create(). + */ +int kalman_demo_main(int argc, char *argv[]) +{ + + if (argc < 1) + usage("missing command"); + + if (!strcmp(argv[1], "start")) { + + if (thread_running) { + printf("kalman_demo already running\n"); + /* this is not an error */ + exit(0); + } + + thread_should_exit = false; + deamon_task = task_spawn("kalman_demo", + SCHED_DEFAULT, + SCHED_PRIORITY_MAX - 5, + 4096, + kalman_demo_thread_main, + (argv) ? (const char **)&argv[2] : (const char **)NULL); + exit(0); + } + + if (!strcmp(argv[1], "stop")) { + thread_should_exit = true; + exit(0); + } + + if (!strcmp(argv[1], "status")) { + if (thread_running) { + printf("\tkalman_demo app is running\n"); + + } else { + printf("\tkalman_demo app not started\n"); + } + + exit(0); + } + + usage("unrecognized command"); + exit(1); +} + +int kalman_demo_thread_main(int argc, char *argv[]) +{ + + printf("[kalman_demo] starting\n"); + + using namespace math; + + thread_running = true; + + KalmanNav nav(NULL, "KF"); + + while (!thread_should_exit) { + nav.update(); + } + + printf("[kalman_demo] exiting.\n"); + + thread_running = false; + + return 0; +} diff --git a/apps/examples/kalman_demo/params.c b/apps/examples/kalman_demo/params.c new file mode 100644 index 000000000..327e2cda6 --- /dev/null +++ b/apps/examples/kalman_demo/params.c @@ -0,0 +1,10 @@ +#include <systemlib/param/param.h> + +/*PARAM_DEFINE_FLOAT(NAME,0.0f);*/ +PARAM_DEFINE_FLOAT(KF_V_GYRO, 0.01f); +PARAM_DEFINE_FLOAT(KF_V_ACCEL, 0.01f); +PARAM_DEFINE_FLOAT(KF_R_MAG, 0.01f); +PARAM_DEFINE_FLOAT(KF_R_GPS_V, 0.1f); +PARAM_DEFINE_FLOAT(KF_R_GPS_GEO, 1.0e-7f); +PARAM_DEFINE_FLOAT(KF_R_GPS_ALT, 10.0f); +PARAM_DEFINE_FLOAT(KF_R_ACCEL, 0.01f); diff --git a/apps/examples/keypadtest/Kconfig b/apps/examples/keypadtest/Kconfig deleted file mode 100644 index 9dee80633..000000000 --- a/apps/examples/keypadtest/Kconfig +++ /dev/null @@ -1,21 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_KEYPADTEST - bool "Keypad test example program" - default n - ---help--- - Enable the Keypad test example programe - -if EXAMPLES_KEYPADTEST - - config EXAMPLES_KEYPAD_DEVNAME - string "Keypad Device Name" - default "/dev/keypad" - ---help--- - The name of the keypad device that will be opened in order to perform - the keypad test. Default: "/dev/keypad" - -endif diff --git a/apps/examples/keypadtest/Makefile b/apps/examples/keypadtest/Makefile deleted file mode 100644 index 3de0556a2..000000000 --- a/apps/examples/keypadtest/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################ -# apps/examples/keypadtest/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# Keypad Test Example - -ASRCS = -CSRCS = keypadtest_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -# helloxx built-in application info - -APPNAME = keypadtest -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/keypadtest/keypadtest_main.c b/apps/examples/keypadtest/keypadtest_main.c deleted file mode 100644 index afdc3e08a..000000000 --- a/apps/examples/keypadtest/keypadtest_main.c +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** - * examples/keypadtest/keypadtest_main.c - * - * Copyright (C) 2011 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 Gregory Nutt 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/stat.h> - -#include <stdio.h> -#include <unistd.h> -#include <fcntl.h> -#include <sched.h> -#include <errno.h> - -#include <nuttx/input/keypad.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Sanity checking */ - -/* Provide some default values for other configuration settings */ - -#ifndef CONFIG_EXAMPLES_KEYPAD_DEVNAME -# define CONFIG_EXAMPLES_KEYPAD_DEVNAME "/dev/keypad" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: keypadtest_main - ****************************************************************************/ - -int keypadtest_main(int argc, char *argv[]) -{ - char buffer[256]; - ssize_t nbytes; - int fd; - int ret; - - /* First, register the keyboard device(s) */ - - printf("keypadtest_main: Register keyboard device\n"); - ret = keypad_kbdinit(); - if (ret != OK) - { - printf("keypadtest_main: Failed to register the KBD class\n"); - fflush(stdout); - return 1; - } - - /* Open the configured keyboard device. */ - - printf("keypadtest_main: Opening device %s\n", CONFIG_EXAMPLES_KEYPAD_DEVNAME); - fd = open(CONFIG_EXAMPLES_KEYPAD_DEVNAME, O_RDONLY); - if (fd < 0) - { - printf("keypadtest_main: open() failed: %d\n", errno); - fflush(stdout); - return 1; - } - - printf("keypadtest_main: Device %s opened\n", CONFIG_EXAMPLES_KEYPAD_DEVNAME); - fflush(stdout); - - /* Loop until there is a read failure */ - - do - { - /* Read a buffer of data */ - - nbytes = read(fd, buffer, 256); - if (nbytes > 0) - { - /* On success, echo the buffer to stdout */ - - (void)write(1, buffer, nbytes); - } - } - while (nbytes >= 0); - - printf("keypadtest_main: Closing device %s: %d\n", CONFIG_EXAMPLES_KEYPAD_DEVNAME, (int)nbytes); - fflush(stdout); - close(fd); - return 0; -} diff --git a/apps/examples/lcdrw/Makefile b/apps/examples/lcdrw/Makefile deleted file mode 100644 index ed612e0be..000000000 --- a/apps/examples/lcdrw/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################ -# apps/examples/lcdrw/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# LCD Read/Write Test - -ASRCS = -CSRCS = lcdrw_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# LCD R/W built-in application info - -APPNAME = lcdrw -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_EXAMPLES_LCDRW_BUILTIN),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/lcdrw/lcdrw_main.c b/apps/examples/lcdrw/lcdrw_main.c deleted file mode 100644 index 0852502f3..000000000 --- a/apps/examples/lcdrw/lcdrw_main.c +++ /dev/null @@ -1,253 +0,0 @@ -/**************************************************************************** - * examples/lcdrw/lcdrw_main.c - * - * Copyright (C) 2011 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 <stdio.h> -#include <stdlib.h> - -#include <nuttx/lcd/lcd.h> -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* Most of the NX configuration settings are probbably *not* needed by this - * example. But, presumeably you are using NX too and so the checks might - * be good for you. - */ - -#ifndef CONFIG_NX -# error "CONFIG_NX must be defined to use this test" -#endif - -#ifndef CONFIG_NX_LCDDRIVER -# error "CONFIG_NX_LCDDRIVER must be defined to use this test" -#endif - -#ifndef CONFIG_EXAMPLES_LCDRW_BPP -# define CONFIG_EXAMPLES_LCDRW_BPP 16 -#endif - -#if CONFIG_EXAMPLES_LCDRW_BPP != 16 -# error "Currently only RGB565 is supported -- feel free to extend" -#endif - -#ifdef CONFIG_NX_DISABLE_16BPP -# error "CONFIG_NX_DISABLE_16BPP disables 16-bit support" -#endif - -#ifndef CONFIG_EXAMPLES_LDCRW_DEVNO -# define CONFIG_EXAMPLES_LDCRW_DEVNO 0 -#endif - -#ifndef CONFIG_EXAMPLES_LDCRW_XRES -# define CONFIG_EXAMPLES_LDCRW_XRES 240 -#endif - -#ifndef CONFIG_EXAMPLES_LDCRW_YRES -# define CONFIG_EXAMPLES_LDCRW_YRES 320 -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -struct lcdrw_instance_s -{ - /* LCD device handle and planeinfo */ - - FAR struct lcd_dev_s *dev; - struct lcd_planeinfo_s pinfo; -}; - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ -/**************************************************************************** - * Name: lcdrw_initialize - ****************************************************************************/ - -static inline int lcdrw_initialize(FAR struct lcdrw_instance_s *inst) -{ - int ret; - - /* Initialize the LCD device */ - - printf("screens_initialize: Initializing LCD\n"); - ret = up_lcdinitialize(); - if (ret < 0) - { - fprintf(stderr, "screens_initialize: up_lcdinitialize failed: %d\n", -ret); - return ret; - } - - /* Get the device instance. */ - - printf("Get LCD instance\n"); - inst->dev = up_lcdgetdev(CONFIG_EXAMPLES_LDCRW_DEVNO); - if (!inst->dev) - { - fprintf(stderr, "up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_LDCRW_DEVNO); - return ret; - } - - /* Turn the LCD on at 75% power. This should not be necessary. */ - - (void)inst->dev->setpower(inst->dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); - - /* Get the planeinfo structure */ - - ret = inst->dev->getplaneinfo(inst->dev, 0, &inst->pinfo); - if (ret < 0) - { - fprintf(stderr, "getplaneinfo failed: %d\n", ret); - } - return ret; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: lcdrw_main - ****************************************************************************/ - -int lcdrw_main(int argc, char *argv[]) -{ - struct lcdrw_instance_s inst; - nxgl_coord_t row; - nxgl_coord_t col; - uint16_t value; - uint32_t offset; - FAR uint16_t *ptr; - int ret; - - /* Initialize the LCD driver */ - - ret = lcdrw_initialize(&inst); - if (ret < 0) - { - exit(1); - } - - /* Loop, writing all possible values to the LCD */ - - value = 0; - for (row = 0; row < CONFIG_EXAMPLES_LDCRW_YRES; row++) - { - /* Create a dummy row. The important thing is to try all - * bit combinations in a predictable way. - */ - - ptr = (FAR uint16_t*)inst.pinfo.buffer; - for (col = 0; col < CONFIG_EXAMPLES_LDCRW_XRES; col++) - { - *ptr++ = value++; - } - - /* Write the row to the LCD */ - - ret = inst.pinfo.putrun(row, 0, inst.pinfo.buffer, - CONFIG_EXAMPLES_LDCRW_XRES); - if (ret < 0) - { - fprintf(stderr, "putrun failed: %d\n", ret); - exit(1); - } - } - - /* Print a header */ - - printf(" "); - for (col = 0; col < 15; col++) - { - printf("---%x ", col); - } - printf("---f\n"); - - /* Then read each line back from the LCD. */ - - offset = 0; - for (row = 0; row < CONFIG_EXAMPLES_LDCRW_YRES; row++) - { - /* Read the row */ - - ret = inst.pinfo.getrun(row, 0, inst.pinfo.buffer, - CONFIG_EXAMPLES_LDCRW_XRES); - if (ret < 0) - { - fprintf(stderr, "getrun failed: %d\n", ret); - exit(1); - } - - /* Then dump the row to the display */ - - ptr = (FAR uint16_t*)inst.pinfo.buffer; - for (col = 0; col < CONFIG_EXAMPLES_LDCRW_XRES; col++) - { - if ((offset & 15) == 0) - { - printf("%06x ", offset); - } - - value = *ptr++; - offset++; - - if ((offset & 15) == 0) - { - printf("%04x\n", value); - } - else - { - printf("%04x ", value); - } - } - } - fflush(stdout); - - return 0; -} - diff --git a/apps/examples/elf/tests/errno/Makefile b/apps/examples/math_demo/Makefile index ca2f34bf9..a1105899a 100644 --- a/apps/examples/elf/tests/errno/Makefile +++ b/apps/examples/math_demo/Makefile @@ -1,8 +1,6 @@ ############################################################################ -# examples/elf/tests/hello/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt <gnutt@nuttx.org> +# Copyright (C) 2012 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -14,7 +12,7 @@ # 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 +# 3. Neither the name PX4 nor the names of its contributors may be # used to endorse or promote products derived from this software # without specific prior written permission. # @@ -33,28 +31,12 @@ # ############################################################################ --include $(TOPDIR)/Make.defs - -BIN = errno - -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) - -all: $(BIN) - -$(OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ - -$(BIN): $(OBJS) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call CLEAN) +# +# Basic example application +# -install: - $(Q) mkdir -p $(ROMFS_DIR) - $(Q) install $(BIN) $(ROMFS_DIR)/$(BIN) +APPNAME = math_demo +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 8192 +include $(APPDIR)/mk/app.mk diff --git a/apps/examples/rgmp/rgmp_main.c b/apps/examples/math_demo/math_demo.cpp index e026852b8..a9c556748 100644 --- a/apps/examples/rgmp/rgmp_main.c +++ b/apps/examples/math_demo/math_demo.cpp @@ -1,8 +1,7 @@ /**************************************************************************** - * examples/rgmp/rgmp_main.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Author: @author Example User <mail@example.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -14,7 +13,7 @@ * 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 + * 3. Neither the name PX4 nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -33,34 +32,74 @@ * ****************************************************************************/ -/**************************************************************************** - * Included Files - ****************************************************************************/ +/** + * @file math_demo.cpp + * Demonstration of math library + */ #include <nuttx/config.h> +#include <unistd.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> +#include <systemlib/systemlib.h> +#include <mathlib/mathlib.h> -/**************************************************************************** - * Definitions - ****************************************************************************/ +/** + * Management function. + */ +extern "C" __EXPORT int math_demo_main(int argc, char *argv[]); -/**************************************************************************** - * Private Data - ****************************************************************************/ +/** + * Test function + */ +void test(); -/**************************************************************************** - * Public Functions - ****************************************************************************/ +/** + * Print the correct usage. + */ +static void usage(const char *reason); -/**************************************************************************** - * rgmp_main - ****************************************************************************/ +static void +usage(const char *reason) +{ + if (reason) + fprintf(stderr, "%s\n", reason); + fprintf(stderr, "usage: math_demo {test}\n\n"); + exit(1); +} -int rgmp_main(int argc, char *argv[]) +/** + * The deamon app only briefly exists to start + * the background job. The stack size assigned in the + * Makefile does only apply to this management task. + * + * The actual stack size should be set in the call + * to task_create(). + */ +int math_demo_main(int argc, char *argv[]) { - // TODO: add your code here - - return 0; + + if (argc < 1) + usage("missing command"); + + if (!strcmp(argv[1], "test")) { + test(); + exit(0); + } + + usage("unrecognized command"); + exit(1); } +void test() +{ + printf("beginning math lib test\n"); + using namespace math; + vectorTest(); + matrixTest(); + vector3Test(); + eulerAnglesTest(); + quaternionTest(); + dcmTest(); +} diff --git a/apps/examples/mm/Makefile b/apps/examples/mm/Makefile index 5ba7f4eec..24ed4926f 100644 --- a/apps/examples/mm/Makefile +++ b/apps/examples/mm/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/mm/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/modbus/Kconfig b/apps/examples/modbus/Kconfig deleted file mode 100644 index 7bc38bf9c..000000000 --- a/apps/examples/modbus/Kconfig +++ /dev/null @@ -1,53 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_MODBUS - bool "FreeModBus example" - default n - ---help--- - Enable the FreeModBus example - -if EXAMPLES_MODBUS - -config EXAMPLES_MODBUS_PORT - int "Port used for MODBUS transmissions" - default 0 - ---help--- - Port used for MODBUS transmissions, default = 0 (i.e., /dev/ttyS0) - -config EXAMPLES_MODBUS_BAUD - int "MODBUS baudrate" - default 38400 - range 50 3000000 - ---help--- - MODBUS baudrate, allowed values {50, 75, 110, 134, 150, 200, 300, 600, - 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 128000, - 230400, 256000, 460800, 500000, 576000, 921600, 1000000, 1152000, - 1500000, 2000000, 2500000, 3000000} - -config EXAMPLES_MODBUS_PARITY - int "MODBUS parity" - default 2 - range 0 2 - ---help--- - MODBUS parity, 0 - none, 1 - odd, 2 - even - -config EXAMPLES_MODBUS_REG_INPUT_START - int "Input registers start address" - default 1000 - -config EXAMPLES_MODBUS_REG_INPUT_NREGS - int "Number of input registers" - default 4 - -config EXAMPLES_MODBUS_REG_HOLDING_START - int "Holding registers start address" - default 2000 - -config EXAMPLES_MODBUS_REG_HOLDING_NREGS - int "Number of holding registers" - default 130 - -endif diff --git a/apps/examples/modbus/Makefile b/apps/examples/modbus/Makefile deleted file mode 100644 index d6caefe81..000000000 --- a/apps/examples/modbus/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################ -# apps/examples/modbus/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# FreeModBus demo built-in application info - -APPNAME = modbus -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# FreeModBus demo - -ASRCS = -CSRCS = modbus_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/modbus/modbus_main.c b/apps/examples/modbus/modbus_main.c deleted file mode 100644 index 2247fd675..000000000 --- a/apps/examples/modbus/modbus_main.c +++ /dev/null @@ -1,552 +0,0 @@ -/**************************************************************************** - * examples/modbus/main.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. - * - **************************************************************************** - * Leveraged from: - * - * FreeModbus Libary: Linux Demo Application - * Copyright (C) 2006 Christian Walter <wolti@sil.at> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <pthread.h> -#include <termios.h> -#include <signal.h> -#include <errno.h> - -#include <apps/modbus/mb.h> -#include <apps/modbus/mbport.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -#ifndef CONFIG_EXAMPLES_MODBUS_PORT -# define CONFIG_EXAMPLES_MODBUS_PORT 0 -#endif - -#ifndef CONFIG_EXAMPLES_MODBUS_BAUD -# define CONFIG_EXAMPLES_MODBUS_BAUD B38400 -#endif - -#ifndef CONFIG_EXAMPLES_MODBUS_PARITY -# define CONFIG_EXAMPLES_MODBUS_PARITY MB_PAR_EVEN -#endif - -#ifndef CONFIG_EXAMPLES_MODBUS_REG_INPUT_START -# define CONFIG_EXAMPLES_MODBUS_REG_INPUT_START 1000 -#endif - -#ifndef CONFIG_EXAMPLES_MODBUS_REG_INPUT_NREGS -# define CONFIG_EXAMPLES_MODBUS_REG_INPUT_NREGS 4 -#endif - -#ifndef CONFIG_EXAMPLES_MODBUS_REG_HOLDING_START -# define CONFIG_EXAMPLES_MODBUS_REG_HOLDING_START 2000 -#endif - -#ifndef CONFIG_EXAMPLES_MODBUS_REG_HOLDING_NREGS -# define CONFIG_EXAMPLES_MODBUS_REG_HOLDING_NREGS 130 -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -enum modbus_threadstate_e -{ - STOPPED = 0, - RUNNING, - SHUTDOWN -}; - -struct modbus_state_s -{ - enum modbus_threadstate_e threadstate; - uint16_t reginput[CONFIG_EXAMPLES_MODBUS_REG_INPUT_NREGS]; - uint16_t regholding[CONFIG_EXAMPLES_MODBUS_REG_HOLDING_NREGS]; - pthread_t threadid; - pthread_mutex_t lock; - volatile bool quit; -}; - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static inline int modbus_initialize(void); -static void *modbus_pollthread(void *pvarg); -static inline int modbus_create_pollthread(void); -static void modbus_showusage(FAR const char *progname, int exitcode); - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static struct modbus_state_s g_modbus; -static const uint8_t g_slaveid[] = { 0xaa, 0xbb, 0xcc }; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: modbus_initialize - * - * Description: - * Called from the ModBus polling thread in order to initialized the - * FreeModBus interface. - * - ****************************************************************************/ - -static inline int modbus_initialize(void) -{ - eMBErrorCode mberr; - int status; - - /* Verify that we are in the stopped state */ - - if (g_modbus.threadstate != STOPPED) - { - fprintf(stderr, "modbus_main: " - "ERROR: Bad state: %d\n", g_modbus.threadstate); - return EINVAL; - } - - /* Initialize the ModBus demo data structures */ - - status = pthread_mutex_init(&g_modbus.lock, NULL); - if (status != 0) - { - fprintf(stderr, "modbus_main: " - "ERROR: pthread_mutex_init failed: %d\n", status); - return status; - } - - status = ENODEV; - - /* Initialize the FreeModBus library. - * - * MB_RTU = RTU mode - * 0x0a = Slave address - * CONFIG_EXAMPLES_MODBUS_PORT = port, default=0 (i.e., /dev/ttyS0) - * CONFIG_EXAMPLES_MODBUS_BAUD = baud, default=B38400 - * CONFIG_EXAMPLES_MODBUS_PARITY = parity, default=MB_PAR_EVEN - */ - - mberr = eMBInit(MB_RTU, 0x0a, CONFIG_EXAMPLES_MODBUS_PORT, - CONFIG_EXAMPLES_MODBUS_BAUD, CONFIG_EXAMPLES_MODBUS_PARITY); - if (mberr != MB_ENOERR) - { - fprintf(stderr, "modbus_main: " - "ERROR: eMBInit failed: %d\n", mberr); - goto errout_with_mutex; - } - - /* Set the slave ID - * - * 0x34 = Slave ID - * true = Is running (run indicator status = 0xff) - * g_slaveid = Additional values to be returned with the slave ID - * 3 = Length of additional values (in bytes) - */ - - mberr = eMBSetSlaveID(0x34, true, g_slaveid, 3); - if (mberr != MB_ENOERR) - { - fprintf(stderr, "modbus_main: " - "ERROR: eMBSetSlaveID failed: %d\n", mberr); - goto errout_with_modbus; - } - - /* Enable FreeModBus */ - - mberr = eMBEnable(); - if (mberr != MB_ENOERR) - { - fprintf(stderr, "modbus_main: " - "ERROR: eMBEnable failed: %d\n", mberr); - goto errout_with_modbus; - } - - /* Successfully initialized */ - - g_modbus.threadstate = RUNNING; - return OK; - -errout_with_modbus: - /* Release hardware resources. */ - - (void)eMBClose(); - -errout_with_mutex: - - /* Free/uninitialize data structures */ - - (void)pthread_mutex_destroy(&g_modbus.lock); - - g_modbus.threadstate = STOPPED; - return status; -} - -/**************************************************************************** - * Name: modbus_pollthread - * - * Description: - * This is the ModBus polling thread. - * - ****************************************************************************/ - -static void *modbus_pollthread(void *pvarg) -{ - eMBErrorCode mberr; - int ret; - - /* Initialize the modbus */ - - ret = modbus_initialize(); - if (ret != OK) - { - fprintf(stderr, "modbus_main: " - "ERROR: modbus_initialize failed: %d\n", ret); - return NULL; - } - - srand(time(NULL)); - - /* Then loop until we are commanded to shutdown */ - - do - { - /* Poll */ - - mberr = eMBPoll(); - if (mberr != MB_ENOERR) - { - break; - } - - /* Generate some random input */ - - g_modbus.reginput[0] = (uint16_t)rand(); - } - while (g_modbus.threadstate != SHUTDOWN); - - /* Disable */ - - (void)eMBDisable(); - - /* Release hardware resources. */ - - (void)eMBClose(); - - /* Free/uninitialize data structures */ - - (void)pthread_mutex_destroy(&g_modbus.lock); - g_modbus.threadstate = STOPPED; - return NULL; -} - -/**************************************************************************** - * Name: modbus_create_pollthread - * - * Description: - * Start the ModBus polling thread - * - ****************************************************************************/ - -static inline int modbus_create_pollthread(void) -{ - int ret; - - if (g_modbus.threadstate == STOPPED) - { - ret = pthread_create(&g_modbus.threadid, NULL, modbus_pollthread, NULL); - } - else - { - ret = EINVAL; - } - - return ret; -} - -/**************************************************************************** - * Name: modbus_showusage - * - * Description: - * Show usage of the demo program and exit - * - ****************************************************************************/ - -static void modbus_showusage(FAR const char *progname, int exitcode) -{ - printf("USAGE: %s [-d|e|s|q|h]\n\n", progname); - printf("Where:\n"); - printf(" -d : Disable protocol stack\n"); - printf(" -e : Enable the protocol stack\n"); - printf(" -s : Show current status\n"); - printf(" -q : Quit application\n"); - printf(" -h : Show this information\n"); - printf("\n"); - exit(exitcode); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: modbus_main - * - * Description: - * This is the main entry point to the demo program - * - ****************************************************************************/ - -int modbus_main(int argc, char *argv[]) -{ - int option; - int ret; - - /* Handle command line arguments */ - - g_modbus.quit = false; - - while ((option = getopt(argc, argv, "desqh")) != ERROR) - { - switch (option) - { - case 'd': /* Disable protocol stack */ - (void)pthread_mutex_lock(&g_modbus.lock); - g_modbus.threadstate = SHUTDOWN; - (void)pthread_mutex_unlock(&g_modbus.lock); - break; - - case 'e': /* Enable the protocol stack */ - { - ret = modbus_create_pollthread(); - if (ret != OK) - { - fprintf(stderr, "modbus_main: " - "ERROR: modbus_create_pollthread failed: %d\n", ret); - exit(EXIT_FAILURE); - } - } - break; - - case 's': /* Show current status */ - switch (g_modbus.threadstate) - { - case RUNNING: - printf("modbus_main: Protocol stack is running\n"); - break; - - case STOPPED: - printf("modbus_main: Protocol stack is stopped\n"); - break; - - case SHUTDOWN: - printf("modbus_main: Protocol stack is shutting down\n"); - break; - - default: - fprintf(stderr, "modbus_main: " - "ERROR: Invalid thread state: %d\n", - g_modbus.threadstate); - break; - } - break; - - case 'q': /* Quit application */ - g_modbus.quit = true; - pthread_kill(g_modbus.threadid, 9); - break; - - case 'h': /* Show help info */ - modbus_showusage(argv[0], EXIT_SUCCESS); - break; - - default: - fprintf(stderr, "modbus_main: " - "ERROR: Unrecognized option: '%c'\n", option); - modbus_showusage(argv[0], EXIT_FAILURE); - break; - } - } - - return EXIT_SUCCESS; -} - -/**************************************************************************** - * Name: eMBRegInputCB - * - * Description: - * Required FreeModBus callback function - * - ****************************************************************************/ - -eMBErrorCode eMBRegInputCB(uint8_t *buffer, uint16_t address, uint16_t nregs) -{ - eMBErrorCode mberr = MB_ENOERR; - int index; - - if ((address >= CONFIG_EXAMPLES_MODBUS_REG_INPUT_START) && - (address + nregs <= - CONFIG_EXAMPLES_MODBUS_REG_INPUT_START + - CONFIG_EXAMPLES_MODBUS_REG_INPUT_NREGS)) - { - index = (int)(address - CONFIG_EXAMPLES_MODBUS_REG_INPUT_START); - while (nregs > 0) - { - *buffer++ = (uint8_t)(g_modbus.reginput[index] >> 8); - *buffer++ = (uint8_t)(g_modbus.reginput[index] & 0xff); - index++; - nregs--; - } - } - else - { - mberr = MB_ENOREG; - } - - return mberr; -} - -/**************************************************************************** - * Name: eMBRegHoldingCB - * - * Description: - * Required FreeModBus callback function - * - ****************************************************************************/ - -eMBErrorCode eMBRegHoldingCB(uint8_t *buffer, uint16_t address, uint16_t nregs, - eMBRegisterMode mode) -{ - eMBErrorCode mberr = MB_ENOERR; - int index; - - if ((address >= CONFIG_EXAMPLES_MODBUS_REG_HOLDING_START) && - (address + nregs <= - CONFIG_EXAMPLES_MODBUS_REG_HOLDING_START + - CONFIG_EXAMPLES_MODBUS_REG_HOLDING_NREGS)) - { - index = (int)(address - CONFIG_EXAMPLES_MODBUS_REG_HOLDING_START); - switch (mode) - { - /* Pass current register values to the protocol stack. */ - case MB_REG_READ: - while (nregs > 0) - { - *buffer++ = (uint8_t)(g_modbus.regholding[index] >> 8); - *buffer++ = (uint8_t)(g_modbus.regholding[index] & 0xff); - index++; - nregs--; - } - break; - - /* Update current register values with new values from the - * protocol stack. - */ - - case MB_REG_WRITE: - while (nregs > 0) - { - g_modbus.regholding[index] = *buffer++ << 8; - g_modbus.regholding[index] |= *buffer++; - index++; - nregs--; - } - break; - } - } - else - { - mberr = MB_ENOREG; - } - - return mberr; -} - -/**************************************************************************** - * Name: eMBRegCoilsCB - * - * Description: - * Required FreeModBus callback function - * - ****************************************************************************/ - -eMBErrorCode eMBRegCoilsCB(uint8_t *buffer, uint16_t address, uint16_t ncoils, - eMBRegisterMode mode) -{ - return MB_ENOREG; -} - -/**************************************************************************** - * Name: eMBRegDiscreteCB - * - * Description: - * Required FreeModBus callback function - * - ****************************************************************************/ - -eMBErrorCode eMBRegDiscreteCB(uint8_t *buffer, uint16_t address, uint16_t ndiscrete) -{ - return MB_ENOREG; -} diff --git a/apps/examples/mount/Makefile b/apps/examples/mount/Makefile index 133bdfa1f..69cf970cf 100644 --- a/apps/examples/mount/Makefile +++ b/apps/examples/mount/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/Makefile # -# Copyright (C) 2007-2008, 2010-2010, 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2010-2010 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/nettest/Kconfig b/apps/examples/nettest/Kconfig deleted file mode 100644 index 63d34ec3f..000000000 --- a/apps/examples/nettest/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_NETTEST - bool "Network test example" - default n - ---help--- - Enable the network test example - -if EXAMPLES_NETTEST -endif diff --git a/apps/examples/nettest/Makefile b/apps/examples/nettest/Makefile deleted file mode 100644 index 085b9406d..000000000 --- a/apps/examples/nettest/Makefile +++ /dev/null @@ -1,143 +0,0 @@ -############################################################################ -# examples/nettest/Makefile -# -# Copyright (C) 2007-2008, 2010-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# Basic TCP networking test - -TARG_ASRCS = -TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT)) - -TARG_CSRCS = nettest.c -ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y) -TARG_CSRCS += nettest_server.c -else -TARG_CSRCS += nettest_client.c -endif - -TARG_COBJS = $(TARG_CSRCS:.c=$(OBJEXT)) - -TARG_SRCS = $(TARG_ASRCS) $(TARG_CSRCS) -TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - TARG_BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - TARG_BIN = ..\\..\\libapps$(LIBEXT) -else - TARG_BIN = ../../libapps$(LIBEXT) -endif -endif - -HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_HOST=1 -ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y) -HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_SERVER=1 \ - -DCONFIG_EXAMPLES_NETTEST_CLIENTIP="$(CONFIG_EXAMPLES_NETTEST_CLIENTIP)" -endif -ifeq ($(CONFIG_EXAMPLES_NETTEST_PERFORMANCE),y) -HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_PERFORMANCE=1 -endif - -HOST_SRCS = host.c -ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y) -HOST_SRCS += nettest_client.c -else -HOST_SRCS += nettest_server.c -endif - -HOST_OBJS = $(HOST_SRCS:.c=.o) -HOST_BIN = host - -ROOTDEPPATH = --dep-path . - -# NET test built-in application info - -APPNAME = nettest -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built $(HOST_BIN) -.PHONY: clean depend distclean - -$(TARG_AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(TARG_COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -$(HOST_OBJS): %.o: %.c - @echo "CC: $<" - @$(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ - -$(HOST_BIN): $(HOST_OBJS) - @echo "LD: $@" - @$(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@ - -.built: $(TARG_OBJS) - $(call ARCHIVE, $(BIN), $(TARG_OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(TARG_SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(TARG_SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, $(HOST_BIN)) - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/nettest/host.c b/apps/examples/nettest/host.c deleted file mode 100644 index ad9d5e942..000000000 --- a/apps/examples/nettest/host.c +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** - * examples/nettest/host.c - * - * Copyright (C) 2007, 2011 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 Gregory Nutt 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 "nettest.h" - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * main - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ -#ifdef CONFIG_EXAMPLES_NETTEST_SERVER - send_client(); -#else - recv_server(); -#endif - - return 0; -} diff --git a/apps/examples/nettest/nettest.c b/apps/examples/nettest/nettest.c deleted file mode 100644 index 81faf9b93..000000000 --- a/apps/examples/nettest/nettest.c +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** - * examples/nettest/nettest.c - * - * Copyright (C) 2007, 2009-2011 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 <stdio.h> -#include <debug.h> - -#include <net/if.h> -#include <nuttx/net/uip/uip.h> -#include <apps/netutils/uiplib.h> - -#include "nettest.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * nettest_main - ****************************************************************************/ - -int nettest_main(int argc, char *argv[]) -{ - struct in_addr addr; -#ifdef CONFIG_EXAMPLES_NETTEST_NOMAC - uint8_t mac[IFHWADDRLEN]; -#endif - -/* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_NETTEST_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up our host address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_IPADDR); - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_NETMASK); - uip_setnetmask("eth0", &addr); - -#ifdef CONFIG_EXAMPLES_NETTEST_SERVER - recv_server(); -#else - send_client(); -#endif - - return 0; -} diff --git a/apps/examples/nettest/nettest.h b/apps/examples/nettest/nettest.h deleted file mode 100644 index f05038584..000000000 --- a/apps/examples/nettest/nettest.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** - * examples/nettest/nettest.h - * - * Copyright (C) 2007, 2009 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 __EXAMPLES_NETTEST_H -#define __EXAMPLES_NETTEST_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NETTEST_HOST -#else -# include <debug.h> -#endif - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NETTEST_HOST - /* HTONS/L macros are unique to uIP */ - -# define HTONS(a) htons(a) -# define HTONL(a) htonl(a) - - /* Used printf for debug output */ - -# ifdef CONFIG_CPP_HAVE_VARARGS -# define message(...) printf(__VA_ARGS__) -# else -# define message printf -# endif - - /* Have SO_LINGER */ - -# define NETTEST_HAVE_SOLINGER 1 - -#else - - /* Used lib_rawprintf() so that there is not confusion from buffered IO */ - -# ifdef CONFIG_CPP_HAVE_VARARGS -# define message(...) lib_rawprintf(__VA_ARGS__) -# else -# define message lib_rawprintf -# endif - - /* At present, uIP does only abortive disconnects */ - -# undef NETTEST_HAVE_SOLINGER -#endif - -#define PORTNO 5471 -#define SENDSIZE 4096 - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -extern void send_client(void); -extern void recv_server(void); - -#endif /* __EXAMPLES_NETTEST_H */ diff --git a/apps/examples/nettest/nettest_client.c b/apps/examples/nettest/nettest_client.c deleted file mode 100644 index 8ab5b14d6..000000000 --- a/apps/examples/nettest/nettest_client.c +++ /dev/null @@ -1,210 +0,0 @@ -/**************************************************************************** - * examples/nettest/nettest-client.c - * - * Copyright (C) 2007, 2011-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 Gregory Nutt 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 <sys/socket.h> -#include <netinet/in.h> - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -#include "nettest.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void send_client(void) -{ - struct sockaddr_in myaddr; - char *outbuf; -#ifndef CONFIG_EXAMPLES_NETTEST_PERFORMANCE - char *inbuf; -#endif - int sockfd; - int nbytessent; -#ifndef CONFIG_EXAMPLES_NETTEST_PERFORMANCE - int nbytesrecvd; - int totalbytesrecvd; -#endif - int ch; - int i; - - /* Allocate buffers */ - - outbuf = (char*)malloc(SENDSIZE); -#ifndef CONFIG_EXAMPLES_NETTEST_PERFORMANCE - inbuf = (char*)malloc(SENDSIZE); - if (!outbuf || !inbuf) -#else - if (!outbuf) -#endif - { - message("client: failed to allocate buffers\n"); - exit(1); - } - - /* Create a new TCP socket */ - - sockfd = socket(PF_INET, SOCK_STREAM, 0); - if (sockfd < 0) - { - message("client socket failure %d\n", errno); - goto errout_with_buffers; - } - - /* Connect the socket to the server */ - - myaddr.sin_family = AF_INET; - myaddr.sin_port = HTONS(PORTNO); -#if 0 - myaddr.sin_addr.s_addr = HTONL(INADDR_LOOPBACK); -#else - myaddr.sin_addr.s_addr = HTONL(CONFIG_EXAMPLES_NETTEST_CLIENTIP); -#endif - - message("client: Connecting...\n"); - if (connect( sockfd, (struct sockaddr*)&myaddr, sizeof(struct sockaddr_in)) < 0) - { - message("client: connect failure: %d\n", errno); - goto errout_with_socket; - } - message("client: Connected\n"); - - /* Initialize the buffer */ - - ch = 0x20; - for (i = 0; i < SENDSIZE; i++ ) - { - outbuf[i] = ch; - if (++ch > 0x7e) - { - ch = 0x20; - } - } - -#ifdef CONFIG_EXAMPLES_NETTEST_PERFORMANCE - /* Then send messages forever */ - - for (;;) - { - nbytessent = send(sockfd, outbuf, SENDSIZE, 0); - if (nbytessent < 0) - { - message("client: send failed: %d\n", errno); - goto errout_with_socket; - } - else if (nbytessent != SENDSIZE) - { - message("client: Bad send length=%d: %d of \n", - nbytessent, SENDSIZE); - goto errout_with_socket; - } - message("Sent %d bytes\n", nbytessent); - } -#else - /* Then send and receive one message */ - - message("client: Sending %d bytes\n", SENDSIZE); - nbytessent = send(sockfd, outbuf, SENDSIZE, 0); - message("client: Sent %d bytes\n", nbytessent); - - if (nbytessent < 0) - { - message("client: send failed: %d\n", errno); - goto errout_with_socket; - } - else if (nbytessent != SENDSIZE) - { - message("client: Bad send length: %d Expected: %d\n", nbytessent, SENDSIZE); - goto errout_with_socket; - } - - totalbytesrecvd = 0; - do - { - message("client: Receiving...\n"); - nbytesrecvd = recv(sockfd, &inbuf[totalbytesrecvd], SENDSIZE - totalbytesrecvd, 0); - - if (nbytesrecvd < 0) - { - message("client: recv failed: %d\n", errno); - goto errout_with_socket; - } - else if (nbytesrecvd == 0) - { - message("client: The server closed the connection\n"); - goto errout_with_socket; - } - totalbytesrecvd += nbytesrecvd; - message("client: Received %d of %d bytes\n", totalbytesrecvd, SENDSIZE); - } - while (totalbytesrecvd < SENDSIZE); - - if (totalbytesrecvd != SENDSIZE) - { - message("client: Bad recv length: %d Expected: %d\n", totalbytesrecvd, SENDSIZE); - goto errout_with_socket; - } - else if (memcmp(inbuf, outbuf, SENDSIZE) != 0) - { - message("client: Received buffer does not match sent buffer\n"); - goto errout_with_socket; - } - - close(sockfd); - free(outbuf); -#ifndef CONFIG_EXAMPLES_NETTEST_PERFORMANCE - free(inbuf); -#endif - return; -#endif - -errout_with_socket: - close(sockfd); - -errout_with_buffers: - free(outbuf); -#ifndef CONFIG_EXAMPLES_NETTEST_PERFORMANCE - free(inbuf); -#endif - exit(1); -} diff --git a/apps/examples/nettest/nettest_server.c b/apps/examples/nettest/nettest_server.c deleted file mode 100644 index 5757a778a..000000000 --- a/apps/examples/nettest/nettest_server.c +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** - * examples/nettest/nettest-server.c - * - * Copyright (C) 2007, 2011-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 Gregory Nutt 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 <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <errno.h> - -#include "nettest.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void recv_server(void) -{ - struct sockaddr_in myaddr; -#ifdef NETTEST_HAVE_SOLINGER - struct linger ling; -#endif - char *buffer; - int listensd; - int acceptsd; - socklen_t addrlen; - int nbytesread; -#ifndef CONFIG_EXAMPLES_NETTEST_PERFORMANCE - int totalbytesread; - int nbytessent; - int ch; - int i; -#endif - int optval; - - /* Allocate a BIG buffer */ - - buffer = (char*)malloc(2*SENDSIZE); - if (!buffer) - { - message("server: failed to allocate buffer\n"); - exit(1); - } - - - /* Create a new TCP socket */ - - listensd = socket(PF_INET, SOCK_STREAM, 0); - if (listensd < 0) - { - message("server: socket failure: %d\n", errno); - goto errout_with_buffer; - } - - /* Set socket to reuse address */ - - optval = 1; - if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0) - { - message("server: setsockopt SO_REUSEADDR failure: %d\n", errno); - goto errout_with_listensd; - } - - /* Bind the socket to a local address */ - - myaddr.sin_family = AF_INET; - myaddr.sin_port = HTONS(PORTNO); - myaddr.sin_addr.s_addr = INADDR_ANY; - - if (bind(listensd, (struct sockaddr*)&myaddr, sizeof(struct sockaddr_in)) < 0) - { - message("server: bind failure: %d\n", errno); - goto errout_with_listensd; - } - - /* Listen for connections on the bound TCP socket */ - - if (listen(listensd, 5) < 0) - { - message("server: listen failure %d\n", errno); - goto errout_with_listensd; - } - - /* Accept only one connection */ - - message("server: Accepting connections on port %d\n", PORTNO); - addrlen = sizeof(struct sockaddr_in); - acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen); - if (acceptsd < 0) - { - message("server: accept failure: %d\n", errno); - goto errout_with_listensd; - } - message("server: Connection accepted -- receiving\n"); - - /* Configure to "linger" until all data is sent when the socket is closed */ - -#ifdef NETTEST_HAVE_SOLINGER - ling.l_onoff = 1; - ling.l_linger = 30; /* timeout is seconds */ - if (setsockopt(acceptsd, SOL_SOCKET, SO_LINGER, &ling, sizeof(struct linger)) < 0) - { - message("server: setsockopt SO_LINGER failure: %d\n", errno); - goto errout_with_acceptsd; - } -#endif - -#ifdef CONFIG_EXAMPLES_NETTEST_PERFORMANCE - /* Then receive data forever */ - - for (;;) - { - nbytesread = recv(acceptsd, buffer, 2*SENDSIZE, 0); - if (nbytesread < 0) - { - message("server: recv failed: %d\n", errno); - goto errout_with_acceptsd; - } - else if (nbytesread == 0) - { - message("server: The client broke the connection\n"); - goto errout_with_acceptsd; - } - message("Received %d bytes\n", nbytesread); - } -#else - /* Receive canned message */ - - totalbytesread = 0; - while (totalbytesread < SENDSIZE) - { - message("server: Reading...\n"); - nbytesread = recv(acceptsd, &buffer[totalbytesread], 2*SENDSIZE - totalbytesread, 0); - if (nbytesread < 0) - { - message("server: recv failed: %d\n", errno); - goto errout_with_acceptsd; - } - else if (nbytesread == 0) - { - message("server: The client broke the connection\n"); - goto errout_with_acceptsd; - } - - totalbytesread += nbytesread; - message("server: Received %d of %d bytes\n", totalbytesread, SENDSIZE); - } - - /* Verify the message */ - - if (totalbytesread != SENDSIZE) - { - message("server: Received %d / Expected %d bytes\n", totalbytesread, SENDSIZE); - goto errout_with_acceptsd; - } - - ch = 0x20; - for (i = 0; i < SENDSIZE; i++ ) - { - if (buffer[i] != ch) - { - message("server: Byte %d is %02x / Expected %02x\n", i, buffer[i], ch); - goto errout_with_acceptsd; - } - - if (++ch > 0x7e) - { - ch = 0x20; - } - } - - /* Then send the same data back to the client */ - - message("server: Sending %d bytes\n", totalbytesread); - nbytessent = send(acceptsd, buffer, totalbytesread, 0); - if (nbytessent <= 0) - { - message("server: send failed: %d\n", errno); - goto errout_with_acceptsd; - } - message("server: Sent %d bytes\n", nbytessent); - - /* If this platform only does abortive disconnects, then wait a bit to get the - * client side a change to receive the data. - */ - -#if 1 /* Do it for all platforms */ - message("server: Wait before closing\n"); - sleep(60); -#endif - - close(listensd); - close(acceptsd); - free(buffer); - return; -#endif - -errout_with_acceptsd: - close(acceptsd); - -errout_with_listensd: - close(listensd); - -errout_with_buffer: - free(buffer); - exit(1); -} diff --git a/apps/examples/nsh/Makefile b/apps/examples/nsh/Makefile index c7d212fc2..bad40fb2e 100644 --- a/apps/examples/nsh/Makefile +++ b/apps/examples/nsh/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/nsh/Makefile # -# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/null/Makefile b/apps/examples/null/Makefile index 47ec4cdaf..634120600 100644 --- a/apps/examples/null/Makefile +++ b/apps/examples/null/Makefile @@ -1,7 +1,7 @@ ############################################################################ # examples/null/Makefile # -# Copyright (C) 2007-2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/nx/Kconfig b/apps/examples/nx/Kconfig deleted file mode 100644 index 2081b12dc..000000000 --- a/apps/examples/nx/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_NX - bool "NX graphics example" - default n - ---help--- - Enable the NX graphics example - -if EXAMPLES_NX -endif diff --git a/apps/examples/nx/Makefile b/apps/examples/nx/Makefile deleted file mode 100644 index ad2bee84e..000000000 --- a/apps/examples/nx/Makefile +++ /dev/null @@ -1,111 +0,0 @@ -############################################################################ -# apps/examples/nx/Makefile -# -# Copyright (C) 2009-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# NuttX NX Graphics Example. - -ASRCS = -CSRCS = nx_main.c nx_events.c nx_kbdin.c -ifeq ($(CONFIG_NX_MULTIUSER),y) -CSRCS += nx_server.c -endif - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# NX built-in application info - -APPNAME = nx -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_EXAMPLES_NX_BUILTIN),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/nx/nx_events.c b/apps/examples/nx/nx_events.c deleted file mode 100644 index 329e5c533..000000000 --- a/apps/examples/nx/nx_events.c +++ /dev/null @@ -1,337 +0,0 @@ -/**************************************************************************** - * examples/nx/nx_events.c - * - * Copyright (C) 2008-2009 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 <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <semaphore.h> -#include <debug.h> -#include <errno.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxtk.h> -#include "nx_internal.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static void nxeg_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool morem, FAR void *arg); -static void nxeg_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg); -#ifdef CONFIG_NX_MOUSE -static void nxeg_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg); -#endif - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -static void nxeg_tbredraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool morem, FAR void *arg); -static void nxeg_tbposition(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg); -#ifdef CONFIG_NX_MOUSE -static void nxeg_tbmousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg); -#endif -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -const struct nx_callback_s g_nxcb = -{ - nxeg_redraw, /* redraw */ - nxeg_position /* position */ -#ifdef CONFIG_NX_MOUSE - , nxeg_mousein /* mousein */ -#endif -#ifdef CONFIG_NX_KBD - , nxeg_kbdin /* my kbdin */ -#endif -}; - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -const struct nx_callback_s g_tbcb = -{ - nxeg_tbredraw, /* redraw */ - nxeg_tbposition /* position */ -#ifdef CONFIG_NX_MOUSE - , nxeg_tbmousein /* mousein */ -#endif -#ifdef CONFIG_NX_KBD - , nxeg_tbkbdin /* my kbdin */ -#endif -}; -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxeg_fillwindow - ****************************************************************************/ - -static inline void nxeg_fillwindow(NXEGWINDOW hwnd, - FAR const struct nxgl_rect_s *rect, - FAR struct nxeg_state_s *st) -{ - int ret; - -#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS - ret = nx_fill(hwnd, rect, st->color); - if (ret < 0) - { - message("nxeg_fillwindow: nx_fill failed: %d\n", errno); - } -#else - ret = nxtk_fillwindow(hwnd, rect, st->color); - if (ret < 0) - { - message("nxeg_fillwindow: nxtk_fillwindow failed: %d\n", errno); - } -#endif -#ifdef CONFIG_NX_KBD - nxeg_filltext(hwnd, rect, st); -#endif -} - -/**************************************************************************** - * Name: nxeg_fillwindow - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -static inline void nxeg_filltoolbar(NXTKWINDOW htb, - FAR const struct nxgl_rect_s *rect, - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]) -{ - int ret; - - ret = nxtk_filltoolbar(htb, rect, color); - if (ret < 0) - { - message("nxeg_filltoolbar: nxtk_filltoolbar failed: %d\n", errno); - } -} -#endif - -/**************************************************************************** - * Name: nxeg_redraw - ****************************************************************************/ - -static void nxeg_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg) -{ - FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; - message("nxeg_redraw%d: hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", - st->wnum, hwnd, - rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, - more ? "true" : "false"); - - nxeg_fillwindow(hwnd, rect, st); -} - -/**************************************************************************** - * Name: nxeg_position - ****************************************************************************/ - -static void nxeg_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg) -{ - FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; - - /* Report the position */ - - message("nxeg_position%d: hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", - st->wnum, hwnd, size->w, size->h, pos->x, pos->y, - bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); - - /* Have we picked off the window bounds yet? */ - - if (!b_haveresolution) - { - /* Save the window limits (these should be the same for all places and all windows */ - - g_xres = bounds->pt2.x; - g_yres = bounds->pt2.y; - - b_haveresolution = true; - sem_post(&g_semevent); - message("nxeg_position2: Have xres=%d yres=%d\n", g_xres, g_yres); - } -} - -/**************************************************************************** - * Name: nxeg_mousein - ****************************************************************************/ - -#ifdef CONFIG_NX_MOUSE -static void nxeg_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg) -{ - FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; - message("nxeg_mousein%d: hwnd=%p pos=(%d,%d) button=%02x\n", - st->wnum, hwnd, pos->x, pos->y, buttons); -} -#endif - -/**************************************************************************** - * Name: nxeg_tbredraw - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -static void nxeg_tbredraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg) -{ - FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; - message("nxeg_tbredraw%d: hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", - st->wnum, hwnd, - rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, - more ? "true" : "false"); - nxeg_filltoolbar(hwnd, rect, g_tbcolor); -} -#endif - -/**************************************************************************** - * Name: nxeg_position - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -static void nxeg_tbposition(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg) -{ - FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; - - /* Report the position */ - - message("nxeg_ptbosition%d: hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", - st->wnum, hwnd, size->w, size->h, pos->x, pos->y, - bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); -} -#endif - -/**************************************************************************** - * Name: nxeg_tbmousein - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -#ifdef CONFIG_NX_MOUSE -static void nxeg_tbmousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg) -{ - FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; - - message("nxeg_tbmousein%d: hwnd=%p pos=(%d,%d) button=%02x\n", - st->wnum, hwnd, pos->x, pos->y, buttons); -} -#endif -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nx_listenerthread - ****************************************************************************/ - -#ifdef CONFIG_NX_MULTIUSER -FAR void *nx_listenerthread(FAR void *arg) -{ - int ret; - - /* Process events forever */ - - for (;;) - { - /* Handle the next event. If we were configured blocking, then - * we will stay right here until the next event is received. Since - * we have dedicated a while thread to servicing events, it would - * be most natural to also select CONFIG_NX_BLOCKING -- if not, the - * following would be a tight infinite loop (unless we added addition - * logic with nx_eventnotify and sigwait to pace it). - */ - - ret = nx_eventhandler(g_hnx); - if (ret < 0) - { - /* An error occurred... assume that we have lost connection with - * the server. - */ - - message("nx_listenerthread: Lost server connection: %d\n", errno); - exit(NXEXIT_LOSTSERVERCONN); - } - - /* If we received a message, we must be connected */ - - if (!g_connected) - { - g_connected = true; - sem_post(&g_semevent); - message("nx_listenerthread: Connected\n"); - } - } -} -#endif diff --git a/apps/examples/nx/nx_internal.h b/apps/examples/nx/nx_internal.h deleted file mode 100644 index d9a6a2ade..000000000 --- a/apps/examples/nx/nx_internal.h +++ /dev/null @@ -1,317 +0,0 @@ -/**************************************************************************** - * examples/nx/nx_internal.h - * - * Copyright (C) 2008-2011 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 __EXAMPLES_NX_NX_INTERNAL_H -#define __EXAMPLES_NX_NX_INTERNAL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <stdbool.h> -#include <semaphore.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxtk.h> -#include <nuttx/nx/nxfonts.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_NX -# error "NX is not enabled (CONFIG_NX)" -#endif - -#ifndef CONFIG_EXAMPLES_NX_VPLANE -# define CONFIG_EXAMPLES_NX_VPLANE 0 -#endif - -#ifndef CONFIG_EXAMPLES_NX_BPP -# define CONFIG_EXAMPLES_NX_BPP 32 -#endif - -#ifndef CONFIG_EXAMPLES_NX_BGCOLOR -# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 -# define CONFIG_EXAMPLES_NX_BGCOLOR 0x007b68ee -# elif CONFIG_EXAMPLES_NX_BPP == 16 -# define CONFIG_EXAMPLES_NX_BGCOLOR 0x7b5d -# else -# define CONFIG_EXAMPLES_NX_BGCOLOR ' ' -# endif -#endif - -#ifndef CONFIG_EXAMPLES_NX_COLOR1 -# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 -# define CONFIG_EXAMPLES_NX_COLOR1 0x00e6e6fa -# elif CONFIG_EXAMPLES_NX_BPP == 16 -# define CONFIG_EXAMPLES_NX_COLOR1 0xe73f -# else -# define CONFIG_EXAMPLES_NX_COLOR1 '1' -# endif -#endif - -#ifndef CONFIG_EXAMPLES_NX_COLOR2 -# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 -# define CONFIG_EXAMPLES_NX_COLOR2 0x00dcdcdc -# elif CONFIG_EXAMPLES_NX_BPP == 16 -# define CONFIG_EXAMPLES_NX_COLOR2 0xdefb -# else -# define CONFIG_EXAMPLES_NX_COLOR2 '2' -# endif -#endif - -#ifndef CONFIG_EXAMPLES_NX_TBCOLOR -# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 -# define CONFIG_EXAMPLES_NX_TBCOLOR 0x00a9a9a9 -# elif CONFIG_EXAMPLES_NX_BPP == 16 -# define CONFIG_EXAMPLES_NX_TBCOLOR 0xad55 -# else -# define CONFIG_EXAMPLES_NX_TBCOLOR 'T' -# endif -#endif - -#ifndef CONFIG_EXAMPLES_NX_FONTID -# define CONFIG_EXAMPLES_NX_FONTID NXFONT_DEFAULT -#endif - -#ifndef CONFIG_EXAMPLES_NX_FONTCOLOR -# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 -# define CONFIG_EXAMPLES_NX_FONTCOLOR 0x00000000 -# elif CONFIG_EXAMPLES_NX_BPP == 16 -# define CONFIG_EXAMPLES_NX_FONTCOLOR 0x0000 -# else -# define CONFIG_EXAMPLES_NX_FONTCOLOR 'F' -# endif -#endif - -#ifndef CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT -# define CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT 16 -#endif - -#ifdef CONFIG_NX_MULTIUSER -# ifdef CONFIG_DISABLE_MQUEUE -# error "The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)" -# endif -# ifdef CONFIG_DISABLE_SIGNALS -# error "This example requires signal support (CONFIG_DISABLE_SIGNALS=n)" -# endif -# ifdef CONFIG_DISABLE_PTHREAD -# error "This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)" -# endif -# ifndef CONFIG_NX_BLOCKING -# error "This example depends on CONFIG_NX_BLOCKING" -# endif -# ifndef CONFIG_EXAMPLES_NX_STACKSIZE -# define CONFIG_EXAMPLES_NX_STACKSIZE 2048 -# endif -# ifndef CONFIG_EXAMPLES_NX_LISTENERPRIO -# define CONFIG_EXAMPLES_NX_LISTENERPRIO 100 -# endif -# ifndef CONFIG_EXAMPLES_NX_CLIENTPRIO -# define CONFIG_EXAMPLES_NX_CLIENTPRIO 100 -# endif -# ifndef CONFIG_EXAMPLES_NX_SERVERPRIO -# define CONFIG_EXAMPLES_NX_SERVERPRIO 120 -# endif -# ifndef CONFIG_EXAMPLES_NX_NOTIFYSIGNO -# define CONFIG_EXAMPLES_NX_NOTIFYSIGNO 4 -# endif -#endif - -#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS -# define NXEGWINDOW NXWINDOW -#else -# define NXEGWINDOW NXTKWINDOW -#endif - -#define NXTK_MAXKBDCHARS 16 - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# define msgflush() -# else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define msgflush() -# else -# define message printf -# define msgflush() fflush(stdout) -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -enum exitcode_e -{ - NXEXIT_SUCCESS = 0, - NXEXIT_SIGPROCMASK, - NXEXIT_SCHEDSETPARAM, - NXEXIT_EVENTNOTIFY, - NXEXIT_TASKCREATE, - NXEXIT_PTHREADCREATE, - NXEXIT_EXTINITIALIZE, - NXEXIT_FBINITIALIZE, - NXEXIT_FBGETVPLANE, - NXEXIT_LCDINITIALIZE, - NXEXIT_LCDGETDEV, - NXEXIT_NXOPEN, - NXEXIT_FONTOPEN, - NXEXIT_NXOPENTOOLBAR, - NXEXIT_NXCONNECT, - NXEXIT_NXSETBGCOLOR, - NXEXIT_NXOPENWINDOW, - NXEXIT_NXSETSIZE, - NXEXIT_NXSETPOSITION, - NXEXIT_NXLOWER, - NXEXIT_NXRAISE, - NXEXIT_NXCLOSEWINDOW, - NXEXIT_LOSTSERVERCONN -}; - -/* Describes one cached glyph bitmap */ - -struct nxeg_glyph_s -{ - uint8_t code; /* Character code */ - uint8_t height; /* Height of this glyph (in rows) */ - uint8_t width; /* Width of this glyph (in pixels) */ - uint8_t stride; /* Width of the glyph row (in bytes) */ - FAR uint8_t *bitmap; /* Allocated bitmap memory */ -}; - -/* Describes on character on the display */ - -struct nxeg_bitmap_s -{ - struct nxgl_rect_s bounds; /* Size/position of bitmap */ - FAR const struct nxeg_glyph_s *glyph; /* The cached glyph */ -}; - -/* Describes the overall state of on one window */ - -struct nxeg_state_s -{ - uint8_t wnum; /* Window number */ - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Window color */ - -#ifdef CONFIG_NX_KBD - uint8_t height; /* Max height of a font in pixels */ - uint8_t width; /* Max width of a font in pixels */ - uint8_t spwidth; /* The width of a space */ - - uint8_t nchars; /* Number of KBD chars received */ - uint8_t nglyphs; /* Number of glyphs cached */ - - struct nxeg_bitmap_s bm[NXTK_MAXKBDCHARS]; - struct nxeg_glyph_s glyph[NXTK_MAXKBDCHARS]; -#endif -}; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/* The connecton handle */ - -extern NXHANDLE g_hnx; - -/* NX callback vtables */ - -extern const struct nx_callback_s g_nxcb; -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -extern const struct nx_callback_s g_tbcb; -#endif - -/* The font handle */ - -extern NXHANDLE g_fonthandle; - -/* The screen resolution */ - -extern nxgl_coord_t g_xres; -extern nxgl_coord_t g_yres; - -extern bool b_haveresolution; -#ifdef CONFIG_NX_MULTIUSER -extern bool g_connected; -#endif -extern sem_t g_semevent; - -/* Colors used to fill window 1 & 2 */ - -extern nxgl_mxpixel_t g_color1[CONFIG_NX_NPLANES]; -extern nxgl_mxpixel_t g_color2[CONFIG_NX_NPLANES]; -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -extern nxgl_mxpixel_t g_tbcolor[CONFIG_NX_NPLANES]; -#endif - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NX_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif - -#if defined(CONFIG_NX) && defined(CONFIG_NX_MULTIUSER) -extern int nx_servertask(int argc, char *argv[]); -extern FAR void *nx_listenerthread(FAR void *arg); -#endif - -#ifdef CONFIG_NX_KBD -extern void nxeg_kbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg); -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -extern void nxeg_tbkbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg); -#endif -extern void nxeg_filltext(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - FAR struct nxeg_state_s *st); -#endif - -#endif /* __EXAMPLES_NX_NX_INTERNAL_H */ diff --git a/apps/examples/nx/nx_kbdin.c b/apps/examples/nx/nx_kbdin.c deleted file mode 100644 index df4a0faa1..000000000 --- a/apps/examples/nx/nx_kbdin.c +++ /dev/null @@ -1,467 +0,0 @@ -/**************************************************************************** - * examples/nx/nx_kbdin.c - * - * Copyright (C) 2008, 2010-2011 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 <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <ctype.h> -#include <debug.h> -#include <errno.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxtk.h> -#include <nuttx/nx/nxfonts.h> - -#include "nx_internal.h" - -#ifdef CONFIG_NX_KBD - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Select renderer -- Some additional logic would be required to support - * pixel depths that are not directly addressable (1,2,4, and 24). - */ - -#if CONFIG_EXAMPLES_NX_BPP == 1 -# define RENDERER nxf_convert_1bpp -#elif CONFIG_EXAMPLES_NX_BPP == 2 -# define RENDERER nxf_convert_2bpp -#elif CONFIG_EXAMPLES_NX_BPP == 4 -# define RENDERER nxf_convert_4bpp -#elif CONFIG_EXAMPLES_NX_BPP == 8 -# define RENDERER nxf_convert_8bpp -#elif CONFIG_EXAMPLES_NX_BPP == 16 -# define RENDERER nxf_convert_16bpp -#elif CONFIG_EXAMPLES_NX_BPP == 24 -# define RENDERER nxf_convert_24bpp -#elif CONFIG_EXAMPLES_NX_BPP == 32 -# define RENDERER nxf_convert_32bpp -#else -# error "Unsupported CONFIG_EXAMPLES_NX_BPP" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxeg_fillchar - ****************************************************************************/ - -static void nxeg_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - FAR const struct nxeg_bitmap_s *bm) -{ - FAR void *src = (FAR void *)bm->glyph->bitmap; - struct nxgl_rect_s intersection; - int ret; - - /* Handle the special case of spaces which have no glyph bitmap */ - - if (src) - { - /* Get the intersection of the redraw region and the character bitmap */ - - nxgl_rectintersect(&intersection, rect, &bm->bounds); - if (!nxgl_nullrect(&intersection)) - { -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS - ret = nxtk_bitmapwindow((NXTKWINDOW)hwnd, &intersection, (FAR const void **)&src, - &bm->bounds.pt1, - (unsigned int)bm->glyph->stride); - if (ret < 0) - { - message("nxeg_fillchar: nxtk_bitmapwindow failed: %d\n", errno); - } -#else - ret = nx_bitmap((NXWINDOW)hwnd, &intersection, &src, - &bm->bounds.pt1, - (unsigned int)bm->glyph->stride); - if (ret < 0) - { - message("nxeg_fillchar: nx_bitmapwindow failed: %d\n", errno); - } -#endif - } - } -} - -/**************************************************************************** - * Name: nxeg_renderglyph - ****************************************************************************/ - -static inline FAR const struct nxeg_glyph_s * -nxeg_renderglyph(FAR struct nxeg_state_s *st, - FAR const struct nx_fontbitmap_s *bm, uint8_t ch) -{ - FAR struct nxeg_glyph_s *glyph = NULL; - FAR nxgl_mxpixel_t *ptr; -#if CONFIG_EXAMPLES_NX_BPP < 8 - nxgl_mxpixel_t pixel; -#endif - int bmsize; - int row; - int col; - int ret; - - /* Make sure that there is room for another glyph */ - - message("nxeg_renderglyph: ch=%02x\n", ch); - if (st->nglyphs < NXTK_MAXKBDCHARS) - { - /* Allocate the glyph */ - - glyph = &st->glyph[st->nglyphs]; - glyph->code = ch; - - /* Get the dimensions of the glyph */ - - glyph->width = bm->metric.width + bm->metric.xoffset; - glyph->height = bm->metric.height + bm->metric.yoffset; - - /* Allocate memory to hold the glyph with its offsets */ - - glyph->stride = (glyph->width * CONFIG_EXAMPLES_NX_BPP + 7) / 8; - bmsize = glyph->stride * glyph->height; - glyph->bitmap = (FAR uint8_t *)malloc(bmsize); - - if (glyph->bitmap) - { - /* Initialize the glyph memory to the background color */ - -#if CONFIG_EXAMPLES_NX_BPP < 8 - pixel = st->color[0]; -# if CONFIG_EXAMPLES_NX_BPP == 1 - /* Pack 1-bit pixels into a 2-bits */ - - pixel &= 0x01; - pixel = (pixel) << 1 |pixel; -# endif -# if CONFIG_EXAMPLES_NX_BPP < 4 - /* Pack 2-bit pixels into a nibble */ - - pixel &= 0x03; - pixel = (pixel) << 2 |pixel; -# endif - - /* Pack 4-bit nibbles into a byte */ - - pixel &= 0x0f; - pixel = (pixel) << 4 | pixel; - - ptr = (FAR nxgl_mxpixel_t *)glyph->bitmap; - for (row = 0; row < glyph->height; row++) - { - for (col = 0; col < glyph->stride; col++) - { - /* Transfer the packed bytes into the buffer */ - - *ptr++ = pixel; - } - } - -#elif CONFIG_EXAMPLES_NX_BPP == 24 -# error "Additional logic is needed here for 24bpp support" - -#else /* CONFIG_EXAMPLES_NX_BPP = {8,16,32} */ - - ptr = (FAR nxgl_mxpixel_t *)glyph->bitmap; - for (row = 0; row < glyph->height; row++) - { - /* Just copy the color value into the glyph memory */ - - for (col = 0; col < glyph->width; col++) - { - *ptr++ = st->color[0]; - } - } -#endif - - /* Then render the glyph into the allocated memory */ - - ret = RENDERER((FAR nxgl_mxpixel_t*)glyph->bitmap, - glyph->height, glyph->width, glyph->stride, - bm, CONFIG_EXAMPLES_NX_FONTCOLOR); - if (ret < 0) - { - /* Actually, the RENDERER never returns a failure */ - - message("nxeg_renderglyph: RENDERER failed\n"); - free(glyph->bitmap); - glyph->bitmap = NULL; - glyph = NULL; - } - else - { - /* Make it permanent */ - - st->nglyphs++; - } - } - } - - return glyph; -} - -/**************************************************************************** - * Name: nxeg_addspace - ****************************************************************************/ - -static inline FAR const struct nxeg_glyph_s * -nxeg_addspace(FAR struct nxeg_state_s *st, uint8_t ch) -{ - FAR struct nxeg_glyph_s *glyph = NULL; - - /* Make sure that there is room for another glyph */ - - if (st->nglyphs < NXTK_MAXKBDCHARS) - { - /* Allocate the NULL glyph */ - - glyph = &st->glyph[st->nglyphs]; - memset(glyph, 0, sizeof(struct nxeg_glyph_s)); - - glyph->code = ' '; - glyph->width = st->spwidth; - - st->nglyphs++; - } - return glyph; -} - -/**************************************************************************** - * Name: nxeg_findglyph - ****************************************************************************/ - -static FAR const struct nxeg_glyph_s * -nxeg_findglyph(FAR struct nxeg_state_s *st, uint8_t ch) -{ - int i; - - /* First, try to find the glyph in the cache of pre-rendered glyphs */ - - for (i = 0; i < st->nglyphs; i++) - { - if (st->glyph[i].code == ch) - { - return &st->glyph[i]; - } - } - return NULL; -} - -/**************************************************************************** - * Name: nxeg_getglyph - ****************************************************************************/ - -static FAR const struct nxeg_glyph_s * -nxeg_getglyph(FAR struct nxeg_state_s *st, uint8_t ch) -{ - FAR const struct nxeg_glyph_s *glyph; - FAR const struct nx_fontbitmap_s *bm; - - /* First, try to find the glyph in the cache of pre-rendered glyphs */ - - glyph = nxeg_findglyph(st, ch); - if (!glyph) - { - /* No, it is not cached... Does the code map to a glyph? */ - - bm = nxf_getbitmap(g_fonthandle, ch); - if (!bm) - { - /* No, there is no glyph for this code. Use space */ - - glyph = nxeg_findglyph(st, ' '); - if (!glyph) - { - /* There isn't fake glyph for ' ' yet... create one */ - - glyph = nxeg_addspace(st, ' '); - } - } - else - { - glyph = nxeg_renderglyph(st, bm, ch); - } - } - return glyph; -} - -/**************************************************************************** - * Name: nxeg_addchar - ****************************************************************************/ - -static FAR const struct nxeg_bitmap_s * -nxeg_addchar(FAR struct nxeg_state_s *st, uint8_t ch) -{ - FAR struct nxeg_bitmap_s *bm = NULL; - FAR struct nxeg_bitmap_s *bmleft; - nxgl_coord_t leftx; - - /* Is there space for another character on the display? */ - - if (st->nchars < NXTK_MAXKBDCHARS) - { - /* Yes, setup the bitmap */ - - bm = &st->bm[st->nchars]; - - /* Find the matching glyph */ - - bm->glyph = nxeg_getglyph(st, ch); - if (!bm->glyph) - { - return NULL; - } - - /* Set up the bounds for the bitmap */ - - if (st->nchars <= 0) - { - /* The first character is one space from the left */ - - leftx = st->spwidth; - } - else - { - /* Otherwise, it is to the left of the preceding char */ - - bmleft = &st->bm[st->nchars-1]; - leftx = bmleft->bounds.pt2.x + 1; - } - - bm->bounds.pt1.x = leftx; - bm->bounds.pt1.y = 2; - bm->bounds.pt2.x = leftx + bm->glyph->width - 1; - bm->bounds.pt2.y = 2 + bm->glyph->height - 1; - - st->nchars++; - } - return bm; -} - -/**************************************************************************** - * Name: nxeg_addchars - ****************************************************************************/ - -static inline void nxeg_addchars(NXWINDOW hwnd, FAR struct nxeg_state_s *st, - uint8_t nch, FAR const uint8_t *ch) -{ - FAR const struct nxeg_bitmap_s *bm; - - while (nch--) - { - bm = nxeg_addchar(st, *ch++); - if (bm) - { - nxeg_fillchar(hwnd, &bm->bounds, bm); - } - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxeg_kbdin - ****************************************************************************/ - -void nxeg_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg) -{ - FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; - message("nxeg_kbdin%d: hwnd=%p nch=%d\n", st->wnum, hwnd, nch); - nxeg_addchars(hwnd, st, nch, ch); -} - -/**************************************************************************** - * Name: nxeg_tbkbdin - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -void nxeg_tbkbdin(NXWINDOW hwnd, uint8_t nch, const uint8_t *ch, FAR void *arg) -{ - FAR struct nxeg_state_s *st = (FAR struct nxeg_state_s *)arg; - message("nxeg_tbkbdin: ERROR -- toolbar should not received keyboard input\n"); - message("nxeg_tbkbdin%d: hwnd=%p nch=%d\n", st->wnum, hwnd, nch); -} -#endif - -/**************************************************************************** - * Name: nxeg_filltext - ****************************************************************************/ - -void nxeg_filltext(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - FAR struct nxeg_state_s *st) -{ - int i; - - /* Fill each character on the display (Only the characters within rect - * will actually be redrawn). - */ - - for (i = 0; i < st->nchars; i++) - { - nxeg_fillchar(hwnd, rect, &st->bm[i]); - } -} - -#endif /* CONFIG_NX_KBD */ diff --git a/apps/examples/nx/nx_main.c b/apps/examples/nx/nx_main.c deleted file mode 100644 index 04fc10e28..000000000 --- a/apps/examples/nx/nx_main.c +++ /dev/null @@ -1,900 +0,0 @@ -/**************************************************************************** - * examples/nx/nx_main.c - * - * Copyright (C) 2008-2011 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 <stdint.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sched.h> -#include <pthread.h> -#include <errno.h> -#include <debug.h> - -#ifdef CONFIG_NX_LCDDRIVER -# include <nuttx/lcd/lcd.h> -#else -# include <nuttx/fb.h> -#endif - -#include <nuttx/arch.h> -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxtk.h> -#include <nuttx/nx/nxfonts.h> - -#include "nx_internal.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ -/* If not specified, assume that the hardware supports one video plane */ - -#ifndef CONFIG_EXAMPLES_NX_VPLANE -# define CONFIG_EXAMPLES_NX_VPLANE 0 -#endif - -/* If not specified, assume that the hardware supports one LCD device */ - -#ifndef CONFIG_EXAMPLES_NX_DEVNO -# define CONFIG_EXAMPLES_NX_DEVNO 0 -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static int g_exitcode = NXEXIT_SUCCESS; - -static struct nxeg_state_s g_wstate[2]; - -#ifdef CONFIG_NX_KBD -static const uint8_t g_kbdmsg1[] = "NuttX is cool!"; -static const uint8_t g_kbdmsg2[] = "NuttX is fun!"; -#endif - -/* The font handle */ - -NXHANDLE g_fonthandle; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* The connecton handler */ - -NXHANDLE g_hnx = NULL; - -/* The screen resolution */ - -nxgl_coord_t g_xres; -nxgl_coord_t g_yres; - -bool b_haveresolution = false; -#ifdef CONFIG_NX_MULTIUSER -bool g_connected = false; -#endif -sem_t g_semevent = {0}; - -/* Colors used to fill window 1 & 2 */ - -nxgl_mxpixel_t g_color1[CONFIG_NX_NPLANES]; -nxgl_mxpixel_t g_color2[CONFIG_NX_NPLANES]; -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -nxgl_mxpixel_t g_tbcolor[CONFIG_NX_NPLANES]; -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxeg_drivemouse - ****************************************************************************/ - -#ifdef CONFIG_NX_MOUSE -static void nxeg_drivemouse(void) -{ - nxgl_coord_t x; - nxgl_coord_t y; - nxgl_coord_t xstep = g_xres / 8; - nxgl_coord_t ystep = g_yres / 8; - - for (x = 0; x < g_xres; x += xstep) - { - for (y = 0; y < g_yres; y += ystep) - { - message("nxeg_drivemouse: Mouse left button at (%d,%d)\n", x, y); - (void)nx_mousein(g_hnx, x, y, NX_MOUSE_LEFTBUTTON); - } - } -} -#endif - -/**************************************************************************** - * Name: nxeg_initstate - ****************************************************************************/ - -static void nxeg_initstate(FAR struct nxeg_state_s *st, int wnum, - nxgl_mxpixel_t color) -{ -#ifdef CONFIG_NX_KBD - FAR const struct nx_font_s *fontset; -#endif - - /* Initialize the window number (used for debug output only) and color - * (used for redrawing the window) - */ - - st->wnum = wnum; - st->color[0] = color; - - /* Get information about the font set being used and save this in the - * state structure - */ - -#ifdef CONFIG_NX_KBD - fontset = nxf_getfontset(g_fonthandle); - st->nchars = 0; - st->nglyphs = 0; - st->height = fontset->mxheight; - st->width = fontset->mxwidth; - st->spwidth = fontset->spwidth; -#endif -} - -/**************************************************************************** - * Name: nxeg_freestate - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -static void nxeg_freestate(FAR struct nxeg_state_s *st) -{ -#ifdef CONFIG_NX_KBD - int i; - - if (st) - { - for (i = 0; i < st->nglyphs; i++) - { - if (st->glyph[i].bitmap) - { - free(st->glyph[i].bitmap); - } - st->glyph[i].bitmap = NULL; - } - st->nchars = 0; - } -#endif -} -#endif - -/**************************************************************************** - * Name: nxeg_openwindow - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS -static inline NXEGWINDOW nxeg_openwindow(FAR const struct nx_callback_s *cb, - FAR struct nxeg_state_s *state) -{ - NXEGWINDOW hwnd; - - hwnd = nx_openwindow(g_hnx, cb, (FAR void *)state); - if (!hwnd) - { - message("nxeg_openwindow: nx_openwindow failed: %d\n", errno); - g_exitcode = NXEXIT_NXOPENWINDOW; - } - return hwnd; -} -#else -static inline NXEGWINDOW nxeg_openwindow(FAR const struct nx_callback_s *cb, - FAR struct nxeg_state_s *state) -{ - NXEGWINDOW hwnd; - - hwnd = nxtk_openwindow(g_hnx, cb, (FAR void *)state); - if (!hwnd) - { - message("nxeg_openwindow: nxtk_openwindow failed: %d\n", errno); - g_exitcode = NXEXIT_NXOPENWINDOW; - } - return hwnd; -} -#endif - -/**************************************************************************** - * Name: nxeg_closewindow - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS -static inline int nxeg_closewindow(NXEGWINDOW hwnd, FAR struct nxeg_state_s *state) -{ - int ret = nx_closewindow(hwnd); - if (ret < 0) - { - message("nxeg_closewindow: nx_closewindow failed: %d\n", errno); - g_exitcode = NXEXIT_NXCLOSEWINDOW; - } - return ret; -} -#else -static inline int nxeg_closewindow(NXEGWINDOW hwnd, FAR struct nxeg_state_s *state) -{ - int ret = nxtk_closewindow(hwnd); - if (ret < 0) - { - message("nxeg_closewindow: nxtk_closewindow failed: %d\n", errno); - g_exitcode = NXEXIT_NXCLOSEWINDOW; - } - nxeg_freestate(state); - return ret; -} -#endif - -/**************************************************************************** - * Name: nxeg_setsize - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS -static inline int nxeg_setsize(NXEGWINDOW hwnd, FAR struct nxgl_size_s *size) -{ - int ret = nx_setsize(hwnd, size); - if (ret < 0) - { - message("nxeg_setsize: nx_setsize failed: %d\n", errno); - g_exitcode = NXEXIT_NXSETSIZE; - } - return ret; -} -#else -static inline int nxeg_setsize(NXEGWINDOW hwnd, FAR struct nxgl_size_s *size) -{ - int ret = nxtk_setsize(hwnd, size); - if (ret < 0) - { - message("nxeg_setsize: nxtk_setsize failed: %d\n", errno); - g_exitcode = NXEXIT_NXSETSIZE; - } - return ret; -} -#endif - -/**************************************************************************** - * Name: nxeg_setposition - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS -static inline int nxeg_setposition(NXEGWINDOW hwnd, FAR struct nxgl_point_s *pos) -{ - int ret = nx_setposition(hwnd, pos); - if (ret < 0) - { - message("nxeg_setposition: nx_setposition failed: %d\n", errno); - g_exitcode = NXEXIT_NXSETPOSITION; - } - return ret; -} -#else -static inline int nxeg_setposition(NXEGWINDOW hwnd, FAR struct nxgl_point_s *pos) -{ - int ret = nxtk_setposition(hwnd, pos); - if (ret < 0) - { - message("nxeg_setposition: nxtk_setposition failed: %d\n", errno); - g_exitcode = NXEXIT_NXSETPOSITION; - } - return ret; -} -#endif - -/**************************************************************************** - * Name: nxeq_opentoolbar - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS -static inline int nxeq_opentoolbar(NXEGWINDOW hwnd, nxgl_coord_t height, - FAR const struct nx_callback_s *cb, - FAR struct nxeg_state_s *state) -{ - int ret; - ret = nxtk_opentoolbar(hwnd, height, cb, (FAR void *)state); - if (ret < 0) - { - message("nxeq_opentoolbar: nxtk_opentoolbar failed: %d\n", errno); - g_exitcode = NXEXIT_NXOPENTOOLBAR; - } - return ret; -} -#endif - -/**************************************************************************** - * Name: nxeg_lower - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS -static inline int nxeg_lower(NXEGWINDOW hwnd) -{ - int ret = nx_lower(hwnd); - if (ret < 0) - { - message("nxeg_lower: nx_lower failed: %d\n", errno); - g_exitcode = NXEXIT_NXLOWER; - } - return ret; -} -#else -static inline int nxeg_lower(NXEGWINDOW hwnd) -{ - int ret = nxtk_lower(hwnd); - if (ret < 0) - { - message("nxeg_lower: nxtk_lower failed: %d\n", errno); - g_exitcode = NXEXIT_NXLOWER; - } - return ret; -} -#endif - -/**************************************************************************** - * Name: nxeg_raise - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NX_RAWWINDOWS -static inline int nxeg_raise(NXEGWINDOW hwnd) -{ - int ret = nx_raise(hwnd); - if (ret < 0) - { - message("nxeg_raise: nx_raise failed: %d\n", errno); - g_exitcode = NXEXIT_NXRAISE; - } - return ret; -} -#else -static inline int nxeg_raise(NXEGWINDOW hwnd) -{ - int ret = nxtk_raise(hwnd); - if (ret < 0) - { - message("nxeg_raise: nxtk_raise failed: %d\n", errno); - g_exitcode = NXEXIT_NXRAISE; - } - return ret; -} -#endif - -/**************************************************************************** - * Name: nxeg_suinitialize - ****************************************************************************/ - -#ifndef CONFIG_NX_MULTIUSER -static inline int nxeg_suinitialize(void) -{ - FAR NX_DRIVERTYPE *dev; - -#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT) - /* Use external graphics driver initialization */ - - message("nxeg_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NX_DEVNO); - if (!dev) - { - message("nxeg_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); - g_exitcode = NXEXIT_EXTINITIALIZE; - return ERROR; - } - -#elif defined(CONFIG_NX_LCDDRIVER) - int ret; - - /* Initialize the LCD device */ - - message("nxeg_initialize: Initializing LCD\n"); - ret = up_lcdinitialize(); - if (ret < 0) - { - message("nxeg_initialize: up_lcdinitialize failed: %d\n", -ret); - g_exitcode = NXEXIT_LCDINITIALIZE; - return ERROR; - } - - /* Get the device instance */ - - dev = up_lcdgetdev(CONFIG_EXAMPLES_NX_DEVNO); - if (!dev) - { - message("nxeg_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); - g_exitcode = NXEXIT_LCDGETDEV; - return ERROR; - } - - /* Turn the LCD on at 75% power */ - - (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); -#else - int ret; - - /* Initialize the frame buffer device */ - - message("nxeg_initialize: Initializing framebuffer\n"); - ret = up_fbinitialize(); - if (ret < 0) - { - message("nxeg_initialize: up_fbinitialize failed: %d\n", -ret); - g_exitcode = NXEXIT_FBINITIALIZE; - return ERROR; - } - - dev = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE); - if (!dev) - { - message("nxeg_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NX_VPLANE); - g_exitcode = NXEXIT_FBGETVPLANE; - return ERROR; - } -#endif - - /* Then open NX */ - - message("nxeg_initialize: Open NX\n"); - g_hnx = nx_open(dev); - if (!g_hnx) - { - message("nxeg_suinitialize: nx_open failed: %d\n", errno); - g_exitcode = NXEXIT_NXOPEN; - return ERROR; - } - return OK; -} -#endif - -/**************************************************************************** - * Name: nxeg_initialize - ****************************************************************************/ - -#ifdef CONFIG_NX_MULTIUSER -static inline int nxeg_muinitialize(void) -{ - struct sched_param param; - pthread_t thread; - pid_t servrid; - int ret; - - /* Set the client task priority */ - - param.sched_priority = CONFIG_EXAMPLES_NX_CLIENTPRIO; - ret = sched_setparam(0, ¶m); - if (ret < 0) - { - message("nxeg_initialize: sched_setparam failed: %d\n" , ret); - g_exitcode = NXEXIT_SCHEDSETPARAM; - return ERROR; - } - - /* Start the server task */ - - message("nxeg_initialize: Starting nx_servertask task\n"); - servrid = task_create("NX Server", CONFIG_EXAMPLES_NX_SERVERPRIO, - CONFIG_EXAMPLES_NX_STACKSIZE, nx_servertask, NULL); - if (servrid < 0) - { - message("nxeg_initialize: Failed to create nx_servertask task: %d\n", errno); - g_exitcode = NXEXIT_TASKCREATE; - return ERROR; - } - - /* Wait a bit to let the server get started */ - - sleep(1); - - /* Connect to the server */ - - g_hnx = nx_connect(); - if (g_hnx) - { - pthread_attr_t attr; - - /* Start a separate thread to listen for server events. This is probably - * the least efficient way to do this, but it makes this example flow more - * smoothly. - */ - - (void)pthread_attr_init(&attr); - param.sched_priority = CONFIG_EXAMPLES_NX_LISTENERPRIO; - (void)pthread_attr_setschedparam(&attr, ¶m); - (void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NX_STACKSIZE); - - ret = pthread_create(&thread, &attr, nx_listenerthread, NULL); - if (ret != 0) - { - printf("nxeg_initialize: pthread_create failed: %d\n", ret); - g_exitcode = NXEXIT_PTHREADCREATE; - return ERROR; - } - - /* Don't return until we are connected to the server */ - - while (!g_connected) - { - /* Wait for the listener thread to wake us up when we really - * are connected. - */ - - (void)sem_wait(&g_semevent); - } - } - else - { - message("nxeg_initialize: nx_connect failed: %d\n", errno); - g_exitcode = NXEXIT_NXCONNECT; - return ERROR; - } - return OK; -} -#endif - -/**************************************************************************** - * Name: nxeg_initialize - ****************************************************************************/ - -static int nxeg_initialize(void) -{ - int i; - - /* Initialize window colors */ - - for (i = 0; i < CONFIG_NX_NPLANES; i++) - { - g_color1[i] = CONFIG_EXAMPLES_NX_COLOR1; - g_color2[i] = CONFIG_EXAMPLES_NX_COLOR2; -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS - g_tbcolor[i] = CONFIG_EXAMPLES_NX_TBCOLOR; -#endif - } - -#ifdef CONFIG_NX_MULTIUSER - return nxeg_muinitialize(); -#else - return nxeg_suinitialize(); -#endif -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nx_main - ****************************************************************************/ - -int nx_main(int argc, char *argv[]) -{ - NXEGWINDOW hwnd1; - NXEGWINDOW hwnd2; - struct nxgl_size_s size; - struct nxgl_point_s pt; - nxgl_mxpixel_t color; - int ret; - - /* Initialize */ - - ret = nxeg_initialize(); - message("nx_main: NX handle=%p\n", g_hnx); - if (!g_hnx || ret < 0) - { - message("nx_main: Failed to get NX handle: %d\n", errno); - g_exitcode = NXEXIT_NXOPEN; - goto errout; - } - - /* Get the default font handle */ - - g_fonthandle = nxf_getfonthandle(CONFIG_EXAMPLES_NX_FONTID); - if (!g_fonthandle) - { - message("nx_main: Failed to get font handle: %d\n", errno); - g_exitcode = NXEXIT_FONTOPEN; - goto errout; - } - - /* Set the background to the configured background color */ - - message("nx_main: Set background color=%d\n", CONFIG_EXAMPLES_NX_BGCOLOR); - color = CONFIG_EXAMPLES_NX_BGCOLOR; - ret = nx_setbgcolor(g_hnx, &color); - if (ret < 0) - { - message("nx_main: nx_setbgcolor failed: %d\n", errno); - g_exitcode = NXEXIT_NXSETBGCOLOR; - goto errout_with_nx; - } - - /* Create window #1 */ - - message("nx_main: Create window #1\n"); - nxeg_initstate(&g_wstate[0], 1, CONFIG_EXAMPLES_NX_COLOR1); - hwnd1 = nxeg_openwindow(&g_nxcb, &g_wstate[0]); - message("nx_main: hwnd1=%p\n", hwnd1); - if (!hwnd1) - { - goto errout_with_nx; - } - - /* Wait until we have the screen resolution */ - - while (!b_haveresolution) - { - (void)sem_wait(&g_semevent); - } - message("nx_main: Screen resolution (%d,%d)\n", g_xres, g_yres); - - /* Set the size of the window 1 */ - - size.w = g_xres / 2; - size.h = g_yres / 2; - - message("nx_main: Set window #1 size to (%d,%d)\n", size.w, size.h); - ret = nxeg_setsize(hwnd1, &size); - if (ret < 0) - { - goto errout_with_hwnd1; - } - - /* Sleep a bit -- both so that we can see the result of the above operations - * but also, in the multi-user case, so that the server can get a chance to - * actually do them! - */ - - message("nx_main: Sleeping\n\n"); - sleep(1); - - /* Set the position of window #1 */ - - pt.x = g_xres / 8; - pt.y = g_yres / 8; - - message("nx_main: Set window #1 postion to (%d,%d)\n", pt.x, pt.y); - ret = nxeg_setposition(hwnd1, &pt); - if (ret < 0) - { - goto errout_with_hwnd1; - } - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(1); - - /* Open the toolbar */ - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS - message("nx_main: Add toolbar to window #1\n"); - ret = nxeq_opentoolbar(hwnd1, CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT, &g_tbcb, &g_wstate[0]); - if (ret < 0) - { - goto errout_with_hwnd1; - } - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(1); -#endif - - /* Create window #2 */ - - message("nx_main: Create window #2\n"); - nxeg_initstate(&g_wstate[1], 2, CONFIG_EXAMPLES_NX_COLOR2); - hwnd2 = nxeg_openwindow(&g_nxcb, &g_wstate[1]); - message("nx_main: hwnd2=%p\n", hwnd2); - if (!hwnd2) - { - goto errout_with_hwnd1; - } - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(1); - - /* Set the size of the window 2 == size of window 1*/ - - message("nx_main: Set hwnd2 size to (%d,%d)\n", size.w, size.h); - ret = nxeg_setsize(hwnd2, &size); - if (ret < 0) - { - goto errout_with_hwnd2; - } - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(1); - - /* Set the position of window #2 */ - - pt.x = g_xres - size.w - pt.x; - pt.y = g_yres - size.h - pt.y; - - message("nx_main: Set hwnd2 postion to (%d,%d)\n", pt.x, pt.y); - ret = nxeg_setposition(hwnd2, &pt); - if (ret < 0) - { - goto errout_with_hwnd2; - } - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(1); - -#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS - message("nx_main: Add toolbar to window #2\n"); - ret = nxeq_opentoolbar(hwnd2, CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT, &g_tbcb, &g_wstate[1]); - if (ret < 0) - { - goto errout_with_hwnd2; - } - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(1); -#endif - - /* Give keyboard input to the top window -- should be window #2 */ - -#ifdef CONFIG_NX_KBD - message("nx_main: Send keyboard input: %s\n", g_kbdmsg1); - ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg1), g_kbdmsg1); - if (ret < 0) - { - message("nx_main: nx_kbdin failed: %d\n", errno); - goto errout_with_hwnd2; - } - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(1); -#endif - - /* Lower window 2 */ - - message("nx_main: Lower window #2\n"); - ret = nxeg_lower(hwnd2); - if (ret < 0) - { - goto errout_with_hwnd2; - } - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(1); - - /* Put mouse left-button clicks all over the screen and see who responds */ - -#ifdef CONFIG_NX_MOUSE - nxeg_drivemouse(); - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(1); -#endif - - /* Give keyboard input to the top window -- should be window #1 */ - -#ifdef CONFIG_NX_KBD - message("nx_main: Send keyboard input: %s\n", g_kbdmsg2); - ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg2), g_kbdmsg2); - if (ret < 0) - { - message("nx_main: nx_kbdin failed: %d\n", errno); - goto errout_with_hwnd2; - } - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(1); -#endif - - /* Raise window 2 */ - - message("nx_main: Raise window #2\n"); - ret = nxeg_raise(hwnd2); - if (ret < 0) - { - goto errout_with_hwnd2; - } - - /* Put mouse left-button clicks all over the screen and see who responds */ - -#ifdef CONFIG_NX_MOUSE - nxeg_drivemouse(); -#endif - - /* Sleep a bit */ - - message("nx_main: Sleeping\n\n"); - sleep(2); - - /* Close the window 2 */ - -errout_with_hwnd2: - message("nx_main: Close window #2\n"); - (void)nxeg_closewindow(hwnd2, &g_wstate[1]); - - /* Close the window1 */ - -errout_with_hwnd1: - message("nx_main: Close window #1\n"); - (void)nxeg_closewindow(hwnd1, &g_wstate[0]); - -errout_with_nx: -#ifdef CONFIG_NX_MULTIUSER - /* Disconnect from the server */ - - message("nx_main: Disconnect from the server\n"); - nx_disconnect(g_hnx); -#else - /* Close the server */ - - message("nx_main: Close NX\n"); - nx_close(g_hnx); -#endif -errout: - return g_exitcode; -} diff --git a/apps/examples/nx/nx_server.c b/apps/examples/nx/nx_server.c deleted file mode 100644 index 7f3ee5dfc..000000000 --- a/apps/examples/nx/nx_server.c +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** - * examples/nx/nx_server.c - * - * Copyright (C) 2008-2009 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sched.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/arch.h> -#include <nuttx/nx/nx.h> - -#ifdef CONFIG_NX_LCDDRIVER -# include <nuttx/lcd/lcd.h> -#else -# include <nuttx/fb.h> -#endif - -#include "nx_internal.h" - -#ifdef CONFIG_NX_MULTIUSER - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nx_servertask - ****************************************************************************/ - -int nx_servertask(int argc, char *argv[]) -{ - FAR NX_DRIVERTYPE *dev; - int ret; - -#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT) - /* Use external graphics driver initialization */ - - message("nxeg_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NX_DEVNO); - if (!dev) - { - message("nxeg_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); - g_exitcode = NXEXIT_EXTINITIALIZE; - return ERROR; - } - -#elif defined(CONFIG_NX_LCDDRIVER) - /* Initialize the LCD device */ - - message("nx_servertask: Initializing LCD\n"); - ret = up_lcdinitialize(); - if (ret < 0) - { - message("nx_servertask: up_lcdinitialize failed: %d\n", -ret); - return 1; - } - - /* Get the device instance */ - - dev = up_lcdgetdev(CONFIG_EXAMPLES_NX_DEVNO); - if (!dev) - { - message("nx_servertask: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO); - return 2; - } - - /* Turn the LCD on at 75% power */ - - (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); -#else - /* Initialize the frame buffer device */ - - message("nx_servertask: Initializing framebuffer\n"); - ret = up_fbinitialize(); - if (ret < 0) - { - message("nx_servertask: up_fbinitialize failed: %d\n", -ret); - return 1; - } - - dev = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE); - if (!dev) - { - message("nx_servertask: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NX_VPLANE); - return 2; - } -#endif - - /* Then start the server */ - - ret = nx_run(dev); - message("nx_servertask: nx_run returned: %d\n", errno); - return 3; -} - -#endif /* CONFIG_NX_MULTIUSER */ diff --git a/apps/examples/nxconsole/Kconfig b/apps/examples/nxconsole/Kconfig deleted file mode 100644 index a52c49453..000000000 --- a/apps/examples/nxconsole/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_NXCONSOLE - bool "NxConsole example" - default n - ---help--- - Enable the NxConsole example - -if EXAMPLES_NXCONSOLE -endif diff --git a/apps/examples/nxconsole/Makefile b/apps/examples/nxconsole/Makefile deleted file mode 100644 index aa4cdc518..000000000 --- a/apps/examples/nxconsole/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -############################################################################ -# apps/examples/nxconsole/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# NuttX NX Console Example. - -ASRCS = -CSRCS = nxcon_main.c nxcon_toolbar.c nxcon_wndo.c nxcon_server.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/nxconsole/nxcon_internal.h b/apps/examples/nxconsole/nxcon_internal.h deleted file mode 100644 index c5ad760ad..000000000 --- a/apps/examples/nxconsole/nxcon_internal.h +++ /dev/null @@ -1,310 +0,0 @@ -/**************************************************************************** - * examples/nxconsole/nxcon_internal.h - * - * 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 __EXAMPLES_NXCONSOLE_NXCON_INTERNAL_H -#define __EXAMPLES_NXCONSOLE_NXCON_INTERNAL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <stdbool.h> -#include <semaphore.h> - -#include <nuttx/rgbcolors.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> -#include <nuttx/nx/nxtk.h> -#include <nuttx/nx/nxconsole.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* Need NX graphics support */ - -#ifndef CONFIG_NX -# error "NX is not enabled (CONFIG_NX=y)" -#endif - -/* Can't do the NxConsole example if the NxConsole driver is not built */ - -#ifndef CONFIG_NXCONSOLE -# error "NxConsole is not enabled (CONFIG_NXCONSOLE=y)" -#endif - -/* NxConsole requires NX Multi-user mode */ - -#ifndef CONFIG_NX_MULTIUSER -# error "Multi-user NX support is required (CONFIG_NX_MULTIUSER=y)" -#endif - -/* If there is no NSH console, then why are we running this example? */ - -#ifndef CONFIG_NSH_CONSOLE -# warning "Expected CONFIG_NSH_CONSOLE=y" -#endif - -/* The NSH telnet console requires networking support (and TCP/IP) */ - -#ifndef CONFIG_NET -# undef CONFIG_NSH_TELNET -#endif - -/* If not specified, assume that the hardware supports one video plane */ - -#if CONFIG_NX_NPLANES != 1 -# error "Only CONFIG_NX_NPLANES==1 supported" -#endif - -#ifndef CONFIG_EXAMPLES_NXCON_VPLANE -# define CONFIG_EXAMPLES_NXCON_VPLANE 0 -#endif - -/* Pixel depth. If none provided, pick the smallest enabled pixel depth */ - -#ifndef CONFIG_EXAMPLES_NXCON_BPP -# if !defined(CONFIG_NX_DISABLE_1BPP) -# define CONFIG_EXAMPLES_NXCON_BPP 1 -# elif !defined(CONFIG_NX_DISABLE_2BPP) -# define CONFIG_EXAMPLES_NXCON_BPP 2 -# elif !defined(CONFIG_NX_DISABLE_4BPP) -# define CONFIG_EXAMPLES_NXCON_BPP 4 -# elif !defined(CONFIG_NX_DISABLE_8BPP) -# define CONFIG_EXAMPLES_NXCON_BPP 8 -# elif !defined(CONFIG_NX_DISABLE_16BPP) -# define CONFIG_EXAMPLES_NXCON_BPP 16 -//#elif !defined(CONFIG_NX_DISABLE_24BPP) -//# define CONFIG_NXCONSOLE_BPP 24 -# elif !defined(CONFIG_NX_DISABLE_32BPP) -# define CONFIG_EXAMPLES_NXCON_BPP 32 -# else -# error "No pixel depth provided" -# endif -#endif - -/* Background color (default is darker royal blue) */ - -#ifndef CONFIG_EXAMPLES_NXCON_BGCOLOR -# if CONFIG_EXAMPLES_NXCON_BPP == 24 || CONFIG_EXAMPLES_NXCON_BPP == 32 -# define CONFIG_EXAMPLES_NXCON_BGCOLOR RGBTO24(39, 64, 139) -# elif CONFIG_EXAMPLES_NXCON_BPP == 16 -# define CONFIG_EXAMPLES_NXCON_BGCOLOR RGBTO16(39, 64, 139) -# else -# define CONFIG_EXAMPLES_NXCON_BGCOLOR RGBTO8(39, 64, 139) -# endif -#endif - -/* Window color (lighter steel blue) */ - -#ifndef CONFIG_EXAMPLES_NXCON_WCOLOR -# if CONFIG_EXAMPLES_NXCON_BPP == 24 || CONFIG_EXAMPLES_NXCON_BPP == 32 -# define CONFIG_EXAMPLES_NXCON_WCOLOR RGBTO24(202, 225, 255) -# elif CONFIG_EXAMPLES_NXCON_BPP == 16 -# define CONFIG_EXAMPLES_NXCON_WCOLOR RGBTO16(202, 225, 255) -# else -# define CONFIG_EXAMPLES_NXCON_WCOLOR RGBTO8(202, 225, 255) -# endif -#endif - -/* Toolbar color (medium grey) */ - -#ifndef CONFIG_EXAMPLES_NXCON_TBCOLOR -# if CONFIG_EXAMPLES_NX_BPP == 24 || CONFIG_EXAMPLES_NX_BPP == 32 -# define CONFIG_EXAMPLES_NXCON_TBCOLOR RGBTO24(188, 188, 188) -# elif CONFIG_EXAMPLES_NX_BPP == 16 -# define CONFIG_EXAMPLES_NXCON_TBCOLOR RGBTO16(188, 188, 188) -# else -# define CONFIG_EXAMPLES_NXCON_TBCOLOR RGBTO8(188, 188, 188) -# endif -#endif - -/* Font ID */ - -#ifndef CONFIG_EXAMPLES_NXCON_FONTID -# define CONFIG_EXAMPLES_NXCON_FONTID NXFONT_DEFAULT -#endif - -/* Font color */ - -#ifndef CONFIG_EXAMPLES_NXCON_FONTCOLOR -# if CONFIG_EXAMPLES_NXCON_BPP == 24 || CONFIG_EXAMPLES_NXCON_BPP == 32 -# define CONFIG_EXAMPLES_NXCON_FONTCOLOR RGBTO24(0, 0, 0) -# elif CONFIG_EXAMPLES_NXCON_BPP == 16 -# define CONFIG_EXAMPLES_NXCON_FONTCOLOR RGBTO16(0, 0, 0) -# else -# define CONFIG_EXAMPLES_NXCON_FONTCOLOR RGBTO8(0, 0, 0) -# endif -#endif - -/* Height of the toolbar */ - -#ifndef CONFIG_EXAMPLES_NXCON_TOOLBAR_HEIGHT -# define CONFIG_EXAMPLES_NXCON_TOOLBAR_HEIGHT 16 -#endif - -/* Multi-user NX support */ - -#ifdef CONFIG_DISABLE_MQUEUE -# error "The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)" -#endif -#ifdef CONFIG_DISABLE_SIGNALS -# error "This example requires signal support (CONFIG_DISABLE_SIGNALS=n)" -#endif -#ifdef CONFIG_DISABLE_PTHREAD -# error "This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)" -#endif -#ifndef CONFIG_NX_BLOCKING -# error "This example depends on CONFIG_NX_BLOCKING" -#endif -#ifndef CONFIG_EXAMPLES_NXCON_STACKSIZE -# define CONFIG_EXAMPLES_NXCON_STACKSIZE 2048 -#endif -#ifndef CONFIG_EXAMPLES_NXCON_LISTENERPRIO -# define CONFIG_EXAMPLES_NXCON_LISTENERPRIO 100 -#endif -#ifndef CONFIG_EXAMPLES_NXCON_CLIENTPRIO -# define CONFIG_EXAMPLES_NXCON_CLIENTPRIO 100 -#endif -#ifndef CONFIG_EXAMPLES_NXCON_SERVERPRIO -# define CONFIG_EXAMPLES_NXCON_SERVERPRIO 120 -#endif -#ifndef CONFIG_EXAMPLES_NXCON_NOTIFYSIGNO -# define CONFIG_EXAMPLES_NXCON_NOTIFYSIGNO 4 -#endif - -/* Graphics Device */ - -#ifndef CONFIG_EXAMPLES_NXCON_DEVNO -# define CONFIG_EXAMPLES_NXCON_DEVNO 0 -#endif - -/* NX Console Device */ - -#ifndef CONFIG_EXAMPLES_NXCON_MINOR -# define CONFIG_EXAMPLES_NXCON_MINOR 0 -#endif - -#ifndef CONFIG_EXAMPLES_NXCON_DEVNAME -# define CONFIG_EXAMPLES_NXCON_DEVNAME "/dev/nxcon0" -#endif - -/* NxConsole task */ - -#ifndef CONFIG_EXAMPLES_NXCONSOLE_PRIO -# define CONFIG_EXAMPLES_NXCONSOLE_PRIO SCHED_PRIORITY_DEFAULT -#endif - -#ifndef CONFIG_EXAMPLES_NXCONSOLE_STACKSIZE -# define CONFIG_EXAMPLES_NXCONSOLE_STACKSIZE 2048 -#endif - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# define msgflush() -# else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define msgflush() -# else -# define message printf -# define msgflush() fflush(stdout) -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* All example global variables are retained in a structure to minimize - * the chance of name collisions. - */ - -struct nxcon_state_s -{ - volatile bool haveres; /* True: Have screen resolution */ - volatile bool connected; /* True: Connected to server */ - sem_t eventsem; /* Control waiting for display events */ - pid_t pid; /* Console task ID */ - NXHANDLE hnx; /* The connection handler */ - NXTKWINDOW hwnd; /* The window */ - NXCONSOLE hdrvr; /* The console driver */ - struct nxcon_window_s wndo; /* Describes the window */ - nxgl_coord_t xres; /* Screen X resolution */ - nxgl_coord_t yres; /* Screen Y resolution */ - struct nxgl_size_s wsize; /* Window size */ - struct nxgl_point_s wpos; /* Window position */ -}; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ -/* All example global variables are retained in a structure to minimize - * the chance of name collisions. - */ - -extern struct nxcon_state_s g_nxcon_vars; - -/* NX callback vtables */ - -extern const struct nx_callback_s g_nxconcb; -extern const struct nx_callback_s g_nxtoolcb; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ -/* Board-specific driver intiialization */ - -#ifdef CONFIG_EXAMPLES_NXCON_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif - -/* Server thread support */ - -extern int nxcon_server(int argc, char *argv[]); -extern FAR void *nxcon_listener(FAR void *arg); - -#endif /* __EXAMPLES_NXCONSOLE_NXCON_INTERNAL_H */ diff --git a/apps/examples/nxconsole/nxcon_main.c b/apps/examples/nxconsole/nxcon_main.c deleted file mode 100644 index 41d8efd19..000000000 --- a/apps/examples/nxconsole/nxcon_main.c +++ /dev/null @@ -1,412 +0,0 @@ -/**************************************************************************** - * examples/nxconsole/nxcon_main.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 <stdint.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <errno.h> -#include <debug.h> - -#ifdef CONFIG_NX_LCDDRIVER -# include <nuttx/lcd/lcd.h> -#else -# include <nuttx/fb.h> -#endif - -#include <nuttx/arch.h> -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> -#include <nuttx/nx/nxfonts.h> -#include <nuttx/nx/nxconsole.h> - -#include <apps/nsh.h> - -#include "nxcon_internal.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* All example global variables are retained in a structure to minimize - * the chance of name collisions. - */ - -struct nxcon_state_s g_nxcon_vars; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxcon_initialize - ****************************************************************************/ - -static int nxcon_initialize(void) -{ - struct sched_param param; - pthread_t thread; - pid_t servrid; - int ret; - - /* Set the client task priority */ - - param.sched_priority = CONFIG_EXAMPLES_NXCON_CLIENTPRIO; - ret = sched_setparam(0, ¶m); - if (ret < 0) - { - message("nxcon_initialize: sched_setparam failed: %d\n" , ret); - return ERROR; - } - - /* Start the server task */ - - message("nxcon_initialize: Starting nxcon_server task\n"); - servrid = task_create("NX Server", CONFIG_EXAMPLES_NXCON_SERVERPRIO, - CONFIG_EXAMPLES_NXCON_STACKSIZE, nxcon_server, NULL); - if (servrid < 0) - { - message("nxcon_initialize: Failed to create nxcon_server task: %d\n", errno); - return ERROR; - } - - /* Wait a bit to let the server get started */ - - sleep(1); - - /* Connect to the server */ - - g_nxcon_vars.hnx = nx_connect(); - if (g_nxcon_vars.hnx) - { - pthread_attr_t attr; - - /* Start a separate thread to listen for server events. This is probably - * the least efficient way to do this, but it makes this example flow more - * smoothly. - */ - - (void)pthread_attr_init(&attr); - param.sched_priority = CONFIG_EXAMPLES_NXCON_LISTENERPRIO; - (void)pthread_attr_setschedparam(&attr, ¶m); - (void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NXCON_STACKSIZE); - - ret = pthread_create(&thread, &attr, nxcon_listener, NULL); - if (ret != 0) - { - printf("nxcon_initialize: pthread_create failed: %d\n", ret); - return ERROR; - } - - /* Don't return until we are connected to the server */ - - while (!g_nxcon_vars.connected) - { - /* Wait for the listener thread to wake us up when we really - * are connected. - */ - - (void)sem_wait(&g_nxcon_vars.eventsem); - } - } - else - { - message("nxcon_initialize: nx_connect failed: %d\n", errno); - return ERROR; - } - return OK; -} - -/**************************************************************************** - * Name: nxcon_task - ****************************************************************************/ - -static int nxcon_task(int argc, char **argv) -{ - /* If the console front end is selected, then run it on this thread */ - -#ifdef CONFIG_NSH_CONSOLE - (void)nsh_consolemain(0, NULL); -#endif - - printf("nxcon_task: Unregister the NX console device\n"); - (void)nxcon_unregister(g_nxcon_vars.hdrvr); - - printf("nxcon_task: Close the window\n"); - (void)nxtk_closewindow(g_nxcon_vars.hwnd); - - /* Disconnect from the server */ - - printf("nxcon_task: Disconnect from the server\n"); - nx_disconnect(g_nxcon_vars.hnx); - - return EXIT_SUCCESS; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxcon_main - ****************************************************************************/ - -int nxcon_main(int argc, char **argv) -{ - nxgl_mxpixel_t color; - int fd; - int ret; - - /* General Initialization *************************************************/ - /* Reset all global data */ - - message("nxcon_main: Started\n"); - memset(&g_nxcon_vars, 0, sizeof(struct nxcon_state_s)); - - /* Call all C++ static constructors */ - -#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) - up_cxxinitialize(); -#endif - - /* NSH Initialization *****************************************************/ - /* Initialize the NSH library */ - - message("nxcon_main: Initialize NSH\n"); - nsh_initialize(); - - /* If the Telnet console is selected as a front-end, then start the - * Telnet daemon. - */ - -#ifdef CONFIG_NSH_TELNET - ret = nsh_telnetstart(); - if (ret < 0) - { - /* The daemon is NOT running. Report the the error then fail... - * either with the serial console up or just exiting. - */ - - fprintf(stderr, "ERROR: Failed to start TELNET daemon: %d\n", ret); - } -#endif - /* NX Initialization ******************************************************/ - /* Initialize NX */ - - message("nxcon_main: Initialize NX\n"); - ret = nxcon_initialize(); - message("nxcon_main: NX handle=%p\n", g_nxcon_vars.hnx); - if (!g_nxcon_vars.hnx || ret < 0) - { - message("nxcon_main: Failed to get NX handle: %d\n", errno); - goto errout; - } - - /* Set the background to the configured background color */ - - message("nxcon_main: Set background color=%d\n", CONFIG_EXAMPLES_NXCON_BGCOLOR); - color = CONFIG_EXAMPLES_NXCON_BGCOLOR; - ret = nx_setbgcolor(g_nxcon_vars.hnx, &color); - if (ret < 0) - { - message("nxcon_main: nx_setbgcolor failed: %d\n", errno); - goto errout_with_nx; - } - - /* Window Configuration ***************************************************/ - /* Create a window */ - - message("nxcon_main: Create window\n"); - g_nxcon_vars.hwnd = nxtk_openwindow(g_nxcon_vars.hnx, &g_nxconcb, NULL); - if (!g_nxcon_vars.hwnd) - { - message("nxcon_main: nxtk_openwindow failed: %d\n", errno); - goto errout_with_nx; - } - message("nxcon_main: hwnd=%p\n", g_nxcon_vars.hwnd); - - /* Wait until we have the screen resolution. We'll have this immediately - * unless we are dealing with the NX server. - */ - - while (!g_nxcon_vars.haveres) - { - (void)sem_wait(&g_nxcon_vars.eventsem); - } - message("nxcon_main: Screen resolution (%d,%d)\n", g_nxcon_vars.xres, g_nxcon_vars.yres); - - /* Determine the size and position of the window */ - - g_nxcon_vars.wndo.wsize.w = g_nxcon_vars.xres / 2 + g_nxcon_vars.xres / 4; - g_nxcon_vars.wndo.wsize.h = g_nxcon_vars.yres / 2 + g_nxcon_vars.yres / 4; - - g_nxcon_vars.wpos.x = g_nxcon_vars.xres / 8; - g_nxcon_vars.wpos.y = g_nxcon_vars.yres / 8; - - /* Set the window position */ - - message("nxcon_main: Set window position to (%d,%d)\n", - g_nxcon_vars.wpos.x, g_nxcon_vars.wpos.y); - - ret = nxtk_setposition(g_nxcon_vars.hwnd, &g_nxcon_vars.wpos); - if (ret < 0) - { - message("nxcon_main: nxtk_setposition failed: %d\n", errno); - goto errout_with_hwnd; - } - - /* Set the window size */ - - message("nxcon_main: Set window size to (%d,%d)\n", - g_nxcon_vars.wndo.wsize.w, g_nxcon_vars.wndo.wsize.h); - - ret = nxtk_setsize(g_nxcon_vars.hwnd, &g_nxcon_vars.wndo.wsize); - if (ret < 0) - { - message("nxcon_main: nxtk_setsize failed: %d\n", errno); - goto errout_with_hwnd; - } - - /* Open the toolbar */ - - message("nxcon_main: Add toolbar to window\n"); - ret = nxtk_opentoolbar(g_nxcon_vars.hwnd, CONFIG_EXAMPLES_NXCON_TOOLBAR_HEIGHT, &g_nxtoolcb, NULL); - if (ret < 0) - { - message("nxcon_main: nxtk_opentoolbar failed: %d\n", errno); - goto errout_with_hwnd; - } - - /* Sleep a little bit to allow the server to catch up */ - - sleep(2); - - /* NxConsole Configuration ************************************************/ - /* Use the window to create an NX console */ - - g_nxcon_vars.wndo.wcolor[0] = CONFIG_EXAMPLES_NXCON_WCOLOR; - g_nxcon_vars.wndo.fcolor[0] = CONFIG_EXAMPLES_NXCON_FONTCOLOR; - g_nxcon_vars.wndo.fontid = CONFIG_EXAMPLES_NXCON_FONTID; - - g_nxcon_vars.hdrvr = nxtk_register(g_nxcon_vars.hwnd, &g_nxcon_vars.wndo, CONFIG_EXAMPLES_NXCON_MINOR); - if (!g_nxcon_vars.hdrvr) - { - message("nxcon_main: nxtk_register failed: %d\n", errno); - goto errout_with_hwnd; - } - - /* Open the NxConsole driver */ - - fd = open(CONFIG_EXAMPLES_NXCON_DEVNAME, O_WRONLY); - if (fd < 0) - { - message("nxcon_main: open %s read-only failed: %d\n", - CONFIG_EXAMPLES_NXCON_DEVNAME, errno); - goto errout_with_driver; - } - - /* Start Console Task *****************************************************/ - /* Now re-direct stdout and stderr so that they use the NX console driver. - * Note that stdin is retained (file descriptor 0, probably the the serial console). - */ - - message("nxcon_main: Starting the console task\n"); - msgflush(); - - (void)fflush(stdout); - (void)fflush(stderr); - - (void)fclose(stdout); - (void)fclose(stderr); - - (void)dup2(fd, 1); - (void)dup2(fd, 2); - - /* And we can close our original driver file descriptor */ - - close(fd); - - /* And start the console task. It will inherit stdin, stdout, and stderr - * from this task. - */ - - g_nxcon_vars.pid = TASK_CREATE("NxConsole", CONFIG_EXAMPLES_NXCONSOLE_PRIO, - CONFIG_EXAMPLES_NXCONSOLE_STACKSIZE, - nxcon_task, NULL); - ASSERT(g_nxcon_vars.pid > 0); - return EXIT_SUCCESS; - - /* Error Exits ************************************************************/ - -errout_with_driver: - (void)nxcon_unregister(g_nxcon_vars.hdrvr); - -errout_with_hwnd: - (void)nxtk_closewindow(g_nxcon_vars.hwnd); - -errout_with_nx: - /* Disconnect from the server */ - - nx_disconnect(g_nxcon_vars.hnx); -errout: - return EXIT_FAILURE; -} diff --git a/apps/examples/nxconsole/nxcon_server.c b/apps/examples/nxconsole/nxcon_server.c deleted file mode 100644 index ccd000ec0..000000000 --- a/apps/examples/nxconsole/nxcon_server.c +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** - * examples/nxconsole/nxcon_server.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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sched.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/arch.h> -#include <nuttx/nx/nx.h> - -#ifdef CONFIG_NX_LCDDRIVER -# include <nuttx/lcd/lcd.h> -#else -# include <nuttx/fb.h> -#endif - -#include "nxcon_internal.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxcon_server - ****************************************************************************/ - -int nxcon_server(int argc, char *argv[]) -{ - FAR NX_DRIVERTYPE *dev; - int ret; - -#if defined(CONFIG_EXAMPLES_NXCON_EXTERNINIT) - /* Use external graphics driver initialization */ - - message("nxcon_server: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXCON_DEVNO); - if (!dev) - { - message("nxcon_server: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NXCON_DEVNO); - return ERROR; - } - -#elif defined(CONFIG_NX_LCDDRIVER) - /* Initialize the LCD device */ - - message("nxcon_server: Initializing LCD\n"); - ret = up_lcdinitialize(); - if (ret < 0) - { - message("nxcon_server: up_lcdinitialize failed: %d\n", -ret); - return 1; - } - - /* Get the device instance */ - - dev = up_lcdgetdev(CONFIG_EXAMPLES_NXCON_DEVNO); - if (!dev) - { - message("nxcon_server: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXCON_DEVNO); - return 2; - } - - /* Turn the LCD on at 75% power */ - - (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); -#else - /* Initialize the frame buffer device */ - - message("nxcon_server: Initializing framebuffer\n"); - ret = up_fbinitialize(); - if (ret < 0) - { - message("nxcon_server: up_fbinitialize failed: %d\n", -ret); - return 1; - } - - dev = up_fbgetvplane(CONFIG_EXAMPLES_NXCON_VPLANE); - if (!dev) - { - message("nxcon_server: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXCON_VPLANE); - return 2; - } -#endif - - /* Then start the server */ - - ret = nx_run(dev); - gvdbg("nx_run returned: %d\n", errno); - return 3; -} - -/**************************************************************************** - * Name: nxcon_listener - ****************************************************************************/ - -FAR void *nxcon_listener(FAR void *arg) -{ - int ret; - - /* Process events forever */ - - for (;;) - { - /* Handle the next event. If we were configured blocking, then - * we will stay right here until the next event is received. Since - * we have dedicated a while thread to servicing events, it would - * be most natural to also select CONFIG_NX_BLOCKING -- if not, the - * following would be a tight infinite loop (unless we added addition - * logic with nx_eventnotify and sigwait to pace it). - */ - - ret = nx_eventhandler(g_nxcon_vars.hnx); - if (ret < 0) - { - /* An error occurred... assume that we have lost connection with - * the server. - */ - - message("nxcon_listener: Lost server connection: %d\n", errno); - exit(EXIT_FAILURE); - } - - /* If we received a message, we must be connected */ - - if (!g_nxcon_vars.connected) - { - g_nxcon_vars.connected = true; - sem_post(&g_nxcon_vars.eventsem); - message("nxcon_listener: Connected\n"); - } - } -} diff --git a/apps/examples/nxconsole/nxcon_toolbar.c b/apps/examples/nxconsole/nxcon_toolbar.c deleted file mode 100644 index d4432b2f4..000000000 --- a/apps/examples/nxconsole/nxcon_toolbar.c +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************** - * examples/nxconsole/nxcon_toolbar.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 <stdint.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <semaphore.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxfonts.h> - -#include "nxcon_internal.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static void nxtool_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool morem, FAR void *arg); -static void nxtool_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg); -#ifdef CONFIG_NX_MOUSE -static void nxtool_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg); -#endif - -#ifdef CONFIG_NX_KBD -static void nxtool_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg); -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* Background window call table */ - -const struct nx_callback_s g_nxtoolcb = -{ - nxtool_redraw, /* redraw */ - nxtool_position /* position */ -#ifdef CONFIG_NX_MOUSE - , nxtool_mousein /* mousein */ -#endif -#ifdef CONFIG_NX_KBD - , nxtool_kbdin /* my kbdin */ -#endif -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxtool_redraw - ****************************************************************************/ - -static void nxtool_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg) -{ - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; - int ret; - - gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", - hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, - more ? "true" : "false"); - - color[0] = CONFIG_EXAMPLES_NXCON_TBCOLOR; - ret = nxtk_filltoolbar(hwnd, rect, color); - if (ret < 0) - { - gdbg("nxtk_filltoolbar failed: %d\n", errno); - } -} - -/**************************************************************************** - * Name: nxtool_position - ****************************************************************************/ - -static void nxtool_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg) -{ - gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", - hwnd, size->w, size->h, pos->x, pos->y, - bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); -} - -/**************************************************************************** - * Name: nxtool_mousein - ****************************************************************************/ - -#ifdef CONFIG_NX_MOUSE -static void nxtool_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg) -{ - gvdbg("hwnd=%p pos=(%d,%d) button=%02x\n", hwnd, pos->x, pos->y, buttons); -} -#endif - -/**************************************************************************** - * Name: nxtool_kbdin - ****************************************************************************/ - -#ifdef CONFIG_NX_KBD -static void nxtool_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg) -{ - gvdbg("hwnd=%p nch=%d\n", hwnd, nch); -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ diff --git a/apps/examples/nxconsole/nxcon_wndo.c b/apps/examples/nxconsole/nxcon_wndo.c deleted file mode 100644 index 083da739d..000000000 --- a/apps/examples/nxconsole/nxcon_wndo.c +++ /dev/null @@ -1,208 +0,0 @@ -/**************************************************************************** - * examples/nxconsole/nxcon_wndo.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 <stdint.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <semaphore.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxfonts.h> - -#include "nxcon_internal.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static void nxwndo_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool morem, FAR void *arg); -static void nxwndo_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg); -#ifdef CONFIG_NX_MOUSE -static void nxwndo_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg); -#endif - -#ifdef CONFIG_NX_KBD -static void nxwndo_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg); -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* Background window call table */ - -const struct nx_callback_s g_nxconcb = -{ - nxwndo_redraw, /* redraw */ - nxwndo_position /* position */ -#ifdef CONFIG_NX_MOUSE - , nxwndo_mousein /* mousein */ -#endif -#ifdef CONFIG_NX_KBD - , nxwndo_kbdin /* my kbdin */ -#endif -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxwndo_redraw - ****************************************************************************/ - -static void nxwndo_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg) -{ - nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]; - - gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", - hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, - more ? "true" : "false"); - - /* Don't attempt to redraw if the driver has not yet been opened */ - - if (g_nxcon_vars.hdrvr) - { - /* Inform the NX console of the redraw request */ - - nxcon_redraw(g_nxcon_vars.hdrvr, rect, more); - } - else - { - /* If the driver has not been opened, then just redraw the window color */ - - wcolor[0] = CONFIG_EXAMPLES_NXCON_WCOLOR; - (void)nxtk_fillwindow(hwnd, rect, wcolor); - } -} - -/**************************************************************************** - * Name: nxwndo_position - ****************************************************************************/ - -static void nxwndo_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg) -{ - /* Report the position */ - - gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", - hwnd, size->w, size->h, pos->x, pos->y, - bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); - - /* Have we picked off the window bounds yet? */ - - if (!g_nxcon_vars.haveres) - { - /* Save the background window handle */ - - g_nxcon_vars.hwnd = hwnd; - - /* Save the background window size */ - - g_nxcon_vars.wndo.wsize.w = size->w; - g_nxcon_vars.wndo.wsize.h = size->h; - - /* Save the window limits (these should be the same for all places and all windows */ - - g_nxcon_vars.xres = bounds->pt2.x + 1; - g_nxcon_vars.yres = bounds->pt2.y + 1; - - g_nxcon_vars.haveres = true; - sem_post(&g_nxcon_vars.eventsem); - gvdbg("Have xres=%d yres=%d\n", g_nxcon_vars.xres, g_nxcon_vars.yres); - } -} - -/**************************************************************************** - * Name: nxwndo_mousein - ****************************************************************************/ - -#ifdef CONFIG_NX_MOUSE -static void nxwndo_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg) -{ - gvdbg("hwnd=%p pos=(%d,%d) button=%02x\n", - hwnd, pos->x, pos->y, buttons); -} -#endif - -/**************************************************************************** - * Name: nxwndo_kbdin - ****************************************************************************/ - -#ifdef CONFIG_NX_KBD -static void nxwndo_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg) -{ - gvdbg("hwnd=%p nch=%d\n", hwnd, nch); - (void)write(1, ch, nch); -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ diff --git a/apps/examples/nxffs/Kconfig b/apps/examples/nxffs/Kconfig deleted file mode 100644 index 074ace872..000000000 --- a/apps/examples/nxffs/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_NXFFS - bool "NXFFS file system example" - default n - ---help--- - Enable the NXFFS file system example - -if EXAMPLES_NXFFS -endif diff --git a/apps/examples/nxffs/Makefile b/apps/examples/nxffs/Makefile deleted file mode 100644 index 9af03897f..000000000 --- a/apps/examples/nxffs/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -############################################################################ -# apps/examples/nxffs/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# Hello, World! Example - -ASRCS = -CSRCS = nxffs_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/nxffs/nxffs_main.c b/apps/examples/nxffs/nxffs_main.c deleted file mode 100644 index 5401fc932..000000000 --- a/apps/examples/nxffs/nxffs_main.c +++ /dev/null @@ -1,947 +0,0 @@ -/**************************************************************************** - * examples/nxffs/nxffs_main.c - * - * Copyright (C) 2011 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/mount.h> - -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <dirent.h> -#include <string.h> -#include <errno.h> -#include <crc32.h> -#include <debug.h> - -#include <nuttx/mtd.h> -#include <nuttx/fs/nxffs.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* The default is to use the RAM MTD device at drivers/mtd/rammtd.c. But - * an architecture-specific MTD driver can be used instead by defining - * CONFIG_EXAMPLES_NXFFS_ARCHINIT. In this case, the initialization logic - * will call nxffs_archinitialize() to obtain the MTD driver instance. - */ - -#ifndef CONFIG_EXAMPLES_NXFFS_ARCHINIT - -/* This must exactly match the default configuration in drivers/mtd/rammtd.c */ - -# ifndef CONFIG_RAMMTD_BLOCKSIZE -# define CONFIG_RAMMTD_BLOCKSIZE 512 -# endif - -# ifndef CONFIG_RAMMTD_ERASESIZE -# define CONFIG_RAMMTD_ERASESIZE 4096 -# endif - -# ifndef CONFIG_EXAMPLES_NXFFS_NEBLOCKS -# define CONFIG_EXAMPLES_NXFFS_NEBLOCKS (32) -# endif - -# undef CONFIG_EXAMPLES_NXFFS_BUFSIZE -# define CONFIG_EXAMPLES_NXFFS_BUFSIZE \ - (CONFIG_RAMMTD_ERASESIZE * CONFIG_EXAMPLES_NXFFS_NEBLOCKS) -#endif - -#ifndef CONFIG_EXAMPLES_NXFFS_MAXNAME -# define CONFIG_EXAMPLES_NXFFS_MAXNAME 128 -#endif - -#if CONFIG_EXAMPLES_NXFFS_MAXNAME > 255 -# undef CONFIG_EXAMPLES_NXFFS_MAXNAME -# define CONFIG_EXAMPLES_NXFFS_MAXNAME 255 -#endif - -#ifndef CONFIG_EXAMPLES_NXFFS_MAXFILE -# define CONFIG_EXAMPLES_NXFFS_MAXFILE 8192 -#endif - -#ifndef CONFIG_EXAMPLES_NXFFS_MAXIO -# define CONFIG_EXAMPLES_NXFFS_MAXIO 347 -#endif - -#ifndef CONFIG_EXAMPLES_NXFFS_MAXOPEN -# define CONFIG_EXAMPLES_NXFFS_MAXOPEN 512 -#endif - -#ifndef CONFIG_EXAMPLES_NXFFS_MOUNTPT -# define CONFIG_EXAMPLES_NXFFS_MOUNTPT "/mnt/nxffs" -#endif - -#ifndef CONFIG_EXAMPLES_NXFFS_NLOOPS -# define CONFIG_EXAMPLES_NXFFS_NLOOPS 100 -#endif - -#ifndef CONFIG_EXAMPLES_NXFFS_VERBOSE -# define CONFIG_EXAMPLES_NXFFS_VERBOSE 0 -#endif - -#if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_FS) -# define message lib_rawprintf -# define msgflush() -#else -# define message printf -# define msgflush() fflush(stdout); -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -struct nxffs_filedesc_s -{ - FAR char *name; - bool deleted; - size_t len; - uint32_t crc; -}; - -/**************************************************************************** - * Private Data - ****************************************************************************/ -/* Pre-allocated simulated flash */ - -#ifndef CONFIG_EXAMPLES_NXFFS_ARCHINIT -static uint8_t g_simflash[CONFIG_EXAMPLES_NXFFS_BUFSIZE]; -#endif - -static uint8_t g_fileimage[CONFIG_EXAMPLES_NXFFS_MAXFILE]; -static struct nxffs_filedesc_s g_files[CONFIG_EXAMPLES_NXFFS_MAXOPEN]; -static const char g_mountdir[] = CONFIG_EXAMPLES_NXFFS_MOUNTPT "/"; -static int g_nfiles; -static int g_ndeleted; - -static struct mallinfo g_mmbefore; -static struct mallinfo g_mmprevious; -static struct mallinfo g_mmafter; - -/**************************************************************************** - * External Functions - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NXFFS_ARCHINIT -extern FAR struct mtd_dev_s *nxffs_archinitialize(void); -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxffs_memusage - ****************************************************************************/ - -static void nxffs_showmemusage(struct mallinfo *mmbefore, - struct mallinfo *mmafter) -{ - message("VARIABLE BEFORE AFTER\n"); - message("======== ======== ========\n"); - message("arena %8x %8x\n", mmbefore->arena, mmafter->arena); - message("ordblks %8d %8d\n", mmbefore->ordblks, mmafter->ordblks); - message("mxordblk %8x %8x\n", mmbefore->mxordblk, mmafter->mxordblk); - message("uordblks %8x %8x\n", mmbefore->uordblks, mmafter->uordblks); - message("fordblks %8x %8x\n", mmbefore->fordblks, mmafter->fordblks); -} - -/**************************************************************************** - * Name: nxffs_loopmemusage - ****************************************************************************/ - -static void nxffs_loopmemusage(void) -{ - /* Get the current memory usage */ - -#ifdef CONFIG_CAN_PASS_STRUCTS - g_mmafter = mallinfo(); -#else - (void)mallinfo(&g_mmafter); -#endif - - /* Show the change from the previous loop */ - - message("\nEnd of loop memory usage:\n"); - nxffs_showmemusage(&g_mmprevious, &g_mmafter); - - /* Set up for the next test */ - -#ifdef CONFIG_CAN_PASS_STRUCTS - g_mmprevious = g_mmafter; -#else - memcpy(&g_mmprevious, &g_mmafter, sizeof(struct mallinfo)); -#endif -} - -/**************************************************************************** - * Name: nxffs_endmemusage - ****************************************************************************/ - -static void nxffs_endmemusage(void) -{ -#ifdef CONFIG_CAN_PASS_STRUCTS - g_mmafter = mallinfo(); -#else - (void)mallinfo(&g_mmafter); -#endif - message("\nFinal memory usage:\n"); - nxffs_showmemusage(&g_mmbefore, &g_mmafter); -} - -/**************************************************************************** - * Name: nxffs_randchar - ****************************************************************************/ - -static inline char nxffs_randchar(void) -{ - int value = rand() % 63; - if (value == 0) - { - return '/'; - } - else if (value <= 10) - { - return value + '0' - 1; - } - else if (value <= 36) - { - return value + 'a' - 11; - } - else /* if (value <= 62) */ - { - return value + 'A' - 37; - } -} - -/**************************************************************************** - * Name: nxffs_randname - ****************************************************************************/ - -static inline void nxffs_randname(FAR struct nxffs_filedesc_s *file) -{ - int dirlen; - int maxname; - int namelen; - int alloclen; - int i; - - dirlen = strlen(g_mountdir); - maxname = CONFIG_EXAMPLES_NXFFS_MAXNAME - dirlen; - namelen = (rand() % maxname) + 1; - alloclen = namelen + dirlen; - - file->name = (FAR char*)malloc(alloclen + 1); - if (!file->name) - { - message("ERROR: Failed to allocate name, length=%d\n", namelen); - msgflush(); - exit(5); - } - - memcpy(file->name, g_mountdir, dirlen); - for (i = dirlen; i < alloclen; i++) - { - file->name[i] = nxffs_randchar(); - } - - file->name[alloclen] = '\0'; -} - -/**************************************************************************** - * Name: nxffs_randfile - ****************************************************************************/ - -static inline void nxffs_randfile(FAR struct nxffs_filedesc_s *file) -{ - int i; - - file->len = (rand() % CONFIG_EXAMPLES_NXFFS_MAXFILE) + 1; - for (i = 0; i < file->len; i++) - { - g_fileimage[i] = nxffs_randchar(); - } - file->crc = crc32(g_fileimage, file->len); -} - -/**************************************************************************** - * Name: nxffs_freefile - ****************************************************************************/ - -static void nxffs_freefile(FAR struct nxffs_filedesc_s *file) -{ - if (file->name) - { - free(file->name); - } - memset(file, 0, sizeof(struct nxffs_filedesc_s)); -} - -/**************************************************************************** - * Name: nxffs_wrfile - ****************************************************************************/ - -static inline int nxffs_wrfile(FAR struct nxffs_filedesc_s *file) -{ - size_t offset; - int fd; - int ret; - - /* Create a random file */ - - nxffs_randname(file); - nxffs_randfile(file); - fd = open(file->name, O_WRONLY | O_CREAT | O_EXCL, 0666); - if (fd < 0) - { - /* If it failed because there is no space on the device, then don't - * complain. - */ - - if (errno != ENOSPC) - { - message("ERROR: Failed to open file for writing: %d\n", errno); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - } - nxffs_freefile(file); - return ERROR; - } - - /* Write a random amount of data to the file */ - - for (offset = 0; offset < file->len; ) - { - size_t maxio = (rand() % CONFIG_EXAMPLES_NXFFS_MAXIO) + 1; - size_t nbytestowrite = file->len - offset; - ssize_t nbyteswritten; - - if (nbytestowrite > maxio) - { - nbytestowrite = maxio; - } - - nbyteswritten = write(fd, &g_fileimage[offset], nbytestowrite); - if (nbyteswritten < 0) - { - int err = errno; - - /* If the write failed because there is no space on the device, - * then don't complain. - */ - - if (err != ENOSPC) - { - message("ERROR: Failed to write file: %d\n", err); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - message(" Write offset: %d\n", offset); - message(" Write size: %d\n", nbytestowrite); - ret = ERROR; - } - close(fd); - - /* Remove any garbage file that might have been left behind */ - - ret = unlink(file->name); - if (ret < 0) - { - message(" Failed to remove partial file\n"); - } - else - { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 - message(" Successfully removed partial file\n"); -#endif - } - - nxffs_freefile(file); - return ERROR; - } - else if (nbyteswritten != nbytestowrite) - { - message("ERROR: Partial write:\n"); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - message(" Write offset: %d\n", offset); - message(" Write size: %d\n", nbytestowrite); - message(" Written: %d\n", nbyteswritten); - } - offset += nbyteswritten; - } - - close(fd); - return OK; -} - -/**************************************************************************** - * Name: nxffs_fillfs - ****************************************************************************/ - -static int nxffs_fillfs(void) -{ - FAR struct nxffs_filedesc_s *file; - int ret; - int i; - - /* Create a file for each unused file structure */ - - for (i = 0; i < CONFIG_EXAMPLES_NXFFS_MAXOPEN; i++) - { - file = &g_files[i]; - if (file->name == NULL) - { - ret = nxffs_wrfile(file); - if (ret < 0) - { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 - message("ERROR: Failed to write file %d\n", i); -#endif - return ERROR; - } - -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 - message(" Created file %s\n", file->name); -#endif - g_nfiles++; - } - } - - return OK; -} - -/**************************************************************************** - * Name: nxffs_rdblock - ****************************************************************************/ - -static ssize_t nxffs_rdblock(int fd, FAR struct nxffs_filedesc_s *file, - size_t offset, size_t len) -{ - size_t maxio = (rand() % CONFIG_EXAMPLES_NXFFS_MAXIO) + 1; - ssize_t nbytesread; - - if (len > maxio) - { - len = maxio; - } - - nbytesread = read(fd, &g_fileimage[offset], len); - if (nbytesread < 0) - { - message("ERROR: Failed to read file: %d\n", errno); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - message(" Read offset: %d\n", offset); - message(" Read size: %d\n", len); - return ERROR; - } - else if (nbytesread == 0) - { -#if 0 /* No... we do this on purpose sometimes */ - message("ERROR: Unexpected end-of-file:\n"); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - message(" Read offset: %d\n", offset); - message(" Read size: %d\n", len); -#endif - return ERROR; - } - else if (nbytesread != len) - { - message("ERROR: Partial read:\n"); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - message(" Read offset: %d\n", offset); - message(" Read size: %d\n", len); - message(" Bytes read: %d\n", nbytesread); - } - return nbytesread; -} - -/**************************************************************************** - * Name: nxffs_rdfile - ****************************************************************************/ - -static inline int nxffs_rdfile(FAR struct nxffs_filedesc_s *file) -{ - size_t ntotalread; - ssize_t nbytesread; - uint32_t crc; - int fd; - - /* Open the file for reading */ - - fd = open(file->name, O_RDONLY); - if (fd < 0) - { - if (!file->deleted) - { - message("ERROR: Failed to open file for reading: %d\n", errno); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - } - return ERROR; - } - - /* Read all of the data info the fileimage buffer using random read sizes */ - - for (ntotalread = 0; ntotalread < file->len; ) - { - nbytesread = nxffs_rdblock(fd, file, ntotalread, file->len - ntotalread); - if (nbytesread < 0) - { - close(fd); - return ERROR; - } - - ntotalread += nbytesread; - } - - /* Verify the file image CRC */ - - crc = crc32(g_fileimage, file->len); - if (crc != file->crc) - { - message("ERROR: Bad CRC: %d vs %d\n", crc, file->crc); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - close(fd); - return ERROR; - } - - /* Try reading past the end of the file */ - - nbytesread = nxffs_rdblock(fd, file, ntotalread, 1024) ; - if (nbytesread > 0) - { - message("ERROR: Read past the end of file\n"); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - message(" Bytes read: %d\n", nbytesread); - close(fd); - return ERROR; - } - - close(fd); - return OK; -} - -/**************************************************************************** - * Name: nxffs_verifyfs - ****************************************************************************/ - -static int nxffs_verifyfs(void) -{ - FAR struct nxffs_filedesc_s *file; - int ret; - int i; - - /* Create a file for each unused file structure */ - - for (i = 0; i < CONFIG_EXAMPLES_NXFFS_MAXOPEN; i++) - { - file = &g_files[i]; - if (file->name != NULL) - { - ret = nxffs_rdfile(file); - if (ret < 0) - { - if (file->deleted) - { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 - message("Deleted file %d OK\n", i); -#endif - nxffs_freefile(file); - g_ndeleted--; - g_nfiles--; - } - else - { - message("ERROR: Failed to read a file: %d\n", i); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - return ERROR; - } - } - else - { - if (file->deleted) - { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 - message("Succesffully read a deleted file\n"); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); -#endif - nxffs_freefile(file); - g_ndeleted--; - g_nfiles--; - return ERROR; - } - else - { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 - message(" Verifed file %s\n", file->name); -#endif - } - } - } - } - - return OK; -} - -/**************************************************************************** - * Name: nxffs_delfiles - ****************************************************************************/ - -static int nxffs_delfiles(void) -{ - FAR struct nxffs_filedesc_s *file; - int ndel; - int ret; - int i; - int j; - - /* Are there any files to be deleted? */ - - int nfiles = g_nfiles - g_ndeleted; - if (nfiles < 1) - { - return 0; - } - - /* Yes... How many files should we delete? */ - - ndel = (rand() % nfiles) + 1; - - /* Now pick which files to delete */ - - for (i = 0; i < ndel; i++) - { - /* Guess a file index */ - - int ndx = (rand() % (g_nfiles - g_ndeleted)); - - /* And delete the next undeleted file after that random index */ - - for (j = ndx + 1; j != ndx;) - { - file = &g_files[j]; - if (file->name && !file->deleted) - { - ret = unlink(file->name); - if (ret < 0) - { - message("ERROR: Unlink %d failed: %d\n", i+1, errno); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - message(" File index: %d\n", j); - } - else - { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 - message(" Deleted file %s\n", file->name); -#endif - file->deleted = true; - g_ndeleted++; - break; - } - } - - /* Increment the index and test for wrap-around */ - - if (++j >= CONFIG_EXAMPLES_NXFFS_MAXOPEN) - { - j = 0; - } - - } - } - - return OK; -} - -/**************************************************************************** - * Name: nxffs_delallfiles - ****************************************************************************/ - -static int nxffs_delallfiles(void) -{ - FAR struct nxffs_filedesc_s *file; - int ret; - int i; - - for (i = 0; i < CONFIG_EXAMPLES_NXFFS_MAXOPEN; i++) - { - file = &g_files[i]; - if (file->name) - { - ret = unlink(file->name); - if (ret < 0) - { - message("ERROR: Unlink %d failed: %d\n", i+1, errno); - message(" File name: %s\n", file->name); - message(" File size: %d\n", file->len); - message(" File index: %d\n", i); - } - else - { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 - message(" Deleted file %s\n", file->name); -#endif - nxffs_freefile(file); - } - } - } - - g_nfiles = 0; - g_ndeleted = 0; - return OK; -} - -/**************************************************************************** - * Name: nxffs_directory - ****************************************************************************/ - -static int nxffs_directory(void) -{ - DIR *dirp; - FAR struct dirent *entryp; - int number; - - /* Open the directory */ - - dirp = opendir(CONFIG_EXAMPLES_NXFFS_MOUNTPT); - - if (!dirp) - { - /* Failed to open the directory */ - - message("ERROR: Failed to open directory '%s': %d\n", - CONFIG_EXAMPLES_NXFFS_MOUNTPT, errno); - return ERROR; - } - - /* Read each directory entry */ - - message("Directory:\n"); - number = 1; - do - { - entryp = readdir(dirp); - if (entryp) - { - message("%2d. Type[%d]: %s Name: %s\n", - number, entryp->d_type, - entryp->d_type == DTYPE_FILE ? "File " : "Error", - entryp->d_name); - } - number++; - } - while (entryp != NULL); - - closedir(dirp); - return OK; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxffs_main - ****************************************************************************/ - -int nxffs_main(int argc, char *argv[]) -{ - FAR struct mtd_dev_s *mtd; - unsigned int i; - int ret; - - /* Seed the random number generated */ - - srand(0x93846); - - /* Create and initialize a RAM MTD device instance */ - -#ifdef CONFIG_EXAMPLES_NXFFS_ARCHINIT - mtd = nxffs_archinitialize(); -#else - mtd = rammtd_initialize(g_simflash, CONFIG_EXAMPLES_NXFFS_BUFSIZE); -#endif - if (!mtd) - { - message("ERROR: Failed to create RAM MTD instance\n"); - msgflush(); - exit(1); - } - - /* Initialize to provide NXFFS on an MTD interface */ - - ret = nxffs_initialize(mtd); - if (ret < 0) - { - message("ERROR: NXFFS initialization failed: %d\n", -ret); - msgflush(); - exit(2); - } - - /* Mount the file system */ - - ret = mount(NULL, CONFIG_EXAMPLES_NXFFS_MOUNTPT, "nxffs", 0, NULL); - if (ret < 0) - { - message("ERROR: Failed to mount the NXFFS volume: %d\n", errno); - msgflush(); - exit(3); - } - - /* Set up memory monitoring */ - -#ifdef CONFIG_CAN_PASS_STRUCTS - g_mmbefore = mallinfo(); - g_mmprevious = g_mmbefore; -#else - (void)mallinfo(&g_mmbefore); - memcpy(&g_mmprevious, &g_mmbefore, sizeof(struct mallinfo)); -#endif - - /* Loop a few times ... file the file system with some random, files, - * delete some files randomly, fill the file system with more random file, - * delete, etc. This beats the FLASH very hard! - */ - -#if CONFIG_EXAMPLES_NXFFS_NLOOPS == 0 - for (i = 0; ; i++) -#else - for (i = 1; i <= CONFIG_EXAMPLES_NXFFS_NLOOPS; i++) -#endif - { - /* Write a files to the NXFFS file system until either (1) all of the - * open file structures are utilized or until (2) NXFFS reports an error - * (hopefully that the file system is full) - */ - - message("\n=== FILLING %d =============================\n", i); - ret = nxffs_fillfs(); - message("Filled file system\n"); - message(" Number of files: %d\n", g_nfiles); - message(" Number deleted: %d\n", g_ndeleted); - nxffs_dump(mtd, CONFIG_EXAMPLES_NXFFS_VERBOSE); - - /* Directory listing */ - - nxffs_directory(); - - /* Verify all files written to FLASH */ - - ret = nxffs_verifyfs(); - if (ret < 0) - { - message("ERROR: Failed to verify files\n"); - message(" Number of files: %d\n", g_nfiles); - message(" Number deleted: %d\n", g_ndeleted); - } - else - { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 - message("Verified!\n"); - message(" Number of files: %d\n", g_nfiles); - message(" Number deleted: %d\n", g_ndeleted); -#endif - } - - /* Delete some files */ - - message("\n=== DELETING %d ============================\n", i); - ret = nxffs_delfiles(); - if (ret < 0) - { - message("ERROR: Failed to delete files\n"); - message(" Number of files: %d\n", g_nfiles); - message(" Number deleted: %d\n", g_ndeleted); - } - else - { - message("Deleted some files\n"); - message(" Number of files: %d\n", g_nfiles); - message(" Number deleted: %d\n", g_ndeleted); - } - nxffs_dump(mtd, CONFIG_EXAMPLES_NXFFS_VERBOSE); - - /* Directory listing */ - - nxffs_directory(); - - /* Verify all files written to FLASH */ - - ret = nxffs_verifyfs(); - if (ret < 0) - { - message("ERROR: Failed to verify files\n"); - message(" Number of files: %d\n", g_nfiles); - message(" Number deleted: %d\n", g_ndeleted); - } - else - { -#if CONFIG_EXAMPLES_NXFFS_VERBOSE != 0 - message("Verified!\n"); - message(" Number of files: %d\n", g_nfiles); - message(" Number deleted: %d\n", g_ndeleted); -#endif - } - - /* Show memory usage */ - - nxffs_loopmemusage(); - msgflush(); - } - - /* Delete all files then show memory usage again */ - - nxffs_delallfiles(); - nxffs_endmemusage(); - msgflush(); - return 0; -} - diff --git a/apps/examples/nxflat/Kconfig b/apps/examples/nxflat/Kconfig deleted file mode 100644 index a3f86488e..000000000 --- a/apps/examples/nxflat/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_NXFLAT - bool "NXFLAT example" - default n - ---help--- - Enable the NXFLAT example - -if EXAMPLES_NXFLAT -endif diff --git a/apps/examples/nxflat/Makefile b/apps/examples/nxflat/Makefile deleted file mode 100644 index 94092bd39..000000000 --- a/apps/examples/nxflat/Makefile +++ /dev/null @@ -1,101 +0,0 @@ -############################################################################ -# apps/examples/nxflat/Makefile -# -# Copyright (C) 2008, 2010-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# NXFLAT Example - -ASRCS = -CSRCS = nxflat_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: headers clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -headers: - @$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) - -.built: headers $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -# We can't make dependencies in this directory because the required -# header files may not yet exist. - -.depend: - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/nxflat/nxflat_main.c b/apps/examples/nxflat/nxflat_main.c deleted file mode 100644 index 536bc1dd8..000000000 --- a/apps/examples/nxflat/nxflat_main.c +++ /dev/null @@ -1,259 +0,0 @@ -/**************************************************************************** - * examples/nxflat/nxflat_main.c - * - * Copyright (C) 2009, 2011 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/compiler.h> - -#include <sys/mount.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <pthread.h> -#include <debug.h> -#include <errno.h> - -#include <nuttx/ramdisk.h> -#include <nuttx/binfmt/binfmt.h> -#include <nuttx/binfmt/nxflat.h> - -#include "tests/romfs.h" -#include "tests/dirlist.h" -#include "tests/symtab.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Check configuration. This is not all of the configuration settings that - * are required -- only the more obvious. - */ - -#if CONFIG_NFILE_DESCRIPTORS < 1 -# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" -#endif - -#ifdef CONFIG_BINFMT_DISABLE -# error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!" -#endif - -#ifndef CONFIG_NXFLAT -# error "You must select CONFIG_NXFLAT in your configuration file" -#endif - -#ifndef CONFIG_FS_ROMFS -# error "You must select CONFIG_FS_ROMFS in your configuration file" -#endif - -#ifdef CONFIG_DISABLE_MOUNTPOINT -# error "You must not disable mountpoints via CONFIG_DISABLE_MOUNTPOINT in your configuration file" -#endif - -#ifdef CONFIG_BINFMT_DISABLE -# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file" -#endif - -/* Describe the ROMFS file system */ - -#define SECTORSIZE 512 -#define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE) -#define ROMFSDEV "/dev/ram0" -#define MOUNTPT "/mnt/romfs" - -/* If CONFIG_DEBUG is enabled, use dbg instead of printf so that the - * output will be synchronous with the debug output. - */ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(format, arg...) dbg(format, ##arg) -# define err(format, arg...) dbg(format, ##arg) -# else -# define message(format, arg...) printf(format, ##arg) -# define err(format, arg...) fprintf(stderr, format, ##arg) -# endif -#else -# ifdef CONFIG_DEBUG -# define message dbg -# define err dbg -# else -# define message printf -# define err printf -# endif -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const char delimiter[] = - "****************************************************************************"; - -#ifndef CONFIG_BINFMT_EXEPATH -static char fullpath[128]; -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: testheader - ****************************************************************************/ - -static inline void testheader(FAR const char *progname) -{ - message("\n%s\n* Executing %s\n%s\n\n", delimiter, progname, delimiter); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxflat_main - ****************************************************************************/ - -int nxflat_main(int argc, char *argv[]) -{ - struct binary_s bin; - int ret; - int i; - - /* Initialize the NXFLAT binary loader */ - - message("Initializing the NXFLAT binary loader\n"); - ret = nxflat_initialize(); - if (ret < 0) - { - err("ERROR: Initialization of the NXFLAT loader failed: %d\n", ret); - exit(1); - } - - /* Create a ROM disk for the ROMFS filesystem */ - - message("Registering romdisk\n"); - ret = romdisk_register(0, (FAR uint8_t *)romfs_img, NSECTORS(romfs_img_len), SECTORSIZE); - if (ret < 0) - { - err("ERROR: romdisk_register failed: %d\n", ret); - nxflat_uninitialize(); - exit(1); - } - - /* Mount the file system */ - - message("Mounting ROMFS filesystem at target=%s with source=%s\n", - MOUNTPT, ROMFSDEV); - - ret = mount(ROMFSDEV, MOUNTPT, "romfs", MS_RDONLY, NULL); - if (ret < 0) - { - err("ERROR: mount(%s,%s,romfs) failed: %s\n", - ROMFSDEV, MOUNTPT, errno); - nxflat_uninitialize(); - } - - /* Does the system support the PATH variable? Has the PATH variable - * already been set? If YES and NO, then set the PATH variable to - * the ROMFS mountpoint. - */ - -#if defined(CONFIG_BINFMT_EXEPATH) && !defined(CONFIG_PATH_INITIAL) - (void)setenv("PATH", MOUNTPT, 1); -#endif - - /* Now excercise every progrm in the ROMFS file system */ - - for (i = 0; dirlist[i]; i++) - { - /* Output a seperated so that we can clearly discrinmate the output of - * this program from the others. - */ - - testheader(dirlist[i]); - - /* Initialize the binary_s structure */ - - memset(&bin, 0, sizeof(struct binary_s)); - - /* If the binary loader does not support the PATH variable, then - * create the full path to the executable program. Otherwise, - * use the relative path so that the binary loader will have to - * search the PATH variable to find the executable. - */ - -#ifdef CONFIG_BINFMT_EXEPATH - bin.filename = dirlist[i]; -#else - snprintf(fullpath, 128, "%s/%s", MOUNTPT, dirlist[i]); - bin.filename = fullpath; -#endif - bin.exports = exports; - bin.nexports = NEXPORTS; - - /* Load the NXFLAT module */ - - ret = load_module(&bin); - if (ret < 0) - { - err("ERROR: Failed to load program '%s'\n", dirlist[i]); - exit(1); - } - - /* Execute the ELF module */ - - ret = exec_module(&bin, 50); - if (ret < 0) - { - err("ERROR: Failed to execute program '%s'\n", dirlist[i]); - unload_module(&bin); - } - - message("Wait a bit for test completion\n"); - sleep(4); - } - - message("End-of-Test.. Exit-ing\n"); - return 0; -} diff --git a/apps/examples/nxflat/tests/Makefile b/apps/examples/nxflat/tests/Makefile deleted file mode 100644 index 4979c7fd4..000000000 --- a/apps/examples/nxflat/tests/Makefile +++ /dev/null @@ -1,103 +0,0 @@ -############################################################################ -# apps/examples/nxflat/tests/Makefile -# -# Copyright (C) 2009, 2011 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. -# -############################################################################ - -# Most of these do no build yet -#SUBDIRS = errno hello hello++ longjmp mutex pthread signal task struct -SUBDIRS = errno hello mutex pthread task struct - -NXFLAT_DIR = $(APPDIR)/examples/nxflat -TESTS_DIR = $(NXFLAT_DIR)/tests -ROMFS_DIR = $(TESTS_DIR)/romfs -ROMFS_IMG = $(TESTS_DIR)/romfs.img -ROMFS_HDR = $(TESTS_DIR)/romfs.h -ROMFS_DIRLIST = $(TESTS_DIR)/dirlist.h -SYMTAB = $(TESTS_DIR)/symtab.h - -define DIR_template -$(1)_$(2): - @$(MAKE) -C $(1) $(3) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" CROSSDEV=$(CROSSDEV) -endef - -all: $(ROMFS_HDR) $(ROMFS_DIRLIST) $(SYMTAB) -.PHONY: all build clean install populate - -$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),build, all))) -$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),clean,clean))) -$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),install,install))) - -# Build program(s) in each sud-directory - -build: $(foreach DIR, $(SUBDIRS), $(DIR)_build) - -# Install each program in the romfs directory - -install: $(foreach DIR, $(SUBDIRS), $(DIR)_install) - -# Create the romfs directory - -$(ROMFS_DIR): - @mkdir $(ROMFS_DIR) - -# Populate the romfs directory - -populate: $(ROMFS_DIR) build install - -# Create the romfs.img file from the populated romfs directory - -$(ROMFS_IMG): populate - @genromfs -f $@ -d $(ROMFS_DIR) -V "NXFLATTEST" - -# Create the romfs.h header file from the romfs.img file - -$(ROMFS_HDR) : $(ROMFS_IMG) - @(cd $(TESTS_DIR); xxd -i romfs.img | sed -e "s/^unsigned/static const unsigned/g" >$@) - -# Create the dirlist.h header file from the romfs directory - -$(ROMFS_DIRLIST) : populate - @$(TESTS_DIR)/mkdirlist.sh $(ROMFS_DIR) >$@ - -# Create the exported symbol table list from the derived *-thunk.S files - -$(SYMTAB): build - @$(TESTS_DIR)/mksymtab.sh $(TESTS_DIR) >$@ - -# Clean each subdirectory - -clean: $(foreach DIR, $(SUBDIRS), $(DIR)_clean) - @rm -f $(ROMFS_HDR) $(ROMFS_IMG) $(SYMTAB) - @rm -rf $(ROMFS_DIR) $(ROMFS_DIRLIST) - - diff --git a/apps/examples/nxflat/tests/errno/Makefile b/apps/examples/nxflat/tests/errno/Makefile deleted file mode 100644 index d8d75b227..000000000 --- a/apps/examples/nxflat/tests/errno/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################ -# examples/nxflat/tests/hello/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = errno - -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN) - diff --git a/apps/examples/nxflat/tests/errno/errno.c b/apps/examples/nxflat/tests/errno/errno.c deleted file mode 100644 index 08a15808a..000000000 --- a/apps/examples/nxflat/tests/errno/errno.c +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** - * examples/nxflat/tests/errno/errno.c - * - * Copyright (C) 2009 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 <stdio.h> -#include <stdlib.h> -#include <errno.h> - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -static const char g_nonexistent[] = "aflav-sautga-ay"; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - FILE *test_stream; - - /* Try using stdout and stderr explicitly. These are global variables - * exported from the base code. - */ - - fprintf(stdout, "Hello, World on stdout\n"); - fprintf(stderr, "Hello, World on stderr\n"); - - /* Try opening a non-existent file using buffered IO. */ - - test_stream = fopen(g_nonexistent, "r"); - if (test_stream) - { - fprintf(stderr, "Hmm... Delete \"%s\" and try this again\n", - g_nonexistent); - exit(1); - } - - /* Now print the errno on stderr. Errno is also a global - * variable exported by the base code. - */ - - fprintf(stderr, "We failed to open \"%s!\" errno is %d\n", - g_nonexistent, errno); - - return 0; -} diff --git a/apps/examples/nxflat/tests/hello++/Makefile b/apps/examples/nxflat/tests/hello++/Makefile deleted file mode 100644 index 739562905..000000000 --- a/apps/examples/nxflat/tests/hello++/Makefile +++ /dev/null @@ -1,189 +0,0 @@ -############################################################################ -# examples/nxflat/tests/hello/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN1 = hello++1 -BIN2 = hello++2 -BIN3 = hello++3 -#BIN4 = hello++4 -ALL_BIN = $(BIN1) $(BIN2) $(BIN3) $(BIN4) - -R1SRCS1 = $(BIN1).c -R1OBJS1 = $(R1SRCS1:.c=.o) -R2SRC1 = $(BIN1)-thunk.S -R2OBJ1 = $(R2SRC1:.S=.o) - -R1SRCS2 = $(BIN2).c -R1OBJS2 = $(R1SRCS2:.c=.o) -R2SRC2 = $(BIN2)-thunk.S -R2OBJ2 = $(R2SRC2:.S=.o) - -R1SRCS3 = $(BIN3).c -R1OBJS3 = $(R1SRCS3:.c=.o) -R2SRC3 = $(BIN3)-thunk.S -R2OBJ3 = $(R2SRC3:.S=.o) - -#R1SRCS4 = $(BIN4).c -#R1OBJS4 = $(R1SRCS4:.c=.o) -#R2SRC4 = $(BIN4)-thunk.S -#R2OBJ4 = $(R2SRC4:.S=.o) - -DERIVED = $(R2SRC1) $(R2SRC2) $(R2SRC3) $(R2SRC4) - -R1CXXOBJS = $(R1OBJS1) $(R1OBJS2) $(R1OBJS3) # $(R1OBJS4) -R2AOBJS = $(R2OBJ1) $(R2OBJ2) $(R2OBJ3) # $(R2OBJ4) - -LIBSTDC_STUBS_DIR = $(TOPDIR)/libxx -LIBSTDC_STUBS_LIB = $(LIBSTDC_STUBS_DIR)/liblibxx.a - -all: $(BIN1) $(BIN2) $(BIN3) # $(BIN4) - -$(R1CXXOBJS): %.o: %.cpp - @echo "CC: $<" - $(Q) $(CXX) -c $(CXXPICFLAGS) $< -o $@ - -$(R2AOBJS): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -# This contains libstdc++ stubs to that you can build C++ code -# without actually having libstdc++ - -$(LIBSTDC_STUBS_LIB): - $(Q) $(MAKE) -C $(LIBSTDC_STUBS_DIR) TOPDIR=$(TOPDIR) - -# BIN1 and BIN2 link just like C code because they contain no -# static constructors. BIN1 is equivalent to a C hello world; -# BIN2 contains a class that implements hello world, but it is -# not statically initialized. - -$(BIN1).r1: $(R1OBJS1) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC1): $(BIN1).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN1).r2: $(R2OBJ1) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS1) $(R2OBJ1) - -$(BIN1): $(BIN1).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -$(BIN2).r1: $(R1OBJS2) $(LIBSTDC_STUBS_LIB) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC2): $(BIN2).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN2).r2: $(R2OBJ2) - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS2) $(R2OBJ2) - -$(BIN2): $(BIN2).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -# BIN3 and BIN4 require that we include --cxx in the xflat-ld command. -# This will instruct xflat-ld that we want it to put together the correct -# startup files to handle the C++ static initializers. -# -# BIN3 is equivalent to BIN2 except that is uses static initializers - -$(BIN3).r1: $(R1OBJS3) $(LIBSTDC_STUBS_LIB) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC3): $(BIN3).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN3).r2: $(R2OBJ3) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS3) $(R2OBJ3) - -$(BIN3): $(BIN3).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -# BIN4 is similar to BIN3 except that it uses the streams code from libstdc++ -# -# NOTE: libstdc++ is not available for XFLAT as of this writing -# -#$(BIN4).r1: $(R1OBJS4) $(LIBSTDC_STUBS_LIB) -# @echo "LD: $<" -# $(LD) $(NXFLATLDFLAGS1) -o $@ $^ -# -#$(R2SRC4): $(BIN4).r1 -# @echo "MK: $<" -# $(MKNXFLAT) -o $@ $^ -# -#$(BIN4).r2: $(R2OBJ4)# @echo "LD: $<" -# $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS4) $(R2OBJ4) -# -#$(BIN4): $(BIN4).r2 -# @echo "LD: $<" -# $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN1)) - $(call DELFILE, $(BIN2)) - $(call DELFILE, $(BIN3)) - $(call DELFILE, $(BIN4)) - $(call DELFILE, $(R2SRC1)) - $(call DELFILE, $(R2SRC2)) - $(call DELFILE, $(R2SRC3)) - $(call DELFILE, $(R2SRC4)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: $(ALL_BIN) - $(Q) install -D $(BIN1) $(ROMFS_DIR)/$(BIN1) - $(Q) install -D $(BIN2) $(ROMFS_DIR)/$(BIN2) - $(Q) install -D $(BIN3) $(ROMFS_DIR)/$(BIN3) -# $(Q) install -D $(BIN4) $(ROMFS_DIR)/$(BIN4) - - - - - - - diff --git a/apps/examples/nxflat/tests/hello++/hello++1.cpp b/apps/examples/nxflat/tests/hello++/hello++1.cpp deleted file mode 100644 index 850c2fd4d..000000000 --- a/apps/examples/nxflat/tests/hello++/hello++1.cpp +++ /dev/null @@ -1,60 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// examples/nxflat/tests/hello++/hello++1.c -// -// Copyright (C) 2009 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. -// -///////////////////////////////////////////////////////////////////////////// -// -// This is an trivial version of "Hello, World" program. It illustrates -// that we can build C programs using the C++ compiler. -// -// - Building a C++ program to use the C library -// - No class creation -// - NO Streams -// - NO Static constructor and destructors -// -///////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// -// Included Files -///////////////////////////////////////////////////////////////////////////// - -#include <cstdio> - -///////////////////////////////////////////////////////////////////////////// -// Public Functions -///////////////////////////////////////////////////////////////////////////// - -int main(int argc, char **argv) -{ - printf("Hello, World!\n"); - return 0; -} diff --git a/apps/examples/nxflat/tests/hello++/hello++2.cpp b/apps/examples/nxflat/tests/hello++/hello++2.cpp deleted file mode 100644 index 3a1798a70..000000000 --- a/apps/examples/nxflat/tests/hello++/hello++2.cpp +++ /dev/null @@ -1,123 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// examples/nxflat/tests/hello++/hello++2.c -// -// Copyright (C) 2009 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. -// -///////////////////////////////////////////////////////////////////////////// -// -// This is an another trivial version of "Hello, World" design. It illustrates -// -// - Building a C++ program to use the C library -// - Basic class creation -// - NO Streams -// - NO Static constructor and destructors -// -///////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// -// Included Files -///////////////////////////////////////////////////////////////////////////// - -#include <cstdio> - -///////////////////////////////////////////////////////////////////////////// -// Classes -///////////////////////////////////////////////////////////////////////////// - -class CThingSayer -{ - const char *szWhatToSay; -public: - CThingSayer(void) - { - printf("CThingSayer::CThingSayer: I am!\n"); - szWhatToSay = (const char*)NULL; - } - - ~CThingSayer(void) - { - printf("CThingSayer::~CThingSayer: I cease to be\n"); - if (szWhatToSay) - { - printf("CThingSayer::~CThingSayer: I will never say '%s' again\n", - szWhatToSay); - } - szWhatToSay = (const char*)NULL; - } - - void Initialize(const char *czSayThis) - { - printf("CThingSayer::Initialize: When told, I will say '%s'\n", - czSayThis); - szWhatToSay = czSayThis; - } - - void SayThing(void) - { - printf("CThingSayer::SayThing: I am now saying '%s'\n", szWhatToSay); - } -}; - -///////////////////////////////////////////////////////////////////////////// -// Public Functions -///////////////////////////////////////////////////////////////////////////// - -int main(int argc, char **argv) -{ - CThingSayer *MyThingSayer; - - printf("main: Started. Creating MyThingSayer\n"); - - // Create an instance of the CThingSayer class - // We should see the message from constructor, CThingSayer::CThingSayer(), - - MyThingSayer = new CThingSayer; - printf("main: Created MyThingSayer=0x%08lx\n", (long)MyThingSayer); - - // Tell MyThingSayer that "Hello, World!" is the string to be said - - printf("main: Calling MyThingSayer->Initialize\n");; - MyThingSayer->Initialize("Hello, World!"); - - // Tell MyThingSayer to say the thing we told it to say - - printf("main: Calling MyThingSayer->SayThing\n");; - MyThingSayer->SayThing(); - - // We should see the message from the destructor, - // CThingSayer::~CThingSayer(), AFTER we see the following - - printf("main: Destroying MyThingSayer\n"); - delete MyThingSayer; - - printf("main: Returning\n");; - return 0; -} diff --git a/apps/examples/nxflat/tests/hello++/hello++3.cpp b/apps/examples/nxflat/tests/hello++/hello++3.cpp deleted file mode 100644 index b115010cf..000000000 --- a/apps/examples/nxflat/tests/hello++/hello++3.cpp +++ /dev/null @@ -1,132 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// examples/nxflat/tests/hello++/hello++3.c -// -// Copyright (C) 2009 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. -// -///////////////////////////////////////////////////////////////////////////// -// -// This is an another trivial version of "Hello, World" design. It illustrates -// -// - Building a C++ program to use the C library and stdio -// - Basic class creation with virtual methods. -// - Static constructor and destructors (in main program only) -// - NO Streams -// -///////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// -// Included Files -///////////////////////////////////////////////////////////////////////////// - -#include <cstdio> - -///////////////////////////////////////////////////////////////////////////// -// Classes -///////////////////////////////////////////////////////////////////////////// - -class CThingSayer -{ - const char *szWhatToSay; -public: - CThingSayer(void); - virtual ~CThingSayer(void); - virtual void Initialize(const char *czSayThis); - virtual void SayThing(void); -}; - -// A static instance of the CThingSayer class. This instance MUST -// be constructed by the system BEFORE the program is started at -// main() and must be destructed by the system AFTER the main() -// returns to the system - -static CThingSayer MyThingSayer; - -// These are implementations of the methods of the CThingSayer class - -CThingSayer::CThingSayer(void) -{ - printf("CThingSayer::CThingSayer: I am!\n"); - szWhatToSay = (const char*)NULL; -} - -CThingSayer::~CThingSayer(void) -{ - printf("CThingSayer::~CThingSayer: I cease to be\n"); - if (szWhatToSay) - { - printf("CThingSayer::~CThingSayer: I will never say '%s' again\n", - szWhatToSay); - } - szWhatToSay = (const char*)NULL; -} - -void CThingSayer::Initialize(const char *czSayThis) -{ - printf("CThingSayer::Initialize: When told, I will say '%s'\n", - czSayThis); - szWhatToSay = czSayThis; -} - -void CThingSayer::SayThing(void) -{ - printf("CThingSayer::SayThing: I am now saying '%s'\n", szWhatToSay); -} - -///////////////////////////////////////////////////////////////////////////// -// Public Functions -///////////////////////////////////////////////////////////////////////////// - -int main(int argc, char **argv) -{ - // We should see the message from constructor, CThingSayer::CThingSayer(), - // BEFORE we see the following messages. That is proof that the - // C++ static initializer is working - - printf("main: Started. MyThingSayer should already exist\n"); - - // Tell MyThingSayer that "Hello, World!" is the string to be said - - printf("main: Calling MyThingSayer.Initialize\n");; - MyThingSayer.Initialize("Hello, World!"); - - // Tell MyThingSayer to say the thing we told it to say - - printf("main: Calling MyThingSayer.SayThing\n");; - MyThingSayer.SayThing(); - - // We are finished, return. We should see the message from the - // destructor, CThingSayer::~CThingSayer(), AFTER we see the following - // message. That is proof that the C++ static destructor logic - // is working - - printf("main: Returning. MyThingSayer should be destroyed\n");; - return 0; -} diff --git a/apps/examples/nxflat/tests/hello++/hello++4.cpp b/apps/examples/nxflat/tests/hello++/hello++4.cpp deleted file mode 100644 index ac718386b..000000000 --- a/apps/examples/nxflat/tests/hello++/hello++4.cpp +++ /dev/null @@ -1,150 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// examples/nxflat/tests/hello++/hello++4.c -// -// Copyright (C) 2009 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. -// -///////////////////////////////////////////////////////////////////////////// -// -// This is an excessively complex version of "Hello, World" design to -// illustrate some basic properties of C++: -// -// - Building a C++ program -// - Streams / statically linked libstdc++ -// - Static constructor and destructors (in main program only) -// -///////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////////////////////////// -// Included Files -///////////////////////////////////////////////////////////////////////////// - -#include <cstdio> -#include <iostream> - -#ifndef NULL -# define NULL ((void*)0L) -#endif - -///////////////////////////////////////////////////////////////////////////// -// Classes -///////////////////////////////////////////////////////////////////////////// - -using namespace std; - -// A hello world sayer class - -class CThingSayer -{ - const char *szWhatToSay; -public: - CThingSayer(void); - virtual ~CThingSayer(void); - virtual void Initialize(const char *czSayThis); - virtual void SayThing(void); -}; - -///////////////////////////////////////////////////////////////////////////// -// Private Data -///////////////////////////////////////////////////////////////////////////// - -// A static instance of the CThingSayer class. This instance MUST -// be constructed by the system BEFORE the program is started at -// main() and must be destructed by the system AFTER the main() -// returns to the system - -static CThingSayer MyThingSayer; - -///////////////////////////////////////////////////////////////////////////// -// Method Implementations -///////////////////////////////////////////////////////////////////////////// - -// These are implementations of the methods of the CThingSayer class - -CThingSayer::CThingSayer(void) -{ - cout << "CThingSayer::CThingSayer: I am!" << endl; - szWhatToSay = (const char*)NULL; -} - -CThingSayer::~CThingSayer(void) -{ - cout << "CThingSayer::~CThingSayer: I cease to be" << endl; - if (szWhatToSay) - { - cout << "CThingSayer::~CThingSayer: I will never say '" - << szWhatToSay << "' again" << endl; - } - szWhatToSay = (const char*)NULL; -} - -void CThingSayer::Initialize(const char *czSayThis) -{ - cout << "CThingSayer::Initialize: When told, I will say '" - << czSayThis << "'" << endl; - szWhatToSay = czSayThis; -} - -void CThingSayer::SayThing(void) -{ - cout << "CThingSayer::SayThing: I am now saying '" - << szWhatToSay << "'" << endl; -} - -///////////////////////////////////////////////////////////////////////////// -// Public Functions -///////////////////////////////////////////////////////////////////////////// - -int main(int argc, char **argv) -{ - // We should see the message from constructor, CThingSayer::CThingSayer(), - // BEFORE we see the following messages. That is proof that the - // C++ static initializer is working - - cout << "main: Started" << endl; - - // Tell MyThingSayer that "Hello, World!" is the string to be said - - cout << "main: Calling MyThingSayer.Initialize" << endl; - MyThingSayer.Initialize("Hello, World!"); - - // Tell MyThingSayer to say the thing we told it to say - - cout << "main: Calling MyThingSayer.SayThing" << endl; - MyThingSayer.SayThing(); - - // We are finished, return. We should see the message from the - // destructor, CThingSayer::~CThingSayer(), AFTER we see the following - // message. That is proof that the C++ static destructor logic - // is working - - cout << "main: Returning" << endl; - return 0; -} diff --git a/apps/examples/nxflat/tests/hello/Makefile b/apps/examples/nxflat/tests/hello/Makefile deleted file mode 100644 index b4521a74e..000000000 --- a/apps/examples/nxflat/tests/hello/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################ -# examples/nxflat/tests/hello/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = hello - -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN) - diff --git a/apps/examples/nxflat/tests/hello/hello.c b/apps/examples/nxflat/tests/hello/hello.c deleted file mode 100644 index 8ec4e019a..000000000 --- a/apps/examples/nxflat/tests/hello/hello.c +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** - * examples/nxflat/tests/hello/hello.c - * - * Copyright (C) 2009 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 <stdio.h> -#include <stdlib.h> - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - int i; - - /* Mandatory "Hello, world!" */ - - puts("Getting ready to say \"Hello, world\"\n"); - printf("Hello, world!\n"); - puts("It has been said.\n"); - - /* Print arguments */ - - printf("argc\t= %d\n", argc); - printf("argv\t= 0x%p\n", argv); - - for (i = 0; i < argc; i++) - { - printf("argv[%d]\t= ", i); - if (argv[i]) - { - printf("(0x%p) \"%s\"\n", argv[i], argv[i]); - } - else - { - printf("NULL?\n"); - } - } - - printf("argv[%d]\t= 0x%p\n", argc, argv[argc]); - printf("Goodbye, world!\n"); - return 0; -} diff --git a/apps/examples/nxflat/tests/longjmp/Makefile b/apps/examples/nxflat/tests/longjmp/Makefile deleted file mode 100644 index 76d49417c..000000000 --- a/apps/examples/nxflat/tests/longjmp/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################ -# examples/nxflat/tests/longjmp/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = longjmp - -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN) - diff --git a/apps/examples/nxflat/tests/longjmp/longjmp.c b/apps/examples/nxflat/tests/longjmp/longjmp.c deleted file mode 100644 index f43096514..000000000 --- a/apps/examples/nxflat/tests/longjmp/longjmp.c +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** - * examples/nxflat/tests/longjmp/longjmp.c - * - * Copyright (C) 2009 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 <stdio.h> -#include <setjmp.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define MAIN_VAL 47 -#define FUNC_VAL 92 -#define LEAF_VAL 163 - -#define FUNCTION_ARG MAIN_VAL -#define LEAF_ARG (FUNCTION_ARG + FUNC_VAL) -#define SETJMP_RETURN (LEAF_ARG + LEAF_VAL) - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static jmp_buf env; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static int leaf(int *some_arg) -{ - int some_local_variable = *some_arg + LEAF_VAL; - - printf("leaf: received %d\n", *some_arg); - - if (*some_arg != LEAF_ARG) - printf("leaf: ERROR: expected %d\n", LEAF_ARG); - - printf("leaf: Calling longjmp() with %d\n", some_local_variable); - - longjmp(env, some_local_variable); - - /* We should not get here */ - - return -ERROR; -} - -static int function(int some_arg) -{ - int some_local_variable = some_arg + FUNC_VAL; - int retval; - - printf("function: received %d\n", some_arg); - - if (some_arg != FUNCTION_ARG) - printf("function: ERROR: expected %d\n", FUNCTION_ARG); - - printf("function: Calling leaf() with %d\n", some_local_variable); - - retval = leaf(&some_local_variable); - - printf("function: ERROR -- leaf returned!\n"); - return retval; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - int value; - - printf("main: Calling setjmp\n"); - value = setjmp(env); - printf("main: setjmp returned %d\n", value); - - if (value == 0) - { - printf("main: Normal setjmp return\n"); - printf("main: Calling function with %d\n", MAIN_VAL); - function(MAIN_VAL); - printf("main: ERROR -- function returned!\n"); - return 1; - } - else if (value != SETJMP_RETURN) - { - printf("main: ERROR: Expected %d\n", SETJMP_RETURN); - return 1; - } - else - { - printf("main: SUCCESS: setjmp return from longjmp call\n"); - return 0; - } -} - diff --git a/apps/examples/nxflat/tests/mkdirlist.sh b/apps/examples/nxflat/tests/mkdirlist.sh deleted file mode 100755 index cc55ac0b5..000000000 --- a/apps/examples/nxflat/tests/mkdirlist.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -usage="Usage: %0 <romfs-dir-path>" - -dir=$1 -if [ -z "$dir" ]; then - echo "ERROR: Missing <romfs-dir-path>" - echo "" - echo $usage - exit 1 -fi - -if [ ! -d "$dir" ]; then - echo "ERROR: Directory $dir does not exist" - echo "" - echo $usage - exit 1 -fi - -echo "#ifndef __EXAMPLES_NXFLAT_TESTS_DIRLIST_H" -echo "#define __EXAMPLES_NXFLAT_TESTS_DIRLIST_H" -echo "" -echo "static const char *dirlist[] =" -echo "{" - -for file in `ls $dir`; do - echo " \"$file\"," -done - -echo " NULL" -echo "};" -echo "" -echo "#endif /* __EXAMPLES_NXFLAT_TESTS_DIRLIST_H */" - - diff --git a/apps/examples/nxflat/tests/mksymtab.sh b/apps/examples/nxflat/tests/mksymtab.sh deleted file mode 100755 index 27abc4b41..000000000 --- a/apps/examples/nxflat/tests/mksymtab.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -usage="Usage: $0 <test-dir-path>" - -dir=$1 -if [ -z "$dir" ]; then - echo "ERROR: Missing <test-dir-path>" - echo "" - echo $usage - exit 1 -fi - -if [ ! -d "$dir" ]; then - echo "ERROR: Directory $dir does not exist" - echo "" - echo $usage - exit 1 -fi - -varlist=`find $dir -name "*-thunk.S"| xargs grep -h asciz | cut -f3 | sort | uniq` - -echo "#ifndef __EXAMPLES_NXFLAT_TESTS_SYMTAB_H" -echo "#define __EXAMPLES_NXFLAT_TESTS_SYMTAB_H" -echo "" -echo "#include <nuttx/binfmt/symtab.h>" -echo "" -echo "static const struct symtab_s exports[] = " -echo "{" - -for string in $varlist; do - var=`echo $string | sed -e "s/\"//g"` - echo " {$string, $var}," -done - -echo "};" -echo "#define NEXPORTS (sizeof(exports)/sizeof(struct symtab_s))" -echo "" -echo "#endif /* __EXAMPLES_NXFLAT_TESTS_SYMTAB_H */" - diff --git a/apps/examples/nxflat/tests/mutex/Makefile b/apps/examples/nxflat/tests/mutex/Makefile deleted file mode 100644 index d45c49ddd..000000000 --- a/apps/examples/nxflat/tests/mutex/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################ -# examples/nxflat/tests/mutex/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = mutex - -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN) - diff --git a/apps/examples/nxflat/tests/mutex/mutex.c b/apps/examples/nxflat/tests/mutex/mutex.c deleted file mode 100644 index 9a2d5f120..000000000 --- a/apps/examples/nxflat/tests/mutex/mutex.c +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** - * examples/nxflat/tests/mutex/mutex.c - * - * Copyright (C) 2009 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 <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <pthread.h> - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static pthread_mutex_t mut; -static volatile int my_mutex = 0; -static unsigned long nloops[2] = {0, 0}; -static unsigned long nerrors[2] = {0, 0}; -static volatile bool bendoftest; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/* NOTE: it is necessary for functions that are referred to by function pointers - * pointer to be declared with global scope (at least for ARM). Otherwise, - * a relocation type that is not supported by NXFLAT is generated by GCC. - */ - -void thread_func(void *parameter) -{ - int my_id = (int)parameter; - int my_ndx = my_id - 1; - int i; - - /* Loop 20 times. There is a 100 MS delay in the loop so this should - * take about 2 seconds. The main thread will stop this thread after - * 2 seconds by setting bendoftest in any event. - */ - - for (i = 0; i < 20 && !bendoftest; i++); - { - if ((pthread_mutex_lock(&mut)) != 0) - { - printf("ERROR thread %d: pthread_mutex_lock failed\n", my_id); - } - - if (my_mutex == 1) - { - printf("ERROR thread=%d: " - "my_mutex should be zero, instead my_mutex=%d\n", - my_id, my_mutex); - nerrors[my_ndx]++; - } - - my_mutex = 1; - usleep(100000); - my_mutex = 0; - - if ((pthread_mutex_unlock(&mut)) != 0) - { - printf("ERROR thread %d: pthread_mutex_unlock failed\n", my_id); - } - - nloops[my_ndx]++; - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - pthread_t thread1; - pthread_t thread2; - - /* Initialize the mutex */ - - pthread_mutex_init(&mut, NULL); - - /* Start two thread instances */ - - printf("Starting thread 1\n"); - bendoftest = false; - if ((pthread_create(&thread1, NULL, (void*)thread_func, (void*)1)) != 0) - { - fprintf(stderr, "Error in thread#1 creation\n"); - } - - printf("Starting thread 2\n"); - if ((pthread_create(&thread2, NULL, (void*)thread_func, (void*)2)) != 0) - { - fprintf(stderr, "Error in thread#2 creation\n"); - } - - /* Wait a bit for the threads to do their thing. */ - - sleep(2); - - /* Then ask them politely to stop running */ - - printf("Stopping threads\n"); - bendoftest = true; - pthread_join(thread1, NULL); - pthread_join(thread2, NULL); - - printf("\tThread1\tThread2\n"); - printf("Loops\t%ld\t%ld\n", nloops[0], nloops[1]); - printf("Errors\t%ld\t%ld\n", nerrors[0], nerrors[1]); - - return 0; -} - diff --git a/apps/examples/nxflat/tests/pthread/Makefile b/apps/examples/nxflat/tests/pthread/Makefile deleted file mode 100644 index fffb13dfb..000000000 --- a/apps/examples/nxflat/tests/pthread/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -############################################################################ -# examples/nxflat/tests/pthread/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/.config # Current configuration --include $(TOPDIR)/Make.defs # Basic make info - -BIN = pthread - -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN) - diff --git a/apps/examples/nxflat/tests/pthread/pthread.c b/apps/examples/nxflat/tests/pthread/pthread.c deleted file mode 100644 index f6e89e229..000000000 --- a/apps/examples/nxflat/tests/pthread/pthread.c +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** - * examples/nxflat/tests/pthread/pthread.c - * - * Copyright (C) 2009 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <pthread.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define CHILD_ARG ((void*)0x12345678) -#define CHILD_RET ((void*)0x87654321) - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -enum exit_values_e -{ - TESTRESULT_SUCCESS = 0, - TESTRESULT_PTHREAD_ATTR_INIT_FAIL, - TESTRESULT_PTHREAD_CREATE_FAIL, - TESTRESULT_PTHREAD_JOIN_FAIL, - TESTRESULT_CHILD_ARG_FAIL, - TESTRESULT_CHILD_RETVAL_FAIL, -}; - -/**************************************************************************** - * External Functions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/* NOTE: it is necessary for functions that are referred to by function pointers - * pointer to be declared with global scope (at least for ARM). Otherwise, - * a relocation type that is not supported by NXFLAT is generated by GCC. - */ - -void *child_start_routine(void *arg) -{ - printf("CHILD: started with arg=%d\n", (int)arg); - - if (arg != CHILD_ARG) - { - printf("CHILD: expected arg=%d\n", (int)CHILD_ARG); - return (void*)TESTRESULT_CHILD_ARG_FAIL; - } - sleep(2); - - printf("CHILD: returning %d\n", (int)CHILD_RET); - pthread_exit(CHILD_RET); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - pthread_attr_t attr; - pthread_t thread; - void *retval; - int status; - - puts("PARENT: started\n"); - - status = pthread_attr_init(&attr); - if (status != 0) - { - printf("PARENT: pthread_attr_init() returned %d\n", status); - exit(TESTRESULT_PTHREAD_ATTR_INIT_FAIL); - } - - printf("PARENT: calling pthread_start with arg=%d\n", (int)CHILD_ARG); - status = pthread_create(&thread, &attr, child_start_routine, CHILD_ARG); - if (status != 0) - { - printf("PARENT: pthread_create() returned %d\n", status); - exit(TESTRESULT_PTHREAD_CREATE_FAIL); - } - - status = pthread_join(thread, &retval); - if (status != 0) - { - printf("PARENT pthread_join() returned %d\n", status); - - exit(TESTRESULT_PTHREAD_JOIN_FAIL); - } - - printf("PARENT child exitted with %d\n", (int)retval); - if (retval != CHILD_RET) - { - printf("PARENT child thread did not exit with %d\n", (int)CHILD_RET); - exit(TESTRESULT_CHILD_RETVAL_FAIL); - } - - puts("PARENT returning success\n"); - return TESTRESULT_SUCCESS; -} diff --git a/apps/examples/nxflat/tests/signal/Makefile b/apps/examples/nxflat/tests/signal/Makefile deleted file mode 100644 index 372100030..000000000 --- a/apps/examples/nxflat/tests/signal/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################ -# examples/nxflat/tests/signal/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = signal - -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN) - diff --git a/apps/examples/nxflat/tests/signal/signal.c b/apps/examples/nxflat/tests/signal/signal.c deleted file mode 100644 index c5ea6bdcc..000000000 --- a/apps/examples/nxflat/tests/signal/signal.c +++ /dev/null @@ -1,265 +0,0 @@ -/**************************************************************************** - * examples/nxflat/tests/signal/signal.c - * - * Copyright (C) 2009, 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 <sys/types.h> - -#include <stdio.h> -#include <stdlib.h> -#include <signal.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#define USEC_PER_MSEC 1000 -#define MSEC_PER_SEC 1000 -#define USEC_PER_SEC (USEC_PER_MSEC * MSEC_PER_SEC) -#define SHORT_DELAY (USEC_PER_SEC / 3) - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static int sigusr1_rcvd = 0; -static int sigusr2_rcvd = 0; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: siguser_action - ***************************************************************************/ - -/* NOTE: it is necessary for functions that are referred to by function pointers - * pointer to be declared with global scope (at least for ARM). Otherwise, - * a relocation type that is not supported by ELF is generated by GCC. - */ - -void siguser_action(int signo, siginfo_t *siginfo, void *arg) -{ - printf("siguser_action: Received signo=%d siginfo=%p arg=%p\n", - signo, siginfo, arg); - - if (signo == SIGUSR1) - { - printf(" SIGUSR1 received\n"); - sigusr2_rcvd = 1; - } - else if (signo == SIGUSR2) - { - printf(" SIGUSR2 received\n"); - sigusr1_rcvd = 2; - } - else - { - printf(" ERROR: Unexpected signal\n"); - } - - if (siginfo) - { - printf("siginfo:\n"); - printf(" si_signo = %d\n", siginfo->si_signo); - printf(" si_code = %d\n", siginfo->si_code); - printf(" si_value = %d\n", siginfo->si_value.sival_int); - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: main - ****************************************************************************/ - -int main(int argc, char **argv) -{ - struct sigaction act; - struct sigaction oact1; - struct sigaction oact2; - pid_t mypid = getpid(); - union sigval sigval; - int status; - - printf("Setting up signal handlers from pid=%d\n", mypid); - - /* Set up so that siguser_action will respond to SIGUSR1 */ - - memset(&act, 0, sizeof(struct sigaction)); - act.sa_sigaction = siguser_action; - act.sa_flags = SA_SIGINFO; - - (void)sigemptyset(&act.sa_mask); - - status = sigaction(SIGUSR1, &act, &oact1); - if (status != 0) - { - fprintf(stderr, "Failed to install SIGUSR1 handler, errno=%d\n", - errno); - exit(2); - } - - printf("Old SIGUSR1 sighandler at %p\n", oact1.sa_handler); - printf("New SIGUSR1 sighandler at %p\n", siguser_action); - - /* Set up so that siguser_action will respond to SIGUSR2 */ - - status = sigaction(SIGUSR2, &act, &oact2); - if (status != 0) - { - fprintf(stderr, "Failed to install SIGUSR2 handler, errno=%d\n", - errno); - exit(2); - } - - printf("Old SIGUSR2 sighandler at %p\n", oact2.sa_handler); - printf("New SIGUSR2 sighandler at %p\n", siguser_action); - printf("Raising SIGUSR1 from pid=%d\n", mypid); - - fflush(stdout); usleep(SHORT_DELAY); - - /* Send SIGUSR1 to ourselves via kill() */ - - printf("Kill-ing SIGUSR1 from pid=%d\n", mypid); - status = kill(0, SIGUSR1); - if (status != 0) - { - fprintf(stderr, "Failed to kill SIGUSR1, errno=%d\n", errno); - exit(3); - } - - usleep(SHORT_DELAY); - printf("SIGUSR1 raised from pid=%d\n", mypid); - - /* Verify that we received SIGUSR1 */ - - if (sigusr1_rcvd == 0) - { - fprintf(stderr, "SIGUSR1 not received\n"); - exit(4); - } - - sigusr1_rcvd = 0; - - /* Send SIGUSR2 to ourselves */ - - printf("sigqueue-ing SIGUSR2 from pid=%d\n", mypid); - fflush(stdout); usleep(SHORT_DELAY); - - /* Send SIGUSR2 to ourselves via sigqueue() */ - - sigval.sival_int = 87; - status = sigqueue(mypid, SIGUSR2, sigval); - if (status != 0) - { - fprintf(stderr, "Failed to queue SIGUSR2, errno=%d\n", errno); - exit(5); - } - - usleep(SHORT_DELAY); - printf("SIGUSR2 queued from pid=%d, sigval=87\n", mypid); - - /* Verify that SIGUSR2 was received */ - - if (sigusr2_rcvd == 0) - { - fprintf(stderr, "SIGUSR2 not received\n"); - exit(6); - } - - sigusr2_rcvd = 0; - - /* Remove the siguser_action handler and replace the SIGUSR2 - * handler with sigusr2_sighandler. - */ - - printf("Resetting SIGUSR2 signal handler from pid=%d\n", mypid); - - status = sigaction(SIGUSR2, &oact2, &act); - if (status != 0) - { - fprintf(stderr, "Failed to install SIGUSR1 handler, errno=%d\n", - errno); - exit(2); - } - - printf("Old SIGUSR1 sighandler at %p\n", act.sa_handler); - printf("New SIGUSR1 sighandler at %p\n", oact1.sa_handler); - - /* Verify that the handler that was removed was siguser_action */ - - if ((void*)act.sa_handler != (void*)siguser_action) - { - fprintf(stderr, - "Old SIGUSR2 signal handler (%p) is not siguser_action (%p)\n", - act.sa_handler, siguser_action); - exit(8); - } - - /* Send SIGUSR2 to ourselves via kill() */ - - printf("Killing SIGUSR2 from pid=%d\n", mypid); - fflush(stdout); usleep(SHORT_DELAY); - - status = kill(mypid, SIGUSR2); - if (status != 0) - { - fprintf(stderr, "Failed to kill SIGUSR2, errno=%d\n", errno); - exit(9); - } - - usleep(SHORT_DELAY); - printf("SIGUSR2 killed from pid=%d\n", mypid); - - /* Verify that SIGUSR2 was received */ - - if (sigusr2_rcvd == 0) - { - fprintf(stderr, "SIGUSR2 not received\n"); - exit(10); - } - - sigusr2_rcvd = 0; - - return 0; -} diff --git a/apps/examples/nxflat/tests/struct/Makefile b/apps/examples/nxflat/tests/struct/Makefile deleted file mode 100644 index ff15256af..000000000 --- a/apps/examples/nxflat/tests/struct/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -############################################################################ -# examples/nxflat/tests/hello/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -CFLAGS += -I. - -BIN = struct - -R1SRCS = struct_main.c struct_dummy.c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN) - diff --git a/apps/examples/nxflat/tests/struct/struct.h b/apps/examples/nxflat/tests/struct/struct.h deleted file mode 100644 index bb31d8f71..000000000 --- a/apps/examples/nxflat/tests/struct/struct.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** - * examples/nxflat/tests/struct/struct.h - * - * Copyright (C) 2009 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 __EXAMPLES_NXFLAT_TESTS_STRUCT_STRUCT_H -#define __EXAMPLES_NXFLAT_TESTS_STRUCT_STRUCT_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#define DUMMY_SCALAR_VALUE1 42 -#define DUMMY_SCALAR_VALUE2 87 -#define DUMMY_SCALAR_VALUE3 117 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -typedef void (*dummy_t)(void); - -struct struct_dummy_s -{ - int n; /* This is a simple scalar value (DUMMY_SCALAR_VALUE3) */ -}; - -struct struct_s -{ - int n; /* This is a simple scalar value (DUMMY_SCALAR_VALUE1) */ - const int *pn; /* This is a pointer to a simple scalar value */ - const struct struct_dummy_s *ps; /* This is a pointer to a structure */ - dummy_t pf; /* This is a pointer to a function */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -extern int dummy_scalar; /* (DUMMY_SCALAR_VALUE2) */ -extern const struct struct_dummy_s dummy_struct; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -extern void dummyfunc(void); -extern const struct struct_s *getstruct(void); - -#endif /* __EXAMPLES_NXFLAT_TESTS_STRUCT_STRUCT_H */ - - diff --git a/apps/examples/nxflat/tests/struct/struct_dummy.c b/apps/examples/nxflat/tests/struct/struct_dummy.c deleted file mode 100644 index 80364b46b..000000000 --- a/apps/examples/nxflat/tests/struct/struct_dummy.c +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** - * examples/nxflat/tests/struct/struct_dummy.c - * - * Copyright (C) 2009 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 <stdio.h> -#include <stdlib.h> - -#include "struct.h" - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -const struct struct_s dummy = -{ - DUMMY_SCALAR_VALUE1, - &dummy_scalar, - &dummy_struct, - (dummy_t)dummyfunc -}; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -const struct struct_s *getstruct(void) -{ - return &dummy; -} - diff --git a/apps/examples/nxflat/tests/struct/struct_main.c b/apps/examples/nxflat/tests/struct/struct_main.c deleted file mode 100644 index 2d8b51a2c..000000000 --- a/apps/examples/nxflat/tests/struct/struct_main.c +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** - * examples/nxflat/tests/struct/struct_main.c - * - * Copyright (C) 2009 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 <stdio.h> -#include <stdlib.h> - -#include "struct.h" - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -const struct struct_dummy_s dummy_struct = -{ - DUMMY_SCALAR_VALUE3 -}; - -int dummy_scalar = DUMMY_SCALAR_VALUE2; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - const struct struct_s *mystruct = getstruct(); - - printf("Calling getstruct()\n"); - mystruct = getstruct(); - printf("getstruct returned %p\n", mystruct); - printf(" n = %d (vs %d) %s\n", - mystruct->n, DUMMY_SCALAR_VALUE1, - mystruct->n == DUMMY_SCALAR_VALUE1 ? "PASS" : "FAIL"); - - printf(" pn = %p (vs %p) %s\n", - mystruct->pn, &dummy_scalar, - mystruct->pn == &dummy_scalar ? "PASS" : "FAIL"); - if (mystruct->pn == &dummy_scalar) - { - printf(" *pn = %d (vs %d) %s\n", - *mystruct->pn, DUMMY_SCALAR_VALUE2, - *mystruct->pn == DUMMY_SCALAR_VALUE2 ? "PASS" : "FAIL"); - } - - printf(" ps = %p (vs %p) %s\n", - mystruct->ps, &dummy_struct, - mystruct->ps == &dummy_struct ? "PASS" : "FAIL"); - if (mystruct->ps == &dummy_struct) - { - printf(" ps->n = %d (vs %d) %s\n", - mystruct->ps->n, DUMMY_SCALAR_VALUE3, - mystruct->ps->n == DUMMY_SCALAR_VALUE3 ? "PASS" : "FAIL"); - } - - printf(" pf = %p (vs %p) %s\n", - mystruct->pf, dummyfunc, - mystruct->pf == dummyfunc ? "PASS" : "FAIL"); - if (mystruct->pf == dummyfunc) - { - printf("Calling mystruct->pf()\n"); - mystruct->pf(); - } - - printf("Exit-ing\n"); - return 0; -} - -void dummyfunc(void) -{ - printf("In dummyfunc() -- PASS\n"); -} - - diff --git a/apps/examples/nxflat/tests/task/Makefile b/apps/examples/nxflat/tests/task/Makefile deleted file mode 100644 index a528c60b7..000000000 --- a/apps/examples/nxflat/tests/task/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -############################################################################ -# examples/nxflat/tests/task/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = task - -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -D $(BIN) $(ROMFS_DIR)/$(BIN) - - diff --git a/apps/examples/nxflat/tests/task/task.c b/apps/examples/nxflat/tests/task/task.c deleted file mode 100644 index 192aa49b3..000000000 --- a/apps/examples/nxflat/tests/task/task.c +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** - * examples/nxflat/tests/task/parent.c - * - * Copyright (C) 2009 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 <sys/types.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sched.h> -#include <semaphore.h> -#include <errno.h> - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static char child_name[] = "child"; -static char child_arg[] = "Hello from your parent!"; -static sem_t g_sem; - -#if CONFIG_TASK_NAME_SIZE == 0 -static char no_name[] = "<noname>"; -#endif - -/**************************************************************************** - * Privite Functions - ****************************************************************************/ - -/* NOTE: it is necessary for functions that are referred to by function pointers - * pointer to be declared with global scope (at least for ARM). Otherwise, - * a relocation type that is not supported by NXFLAT is generated by GCC. - */ - - int child_task(int argc, char **argv) -{ - printf("Child: execv was successful!\n"); - printf("Child: argc=%d\n", argc); - - if (argc != 2) - { - printf("Child: expected argc to be 2\n"); - printf("Child: Exit-ting with status=2\n"); - exit(2); - } - printf("Child: argv[0]=\"%s\"\n", argv[0]); - -#if CONFIG_TASK_NAME_SIZE == 0 - if (strcmp(argv[0], no_name) != 0) - { - printf("Child: expected argv[0] to be \"%s\"\n", no_name); - printf("Child: Exit-ting with status=3\n"); - exit(3); - } -#else - if (strncmp(argv[0], child_name, CONFIG_TASK_NAME_SIZE) != 0) - { - printf("Child: expected argv[0] to be \"%s\"\n", child_name); - printf("Child: Exit-ting with status=3\n"); - exit(3); - } -#endif - - printf("Child: argv[1]=\"%s\"\n", argv[1]); - - if (strcmp(argv[1], child_arg) != 0) - { - printf("Child: expected argv[1] to be \"%s\"\n", child_arg); - printf("Child: Exit-ting with status=4\n"); - exit(4); - } - - printf("Child: Exit-ting with status=0\n"); - sem_post(&g_sem); - return 0; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char **argv) -{ - pid_t parent_pid = getpid(); - char *child_argv[2]; - pid_t child_pid; - - printf("Parent: Started, pid=%d\n", parent_pid); - - sem_init(&g_sem, 0, 0); - - printf("Parent: Calling task_create()\n"); - - child_argv[0] = child_arg; - child_argv[1] = 0; - child_pid = task_create(child_name, 50, 512, child_task, (const char**)child_argv); - if (child_pid < 0) - { - printf("Parent: task_create failed: %d\n", errno); - } - - printf("Parent: Waiting for child (pid=%d)\n", child_pid); - sem_wait(&g_sem); - printf("Parent: Exit-ing\n"); - sem_destroy(&g_sem); - return 0; -} - diff --git a/apps/examples/nxhello/Kconfig b/apps/examples/nxhello/Kconfig deleted file mode 100644 index 22f16c9b2..000000000 --- a/apps/examples/nxhello/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_NXHELLO - bool "NX graphics \"Hello, World!\" example" - default n - ---help--- - Enable the NX graphics \"Hello, World!\" example - -if EXAMPLES_HELLOXX -endif diff --git a/apps/examples/nxhello/Makefile b/apps/examples/nxhello/Makefile deleted file mode 100644 index b1ac6f116..000000000 --- a/apps/examples/nxhello/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################ -# apps/examples/nxhello/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# NuttX NX Graphics Example. - -ASRCS = -CSRCS = nxhello_main.c nxhello_bkgd.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# NXHELLO built-in application info - -APPNAME = nxhello -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_EXAMPLES_NXHELLO_BUILTIN),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/nxhello/nxhello.h b/apps/examples/nxhello/nxhello.h deleted file mode 100644 index 2dce7bf6c..000000000 --- a/apps/examples/nxhello/nxhello.h +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************** - * examples/nxhello/nxhello.h - * - * Copyright (C) 2011 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 __APPS_EXAMPLES_NXHELLO_NXHELLO_H -#define __APPS_EXAMPLES_NXHELLO_NXHELLO_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <stdbool.h> -#include <semaphore.h> - -#include <nuttx/nx/nxglib.h> -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxfonts.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_NX -# error "NX is not enabled (CONFIG_NX)" -#endif - -#ifndef CONFIG_EXAMPLES_NXHELLO_VPLANE -# define CONFIG_EXAMPLES_NXHELLO_VPLANE 0 -#endif - -#ifndef CONFIG_EXAMPLES_NXHELLO_BPP -# define CONFIG_EXAMPLES_NXHELLO_BPP 32 -#endif - -#ifndef CONFIG_EXAMPLES_NXHELLO_BGCOLOR -# if CONFIG_EXAMPLES_NXHELLO_BPP == 24 || CONFIG_EXAMPLES_NXHELLO_BPP == 32 -# define CONFIG_EXAMPLES_NXHELLO_BGCOLOR 0x007b68ee -# elif CONFIG_EXAMPLES_NXHELLO_BPP == 16 -# define CONFIG_EXAMPLES_NXHELLO_BGCOLOR 0x7b5d -# else -# define CONFIG_EXAMPLES_NXHELLO_BGCOLOR ' ' -# endif -#endif - -#ifndef CONFIG_EXAMPLES_NXHELLO_FONTID -# define CONFIG_EXAMPLES_NXHELLO_FONTID NXFONT_DEFAULT -#endif - -#ifndef CONFIG_EXAMPLES_NXHELLO_FONTCOLOR -# if CONFIG_EXAMPLES_NXHELLO_BPP == 24 || CONFIG_EXAMPLES_NXHELLO_BPP == 32 -# define CONFIG_EXAMPLES_NXHELLO_FONTCOLOR 0x00000000 -# elif CONFIG_EXAMPLES_NXHELLO_BPP == 16 -# define CONFIG_EXAMPLES_NXHELLO_FONTCOLOR 0x0000 -# else -# define CONFIG_EXAMPLES_NXHELLO_FONTCOLOR 'F' -# endif -#endif - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# define msgflush() -# else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define msgflush() -# else -# define message printf -# define msgflush() fflush(stdout) -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -enum exitcode_e -{ - NXEXIT_SUCCESS = 0, - NXEXIT_EXTINITIALIZE, - NXEXIT_FBINITIALIZE, - NXEXIT_FBGETVPLANE, - NXEXIT_LCDINITIALIZE, - NXEXIT_LCDGETDEV, - NXEXIT_NXOPEN, - NXEXIT_FONTOPEN, - NXEXIT_NXREQUESTBKGD, - NXEXIT_NXSETBGCOLOR -}; - -/* Describes one cached glyph bitmap */ - -struct nxhello_glyph_s -{ - uint8_t code; /* Character code */ - uint8_t height; /* Height of this glyph (in rows) */ - uint8_t width; /* Width of this glyph (in pixels) */ - uint8_t stride; /* Width of the glyph row (in bytes) */ - uint8_t usecnt; /* Use count */ - FAR uint8_t *bitmap; /* Allocated bitmap memory */ -}; - -/* Describes on character on the display */ - -struct nxhello_bitmap_s -{ - uint8_t code; /* Character code */ - uint8_t flags; /* See BMFLAGS_* */ - struct nxgl_point_s pos; /* Character position */ -}; - -struct nxhello_data_s -{ - /* The NX handles */ - - NXHANDLE hnx; - NXHANDLE hbkgd; - NXHANDLE hfont; - - /* The screen resolution */ - - nxgl_coord_t xres; - nxgl_coord_t yres; - - volatile bool havepos; - sem_t sem; - volatile int code; -}; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/* NXHELLO state data */ - -extern struct nxhello_data_s g_nxhello; - -/* NX callback vtables */ - -extern const struct nx_callback_s g_nxhellocb; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NXHELLO_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif - -/* Background window interfaces */ - -extern void nxhello_hello(NXWINDOW hwnd); - -#endif /* __APPS_EXAMPLES_NXHELLO_NXHELLO_H */ diff --git a/apps/examples/nxhello/nxhello_bkgd.c b/apps/examples/nxhello/nxhello_bkgd.c deleted file mode 100644 index ad1b99d24..000000000 --- a/apps/examples/nxhello/nxhello_bkgd.c +++ /dev/null @@ -1,443 +0,0 @@ -/**************************************************************************** - * examples/nxhello/nxhello_bkgd.c - * - * Copyright (C) 2011 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 <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <semaphore.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> -#include <nuttx/nx/nxfonts.h> - -#include "nxhello.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Select renderer -- Some additional logic would be required to support - * pixel depths that are not directly addressable (1,2,4, and 24). - */ - -#if CONFIG_EXAMPLES_NXHELLO_BPP == 1 -# define RENDERER nxf_convert_1bpp -#elif CONFIG_EXAMPLES_NXHELLO_BPP == 2 -# define RENDERER nxf_convert_2bpp -#elif CONFIG_EXAMPLES_NXHELLO_BPP == 4 -# define RENDERER nxf_convert_4bpp -#elif CONFIG_EXAMPLES_NXHELLO_BPP == 8 -# define RENDERER nxf_convert_8bpp -#elif CONFIG_EXAMPLES_NXHELLO_BPP == 16 -# define RENDERER nxf_convert_16bpp -#elif CONFIG_EXAMPLES_NXHELLO_BPP == 24 -# define RENDERER nxf_convert_24bpp -#elif CONFIG_EXAMPLES_NXHELLO_BPP == 32 -# define RENDERER nxf_convert_32bpp -#else -# error "Unsupported CONFIG_EXAMPLES_NXHELLO_BPP" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static void nxhello_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool morem, FAR void *arg); -static void nxhello_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg); -#ifdef CONFIG_NX_MOUSE -static void nxhello_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg); -#endif - -#ifdef CONFIG_NX_KBD -static void nxhello_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg); -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const char g_hello[] = "Hello, World!"; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* Background window call table */ - -const struct nx_callback_s g_nxhellocb = -{ - nxhello_redraw, /* redraw */ - nxhello_position /* position */ -#ifdef CONFIG_NX_MOUSE - , nxhello_mousein /* mousein */ -#endif -#ifdef CONFIG_NX_KBD - , nxhello_kbdin /* my kbdin */ -#endif -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxhello_redraw - ****************************************************************************/ - -static void nxhello_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg) -{ - gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", - hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, - more ? "true" : "false"); -} - -/**************************************************************************** - * Name: nxhello_position - ****************************************************************************/ - -static void nxhello_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg) -{ - /* Report the position */ - - gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", - hwnd, size->w, size->h, pos->x, pos->y, - bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); - - /* Have we picked off the window bounds yet? */ - - if (!g_nxhello.havepos) - { - /* Save the background window handle */ - - g_nxhello.hbkgd = hwnd; - - /* Save the window limits */ - - g_nxhello.xres = bounds->pt2.x + 1; - g_nxhello.yres = bounds->pt2.y + 1; - - g_nxhello.havepos = true; - sem_post(&g_nxhello.sem); - gvdbg("Have xres=%d yres=%d\n", g_nxhello.xres, g_nxhello.yres); - } -} - -/**************************************************************************** - * Name: nxhello_mousein - ****************************************************************************/ - -#ifdef CONFIG_NX_MOUSE -static void nxhello_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg) -{ - message("nxhello_mousein: hwnd=%p pos=(%d,%d) button=%02x\n", - hwnd, pos->x, pos->y, buttons); -} -#endif - -/**************************************************************************** - * Name: nxhello_kbdin - ****************************************************************************/ - -#ifdef CONFIG_NX_KBD -static void nxhello_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg) -{ - gvdbg("hwnd=%p nch=%d\n", hwnd, nch); - - /* In this example, there is no keyboard so a keyboard event is not - * expected. - */ - - message("nxhello_kbdin: Unexpected keyboard callback\n"); -} -#endif - -/**************************************************************************** - * Name: nxhello_center - ****************************************************************************/ - -static void nxhello_center(FAR struct nxgl_point_s *pos, - FAR const struct nx_font_s *fontset) -{ - FAR const struct nx_fontbitmap_s *fbm; - FAR uint8_t *ptr; - unsigned int width; - - /* Get the width of the collection of characters so that we can center the - * hello world message. - */ - - for (ptr = (uint8_t*)g_hello, width = 0; *ptr; ptr++) - { - /* Get the font bitmap for this character */ - - fbm = nxf_getbitmap(g_nxhello.hfont, *ptr); - if (fbm) - { - /* Add the font size */ - - width += fbm->metric.width + fbm->metric.xoffset; - } - else - { - /* Use the width of a space */ - - width += fontset->spwidth; - } - } - - /* Now we know how to center the string. Create a the position and - * the bounding box - */ - - pos->x = (g_nxhello.xres - width) / 2; - pos->y = (g_nxhello.yres - fontset->mxheight) / 2; -} - -/**************************************************************************** - * Name: nxhello_initglyph - ****************************************************************************/ - -static void nxhello_initglyph(FAR uint8_t *glyph, uint8_t height, - uint8_t width, uint8_t stride) -{ - FAR nxgl_mxpixel_t *ptr; -#if CONFIG_EXAMPLES_NXHELLO_BPP < 8 - nxgl_mxpixel_t pixel; -#endif - unsigned int row; - unsigned int col; - - /* Initialize the glyph memory to the background color */ - -#if CONFIG_EXAMPLES_NXHELLO_BPP < 8 - - pixel = CONFIG_EXAMPLES_NXHELLO_BGCOLOR; - -#if CONFIG_NX_NPLANES > 1 -# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" -#endif -# if CONFIG_EXAMPLES_NXHELLO_BPP == 1 - /* Pack 1-bit pixels into a 2-bits */ - - pixel &= 0x01; - pixel = (pixel) << 1 |pixel; - -# endif -# if CONFIG_EXAMPLES_NXHELLO_BPP < 4 - - /* Pack 2-bit pixels into a nibble */ - - pixel &= 0x03; - pixel = (pixel) << 2 |pixel; - -# endif - - /* Pack 4-bit nibbles into a byte */ - - pixel &= 0x0f; - pixel = (pixel) << 4 | pixel; - - ptr = (FAR nxgl_mxpixel_t *)glyph; - for (row = 0; row < fheight; row++) - { - for (col = 0; col < stride; col++) - { - /* Transfer the packed bytes into the buffer */ - - *ptr++ = pixel; - } - } - -#elif CONFIG_EXAMPLES_NXHELLO_BPP == 24 -# error "Additional logic is needed here for 24bpp support" - -#else /* CONFIG_EXAMPLES_NXHELLO_BPP = {8,16,32} */ - - ptr = (FAR nxgl_mxpixel_t *)glyph; - for (row = 0; row < height; row++) - { - /* Just copy the color value into the glyph memory */ - - for (col = 0; col < width; col++) - { - *ptr++ = CONFIG_EXAMPLES_NXHELLO_BGCOLOR; -#if CONFIG_NX_NPLANES > 1 -# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" -#endif - } - } -#endif -} - - /**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxhello_hello - * - * Description: - * Print "Hello, World!" in the center of the display. - * - ****************************************************************************/ - -void nxhello_hello(NXWINDOW hwnd) -{ - FAR const struct nx_font_s *fontset; - FAR const struct nx_fontbitmap_s *fbm; - FAR uint8_t *glyph; - FAR const char *ptr; - FAR struct nxgl_point_s pos; - FAR struct nxgl_rect_s dest; - FAR const void *src[CONFIG_NX_NPLANES]; - unsigned int glyphsize; - unsigned int mxstride; - int ret; - - /* Get information about the font we are going to use */ - - fontset = nxf_getfontset(g_nxhello.hfont); - - /* Allocate a bit of memory to hold the largest rendered font */ - - mxstride = (fontset->mxwidth * CONFIG_EXAMPLES_NXHELLO_BPP + 7) >> 3; - glyphsize = (unsigned int)fontset->mxheight * mxstride; - glyph = (FAR uint8_t*)malloc(glyphsize); - - /* NOTE: no check for failure to allocate the memory. In a real application - * you would need to handle that event. - */ - - /* Get a position so the the "Hello, World!" string will be centered on the - * display. - */ - - nxhello_center(&pos, fontset); - message("nxhello_hello: Position (%d,%d)\n", pos.x, pos.y); - - /* Now we can say "hello" in the center of the display. */ - - for (ptr = g_hello; *ptr; ptr++) - { - /* Get the bitmap font for this ASCII code */ - - fbm = nxf_getbitmap(g_nxhello.hfont, *ptr); - if (fbm) - { - uint8_t fheight; /* Height of this glyph (in rows) */ - uint8_t fwidth; /* Width of this glyph (in pixels) */ - uint8_t fstride; /* Width of the glyph row (in bytes) */ - - /* Get information about the font bitmap */ - - fwidth = fbm->metric.width + fbm->metric.xoffset; - fheight = fbm->metric.height + fbm->metric.yoffset; - fstride = (fwidth * CONFIG_EXAMPLES_NXHELLO_BPP + 7) >> 3; - - /* Initialize the glyph memory to the background color */ - - nxhello_initglyph(glyph, fheight, fwidth, fstride); - - /* Then render the glyph into the allocated memory */ - -#if CONFIG_NX_NPLANES > 1 -# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" -#endif - (void)RENDERER((FAR nxgl_mxpixel_t*)glyph, fheight, fwidth, - fstride, fbm, CONFIG_EXAMPLES_NXHELLO_FONTCOLOR); - - /* Describe the destination of the font with a rectangle */ - - dest.pt1.x = pos.x; - dest.pt1.y = pos.y; - dest.pt2.x = pos.x + fwidth - 1; - dest.pt2.y = pos.y + fheight - 1; - - /* Then put the font on the display */ - - src[0] = (FAR const void *)glyph; -#if CONFIG_NX_NPLANES > 1 -# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" -#endif - ret = nx_bitmap((NXWINDOW)hwnd, &dest, src, &pos, fstride); - if (ret < 0) - { - message("nxhello_write: nx_bitmapwindow failed: %d\n", errno); - } - - /* Skip to the right the width of the font */ - - pos.x += fwidth; - } - else - { - /* No bitmap (probably because the font is a space). Skip to the - * right the width of a space. - */ - - pos.x += fontset->spwidth; - } - } - - /* Free the allocated glyph */ - - free(glyph); -} diff --git a/apps/examples/nxhello/nxhello_main.c b/apps/examples/nxhello/nxhello_main.c deleted file mode 100644 index 6ee6c69b2..000000000 --- a/apps/examples/nxhello/nxhello_main.c +++ /dev/null @@ -1,286 +0,0 @@ -/**************************************************************************** - * examples/nxhello/nxhello_main.c - * - * Copyright (C) 2011 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 <stdint.h> -#include <stdbool.h> -#include <stdio.h> -#include <unistd.h> -#include <time.h> -#include <string.h> -#include <sched.h> -#include <pthread.h> -#include <errno.h> -#include <debug.h> - -#ifdef CONFIG_NX_LCDDRIVER -# include <nuttx/lcd/lcd.h> -#else -# include <nuttx/fb.h> -#endif - -#include <nuttx/arch.h> -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> -#include <nuttx/nx/nxfonts.h> - -#include "nxhello.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ -/* If not specified, assume that the hardware supports one video plane */ - -#ifndef CONFIG_EXAMPLES_NXHELLO_VPLANE -# define CONFIG_EXAMPLES_NXHELLO_VPLANE 0 -#endif - -/* If not specified, assume that the hardware supports one LCD device */ - -#ifndef CONFIG_EXAMPLES_NXHELLO_DEVNO -# define CONFIG_EXAMPLES_NXHELLO_DEVNO 0 -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -struct nxhello_data_s g_nxhello = -{ - NULL, /* hnx */ - NULL, /* hbkgd */ - NULL, /* hfont */ - 0, /* xres */ - 0, /* yres */ - false, /* havpos */ - { 0 }, /* sem */ - NXEXIT_SUCCESS /* exit code */ -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxhello_initialize - ****************************************************************************/ - -static inline int nxhello_initialize(void) -{ - FAR NX_DRIVERTYPE *dev; - -#if defined(CONFIG_EXAMPLES_NXHELLO_EXTERNINIT) - /* Use external graphics driver initialization */ - - message("nxhello_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXHELLO_DEVNO); - if (!dev) - { - message("nxhello_initialize: up_nxdrvinit failed, devno=%d\n", - CONFIG_EXAMPLES_NXHELLO_DEVNO); - g_nxhello.code = NXEXIT_EXTINITIALIZE; - return ERROR; - } - -#elif defined(CONFIG_NX_LCDDRIVER) - int ret; - - /* Initialize the LCD device */ - - message("nxhello_initialize: Initializing LCD\n"); - ret = up_lcdinitialize(); - if (ret < 0) - { - message("nxhello_initialize: up_lcdinitialize failed: %d\n", -ret); - g_nxhello.code = NXEXIT_LCDINITIALIZE; - return ERROR; - } - - /* Get the device instance */ - - dev = up_lcdgetdev(CONFIG_EXAMPLES_NXHELLO_DEVNO); - if (!dev) - { - message("nxhello_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXHELLO_DEVNO); - g_nxhello.code = NXEXIT_LCDGETDEV; - return ERROR; - } - - /* Turn the LCD on at 75% power */ - - (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); -#else - int ret; - - /* Initialize the frame buffer device */ - - message("nxhello_initialize: Initializing framebuffer\n"); - ret = up_fbinitialize(); - if (ret < 0) - { - message("nxhello_initialize: up_fbinitialize failed: %d\n", -ret); - g_nxhello.code = NXEXIT_FBINITIALIZE; - return ERROR; - } - - dev = up_fbgetvplane(CONFIG_EXAMPLES_NXHELLO_VPLANE); - if (!dev) - { - message("nxhello_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXHELLO_VPLANE); - g_nxhello.code = NXEXIT_FBGETVPLANE; - return ERROR; - } -#endif - - /* Then open NX */ - - message("nxhello_initialize: Open NX\n"); - g_nxhello.hnx = nx_open(dev); - if (!g_nxhello.hnx) - { - message("nxhello_initialize: nx_open failed: %d\n", errno); - g_nxhello.code = NXEXIT_NXOPEN; - return ERROR; - } - return OK; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxhello_main - ****************************************************************************/ - -int nxhello_main(int argc, char *argv[]) -{ - nxgl_mxpixel_t color; - int ret; - - /* Initialize NX */ - - ret = nxhello_initialize(); - message("nxhello_main: NX handle=%p\n", g_nxhello.hnx); - if (!g_nxhello.hnx || ret < 0) - { - message("nxhello_main: Failed to get NX handle: %d\n", errno); - g_nxhello.code = NXEXIT_NXOPEN; - goto errout; - } - - /* Get the default font handle */ - - g_nxhello.hfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXHELLO_FONTID); - if (!g_nxhello.hfont) - { - message("nxhello_main: Failed to get font handle: %d\n", errno); - g_nxhello.code = NXEXIT_FONTOPEN; - goto errout; - } - - /* Set the background to the configured background color */ - - message("nxhello_main: Set background color=%d\n", - CONFIG_EXAMPLES_NXHELLO_BGCOLOR); - - color = CONFIG_EXAMPLES_NXHELLO_BGCOLOR; - ret = nx_setbgcolor(g_nxhello.hnx, &color); - if (ret < 0) - { - message("nxhello_main: nx_setbgcolor failed: %d\n", errno); - g_nxhello.code = NXEXIT_NXSETBGCOLOR; - goto errout_with_nx; - } - - /* Get the background window */ - - ret = nx_requestbkgd(g_nxhello.hnx, &g_nxhellocb, NULL); - if (ret < 0) - { - message("nxhello_main: nx_setbgcolor failed: %d\n", errno); - g_nxhello.code = NXEXIT_NXREQUESTBKGD; - goto errout_with_nx; - } - - /* Wait until we have the screen resolution. We'll have this immediately - * unless we are dealing with the NX server. - */ - - while (!g_nxhello.havepos) - { - (void)sem_wait(&g_nxhello.sem); - } - message("nxhello_main: Screen resolution (%d,%d)\n", g_nxhello.xres, g_nxhello.yres); - - /* Now, say hello and exit, sleeping a little before each. */ - - sleep(1); - nxhello_hello(g_nxhello.hbkgd); - sleep(1); - - /* Release background */ - - (void)nx_releasebkgd(g_nxhello.hbkgd); - - /* Close NX */ - -errout_with_nx: - message("nxhello_main: Close NX\n"); - nx_close(g_nxhello.hnx); -errout: - return g_nxhello.code; -} diff --git a/apps/examples/nximage/Kconfig b/apps/examples/nximage/Kconfig deleted file mode 100644 index e1d84a867..000000000 --- a/apps/examples/nximage/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_NXIMAGE - bool "NX graphics image example" - default n - ---help--- - Enable the X graphics image example - -if EXAMPLES_NXIMAGE -endif diff --git a/apps/examples/nximage/Makefile b/apps/examples/nximage/Makefile deleted file mode 100644 index e2e9201e7..000000000 --- a/apps/examples/nximage/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################ -# apps/examples/nximage/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# NuttX NX Graphics Example. - -ASRCS = -CSRCS = nximage_main.c nximage_bkgd.c nximage_bitmap.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# NXIMAGE built-in application info - -APPNAME = nximage -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_EXAMPLES_NXIMAGE_BUILTIN),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/nximage/nximage.h b/apps/examples/nximage/nximage.h deleted file mode 100644 index eac0f5dc2..000000000 --- a/apps/examples/nximage/nximage.h +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************************** - * examples/nximage/nximage.h - * - * Copyright (C) 2011 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 __APPS_EXAMPLES_NXIMAGE_NXIMAGE_H -#define __APPS_EXAMPLES_NXIMAGE_NXIMAGE_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <stdbool.h> -#include <semaphore.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_NX -# error "NX is not enabled (CONFIG_NX)" -#endif - -#ifndef CONFIG_EXAMPLES_NXIMAGE_VPLANE -# define CONFIG_EXAMPLES_NXIMAGE_VPLANE 0 -#endif - -#ifndef CONFIG_EXAMPLES_NXIMAGE_BPP -# define CONFIG_EXAMPLES_NXIMAGE_BPP 16 -#endif - -#if defined(CONFIG_EXAMPLES_NXIMAGE_XSCALEp5) -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0 -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5 -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0 -#elif defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5) -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALEp5 -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0 -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0 -#elif defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0) -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALEp5 -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0 -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5 -#else -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALEp5 -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0 -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5 -# undef CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0 -# define CONFIG_EXAMPLES_NXIMAGE_XSCALE1p0 1 -#endif - -#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALEp5) -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p0 -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5 -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0 -#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALEp5 -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p0 -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0 -#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0) -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALEp5 -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p0 -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5 -#else -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALEp5 -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p0 -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5 -# undef CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0 -# define CONFIG_EXAMPLES_NXIMAGE_YSCALE1p0 1 -#endif - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# define msgflush() -# else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define msgflush() -# else -# define message printf -# define msgflush() fflush(stdout) -# endif -#endif - -/* Image Information ********************************************************/ - -#define IMAGE_HEIGHT 160 /* Number of rows in the raw image */ -#define IMAGE_WIDTH 160 /* Number of columns in the raw image */ - -#if defined(CONFIG_EXAMPLES_NXIMAGE_XSCALEp5) -# define SCALED_WIDTH 80 /* Number of columns in the scaled image */ -#elif defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5) -# define SCALED_WIDTH 240 /* Number of columns in the scaled image */ -#elif defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0) -# define SCALED_WIDTH 320 /* Number of columns in the scaled image */ -#else -# define SCALED_WIDTH 160 /* Number of columns in the scaled image */ -#endif - -#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALEp5) -# define SCALED_HEIGHT 80 /* Number of rows in the scaled image */ -#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) -# define SCALED_HEIGHT 240 /* Number of rows in the scaled image */ -#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0) -# define SCALED_HEIGHT 320 /* Number of rows in the scaled image */ -#else -# define SCALED_HEIGHT 160 /* Number of rows in the scaled image */ -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -enum exitcode_e -{ - NXEXIT_SUCCESS = 0, - NXEXIT_EXTINITIALIZE, - NXEXIT_FBINITIALIZE, - NXEXIT_FBGETVPLANE, - NXEXIT_LCDINITIALIZE, - NXEXIT_LCDGETDEV, - NXEXIT_NXOPEN, - NXEXIT_NXREQUESTBKGD, - NXEXIT_NXSETBGCOLOR -}; - -struct nximage_data_s -{ - /* The NX handles */ - - NXHANDLE hnx; - NXHANDLE hbkgd; - - /* The screen resolution */ - - nxgl_coord_t xres; - nxgl_coord_t yres; - - volatile bool havepos; - sem_t sem; - volatile int code; -}; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/* NXIMAGE state data */ - -extern struct nximage_data_s g_nximage; - -/* NX callback vtables */ - -extern const struct nx_callback_s g_nximagecb; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif - -/* Background window interfaces */ - -extern void nximage_image(NXWINDOW hwnd); - -/* Image interfaces */ - -extern nxgl_mxpixel_t nximage_bgcolor(void); -extern nxgl_mxpixel_t nximage_avgcolor(nxgl_mxpixel_t color1, nxgl_mxpixel_t color2); -extern void nximage_blitrow(FAR nxgl_mxpixel_t *run, FAR const void **state); - -#endif /* __APPS_EXAMPLES_NXIMAGE_NXIMAGE_H */ diff --git a/apps/examples/nximage/nximage_bitmap.c b/apps/examples/nximage/nximage_bitmap.c deleted file mode 100644 index a7c304d31..000000000 --- a/apps/examples/nximage/nximage_bitmap.c +++ /dev/null @@ -1,3711 +0,0 @@ -/******************************************************************************************** - * examples/nximage/nximage_bitmap.c - * - * 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 - * 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 <assert.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> - -#include "nximage.h" - -/******************************************************************************************** - * Pre-processor Definitions - ********************************************************************************************/ - -#if CONFIG_EXAMPLES_NXIMAGE_BPP == 24 - -# ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE -# error "24-bit greyscale not supported" -# endif - -# define IMAGE_NLUTCODES 164 /* Number of unique RGB colors in the image */ - -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 16 - -# ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE -# error "16-bit greyscale not supported" -# endif - -# define IMAGE_NLUTCODES 141 /* Number of unique RGB colors in the image */ - -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 8 - -# ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE -# define IMAGE_NLUTCODES 116 /* Number of unique greyscale levels in the image */ -# else -# define IMAGE_NLUTCODES 27 /* Number of unique RGB colors in the image */ -# endif - -#else -# error "Unsupport pixel format" -#endif - -/******************************************************************************************** - * Private Types - ********************************************************************************************/ - -struct pix_run_s -{ - uint8_t npix; /* Number of pixels */ - uint8_t code; /* Pixel RGB code */ -}; - -/******************************************************************************************** - * Private Data - ********************************************************************************************/ -/* RGB24 (8-8-8) Colors */ - -#if CONFIG_EXAMPLES_NXIMAGE_BPP == 24 - -static const nxgl_mxpixel_t g_lut[IMAGE_NLUTCODES] = -{ - 0x000000, 0x0a0804, 0x382616, 0x390c0f, 0x390d0f, 0x0a0203, 0x390b0e, 0x3a0d0f, /* Codes 0-7 */ - 0x350d0e, 0x1d0709, 0x24090b, 0x230f0d, 0x3b2817, 0x341511, 0x230a0b, 0x3a2817, /* Codes 8-15 */ - 0x350c0e, 0x1e1c1a, 0x3c3934, 0x390a0d, 0x0b0a09, 0x3c3933, 0x3b2321, 0x3d3d37, /* Codes 16-23 */ - 0x3c3b36, 0x38090b, 0x312e2a, 0x3c312d, 0x391516, 0x3c3c36, 0x3d3c36, 0x241212, /* Codes 24-31 */ - 0x1f0a0b, 0x1f0a0a, 0x1e090a, 0x2d0b0d, 0x3c3833, 0x3d3a36, 0x322f2a, 0x261f16, /* Codes 32-39 */ - 0x2f2617, 0x18130b, 0x3f3e38, 0x1e0507, 0x210a0b, 0x250a0c, 0x3f3f3f, 0x3d3a35, /* Codes 40-47 */ - 0x2e2414, 0x080704, 0x3e3b36, 0x2f2517, 0x3b2423, 0x2f211f, 0x3c3832, 0x363026, /* Codes 48-55 */ - 0x3e3c3a, 0x362f25, 0x390c0e, 0x3b2f2c, 0x3f3e3d, 0x3e3c39, 0x3b0d0f, 0x0a0805, /* Codes 56-63 */ - 0x2f2516, 0x2b1e14, 0x2d2114, 0x20080a, 0x2d0a0d, 0x3d3934, 0x32291c, 0x360d0f, /* Codes 64-71 */ - 0x2c201e, 0x2e2415, 0x2d2115, 0x1e070a, 0x3b2917, 0x3f3d37, 0x1e0406, 0x200a0b, /* Codes 72-79 */ - 0x340b0e, 0x2e0b0d, 0x220607, 0x3c2322, 0x3c3831, 0x373126, 0x1d0306, 0x2c2014, /* Codes 80-87 */ - 0x20090a, 0x030001, 0x1d090a, 0x3d0e10, 0x3b090c, 0x270b0c, 0x2d211f, 0x0a0703, /* Codes 88-95 */ - 0x382414, 0x39080c, 0x3e3c36, 0x2d1e1d, 0x1c0204, 0x1b0002, 0x230609, 0x1f0708, /* Codes 96-103 */ - 0x24080b, 0x342614, 0x3c3935, 0x342716, 0x38100e, 0x391210, 0x3c3731, 0x3e3d37, /* Codes 104-111 */ - 0x3a090c, 0x2b0b0d, 0x2e1e12, 0x381210, 0x3a2120, 0x23090b, 0x2f0c0d, 0x1c0709, /* Codes 112-119 */ - 0x1d0405, 0x380a0d, 0x3b0b0d, 0x2d090b, 0x1e0708, 0x340a0c, 0x230709, 0x2d1e1c, /* Codes 120-127 */ - 0x0a0001, 0x3c3a35, 0x351f13, 0x1e080a, 0x2c2115, 0x170a08, 0x1f0608, 0x2c1f13, /* Codes 128-135 */ - 0x340c0e, 0x3c0d10, 0x32080a, 0x3d3c37, 0x23100d, 0x3b3526, 0x38070b, 0x2b2014, /* Codes 136-143 */ - 0x3a0c0f, 0x2a1e1c, 0x070001, 0x0d0c0b, 0x19140c, 0x16110b, 0x322a1d, 0x3f3e3e, /* Codes 144-151 */ - 0x3e3b37, 0x37302c, 0x2f2c28, 0x39352d, 0x201e1c, 0x2a261f, 0x3c3d37, 0x2b080a, /* Codes 152-159 */ - 0x1d0608, 0x260a0c, 0x2b110e, 0x381f14 /* Codes 160-163 */ -}; - -/* RGB16 (565) Colors (four of the colors in this map are duplicates) */ - -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 16 - -static const nxgl_mxpixel_t g_lut[IMAGE_NLUTCODES] = -{ - 0x0000, 0x1105, 0x5cdc, 0x399c, 0x41bc, 0x0845, 0x397c, 0x39bc, 0x41bd, 0x39ba, /* Codes 0-9 */ - 0x28ee, 0x3132, 0x31f2, 0x5d1d, 0x42ba, 0x3152, 0x399a, 0x6b8f, 0xd73e, 0x315c, /* Codes 10-19 */ - 0x2945, 0x8c7d, 0xe7be, 0xdf7e, 0x313c, 0xadd9, 0xb63e, 0x5abd, 0xdf9e, 0xdf9f, /* Codes 20-29 */ - 0x4a52, 0x2950, 0x292f, 0x3176, 0xcf1e, 0xdf5f, 0xadf9, 0x5bf3, 0x5cd8, 0x326c, /* Codes 30-39 */ - 0xe7df, 0x18af, 0x3153, 0xdf5e, 0xffff, 0x5497, 0x10e4, 0xdf7f, 0x5cb8, 0x8c9d, /* Codes 40-49 */ - 0x8437, 0x9e1b, 0xef9f, 0x9dfb, 0xb5fe, 0xffdf, 0x41be, 0x53d6, 0x5436, 0x2910, /* Codes 50-59 */ - 0x3156, 0x7539, 0x39bb, 0x7c16, 0x95fb, 0x28ef, 0x653d, 0xe7bf, 0x188f, 0x397a, /* Codes 60-69 */ - 0x3977, 0x20d1, 0x8c7e, 0xe79f, 0x9e3b, 0x186e, 0x5416, 0x2930, 0x0801, 0x41de, /* Codes 70-79 */ - 0x313d, 0x3173, 0x7c36, 0x08e5, 0x549c, 0xd75f, 0x311c, 0x73d6, 0x3150, 0x315d, /* Codes 80-89 */ - 0x104e, 0x080e, 0x20f0, 0x2912, 0x54da, 0xdf3e, 0x5cfa, 0x3a1c, 0x425c, 0xcefe, /* Codes 90-99 */ - 0x4bd7, 0x843d, 0x2932, 0x3997, 0xf7df, 0x397d, 0x2936, 0x20ef, 0x315a, 0x20f1, /* Codes 100-109 */ - 0x0005, 0xd75e, 0x53fa, 0x290f, 0x214b, 0x20cf, 0x4bf6, 0x2919, 0x3212, 0x9ebd, /* Codes 110-119 */ - 0x28fc, 0x5415, 0x399d, 0x73d5, 0x0804, 0x3187, 0x328d, 0x2a2b, 0x7559, 0xe77f, /* Codes 120-129 */ - 0xb61c, 0x3186, 0xa598, 0xbebd, 0x73d0, 0x84d5, 0x5cb7, 0x2916, 0x20ce, 0x3a35, /* Codes 130-139 */ - 0x53fc /* Codes 140-140 */ -}; - -/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used - * to lookup an 8-bit value. There is no savings in that! It would be better to just put - * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these - * pointless lookups. But these p;ointless lookups do make the logic compatible with the - * 16- and 24-bit types. - */ - -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 8 -# ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE - -/* 8-bit Greyscale */ - -static const uint8_t g_lut[IMAGE_NLUTCODES] = -{ - 0x00, 0x19, 0x8b, 0x46, 0x4a, 0x0b, 0x8d, 0x41, 0x44, 0x27, 0x32, 0x92, 0x59, 0x34, 0x6d, 0xdb, /* Codes 0-15 */ - 0x3f, 0x26, 0x91, 0xec, 0xe5, 0x39, 0xb4, 0xc0, 0x62, 0xe6, 0x4c, 0x2f, 0x2e, 0x3c, 0xda, 0xe4, /* Codes 16-31 */ - 0x72, 0x86, 0xed, 0x1d, 0x35, 0xe2, 0xfc, 0xe3, 0x7d, 0x16, 0x97, 0x87, 0xee, 0xb2, 0x42, 0xbc, /* Codes 32-47 */ - 0xf6, 0x4b, 0x1c, 0x70, 0x90, 0x77, 0x2c, 0xdf, 0x96, 0x29, 0x45, 0x7f, 0x81, 0xb1, 0x28, 0xea, /* Codes 48-63 */ - 0x40, 0x3d, 0x23, 0x95, 0xe9, 0xd6, 0xb7, 0x2d, 0x02, 0x3a, 0x85, 0x17, 0x82, 0xe7, 0x7b, 0x33, /* Codes 64-79 */ - 0x0e, 0x25, 0x84, 0xe0, 0x8c, 0x4d, 0x56, 0x1e, 0x3b, 0x6e, 0x31, 0x3e, 0xf3, 0x1a, 0x20, 0x04, /* Codes 80-95 */ - 0xe1, 0x74, 0x2a, 0x79, 0x21, 0x71, 0xc4, 0x76, 0x48, 0x98, 0xf7, 0x94, 0xe8, 0xbe, 0xac, 0xc9, /* Codes 96-111 */ - 0x75, 0x8e, 0x49, 0x7a /* Codes 112-115 */ -}; - -# else /* CONFIG_EXAMPLES_NXIMAGE_GREYSCALE */ - -/* RGB8 (332) Colors */ - -static const nxgl_mxpixel_t g_lut[IMAGE_NLUTCODES] = -{ - 0x00, 0x25, 0x77, 0x4b, 0x01, 0x47, 0x26, 0x4a, 0x4f, 0x72, 0xdf, 0x93, 0xff, 0x27, 0xbb, 0xdb, /* Codes 0-15 */ - 0x6f, 0x29, 0x53, 0x97, 0x73, 0x22, 0x05, 0x02, 0x57, 0xbf, 0x4e /* Codes 16-26 */ -}; - -# endif -#else -# error "Unsupport pixel format" -#endif - -#if CONFIG_EXAMPLES_NXIMAGE_BPP == 24 - -static const struct pix_run_s g_nuttx[] = -{ - { 76, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 4, 4}, { 1, 5}, { 76, 0}, /* Row 0 */ - { 75, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 2, 7}, { 3, 4}, { 1, 5}, /* Row 1 */ - { 75, 0}, - { 74, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 9}, { 1, 10}, /* Row 2 */ - { 1, 7}, { 3, 4}, { 1, 5}, { 74, 0}, - { 73, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 12}, /* Row 3 */ - { 1, 13}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 73, 0}, - { 72, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 4 */ - { 1, 6}, { 1, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 72, 0}, - { 71, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 5 */ - { 1, 6}, { 3, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 71, 0}, - { 70, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 6 */ - { 1, 6}, { 5, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 70, 0}, - { 69, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 7 */ - { 1, 6}, { 7, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 69, 0}, - { 68, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 8 */ - { 1, 6}, { 9, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 68, 0}, - { 67, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 9 */ - { 1, 6}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 67, 0}, - { 66, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 10 */ - { 1, 6}, { 13, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 66, 0}, - { 65, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 11 */ - { 1, 6}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 65, 0}, - { 64, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 12 */ - { 1, 6}, { 17, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 64, 0}, - { 63, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 13 */ - { 1, 6}, { 19, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 63, 0}, - { 62, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 14 */ - { 1, 6}, { 21, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 62, 0}, - { 61, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 15 */ - { 1, 6}, { 23, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 61, 0}, - { 60, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 16 */ - { 1, 6}, { 25, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 60, 0}, - { 59, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 17 */ - { 1, 6}, { 27, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 59, 0}, - { 58, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 18 */ - { 1, 6}, { 29, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 26, 0}, - { 1, 17}, { 5, 18}, { 1, 17}, { 25, 0}, - { 57, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 19 */ - { 1, 6}, { 10, 4}, { 5, 19}, { 16, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, - { 1, 5}, { 23, 0}, { 1, 20}, { 1, 18}, { 1, 21}, { 5, 18}, { 1, 21}, { 1, 18}, - { 1, 20}, { 23, 0}, - { 56, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, /* Row 20 */ - { 1, 6}, { 9, 4}, { 1, 19}, { 1, 22}, { 1, 23}, { 3, 24}, { 1, 23}, { 1, 22}, - { 1, 25}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 22, 0}, - { 11, 18}, { 1, 20}, { 22, 0}, - { 23, 0}, { 1, 17}, { 5, 18}, { 1, 26}, { 25, 0}, { 1, 1}, { 1, 2}, { 1, 6}, /* Row 21 */ - { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 9, 4}, { 1, 19}, { 1, 27}, - { 1, 21}, { 5, 18}, { 1, 21}, { 1, 23}, { 1, 28}, { 15, 4}, { 1, 16}, { 1, 14}, - { 1, 7}, { 3, 4}, { 1, 5}, { 20, 0}, { 1, 17}, { 1, 21}, { 11, 18}, { 1, 20}, - { 21, 0}, - { 21, 0}, { 1, 20}, { 1, 18}, { 1, 21}, { 5, 18}, { 1, 21}, { 1, 18}, { 1, 20}, /* Row 22 */ - { 22, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 9, 4}, { 1, 19}, { 1, 27}, { 1, 21}, { 8, 18}, { 1, 29}, { 1, 28}, - { 4, 7}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 19, 0}, - { 14, 18}, { 21, 0}, - { 21, 0}, { 11, 18}, { 1, 20}, { 20, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, /* Row 23 */ - { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 10, 4}, { 1, 22}, { 1, 21}, { 10, 18}, - { 1, 30}, { 1, 31}, { 1, 32}, { 1, 33}, { 1, 34}, { 1, 35}, { 1, 7}, { 10, 4}, - { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 17, 0}, { 1, 17}, { 1, 21}, - { 4, 18}, { 1, 36}, { 2, 37}, { 1, 36}, { 4, 18}, { 1, 21}, { 1, 17}, { 20, 0}, - { 20, 0}, { 1, 38}, { 1, 21}, { 11, 18}, { 1, 39}, { 4, 40}, { 1, 41}, { 13, 0}, /* Row 24 */ - { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, - { 10, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 3, 36}, { 5, 18}, { 1, 42}, { 1, 43}, - { 3, 44}, { 1, 45}, { 1, 7}, { 10, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, - { 1, 5}, { 16, 0}, { 5, 18}, { 1, 37}, { 4, 46}, { 1, 37}, { 4, 18}, { 1, 47}, - { 1, 48}, { 1, 49}, { 18, 0}, - { 19, 0}, { 1, 17}, { 1, 21}, { 12, 18}, { 1, 50}, { 1, 48}, { 3, 40}, { 1, 51}, /* Row 25 */ - { 1, 40}, { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, - { 1, 15}, { 1, 6}, { 11, 4}, { 1, 52}, { 1, 21}, { 3, 18}, { 1, 37}, { 3, 46}, - { 1, 37}, { 4, 18}, { 1, 21}, { 1, 53}, { 4, 44}, { 1, 45}, { 1, 7}, { 10, 4}, - { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 1, 21}, - { 3, 18}, { 1, 54}, { 6, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 55}, { 1, 40}, - { 1, 49}, { 17, 0}, - { 19, 0}, { 5, 18}, { 1, 54}, { 2, 56}, { 1, 37}, { 5, 18}, { 1, 21}, { 1, 57}, /* Row 26 */ - { 4, 40}, { 1, 51}, { 1, 41}, { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, - { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 11, 4}, { 1, 58}, { 1, 59}, { 3, 18}, - { 1, 21}, { 1, 60}, { 4, 46}, { 1, 37}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, - { 1, 45}, { 1, 7}, { 10, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, - { 13, 0}, { 5, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 4, 18}, { 1, 57}, { 2, 40}, - { 1, 49}, { 16, 0}, - { 18, 0}, { 1, 17}, { 1, 21}, { 3, 18}, { 1, 37}, { 4, 46}, { 1, 37}, { 5, 18}, /* Row 27 */ - { 1, 50}, { 1, 48}, { 5, 40}, { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, - { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 12, 4}, { 1, 19}, { 1, 24}, { 3, 18}, - { 1, 37}, { 6, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, - { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 11, 0}, { 1, 17}, - { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 57}, { 3, 40}, - { 16, 0}, - { 18, 0}, { 4, 18}, { 1, 54}, { 5, 46}, { 1, 60}, { 1, 36}, { 4, 18}, { 1, 21}, /* Row 28 */ - { 1, 57}, { 4, 40}, { 1, 51}, { 1, 41}, { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, - { 1, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 13, 4}, { 1, 19}, { 1, 24}, - { 3, 18}, { 1, 61}, { 6, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, - { 1, 34}, { 1, 62}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, - { 10, 0}, { 5, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 55}, - { 2, 40}, { 1, 51}, { 1, 41}, { 15, 0}, - { 18, 0}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 29 */ - { 5, 40}, { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, - { 1, 15}, { 1, 6}, { 14, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, - { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 12, 4}, { 1, 16}, - { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 1, 21}, { 3, 18}, - { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 4, 40}, { 15, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 30 */ - { 4, 40}, { 1, 51}, { 1, 41}, { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, - { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 15, 4}, { 1, 19}, { 1, 24}, { 2, 18}, - { 1, 36}, { 8, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, - { 1, 62}, { 12, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 7, 0}, - { 5, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, - { 1, 63}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 31 */ - { 5, 40}, { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, - { 1, 15}, { 1, 6}, { 16, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 9, 46}, - { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 13, 4}, { 1, 16}, - { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 1, 21}, { 3, 18}, - { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 5, 40}, { 1, 41}, - { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 9, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 32 */ - { 4, 40}, { 1, 51}, { 1, 41}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 4}, { 1, 8}, - { 1, 11}, { 1, 15}, { 1, 6}, { 17, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, - { 9, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, - { 13, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 4, 0}, { 5, 18}, - { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 6, 40}, { 1, 63}, - { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 9, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 33 */ - { 3, 40}, { 1, 64}, { 1, 65}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 8}, { 1, 11}, - { 1, 15}, { 1, 6}, { 18, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 10, 46}, - { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 14, 4}, { 1, 16}, - { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 1, 21}, { 3, 18}, - { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 15, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 10, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 34 */ - { 2, 40}, { 1, 64}, { 1, 66}, { 1, 67}, { 1, 68}, { 1, 4}, { 1, 8}, { 1, 11}, - { 1, 15}, { 1, 6}, { 19, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 10, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 14, 4}, - { 1, 16}, { 1, 14}, { 1, 7}, { 3, 4}, { 1, 5}, { 1, 0}, { 5, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 69}, { 1, 70}, { 5, 40}, { 1, 51}, { 1, 41}, - { 15, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 10, 46}, { 1, 56}, { 5, 18}, { 1, 50}, { 1, 48}, /* Row 35 */ - { 1, 64}, { 1, 66}, { 1, 67}, { 1, 44}, { 1, 34}, { 1, 71}, { 1, 11}, { 1, 15}, - { 1, 6}, { 20, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 11, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 15, 4}, { 1, 16}, { 1, 14}, - { 1, 7}, { 3, 4}, { 1, 72}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, - { 4, 18}, { 1, 50}, { 1, 73}, { 6, 40}, { 16, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 11, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 57}, /* Row 36 */ - { 1, 74}, { 1, 67}, { 3, 44}, { 1, 75}, { 1, 76}, { 1, 6}, { 21, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 11, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, - { 4, 44}, { 1, 34}, { 1, 62}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 1, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 16, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 11, 46}, { 1, 56}, { 5, 18}, { 1, 77}, { 1, 78}, /* Row 37 */ - { 4, 44}, { 1, 79}, { 1, 80}, { 22, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, - { 12, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 16, 4}, - { 1, 16}, { 1, 14}, { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 17, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 12, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 38 */ - { 5, 44}, { 1, 81}, { 22, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 12, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 16, 4}, - { 1, 16}, { 1, 82}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 17, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 12, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, /* Row 39 */ - { 4, 44}, { 1, 34}, { 1, 62}, { 21, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, - { 13, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 17, 4}, - { 1, 83}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, - { 1, 48}, { 6, 40}, { 18, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 13, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 40 */ - { 5, 44}, { 1, 35}, { 21, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 13, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 15, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 18, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 13, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, /* Row 41 */ - { 4, 44}, { 1, 34}, { 1, 62}, { 20, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, - { 14, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 15, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, - { 1, 48}, { 6, 40}, { 19, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 14, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 42 */ - { 5, 44}, { 1, 35}, { 20, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 14, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 13, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 19, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 14, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, /* Row 43 */ - { 4, 44}, { 1, 34}, { 1, 62}, { 19, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, - { 7, 46}, { 1, 61}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, - { 1, 35}, { 13, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, - { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 15, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, /* Row 44 */ - { 5, 44}, { 1, 35}, { 19, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, - { 1, 84}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, - { 1, 62}, { 11, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 61}, { 6, 46}, { 1, 56}, { 5, 18}, /* Row 45 */ - { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 18, 4}, { 1, 19}, { 1, 24}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 11, 4}, { 1, 22}, { 1, 21}, { 3, 18}, - { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 84}, { 7, 46}, { 1, 54}, { 4, 18}, /* Row 46 */ - { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 18, 4}, { 1, 19}, { 1, 24}, { 2, 18}, - { 1, 36}, { 7, 46}, { 1, 36}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 25}, { 1, 23}, { 4, 18}, - { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, - { 1, 41}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 56}, { 6, 46}, { 1, 56}, /* Row 47 */ - { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 17, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 56}, { 7, 46}, - { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 9, 4}, { 1, 22}, - { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, - { 6, 40}, { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 54}, { 7, 46}, { 1, 54}, /* Row 48 */ - { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 17, 4}, { 1, 19}, { 1, 24}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 54}, { 7, 46}, { 1, 56}, - { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 25}, - { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 85}, - { 1, 51}, { 4, 40}, { 1, 51}, { 1, 41}, { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 18}, { 1, 56}, { 6, 46}, /* Row 49 */ - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 16, 4}, - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 7, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 86}, { 1, 66}, { 1, 64}, { 4, 40}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 1, 18}, { 1, 54}, { 7, 46}, /* Row 50 */ - { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 16, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 5, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 1, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 1, 51}, { 1, 41}, - { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 56}, { 6, 46}, /* Row 51 */ - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 15, 4}, - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 5, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 2, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 54}, { 7, 46}, /* Row 52 */ - { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 15, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 3, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 4, 44}, { 1, 67}, { 1, 87}, { 1, 41}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 3, 18}, { 1, 56}, { 6, 46}, /* Row 53 */ - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 14, 4}, - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 3, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 5, 44}, { 1, 88}, { 1, 89}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 3, 18}, { 1, 54}, { 7, 46}, /* Row 54 */ - { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 14, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 1, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 6, 44}, { 1, 90}, { 1, 62}, { 1, 5}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 4, 18}, { 1, 56}, { 6, 46}, /* Row 55 */ - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 13, 4}, - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 1, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 5, 44}, { 1, 33}, { 1, 91}, { 2, 4}, { 1, 5}, { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 4, 18}, { 1, 54}, { 7, 46}, /* Row 56 */ - { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 13, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 92}, { 1, 23}, - { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, - { 1, 93}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 5, 18}, { 1, 56}, { 6, 46}, /* Row 57 */ - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 12, 4}, - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 94}, { 1, 21}, - { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, - { 1, 34}, { 1, 62}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 5, 18}, { 1, 54}, { 7, 46}, /* Row 58 */ - { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 12, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 3, 44}, { 1, 43}, { 1, 42}, { 4, 18}, - { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, - { 2, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 19, 0}, - { 17, 0}, { 1, 95}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 6, 18}, { 1, 56}, /* Row 59 */ - { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, - { 11, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 7, 18}, - { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 3, 44}, { 1, 53}, - { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, - { 5, 44}, { 1, 34}, { 1, 62}, { 3, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, - { 1, 5}, { 18, 0}, - { 16, 0}, { 1, 1}, { 1, 96}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, /* Row 60 */ - { 6, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, - { 1, 35}, { 11, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, - { 2, 18}, { 1, 21}, { 1, 47}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, - { 1, 42}, { 1, 43}, { 1, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, - { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 5, 4}, { 1, 16}, - { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 17, 0}, - { 15, 0}, { 1, 1}, { 1, 2}, { 1, 97}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 61 */ - { 1, 36}, { 7, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, - { 4, 44}, { 1, 34}, { 1, 62}, { 10, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, - { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 99}, { 1, 21}, { 3, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 1, 44}, { 1, 53}, { 1, 21}, - { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, - { 1, 34}, { 1, 62}, { 6, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, - { 16, 0}, - { 14, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, /* Row 62 */ - { 8, 46}, { 1, 36}, { 7, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, - { 1, 53}, { 5, 44}, { 1, 35}, { 10, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, - { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 100}, { 1, 42}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 101}, { 1, 42}, { 4, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 8, 4}, - { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 15, 0}, - { 13, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 102}, { 1, 98}, { 2, 18}, /* Row 63 */ - { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 21}, { 1, 47}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, - { 9, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 98}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, - { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 16}, - { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 14, 0}, - { 12, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 105}, { 1, 106}, /* Row 64 */ - { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 99}, { 1, 21}, - { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, - { 1, 35}, { 9, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, - { 2, 18}, { 1, 98}, { 1, 103}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 9, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, - { 6, 44}, { 1, 35}, { 11, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, - { 13, 0}, - { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 108}, /* Row 65 */ - { 1, 29}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 100}, - { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, - { 4, 44}, { 1, 34}, { 1, 62}, { 8, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, - { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 53}, { 1, 21}, - { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 7, 18}, { 1, 54}, { 7, 46}, { 1, 56}, - { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 12, 4}, { 1, 16}, - { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 12, 0}, - { 10, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 66 */ - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, - { 1, 103}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, - { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 8, 4}, { 1, 19}, { 1, 24}, { 2, 18}, - { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 43}, - { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 7, 18}, { 1, 56}, { 7, 46}, - { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 14, 4}, { 1, 16}, - { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 11, 0}, - { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 67 */ - { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, - { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 2, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 5, 18}, - { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, - { 1, 62}, { 15, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 10, 0}, - { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 68 */ - { 2, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 1, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, - { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 7, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 2, 44}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 5, 18}, - { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, - { 17, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 9, 0}, - { 7, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 69 */ - { 3, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 1, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 6, 4}, - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, - { 1, 103}, { 3, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, - { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, - { 1, 34}, { 1, 62}, { 18, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, - { 8, 0}, - { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 70 */ - { 4, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 2, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, - { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 6, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 3, 44}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 3, 18}, - { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, - { 20, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 7, 0}, - { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 71 */ - { 5, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 2, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 5, 4}, - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, - { 1, 103}, { 4, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, - { 1, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, - { 1, 34}, { 1, 62}, { 21, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, - { 6, 0}, - { 4, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 72 */ - { 6, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 3, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, - { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 5, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 4, 44}, { 1, 43}, { 1, 42}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 1, 18}, - { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, - { 23, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 5, 0}, - { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 73 */ - { 7, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 3, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 4, 4}, - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, - { 1, 103}, { 5, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 110}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, - { 24, 4}, { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 4, 0}, - { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 74 */ - { 8, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 4, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, - { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 4, 4}, { 1, 19}, - { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 43}, { 1, 111}, { 3, 18}, { 1, 54}, { 15, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 26, 4}, { 1, 16}, { 1, 14}, { 1, 7}, - { 2, 4}, { 1, 5}, { 3, 0}, - { 1, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, /* Row 75 */ - { 9, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 4, 44}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 6, 46}, - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 3, 4}, - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, - { 1, 103}, { 5, 44}, { 1, 32}, { 1, 83}, { 1, 21}, { 3, 18}, { 1, 56}, { 13, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 27, 4}, - { 1, 16}, { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, { 2, 0}, - { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, { 10, 4}, /* Row 76 */ - { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, - { 1, 103}, { 5, 44}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, - { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 3, 4}, { 1, 19}, { 1, 24}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, - { 1, 33}, { 1, 112}, { 1, 23}, { 3, 18}, { 1, 54}, { 13, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 29, 4}, { 1, 16}, { 1, 14}, { 1, 7}, - { 2, 4}, { 1, 5}, { 1, 0}, - { 1, 2}, { 1, 6}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, { 11, 4}, { 1, 19}, /* Row 77 */ - { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 43}, { 1, 111}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, - { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 2, 4}, { 1, 19}, { 1, 24}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, - { 1, 33}, { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 56}, { 11, 46}, { 1, 56}, - { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 30, 4}, { 1, 16}, - { 1, 14}, { 1, 7}, { 2, 4}, { 1, 5}, - { 1, 3}, { 1, 7}, { 1, 104}, { 1, 107}, { 1, 109}, { 12, 4}, { 1, 19}, { 1, 24}, /* Row 78 */ - { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, - { 1, 32}, { 1, 83}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, - { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 2, 4}, { 1, 19}, { 1, 24}, { 2, 18}, - { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, - { 1, 7}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 54}, { 11, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 32, 4}, { 1, 16}, { 1, 14}, { 1, 7}, - { 2, 4}, - { 1, 4}, { 1, 113}, { 1, 114}, { 1, 115}, { 13, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 79 */ - { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, - { 1, 112}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, - { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18}, - { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, - { 1, 7}, { 1, 4}, { 1, 116}, { 4, 18}, { 1, 56}, { 9, 46}, { 1, 61}, { 4, 18}, - { 1, 42}, { 1, 43}, { 5, 44}, { 1, 34}, { 1, 62}, { 33, 4}, { 1, 16}, { 1, 14}, - { 1, 62}, { 1, 4}, - { 1, 4}, { 1, 7}, { 1, 117}, { 1, 8}, { 13, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 80 */ - { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, - { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, - { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18}, - { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, - { 1, 7}, { 1, 4}, { 1, 116}, { 4, 18}, { 1, 54}, { 9, 46}, { 1, 37}, { 3, 18}, - { 1, 21}, { 1, 53}, { 6, 44}, { 1, 35}, { 35, 4}, { 1, 118}, { 1, 119}, { 1, 7}, - { 2, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 12, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 81 */ - { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, - { 1, 7}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, - { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 62}, { 1, 19}, { 1, 24}, { 2, 18}, - { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, - { 1, 7}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 8, 46}, { 1, 60}, { 1, 21}, - { 3, 18}, { 1, 98}, { 1, 120}, { 5, 44}, { 1, 33}, { 1, 62}, { 34, 4}, { 1, 8}, - { 1, 11}, { 1, 76}, { 1, 3}, - { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4}, { 1, 19}, { 1, 24}, { 2, 18}, /* Row 82 */ - { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, - { 1, 7}, { 1, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, - { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 35}, { 1, 121}, { 1, 24}, { 2, 18}, - { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, - { 1, 7}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 10, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 53}, { 5, 44}, { 1, 33}, { 1, 62}, { 33, 4}, { 1, 8}, { 1, 11}, - { 1, 15}, { 1, 6}, { 1, 4}, - { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 10, 4}, { 1, 19}, { 1, 24}, /* Row 83 */ - { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, - { 1, 33}, { 1, 7}, { 1, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 34}, { 1, 122}, { 1, 24}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, - { 1, 33}, { 1, 112}, { 1, 23}, { 4, 18}, { 1, 56}, { 10, 46}, { 1, 56}, { 4, 18}, - { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 32, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 1, 4}, { 1, 5}, - { 1, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4}, { 1, 19}, /* Row 84 */ - { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 33}, { 1, 7}, { 2, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 123}, { 1, 24}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, - { 1, 32}, { 1, 83}, { 1, 21}, { 3, 18}, { 1, 54}, { 12, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 30, 4}, { 1, 8}, { 1, 11}, - { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 1, 0}, - { 2, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 8, 4}, { 1, 19}, /* Row 85 */ - { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 33}, { 1, 7}, { 2, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 124}, { 1, 98}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, - { 1, 43}, { 1, 111}, { 4, 18}, { 1, 56}, { 12, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 5, 44}, { 1, 35}, { 29, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, - { 1, 4}, { 1, 5}, { 2, 0}, - { 3, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 7, 4}, { 1, 19}, /* Row 86 */ - { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 4, 44}, { 1, 103}, { 1, 98}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, - { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 14, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 27, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 1, 4}, { 1, 5}, { 3, 0}, - { 4, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 6, 4}, { 1, 19}, /* Row 87 */ - { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 3, 44}, { 1, 103}, { 1, 98}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 4, 44}, - { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 14, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 5, 44}, { 1, 35}, { 26, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, - { 1, 4}, { 1, 5}, { 4, 0}, - { 5, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 5, 4}, { 1, 19}, /* Row 88 */ - { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 33}, { 1, 7}, { 4, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 3, 44}, { 1, 103}, { 1, 98}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 4, 44}, - { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 16, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 24, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 1, 4}, { 1, 5}, { 5, 0}, - { 6, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 4, 4}, { 1, 19}, /* Row 89 */ - { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 33}, { 1, 7}, { 4, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 2, 44}, { 1, 103}, { 1, 98}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 3, 44}, - { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 23, 4}, { 1, 8}, - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 6, 0}, - { 7, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 3, 4}, { 1, 19}, /* Row 90 */ - { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 2, 44}, { 1, 103}, { 1, 98}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 3, 44}, - { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 1, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, - { 21, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0}, - { 8, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 2, 4}, { 1, 19}, /* Row 91 */ - { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 1, 44}, { 1, 103}, { 1, 98}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 2, 44}, - { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 2, 18}, { 1, 54}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 20, 4}, - { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 8, 0}, - { 9, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 1, 4}, { 1, 19}, /* Row 92 */ - { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, - { 5, 44}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, { 1, 53}, { 1, 44}, { 1, 103}, { 1, 98}, - { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 2, 44}, - { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, - { 18, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 9, 0}, - { 10, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 1, 121}, { 1, 24}, /* Row 93 */ - { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, - { 1, 33}, { 1, 7}, { 6, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, - { 1, 56}, { 5, 18}, { 1, 42}, { 1, 43}, { 1, 103}, { 1, 98}, { 2, 18}, { 1, 36}, - { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 43}, { 1, 42}, - { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 54}, { 7, 46}, { 1, 56}, - { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 17, 4}, { 1, 8}, { 1, 11}, - { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0}, - { 11, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 125}, { 1, 24}, { 2, 18}, /* Row 94 */ - { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, - { 1, 7}, { 7, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, - { 4, 18}, { 1, 21}, { 1, 53}, { 1, 103}, { 1, 98}, { 2, 18}, { 1, 36}, { 7, 46}, - { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 1, 44}, { 1, 53}, { 1, 21}, { 3, 18}, - { 1, 54}, { 8, 46}, { 1, 54}, { 5, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 15, 4}, { 1, 8}, { 1, 11}, - { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 11, 0}, - { 12, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 126}, { 1, 98}, { 2, 18}, { 1, 36}, /* Row 95 */ - { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, - { 7, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, - { 1, 42}, { 1, 100}, { 1, 98}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, - { 1, 98}, { 1, 103}, { 1, 43}, { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, - { 6, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, - { 1, 35}, { 14, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, - { 12, 0}, - { 13, 0}, { 1, 5}, { 3, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 96 */ - { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 8, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 4, 18}, { 1, 21}, - { 1, 99}, { 1, 98}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, - { 1, 103}, { 1, 53}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 7, 18}, - { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, - { 1, 62}, { 12, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, - { 13, 0}, - { 14, 0}, { 1, 5}, { 2, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 97 */ - { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 8, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 5, 18}, { 1, 47}, - { 1, 21}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 100}, - { 1, 42}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 47}, { 1, 21}, - { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, - { 1, 35}, { 11, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, - { 14, 0}, - { 15, 0}, { 1, 5}, { 1, 4}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, /* Row 98 */ - { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 9, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 8, 18}, { 1, 36}, - { 7, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 99}, { 1, 21}, { 3, 18}, { 1, 54}, - { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 127}, { 1, 42}, { 3, 18}, { 1, 56}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, - { 9, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 15, 0}, - { 16, 0}, { 1, 5}, { 1, 19}, { 1, 24}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, /* Row 99 */ - { 2, 18}, { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 9, 4}, { 1, 25}, - { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 8, 18}, { 1, 36}, { 7, 46}, - { 1, 36}, { 2, 18}, { 1, 21}, { 1, 47}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 56}, - { 4, 18}, { 1, 42}, { 1, 43}, { 1, 53}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, { 1, 35}, { 8, 4}, { 1, 8}, - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0}, - { 17, 0}, { 1, 128}, { 1, 129}, { 2, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, /* Row 100 */ - { 1, 98}, { 1, 103}, { 5, 44}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 22}, { 1, 21}, - { 3, 18}, { 1, 54}, { 7, 46}, { 1, 54}, { 7, 18}, { 1, 36}, { 7, 46}, { 1, 36}, - { 7, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 1, 44}, - { 1, 43}, { 1, 42}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 5, 44}, { 1, 34}, { 1, 62}, { 6, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 1, 4}, { 1, 5}, { 17, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 101 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 7, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 7, 18}, { 1, 56}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 2, 44}, { 1, 53}, { 1, 21}, - { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, - { 1, 35}, { 5, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, - { 18, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 102 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 6, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 54}, - { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 3, 44}, { 1, 43}, { 1, 42}, - { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, - { 1, 34}, { 1, 62}, { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, - { 1, 5}, { 19, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 103 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 6, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 6, 18}, { 1, 56}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 4, 44}, { 1, 53}, { 1, 21}, - { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, - { 1, 35}, { 2, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, - { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 104 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 5, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 54}, - { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, { 1, 43}, { 1, 42}, - { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 5, 44}, - { 1, 34}, { 1, 62}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, - { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 105 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 5, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 5, 18}, { 1, 56}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 94}, { 1, 21}, - { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 5, 44}, - { 1, 93}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 106 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 4, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 54}, - { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 92}, - { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, - { 5, 44}, { 1, 88}, { 1, 130}, { 1, 6}, { 1, 4}, { 1, 5}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 107 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 4, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 4, 18}, { 1, 56}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 1, 4}, - { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 5, 44}, { 1, 131}, { 1, 7}, { 1, 5}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 108 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 3, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 54}, - { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, - { 1, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 53}, { 4, 44}, { 1, 67}, { 1, 132}, { 1, 133}, { 25, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 109 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 3, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 3, 18}, { 1, 56}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 3, 4}, - { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 2, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 25, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 110 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 54}, - { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, - { 3, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 53}, { 1, 44}, { 1, 67}, { 1, 66}, { 1, 64}, { 1, 40}, { 1, 51}, - { 1, 41}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 111 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 2, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 2, 18}, { 1, 56}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 5, 4}, - { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 86}, { 1, 66}, { 1, 64}, { 4, 40}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 112 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 16, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 1, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 54}, - { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, - { 5, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, - { 1, 21}, { 1, 85}, { 1, 51}, { 4, 40}, { 1, 51}, { 1, 41}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 113 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 16, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 1, 18}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 18}, { 1, 56}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 7, 4}, - { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, - { 1, 48}, { 6, 40}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 114 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 17, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 54}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 54}, { 8, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 25}, - { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, - { 5, 40}, { 1, 51}, { 1, 41}, { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 103}, /* Row 115 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 17, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, - { 6, 46}, { 1, 56}, { 1, 36}, { 7, 46}, { 1, 36}, { 1, 56}, { 7, 46}, { 1, 56}, - { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 9, 4}, { 1, 22}, { 1, 21}, - { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, - { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 98}, { 1, 134}, /* Row 116 */ - { 5, 44}, { 1, 33}, { 1, 7}, { 18, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, - { 7, 46}, { 1, 84}, { 7, 46}, { 1, 84}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 25}, { 1, 23}, { 3, 18}, - { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, - { 1, 41}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 135}, /* Row 117 */ - { 1, 67}, { 4, 44}, { 1, 33}, { 1, 7}, { 18, 4}, { 1, 25}, { 1, 23}, { 4, 18}, - { 1, 56}, { 6, 46}, { 1, 61}, { 7, 46}, { 1, 61}, { 7, 46}, { 1, 56}, { 4, 18}, - { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 11, 4}, { 1, 22}, { 1, 21}, { 2, 18}, - { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 118 */ - { 1, 66}, { 1, 67}, { 3, 44}, { 1, 79}, { 1, 136}, { 19, 4}, { 1, 22}, { 1, 21}, - { 3, 18}, { 1, 54}, { 22, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, - { 1, 34}, { 1, 62}, { 11, 4}, { 1, 25}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, - { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 119 */ - { 1, 64}, { 1, 66}, { 1, 67}, { 2, 44}, { 1, 79}, { 1, 45}, { 1, 16}, { 18, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 20, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 6, 44}, { 1, 35}, { 13, 4}, { 1, 22}, { 1, 21}, { 2, 18}, { 1, 54}, - { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 120 */ - { 1, 40}, { 1, 64}, { 1, 66}, { 1, 67}, { 1, 44}, { 1, 33}, { 1, 137}, { 1, 14}, - { 1, 16}, { 18, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 20, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 13, 4}, { 1, 138}, - { 1, 139}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, - { 5, 40}, { 1, 51}, { 1, 41}, { 19, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 121 */ - { 2, 40}, { 1, 64}, { 1, 66}, { 1, 67}, { 1, 33}, { 2, 7}, { 1, 14}, { 1, 16}, - { 17, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 18, 46}, { 1, 56}, { 4, 18}, - { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 13, 4}, { 1, 8}, { 1, 140}, { 1, 141}, - { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, - { 6, 40}, { 19, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 122 */ - { 3, 40}, { 1, 64}, { 1, 66}, { 1, 131}, { 1, 7}, { 1, 4}, { 1, 7}, { 1, 14}, - { 1, 16}, { 17, 4}, { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 18, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 12, 4}, { 1, 8}, - { 1, 11}, { 1, 15}, { 1, 142}, { 1, 23}, { 3, 18}, { 1, 56}, { 7, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 18, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 123 */ - { 4, 40}, { 1, 64}, { 1, 143}, { 1, 144}, { 2, 4}, { 1, 7}, { 1, 14}, { 1, 16}, - { 16, 4}, { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 16, 46}, { 1, 56}, { 4, 18}, - { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 12, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 1, 4}, { 1, 145}, { 3, 18}, { 1, 54}, { 7, 46}, { 1, 56}, { 4, 18}, - { 1, 50}, { 1, 48}, { 6, 40}, { 18, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 124 */ - { 5, 40}, { 1, 64}, { 1, 146}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 16, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 16, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 11, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 1, 4}, { 1, 5}, { 1, 147}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 17, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 125 */ - { 6, 40}, { 1, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 15, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 14, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 6, 44}, { 1, 35}, { 11, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, - { 1, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 17, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 126 */ - { 6, 40}, { 2, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 15, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 14, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 10, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 1, 4}, { 1, 5}, { 4, 0}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 16, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 127 */ - { 6, 40}, { 3, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 14, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 12, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 6, 44}, { 1, 35}, { 10, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, - { 1, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 16, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 128 */ - { 6, 40}, { 4, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 14, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 12, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 9, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 57}, { 5, 40}, { 1, 51}, { 1, 41}, { 15, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 129 */ - { 6, 40}, { 5, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 13, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 10, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 6, 44}, { 1, 35}, { 9, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, - { 1, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 50}, { 1, 48}, { 6, 40}, { 15, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 130 */ - { 6, 40}, { 6, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 13, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 10, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 8, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0}, { 4, 18}, { 1, 56}, { 7, 46}, { 1, 54}, - { 3, 18}, { 1, 21}, { 1, 55}, { 5, 40}, { 1, 51}, { 1, 148}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 131 */ - { 6, 40}, { 7, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 12, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 8, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 6, 44}, { 1, 35}, { 8, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, - { 1, 4}, { 1, 5}, { 11, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 7, 46}, - { 1, 56}, { 4, 18}, { 1, 57}, { 6, 40}, { 1, 149}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 132 */ - { 6, 40}, { 8, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 12, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 54}, { 8, 46}, { 1, 54}, { 3, 18}, { 1, 21}, - { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 7, 4}, { 1, 8}, { 1, 11}, { 1, 15}, - { 1, 6}, { 1, 4}, { 1, 5}, { 13, 0}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, - { 4, 18}, { 1, 57}, { 7, 40}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 133 */ - { 6, 40}, { 9, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 56}, { 6, 46}, { 1, 56}, { 4, 18}, { 1, 42}, - { 1, 43}, { 6, 44}, { 1, 35}, { 7, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, - { 1, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 1, 21}, { 2, 18}, { 1, 54}, { 6, 46}, - { 1, 56}, { 3, 18}, { 1, 69}, { 1, 150}, { 6, 40}, { 1, 51}, { 1, 148}, { 13, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 134 */ - { 6, 40}, { 10, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4}, - { 1, 22}, { 1, 21}, { 3, 18}, { 1, 36}, { 1, 151}, { 4, 46}, { 1, 151}, { 1, 36}, - { 3, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, { 6, 4}, { 1, 8}, - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0}, { 4, 18}, { 1, 56}, - { 5, 46}, { 1, 54}, { 3, 18}, { 1, 50}, { 1, 73}, { 7, 40}, { 1, 41}, { 13, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 135 */ - { 6, 40}, { 11, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 10, 4}, - { 1, 25}, { 1, 23}, { 4, 18}, { 1, 36}, { 1, 56}, { 2, 46}, { 1, 56}, { 1, 36}, - { 4, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 6, 4}, { 1, 8}, { 1, 11}, - { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 17, 0}, { 1, 17}, { 1, 21}, { 2, 18}, - { 1, 36}, { 1, 56}, { 2, 46}, { 1, 56}, { 1, 54}, { 3, 18}, { 1, 21}, { 1, 57}, - { 8, 40}, { 1, 41}, { 13, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 136 */ - { 6, 40}, { 12, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 10, 4}, - { 1, 22}, { 1, 21}, { 5, 18}, { 2, 36}, { 5, 18}, { 1, 21}, { 1, 53}, { 6, 44}, - { 1, 34}, { 1, 62}, { 5, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, - { 1, 5}, { 19, 0}, { 5, 18}, { 2, 36}, { 5, 18}, { 1, 50}, { 1, 48}, { 8, 40}, - { 1, 63}, { 13, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 137 */ - { 6, 40}, { 13, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4}, - { 1, 25}, { 1, 23}, { 12, 18}, { 1, 42}, { 1, 43}, { 6, 44}, { 1, 35}, { 5, 4}, - { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 20, 0}, { 1, 17}, - { 1, 21}, { 9, 18}, { 1, 47}, { 1, 70}, { 9, 40}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 36}, { 2, 18}, { 1, 47}, { 1, 73}, /* Row 138 */ - { 6, 40}, { 14, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4}, - { 1, 22}, { 1, 21}, { 10, 18}, { 1, 21}, { 1, 53}, { 6, 44}, { 1, 34}, { 1, 62}, - { 4, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0}, - { 9, 18}, { 1, 47}, { 1, 70}, { 8, 40}, { 1, 51}, { 1, 41}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 36}, { 8, 46}, { 1, 69}, { 2, 47}, { 1, 152}, { 1, 73}, /* Row 139 */ - { 6, 40}, { 15, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 8, 4}, - { 1, 19}, { 1, 27}, { 1, 21}, { 8, 18}, { 1, 21}, { 1, 153}, { 1, 103}, { 6, 44}, - { 1, 35}, { 4, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, - { 23, 0}, { 1, 147}, { 1, 154}, { 1, 18}, { 1, 21}, { 2, 18}, { 1, 21}, { 1, 47}, - { 1, 155}, { 1, 150}, { 10, 40}, { 15, 0}, - { 25, 0}, { 5, 48}, { 4, 73}, { 7, 40}, { 16, 0}, { 1, 5}, { 3, 4}, { 1, 7}, /* Row 140 */ - { 1, 14}, { 1, 16}, { 8, 4}, { 1, 19}, { 1, 22}, { 1, 23}, { 1, 21}, { 4, 18}, - { 1, 21}, { 1, 42}, { 1, 53}, { 1, 103}, { 6, 44}, { 1, 34}, { 1, 62}, { 3, 4}, - { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 27, 0}, { 1, 156}, - { 1, 17}, { 1, 157}, { 1, 55}, { 1, 48}, { 1, 64}, { 9, 40}, { 1, 51}, { 1, 41}, - { 15, 0}, - { 25, 0}, { 16, 40}, { 17, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 141 */ - { 9, 4}, { 1, 25}, { 1, 22}, { 1, 158}, { 2, 98}, { 1, 77}, { 1, 53}, { 1, 43}, - { 7, 44}, { 1, 33}, { 1, 136}, { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, - { 1, 4}, { 1, 5}, { 30, 0}, { 1, 63}, { 11, 40}, { 1, 51}, { 1, 40}, { 16, 0}, - { 25, 0}, { 16, 40}, { 18, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 142 */ - { 10, 4}, { 1, 19}, { 1, 159}, { 1, 160}, { 1, 103}, { 7, 44}, { 1, 79}, { 1, 161}, - { 1, 136}, { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, - { 32, 0}, { 1, 41}, { 1, 51}, { 8, 40}, { 1, 51}, { 1, 40}, { 17, 0}, - { 25, 0}, { 16, 40}, { 19, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 143 */ - { 11, 4}, { 1, 62}, { 1, 35}, { 1, 34}, { 5, 33}, { 1, 161}, { 1, 136}, { 1, 7}, - { 3, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 34, 0}, - { 8, 40}, { 1, 51}, { 1, 40}, { 18, 0}, - { 25, 0}, { 16, 40}, { 20, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 144 */ - { 12, 4}, { 7, 7}, { 4, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, - { 1, 5}, { 35, 0}, { 1, 49}, { 7, 40}, { 1, 41}, { 19, 0}, - { 25, 0}, { 16, 40}, { 21, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 145 */ - { 21, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 64, 0}, - { 25, 0}, { 16, 40}, { 22, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, /* Row 146 */ - { 19, 4}, { 1, 8}, { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 65, 0}, - { 64, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 17, 4}, { 1, 8}, /* Row 147 */ - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 66, 0}, - { 65, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 15, 4}, { 1, 8}, /* Row 148 */ - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 67, 0}, - { 66, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 13, 4}, { 1, 8}, /* Row 149 */ - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 68, 0}, - { 67, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 11, 4}, { 1, 8}, /* Row 150 */ - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 69, 0}, - { 68, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 9, 4}, { 1, 8}, /* Row 151 */ - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 70, 0}, - { 69, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 7, 4}, { 1, 8}, /* Row 152 */ - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 71, 0}, - { 70, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 5, 4}, { 1, 8}, /* Row 153 */ - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 72, 0}, - { 71, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 3, 4}, { 1, 8}, /* Row 154 */ - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 73, 0}, - { 72, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 16}, { 1, 4}, { 1, 8}, /* Row 155 */ - { 1, 11}, { 1, 15}, { 1, 6}, { 1, 4}, { 1, 5}, { 74, 0}, - { 73, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 14}, { 1, 118}, { 1, 11}, { 1, 15}, /* Row 156 */ - { 1, 6}, { 1, 4}, { 1, 5}, { 75, 0}, - { 74, 0}, { 1, 5}, { 3, 4}, { 1, 7}, { 1, 162}, { 1, 15}, { 1, 6}, { 1, 4}, /* Row 157 */ - { 1, 5}, { 76, 0}, - { 75, 0}, { 1, 5}, { 2, 4}, { 1, 3}, { 1, 163}, { 1, 6}, { 1, 4}, { 1, 5}, /* Row 158 */ - { 77, 0}, - { 76, 0}, { 1, 5}, { 4, 4}, { 1, 5}, { 78, 0} /* Row 159 */ - }; - -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 16 - -static const struct pix_run_s g_nuttx[] = -{ - { 76, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 4, 4}, { 1, 5}, { 76, 0}, /* Row 0 */ - { 75, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 2, 8}, { 3, 4}, { 1, 5}, /* Row 1 */ - { 75, 0}, - { 74, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 10}, { 1, 11}, /* Row 2 */ - { 1, 8}, { 3, 4}, { 1, 5}, { 74, 0}, - { 73, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 3 */ - { 1, 14}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 73, 0}, - { 72, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 4 */ - { 1, 6}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 72, 0}, - { 71, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 5 */ - { 1, 6}, { 2, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 71, 0}, - { 70, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 6 */ - { 1, 6}, { 4, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 70, 0}, - { 69, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 7 */ - { 1, 6}, { 6, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 69, 0}, - { 68, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 8 */ - { 1, 6}, { 8, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 68, 0}, - { 67, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 9 */ - { 1, 6}, { 10, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 67, 0}, - { 66, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 10 */ - { 1, 6}, { 12, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 66, 0}, - { 65, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 11 */ - { 1, 6}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 65, 0}, - { 64, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 12 */ - { 1, 6}, { 16, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 64, 0}, - { 63, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 13 */ - { 1, 6}, { 18, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 63, 0}, - { 62, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 14 */ - { 1, 6}, { 20, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 62, 0}, - { 61, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 15 */ - { 1, 6}, { 22, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 61, 0}, - { 60, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 16 */ - { 1, 6}, { 24, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 60, 0}, - { 59, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 17 */ - { 1, 6}, { 26, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 59, 0}, - { 58, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 18 */ - { 1, 6}, { 28, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 26, 0}, { 1, 17}, { 5, 18}, { 1, 17}, { 25, 0}, - { 57, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 19 */ - { 1, 6}, { 10, 4}, { 5, 19}, { 15, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, - { 3, 4}, { 1, 5}, { 23, 0}, { 1, 20}, { 9, 18}, { 1, 20}, { 23, 0}, - { 56, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, /* Row 20 */ - { 1, 6}, { 9, 4}, { 1, 19}, { 1, 21}, { 1, 22}, { 3, 23}, { 1, 22}, { 1, 21}, - { 1, 24}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 22, 0}, { 11, 18}, { 1, 20}, { 22, 0}, - { 23, 0}, { 1, 17}, { 5, 18}, { 1, 25}, { 25, 0}, { 1, 1}, { 1, 2}, { 1, 6}, /* Row 21 */ - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 9, 4}, { 1, 19}, { 1, 26}, - { 7, 18}, { 1, 22}, { 1, 27}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, - { 3, 4}, { 1, 5}, { 20, 0}, { 1, 17}, { 12, 18}, { 1, 20}, { 21, 0}, - { 21, 0}, { 1, 20}, { 9, 18}, { 1, 20}, { 22, 0}, { 1, 1}, { 1, 2}, { 1, 6}, /* Row 22 */ - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 9, 4}, { 1, 19}, { 1, 26}, - { 9, 18}, { 1, 28}, { 1, 27}, { 4, 8}, { 1, 7}, { 9, 4}, { 1, 7}, { 1, 16}, - { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 19, 0}, { 14, 18}, { 21, 0}, - { 21, 0}, { 11, 18}, { 1, 20}, { 20, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, /* Row 23 */ - { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 10, 4}, { 1, 21}, { 11, 18}, { 1, 29}, - { 1, 30}, { 2, 31}, { 1, 32}, { 1, 33}, { 1, 8}, { 9, 4}, { 1, 7}, { 1, 16}, - { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 17, 0}, { 1, 17}, { 5, 18}, { 1, 34}, - { 2, 35}, { 1, 34}, { 5, 18}, { 1, 17}, { 20, 0}, - { 20, 0}, { 1, 36}, { 12, 18}, { 1, 37}, { 4, 38}, { 1, 39}, { 13, 0}, { 1, 1}, /* Row 24 */ - { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 10, 4}, - { 1, 24}, { 1, 22}, { 4, 18}, { 3, 34}, { 5, 18}, { 1, 40}, { 1, 41}, { 3, 31}, - { 1, 42}, { 1, 8}, { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, - { 1, 5}, { 16, 0}, { 5, 18}, { 1, 43}, { 4, 44}, { 1, 43}, { 4, 18}, { 1, 35}, - { 1, 45}, { 1, 46}, { 18, 0}, - { 19, 0}, { 1, 17}, { 13, 18}, { 1, 47}, { 1, 45}, { 3, 38}, { 1, 48}, { 1, 38}, /* Row 25 */ - { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, - { 1, 6}, { 11, 4}, { 1, 49}, { 4, 18}, { 1, 35}, { 3, 44}, { 1, 43}, { 5, 18}, - { 1, 50}, { 4, 31}, { 1, 42}, { 1, 8}, { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, - { 1, 8}, { 3, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 4, 18}, { 1, 34}, { 6, 44}, - { 1, 34}, { 4, 18}, { 1, 51}, { 1, 38}, { 1, 46}, { 17, 0}, - { 19, 0}, { 5, 18}, { 1, 34}, { 2, 52}, { 1, 35}, { 6, 18}, { 1, 53}, { 4, 38}, /* Row 26 */ - { 1, 48}, { 1, 39}, { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 11, 4}, { 1, 3}, { 1, 54}, { 4, 18}, { 1, 55}, - { 4, 44}, { 1, 43}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 42}, { 1, 8}, - { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 13, 0}, - { 5, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 4, 18}, { 1, 53}, { 2, 38}, { 1, 46}, - { 16, 0}, - { 18, 0}, { 1, 17}, { 4, 18}, { 1, 43}, { 4, 44}, { 1, 35}, { 5, 18}, { 1, 47}, /* Row 27 */ - { 1, 45}, { 5, 38}, { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 12, 4}, { 1, 19}, { 1, 23}, { 3, 18}, { 1, 35}, - { 6, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 9, 4}, - { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 11, 0}, { 1, 17}, - { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 53}, { 3, 38}, { 16, 0}, - { 18, 0}, { 4, 18}, { 1, 34}, { 5, 44}, { 1, 55}, { 1, 34}, { 5, 18}, { 1, 53}, /* Row 28 */ - { 4, 38}, { 1, 48}, { 1, 39}, { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, - { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 13, 4}, { 1, 19}, { 1, 23}, { 3, 18}, - { 1, 52}, { 6, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, - { 1, 56}, { 10, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, - { 10, 0}, { 5, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 51}, { 2, 38}, - { 1, 48}, { 1, 39}, { 15, 0}, - { 18, 0}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 29 */ - { 5, 38}, { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 14, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, - { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 7}, - { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 4, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 4, 38}, { 15, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, { 1, 53}, { 4, 38}, /* Row 30 */ - { 1, 48}, { 1, 39}, { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 15, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, - { 8, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, - { 11, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 7, 0}, - { 5, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 5, 38}, { 1, 1}, - { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 31 */ - { 5, 38}, { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 16, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 9, 44}, - { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 7}, - { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 4, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 5, 38}, { 1, 39}, - { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 9, 44}, { 1, 34}, { 5, 18}, { 1, 53}, { 4, 38}, /* Row 32 */ - { 1, 48}, { 1, 39}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 17, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 9, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 12, 4}, - { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 4, 0}, { 5, 18}, - { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 6, 38}, { 1, 1}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 9, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 33 */ - { 3, 38}, { 1, 48}, { 1, 57}, { 1, 13}, { 1, 6}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 18, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 10, 44}, - { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 7}, - { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 4, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 15, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 10, 44}, { 1, 34}, { 5, 18}, { 1, 53}, { 2, 38}, /* Row 34 */ - { 1, 48}, { 1, 58}, { 1, 59}, { 1, 60}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, - { 1, 6}, { 19, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 10, 44}, { 1, 52}, - { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 13, 4}, { 1, 7}, - { 1, 16}, { 1, 15}, { 1, 8}, { 3, 4}, { 1, 5}, { 1, 0}, { 5, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 61}, { 5, 38}, { 1, 48}, { 1, 39}, { 15, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 10, 44}, { 1, 52}, { 5, 18}, { 1, 47}, { 1, 45}, /* Row 35 */ - { 1, 48}, { 1, 58}, { 1, 59}, { 1, 31}, { 1, 32}, { 1, 62}, { 1, 12}, { 1, 13}, - { 1, 6}, { 20, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 11, 44}, { 1, 34}, - { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 7}, { 1, 16}, - { 1, 15}, { 1, 8}, { 3, 4}, { 1, 63}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, - { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 16, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 11, 44}, { 1, 34}, { 5, 18}, { 1, 64}, { 1, 58}, /* Row 36 */ - { 1, 59}, { 3, 31}, { 1, 65}, { 1, 66}, { 1, 6}, { 21, 4}, { 1, 19}, { 1, 23}, - { 2, 18}, { 1, 34}, { 11, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, - { 1, 32}, { 1, 56}, { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 1, 4}, - { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, - { 5, 38}, { 1, 48}, { 1, 39}, { 16, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 11, 44}, { 1, 52}, { 5, 18}, { 1, 67}, { 1, 68}, /* Row 37 */ - { 5, 31}, { 1, 69}, { 22, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 12, 44}, - { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 7}, - { 1, 16}, { 1, 15}, { 1, 8}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, - { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 17, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 12, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 38 */ - { 1, 70}, { 1, 7}, { 21, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 12, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 15, 4}, - { 1, 7}, { 1, 16}, { 1, 71}, { 1, 67}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 17, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 12, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, /* Row 39 */ - { 4, 31}, { 1, 32}, { 1, 56}, { 21, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, - { 13, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 16, 4}, - { 1, 72}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, - { 6, 38}, { 18, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 13, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 40 */ - { 1, 33}, { 1, 7}, { 20, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 13, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 15, 4}, - { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, - { 5, 38}, { 1, 48}, { 1, 39}, { 18, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 13, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, /* Row 41 */ - { 4, 31}, { 1, 32}, { 1, 56}, { 20, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, - { 14, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 14, 4}, - { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, - { 6, 38}, { 19, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 14, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 42 */ - { 1, 33}, { 1, 7}, { 19, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 14, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 13, 4}, - { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, - { 5, 38}, { 1, 48}, { 1, 39}, { 19, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 14, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, /* Row 43 */ - { 4, 31}, { 1, 32}, { 1, 56}, { 19, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 73}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, - { 1, 7}, { 12, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, - { 1, 47}, { 1, 45}, { 6, 38}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 15, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, /* Row 44 */ - { 1, 33}, { 1, 7}, { 18, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, - { 1, 56}, { 11, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 73}, { 6, 44}, { 1, 52}, { 5, 18}, /* Row 45 */ - { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 18, 4}, { 1, 19}, { 1, 23}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, - { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 21}, { 4, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, /* Row 46 */ - { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 17, 4}, { 1, 19}, { 1, 23}, { 2, 18}, - { 1, 34}, { 7, 44}, { 2, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, - { 4, 31}, { 1, 32}, { 1, 56}, { 9, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 1, 52}, { 6, 44}, { 1, 52}, /* Row 47 */ - { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 17, 4}, { 1, 19}, - { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 7, 44}, - { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 8, 4}, { 1, 21}, - { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, - { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 2, 34}, { 7, 44}, { 1, 34}, { 5, 18}, /* Row 48 */ - { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 16, 4}, { 1, 19}, { 1, 23}, { 2, 18}, - { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, - { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 7, 4}, { 1, 24}, { 1, 22}, - { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 74}, { 1, 48}, { 4, 38}, - { 1, 48}, { 1, 39}, { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 6, 44}, /* Row 49 */ - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 16, 4}, - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 6, 4}, - { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 75}, - { 1, 58}, { 1, 48}, { 4, 38}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 1, 18}, { 1, 34}, { 7, 44}, /* Row 50 */ - { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 19}, - { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 34}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 5, 4}, - { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 1, 31}, { 1, 59}, { 1, 58}, { 1, 48}, { 1, 38}, { 1, 48}, { 1, 39}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 52}, { 6, 44}, /* Row 51 */ - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 15, 4}, - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 4, 4}, - { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, - { 2, 31}, { 1, 59}, { 1, 58}, { 1, 48}, { 1, 38}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 34}, { 7, 44}, /* Row 52 */ - { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 14, 4}, { 1, 19}, - { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 34}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 3, 4}, - { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 4, 31}, { 1, 59}, { 1, 76}, { 1, 39}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 3, 18}, { 1, 52}, { 6, 44}, /* Row 53 */ - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 14, 4}, - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 2, 4}, - { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, - { 5, 31}, { 1, 77}, { 1, 78}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 3, 18}, { 1, 34}, { 7, 44}, /* Row 54 */ - { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 13, 4}, { 1, 19}, - { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 34}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 1, 4}, - { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 6, 31}, { 1, 32}, { 1, 56}, { 1, 5}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 52}, { 6, 44}, /* Row 55 */ - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 13, 4}, - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 4}, { 1, 21}, - { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, - { 1, 79}, { 1, 7}, { 1, 4}, { 1, 5}, { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 34}, { 7, 44}, /* Row 56 */ - { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 19}, - { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 34}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 80}, { 1, 22}, - { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 81}, - { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, { 1, 52}, { 6, 44}, /* Row 57 */ - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 12, 4}, - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 82}, { 4, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, - { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, { 1, 34}, { 7, 44}, /* Row 58 */ - { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 19}, - { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 34}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 3, 31}, { 1, 41}, { 1, 40}, { 4, 18}, - { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 2, 7}, - { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 19, 0}, - { 17, 0}, { 1, 83}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 6, 18}, { 1, 52}, /* Row 59 */ - { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, - { 11, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 7, 18}, - { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 3, 31}, { 1, 50}, { 4, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, - { 1, 56}, { 2, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, - { 18, 0}, - { 16, 0}, { 1, 1}, { 1, 84}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, /* Row 60 */ - { 6, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, - { 1, 7}, { 10, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 3, 18}, { 1, 85}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, - { 1, 41}, { 1, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 7}, { 1, 16}, - { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 17, 0}, - { 15, 0}, { 1, 1}, { 1, 2}, { 1, 86}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 61 */ - { 1, 34}, { 7, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, - { 4, 31}, { 1, 32}, { 1, 56}, { 10, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 87}, { 4, 18}, { 1, 52}, { 7, 44}, - { 1, 34}, { 4, 18}, { 1, 50}, { 1, 88}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 5, 4}, - { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 16, 0}, - { 14, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 89}, { 1, 23}, { 2, 18}, { 1, 34}, /* Row 62 */ - { 8, 44}, { 1, 34}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, - { 5, 31}, { 1, 33}, { 1, 7}, { 9, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 90}, { 1, 40}, { 3, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 91}, { 1, 40}, { 4, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 6, 4}, - { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 15, 0}, - { 13, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 71}, { 1, 29}, { 2, 18}, /* Row 63 */ - { 1, 34}, { 8, 44}, { 1, 34}, { 3, 18}, { 1, 85}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 9, 4}, - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 29}, - { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, - { 1, 32}, { 1, 56}, { 8, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, - { 1, 5}, { 14, 0}, - { 12, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 94}, { 1, 95}, /* Row 64 */ - { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 87}, { 4, 18}, - { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, - { 8, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, - { 1, 29}, { 1, 92}, { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, - { 9, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, - { 1, 7}, { 9, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, - { 13, 0}, - { 11, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 97}, /* Row 65 */ - { 1, 28}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 90}, - { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, - { 4, 31}, { 1, 32}, { 1, 56}, { 8, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 31}, { 1, 50}, { 4, 18}, - { 1, 52}, { 7, 44}, { 1, 34}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, - { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 11, 4}, { 1, 7}, { 1, 16}, - { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 12, 0}, - { 10, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 66 */ - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, - { 5, 31}, { 1, 33}, { 1, 7}, { 7, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 31}, { 1, 41}, { 1, 40}, - { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 7, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 7}, { 1, 16}, - { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 11, 0}, - { 9, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 67 */ - { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, - { 1, 29}, { 1, 92}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, - { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 7, 4}, { 1, 19}, - { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, - { 2, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, - { 14, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 10, 0}, - { 8, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 68 */ - { 2, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, - { 1, 29}, { 1, 92}, { 1, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 19}, { 1, 23}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 2, 31}, - { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 5, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 15, 4}, - { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 9, 0}, - { 7, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 69 */ - { 3, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, - { 1, 29}, { 1, 92}, { 1, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 6, 4}, - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 3, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 3, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, - { 1, 56}, { 17, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, - { 8, 0}, - { 6, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 70 */ - { 4, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, - { 1, 29}, { 1, 92}, { 2, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 19}, { 1, 23}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 3, 31}, - { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 3, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 18, 4}, - { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 7, 0}, - { 5, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 71 */ - { 5, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, - { 1, 29}, { 1, 92}, { 2, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 5, 4}, - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 4, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 1, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, - { 1, 56}, { 20, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, - { 6, 0}, - { 4, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 72 */ - { 6, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, - { 1, 29}, { 1, 92}, { 3, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 4, 4}, { 1, 19}, { 1, 23}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 4, 31}, - { 1, 41}, { 1, 40}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 1, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, { 1, 7}, { 21, 4}, - { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 5, 0}, - { 3, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 73 */ - { 7, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, - { 1, 29}, { 1, 92}, { 3, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 4, 4}, - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 5, 31}, { 1, 50}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 99}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 23, 4}, - { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 4, 0}, - { 2, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 74 */ - { 8, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, - { 1, 29}, { 1, 92}, { 4, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 5, 18}, { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 3, 4}, { 1, 19}, { 1, 23}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 5, 31}, - { 1, 41}, { 1, 67}, { 3, 18}, { 1, 34}, { 15, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 6, 31}, { 1, 33}, { 1, 7}, { 24, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, - { 2, 4}, { 1, 5}, { 3, 0}, - { 1, 0}, { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, /* Row 75 */ - { 9, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, - { 1, 29}, { 1, 92}, { 4, 31}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 3, 4}, - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 6, 31}, { 1, 72}, { 4, 18}, { 1, 52}, { 13, 44}, { 1, 52}, { 4, 18}, - { 1, 40}, { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 26, 4}, { 1, 7}, { 1, 16}, - { 1, 15}, { 1, 8}, { 2, 4}, { 1, 5}, { 2, 0}, - { 1, 1}, { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, { 10, 4}, /* Row 76 */ - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 5, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, - { 1, 50}, { 5, 31}, { 1, 33}, { 1, 7}, { 2, 4}, { 1, 19}, { 1, 23}, { 2, 18}, - { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 80}, - { 1, 22}, { 3, 18}, { 1, 34}, { 13, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, - { 1, 33}, { 1, 7}, { 27, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, - { 1, 5}, { 1, 0}, - { 1, 2}, { 1, 6}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, { 11, 4}, { 1, 19}, /* Row 77 */ - { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, - { 5, 31}, { 1, 41}, { 1, 67}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, - { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 2, 4}, { 1, 19}, { 1, 23}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, - { 1, 8}, { 1, 21}, { 4, 18}, { 1, 52}, { 11, 44}, { 1, 52}, { 4, 18}, { 1, 40}, - { 1, 41}, { 5, 31}, { 1, 32}, { 1, 56}, { 29, 4}, { 1, 7}, { 1, 16}, { 1, 15}, - { 1, 8}, { 2, 4}, { 1, 5}, - { 1, 3}, { 1, 8}, { 1, 93}, { 1, 96}, { 1, 98}, { 12, 4}, { 1, 19}, { 1, 23}, /* Row 78 */ - { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, - { 1, 72}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, - { 1, 33}, { 1, 7}, { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, - { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 24}, { 1, 22}, - { 3, 18}, { 1, 34}, { 11, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, - { 1, 7}, { 30, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 8}, { 2, 4}, - { 1, 4}, { 1, 33}, { 1, 100}, { 1, 98}, { 13, 4}, { 1, 19}, { 1, 23}, { 2, 18}, /* Row 79 */ - { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 80}, - { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, - { 4, 31}, { 1, 32}, { 1, 56}, { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 4}, - { 1, 101}, { 4, 18}, { 1, 52}, { 9, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, - { 5, 31}, { 1, 32}, { 1, 56}, { 32, 4}, { 1, 7}, { 1, 16}, { 1, 15}, { 1, 56}, - { 1, 7}, - { 1, 4}, { 1, 8}, { 1, 102}, { 1, 9}, { 1, 7}, { 12, 4}, { 1, 19}, { 1, 23}, /* Row 80 */ - { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, - { 1, 8}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, - { 5, 31}, { 1, 33}, { 1, 7}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, - { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 4}, { 1, 101}, - { 4, 18}, { 1, 34}, { 9, 44}, { 1, 35}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 33}, - { 1, 7}, { 33, 4}, { 1, 7}, { 1, 103}, { 1, 10}, { 1, 8}, - { 2, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 11, 4}, { 1, 19}, { 1, 23}, /* Row 81 */ - { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, - { 1, 8}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, - { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 56}, { 1, 19}, { 1, 23}, { 2, 18}, - { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, - { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 8, 44}, { 1, 104}, { 4, 18}, { 1, 29}, - { 1, 68}, { 6, 31}, { 1, 56}, { 33, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 66}, - { 1, 3}, - { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 10, 4}, { 1, 19}, { 1, 23}, /* Row 82 */ - { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, - { 1, 8}, { 1, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, - { 1, 50}, { 5, 31}, { 1, 33}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 7, 44}, - { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 1, 21}, { 4, 18}, - { 1, 34}, { 10, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 56}, { 32, 4}, - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, - { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 9, 4}, { 1, 19}, /* Row 83 */ - { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, - { 6, 31}, { 1, 8}, { 1, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 32}, { 1, 105}, { 1, 23}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, - { 1, 80}, { 1, 22}, { 4, 18}, { 1, 52}, { 10, 44}, { 1, 52}, { 4, 18}, { 1, 40}, - { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 30, 4}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, - { 1, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 8, 4}, /* Row 84 */ - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 6, 31}, { 1, 8}, { 2, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, - { 1, 34}, { 5, 18}, { 1, 50}, { 5, 31}, { 1, 106}, { 1, 23}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 72}, { 4, 18}, - { 1, 34}, { 12, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, - { 29, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, - { 1, 0}, - { 2, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 7, 4}, /* Row 85 */ - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 6, 31}, { 1, 8}, { 2, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, - { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 107}, { 1, 29}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 5, 31}, - { 1, 41}, { 1, 67}, { 4, 18}, { 1, 52}, { 12, 44}, { 1, 52}, { 4, 18}, { 1, 40}, - { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 27, 4}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 2, 0}, - { 3, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 6, 4}, /* Row 86 */ - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 6, 31}, { 1, 8}, { 3, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, - { 1, 34}, { 5, 18}, { 1, 50}, { 4, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 5, 31}, { 1, 50}, { 4, 18}, - { 1, 34}, { 14, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, - { 26, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, - { 3, 0}, - { 4, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 5, 4}, /* Row 87 */ - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 6, 31}, { 1, 8}, { 3, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, - { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 3, 31}, { 1, 92}, { 1, 29}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 4, 31}, - { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 14, 44}, { 1, 52}, { 4, 18}, { 1, 40}, - { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 24, 4}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 4, 0}, - { 5, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 4, 4}, /* Row 88 */ - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 6, 31}, { 1, 8}, { 4, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, - { 1, 34}, { 5, 18}, { 1, 50}, { 3, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 4, 31}, { 1, 50}, { 4, 18}, - { 1, 34}, { 16, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, - { 23, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, - { 5, 0}, - { 6, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 3, 4}, /* Row 89 */ - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 6, 31}, { 1, 8}, { 4, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, - { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 2, 31}, { 1, 92}, { 1, 29}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 3, 31}, - { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 1, 34}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 21, 4}, - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 6, 0}, - { 7, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 2, 4}, /* Row 90 */ - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 6, 31}, { 1, 8}, { 5, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, - { 1, 34}, { 5, 18}, { 1, 50}, { 2, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 3, 31}, { 1, 50}, { 4, 18}, - { 1, 34}, { 8, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, - { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 20, 4}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0}, - { 8, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 4}, /* Row 91 */ - { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 6, 31}, { 1, 8}, { 5, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, - { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, { 1, 41}, { 1, 31}, { 1, 92}, { 1, 29}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 2, 31}, - { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 2, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, - { 18, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, - { 8, 0}, - { 9, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 19}, /* Row 92 */ - { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, - { 6, 31}, { 1, 8}, { 6, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 5, 18}, { 1, 50}, { 1, 31}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44}, - { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 2, 31}, { 1, 50}, { 4, 18}, { 1, 34}, - { 8, 44}, { 1, 34}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 5, 31}, { 1, 32}, { 1, 56}, { 17, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, - { 1, 6}, { 1, 4}, { 1, 5}, { 9, 0}, - { 10, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 19}, { 1, 23}, /* Row 93 */ - { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, - { 1, 8}, { 6, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, - { 5, 18}, { 1, 40}, { 1, 41}, { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44}, - { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 31}, { 1, 41}, { 1, 40}, { 4, 18}, - { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, - { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 15, 4}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0}, - { 11, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 108}, { 1, 23}, { 2, 18}, /* Row 94 */ - { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, - { 7, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 50}, - { 1, 92}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 1, 31}, { 1, 50}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 5, 18}, - { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, - { 14, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, - { 11, 0}, - { 12, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 109}, { 1, 29}, { 2, 18}, { 1, 34}, /* Row 95 */ - { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 7, 4}, - { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 40}, - { 1, 90}, { 1, 29}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, - { 1, 92}, { 1, 41}, { 1, 40}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 6, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, - { 1, 7}, { 12, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, - { 1, 5}, { 12, 0}, - { 13, 0}, { 1, 5}, { 3, 4}, { 1, 89}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 96 */ - { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 8, 4}, { 1, 21}, - { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 87}, { 1, 29}, { 2, 18}, - { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 1, 50}, { 4, 18}, - { 1, 34}, { 8, 44}, { 1, 34}, { 7, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, - { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 11, 4}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 13, 0}, - { 14, 0}, { 1, 5}, { 2, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 97 */ - { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 8, 4}, { 1, 24}, - { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 5, 18}, { 1, 85}, { 3, 18}, - { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 90}, { 1, 40}, { 4, 18}, - { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 85}, { 3, 18}, { 1, 34}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 9, 4}, - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 14, 0}, - { 15, 0}, { 1, 5}, { 1, 4}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, /* Row 98 */ - { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 9, 4}, { 1, 21}, - { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 8, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 2, 18}, { 1, 29}, { 1, 87}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, - { 1, 87}, { 1, 40}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 5, 31}, { 1, 32}, { 1, 56}, { 8, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, - { 1, 6}, { 1, 4}, { 1, 5}, { 15, 0}, - { 16, 0}, { 1, 5}, { 1, 19}, { 1, 23}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, /* Row 99 */ - { 2, 18}, { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 9, 4}, { 1, 24}, { 1, 22}, - { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 8, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 3, 18}, { 1, 85}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, - { 1, 41}, { 1, 50}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, - { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0}, - { 17, 0}, { 1, 110}, { 1, 111}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, /* Row 100 */ - { 1, 29}, { 1, 92}, { 6, 31}, { 1, 8}, { 10, 4}, { 1, 21}, { 4, 18}, { 1, 34}, - { 7, 44}, { 1, 34}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 7, 18}, { 1, 34}, - { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 1, 31}, { 1, 41}, { 1, 40}, { 3, 18}, - { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, - { 5, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, - { 17, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 101 */ - { 6, 31}, { 1, 8}, { 10, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 7, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 7, 18}, { 1, 52}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 2, 31}, { 1, 50}, { 3, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 1, 7}, - { 3, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, - { 18, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 102 */ - { 6, 31}, { 1, 8}, { 11, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 6, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 34}, { 8, 44}, { 1, 34}, - { 4, 18}, { 1, 50}, { 3, 31}, { 1, 41}, { 1, 40}, { 3, 18}, { 1, 52}, { 7, 44}, - { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 2, 4}, { 1, 7}, - { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 19, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 103 */ - { 6, 31}, { 1, 8}, { 11, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 6, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 6, 18}, { 1, 52}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 4, 31}, { 1, 50}, { 3, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 33}, { 2, 7}, - { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 104 */ - { 6, 31}, { 1, 8}, { 12, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 5, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 34}, { 8, 44}, { 1, 34}, - { 4, 18}, { 1, 50}, { 5, 31}, { 1, 41}, { 1, 40}, { 3, 18}, { 1, 52}, { 7, 44}, - { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 32}, { 1, 56}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 105 */ - { 6, 31}, { 1, 8}, { 12, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 5, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 5, 18}, { 1, 52}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 82}, { 3, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, { 1, 81}, { 1, 12}, - { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 106 */ - { 6, 31}, { 1, 8}, { 13, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, - { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 80}, { 1, 22}, { 3, 18}, { 1, 52}, - { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 5, 31}, { 1, 77}, { 1, 112}, { 1, 6}, - { 1, 4}, { 1, 5}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 107 */ - { 6, 31}, { 1, 8}, { 13, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 52}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 4}, { 1, 21}, - { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 5, 31}, - { 1, 113}, { 1, 8}, { 1, 5}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 108 */ - { 6, 31}, { 1, 8}, { 14, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 3, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, - { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 1, 4}, { 1, 24}, { 1, 22}, - { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 4, 31}, { 1, 59}, - { 1, 58}, { 1, 114}, { 25, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 109 */ - { 6, 31}, { 1, 8}, { 14, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 3, 18}, { 1, 52}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 2, 4}, - { 1, 21}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, - { 2, 31}, { 1, 59}, { 1, 58}, { 1, 48}, { 1, 38}, { 25, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 110 */ - { 6, 31}, { 1, 8}, { 15, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 34}, { 8, 44}, { 1, 34}, - { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 3, 4}, { 1, 24}, { 1, 22}, - { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 1, 31}, { 1, 59}, - { 1, 58}, { 1, 48}, { 1, 38}, { 1, 48}, { 1, 39}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 111 */ - { 6, 31}, { 1, 8}, { 15, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 2, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 2, 18}, { 1, 52}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 4, 4}, - { 1, 21}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, { 1, 75}, - { 1, 58}, { 1, 48}, { 4, 38}, { 24, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 112 */ - { 6, 31}, { 1, 8}, { 16, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 1, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 34}, { 8, 44}, { 1, 34}, - { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 5, 4}, { 1, 24}, { 1, 22}, - { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 74}, { 1, 48}, { 4, 38}, - { 1, 48}, { 1, 39}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 113 */ - { 6, 31}, { 1, 8}, { 16, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 1, 18}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 18}, { 1, 52}, { 7, 44}, - { 1, 52}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 6, 4}, - { 1, 21}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, - { 6, 38}, { 23, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 114 */ - { 6, 31}, { 1, 8}, { 17, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 2, 34}, - { 7, 44}, { 2, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, - { 1, 56}, { 7, 4}, { 1, 24}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 92}, /* Row 115 */ - { 6, 31}, { 1, 8}, { 17, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, - { 1, 52}, { 1, 34}, { 7, 44}, { 1, 34}, { 1, 52}, { 7, 44}, { 1, 52}, { 4, 18}, - { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 8, 4}, { 1, 21}, { 3, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 22, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 29}, { 1, 115}, /* Row 116 */ - { 6, 31}, { 1, 8}, { 18, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 7, 44}, { 1, 34}, - { 7, 44}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, - { 1, 56}, { 9, 4}, { 1, 24}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 116}, /* Row 117 */ - { 1, 59}, { 5, 31}, { 1, 8}, { 18, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, - { 6, 44}, { 1, 73}, { 7, 44}, { 1, 73}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 40}, - { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 21}, { 3, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 21, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 118 */ - { 1, 58}, { 1, 59}, { 4, 31}, { 1, 16}, { 1, 7}, { 18, 4}, { 1, 21}, { 4, 18}, - { 1, 34}, { 22, 44}, { 1, 34}, { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, - { 11, 4}, { 1, 24}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, - { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 119 */ - { 1, 48}, { 1, 58}, { 1, 59}, { 3, 31}, { 1, 42}, { 1, 16}, { 1, 7}, { 17, 4}, - { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 20, 44}, { 1, 52}, { 4, 18}, { 1, 40}, - { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 12, 4}, { 1, 21}, { 3, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 20, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 120 */ - { 1, 38}, { 1, 48}, { 1, 58}, { 1, 59}, { 2, 31}, { 1, 56}, { 1, 15}, { 1, 16}, - { 1, 7}, { 17, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 20, 44}, { 1, 34}, { 4, 18}, - { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 12, 4}, { 1, 7}, { 1, 117}, { 1, 73}, - { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, - { 1, 39}, { 19, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 121 */ - { 2, 38}, { 1, 48}, { 1, 58}, { 1, 59}, { 1, 31}, { 2, 8}, { 1, 15}, { 1, 16}, - { 1, 7}, { 16, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 18, 44}, { 1, 52}, - { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 11, 4}, { 1, 7}, - { 1, 9}, { 1, 118}, { 1, 119}, { 3, 18}, { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, - { 1, 47}, { 1, 45}, { 6, 38}, { 19, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 122 */ - { 3, 38}, { 1, 48}, { 1, 58}, { 1, 113}, { 1, 8}, { 1, 4}, { 1, 8}, { 1, 15}, - { 1, 16}, { 1, 7}, { 16, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 18, 44}, { 1, 34}, - { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 11, 4}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 120}, { 1, 22}, { 3, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 18, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 123 */ - { 4, 38}, { 1, 48}, { 1, 121}, { 1, 122}, { 2, 4}, { 1, 8}, { 1, 15}, { 1, 16}, - { 1, 7}, { 15, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 16, 44}, { 1, 52}, - { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 10, 4}, { 1, 7}, - { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 123}, { 3, 18}, { 1, 34}, - { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 18, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 124 */ - { 5, 38}, { 1, 48}, { 1, 124}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 15, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 16, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 6, 31}, { 1, 32}, { 1, 56}, { 10, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, - { 1, 6}, { 1, 4}, { 1, 5}, { 1, 125}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 17, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 125 */ - { 6, 38}, { 1, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 14, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 14, 44}, { 1, 52}, { 4, 18}, - { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 9, 4}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 2, 0}, { 1, 17}, { 3, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 17, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 126 */ - { 6, 38}, { 2, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 14, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 14, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 6, 31}, { 1, 32}, { 1, 56}, { 9, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, - { 1, 6}, { 1, 4}, { 1, 5}, { 4, 0}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 16, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 127 */ - { 6, 38}, { 3, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 13, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 12, 44}, { 1, 52}, { 4, 18}, - { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 8, 4}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 5, 0}, { 1, 17}, { 3, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 16, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 128 */ - { 6, 38}, { 4, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 13, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 12, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 6, 31}, { 1, 32}, { 1, 56}, { 8, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, - { 1, 6}, { 1, 4}, { 1, 5}, { 7, 0}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 53}, { 5, 38}, { 1, 48}, { 1, 39}, { 15, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 129 */ - { 6, 38}, { 5, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 12, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 10, 44}, { 1, 52}, { 4, 18}, - { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 7, 4}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 8, 0}, { 1, 17}, { 3, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 47}, { 1, 45}, { 6, 38}, { 15, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 130 */ - { 6, 38}, { 6, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 12, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 10, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 6, 31}, { 1, 32}, { 1, 56}, { 7, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, - { 1, 6}, { 1, 4}, { 1, 5}, { 10, 0}, { 4, 18}, { 1, 52}, { 7, 44}, { 1, 34}, - { 4, 18}, { 1, 51}, { 5, 38}, { 1, 48}, { 1, 126}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 131 */ - { 6, 38}, { 7, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 11, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 8, 44}, { 1, 52}, { 4, 18}, - { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 6, 4}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 11, 0}, { 1, 17}, { 3, 18}, - { 1, 34}, { 7, 44}, { 1, 52}, { 4, 18}, { 1, 53}, { 6, 38}, { 1, 127}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 132 */ - { 6, 38}, { 8, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 11, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 4, 18}, { 1, 50}, - { 6, 31}, { 1, 32}, { 1, 56}, { 6, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, - { 1, 6}, { 1, 4}, { 1, 5}, { 13, 0}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, - { 4, 18}, { 1, 53}, { 7, 38}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 133 */ - { 6, 38}, { 9, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 10, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 52}, { 6, 44}, { 1, 52}, { 4, 18}, - { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 5, 4}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 14, 0}, { 1, 17}, { 3, 18}, - { 1, 34}, { 6, 44}, { 1, 52}, { 4, 18}, { 1, 128}, { 6, 38}, { 1, 48}, { 1, 126}, - { 13, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 134 */ - { 6, 38}, { 10, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 10, 4}, { 1, 21}, { 4, 18}, { 1, 34}, { 1, 55}, { 4, 44}, { 1, 55}, { 1, 34}, - { 4, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 5, 4}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 16, 0}, { 4, 18}, { 1, 52}, - { 5, 44}, { 1, 34}, { 3, 18}, { 1, 47}, { 1, 45}, { 7, 38}, { 1, 39}, { 13, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 135 */ - { 6, 38}, { 11, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 9, 4}, { 1, 24}, { 1, 22}, { 4, 18}, { 1, 34}, { 1, 52}, { 2, 44}, { 1, 52}, - { 1, 34}, { 4, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, { 1, 7}, { 4, 4}, - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 17, 0}, - { 1, 17}, { 3, 18}, { 1, 34}, { 1, 52}, { 2, 44}, { 1, 52}, { 1, 34}, { 4, 18}, - { 1, 53}, { 8, 38}, { 1, 39}, { 13, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 136 */ - { 6, 38}, { 12, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 9, 4}, { 1, 21}, { 6, 18}, { 2, 34}, { 6, 18}, { 1, 50}, { 6, 31}, { 1, 32}, - { 1, 56}, { 4, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, - { 1, 5}, { 19, 0}, { 5, 18}, { 2, 34}, { 5, 18}, { 1, 47}, { 1, 45}, { 8, 38}, - { 1, 1}, { 13, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 137 */ - { 6, 38}, { 13, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 8, 4}, { 1, 24}, { 1, 22}, { 12, 18}, { 1, 40}, { 1, 41}, { 6, 31}, { 1, 33}, - { 1, 7}, { 3, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, - { 1, 5}, { 20, 0}, { 1, 17}, { 10, 18}, { 1, 35}, { 1, 61}, { 9, 38}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 34}, { 2, 18}, { 1, 35}, { 1, 45}, /* Row 138 */ - { 6, 38}, { 14, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 8, 4}, { 1, 21}, { 12, 18}, { 1, 50}, { 6, 31}, { 1, 32}, { 1, 56}, { 3, 4}, - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 22, 0}, - { 9, 18}, { 1, 35}, { 1, 61}, { 8, 38}, { 1, 48}, { 1, 39}, { 14, 0}, - { 18, 0}, { 3, 18}, { 1, 34}, { 8, 44}, { 1, 18}, { 2, 35}, { 1, 129}, { 1, 45}, /* Row 139 */ - { 6, 38}, { 15, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, - { 7, 4}, { 1, 19}, { 1, 26}, { 10, 18}, { 1, 130}, { 1, 107}, { 6, 31}, { 1, 33}, - { 1, 7}, { 2, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, - { 1, 5}, { 23, 0}, { 1, 131}, { 1, 132}, { 5, 18}, { 1, 35}, { 1, 133}, { 1, 128}, - { 10, 38}, { 15, 0}, - { 25, 0}, { 9, 45}, { 7, 38}, { 16, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, /* Row 140 */ - { 1, 16}, { 1, 7}, { 7, 4}, { 1, 19}, { 1, 21}, { 1, 22}, { 6, 18}, { 1, 40}, - { 1, 50}, { 1, 107}, { 6, 31}, { 1, 32}, { 1, 56}, { 2, 4}, { 1, 7}, { 1, 9}, - { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 27, 0}, { 1, 134}, { 1, 17}, - { 1, 135}, { 1, 51}, { 1, 45}, { 1, 136}, { 9, 38}, { 1, 48}, { 1, 39}, { 15, 0}, - { 25, 0}, { 16, 38}, { 17, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 141 */ - { 1, 7}, { 8, 4}, { 1, 24}, { 1, 21}, { 1, 22}, { 2, 29}, { 1, 67}, { 1, 50}, - { 1, 41}, { 8, 31}, { 1, 16}, { 1, 7}, { 1, 4}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 30, 0}, { 1, 1}, { 11, 38}, { 1, 48}, - { 1, 38}, { 16, 0}, - { 25, 0}, { 16, 38}, { 18, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 142 */ - { 1, 7}, { 9, 4}, { 1, 89}, { 1, 137}, { 1, 138}, { 1, 92}, { 8, 31}, { 1, 42}, - { 1, 16}, { 1, 7}, { 1, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, - { 1, 4}, { 1, 5}, { 32, 0}, { 1, 39}, { 1, 48}, { 8, 38}, { 1, 48}, { 1, 38}, - { 17, 0}, - { 25, 0}, { 16, 38}, { 19, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 143 */ - { 1, 7}, { 9, 4}, { 1, 7}, { 1, 56}, { 1, 33}, { 1, 32}, { 5, 31}, { 1, 42}, - { 1, 16}, { 1, 8}, { 2, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, - { 1, 4}, { 1, 5}, { 34, 0}, { 8, 38}, { 1, 48}, { 1, 38}, { 18, 0}, - { 25, 0}, { 16, 38}, { 20, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 144 */ - { 1, 7}, { 10, 4}, { 1, 7}, { 7, 8}, { 3, 4}, { 1, 7}, { 1, 9}, { 1, 12}, - { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 35, 0}, { 1, 46}, { 7, 38}, { 1, 39}, - { 19, 0}, - { 25, 0}, { 16, 38}, { 21, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 145 */ - { 1, 7}, { 19, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, - { 1, 5}, { 64, 0}, - { 25, 0}, { 16, 38}, { 22, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, /* Row 146 */ - { 1, 7}, { 17, 4}, { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, - { 1, 5}, { 65, 0}, - { 64, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 15, 4}, /* Row 147 */ - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 66, 0}, - { 65, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 13, 4}, /* Row 148 */ - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 67, 0}, - { 66, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 11, 4}, /* Row 149 */ - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 68, 0}, - { 67, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 9, 4}, /* Row 150 */ - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 69, 0}, - { 68, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 7, 4}, /* Row 151 */ - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 70, 0}, - { 69, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 5, 4}, /* Row 152 */ - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 71, 0}, - { 70, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 3, 4}, /* Row 153 */ - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 72, 0}, - { 71, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 4}, /* Row 154 */ - { 1, 7}, { 1, 9}, { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 73, 0}, - { 72, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 16}, { 1, 7}, { 1, 9}, /* Row 155 */ - { 1, 12}, { 1, 13}, { 1, 6}, { 1, 4}, { 1, 5}, { 74, 0}, - { 73, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 15}, { 1, 103}, { 1, 12}, { 1, 13}, /* Row 156 */ - { 1, 6}, { 1, 4}, { 1, 5}, { 75, 0}, - { 74, 0}, { 1, 5}, { 3, 4}, { 1, 8}, { 1, 139}, { 1, 13}, { 1, 6}, { 1, 4}, /* Row 157 */ - { 1, 5}, { 76, 0}, - { 75, 0}, { 1, 5}, { 2, 4}, { 1, 3}, { 1, 140}, { 1, 6}, { 1, 4}, { 1, 5}, /* Row 158 */ - { 77, 0}, - { 76, 0}, { 1, 5}, { 4, 4}, { 1, 5}, { 78, 0} /* Row 159 */ -}; - -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 8 -# ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE - - { 76, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 4, 4}, { 1, 5}, { 76, 0}, /* Row 0 */ - { 75, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 5, 4}, { 1, 5}, { 75, 0}, /* Row 1 */ - { 74, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 9}, { 1, 10}, /* Row 2 */ - { 4, 4}, { 1, 5}, { 74, 0}, - { 73, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 3 */ - { 1, 12}, { 1, 13}, { 4, 4}, { 1, 5}, { 73, 0}, - { 72, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 4 */ - { 1, 7}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 72, 0}, - { 71, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 5 */ - { 1, 7}, { 2, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 71, 0}, - { 70, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 6 */ - { 1, 7}, { 4, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 70, 0}, - { 69, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 7 */ - { 1, 7}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 69, 0}, - { 68, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 8 */ - { 1, 7}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 68, 0}, - { 67, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 9 */ - { 1, 7}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 67, 0}, - { 66, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 10 */ - { 1, 7}, { 12, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 66, 0}, - { 65, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 11 */ - { 1, 7}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 65, 0}, - { 64, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 12 */ - { 1, 7}, { 16, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 64, 0}, - { 63, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 13 */ - { 1, 7}, { 18, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 63, 0}, - { 62, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 14 */ - { 1, 7}, { 20, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 62, 0}, - { 61, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 15 */ - { 1, 7}, { 22, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 61, 0}, - { 60, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 16 */ - { 1, 7}, { 24, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 60, 0}, - { 59, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 17 */ - { 1, 7}, { 26, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 59, 0}, - { 58, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 18 */ - { 1, 7}, { 28, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 26, 0}, - { 1, 14}, { 5, 15}, { 1, 14}, { 25, 0}, - { 57, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 19 */ - { 1, 7}, { 10, 4}, { 5, 16}, { 15, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, - { 1, 5}, { 23, 0}, { 1, 17}, { 9, 15}, { 1, 17}, { 23, 0}, - { 56, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, /* Row 20 */ - { 1, 7}, { 9, 4}, { 1, 16}, { 1, 18}, { 1, 19}, { 3, 20}, { 1, 19}, { 1, 18}, - { 1, 21}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 22, 0}, - { 11, 15}, { 1, 17}, { 22, 0}, - { 23, 0}, { 1, 14}, { 5, 15}, { 1, 22}, { 25, 0}, { 1, 1}, { 1, 6}, { 1, 7}, /* Row 21 */ - { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 9, 4}, { 1, 16}, { 1, 23}, - { 7, 15}, { 1, 19}, { 1, 24}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, - { 1, 5}, { 20, 0}, { 1, 14}, { 12, 15}, { 1, 17}, { 21, 0}, - { 21, 0}, { 1, 17}, { 9, 15}, { 1, 17}, { 22, 0}, { 1, 1}, { 1, 6}, { 1, 7}, /* Row 22 */ - { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 9, 4}, { 1, 16}, { 1, 23}, - { 9, 15}, { 1, 20}, { 1, 24}, { 4, 4}, { 1, 3}, { 9, 4}, { 1, 3}, { 1, 8}, - { 1, 13}, { 4, 4}, { 1, 5}, { 19, 0}, { 14, 15}, { 21, 0}, - { 21, 0}, { 11, 15}, { 1, 17}, { 20, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, /* Row 23 */ - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 10, 4}, { 1, 18}, { 11, 15}, { 1, 25}, - { 1, 26}, { 2, 27}, { 1, 28}, { 1, 29}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, - { 4, 4}, { 1, 5}, { 17, 0}, { 1, 14}, { 5, 15}, { 1, 30}, { 2, 31}, { 1, 30}, - { 5, 15}, { 1, 14}, { 20, 0}, - { 20, 0}, { 1, 22}, { 12, 15}, { 1, 32}, { 4, 33}, { 1, 7}, { 13, 0}, { 1, 1}, /* Row 24 */ - { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 10, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 3, 30}, { 5, 15}, { 1, 34}, { 1, 35}, { 3, 27}, - { 1, 36}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 16, 0}, - { 5, 15}, { 1, 37}, { 4, 38}, { 1, 37}, { 4, 15}, { 1, 39}, { 1, 40}, { 1, 41}, - { 18, 0}, - { 19, 0}, { 1, 14}, { 13, 15}, { 1, 31}, { 1, 40}, { 5, 33}, { 11, 0}, { 1, 1}, /* Row 25 */ - { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 11, 4}, - { 1, 42}, { 4, 15}, { 1, 31}, { 3, 38}, { 1, 37}, { 5, 15}, { 1, 43}, { 4, 27}, - { 1, 36}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 14, 0}, - { 1, 14}, { 4, 15}, { 1, 30}, { 6, 38}, { 1, 30}, { 4, 15}, { 1, 22}, { 1, 33}, - { 1, 41}, { 17, 0}, - { 19, 0}, { 5, 15}, { 1, 30}, { 1, 44}, { 1, 34}, { 1, 31}, { 6, 15}, { 1, 45}, /* Row 26 */ - { 5, 33}, { 1, 7}, { 9, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, - { 1, 7}, { 1, 11}, { 1, 7}, { 11, 4}, { 1, 46}, { 1, 47}, { 4, 15}, { 1, 48}, - { 4, 38}, { 1, 37}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 36}, { 10, 4}, - { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 13, 0}, { 5, 15}, { 1, 34}, - { 6, 38}, { 1, 44}, { 4, 15}, { 1, 45}, { 2, 33}, { 1, 41}, { 16, 0}, - { 18, 0}, { 1, 14}, { 4, 15}, { 1, 37}, { 4, 38}, { 1, 31}, { 5, 15}, { 1, 31}, /* Row 27 */ - { 1, 40}, { 5, 33}, { 8, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, - { 1, 7}, { 1, 11}, { 1, 7}, { 12, 4}, { 1, 16}, { 1, 20}, { 3, 15}, { 1, 31}, - { 6, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 9, 4}, - { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 11, 0}, { 1, 14}, { 4, 15}, - { 1, 30}, { 7, 38}, { 1, 44}, { 4, 15}, { 1, 45}, { 3, 33}, { 16, 0}, - { 18, 0}, { 4, 15}, { 1, 30}, { 5, 38}, { 1, 48}, { 1, 30}, { 5, 15}, { 1, 45}, /* Row 28 */ - { 5, 33}, { 1, 7}, { 6, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, - { 1, 7}, { 1, 11}, { 1, 7}, { 13, 4}, { 1, 16}, { 1, 20}, { 3, 15}, { 1, 19}, - { 6, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, - { 10, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 10, 0}, { 5, 15}, - { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 22}, { 3, 33}, { 1, 7}, { 15, 0}, - { 18, 0}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 29 */ - { 5, 33}, { 5, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 14, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 3}, - { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 8, 0}, { 1, 14}, { 4, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 4, 33}, { 15, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 45}, { 5, 33}, /* Row 30 */ - { 1, 7}, { 3, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 15, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 11, 4}, - { 1, 3}, { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 7, 0}, { 5, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 5, 33}, { 1, 50}, { 14, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 31 */ - { 5, 33}, { 2, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 16, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 9, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 11, 4}, { 1, 3}, - { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 5, 0}, { 1, 14}, { 4, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 5, 33}, { 1, 7}, { 14, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 9, 38}, { 1, 30}, { 5, 15}, { 1, 45}, { 5, 33}, /* Row 32 */ - { 1, 7}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, - { 1, 7}, { 17, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 9, 38}, { 1, 34}, - { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 12, 4}, { 1, 3}, - { 1, 8}, { 1, 13}, { 4, 4}, { 1, 5}, { 4, 0}, { 5, 15}, { 1, 34}, { 7, 38}, - { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 50}, { 14, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 9, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 33 */ - { 4, 33}, { 1, 51}, { 1, 52}, { 1, 7}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, - { 1, 7}, { 18, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 10, 38}, { 1, 30}, - { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 3}, { 1, 8}, - { 1, 13}, { 4, 4}, { 1, 5}, { 2, 0}, { 1, 14}, { 4, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 15, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 10, 38}, { 1, 30}, { 5, 15}, { 1, 45}, { 3, 33}, /* Row 34 */ - { 1, 53}, { 1, 54}, { 1, 21}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 19, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 10, 38}, { 1, 34}, { 4, 15}, - { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 13, 4}, { 1, 3}, { 1, 8}, - { 1, 13}, { 4, 4}, { 1, 5}, { 1, 0}, { 5, 15}, { 1, 34}, { 7, 38}, { 1, 30}, - { 3, 15}, { 1, 55}, { 1, 56}, { 6, 33}, { 1, 7}, { 15, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 10, 38}, { 1, 34}, { 5, 15}, { 1, 31}, { 1, 40}, /* Row 35 */ - { 1, 33}, { 1, 53}, { 1, 57}, { 1, 27}, { 1, 28}, { 1, 58}, { 1, 7}, { 1, 11}, - { 1, 7}, { 20, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 11, 38}, { 1, 30}, - { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 13, 4}, { 1, 3}, { 1, 8}, - { 1, 13}, { 4, 4}, { 1, 59}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, - { 1, 31}, { 1, 60}, { 6, 33}, { 16, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 11, 38}, { 1, 30}, { 5, 15}, { 1, 61}, { 1, 53}, /* Row 36 */ - { 1, 57}, { 3, 27}, { 1, 62}, { 1, 56}, { 1, 7}, { 21, 4}, { 1, 16}, { 1, 20}, - { 2, 15}, { 1, 30}, { 11, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, - { 1, 28}, { 1, 49}, { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 2, 4}, { 1, 21}, - { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, - { 1, 7}, { 16, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 11, 38}, { 1, 34}, { 5, 15}, { 1, 63}, { 1, 35}, /* Row 37 */ - { 5, 27}, { 1, 64}, { 22, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 12, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 14, 4}, { 1, 3}, - { 1, 8}, { 1, 13}, { 1, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 17, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 12, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 38 */ - { 1, 65}, { 1, 3}, { 21, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 12, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 15, 4}, - { 1, 3}, { 1, 8}, { 1, 66}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, - { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 17, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 12, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, /* Row 39 */ - { 4, 27}, { 1, 28}, { 1, 49}, { 21, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, - { 13, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 16, 4}, - { 1, 67}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, - { 6, 33}, { 18, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 13, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 40 */ - { 1, 29}, { 1, 3}, { 20, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 13, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 15, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, - { 6, 33}, { 1, 7}, { 18, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 13, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, /* Row 41 */ - { 4, 27}, { 1, 28}, { 1, 49}, { 20, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, - { 14, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 14, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, - { 6, 33}, { 19, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 14, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 42 */ - { 1, 29}, { 1, 3}, { 19, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 14, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 13, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, - { 6, 33}, { 1, 7}, { 19, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 14, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, /* Row 43 */ - { 4, 27}, { 1, 28}, { 1, 49}, { 19, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 68}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, - { 1, 3}, { 12, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, - { 1, 31}, { 1, 40}, { 6, 33}, { 20, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 15, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, /* Row 44 */ - { 1, 29}, { 1, 3}, { 18, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, - { 1, 69}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, - { 1, 49}, { 11, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, - { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 20, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 68}, { 6, 38}, { 1, 34}, { 5, 15}, /* Row 45 */ - { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 18, 4}, { 1, 16}, { 1, 20}, - { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, - { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 18}, { 4, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 21, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 69}, { 7, 38}, { 1, 30}, { 5, 15}, /* Row 46 */ - { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 17, 4}, { 1, 16}, { 1, 20}, { 2, 15}, - { 1, 30}, { 7, 38}, { 2, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, - { 4, 27}, { 1, 28}, { 1, 49}, { 9, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 21, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 1, 34}, { 6, 38}, { 1, 34}, /* Row 47 */ - { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 17, 4}, { 1, 16}, - { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 34}, { 7, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 8, 4}, { 1, 18}, - { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, - { 22, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 2, 30}, { 7, 38}, { 1, 30}, { 5, 15}, /* Row 48 */ - { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 16, 4}, { 1, 16}, { 1, 20}, { 2, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, - { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 7, 4}, { 1, 21}, { 1, 19}, - { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 70}, { 6, 33}, { 1, 7}, - { 22, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 1, 15}, { 1, 34}, { 6, 38}, /* Row 49 */ - { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 16, 4}, - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 6, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 1}, - { 1, 53}, { 5, 33}, { 23, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 1, 15}, { 1, 30}, { 7, 38}, /* Row 50 */ - { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 15, 4}, { 1, 16}, - { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 5, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, - { 1, 27}, { 1, 57}, { 1, 53}, { 3, 33}, { 1, 7}, { 23, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 34}, { 6, 38}, /* Row 51 */ - { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 15, 4}, - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 4, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, - { 2, 27}, { 1, 57}, { 1, 53}, { 2, 33}, { 24, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 30}, { 7, 38}, /* Row 52 */ - { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 14, 4}, { 1, 16}, - { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 3, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, - { 4, 27}, { 1, 57}, { 1, 53}, { 1, 7}, { 24, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 3, 15}, { 1, 34}, { 6, 38}, /* Row 53 */ - { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 14, 4}, - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 2, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, - { 5, 27}, { 1, 71}, { 1, 72}, { 24, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 3, 15}, { 1, 30}, { 7, 38}, /* Row 54 */ - { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 13, 4}, { 1, 16}, - { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 1, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, - { 6, 27}, { 1, 28}, { 1, 49}, { 1, 5}, { 23, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 34}, { 6, 38}, /* Row 55 */ - { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 13, 4}, - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 4}, { 1, 18}, - { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, - { 1, 49}, { 1, 3}, { 1, 4}, { 1, 5}, { 22, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 30}, { 7, 38}, /* Row 56 */ - { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 16}, - { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 73}, { 1, 19}, - { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 36}, - { 1, 13}, { 3, 4}, { 1, 5}, { 21, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 34}, { 6, 38}, /* Row 57 */ - { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 12, 4}, - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 74}, { 4, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, - { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 20, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 30}, { 7, 38}, /* Row 58 */ - { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 11, 4}, { 1, 16}, - { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 3, 27}, { 1, 35}, { 1, 34}, { 4, 15}, - { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 2, 3}, - { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 19, 0}, - { 17, 0}, { 1, 75}, { 1, 55}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 6, 15}, /* Row 59 */ - { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, - { 1, 49}, { 11, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 7, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 3, 27}, { 1, 43}, - { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, - { 1, 28}, { 1, 49}, { 2, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, - { 18, 0}, - { 16, 0}, { 1, 1}, { 1, 76}, { 1, 37}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, /* Row 60 */ - { 6, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, - { 1, 3}, { 10, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 3, 15}, { 1, 37}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, - { 1, 35}, { 1, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, - { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 3, 4}, { 1, 3}, { 1, 8}, - { 1, 13}, { 3, 4}, { 1, 5}, { 17, 0}, - { 15, 0}, { 1, 1}, { 1, 6}, { 1, 73}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 61 */ - { 1, 30}, { 7, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, - { 4, 27}, { 1, 28}, { 1, 49}, { 10, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 77}, { 1, 78}, { 4, 15}, { 1, 34}, { 7, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 1, 79}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 5, 4}, - { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 16, 0}, - { 14, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, /* Row 62 */ - { 8, 38}, { 1, 30}, { 7, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, - { 5, 27}, { 1, 29}, { 1, 3}, { 9, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 41}, { 1, 34}, { 3, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 80}, { 1, 34}, { 4, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 6, 4}, - { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 15, 0}, - { 13, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 9}, { 1, 77}, { 2, 15}, /* Row 63 */ - { 1, 30}, { 8, 38}, { 1, 30}, { 3, 15}, { 1, 37}, { 4, 15}, { 1, 34}, { 6, 38}, - { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 9, 4}, - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, - { 1, 81}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 68}, - { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, - { 1, 28}, { 1, 49}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, - { 14, 0}, - { 12, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 82}, { 1, 83}, /* Row 64 */ - { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 77}, { 1, 78}, { 4, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, - { 8, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, - { 9, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, - { 1, 3}, { 9, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 13, 0}, - { 11, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 85}, /* Row 65 */ - { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 41}, - { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, - { 4, 27}, { 1, 28}, { 1, 49}, { 8, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 27}, { 1, 43}, { 4, 15}, - { 1, 34}, { 7, 38}, { 1, 30}, { 7, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, - { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 11, 4}, { 1, 3}, { 1, 8}, - { 1, 13}, { 3, 4}, { 1, 5}, { 12, 0}, - { 10, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 66 */ - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, - { 1, 81}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, - { 5, 27}, { 1, 29}, { 1, 3}, { 7, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 27}, { 1, 35}, { 1, 34}, - { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 7, 15}, { 1, 34}, { 7, 38}, { 1, 30}, - { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 3}, { 1, 8}, - { 1, 13}, { 3, 4}, { 1, 5}, { 11, 0}, - { 9, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 67 */ - { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 7, 4}, { 1, 16}, - { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, - { 2, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, - { 14, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 10, 0}, - { 8, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 68 */ - { 2, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 1, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 16}, { 1, 20}, - { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 2, 27}, - { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 5, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 15, 4}, - { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 9, 0}, - { 7, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 69 */ - { 3, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 1, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, - { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 6, 4}, - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, - { 1, 81}, { 3, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 3, 15}, - { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, - { 1, 49}, { 17, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 8, 0}, - { 6, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 70 */ - { 4, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 2, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 5, 4}, { 1, 16}, { 1, 20}, - { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 3, 27}, - { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 3, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 18, 4}, - { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 7, 0}, - { 5, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 71 */ - { 5, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 2, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, - { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 5, 4}, - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, - { 1, 81}, { 4, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 1, 15}, - { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, - { 1, 49}, { 20, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 6, 0}, - { 4, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 72 */ - { 6, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 3, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 4, 4}, { 1, 16}, { 1, 20}, - { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 4, 27}, - { 1, 35}, { 1, 34}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 1, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 21, 4}, - { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 5, 0}, - { 3, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 73 */ - { 7, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 3, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, - { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 4, 4}, - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, - { 1, 81}, { 5, 27}, { 1, 43}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 69}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 23, 4}, - { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, { 4, 0}, - { 2, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 74 */ - { 8, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 4, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 5, 15}, { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 3, 4}, { 1, 16}, { 1, 20}, - { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 5, 27}, - { 1, 87}, { 1, 34}, { 3, 15}, { 1, 30}, { 15, 38}, { 1, 30}, { 4, 15}, { 1, 43}, - { 6, 27}, { 1, 29}, { 1, 3}, { 24, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, - { 1, 5}, { 3, 0}, - { 1, 0}, { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, /* Row 75 */ - { 9, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 4, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, - { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 3, 4}, - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, - { 1, 81}, { 6, 27}, { 1, 67}, { 4, 15}, { 1, 34}, { 13, 38}, { 1, 34}, { 4, 15}, - { 1, 34}, { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 26, 4}, { 1, 3}, { 1, 8}, - { 1, 13}, { 3, 4}, { 1, 5}, { 2, 0}, - { 1, 1}, { 1, 6}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, { 10, 4}, /* Row 76 */ - { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, - { 1, 81}, { 5, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, - { 1, 43}, { 5, 27}, { 1, 29}, { 1, 3}, { 2, 4}, { 1, 16}, { 1, 20}, { 2, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 21}, - { 1, 19}, { 3, 15}, { 1, 30}, { 13, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, - { 1, 29}, { 1, 3}, { 27, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, { 1, 5}, - { 1, 0}, - { 1, 2}, { 1, 7}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, { 11, 4}, { 1, 16}, /* Row 77 */ - { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, - { 5, 27}, { 1, 87}, { 1, 34}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, - { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 2, 4}, { 1, 16}, { 1, 20}, - { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, - { 1, 4}, { 1, 18}, { 4, 15}, { 1, 34}, { 11, 38}, { 1, 34}, { 4, 15}, { 1, 34}, - { 1, 35}, { 5, 27}, { 1, 28}, { 1, 49}, { 29, 4}, { 1, 3}, { 1, 8}, { 1, 13}, - { 3, 4}, { 1, 5}, - { 1, 3}, { 1, 4}, { 1, 28}, { 1, 84}, { 1, 86}, { 12, 4}, { 1, 16}, { 1, 20}, /* Row 78 */ - { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, - { 1, 67}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, - { 1, 29}, { 1, 3}, { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, - { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, { 1, 21}, { 1, 19}, - { 3, 15}, { 1, 30}, { 11, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, - { 1, 3}, { 30, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 3, 4}, - { 1, 4}, { 1, 88}, { 1, 89}, { 1, 86}, { 13, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 79 */ - { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 21}, - { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 35}, - { 4, 27}, { 1, 28}, { 1, 49}, { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 2, 4}, { 1, 6}, - { 4, 15}, { 1, 34}, { 9, 38}, { 1, 19}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, - { 1, 28}, { 1, 49}, { 32, 4}, { 1, 3}, { 1, 8}, { 1, 13}, { 1, 49}, { 1, 3}, - { 2, 4}, { 1, 90}, { 1, 8}, { 1, 3}, { 12, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 80 */ - { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, - { 1, 29}, { 1, 3}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 2, 4}, { 1, 6}, { 4, 15}, { 1, 69}, - { 9, 38}, { 1, 31}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 29}, { 1, 3}, { 33, 4}, - { 1, 3}, { 1, 91}, { 1, 81}, { 1, 4}, - { 3, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 81 */ - { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, - { 1, 35}, { 4, 27}, { 1, 28}, { 1, 49}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, { 1, 21}, - { 1, 19}, { 4, 15}, { 1, 34}, { 8, 38}, { 1, 92}, { 4, 15}, { 1, 68}, { 1, 93}, - { 6, 27}, { 1, 49}, { 33, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 56}, { 1, 8}, - { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 10, 4}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 82 */ - { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 2, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 5, 27}, - { 1, 29}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 6, 27}, { 1, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 10, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 49}, { 32, 4}, { 1, 3}, { 1, 8}, - { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, - { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4}, { 1, 16}, { 1, 20}, /* Row 83 */ - { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, - { 2, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, - { 1, 34}, { 1, 35}, { 4, 27}, { 1, 28}, { 1, 7}, { 1, 20}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 21}, { 1, 19}, - { 4, 15}, { 1, 34}, { 10, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, - { 1, 29}, { 1, 3}, { 30, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 1, 4}, { 1, 5}, - { 1, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 8, 4}, { 1, 16}, /* Row 84 */ - { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, - { 6, 27}, { 3, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, - { 1, 43}, { 5, 27}, { 1, 10}, { 1, 20}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 1, 67}, { 4, 15}, { 1, 30}, { 12, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 29, 4}, { 1, 3}, - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 1, 0}, - { 2, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, { 1, 16}, /* Row 85 */ - { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, - { 6, 27}, { 3, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 5, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 81}, { 1, 77}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 5, 27}, { 1, 87}, { 1, 34}, - { 4, 15}, { 1, 34}, { 12, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, - { 1, 29}, { 1, 3}, { 27, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 1, 4}, { 1, 5}, { 2, 0}, - { 3, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 6, 4}, { 1, 16}, /* Row 86 */ - { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, - { 6, 27}, { 4, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, - { 1, 43}, { 4, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 2, 15}, { 1, 25}, { 1, 81}, { 5, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 14, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 26, 4}, { 1, 3}, - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 3, 0}, - { 4, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 5, 4}, { 1, 16}, /* Row 87 */ - { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, - { 6, 27}, { 4, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 5, 15}, { 1, 34}, { 1, 35}, { 3, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 4, 27}, { 1, 35}, { 1, 34}, - { 4, 15}, { 1, 34}, { 14, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, - { 1, 29}, { 1, 3}, { 24, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 1, 4}, { 1, 5}, { 4, 0}, - { 5, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 4, 4}, { 1, 16}, /* Row 88 */ - { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, - { 6, 27}, { 5, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, - { 1, 43}, { 3, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 2, 15}, { 1, 25}, { 1, 81}, { 4, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 16, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 23, 4}, { 1, 3}, - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 5, 0}, - { 6, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 3, 4}, { 1, 16}, /* Row 89 */ - { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, - { 6, 27}, { 5, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 5, 15}, { 1, 34}, { 1, 35}, { 2, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 3, 27}, { 1, 35}, { 1, 34}, - { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 1, 69}, { 7, 38}, { 1, 34}, { 4, 15}, - { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 21, 4}, { 1, 3}, { 1, 8}, - { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 6, 0}, - { 7, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 2, 4}, { 1, 16}, /* Row 90 */ - { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, - { 6, 27}, { 6, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, - { 1, 43}, { 2, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, - { 2, 15}, { 1, 25}, { 1, 81}, { 3, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 8, 38}, - { 1, 30}, { 1, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, - { 1, 28}, { 1, 49}, { 20, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 1, 4}, { 1, 5}, { 7, 0}, - { 8, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 4}, { 1, 16}, /* Row 91 */ - { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, - { 6, 27}, { 6, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 5, 15}, { 1, 34}, { 1, 35}, { 1, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 2, 27}, { 1, 35}, { 1, 34}, - { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 18, 4}, { 1, 3}, - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 8, 0}, - { 9, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 16}, { 1, 20}, /* Row 92 */ - { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, - { 7, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, - { 1, 27}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 2, 27}, { 1, 43}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, - { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, - { 1, 49}, { 17, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, - { 1, 5}, { 9, 0}, - { 10, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 16}, { 1, 20}, { 2, 15}, /* Row 93 */ - { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 7, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, - { 1, 35}, { 1, 81}, { 1, 25}, { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, - { 1, 25}, { 1, 81}, { 1, 27}, { 1, 35}, { 1, 34}, { 4, 15}, { 1, 34}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, - { 5, 27}, { 1, 29}, { 1, 3}, { 15, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, - { 1, 7}, { 1, 4}, { 1, 5}, { 10, 0}, - { 11, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 73}, { 1, 20}, { 2, 15}, { 1, 30}, /* Row 94 */ - { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 8, 4}, { 1, 18}, - { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 43}, { 1, 81}, { 1, 25}, - { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 27}, - { 1, 43}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 5, 15}, { 1, 34}, { 7, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 14, 4}, { 1, 3}, - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 11, 0}, - { 12, 0}, { 1, 5}, { 4, 4}, { 1, 57}, { 1, 77}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 95 */ - { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 8, 4}, { 1, 21}, { 1, 19}, - { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 34}, { 1, 41}, { 1, 25}, - { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 35}, - { 1, 34}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 6, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 12, 4}, - { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 12, 0}, - { 13, 0}, { 1, 5}, { 3, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 96 */ - { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 9, 4}, { 1, 18}, { 4, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 78}, { 1, 77}, { 2, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 1, 43}, { 4, 15}, { 1, 30}, - { 8, 38}, { 1, 30}, { 7, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, - { 5, 27}, { 1, 28}, { 1, 49}, { 11, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, - { 1, 7}, { 1, 4}, { 1, 5}, { 13, 0}, - { 14, 0}, { 1, 5}, { 2, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 97 */ - { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 9, 4}, { 1, 21}, { 1, 19}, - { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 5, 15}, { 1, 37}, { 3, 15}, { 1, 30}, - { 7, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 41}, { 1, 34}, { 4, 15}, { 1, 34}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 37}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 9, 4}, { 1, 3}, - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 14, 0}, - { 15, 0}, { 1, 5}, { 1, 4}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, /* Row 98 */ - { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 10, 4}, { 1, 18}, { 4, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 8, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, - { 1, 77}, { 1, 78}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 78}, - { 1, 34}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, - { 1, 28}, { 1, 49}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 1, 4}, { 1, 5}, { 15, 0}, - { 16, 0}, { 1, 5}, { 1, 16}, { 1, 20}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, /* Row 99 */ - { 2, 15}, { 1, 25}, { 1, 81}, { 6, 27}, { 10, 4}, { 1, 21}, { 1, 19}, { 4, 15}, - { 1, 34}, { 6, 38}, { 1, 34}, { 8, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, - { 1, 37}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 94}, - { 1, 43}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, - { 5, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, - { 1, 7}, { 1, 4}, { 1, 5}, { 16, 0}, - { 17, 0}, { 1, 95}, { 1, 96}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, /* Row 100 */ - { 1, 25}, { 1, 81}, { 6, 27}, { 11, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, - { 1, 30}, { 7, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 7, 15}, { 1, 30}, { 8, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 1, 27}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 34}, - { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 5, 4}, - { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 17, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 101 */ - { 6, 27}, { 11, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 7, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 7, 15}, { 1, 34}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 34}, { 1, 35}, { 2, 27}, { 1, 43}, { 3, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 1, 3}, { 3, 4}, - { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 18, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 102 */ - { 6, 27}, { 12, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, - { 1, 43}, { 3, 27}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, - { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 2, 4}, { 1, 3}, { 1, 8}, - { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 19, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 103 */ - { 6, 27}, { 12, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 6, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 6, 15}, { 1, 34}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 34}, { 1, 35}, { 4, 27}, { 1, 43}, { 3, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 29}, { 2, 3}, { 1, 8}, - { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 20, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 104 */ - { 6, 27}, { 13, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, - { 1, 43}, { 5, 27}, { 1, 35}, { 1, 34}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, - { 4, 15}, { 1, 43}, { 5, 27}, { 1, 28}, { 1, 49}, { 1, 8}, { 1, 7}, { 1, 11}, - { 1, 7}, { 1, 4}, { 1, 5}, { 21, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 105 */ - { 6, 27}, { 13, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 5, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 5, 15}, { 1, 34}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 74}, { 3, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 36}, { 1, 7}, { 1, 11}, - { 1, 7}, { 1, 4}, { 1, 5}, { 22, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 106 */ - { 6, 27}, { 14, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, - { 1, 43}, { 6, 27}, { 1, 28}, { 1, 73}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, - { 1, 30}, { 4, 15}, { 1, 43}, { 5, 27}, { 1, 54}, { 1, 97}, { 1, 7}, { 1, 4}, - { 1, 5}, { 23, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 107 */ - { 6, 27}, { 14, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 4}, { 1, 18}, { 3, 15}, - { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 5, 27}, { 1, 98}, - { 1, 4}, { 1, 5}, { 24, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 108 */ - { 6, 27}, { 15, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, - { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 1, 4}, { 1, 21}, { 1, 19}, { 3, 15}, - { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 4, 27}, { 1, 57}, { 1, 99}, - { 1, 9}, { 25, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 109 */ - { 6, 27}, { 15, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 3, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 2, 4}, { 1, 18}, - { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, { 2, 27}, - { 1, 57}, { 1, 53}, { 2, 33}, { 25, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 110 */ - { 6, 27}, { 16, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, - { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 3, 4}, { 1, 21}, { 1, 19}, { 3, 15}, - { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 1, 27}, { 1, 57}, { 1, 53}, - { 3, 33}, { 1, 7}, { 24, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 111 */ - { 6, 27}, { 16, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 2, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 2, 15}, { 1, 34}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 4, 4}, { 1, 18}, - { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 1}, { 1, 53}, - { 5, 33}, { 24, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 112 */ - { 6, 27}, { 17, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, - { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, - { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 5, 4}, { 1, 21}, { 1, 19}, { 3, 15}, - { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 70}, { 6, 33}, { 1, 7}, { 23, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 113 */ - { 6, 27}, { 17, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 1, 15}, { 1, 30}, { 7, 38}, { 1, 30}, { 1, 15}, { 1, 34}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 18}, - { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, - { 23, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 114 */ - { 6, 27}, { 18, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 2, 30}, { 7, 38}, - { 2, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, - { 7, 4}, { 1, 21}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, - { 1, 45}, { 6, 33}, { 1, 7}, { 22, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 25}, { 1, 81}, /* Row 115 */ - { 6, 27}, { 18, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, - { 1, 30}, { 7, 38}, { 1, 30}, { 1, 34}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, - { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 8, 4}, { 1, 18}, { 3, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 22, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 77}, { 1, 100}, /* Row 116 */ - { 6, 27}, { 19, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 7, 38}, { 1, 69}, { 7, 38}, - { 1, 69}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, - { 9, 4}, { 1, 21}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, - { 1, 45}, { 6, 33}, { 1, 7}, { 21, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 101}, /* Row 117 */ - { 1, 57}, { 5, 27}, { 19, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, - { 1, 68}, { 7, 38}, { 1, 68}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 34}, { 1, 35}, - { 6, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 18}, { 3, 15}, { 1, 30}, { 7, 38}, - { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 21, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 118 */ - { 1, 53}, { 1, 57}, { 4, 27}, { 1, 8}, { 1, 3}, { 18, 4}, { 1, 18}, { 4, 15}, - { 1, 30}, { 22, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, - { 11, 4}, { 1, 21}, { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, - { 1, 45}, { 6, 33}, { 1, 7}, { 20, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 119 */ - { 1, 33}, { 1, 53}, { 1, 57}, { 3, 27}, { 1, 36}, { 1, 8}, { 1, 3}, { 17, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 20, 38}, { 1, 34}, { 4, 15}, { 1, 34}, - { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 12, 4}, { 1, 18}, { 3, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 20, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 120 */ - { 2, 33}, { 1, 53}, { 1, 57}, { 2, 27}, { 1, 49}, { 1, 13}, { 1, 8}, { 1, 3}, - { 17, 4}, { 1, 18}, { 4, 15}, { 1, 30}, { 20, 38}, { 1, 30}, { 4, 15}, { 1, 43}, - { 6, 27}, { 1, 28}, { 1, 49}, { 12, 4}, { 1, 3}, { 1, 79}, { 1, 63}, { 3, 15}, - { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 7}, { 19, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 121 */ - { 3, 33}, { 1, 53}, { 1, 57}, { 1, 27}, { 2, 4}, { 1, 13}, { 1, 8}, { 1, 3}, - { 16, 4}, { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 18, 38}, { 1, 34}, { 4, 15}, - { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 11, 4}, { 1, 3}, { 1, 8}, - { 1, 7}, { 1, 102}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, - { 1, 40}, { 6, 33}, { 19, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 122 */ - { 4, 33}, { 1, 53}, { 1, 62}, { 3, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 16, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 18, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, - { 1, 28}, { 1, 49}, { 11, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 79}, - { 1, 19}, { 3, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, { 6, 33}, - { 1, 7}, { 18, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 123 */ - { 5, 33}, { 1, 103}, { 1, 3}, { 3, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 15, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 16, 38}, { 1, 34}, { 4, 15}, { 1, 34}, - { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 1, 4}, { 1, 53}, { 3, 15}, { 1, 30}, { 7, 38}, { 1, 34}, - { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 18, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 124 */ - { 6, 33}, { 1, 95}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 15, 4}, { 1, 18}, - { 4, 15}, { 1, 30}, { 16, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, { 1, 28}, - { 1, 49}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, - { 1, 5}, { 1, 27}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, { 1, 45}, - { 6, 33}, { 1, 7}, { 17, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 125 */ - { 6, 33}, { 1, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 14, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 14, 38}, { 1, 34}, { 4, 15}, { 1, 34}, - { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 9, 4}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 2, 0}, { 1, 14}, { 3, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 17, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 126 */ - { 6, 33}, { 2, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 14, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 14, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, - { 1, 28}, { 1, 49}, { 9, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 1, 4}, { 1, 5}, { 4, 0}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, - { 1, 45}, { 6, 33}, { 1, 7}, { 16, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 127 */ - { 6, 33}, { 3, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 13, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 12, 38}, { 1, 34}, { 4, 15}, { 1, 34}, - { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 5, 0}, { 1, 14}, { 3, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 16, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 128 */ - { 6, 33}, { 4, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 13, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 12, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, - { 1, 28}, { 1, 49}, { 8, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 1, 4}, { 1, 5}, { 7, 0}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, - { 1, 45}, { 6, 33}, { 1, 7}, { 15, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 129 */ - { 6, 33}, { 5, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 12, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 10, 38}, { 1, 34}, { 4, 15}, { 1, 34}, - { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 7, 4}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 8, 0}, { 1, 14}, { 3, 15}, { 1, 30}, - { 7, 38}, { 1, 34}, { 4, 15}, { 1, 31}, { 1, 40}, { 6, 33}, { 15, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 130 */ - { 6, 33}, { 6, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 12, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 10, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, - { 1, 28}, { 1, 49}, { 7, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 1, 4}, { 1, 5}, { 10, 0}, { 4, 15}, { 1, 34}, { 7, 38}, { 1, 30}, { 4, 15}, - { 1, 22}, { 6, 33}, { 1, 104}, { 14, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 131 */ - { 6, 33}, { 7, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 8, 38}, { 1, 34}, { 4, 15}, { 1, 34}, - { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 11, 0}, { 1, 14}, { 3, 15}, { 1, 30}, - { 7, 38}, { 1, 44}, { 4, 15}, { 1, 45}, { 6, 33}, { 1, 65}, { 14, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 132 */ - { 6, 33}, { 8, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 4, 15}, { 1, 43}, { 6, 27}, - { 1, 28}, { 1, 49}, { 6, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 1, 4}, { 1, 5}, { 13, 0}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 4, 15}, - { 1, 45}, { 7, 33}, { 14, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 133 */ - { 6, 33}, { 9, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 10, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 34}, { 6, 38}, { 1, 34}, { 4, 15}, { 1, 34}, - { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 5, 4}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 14, 0}, { 1, 14}, { 3, 15}, { 1, 30}, - { 6, 38}, { 1, 44}, { 3, 15}, { 1, 55}, { 1, 105}, { 7, 33}, { 1, 104}, { 13, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 134 */ - { 6, 33}, { 10, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 10, 4}, - { 1, 18}, { 4, 15}, { 1, 30}, { 1, 106}, { 4, 38}, { 1, 106}, { 1, 30}, { 4, 15}, - { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 5, 4}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 16, 0}, { 4, 15}, { 1, 34}, { 5, 38}, - { 1, 30}, { 3, 15}, { 1, 31}, { 1, 60}, { 7, 33}, { 1, 7}, { 13, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 135 */ - { 6, 33}, { 11, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4}, - { 1, 21}, { 1, 19}, { 4, 15}, { 1, 30}, { 1, 34}, { 2, 38}, { 1, 34}, { 1, 30}, - { 4, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, { 4, 4}, { 1, 3}, - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 17, 0}, { 1, 14}, - { 3, 15}, { 1, 30}, { 1, 34}, { 2, 38}, { 1, 34}, { 1, 30}, { 4, 15}, { 1, 45}, - { 8, 33}, { 1, 7}, { 13, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 136 */ - { 6, 33}, { 12, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4}, - { 1, 18}, { 6, 15}, { 2, 30}, { 6, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, - { 4, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, - { 19, 0}, { 5, 15}, { 2, 30}, { 5, 15}, { 1, 31}, { 1, 40}, { 8, 33}, { 1, 50}, - { 13, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 137 */ - { 6, 33}, { 13, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 8, 4}, - { 1, 21}, { 1, 19}, { 12, 15}, { 1, 34}, { 1, 35}, { 6, 27}, { 1, 29}, { 1, 3}, - { 3, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, - { 20, 0}, { 1, 14}, { 10, 15}, { 1, 39}, { 1, 107}, { 9, 33}, { 14, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 30}, { 2, 15}, { 1, 96}, { 1, 60}, /* Row 138 */ - { 6, 33}, { 14, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 8, 4}, - { 1, 18}, { 12, 15}, { 1, 43}, { 6, 27}, { 1, 28}, { 1, 49}, { 3, 4}, { 1, 3}, - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 22, 0}, { 9, 15}, - { 1, 39}, { 1, 107}, { 9, 33}, { 1, 7}, { 14, 0}, - { 18, 0}, { 3, 15}, { 1, 30}, { 8, 38}, { 1, 55}, { 2, 96}, { 1, 108}, { 1, 60}, /* Row 139 */ - { 6, 33}, { 15, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, - { 1, 16}, { 1, 23}, { 10, 15}, { 1, 109}, { 1, 81}, { 6, 27}, { 1, 29}, { 1, 3}, - { 2, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, - { 23, 0}, { 1, 28}, { 1, 110}, { 5, 15}, { 1, 39}, { 1, 111}, { 1, 105}, { 10, 33}, - { 15, 0}, - { 25, 0}, { 1, 59}, { 4, 40}, { 4, 60}, { 7, 33}, { 16, 0}, { 1, 5}, { 4, 4}, /* Row 140 */ - { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, { 1, 16}, { 1, 18}, { 1, 19}, { 6, 15}, - { 1, 34}, { 1, 43}, { 1, 81}, { 6, 27}, { 1, 28}, { 1, 49}, { 2, 4}, { 1, 3}, - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 27, 0}, { 1, 112}, - { 1, 14}, { 1, 113}, { 1, 22}, { 1, 40}, { 1, 76}, { 10, 33}, { 1, 7}, { 15, 0}, - { 25, 0}, { 16, 33}, { 17, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 141 */ - { 8, 4}, { 1, 21}, { 1, 18}, { 1, 19}, { 1, 77}, { 1, 25}, { 1, 34}, { 1, 43}, - { 1, 35}, { 8, 27}, { 1, 8}, { 1, 3}, { 1, 4}, { 1, 3}, { 1, 8}, { 1, 7}, - { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 30, 0}, { 1, 50}, { 13, 33}, { 16, 0}, - { 25, 0}, { 16, 33}, { 18, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 142 */ - { 9, 4}, { 1, 16}, { 1, 10}, { 1, 66}, { 1, 81}, { 8, 27}, { 1, 36}, { 1, 8}, - { 1, 3}, { 1, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, - { 1, 5}, { 32, 0}, { 1, 7}, { 11, 33}, { 17, 0}, - { 25, 0}, { 16, 33}, { 19, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 143 */ - { 9, 4}, { 1, 3}, { 1, 49}, { 1, 29}, { 1, 28}, { 5, 27}, { 1, 36}, { 1, 8}, - { 3, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, - { 34, 0}, { 10, 33}, { 18, 0}, - { 25, 0}, { 16, 33}, { 20, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 144 */ - { 10, 4}, { 1, 3}, { 10, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, - { 1, 4}, { 1, 5}, { 35, 0}, { 1, 41}, { 7, 33}, { 1, 7}, { 19, 0}, - { 25, 0}, { 16, 33}, { 21, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 145 */ - { 19, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, - { 64, 0}, - { 25, 0}, { 16, 33}, { 22, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, /* Row 146 */ - { 17, 4}, { 1, 3}, { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, - { 65, 0}, - { 64, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 15, 4}, { 1, 3}, /* Row 147 */ - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 66, 0}, - { 65, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 13, 4}, { 1, 3}, /* Row 148 */ - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 67, 0}, - { 66, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 11, 4}, { 1, 3}, /* Row 149 */ - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 68, 0}, - { 67, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 9, 4}, { 1, 3}, /* Row 150 */ - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 69, 0}, - { 68, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 7, 4}, { 1, 3}, /* Row 151 */ - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 70, 0}, - { 69, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 5, 4}, { 1, 3}, /* Row 152 */ - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 71, 0}, - { 70, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 3, 4}, { 1, 3}, /* Row 153 */ - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 72, 0}, - { 71, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 4}, { 1, 3}, /* Row 154 */ - { 1, 8}, { 1, 7}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 73, 0}, - { 72, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 8}, { 1, 3}, { 1, 8}, { 1, 7}, /* Row 155 */ - { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, { 74, 0}, - { 73, 0}, { 1, 5}, { 4, 4}, { 1, 13}, { 1, 91}, { 1, 7}, { 1, 11}, { 1, 7}, /* Row 156 */ - { 1, 4}, { 1, 5}, { 75, 0}, - { 74, 0}, { 1, 5}, { 4, 4}, { 1, 114}, { 1, 11}, { 1, 7}, { 1, 4}, { 1, 5}, /* Row 157 */ - { 76, 0}, - { 75, 0}, { 1, 5}, { 2, 4}, { 1, 8}, { 1, 115}, { 1, 7}, { 1, 4}, { 1, 5}, /* Row 158 */ - { 77, 0}, - { 76, 0}, { 1, 5}, { 4, 4}, { 1, 5}, { 78, 0} /* Row 159 */ - -# else /* CONFIG_EXAMPLES_NXIMAGE_GREYSCALE */ - -static const struct pix_run_s g_nuttx[] = -{ - { 76, 0}, { 1, 1}, { 1, 2}, { 5, 3}, { 1, 4}, { 76, 0}, /* Row 0 */ - { 75, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 6, 3}, { 1, 4}, { 75, 0}, /* Row 1 */ - { 74, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 2, 6}, { 4, 3}, { 1, 4}, /* Row 2 */ - { 74, 0}, - { 73, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 8}, /* Row 3 */ - { 1, 6}, { 4, 3}, { 1, 4}, { 73, 0}, - { 72, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 4 */ - { 2, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 72, 0}, - { 71, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 5 */ - { 4, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 71, 0}, - { 70, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 6 */ - { 6, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 70, 0}, - { 69, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 7 */ - { 8, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 69, 0}, - { 68, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 8 */ - { 10, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 68, 0}, - { 67, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 9 */ - { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 67, 0}, - { 66, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 10 */ - { 14, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 66, 0}, - { 65, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 11 */ - { 16, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 65, 0}, - { 64, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 12 */ - { 18, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 64, 0}, - { 63, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 13 */ - { 20, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 63, 0}, - { 62, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 14 */ - { 22, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 62, 0}, - { 61, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 15 */ - { 24, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 61, 0}, - { 60, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 16 */ - { 26, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 60, 0}, - { 59, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 17 */ - { 28, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 59, 0}, - { 58, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 18 */ - { 30, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 26, 0}, { 1, 9}, { 5, 10}, { 1, 9}, - { 25, 0}, - { 57, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 19 */ - { 10, 3}, { 5, 5}, { 17, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 23, 0}, { 1, 1}, - { 9, 10}, { 1, 1}, { 23, 0}, - { 56, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 20 */ - { 9, 3}, { 1, 5}, { 1, 11}, { 5, 12}, { 1, 11}, { 1, 13}, { 16, 3}, { 1, 6}, - { 4, 3}, { 1, 4}, { 22, 0}, { 11, 10}, { 1, 1}, { 22, 0}, - { 23, 0}, { 1, 9}, { 5, 10}, { 1, 14}, { 25, 0}, { 1, 1}, { 1, 2}, { 1, 5}, /* Row 21 */ - { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 9, 3}, { 1, 5}, { 1, 15}, { 7, 10}, - { 1, 12}, { 1, 16}, { 16, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 20, 0}, { 1, 9}, - { 12, 10}, { 1, 1}, { 21, 0}, - { 21, 0}, { 1, 1}, { 9, 10}, { 1, 1}, { 22, 0}, { 1, 1}, { 1, 2}, { 1, 5}, /* Row 22 */ - { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 9, 3}, { 1, 5}, { 1, 15}, { 9, 10}, - { 1, 12}, { 1, 16}, { 16, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 19, 0}, { 14, 10}, - { 21, 0}, - { 21, 0}, { 11, 10}, { 1, 1}, { 20, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, /* Row 23 */ - { 1, 7}, { 1, 2}, { 1, 5}, { 10, 3}, { 1, 11}, { 11, 10}, { 1, 12}, { 1, 7}, - { 3, 6}, { 1, 5}, { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 17, 0}, { 1, 9}, - { 6, 10}, { 2, 12}, { 6, 10}, { 1, 9}, { 20, 0}, - { 20, 0}, { 1, 14}, { 12, 10}, { 1, 9}, { 4, 2}, { 1, 17}, { 13, 0}, { 1, 1}, /* Row 24 */ - { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 10, 3}, { 1, 13}, - { 1, 12}, { 12, 10}, { 1, 12}, { 5, 6}, { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, - { 16, 0}, { 5, 10}, { 6, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 1, 1}, { 18, 0}, - { 19, 0}, { 1, 9}, { 13, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 11, 0}, { 1, 1}, /* Row 25 */ - { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 11, 3}, { 1, 19}, - { 4, 10}, { 5, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 12, 3}, { 1, 6}, { 4, 3}, - { 1, 4}, { 14, 0}, { 1, 9}, { 5, 10}, { 6, 12}, { 5, 10}, { 1, 14}, { 1, 2}, - { 1, 1}, { 17, 0}, - { 19, 0}, { 6, 10}, { 3, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 9, 0}, /* Row 26 */ - { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 11, 3}, - { 1, 5}, { 1, 14}, { 4, 10}, { 6, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 12, 3}, - { 1, 6}, { 4, 3}, { 1, 4}, { 13, 0}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 14}, - { 2, 2}, { 1, 1}, { 16, 0}, - { 18, 0}, { 1, 9}, { 4, 10}, { 6, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 5, 2}, /* Row 27 */ - { 8, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, - { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 5, 10}, { 1, 11}, { 5, 6}, - { 1, 5}, { 12, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 11, 0}, { 1, 9}, { 5, 10}, - { 8, 12}, { 4, 10}, { 1, 14}, { 3, 2}, { 16, 0}, - { 18, 0}, { 5, 10}, { 6, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 6, 0}, /* Row 28 */ - { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 13, 3}, - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 13, 3}, - { 1, 6}, { 4, 3}, { 1, 4}, { 10, 0}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 14}, - { 3, 2}, { 1, 17}, { 15, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 5, 0}, /* Row 29 */ - { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 14, 3}, - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, - { 13, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 8, 0}, { 1, 9}, { 5, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 1, 18}, { 4, 2}, { 15, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 3, 0}, /* Row 30 */ - { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 15, 3}, - { 1, 5}, { 1, 12}, { 3, 10}, { 9, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 14, 3}, - { 1, 6}, { 4, 3}, { 1, 4}, { 7, 0}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 14}, - { 5, 2}, { 1, 1}, { 14, 0}, - { 18, 0}, { 4, 10}, { 9, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 2, 0}, /* Row 31 */ - { 1, 1}, { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 16, 3}, - { 1, 5}, { 1, 12}, { 3, 10}, { 9, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, - { 14, 3}, { 1, 6}, { 4, 3}, { 1, 4}, { 5, 0}, { 1, 9}, { 5, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 1, 18}, { 5, 2}, { 1, 17}, { 14, 0}, - { 18, 0}, { 4, 10}, { 9, 12}, { 6, 10}, { 1, 14}, { 5, 2}, { 1, 17}, { 1, 1}, /* Row 32 */ - { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 17, 3}, { 1, 5}, - { 1, 12}, { 3, 10}, { 10, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 15, 3}, { 1, 6}, - { 4, 3}, { 1, 4}, { 4, 0}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, - { 1, 1}, { 14, 0}, - { 18, 0}, { 4, 10}, { 10, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 4, 2}, { 1, 18}, /* Row 33 */ - { 1, 2}, { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 18, 3}, { 1, 5}, - { 1, 12}, { 3, 10}, { 10, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 15, 3}, - { 1, 6}, { 4, 3}, { 1, 4}, { 2, 0}, { 1, 9}, { 5, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 1, 18}, { 6, 2}, { 15, 0}, - { 18, 0}, { 4, 10}, { 10, 12}, { 6, 10}, { 1, 14}, { 3, 2}, { 1, 20}, { 1, 6}, /* Row 34 */ - { 1, 5}, { 2, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 19, 3}, { 1, 5}, { 1, 12}, - { 3, 10}, { 11, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 16, 3}, { 1, 6}, { 4, 3}, - { 1, 4}, { 1, 0}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 2}, { 1, 17}, - { 15, 0}, - { 18, 0}, { 4, 10}, { 11, 12}, { 5, 10}, { 1, 12}, { 1, 18}, { 1, 2}, { 1, 20}, /* Row 35 */ - { 3, 6}, { 1, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 20, 3}, { 1, 5}, { 1, 12}, - { 3, 10}, { 11, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 16, 3}, { 1, 6}, - { 4, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 2}, { 16, 0}, - { 18, 0}, { 4, 10}, { 11, 12}, { 6, 10}, { 1, 14}, { 1, 20}, { 5, 6}, { 1, 2}, /* Row 36 */ - { 1, 5}, { 21, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 12, 12}, { 4, 10}, { 1, 12}, - { 6, 6}, { 17, 3}, { 1, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, - { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 16, 0}, - { 18, 0}, { 4, 10}, { 12, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 1, 5}, { 22, 3}, /* Row 37 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 12, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, - { 17, 3}, { 1, 6}, { 1, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, - { 1, 18}, { 6, 2}, { 17, 0}, - { 18, 0}, { 4, 10}, { 12, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 22, 3}, /* Row 38 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 13, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 18, 3}, - { 1, 6}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, - { 17, 0}, - { 18, 0}, { 4, 10}, { 13, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 22, 3}, { 1, 5}, /* Row 39 */ - { 1, 12}, { 3, 10}, { 13, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 17, 3}, - { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 18, 0}, - { 18, 0}, { 4, 10}, { 13, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 21, 3}, /* Row 40 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 14, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 16, 3}, - { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, - { 18, 0}, - { 18, 0}, { 4, 10}, { 14, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 21, 3}, { 1, 5}, /* Row 41 */ - { 1, 12}, { 3, 10}, { 14, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 15, 3}, - { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 19, 0}, - { 18, 0}, { 4, 10}, { 14, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 20, 3}, /* Row 42 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 15, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 14, 3}, - { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, - { 19, 0}, - { 18, 0}, { 4, 10}, { 15, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 20, 3}, { 1, 5}, /* Row 43 */ - { 1, 12}, { 3, 10}, { 15, 12}, { 5, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 13, 3}, - { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 20, 0}, - { 18, 0}, { 4, 10}, { 15, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 19, 3}, /* Row 44 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 1, 10}, { 8, 12}, { 4, 10}, { 1, 12}, - { 6, 6}, { 12, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, - { 6, 2}, { 1, 17}, { 20, 0}, - { 18, 0}, { 4, 10}, { 16, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 19, 3}, { 1, 5}, /* Row 45 */ - { 1, 12}, { 3, 10}, { 7, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 5, 6}, - { 1, 5}, { 11, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, - { 6, 2}, { 21, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 1, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 46 */ - { 1, 5}, { 18, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 2, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 6, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, - { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 21, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 47 */ - { 18, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 2, 10}, { 8, 12}, { 5, 10}, - { 1, 11}, { 5, 6}, { 1, 5}, { 9, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 1, 18}, { 6, 2}, { 22, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 2, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 48 */ - { 1, 5}, { 17, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 6, 6}, { 8, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, - { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 22, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 2, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 49 */ - { 17, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 8, 12}, { 5, 10}, - { 1, 11}, { 5, 6}, { 1, 5}, { 7, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 1, 21}, { 1, 20}, { 5, 2}, { 23, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 50 */ - { 1, 5}, { 16, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 4, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 6, 6}, { 6, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, - { 5, 10}, { 1, 11}, { 2, 6}, { 1, 20}, { 3, 2}, { 1, 17}, { 23, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 51 */ - { 16, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 4, 10}, { 8, 12}, { 5, 10}, - { 1, 11}, { 5, 6}, { 1, 5}, { 5, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 4, 6}, { 1, 20}, { 2, 2}, { 24, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 4, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 52 */ - { 1, 5}, { 15, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 5, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 6, 6}, { 4, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, - { 5, 10}, { 1, 11}, { 5, 6}, { 1, 20}, { 1, 17}, { 24, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 53 */ - { 15, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 5, 10}, { 8, 12}, { 5, 10}, - { 1, 11}, { 5, 6}, { 1, 5}, { 3, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 25, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 54 */ - { 1, 5}, { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 6, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 6, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, - { 5, 10}, { 1, 11}, { 7, 6}, { 1, 3}, { 1, 4}, { 23, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 55 */ - { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 6, 10}, { 8, 12}, { 5, 10}, - { 1, 11}, { 5, 6}, { 1, 5}, { 1, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 3, 3}, { 1, 4}, { 22, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 6, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 56 */ - { 1, 5}, { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 7, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 6, 6}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, - { 1, 11}, { 8, 6}, { 3, 3}, { 1, 4}, { 21, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 6, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, /* Row 57 */ - { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 7, 10}, { 8, 12}, { 5, 10}, - { 1, 11}, { 5, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, - { 2, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 20, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 7, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, /* Row 58 */ - { 1, 5}, { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 8, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 5, 6}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 6, 6}, { 1, 5}, { 3, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 19, 0}, - { 17, 0}, { 1, 22}, { 1, 12}, { 3, 10}, { 8, 12}, { 7, 10}, { 8, 12}, { 5, 10}, /* Row 59 */ - { 1, 12}, { 6, 6}, { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 8, 10}, - { 8, 12}, { 5, 10}, { 1, 11}, { 3, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 5, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 18, 0}, - { 16, 0}, { 1, 1}, { 1, 18}, { 1, 12}, { 3, 10}, { 8, 12}, { 8, 10}, { 7, 12}, /* Row 60 */ - { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 11, 3}, { 1, 5}, { 1, 12}, { 3, 10}, - { 7, 12}, { 4, 10}, { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 3, 6}, - { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 6, 3}, - { 1, 6}, { 3, 3}, { 1, 4}, { 17, 0}, - { 15, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 8, 10}, /* Row 61 */ - { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 11, 3}, { 1, 5}, { 1, 12}, { 3, 10}, - { 7, 12}, { 3, 10}, { 1, 12}, { 1, 11}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 1, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 8, 3}, - { 1, 6}, { 3, 3}, { 1, 4}, { 16, 0}, - { 14, 0}, { 1, 1}, { 1, 2}, { 2, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 9, 10}, /* Row 62 */ - { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 10, 3}, { 1, 5}, { 1, 12}, - { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 21}, { 1, 12}, { 4, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 1, 23}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 6, 6}, { 1, 5}, { 9, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 15, 0}, - { 13, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 12}, { 3, 10}, /* Row 63 */ - { 8, 12}, { 4, 10}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, - { 10, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 6}, - { 1, 11}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 5, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 11, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 14, 0}, - { 12, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 24}, { 1, 12}, /* Row 64 */ - { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, - { 1, 11}, { 5, 6}, { 1, 5}, { 9, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, - { 3, 10}, { 1, 12}, { 2, 6}, { 1, 12}, { 4, 10}, { 8, 12}, { 9, 10}, { 8, 12}, - { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 12, 3}, { 1, 6}, { 3, 3}, { 1, 4}, - { 13, 0}, - { 11, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 1, 3}, /* Row 65 */ - { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 21}, { 1, 12}, { 4, 10}, - { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 9, 3}, { 1, 5}, { 1, 12}, { 3, 10}, - { 7, 12}, { 3, 10}, { 1, 12}, { 2, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 9, 10}, - { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 14, 3}, { 1, 6}, { 3, 3}, { 1, 4}, - { 12, 0}, - { 10, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 1, 3}, /* Row 66 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 6}, { 1, 11}, - { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 8, 3}, { 1, 5}, - { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 12}, { 4, 10}, - { 8, 12}, { 7, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 15, 3}, - { 1, 6}, { 3, 3}, { 1, 4}, { 11, 0}, - { 9, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 2, 3}, /* Row 67 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 2, 6}, { 1, 12}, - { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 8, 3}, { 1, 5}, { 1, 12}, - { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 11}, { 4, 10}, { 8, 12}, - { 7, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 17, 3}, { 1, 6}, { 3, 3}, - { 1, 4}, { 10, 0}, - { 8, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 3, 3}, /* Row 68 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 2, 6}, { 1, 11}, - { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 7, 3}, { 1, 5}, - { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 12}, { 4, 10}, - { 8, 12}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 18, 3}, - { 1, 6}, { 3, 3}, { 1, 4}, { 9, 0}, - { 7, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 4, 3}, /* Row 69 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 12}, - { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 7, 3}, { 1, 5}, { 1, 12}, - { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 11}, { 4, 10}, { 8, 12}, - { 5, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 20, 3}, { 1, 6}, { 3, 3}, - { 1, 4}, { 8, 0}, - { 6, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 5, 3}, /* Row 70 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 3, 6}, { 1, 11}, - { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 6, 3}, { 1, 5}, - { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 12}, { 4, 10}, - { 8, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 21, 3}, - { 1, 6}, { 3, 3}, { 1, 4}, { 7, 0}, - { 5, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 6, 3}, /* Row 71 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 12}, - { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 6, 3}, { 1, 5}, { 1, 12}, - { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 11}, { 4, 10}, { 8, 12}, - { 3, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 23, 3}, { 1, 6}, { 3, 3}, - { 1, 4}, { 6, 0}, - { 4, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 7, 3}, /* Row 72 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 4, 6}, { 1, 11}, - { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 5, 3}, { 1, 5}, - { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 12}, { 4, 10}, - { 8, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 24, 3}, - { 1, 6}, { 3, 3}, { 1, 4}, { 5, 0}, - { 3, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 8, 3}, /* Row 73 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 12}, - { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 5, 3}, { 1, 5}, { 1, 12}, - { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 11}, { 4, 10}, { 8, 12}, - { 1, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 26, 3}, { 1, 6}, { 3, 3}, - { 1, 4}, { 4, 0}, - { 2, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 9, 3}, /* Row 74 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 5, 6}, { 1, 11}, - { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 4, 3}, { 1, 5}, - { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 12}, { 4, 10}, - { 15, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 27, 3}, { 1, 6}, { 3, 3}, - { 1, 4}, { 3, 0}, - { 1, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 10, 3}, /* Row 75 */ - { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 12}, - { 4, 10}, { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 4, 3}, { 1, 5}, { 1, 12}, - { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 11}, { 4, 10}, { 15, 12}, - { 4, 10}, { 1, 12}, { 7, 6}, { 29, 3}, { 1, 6}, { 3, 3}, { 1, 4}, { 2, 0}, - { 1, 1}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 11, 3}, { 1, 5}, /* Row 76 */ - { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 6, 6}, { 1, 11}, { 5, 10}, - { 7, 12}, { 6, 10}, { 1, 11}, { 5, 6}, { 1, 5}, { 3, 3}, { 1, 5}, { 1, 12}, - { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 13}, { 1, 12}, { 4, 10}, - { 13, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 1, 5}, { 30, 3}, { 1, 6}, { 3, 3}, - { 1, 4}, { 1, 0}, - { 1, 2}, { 1, 5}, { 1, 3}, { 1, 6}, { 1, 2}, { 12, 3}, { 1, 5}, { 1, 12}, /* Row 77 */ - { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 1, 12}, { 4, 10}, { 8, 12}, - { 5, 10}, { 1, 12}, { 6, 6}, { 3, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, - { 3, 10}, { 1, 12}, { 7, 6}, { 1, 3}, { 1, 11}, { 4, 10}, { 13, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 32, 3}, { 1, 6}, { 3, 3}, { 1, 4}, - { 2, 3}, { 1, 6}, { 1, 2}, { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 78 */ - { 3, 10}, { 1, 12}, { 7, 6}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, - { 5, 6}, { 1, 5}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 7, 6}, { 1, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 11, 12}, { 5, 10}, - { 1, 11}, { 6, 6}, { 1, 5}, { 33, 3}, { 1, 6}, { 3, 3}, - { 1, 3}, { 1, 5}, { 1, 18}, { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 79 */ - { 3, 10}, { 1, 12}, { 7, 6}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, - { 1, 12}, { 6, 6}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 7, 6}, { 2, 3}, { 1, 11}, { 4, 10}, { 11, 12}, { 4, 10}, { 1, 12}, - { 7, 6}, { 35, 3}, { 1, 6}, { 2, 3}, - { 2, 3}, { 1, 6}, { 14, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 80 */ - { 1, 12}, { 7, 6}, { 1, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, - { 5, 6}, { 1, 5}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 7, 6}, { 2, 3}, { 1, 11}, { 5, 10}, { 10, 12}, { 4, 10}, { 1, 11}, - { 6, 6}, { 1, 5}, { 35, 3}, { 1, 5}, { 1, 6}, { 1, 3}, - { 3, 3}, { 1, 6}, { 13, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 81 */ - { 1, 12}, { 7, 6}, { 1, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, - { 1, 12}, { 6, 6}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 7, 6}, { 1, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 10, 12}, { 4, 10}, - { 1, 12}, { 1, 21}, { 6, 6}, { 36, 3}, { 1, 7}, { 1, 2}, { 1, 5}, - { 4, 3}, { 1, 6}, { 12, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 82 */ - { 1, 12}, { 7, 6}, { 2, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, - { 5, 6}, { 2, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 7, 6}, - { 1, 3}, { 1, 11}, { 5, 10}, { 10, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 35, 3}, - { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, - { 1, 4}, { 4, 3}, { 1, 6}, { 11, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 83 */ - { 3, 10}, { 1, 12}, { 7, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, - { 5, 10}, { 1, 12}, { 6, 6}, { 1, 5}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 7, 6}, { 1, 13}, { 1, 12}, { 4, 10}, { 12, 12}, { 4, 10}, { 1, 12}, - { 6, 6}, { 1, 5}, { 33, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, - { 1, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 10, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 84 */ - { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 3, 3}, { 1, 11}, { 5, 10}, { 7, 12}, - { 6, 10}, { 1, 11}, { 5, 6}, { 1, 13}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 7, 6}, { 1, 11}, { 5, 10}, { 12, 12}, { 5, 10}, { 1, 11}, { 6, 6}, - { 32, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 1, 0}, - { 2, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 9, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 85 */ - { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 3, 3}, { 1, 13}, { 1, 12}, { 4, 10}, - { 8, 12}, { 5, 10}, { 1, 12}, { 6, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 7, 6}, { 1, 12}, { 4, 10}, { 14, 12}, { 4, 10}, { 1, 12}, { 6, 6}, - { 1, 5}, { 30, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 2, 0}, - { 3, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 8, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 86 */ - { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 4, 3}, { 1, 11}, { 5, 10}, { 7, 12}, - { 6, 10}, { 1, 11}, { 5, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, - { 6, 6}, { 1, 11}, { 5, 10}, { 14, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 29, 3}, - { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 3, 0}, - { 4, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 7, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 87 */ - { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 4, 3}, { 1, 13}, { 1, 12}, { 4, 10}, - { 8, 12}, { 5, 10}, { 1, 12}, { 5, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 6, 6}, { 1, 12}, { 4, 10}, { 16, 12}, { 4, 10}, { 1, 12}, { 6, 6}, - { 1, 5}, { 27, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 4, 0}, - { 5, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 6, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 88 */ - { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 5, 3}, { 1, 11}, { 5, 10}, { 7, 12}, - { 6, 10}, { 1, 11}, { 4, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, - { 5, 6}, { 1, 11}, { 5, 10}, { 16, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 26, 3}, - { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 5, 0}, - { 6, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 5, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 89 */ - { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 5, 3}, { 1, 13}, { 1, 12}, { 4, 10}, - { 8, 12}, { 5, 10}, { 1, 12}, { 4, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 5, 6}, { 1, 12}, { 4, 10}, { 9, 12}, { 1, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 6, 6}, { 1, 5}, { 24, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, - { 1, 4}, { 6, 0}, - { 7, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 4, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 90 */ - { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 6, 3}, { 1, 11}, { 5, 10}, { 7, 12}, - { 6, 10}, { 1, 11}, { 3, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, - { 4, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 2, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 6, 6}, { 23, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 7, 0}, - { 8, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 3, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 91 */ - { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 6, 3}, { 1, 13}, { 1, 12}, { 4, 10}, - { 8, 12}, { 5, 10}, { 1, 12}, { 3, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 4, 6}, { 1, 12}, { 4, 10}, { 9, 12}, { 3, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 6, 6}, { 1, 5}, { 21, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, - { 1, 4}, { 8, 0}, - { 9, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 92 */ - { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 7, 3}, { 1, 11}, { 5, 10}, { 7, 12}, - { 6, 10}, { 1, 11}, { 2, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, - { 3, 6}, { 1, 11}, { 5, 10}, { 8, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 6, 6}, { 20, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 9, 0}, - { 10, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, /* Row 93 */ - { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 7, 3}, { 1, 13}, { 1, 12}, { 4, 10}, - { 8, 12}, { 5, 10}, { 1, 12}, { 2, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, - { 1, 12}, { 3, 6}, { 1, 12}, { 4, 10}, { 9, 12}, { 5, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 6, 6}, { 1, 5}, { 18, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, - { 1, 4}, { 10, 0}, - { 11, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, /* Row 94 */ - { 3, 10}, { 1, 12}, { 7, 6}, { 8, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, - { 1, 11}, { 1, 6}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 2, 6}, - { 1, 11}, { 5, 10}, { 8, 12}, { 6, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, - { 17, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 11, 0}, - { 12, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 95 */ - { 1, 12}, { 7, 6}, { 8, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, - { 1, 12}, { 1, 21}, { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 2, 6}, - { 1, 12}, { 4, 10}, { 9, 12}, { 7, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, - { 1, 5}, { 15, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 12, 0}, - { 13, 0}, { 1, 4}, { 3, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 96 */ - { 1, 12}, { 7, 6}, { 9, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 6, 10}, { 1, 11}, - { 1, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 6}, { 1, 11}, { 5, 10}, - { 8, 12}, { 8, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 14, 3}, { 1, 7}, - { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 13, 0}, - { 14, 0}, { 1, 4}, { 2, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 97 */ - { 1, 12}, { 7, 6}, { 9, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, - { 1, 12}, { 4, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 21}, { 1, 12}, { 4, 10}, - { 9, 12}, { 4, 10}, { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, - { 1, 5}, { 12, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 14, 0}, - { 15, 0}, { 1, 4}, { 1, 3}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, /* Row 98 */ - { 1, 12}, { 7, 6}, { 10, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 10, 10}, { 7, 12}, - { 3, 10}, { 1, 12}, { 1, 11}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 1, 12}, - { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 11, 3}, { 1, 7}, { 1, 2}, - { 1, 5}, { 1, 3}, { 1, 4}, { 15, 0}, - { 16, 0}, { 1, 4}, { 1, 5}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, /* Row 99 */ - { 7, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 9, 10}, { 7, 12}, - { 4, 10}, { 1, 12}, { 4, 10}, { 9, 12}, { 4, 10}, { 1, 12}, { 1, 6}, { 1, 11}, - { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, { 1, 5}, { 9, 3}, { 1, 7}, - { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 16, 0}, - { 17, 0}, { 1, 4}, { 1, 12}, { 3, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, /* Row 100 */ - { 11, 3}, { 1, 11}, { 5, 10}, { 7, 12}, { 9, 10}, { 7, 12}, { 9, 10}, { 8, 12}, - { 5, 10}, { 1, 11}, { 2, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 6, 6}, { 8, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 17, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 11, 3}, { 1, 13}, /* Row 101 */ - { 1, 12}, { 4, 10}, { 8, 12}, { 8, 10}, { 7, 12}, { 8, 10}, { 9, 12}, { 4, 10}, - { 1, 12}, { 3, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, - { 1, 5}, { 6, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 18, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 12, 3}, { 1, 11}, /* Row 102 */ - { 5, 10}, { 7, 12}, { 8, 10}, { 7, 12}, { 8, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 4, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 5, 3}, - { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 19, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 12, 3}, { 1, 13}, /* Row 103 */ - { 1, 12}, { 4, 10}, { 8, 12}, { 7, 10}, { 7, 12}, { 7, 10}, { 9, 12}, { 4, 10}, - { 1, 12}, { 5, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 6, 6}, - { 1, 5}, { 3, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 20, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 13, 3}, { 1, 11}, /* Row 104 */ - { 5, 10}, { 7, 12}, { 7, 10}, { 7, 12}, { 7, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 6, 6}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, { 2, 3}, - { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 21, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 13, 3}, { 1, 13}, /* Row 105 */ - { 1, 12}, { 4, 10}, { 8, 12}, { 6, 10}, { 7, 12}, { 6, 10}, { 9, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 7, 6}, - { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 22, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 14, 3}, { 1, 11}, /* Row 106 */ - { 5, 10}, { 7, 12}, { 6, 10}, { 7, 12}, { 6, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, { 6, 6}, - { 1, 18}, { 1, 5}, { 1, 3}, { 1, 4}, { 23, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 14, 3}, { 1, 13}, /* Row 107 */ - { 1, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 7, 12}, { 5, 10}, { 9, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 1, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 3}, { 1, 4}, { 24, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 15, 3}, { 1, 11}, /* Row 108 */ - { 5, 10}, { 7, 12}, { 5, 10}, { 7, 12}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 2, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 5, 6}, { 1, 20}, { 1, 1}, { 25, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 15, 3}, { 1, 13}, /* Row 109 */ - { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, { 7, 12}, { 4, 10}, { 9, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 3, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 4, 6}, { 1, 20}, { 2, 2}, { 25, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 16, 3}, { 1, 11}, /* Row 110 */ - { 5, 10}, { 7, 12}, { 4, 10}, { 7, 12}, { 4, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 4, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 2, 6}, { 1, 20}, { 3, 2}, { 1, 17}, { 24, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 16, 3}, { 1, 13}, /* Row 111 */ - { 1, 12}, { 4, 10}, { 8, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 9, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 5, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 1, 21}, { 1, 20}, { 5, 2}, { 24, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 17, 3}, { 1, 11}, /* Row 112 */ - { 5, 10}, { 7, 12}, { 3, 10}, { 7, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 6, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, - { 6, 2}, { 1, 17}, { 23, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 17, 3}, { 1, 13}, /* Row 113 */ - { 1, 12}, { 4, 10}, { 8, 12}, { 2, 10}, { 7, 12}, { 2, 10}, { 9, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 7, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 1, 18}, { 6, 2}, { 23, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 18, 3}, { 1, 11}, /* Row 114 */ - { 5, 10}, { 7, 12}, { 2, 10}, { 7, 12}, { 2, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 8, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, - { 6, 2}, { 1, 17}, { 22, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 18, 3}, { 1, 13}, /* Row 115 */ - { 1, 12}, { 4, 10}, { 8, 12}, { 1, 10}, { 7, 12}, { 1, 10}, { 9, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 9, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 1, 18}, { 6, 2}, { 22, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 6}, { 19, 3}, { 1, 11}, /* Row 116 */ - { 5, 10}, { 7, 12}, { 1, 10}, { 7, 12}, { 1, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, - { 6, 2}, { 1, 17}, { 21, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 18}, { 6, 6}, { 19, 3}, /* Row 117 */ - { 1, 13}, { 1, 12}, { 4, 10}, { 24, 12}, { 4, 10}, { 1, 12}, { 7, 6}, { 1, 5}, - { 11, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, - { 21, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 1, 2}, { 1, 20}, { 5, 6}, /* Row 118 */ - { 20, 3}, { 1, 11}, { 5, 10}, { 22, 12}, { 5, 10}, { 1, 11}, { 7, 6}, { 12, 3}, - { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, - { 20, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 2, 2}, { 1, 20}, { 5, 6}, /* Row 119 */ - { 19, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 22, 12}, { 4, 10}, { 1, 12}, { 7, 6}, - { 1, 5}, { 13, 3}, { 1, 11}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, - { 6, 2}, { 20, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 3, 2}, { 1, 20}, { 3, 6}, /* Row 120 */ - { 1, 3}, { 1, 6}, { 19, 3}, { 1, 11}, { 5, 10}, { 20, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 14, 3}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, { 5, 10}, { 1, 14}, - { 6, 2}, { 1, 17}, { 19, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 4, 2}, { 1, 20}, { 2, 6}, /* Row 121 */ - { 2, 3}, { 1, 6}, { 18, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 20, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 14, 3}, { 1, 7}, { 1, 25}, { 4, 10}, { 8, 12}, - { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 19, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 5, 2}, { 1, 20}, { 1, 6}, /* Row 122 */ - { 3, 3}, { 1, 6}, { 18, 3}, { 1, 11}, { 5, 10}, { 18, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 14, 3}, { 1, 7}, { 1, 2}, { 1, 13}, { 1, 12}, { 3, 10}, { 8, 12}, - { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 18, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 6, 2}, { 1, 20}, { 4, 3}, /* Row 123 */ - { 1, 6}, { 17, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 18, 12}, { 4, 10}, { 1, 12}, - { 7, 6}, { 1, 5}, { 13, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 20}, - { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, { 6, 2}, { 18, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 1, 0}, { 4, 3}, /* Row 124 */ - { 1, 6}, { 17, 3}, { 1, 11}, { 5, 10}, { 16, 12}, { 5, 10}, { 1, 11}, { 7, 6}, - { 13, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 1, 17}, { 4, 10}, - { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 17, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 1, 0}, { 1, 4}, /* Row 125 */ - { 4, 3}, { 1, 6}, { 16, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 16, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 12, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, - { 1, 4}, { 2, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, - { 6, 2}, { 17, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 2, 0}, { 1, 4}, /* Row 126 */ - { 4, 3}, { 1, 6}, { 16, 3}, { 1, 11}, { 5, 10}, { 14, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 12, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 4, 0}, - { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 16, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 3, 0}, { 1, 4}, /* Row 127 */ - { 4, 3}, { 1, 6}, { 15, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 14, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 11, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, - { 1, 4}, { 5, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, - { 6, 2}, { 16, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 4, 0}, { 1, 4}, /* Row 128 */ - { 4, 3}, { 1, 6}, { 15, 3}, { 1, 11}, { 5, 10}, { 12, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 11, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 7, 0}, - { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 17}, { 15, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 5, 0}, { 1, 4}, /* Row 129 */ - { 4, 3}, { 1, 6}, { 14, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 12, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 10, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, - { 1, 4}, { 8, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 12}, { 1, 18}, - { 6, 2}, { 15, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 6, 0}, { 1, 4}, /* Row 130 */ - { 4, 3}, { 1, 6}, { 14, 3}, { 1, 11}, { 5, 10}, { 10, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 10, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 10, 0}, - { 4, 10}, { 8, 12}, { 5, 10}, { 1, 14}, { 6, 2}, { 1, 26}, { 14, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 7, 0}, { 1, 4}, /* Row 131 */ - { 4, 3}, { 1, 6}, { 13, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 10, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 9, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, - { 1, 4}, { 11, 0}, { 1, 9}, { 4, 10}, { 8, 12}, { 4, 10}, { 1, 14}, { 6, 2}, - { 1, 17}, { 14, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 8, 0}, { 1, 4}, /* Row 132 */ - { 4, 3}, { 1, 6}, { 13, 3}, { 1, 11}, { 5, 10}, { 8, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 9, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 13, 0}, - { 4, 10}, { 8, 12}, { 4, 10}, { 1, 14}, { 7, 2}, { 14, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 9, 0}, { 1, 4}, /* Row 133 */ - { 4, 3}, { 1, 6}, { 12, 3}, { 1, 13}, { 1, 12}, { 4, 10}, { 8, 12}, { 4, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 8, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, - { 1, 4}, { 14, 0}, { 1, 9}, { 4, 10}, { 7, 12}, { 3, 10}, { 1, 12}, { 1, 19}, - { 7, 2}, { 1, 26}, { 13, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 10, 0}, { 1, 4}, /* Row 134 */ - { 4, 3}, { 1, 6}, { 12, 3}, { 1, 11}, { 5, 10}, { 6, 12}, { 5, 10}, { 1, 11}, - { 7, 6}, { 8, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 16, 0}, - { 4, 10}, { 6, 12}, { 4, 10}, { 1, 12}, { 8, 2}, { 1, 17}, { 13, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 11, 0}, { 1, 4}, /* Row 135 */ - { 4, 3}, { 1, 6}, { 11, 3}, { 1, 13}, { 1, 12}, { 5, 10}, { 4, 12}, { 5, 10}, - { 1, 12}, { 7, 6}, { 1, 5}, { 7, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, - { 1, 4}, { 17, 0}, { 1, 9}, { 4, 10}, { 4, 12}, { 5, 10}, { 1, 14}, { 8, 2}, - { 1, 17}, { 13, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 12, 0}, { 1, 4}, /* Row 136 */ - { 4, 3}, { 1, 6}, { 11, 3}, { 1, 11}, { 14, 10}, { 1, 11}, { 7, 6}, { 7, 3}, - { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 19, 0}, { 12, 10}, { 1, 12}, - { 1, 18}, { 8, 2}, { 1, 1}, { 13, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 13, 0}, { 1, 4}, /* Row 137 */ - { 4, 3}, { 1, 6}, { 10, 3}, { 1, 13}, { 1, 12}, { 12, 10}, { 1, 12}, { 7, 6}, - { 1, 5}, { 6, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 20, 0}, - { 1, 9}, { 10, 10}, { 1, 12}, { 10, 2}, { 14, 0}, - { 18, 0}, { 4, 10}, { 8, 12}, { 3, 10}, { 1, 12}, { 7, 2}, { 14, 0}, { 1, 4}, /* Row 138 */ - { 4, 3}, { 1, 6}, { 10, 3}, { 1, 11}, { 12, 10}, { 1, 11}, { 7, 6}, { 6, 3}, - { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 22, 0}, { 9, 10}, { 1, 12}, - { 10, 2}, { 1, 17}, { 14, 0}, - { 18, 0}, { 4, 10}, { 12, 12}, { 7, 2}, { 15, 0}, { 1, 4}, { 4, 3}, { 1, 6}, /* Row 139 */ - { 9, 3}, { 1, 5}, { 1, 15}, { 10, 10}, { 1, 15}, { 7, 6}, { 1, 5}, { 5, 3}, - { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 23, 0}, { 1, 17}, { 1, 14}, - { 5, 10}, { 1, 12}, { 1, 10}, { 1, 19}, { 10, 2}, { 15, 0}, - { 25, 0}, { 1, 20}, { 4, 18}, { 11, 2}, { 16, 0}, { 1, 4}, { 4, 3}, { 1, 6}, /* Row 140 */ - { 9, 3}, { 1, 5}, { 1, 11}, { 1, 12}, { 6, 10}, { 1, 12}, { 1, 11}, { 8, 6}, - { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 27, 0}, { 2, 9}, - { 1, 19}, { 1, 14}, { 1, 18}, { 11, 2}, { 1, 17}, { 15, 0}, - { 25, 0}, { 16, 2}, { 17, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 10, 3}, { 1, 13}, /* Row 141 */ - { 1, 11}, { 4, 12}, { 1, 11}, { 9, 6}, { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, - { 1, 3}, { 1, 4}, { 30, 0}, { 1, 1}, { 13, 2}, { 16, 0}, - { 25, 0}, { 16, 2}, { 18, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 11, 3}, { 1, 5}, /* Row 142 */ - { 1, 13}, { 11, 6}, { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, - { 32, 0}, { 1, 17}, { 11, 2}, { 17, 0}, - { 25, 0}, { 16, 2}, { 19, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 13, 3}, { 1, 5}, /* Row 143 */ - { 7, 6}, { 6, 3}, { 1, 7}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 34, 0}, - { 10, 2}, { 18, 0}, - { 25, 0}, { 16, 2}, { 20, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 25, 3}, { 1, 7}, /* Row 144 */ - { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 35, 0}, { 1, 1}, { 7, 2}, { 1, 17}, - { 19, 0}, - { 25, 0}, { 16, 2}, { 21, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 23, 3}, { 1, 7}, /* Row 145 */ - { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 64, 0}, - { 25, 0}, { 16, 2}, { 22, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 21, 3}, { 1, 7}, /* Row 146 */ - { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 65, 0}, - { 64, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 19, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 147 */ - { 1, 3}, { 1, 4}, { 66, 0}, - { 65, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 17, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 148 */ - { 1, 3}, { 1, 4}, { 67, 0}, - { 66, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 15, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 149 */ - { 1, 3}, { 1, 4}, { 68, 0}, - { 67, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 13, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 150 */ - { 1, 3}, { 1, 4}, { 69, 0}, - { 68, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 11, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 151 */ - { 1, 3}, { 1, 4}, { 70, 0}, - { 69, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 9, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 152 */ - { 1, 3}, { 1, 4}, { 71, 0}, - { 70, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 7, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 153 */ - { 1, 3}, { 1, 4}, { 72, 0}, - { 71, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 5, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 154 */ - { 1, 3}, { 1, 4}, { 73, 0}, - { 72, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 3, 3}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 155 */ - { 1, 3}, { 1, 4}, { 74, 0}, - { 73, 0}, { 1, 4}, { 4, 3}, { 1, 6}, { 1, 5}, { 1, 7}, { 1, 2}, { 1, 5}, /* Row 156 */ - { 1, 3}, { 1, 4}, { 75, 0}, - { 74, 0}, { 1, 4}, { 5, 3}, { 1, 2}, { 1, 5}, { 1, 3}, { 1, 4}, { 76, 0}, /* Row 157 */ - { 75, 0}, { 1, 4}, { 2, 3}, { 1, 5}, { 1, 20}, { 1, 5}, { 1, 3}, { 1, 4}, /* Row 158 */ - { 77, 0}, - { 76, 0}, { 1, 4}, { 4, 3}, { 1, 4}, { 78, 0} /* Row 159 */ -}; - -# endif -#else -# error "Unsupport pixel format" -#endif - -/******************************************************************************************** - * Public Data - ********************************************************************************************/ - -/******************************************************************************************** - * Private Functions - ********************************************************************************************/ - -/******************************************************************************************** - * Public Functions - ********************************************************************************************/ - -/******************************************************************************************** - * Name:nximage_bgcolor - * - * Description: - * Return the color of the background. In this case, we know that this is the first - * encoded color in the look-up table. - * - ********************************************************************************************/ - -nxgl_mxpixel_t nximage_bgcolor(void) -{ - return g_lut[0]; -} - -/******************************************************************************************** - * Name:nximage_avgcolor - * - * Description: - * Take the average of two pixel RGB values. - * - ********************************************************************************************/ - -nxgl_mxpixel_t nximage_avgcolor(nxgl_mxpixel_t color1, nxgl_mxpixel_t color2) -{ -#ifdef CONFIG_EXAMPLES_NXIMAGE_GREYSCALE - - return (nxgl_mxpixel_t)(((unsigned int)color1 + (unsigned int)color2) >> 1); - -#else /* CONFIG_EXAMPLES_NXIMAGE_GREYSCALE */ - unsigned int r1; - unsigned int g1; - unsigned int b1; - unsigned int r2; - unsigned int g2; - unsigned int b2; - -#if CONFIG_EXAMPLES_NXIMAGE_BPP == 24 - - /* RGB24 (8-8-8) Colors */ - - /* Demultiplex */ - - r1 = (color1 >> 16) & 0xff; /* 8-bit */ - g1 = (color1 >> 8) & 0xff; /* 8-bit */ - b1 = color1 & 0xff; /* 8-bit */ - - r2 = (color2 >> 16) & 0xff; /* 8-bit */ - g2 = (color2 >> 8) & 0xff; /* 8-bit */ - b2 = color2 & 0xff; /* 8-bit */ - - /* Average */ - - r1 = (r1 + r2 + 1) >> 1; /* 8-bit */ - g1 = (g1 + g2 + 1) >> 1; /* 8-bit */ - b1 = (b1 + b2 + 1) >> 1; /* 8-bit */ - - /* Clip */ - - if (r1 > 0xff) - { - r1 = 0xff; - } - - if (g1 > 0xff) - { - g1 = 0xff; - } - - if (b1 > 0xff) - { - b1 = 0xff; - } - - /* Multiplex */ - - color1 = r1 << 16 | g1 << 8 | b1; - -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 16 - - /* RGB16 (565) Colors */ - - /* Demultiplex */ - - r1 = (color1 >> 11) & 0x1f; /* 5-bit */ - g1 = (color1 >> 5) & 0x3f; /* 6-bit */ - b1 = color1 & 0x1f; /* 5-bit */ - - r2 = (color2 >> 11) & 0x1f; /* 5-bit */ - g2 = (color2 >> 5) & 0x3f; /* 6-bit */ - b2 = color2 & 0x1f; /* 5-bit */ - - /* Average */ - - r1 = (r1 + r2 + 1) >> 1; /* 5-bit */ - g1 = (g1 + g2 + 1) >> 1; /* 6-bit */ - b1 = (b1 + b2 + 1) >> 1; /* 5-bit */ - - /* Clip */ - - if (r1 > 0x1f) - { - r1 = 0x1f; - } - - if (g1 > 0x3f) - { - g1 = 0x3f; - } - - if (b1 > 0x1f) - { - b1 = 0x1f; - } - - /* Multiplex */ - - color1 = r1 << 11 | g1 << 5 | b1; - -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 8 - - /* RGB8 (332) Colors */ - - /* Demultiplex */ - - r1 = (color1 >> 5) & 0x07; /* 3-bit */ - g1 = (color1 >> 2) & 0x07; /* 3-bit */ - b1 = color1 & 0x03; /* 2-bit */ - - r2 = (color2 >> 5) & 0x07; /* 3-bit */ - g2 = (color2 >> 2) & 0x07; /* 3-bit */ - b2 = color2 & 0x03; /* 2-bit */ - - /* Average */ - - r1 = (r1 + r2 + 1) >> 1; /* 3-bit */ - g1 = (g1 + g2 + 1) >> 1; /* 3-bit */ - b1 = (b1 + b2 + 1) >> 1; /* 2-bit */ - - /* RGB24 (8-8-8) Colors */ - - /* Clip */ - - if (r1 > 0x07) - { - r1 = 0x07; - } - - if (g1 > 0x07) - { - g1 = 0x07; - } - - if (b1 > 0x03) - { - b1 = 0x03; - } - - /* Multiplex */ - - color1 = r1 << 5 | g1 << 2 | b1; - -#else -# error "Unsupport pixel format" -#endif - - return color1; -#endif /* CONFIG_EXAMPLES_NXIMAGE_GREYSCALE */ -} - -/******************************************************************************************** - * Name: nximage_blitrow - * - * Description: - * Return the next properly scaled row from the image. - * - ********************************************************************************************/ - -void nximage_blitrow(FAR nxgl_mxpixel_t *run, FAR const void **state) -{ - FAR const struct pix_run_s *pos = *(FAR const struct pix_run_s **)state; - unsigned int width; -#if defined(CONFIG_EXAMPLES_NXIMAGE_XSCALEp5) || defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5) - unsigned int nhalfpixels; - nxgl_mxpixel_t last; -#endif - unsigned int nrun; - nxgl_mxpixel_t color; - - /* NULL positional data means to start over */ - - if (!pos) - { - pos = g_nuttx; - } - - /* Process each run-length encoded pixel in the image */ - -#if defined(CONFIG_EXAMPLES_NXIMAGE_XSCALEp5) || defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5) - nhalfpixels = 0; - last = nximage_bgcolor(); -#endif - - for (width = 0; width < SCALED_WIDTH; pos++) - { - nrun = (unsigned int)pos->npix; - color = g_lut[pos->code]; - -#if defined(CONFIG_EXAMPLES_NXIMAGE_XSCALEp5) || defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5) - nhalfpixels += nrun & 1; -#ifdef CONFIG_EXAMPLES_NXIMAGE_XSCALEp5 - nrun >>= 1; -#else - nrun = nrun + (nrun >> 1); -#endif - if (nhalfpixels > 1) - { - *run++ = nximage_avgcolor(color, last); - nhalfpixels -= 2; - width++; - } - last = color; -#elif defined(CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0) - nrun <<= 1; -#endif - width += nrun; - while (nrun-- > 0) - { - *run++ = color; - } - } - ASSERT(width == SCALED_WIDTH); - - /* Save the start of the next row and return success */ - - *state = (FAR const void *)pos; -} diff --git a/apps/examples/nximage/nximage_bkgd.c b/apps/examples/nximage/nximage_bkgd.c deleted file mode 100644 index 4a028f720..000000000 --- a/apps/examples/nximage/nximage_bkgd.c +++ /dev/null @@ -1,397 +0,0 @@ -/**************************************************************************** - * examples/nximage/nximage_bkgd.c - * - * Copyright (C) 2011 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 <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <semaphore.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> -#include <nuttx/nx/nxfonts.h> - -#include "nximage.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Select renderer -- Some additional logic would be required to support - * pixel depths that are not directly addressable (1,2,4, and 24). - */ - -#if CONFIG_EXAMPLES_NXIMAGE_BPP == 1 -# define RENDERER nxf_convert_1bpp -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 2 -# define RENDERER nxf_convert_2bpp -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 4 -# define RENDERER nxf_convert_4bpp -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 8 -# define RENDERER nxf_convert_8bpp -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 16 -# define RENDERER nxf_convert_16bpp -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 24 -# define RENDERER nxf_convert_24bpp -#elif CONFIG_EXAMPLES_NXIMAGE_BPP == 32 -# define RENDERER nxf_convert_32bpp -#else -# error "Unsupported CONFIG_EXAMPLES_NXIMAGE_BPP" -#endif - -/* Vertical scaling */ - -#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALEp5) - -/* Read two rows, output one averaged row */ - -#define NINPUT_ROWS 2 -#define NOUTPUT_ROWS 1 - -#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) -/* Read two rows, output three rows */ - -#define NINPUT_ROWS 2 -#define NOUTPUT_ROWS 3 - -#elif defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0) -/* Read one row, output two rows */ - -#define NINPUT_ROWS 1 -#define NOUTPUT_ROWS 2 - -#else -/* Read one rows, output one or two rows */ - -#define NINPUT_ROWS 1 -#define NOUTPUT_ROWS 1 -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -struct nximage_run_t -{ - nxgl_mxpixel_t run[SCALED_WIDTH]; -}; - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static void nximage_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg); -static void nximage_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg); -#ifdef CONFIG_NX_MOUSE -static void nximage_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg); -#endif - -#ifdef CONFIG_NX_KBD -static void nximage_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg); -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const char g_hello[] = "Hello, World!"; - -/* Read one or two rows, output one tow or three rows */ - -static struct nximage_run_t g_runs[NINPUT_ROWS]; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* Background window call table */ - -const struct nx_callback_s g_nximagecb = -{ - nximage_redraw, /* redraw */ - nximage_position /* position */ -#ifdef CONFIG_NX_MOUSE - , nximage_mousein /* mousein */ -#endif -#ifdef CONFIG_NX_KBD - , nximage_kbdin /* my kbdin */ -#endif -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nximage_redraw - * - * Description: - * NX re-draw handler - * - ****************************************************************************/ - -static void nximage_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg) -{ - gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", - hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, - more ? "true" : "false"); -} - -/**************************************************************************** - * Name: nximage_position - * - * Description: - * NX position change handler - * - ****************************************************************************/ - -static void nximage_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg) -{ - /* Report the position */ - - gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", - hwnd, size->w, size->h, pos->x, pos->y, - bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); - - /* Have we picked off the window bounds yet? */ - - if (!g_nximage.havepos) - { - /* Save the background window handle */ - - g_nximage.hbkgd = hwnd; - - /* Save the window limits */ - - g_nximage.xres = bounds->pt2.x + 1; - g_nximage.yres = bounds->pt2.y + 1; - - g_nximage.havepos = true; - sem_post(&g_nximage.sem); - gvdbg("Have xres=%d yres=%d\n", g_nximage.xres, g_nximage.yres); - } -} - -/**************************************************************************** - * Name: nximage_mousein - * - * Description: - * NX mouse input handler - * - ****************************************************************************/ - -#ifdef CONFIG_NX_MOUSE -static void nximage_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg) -{ - message("nximage_mousein: hwnd=%p pos=(%d,%d) button=%02x\n", - hwnd, pos->x, pos->y, buttons); -} -#endif - -/**************************************************************************** - * Name: nximage_kbdin - * - * Description: - * NX keyboard input handler - * - ****************************************************************************/ - -#ifdef CONFIG_NX_KBD -static void nximage_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg) -{ - gvdbg("hwnd=%p nch=%d\n", hwnd, nch); - - /* In this example, there is no keyboard so a keyboard event is not - * expected. - */ - - message("nximage_kbdin: Unexpected keyboard callback\n"); -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nximage_image - * - * Description: - * Put the NuttX logo in the center of the display. - * - ****************************************************************************/ - -void nximage_image(NXWINDOW hwnd) -{ - FAR const void *state = NULL; - FAR struct nxgl_point_s pos; - FAR struct nxgl_rect_s dest; - FAR const void *src[CONFIG_NX_NPLANES]; - nxgl_coord_t row; - int ret; -#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALEp5) || defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) - int i; -#endif - - /* Center the image. Note: these may extend off the display. */ - - pos.x = (g_nximage.xres - SCALED_WIDTH) / 2; - pos.y = (g_nximage.yres - SCALED_HEIGHT) / 2; - - /* Set up the invariant part of the destination bounding box */ - - dest.pt1.x = pos.x; - dest.pt2.x = pos.x + SCALED_WIDTH - 1; - - /* Now output the rows */ - - for (row = 0; row < IMAGE_HEIGHT; row += NINPUT_ROWS) - { - /* Read input row(s) */ - - nximage_blitrow(g_runs[0].run, &state); -#if NINPUT_ROWS > 1 - nximage_blitrow(g_runs[1].run, &state); -#endif - - /* Output rows before averaging */ - -#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) || defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0) - - /* Output row[0] */ - - dest.pt1.y = pos.y; - dest.pt2.y = pos.y; - - src[0] = (FAR const void *)g_runs[0].run; -#if CONFIG_NX_NPLANES > 1 -# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" -#endif - ret = nx_bitmap((NXWINDOW)hwnd, &dest, src, &pos, SCALED_WIDTH*sizeof(nxgl_mxpixel_t)); - if (ret < 0) - { - message("nximage_image: nx_bitmapwindow failed: %d\n", errno); - } - - /* Increment the vertical position */ - - pos.y++; -#endif - - /* Perform averaging */ - -#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALEp5) || defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) - - /* Average row[0] and row[1], output results in row[0] */ - - for (i = 0; i < SCALED_WIDTH; i++) - { - /* Only average if the corresponding pixels in each row differ */ - - nxgl_mxpixel_t pix0 = g_runs[0].run[i]; - nxgl_mxpixel_t pix1 = g_runs[1].run[i]; - if (pix0 != pix1) - { - g_runs[0].run[i] = nximage_avgcolor(pix0, pix1); - } - } - -#endif - - /* Output rows after averaging */ - - /* Output row[0] */ - - dest.pt1.y = pos.y; - dest.pt2.y = pos.y; - - src[0] = (FAR const void *)g_runs[0].run; -#if CONFIG_NX_NPLANES > 1 -# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" -#endif - ret = nx_bitmap((NXWINDOW)hwnd, &dest, src, &pos, SCALED_WIDTH*sizeof(nxgl_mxpixel_t)); - if (ret < 0) - { - message("nximage_image: nx_bitmapwindow failed: %d\n", errno); - } - - /* Increment the vertical position */ - - pos.y++; - -#if defined(CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5) - - /* Output row[0] and row[1] */ - - dest.pt1.y = pos.y; - dest.pt2.y = pos.y; - - src[0] = (FAR const void *)g_runs[1].run; -#if CONFIG_NX_NPLANES > 1 -# warning "More logic is needed for the case where CONFIG_NX_PLANES > 1" -#endif - ret = nx_bitmap((NXWINDOW)hwnd, &dest, src, &pos, SCALED_WIDTH*sizeof(nxgl_mxpixel_t)); - if (ret < 0) - { - message("nximage_image: nx_bitmapwindow failed: %d\n", errno); - } - - /* Increment the vertical position */ - - pos.y++; -#endif - } -} diff --git a/apps/examples/nximage/nximage_main.c b/apps/examples/nximage/nximage_main.c deleted file mode 100644 index c432d8a73..000000000 --- a/apps/examples/nximage/nximage_main.c +++ /dev/null @@ -1,282 +0,0 @@ -/**************************************************************************** - * examples/nximage/nximage_main.c - * - * Copyright (C) 2011 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 <stdint.h> -#include <stdbool.h> -#include <stdio.h> -#include <unistd.h> -#include <time.h> -#include <string.h> -#include <sched.h> -#include <pthread.h> -#include <errno.h> -#include <debug.h> - -#ifdef CONFIG_NX_LCDDRIVER -# include <nuttx/lcd/lcd.h> -#else -# include <nuttx/fb.h> -#endif - -#include <nuttx/arch.h> -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> -#include <nuttx/nx/nxfonts.h> - -#include "nximage.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ -/* If not specified, assume that the hardware supports one video plane */ - -#ifndef CONFIG_EXAMPLES_NXIMAGE_VPLANE -# define CONFIG_EXAMPLES_NXIMAGE_VPLANE 0 -#endif - -/* If not specified, assume that the hardware supports one LCD device */ - -#ifndef CONFIG_EXAMPLES_NXIMAGE_DEVNO -# define CONFIG_EXAMPLES_NXIMAGE_DEVNO 0 -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -struct nximage_data_s g_nximage = -{ - NULL, /* hnx */ - NULL, /* hbkgd */ - 0, /* xres */ - 0, /* yres */ - false, /* havpos */ - { 0 }, /* sem */ - NXEXIT_SUCCESS /* exit code */ -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nximage_initialize - * - * Description: - * Initialize the LCD or framebuffer device (single user mode only), then - * open NX. - * - ****************************************************************************/ - -static inline int nximage_initialize(void) -{ - FAR NX_DRIVERTYPE *dev; - -#if defined(CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT) - /* Use external graphics driver initialization */ - - message("nximage_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXIMAGE_DEVNO); - if (!dev) - { - message("nximage_initialize: up_nxdrvinit failed, devno=%d\n", - CONFIG_EXAMPLES_NXIMAGE_DEVNO); - g_nximage.code = NXEXIT_EXTINITIALIZE; - return ERROR; - } - -#elif defined(CONFIG_NX_LCDDRIVER) - int ret; - - /* Initialize the LCD device */ - - message("nximage_initialize: Initializing LCD\n"); - ret = up_lcdinitialize(); - if (ret < 0) - { - message("nximage_initialize: up_lcdinitialize failed: %d\n", -ret); - g_nximage.code = NXEXIT_LCDINITIALIZE; - return ERROR; - } - - /* Get the device instance */ - - dev = up_lcdgetdev(CONFIG_EXAMPLES_NXIMAGE_DEVNO); - if (!dev) - { - message("nximage_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXIMAGE_DEVNO); - g_nximage.code = NXEXIT_LCDGETDEV; - return ERROR; - } - - /* Turn the LCD on at 75% power */ - - (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); -#else - int ret; - - /* Initialize the frame buffer device */ - - message("nximage_initialize: Initializing framebuffer\n"); - ret = up_fbinitialize(); - if (ret < 0) - { - message("nximage_initialize: up_fbinitialize failed: %d\n", -ret); - g_nximage.code = NXEXIT_FBINITIALIZE; - return ERROR; - } - - dev = up_fbgetvplane(CONFIG_EXAMPLES_NXIMAGE_VPLANE); - if (!dev) - { - message("nximage_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXIMAGE_VPLANE); - g_nximage.code = NXEXIT_FBGETVPLANE; - return ERROR; - } -#endif - - /* Then open NX */ - - message("nximage_initialize: Open NX\n"); - g_nximage.hnx = nx_open(dev); - if (!g_nximage.hnx) - { - message("nximage_initialize: nx_open failed: %d\n", errno); - g_nximage.code = NXEXIT_NXOPEN; - return ERROR; - } - return OK; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nximage_main - * - * Description: - * Main entry pointer. Configures the basic display resources. - * - ****************************************************************************/ - -int nximage_main(int argc, char *argv[]) -{ - nxgl_mxpixel_t color; - int ret; - - /* Initialize NX */ - - ret = nximage_initialize(); - message("nximage_main: NX handle=%p\n", g_nximage.hnx); - if (!g_nximage.hnx || ret < 0) - { - message("nximage_main: Failed to get NX handle: %d\n", errno); - g_nximage.code = NXEXIT_NXOPEN; - goto errout; - } - - /* Set the background to the configured background color */ - - color = nximage_bgcolor(); - message("nximage_main: Set background color=%d\n", color); - - ret = nx_setbgcolor(g_nximage.hnx, &color); - if (ret < 0) - { - message("nximage_main: nx_setbgcolor failed: %d\n", errno); - g_nximage.code = NXEXIT_NXSETBGCOLOR; - goto errout_with_nx; - } - - /* Get the background window */ - - ret = nx_requestbkgd(g_nximage.hnx, &g_nximagecb, NULL); - if (ret < 0) - { - message("nximage_main: nx_setbgcolor failed: %d\n", errno); - g_nximage.code = NXEXIT_NXREQUESTBKGD; - goto errout_with_nx; - } - - /* Wait until we have the screen resolution. We'll have this immediately - * unless we are dealing with the NX server. - */ - - while (!g_nximage.havepos) - { - (void)sem_wait(&g_nximage.sem); - } - message("nximage_main: Screen resolution (%d,%d)\n", g_nximage.xres, g_nximage.yres); - - /* Now, put up the NuttX logo and wait a bit so that it visible. */ - - nximage_image(g_nximage.hbkgd); - sleep(5); - - /* Release background */ - - (void)nx_releasebkgd(g_nximage.hbkgd); - - /* Close NX */ - -errout_with_nx: - message("nximage_main: Close NX\n"); - nx_close(g_nximage.hnx); -errout: - return g_nximage.code; -} diff --git a/apps/examples/nxlines/Kconfig b/apps/examples/nxlines/Kconfig deleted file mode 100644 index af1286a4f..000000000 --- a/apps/examples/nxlines/Kconfig +++ /dev/null @@ -1,87 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_NXLINES - bool "NX graphics lines example" - default n - ---help--- - Enable the X graphics lines example - -if EXAMPLES_NXLINES - -config EXAMPLES_NXLINES_VPLANE - int "Graphics Plane" - default 0 - ---help--- - The plane to select from the frame-buffer driver for use in the test. Default: 0 - -config EXAMPLES_NXLINES_DEVNO - int "Graphics Device Number" - default 0 - ---help--- - The LCD device to select from the LCD driver for use in the test: Default: 0 - -config EXAMPLES_NXLINES_BGCOLOR - hex "Background Color" - default 0x00 - ---help--- - The color of the background. Default depends on EXAMPLES_NXLINES_BPP. - -config EXAMPLES_NXLINES_LINEWIDTH - int "Line Width" - default 16 - ---help--- - Selects the width of the lines in pixels (default: 16) - -config EXAMPLES_NXLINES_LINECOLOR - hex "Line Color" - default 0x00 - ---help--- - The color of the central lines drawn in the background window. Default - depends on EXAMPLES_NXLINES_BPP (there really is no meaningful default). - -config EXAMPLES_NXLINES_BORDERWIDTH - int "Border Width" - default 16 - ---help--- - The width of the circular border drawn in the background window. (default: 16). - -config EXAMPLES_NXLINES_BORDERCOLOR - hex "Border Color" - default 0x00 - ---help--- - The color of the circular border drawn in the background window. Default - depends on EXAMPLES_NXLINES_BPP (there really is no meaningful default). - -config EXAMPLES_NXLINES_CIRCLECOLOR - hex "Circle Color" - default 0x00 - ---help--- - The color of the circular region filled in the background window. Default - depends on EXAMPLES_NXLINES_BPP (there really is no meaningful default). - -config EXAMPLES_NXLINES_BPP - int "Bits Per Pixel" - default 8 - ---help--- - Pixels per pixel to use. Valid options include 2, 4, 8, 16, 24, and 32. - Default is 16. - -config EXAMPLES_NXLINES_EXTERNINIT - bool "External Device Initialization" - default false - ---help--- - The driver for the graphics device on this platform requires some unusual - initialization. This is the for, for example, SPI LCD/OLED devices. If - this configuration is selected, then the platform code must provide an LCD - initialization function with a prototype like: - - #ifdef NX_LCDDRIVER - FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); - #else - FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); - #endif - -endif diff --git a/apps/examples/nxlines/Makefile b/apps/examples/nxlines/Makefile deleted file mode 100644 index cdda7ad8c..000000000 --- a/apps/examples/nxlines/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################ -# apps/examples/nxlines/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# NuttX NX Graphics Example. - -ASRCS = -CSRCS = nxlines_main.c nxlines_bkgd.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# NXLINES built-in application info - -APPNAME = nxlines -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/nxlines/nxlines.h b/apps/examples/nxlines/nxlines.h deleted file mode 100644 index a26db9f29..000000000 --- a/apps/examples/nxlines/nxlines.h +++ /dev/null @@ -1,197 +0,0 @@ -/**************************************************************************** - * examples/nxlines/nxlines.h - * - * 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 - * 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 __APPS_EXAMPLES_NXLINES_NXLINES_H -#define __APPS_EXAMPLES_NXLINES_NXLINES_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <stdbool.h> -#include <semaphore.h> - -#include <nuttx/nx/nxglib.h> -#include <nuttx/nx/nx.h> -#include <nuttx/rgbcolors.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_NX -# error "NX is not enabled (CONFIG_NX)" -#endif - -#ifndef CONFIG_EXAMPLES_NXLINES_VPLANE -# define CONFIG_EXAMPLES_NXLINES_VPLANE 0 -#endif - -#ifndef CONFIG_EXAMPLES_NXLINES_BPP -# define CONFIG_EXAMPLES_NXLINES_BPP 16 -#endif - -#ifndef CONFIG_EXAMPLES_NXLINES_BGCOLOR -# if CONFIG_EXAMPLES_NXLINES_BPP == 24 || CONFIG_EXAMPLES_NXLINES_BPP == 32 -# define CONFIG_EXAMPLES_NXLINES_BGCOLOR RGB24_DARKGREEN -# elif CONFIG_EXAMPLES_NXLINES_BPP == 16 -# define CONFIG_EXAMPLES_NXLINES_BGCOLOR RGB16_DARKGREEN -# else -# define CONFIG_EXAMPLES_NXLINES_BGCOLOR RGB8_DARKGREEN -# endif -#endif - -#ifndef CONFIG_EXAMPLES_NXLINES_LINEWIDTH -# define CONFIG_EXAMPLES_NXLINES_LINEWIDTH 16 -#endif - -#ifndef CONFIG_EXAMPLES_NXLINES_LINECOLOR -# if CONFIG_EXAMPLES_NXLINES_BPP == 24 || CONFIG_EXAMPLES_NXLINES_BPP == 32 -# define CONFIG_EXAMPLES_NXLINES_LINECOLOR RGB24_YELLOW -# elif CONFIG_EXAMPLES_NXLINES_BPP == 16 -# define CONFIG_EXAMPLES_NXLINES_LINECOLOR RGB16_YELLOW -# else -# define CONFIG_EXAMPLES_NXLINES_LINECOLOR RGB8_YELLOW -# endif -#endif - -#ifndef CONFIG_EXAMPLES_NXLINES_BORDERWIDTH -# define CONFIG_EXAMPLES_NXLINES_BORDERWIDTH 16 -#endif - -#ifndef CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -# if CONFIG_EXAMPLES_NXLINES_BPP == 24 || CONFIG_EXAMPLES_NXLINES_BPP == 32 -# define CONFIG_EXAMPLES_NXLINES_BORDERCOLOR RGB24_YELLOW -# elif CONFIG_EXAMPLES_NXLINES_BPP == 16 -# define CONFIG_EXAMPLES_NXLINES_BORDERCOLOR RGB16_YELLOW -# else -# define CONFIG_EXAMPLES_NXLINES_BORDERCOLOR RGB8_YELLOW -# endif -#endif - -#ifndef CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR -# if CONFIG_EXAMPLES_NXLINES_BPP == 24 || CONFIG_EXAMPLES_NXLINES_BPP == 32 -# define CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR RGB24_BEIGE -# elif CONFIG_EXAMPLES_NXLINES_BPP == 16 -# define CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR RGB16_BEIGE -# else -# define CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR RGB8_YELLOW -# endif -#endif - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# define msgflush() -# else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define msgflush() -# else -# define message printf -# define msgflush() fflush(stdout) -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -enum exitcode_e -{ - NXEXIT_SUCCESS = 0, - NXEXIT_EXTINITIALIZE, - NXEXIT_FBINITIALIZE, - NXEXIT_FBGETVPLANE, - NXEXIT_LCDINITIALIZE, - NXEXIT_LCDGETDEV, - NXEXIT_NXOPEN, - NXEXIT_NXREQUESTBKGD, - NXEXIT_NXSETBGCOLOR -}; - -struct nxlines_data_s -{ - /* The NX handles */ - - NXHANDLE hnx; - NXHANDLE hbkgd; - - /* The screen resolution */ - - nxgl_coord_t xres; - nxgl_coord_t yres; - - volatile bool havepos; - sem_t sem; - volatile int code; -}; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/* NXLINES state data */ - -extern struct nxlines_data_s g_nxlines; - -/* NX callback vtables */ - -extern const struct nx_callback_s g_nxlinescb; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NXLINES_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif - -/* Background window interfaces */ - -extern void nxlines_test(NXWINDOW hwnd); - -#endif /* __APPS_EXAMPLES_NXLINES_NXLINES_H */ diff --git a/apps/examples/nxlines/nxlines_bkgd.c b/apps/examples/nxlines/nxlines_bkgd.c deleted file mode 100644 index 9dd785605..000000000 --- a/apps/examples/nxlines/nxlines_bkgd.c +++ /dev/null @@ -1,335 +0,0 @@ -/**************************************************************************** - * examples/nxlines/nxlines_bkgd.c - * - * 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 - * 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <debug.h> -#include <fixedmath.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> - -#include "nxlines.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#ifndef MIN -# define MIN(a,b) (a < b ? a : b) -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static void nxlines_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool morem, FAR void *arg); -static void nxlines_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg); -#ifdef CONFIG_NX_MOUSE -static void nxlines_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg); -#endif - -#ifdef CONFIG_NX_KBD -static void nxlines_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg); -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* Background window call table */ - -const struct nx_callback_s g_nxlinescb = -{ - nxlines_redraw, /* redraw */ - nxlines_position /* position */ -#ifdef CONFIG_NX_MOUSE - , nxlines_mousein /* mousein */ -#endif -#ifdef CONFIG_NX_KBD - , nxlines_kbdin /* my kbdin */ -#endif -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxlines_redraw - ****************************************************************************/ - -static void nxlines_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg) -{ - gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", - hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, - more ? "true" : "false"); -} - -/**************************************************************************** - * Name: nxlines_position - ****************************************************************************/ - -static void nxlines_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg) -{ - /* Report the position */ - - gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", - hwnd, size->w, size->h, pos->x, pos->y, - bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); - - /* Have we picked off the window bounds yet? */ - - if (!g_nxlines.havepos) - { - /* Save the background window handle */ - - g_nxlines.hbkgd = hwnd; - - /* Save the window limits */ - - g_nxlines.xres = bounds->pt2.x + 1; - g_nxlines.yres = bounds->pt2.y + 1; - - g_nxlines.havepos = true; - sem_post(&g_nxlines.sem); - gvdbg("Have xres=%d yres=%d\n", g_nxlines.xres, g_nxlines.yres); - } -} - -/**************************************************************************** - * Name: nxlines_mousein - ****************************************************************************/ - -#ifdef CONFIG_NX_MOUSE -static void nxlines_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg) -{ - message("nxlines_mousein: hwnd=%p pos=(%d,%d) button=%02x\n", - hwnd, pos->x, pos->y, buttons); -} -#endif - -/**************************************************************************** - * Name: nxlines_kbdin - ****************************************************************************/ - -#ifdef CONFIG_NX_KBD -static void nxlines_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg) -{ - gvdbg("hwnd=%p nch=%d\n", hwnd, nch); - - /* In this example, there is no keyboard so a keyboard event is not - * expected. - */ - - message("nxlines_kbdin: Unexpected keyboard callback\n"); -} -#endif - - /**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxlines_test - * - * Description: - * Print "Hello, World!" in the center of the display. - * - ****************************************************************************/ - -void nxlines_test(NXWINDOW hwnd) -{ - struct nxgl_point_s center; - struct nxgl_vector_s vector; - struct nxgl_vector_s previous; - nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; - nxgl_coord_t maxradius; - nxgl_coord_t radius; - nxgl_coord_t halfx; - nxgl_coord_t halfy; - b16_t angle; - int ret; - - /* Get the maximum radius and center of the circle */ - - maxradius = MIN(g_nxlines.yres, g_nxlines.xres) >> 1; - center.x = g_nxlines.xres >> 1; - center.y = g_nxlines.yres >> 1; - - /* Draw a circular background */ - - radius = maxradius - ((CONFIG_EXAMPLES_NXLINES_BORDERWIDTH+1)/2); - color[0] = CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR; - ret = nx_fillcircle((NXWINDOW)hwnd, ¢er, radius, color); - if (ret < 0) - { - message("nxlines_test: nx_fillcircle failed: %d\n", ret); - } - - /* Draw the circular border */ - - color[0] = CONFIG_EXAMPLES_NXLINES_BORDERCOLOR; - ret = nx_drawcircle((NXWINDOW)hwnd, ¢er, radius, - CONFIG_EXAMPLES_NXLINES_BORDERWIDTH, color); - if (ret < 0) - { - message("nxlines_test: nx_fillcircle failed: %d\n", ret); - } - - /* Back off the radius to account for the thickness of border line - * and with a big fudge factor that will (hopefully) prevent the corners - * of the lines from overwriting the border. This is overly complicated - * here because we don't assume anything about the screen resolution or - * the borderwidth or the line thickness (and there are certainly some - * smarter ways to do this). - */ - - if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 80)) - { - radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 40); - } - else if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 60)) - { - radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 30); - } - else if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 40)) - { - radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 20); - } - else if (maxradius > (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 20)) - { - radius = maxradius - (CONFIG_EXAMPLES_NXLINES_BORDERWIDTH + 10); - } - else - { - radius = maxradius - CONFIG_EXAMPLES_NXLINES_BORDERWIDTH; - } - - /* The loop, showing the line in various orientations */ - - angle = 0; - previous.pt1.x = center.x; - previous.pt1.y = center.y; - previous.pt2.x = center.x; - previous.pt2.y = center.y; - - for (;;) - { - /* Determine the position of the line on this pass */ - - halfx = b16toi(b16muli(b16sin(angle), radius)); - halfy = b16toi(b16muli(b16cos(angle), radius)); - - vector.pt1.x = center.x + halfx; - vector.pt1.y = center.y + halfy; - vector.pt2.x = center.x - halfx; - vector.pt2.y = center.y - halfy; - - message("Angle: %08x vector: (%d,%d)->(%d,%d)\n", - angle, vector.pt1.x, vector.pt1.y, vector.pt2.x, vector.pt2.y); - - /* Clear the previous line by overwriting it with the circle color */ - - color[0] = CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR; - ret = nx_drawline((NXWINDOW)hwnd, &previous, CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color); - if (ret < 0) - { - message("nxlines_test: nx_drawline failed clearing: %d\n", ret); - } - - /* Draw the new line */ - - color[0] = CONFIG_EXAMPLES_NXLINES_LINECOLOR; - ret = nx_drawline((NXWINDOW)hwnd, &vector, CONFIG_EXAMPLES_NXLINES_LINEWIDTH, color); - if (ret < 0) - { - message("nxlines_test: nx_drawline failed clearing: %d\n", ret); - } - - /* Set up for the next time through the loop then sleep for a bit. */ - - angle += b16PI / 16; /* 32 angular positions in full circle */ - - /* Check if we have gone all the way around */ - - if (angle > (31 * (2 * b16PI) / 32)) - { -#ifdef CONFIG_NSH_BUILTIN_APPS - /* If this example was built as an NSH add-on, then exit after we - * have gone all the way around once. - */ - - return; -#else - /* Wrap back to zero and continue with the test */ - - angle = 0; -#endif - } - - memcpy(&previous, &vector, sizeof(struct nxgl_vector_s)); - usleep(500*1000); - } -} diff --git a/apps/examples/nxlines/nxlines_main.c b/apps/examples/nxlines/nxlines_main.c deleted file mode 100644 index 331fab631..000000000 --- a/apps/examples/nxlines/nxlines_main.c +++ /dev/null @@ -1,272 +0,0 @@ -/**************************************************************************** - * examples/nxlines/nxlines_main.c - * - * 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 - * 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 <stdint.h> -#include <stdio.h> -#include <unistd.h> -#include <time.h> -#include <string.h> -#include <sched.h> -#include <errno.h> -#include <debug.h> - -#ifdef CONFIG_NX_LCDDRIVER -# include <nuttx/lcd/lcd.h> -#else -# include <nuttx/fb.h> -#endif - -#include <nuttx/arch.h> -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> - -#include "nxlines.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ -/* If not specified, assume that the hardware supports one video plane */ - -#ifndef CONFIG_EXAMPLES_NXLINES_VPLANE -# define CONFIG_EXAMPLES_NXLINES_VPLANE 0 -#endif - -/* If not specified, assume that the hardware supports one LCD device */ - -#ifndef CONFIG_EXAMPLES_NXLINES_DEVNO -# define CONFIG_EXAMPLES_NXLINES_DEVNO 0 -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -struct nxlines_data_s g_nxlines = -{ - NULL, /* hnx */ - NULL, /* hbkgd */ - 0, /* xres */ - 0, /* yres */ - false, /* havpos */ - { 0 }, /* sem */ - NXEXIT_SUCCESS /* exit code */ -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxlines_initialize - ****************************************************************************/ - -static inline int nxlines_initialize(void) -{ - FAR NX_DRIVERTYPE *dev; - -#if defined(CONFIG_EXAMPLES_NXLINES_EXTERNINIT) - /* Use external graphics driver initialization */ - - message("nxlines_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXLINES_DEVNO); - if (!dev) - { - message("nxlines_initialize: up_nxdrvinit failed, devno=%d\n", - CONFIG_EXAMPLES_NXLINES_DEVNO); - g_nxlines.code = NXEXIT_EXTINITIALIZE; - return ERROR; - } - -#elif defined(CONFIG_NX_LCDDRIVER) - int ret; - - /* Initialize the LCD device */ - - message("nxlines_initialize: Initializing LCD\n"); - ret = up_lcdinitialize(); - if (ret < 0) - { - message("nxlines_initialize: up_lcdinitialize failed: %d\n", -ret); - g_nxlines.code = NXEXIT_LCDINITIALIZE; - return ERROR; - } - - /* Get the device instance */ - - dev = up_lcdgetdev(CONFIG_EXAMPLES_NXLINES_DEVNO); - if (!dev) - { - message("nxlines_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXLINES_DEVNO); - g_nxlines.code = NXEXIT_LCDGETDEV; - return ERROR; - } - - /* Turn the LCD on at 75% power */ - - (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); -#else - int ret; - - /* Initialize the frame buffer device */ - - message("nxlines_initialize: Initializing framebuffer\n"); - ret = up_fbinitialize(); - if (ret < 0) - { - message("nxlines_initialize: up_fbinitialize failed: %d\n", -ret); - g_nxlines.code = NXEXIT_FBINITIALIZE; - return ERROR; - } - - dev = up_fbgetvplane(CONFIG_EXAMPLES_NXLINES_VPLANE); - if (!dev) - { - message("nxlines_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXLINES_VPLANE); - g_nxlines.code = NXEXIT_FBGETVPLANE; - return ERROR; - } -#endif - - /* Then open NX */ - - message("nxlines_initialize: Open NX\n"); - g_nxlines.hnx = nx_open(dev); - if (!g_nxlines.hnx) - { - message("nxlines_initialize: nx_open failed: %d\n", errno); - g_nxlines.code = NXEXIT_NXOPEN; - return ERROR; - } - return OK; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxlines_main - ****************************************************************************/ - -int nxlines_main(int argc, char *argv[]) -{ - nxgl_mxpixel_t color; - int ret; - - /* Initialize NX */ - - ret = nxlines_initialize(); - message("nxlines_main: NX handle=%p\n", g_nxlines.hnx); - if (!g_nxlines.hnx || ret < 0) - { - message("nxlines_main: Failed to get NX handle: %d\n", errno); - g_nxlines.code = NXEXIT_NXOPEN; - goto errout; - } - - /* Set the background to the configured background color */ - - message("nxlines_main: Set background color=%d\n", - CONFIG_EXAMPLES_NXLINES_BGCOLOR); - - color = CONFIG_EXAMPLES_NXLINES_BGCOLOR; - ret = nx_setbgcolor(g_nxlines.hnx, &color); - if (ret < 0) - { - message("nxlines_main: nx_setbgcolor failed: %d\n", errno); - g_nxlines.code = NXEXIT_NXSETBGCOLOR; - goto errout_with_nx; - } - - /* Get the background window */ - - ret = nx_requestbkgd(g_nxlines.hnx, &g_nxlinescb, NULL); - if (ret < 0) - { - message("nxlines_main: nx_setbgcolor failed: %d\n", errno); - g_nxlines.code = NXEXIT_NXREQUESTBKGD; - goto errout_with_nx; - } - - /* Wait until we have the screen resolution. We'll have this immediately - * unless we are dealing with the NX server. - */ - - while (!g_nxlines.havepos) - { - (void)sem_wait(&g_nxlines.sem); - } - message("nxlines_main: Screen resolution (%d,%d)\n", g_nxlines.xres, g_nxlines.yres); - - /* Now, say perform the lines (these test does not return so the remaining - * logic is cosmetic). - */ - - nxlines_test(g_nxlines.hbkgd); - - /* Release background */ - - (void)nx_releasebkgd(g_nxlines.hbkgd); - - /* Close NX */ - -errout_with_nx: - message("nxlines_main: Close NX\n"); - nx_close(g_nxlines.hnx); -errout: - return g_nxlines.code; -} diff --git a/apps/examples/nxtext/Kconfig b/apps/examples/nxtext/Kconfig deleted file mode 100644 index 1ff2c44be..000000000 --- a/apps/examples/nxtext/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_NXTEXT - bool "NX graphics text example" - default n - ---help--- - Enable the NX graphics text example - -if EXAMPLES_NXTEXT -endif diff --git a/apps/examples/nxtext/Makefile b/apps/examples/nxtext/Makefile deleted file mode 100644 index dffe66ba1..000000000 --- a/apps/examples/nxtext/Makefile +++ /dev/null @@ -1,112 +0,0 @@ -############################################################################ -# apps/examples/nxtext/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# NuttX NX Graphics Example. - -ASRCS = -CSRCS = nxtext_main.c nxtext_bkgd.c nxtext_popup.c nxtext_putc.c - -ifeq ($(CONFIG_NX_MULTIUSER),y) -CSRCS += nxtext_server.c -endif - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# NXTEXT built-in application info - -APPNAME = nxtext -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_EXAMPLES_NXTEXT_BUILTIN),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/nxtext/nxtext_bkgd.c b/apps/examples/nxtext/nxtext_bkgd.c deleted file mode 100644 index d457432db..000000000 --- a/apps/examples/nxtext/nxtext_bkgd.c +++ /dev/null @@ -1,467 +0,0 @@ -/**************************************************************************** - * examples/nxtext/nxtext_bkgd.c - * - * 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 - * 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 <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <semaphore.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxfonts.h> - -#include "nxtext_internal.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static void nxbg_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool morem, FAR void *arg); -static void nxbg_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg); -#ifdef CONFIG_NX_MOUSE -static void nxbg_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg); -#endif - -#ifdef CONFIG_NX_KBD -static void nxbg_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg); -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static struct nxtext_state_s g_bgstate; -static struct nxtext_bitmap_s g_bgbm[CONFIG_EXAMPLES_NXTEXT_BMCACHE]; -static struct nxtext_glyph_s g_bgglyph[CONFIG_EXAMPLES_NXTEXT_GLCACHE]; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* Background window call table */ - -const struct nx_callback_s g_nxtextcb = -{ - nxbg_redraw, /* redraw */ - nxbg_position /* position */ -#ifdef CONFIG_NX_MOUSE - , nxbg_mousein /* mousein */ -#endif -#ifdef CONFIG_NX_KBD - , nxbg_kbdin /* my kbdin */ -#endif -}; - -/* Background window handle */ - -NXHANDLE g_bgwnd; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxbg_redrawrect - ****************************************************************************/ - -static void nxbg_redrawrect(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect) -{ - int ret; - int i; - - ret = nx_fill(hwnd, rect, g_bgstate.wcolor); - if (ret < 0) - { - message("nxbg_redrawrect: nx_fill failed: %d\n", errno); - } - - /* Fill each character on the display (Only the characters within rect - * will actually be redrawn). - */ - - for (i = 0; i < g_bgstate.nchars; i++) - { - nxtext_fillchar(hwnd, rect, &g_bgstate, g_bghfont, &g_bgstate.bm[i]); - } -} - -/**************************************************************************** - * Name: nxbg_redraw - ****************************************************************************/ - -static void nxbg_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg) -{ - gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", - hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, - more ? "true" : "false"); - - nxbg_redrawrect(hwnd, rect); -} - -/**************************************************************************** - * Name: nxbg_position - ****************************************************************************/ - -static void nxbg_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg) -{ - FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg; - - /* Report the position */ - - gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", - hwnd, size->w, size->h, pos->x, pos->y, - bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); - - /* Have we picked off the window bounds yet? */ - - if (!b_haveresolution) - { - /* Save the background window handle */ - - g_bgwnd = hwnd; - - /* Save the background window size */ - - st->wsize.w = size->w; - st->wsize.h = size->h; - - /* Save the window limits (these should be the same for all places and all windows */ - - g_xres = bounds->pt2.x + 1; - g_yres = bounds->pt2.y + 1; - - b_haveresolution = true; - sem_post(&g_semevent); - gvdbg("Have xres=%d yres=%d\n", g_xres, g_yres); - } -} - -/**************************************************************************** - * Name: nxbg_mousein - ****************************************************************************/ - -#ifdef CONFIG_NX_MOUSE -static void nxbg_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg) -{ - message("nxbg_mousein: hwnd=%p pos=(%d,%d) button=%02x\n", - hwnd, pos->x, pos->y, buttons); -} -#endif - -/**************************************************************************** - * Name: nxbg_kbdin - ****************************************************************************/ - -#ifdef CONFIG_NX_KBD -static void nxbg_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg) -{ - gvdbg("hwnd=%p nch=%d\n", hwnd, nch); - nxbg_write(hwnd, ch, nch); -} -#endif - -/**************************************************************************** - * Name: nxbg_movedisplay - * - * Description: - * This function implements the data movement for the scroll operation. If - * we can read the displays framebuffer memory, then the job is pretty - * easy. However, many displays (such as SPI-based LCDs) are often read- - * only. - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NXTEXT_NOGETRUN -static inline void nxbg_movedisplay(NXWINDOW hwnd, int bottom, int lineheight) -{ - FAR struct nxtext_bitmap_s *bm; - struct nxgl_rect_s rect; - nxgl_coord_t row; - int ret; - int i; - - /* Move each row, one at a time. They could all be moved at once (by calling - * nxbg_redrawrect), but the since the region is cleared, then re-written, the - * effect would not be good. Below the region is also cleared and re-written, - * however, in much smaller chunks. - */ - - rect.pt1.x = 0; - rect.pt2.x = g_bgstate.wsize.w - 1; - - for (row = LINE_SEPARATION; row < bottom; row += lineheight) - { - /* Create a bounding box the size of one row of characters */ - - rect.pt1.y = row; - rect.pt2.y = row + lineheight - 1; - - /* Clear the region */ - - ret = nx_fill(hwnd, &rect, g_bgstate.wcolor); - if (ret < 0) - { - message("nxbg_movedisplay: nx_fill failed: %d\n", errno); - } - - /* Fill each character that might lie within in the bounding box */ - - for (i = 0; i < g_bgstate.nchars; i++) - { - bm = &g_bgstate.bm[i]; - if (bm->pos.y <= rect.pt2.y && bm->pos.y + g_bgstate.fheight >= rect.pt1.y) - { - nxtext_fillchar(hwnd, &rect, &g_bgstate, g_bghfont, bm); - } - } - } - - /* Finally, clear the bottom part of the display */ - - rect.pt1.y = bottom; - rect.pt2.y = g_bgstate.wsize.h- 1; - - ret = nx_fill(hwnd, &rect, g_bgstate.wcolor); - if (ret < 0) - { - message("nxbg_movedisplay: nx_fill failed: %d\n", errno); - } -} -#else -static inline void nxbg_movedisplay(NXWINDOW hwnd, int bottom, int lineheight) -{ - struct nxgl_rect_s rect; - struct nxgl_point_s offset; - int ret; - - /* Move the display in the range of 0-height up one lineheight. The - * line at the bottom will be reset to the background color automatically. - * - * The source rectangle to be moved. - */ - - rect.pt1.x = 0; - rect.pt1.y = lineheight + LINE_SEPARATION; - rect.pt2.x = g_bgstate.wsize.w - 1; - rect.pt2.y = g_bgstate.wsize.h - 1; - - /* The offset that determines how far to move the source rectangle */ - - offset.x = 0; - offset.y = -lineheight; - - /* Move the source rectangle */ - - ret = nx_move(hwnd, &rect, &offset); - if (ret < 0) - { - message("nxbg_movedisplay: nx_move failed: %d\n", errno); - } -} -#endif - -/**************************************************************************** - * Name: nxbg_scroll - ****************************************************************************/ - -static inline void nxbg_scroll(NXWINDOW hwnd, int lineheight) -{ - int i; - int j; - - /* Adjust the vertical position of each character */ - - for (i = 0; i < g_bgstate.nchars; ) - { - FAR struct nxtext_bitmap_s *bm = &g_bgstate.bm[i]; - - /* Has any part of this character scrolled off the screen? */ - - if (bm->pos.y < lineheight + LINE_SEPARATION) - { - /* Yes... Delete the character by moving all of the data */ - - for (j = i; j < g_bgstate.nchars-1; j++) - { - memcpy(&g_bgstate.bm[j], &g_bgstate.bm[j+1], sizeof(struct nxtext_bitmap_s)); - } - - /* Decrement the number of cached characters ('i' is not incremented - * in this case because it already points to the next character) - */ - - g_bgstate.nchars--; - } - - /* No.. just decrement its vertical position (moving it "up" the - * display by one line). - */ - - else - { - bm->pos.y -= lineheight; - - /* We are keeping this one so increment to the next character */ - - i++; - } - } - - /* And move the next display position up by one line as well */ - - g_bgstate.fpos.y -= lineheight; - - /* Move the display in the range of 0-height up one lineheight. */ - - nxbg_movedisplay(hwnd, g_bgstate.fpos.y, lineheight); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxbg_getstate - * - * Description: - * Initialize the background window state structure. - * - ****************************************************************************/ - -FAR struct nxtext_state_s *nxbg_getstate(void) -{ - FAR const struct nx_font_s *fontset; - - /* Initialize the color (used for redrawing the window) */ - - memset(&g_bgstate, 0, sizeof(struct nxtext_state_s)); - g_bgstate.wcolor[0] = CONFIG_EXAMPLES_NXTEXT_BGCOLOR; - g_bgstate.fcolor[0] = CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR; - - /* Get information about the font set being used and save this in the - * state structure - */ - - fontset = nxf_getfontset(g_bghfont); - g_bgstate.fheight = fontset->mxheight; - g_bgstate.fwidth = fontset->mxwidth; - g_bgstate.spwidth = fontset->spwidth; - - /* Set up the text caches */ - - g_bgstate.maxchars = CONFIG_EXAMPLES_NXTEXT_BMCACHE; - g_bgstate.maxglyphs = CONFIG_EXAMPLES_NXTEXT_GLCACHE; - g_bgstate.bm = g_bgbm; - g_bgstate.glyph = g_bgglyph; - - /* Set the first display position */ - - nxtext_home(&g_bgstate); - return &g_bgstate; -} - -/**************************************************************************** - * Name: nxbg_write - * - * Description: - * Put a sequence of bytes in the window. - * - ****************************************************************************/ - -void nxbg_write(NXWINDOW hwnd, FAR const uint8_t *buffer, size_t buflen) -{ - int lineheight = (g_bgstate.fheight + LINE_SEPARATION); - - while (buflen-- > 0) - { - /* Will another character fit on this line? */ - - if (g_bgstate.fpos.x + g_bgstate.fwidth > g_bgstate.wsize.w) - { - /* No.. move to the next line */ - - nxtext_newline(&g_bgstate); - - /* If we were about to output a newline character, then don't */ - - if (*buffer == '\n') - { - buffer++; - continue; - } - } - - /* Check if we need to scroll up (handling a corner case where - * there may be more than one newline). - */ - - while (g_bgstate.fpos.y >= g_bgstate.wsize.h - lineheight) - { - nxbg_scroll(hwnd, lineheight); - } - - /* Finally, we can output the character */ - - nxtext_putc(hwnd, &g_bgstate, g_bghfont, (uint8_t)*buffer++); - } -} diff --git a/apps/examples/nxtext/nxtext_internal.h b/apps/examples/nxtext/nxtext_internal.h deleted file mode 100644 index f0001e0bb..000000000 --- a/apps/examples/nxtext/nxtext_internal.h +++ /dev/null @@ -1,366 +0,0 @@ -/**************************************************************************** - * examples/nxtext/nxtext_internal.h - * - * 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 - * 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 __EXAMPLES_NXTEXT_NXTEXT_INTERNAL_H -#define __EXAMPLES_NXTEXT_NXTEXT_INTERNAL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <stdbool.h> -#include <semaphore.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxtk.h> -#include <nuttx/nx/nxfonts.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_NX -# error "NX is not enabled (CONFIG_NX)" -#endif - -#ifndef CONFIG_EXAMPLES_NXTEXT_VPLANE -# define CONFIG_EXAMPLES_NXTEXT_VPLANE 0 -#endif - -/* Pixel depth. If none provided, pick the smallest enabled pixel depth */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_BPP -# if !defined(CONFIG_NX_DISABLE_1BPP) -# define CONFIG_EXAMPLES_NXTEXT_BPP 1 -# elif !defined(CONFIG_NX_DISABLE_2BPP) -# define CONFIG_EXAMPLES_NXTEXT_BPP 2 -# elif !defined(CONFIG_NX_DISABLE_4BPP) -# define CONFIG_EXAMPLES_NXTEXT_BPP 4 -# elif !defined(CONFIG_NX_DISABLE_8BPP) -# define CONFIG_EXAMPLES_NXTEXT_BPP 8 -# elif !defined(CONFIG_NX_DISABLE_16BPP) -# define CONFIG_EXAMPLES_NXTEXT_BPP 16 -//#elif !defined(CONFIG_NX_DISABLE_24BPP) -//# define CONFIG_NXCONSOLE_BPP 24 -# elif !defined(CONFIG_NX_DISABLE_32BPP) -# define CONFIG_EXAMPLES_NXTEXT_BPP 32 -# else -# error "No pixel depth provided" -# endif -#endif - -/* Background color */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_BGCOLOR -# if CONFIG_EXAMPLES_NXTEXT_BPP == 24 || CONFIG_EXAMPLES_NXTEXT_BPP == 32 -# define CONFIG_EXAMPLES_NXTEXT_BGCOLOR 0x007b68ee -# elif CONFIG_EXAMPLES_NXTEXT_BPP == 16 -# define CONFIG_EXAMPLES_NXTEXT_BGCOLOR 0x7b5d -# else -# define CONFIG_EXAMPLES_NXTEXT_BGCOLOR ' ' -# endif -#endif - -/* Pop-up font ID */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_PUFONTID -# define CONFIG_EXAMPLES_NXTEXT_PUFONTID NXFONT_DEFAULT -#endif - -/* Pop-up window color */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_PUCOLOR -# if CONFIG_EXAMPLES_NXTEXT_BPP == 24 || CONFIG_EXAMPLES_NXTEXT_BPP == 32 -# define CONFIG_EXAMPLES_NXTEXT_PUCOLOR 0x00dcdcdc -# elif CONFIG_EXAMPLES_NXTEXT_BPP == 16 -# define CONFIG_EXAMPLES_NXTEXT_PUCOLOR 0xdefb -# else -# define CONFIG_EXAMPLES_NXTEXT_PUCOLOR '2' -# endif -#endif - -/* Background font ID */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_BGFONTID -# define CONFIG_EXAMPLES_NXTEXT_BGFONTID NXFONT_DEFAULT -#endif - -/* Background font color */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR -# if CONFIG_EXAMPLES_NXTEXT_BPP == 24 || CONFIG_EXAMPLES_NXTEXT_BPP == 32 -# define CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR 0x00000000 -# elif CONFIG_EXAMPLES_NXTEXT_BPP == 16 -# define CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR 0x0000 -# else -# define CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR 'F' -# endif -#endif - -/* Pop-up font color */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR -# if CONFIG_EXAMPLES_NXTEXT_BPP == 24 || CONFIG_EXAMPLES_NXTEXT_BPP == 32 -# define CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR 0x00000000 -# elif CONFIG_EXAMPLES_NXTEXT_BPP == 16 -# define CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR 0x0000 -# else -# define CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR 'F' -# endif -#endif - -/* Character caching */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_BMCACHE -# define CONFIG_EXAMPLES_NXTEXT_BMCACHE 128 -#endif - -/* Font glyph caching */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_GLCACHE -# define CONFIG_EXAMPLES_NXTEXT_GLCACHE 16 -#endif - -/* NX muli-user mode */ - -#ifdef CONFIG_NX_MULTIUSER -# ifdef CONFIG_DISABLE_MQUEUE -# error "The multi-threaded example requires MQ support (CONFIG_DISABLE_MQUEUE=n)" -# endif -# ifdef CONFIG_DISABLE_SIGNALS -# error "This example requires signal support (CONFIG_DISABLE_SIGNALS=n)" -# endif -# ifdef CONFIG_DISABLE_PTHREAD -# error "This example requires pthread support (CONFIG_DISABLE_PTHREAD=n)" -# endif -# ifndef CONFIG_NX_BLOCKING -# error "This example depends on CONFIG_NX_BLOCKING" -# endif -# ifndef CONFIG_EXAMPLES_NXTEXT_STACKSIZE -# define CONFIG_EXAMPLES_NXTEXT_STACKSIZE 2048 -# endif -# ifndef CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO -# define CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO 100 -# endif -# ifndef CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO -# define CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO 100 -# endif -# ifndef CONFIG_EXAMPLES_NXTEXT_SERVERPRIO -# define CONFIG_EXAMPLES_NXTEXT_SERVERPRIO 120 -# endif -# ifndef CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO -# define CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO 4 -# endif -#endif - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# define msgflush() -# else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define msgflush() -# else -# define message printf -# define msgflush() fflush(stdout) -# endif -#endif - -/* Bitmap flags */ - -#define BMFLAGS_NOGLYPH (1 << 0) /* No glyph available, use space */ - -#define BM_ISSPACE(bm) (((bm)->flags & BMFLAGS_NOGLYPH) != 0) - -/* Sizes and maximums */ - -#define MAX_USECNT 255 /* Limit to range of a uint8_t */ -#define LINE_SEPARATION 2 /* Space (in rows) between lines */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -enum exitcode_e -{ - NXEXIT_SUCCESS = 0, - NXEXIT_SCHEDSETPARAM, - NXEXIT_TASKCREATE, - NXEXIT_PTHREADCREATE, - NXEXIT_EXTINITIALIZE, - NXEXIT_FBINITIALIZE, - NXEXIT_FBGETVPLANE, - NXEXIT_LCDINITIALIZE, - NXEXIT_LCDGETDEV, - NXEXIT_NXOPEN, - NXEXIT_FONTOPEN, - NXEXIT_NXREQUESTBKGD, - NXEXIT_NXCONNECT, - NXEXIT_NXSETBGCOLOR, - NXEXIT_NXOPENWINDOW, - NXEXIT_NXSETSIZE, - NXEXIT_NXSETPOSITION, - NXEXIT_NXCLOSEWINDOW, - NXEXIT_LOSTSERVERCONN -}; - -/* Describes one cached glyph bitmap */ - -struct nxtext_glyph_s -{ - uint8_t code; /* Character code */ - uint8_t height; /* Height of this glyph (in rows) */ - uint8_t width; /* Width of this glyph (in pixels) */ - uint8_t stride; /* Width of the glyph row (in bytes) */ - uint8_t usecnt; /* Use count */ - FAR uint8_t *bitmap; /* Allocated bitmap memory */ -}; - -/* Describes on character on the display */ - -struct nxtext_bitmap_s -{ - uint8_t code; /* Character code */ - uint8_t flags; /* See BMFLAGS_* */ - struct nxgl_point_s pos; /* Character position */ -}; - -/* Describes the state of one text display */ - -struct nxtext_state_s -{ - /* The following describe the window */ - - nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]; /* Window color */ - struct nxgl_size_s wsize; /* Window size */ - struct nxgl_point_s wpos; /* Window position */ - - /* These characterize the font in use */ - - nxgl_mxpixel_t fcolor[CONFIG_NX_NPLANES]; /* Font color */ - uint8_t fheight; /* Max height of a font in pixels */ - uint8_t fwidth; /* Max width of a font in pixels */ - uint8_t spwidth; /* The width of a space */ - struct nxgl_point_s fpos; /* Next display position */ - - /* These describe all text already added to the display */ - - uint8_t maxglyphs; /* Size of the glyph[] array */ - uint16_t maxchars; /* Size of the bm[] array */ - uint16_t nchars; /* Number of chars in the bm[] array */ - - FAR struct nxtext_bitmap_s *bm; /* List of characters on the display */ - FAR struct nxtext_glyph_s *glyph; /* Cache of rendered fonts in use */ -}; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/* The connecton handler */ - -extern NXHANDLE g_hnx; - -/* Background window handle */ - -extern NXHANDLE g_bgwnd; - -/* The font handlse */ - -extern NXHANDLE g_bghfont; -extern NXHANDLE g_puhfont; - -/* NX callback vtables */ - -extern const struct nx_callback_s g_nxtextcb; - -/* The screen resolution */ - -extern nxgl_coord_t g_xres; -extern nxgl_coord_t g_yres; - -extern bool b_haveresolution; -#ifdef CONFIG_NX_MULTIUSER -extern bool g_connected; -#endif -extern sem_t g_semevent; - -extern int g_exitcode; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_NXTEXT_EXTERNINIT -extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno); -#endif -#if defined(CONFIG_NX) && defined(CONFIG_NX_MULTIUSER) -extern int nxtext_server(int argc, char *argv[]); -extern FAR void *nxtext_listener(FAR void *arg); -#endif - -/* Background window interfaces */ - -extern FAR struct nxtext_state_s *nxbg_getstate(void); -extern void nxbg_write(NXWINDOW hwnd, FAR const uint8_t *buffer, size_t buflen); - -/* Pop-up window interfaces */ - -extern NXWINDOW nxpu_open(void); -extern int nxpu_close(NXWINDOW hwnd); - -/* Generic text helpers */ - -extern void nxtext_home(FAR struct nxtext_state_s *st); -extern void nxtext_newline(FAR struct nxtext_state_s *st); -extern void nxtext_putc(NXWINDOW hwnd, FAR struct nxtext_state_s *st, - NXHANDLE hfont, uint8_t ch); -extern void nxtext_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - FAR struct nxtext_state_s *st, NXHANDLE hfont, - FAR const struct nxtext_bitmap_s *bm); - -#endif /* __EXAMPLES_NXTEXT_NXTEXT_INTERNAL_H */ diff --git a/apps/examples/nxtext/nxtext_main.c b/apps/examples/nxtext/nxtext_main.c deleted file mode 100644 index 2a1b50355..000000000 --- a/apps/examples/nxtext/nxtext_main.c +++ /dev/null @@ -1,502 +0,0 @@ -/**************************************************************************** - * examples/nxtext/nxtext_main.c - * - * 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 - * 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 <stdint.h> -#include <stdbool.h> -#include <stdio.h> -#include <unistd.h> -#include <time.h> -#include <string.h> -#include <sched.h> -#include <pthread.h> -#include <errno.h> -#include <debug.h> - -#ifdef CONFIG_NX_LCDDRIVER -# include <nuttx/lcd/lcd.h> -#else -# include <nuttx/fb.h> -#endif - -#include <nuttx/arch.h> -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxglib.h> -#include <nuttx/nx/nxfonts.h> - -#include "nxtext_internal.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ -/* If not specified, assume that the hardware supports one video plane */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_VPLANE -# define CONFIG_EXAMPLES_NXTEXT_VPLANE 0 -#endif - -/* If not specified, assume that the hardware supports one LCD device */ - -#ifndef CONFIG_EXAMPLES_NXTEXT_DEVNO -# define CONFIG_EXAMPLES_NXTEXT_DEVNO 0 -#endif - -#define BGMSG_LINES 24 - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const uint8_t g_pumsg[] = "Pop-Up!"; -static const char *g_bgmsg[BGMSG_LINES] = -{ - "\nJULIET\n", /* Line 1 */ - "Wilt thou be gone?\n", /* Line 2 */ - " It is not yet near day:\n", /* Line 3 */ - "It was the nightingale,\n", /* Line 4 */ - " and not the lark,\n", /* Line 5 */ - "That pierced the fearful hollow\n", /* Line 6 */ - " of thine ear;\n", /* Line 7 */ - "Nightly she sings\n", /* Line 8 */ - " on yon pomegranate-tree:\n", /* Line 9 */ - "Believe me, love,\n", /* Line 10 */ - " it was the nightingale.\n", /* Line 11 */ - "\nROMEO\n", /* Line 12 */ - "It was the lark,\n", /* Line 13 */ - " the herald of the morn,\n", /* Line 14 */ - "No nightingale:\n", /* Line 15 */ - " look, love, what envious streaks\n", /* Line 16 */ - "Do lace the severing clouds\n", /* Line 17 */ - " in yonder east:\n", /* Line 18 */ - "Night's candles are burnt out,\n", /* Line 19 */ - " and jocund day\n", /* Line 20 */ - "Stands tiptoe\n", /* Line 21 */ - " on the misty mountain tops.\n", /* Line 22 */ - "I must be gone and live,\n", /* Line 23 */ - " or stay and die.\n" /* Line 24 */ -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* The connecton handler */ - -NXHANDLE g_hnx = NULL; - -/* The font handles */ - -NXHANDLE g_bghfont = NULL; -NXHANDLE g_puhfont = NULL; - -/* The screen resolution */ - -nxgl_coord_t g_xres; -nxgl_coord_t g_yres; - -bool b_haveresolution = false; -#ifdef CONFIG_NX_MULTIUSER -bool g_connected = false; -#endif -sem_t g_semevent = {0}; - -int g_exitcode = NXEXIT_SUCCESS; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxtext_suinitialize - ****************************************************************************/ - -#ifndef CONFIG_NX_MULTIUSER -static inline int nxtext_suinitialize(void) -{ - FAR NX_DRIVERTYPE *dev; - -#if defined(CONFIG_EXAMPLES_NXTEXT_EXTERNINIT) - /* Use external graphics driver initialization */ - - message("nxtext_initialize: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXTEXT_DEVNO); - if (!dev) - { - message("nxtext_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NXTEXT_DEVNO); - g_exitcode = NXEXIT_EXTINITIALIZE; - return ERROR; - } - -#elif defined(CONFIG_NX_LCDDRIVER) - int ret; - - /* Initialize the LCD device */ - - message("nxtext_initialize: Initializing LCD\n"); - ret = up_lcdinitialize(); - if (ret < 0) - { - message("nxtext_initialize: up_lcdinitialize failed: %d\n", -ret); - g_exitcode = NXEXIT_LCDINITIALIZE; - return ERROR; - } - - /* Get the device instance */ - - dev = up_lcdgetdev(CONFIG_EXAMPLES_NXTEXT_DEVNO); - if (!dev) - { - message("nxtext_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXTEXT_DEVNO); - g_exitcode = NXEXIT_LCDGETDEV; - return ERROR; - } - - /* Turn the LCD on at 75% power */ - - (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); -#else - int ret; - - /* Initialize the frame buffer device */ - - message("nxtext_initialize: Initializing framebuffer\n"); - ret = up_fbinitialize(); - if (ret < 0) - { - message("nxtext_initialize: up_fbinitialize failed: %d\n", -ret); - g_exitcode = NXEXIT_FBINITIALIZE; - return ERROR; - } - - dev = up_fbgetvplane(CONFIG_EXAMPLES_NXTEXT_VPLANE); - if (!dev) - { - message("nxtext_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXTEXT_VPLANE); - g_exitcode = NXEXIT_FBGETVPLANE; - return ERROR; - } -#endif - - /* Then open NX */ - - message("nxtext_initialize: Open NX\n"); - g_hnx = nx_open(dev); - if (!g_hnx) - { - message("nxtext_initialize: nx_open failed: %d\n", errno); - g_exitcode = NXEXIT_NXOPEN; - return ERROR; - } - return OK; -} -#endif - -/**************************************************************************** - * Name: nxtext_initialize - ****************************************************************************/ - -#ifdef CONFIG_NX_MULTIUSER -static inline int nxtext_muinitialize(void) -{ - struct sched_param param; - pthread_t thread; - pid_t servrid; - int ret; - - /* Set the client task priority */ - - param.sched_priority = CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO; - ret = sched_setparam(0, ¶m); - if (ret < 0) - { - message("nxtext_initialize: sched_setparam failed: %d\n" , ret); - g_exitcode = NXEXIT_SCHEDSETPARAM; - return ERROR; - } - - /* Start the server task */ - - message("nxtext_initialize: Starting nxtext_server task\n"); - servrid = task_create("NX Server", CONFIG_EXAMPLES_NXTEXT_SERVERPRIO, - CONFIG_EXAMPLES_NXTEXT_STACKSIZE, nxtext_server, NULL); - if (servrid < 0) - { - message("nxtext_initialize: Failed to create nxtext_server task: %d\n", errno); - g_exitcode = NXEXIT_TASKCREATE; - return ERROR; - } - - /* Wait a bit to let the server get started */ - - sleep(1); - - /* Connect to the server */ - - g_hnx = nx_connect(); - if (g_hnx) - { - pthread_attr_t attr; - - /* Start a separate thread to listen for server events. This is probably - * the least efficient way to do this, but it makes this example flow more - * smoothly. - */ - - (void)pthread_attr_init(&attr); - param.sched_priority = CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO; - (void)pthread_attr_setschedparam(&attr, ¶m); - (void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NXTEXT_STACKSIZE); - - ret = pthread_create(&thread, &attr, nxtext_listener, NULL); - if (ret != 0) - { - printf("nxtext_initialize: pthread_create failed: %d\n", ret); - g_exitcode = NXEXIT_PTHREADCREATE; - return ERROR; - } - - /* Don't return until we are connected to the server */ - - while (!g_connected) - { - /* Wait for the listener thread to wake us up when we really - * are connected. - */ - - (void)sem_wait(&g_semevent); - } - } - else - { - message("nxtext_initialize: nx_connect failed: %d\n", errno); - g_exitcode = NXEXIT_NXCONNECT; - return ERROR; - } - return OK; -} -#endif - -/**************************************************************************** - * Name: nxtext_initialize - ****************************************************************************/ - -static int nxtext_initialize(void) -{ -#ifdef CONFIG_NX_MULTIUSER - return nxtext_muinitialize(); -#else - return nxtext_suinitialize(); -#endif -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxtext_main - ****************************************************************************/ - -int nxtext_main(int argc, char **argv) -{ - FAR struct nxtext_state_s *bgstate; - NXWINDOW hwnd = NULL; - nxgl_mxpixel_t color; - int popcnt; - int bkgndx; - int ret; - - /* Initialize NX */ - - ret = nxtext_initialize(); - message("nxtext_main: NX handle=%p\n", g_hnx); - if (!g_hnx || ret < 0) - { - message("nxtext_main: Failed to get NX handle: %d\n", errno); - g_exitcode = NXEXIT_NXOPEN; - goto errout; - } - - /* Get the configured font handles */ - - g_bghfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXTEXT_BGFONTID); - if (!g_bghfont) - { - message("nxtext_main: Failed to get background font handle: %d\n", errno); - g_exitcode = NXEXIT_FONTOPEN; - goto errout; - } - - g_puhfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXTEXT_PUFONTID); - if (!g_puhfont) - { - message("nxtext_main: Failed to get pop-up font handle: %d\n", errno); - g_exitcode = NXEXIT_FONTOPEN; - goto errout; - } - - /* Set the background to the configured background color */ - - message("nxtext_main: Set background color=%d\n", CONFIG_EXAMPLES_NXTEXT_BGCOLOR); - color = CONFIG_EXAMPLES_NXTEXT_BGCOLOR; - ret = nx_setbgcolor(g_hnx, &color); - if (ret < 0) - { - message("nxtext_main: nx_setbgcolor failed: %d\n", errno); - g_exitcode = NXEXIT_NXSETBGCOLOR; - goto errout_with_nx; - } - - /* Get the background window */ - - bgstate = nxbg_getstate(); - ret = nx_requestbkgd(g_hnx, &g_nxtextcb, bgstate); - if (ret < 0) - { - message("nxtext_main: nx_setbgcolor failed: %d\n", errno); - g_exitcode = NXEXIT_NXREQUESTBKGD; - goto errout_with_nx; - } - - /* Wait until we have the screen resolution. We'll have this immediately - * unless we are dealing with the NX server. - */ - - while (!b_haveresolution) - { - (void)sem_wait(&g_semevent); - } - message("nxtext_main: Screen resolution (%d,%d)\n", g_xres, g_yres); - - /* Now loop, adding text to the background and periodically presenting - * a pop-up window. - */ - - popcnt = 0; - bkgndx = 0; - for (;;) - { - /* Sleep for one second */ - - sleep(1); - popcnt++; - - /* Each three seconds, create a pop-up window. Destroy the pop-up - * window after two more seconds. - */ - - if (popcnt == 3) - { - /* Create a pop-up window */ - - hwnd = nxpu_open(); - - /* Give keyboard input to the top window (which should be the pop-up) */ - -#ifdef CONFIG_NX_KBD - message("nxtext_main: Send keyboard input: %s\n", g_pumsg); - ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_pumsg), g_pumsg); - if (ret < 0) - { - message("nxtext_main: nx_kbdin failed: %d\n", errno); - goto errout_with_hwnd; - } -#endif - } - else if (popcnt == 5) - { - /* Destroy the pop-up window and restart the sequence */ - - message("nxtext_main: Close pop-up\n"); - (void)nxpu_close(hwnd); - popcnt = 0; - } - - /* Give another line of text to the background window. Force this - * text to go the background by calling the background window interfaces - * directly. - */ - - nxbg_write(g_bgwnd, (FAR const uint8_t *)g_bgmsg[bkgndx], strlen(g_bgmsg[bkgndx])); - if (++bkgndx >= BGMSG_LINES) - { - bkgndx = 0; - } - } - - /* Close the pop-up window */ - -errout_with_hwnd: - if (popcnt >= 3) - { - message("nxtext_main: Close pop-up\n"); - (void)nxpu_close(hwnd); - } - -//errout_with_bkgd: - (void)nx_releasebkgd(g_bgwnd); - -errout_with_nx: -#ifdef CONFIG_NX_MULTIUSER - /* Disconnect from the server */ - - message("nxtext_main: Disconnect from the server\n"); - nx_disconnect(g_hnx); -#else - /* Close the server */ - - message("nxtext_main: Close NX\n"); - nx_close(g_hnx); -#endif -errout: - return g_exitcode; -} diff --git a/apps/examples/nxtext/nxtext_popup.c b/apps/examples/nxtext/nxtext_popup.c deleted file mode 100644 index 4faaf3a35..000000000 --- a/apps/examples/nxtext/nxtext_popup.c +++ /dev/null @@ -1,408 +0,0 @@ -/**************************************************************************** - * examples/nxtext/nxtext_popup.c - * - * 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 - * 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 <stdbool.h> -#include <stdio.h> -#include <string.h> -#include <semaphore.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxfonts.h> - -#include "nxtext_internal.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#define NBM_CACHE 8 -#define NGLYPH_CACHE 8 - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static void nxpu_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool morem, FAR void *arg); -static void nxpu_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg); -#ifdef CONFIG_NX_MOUSE -static void nxpu_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg); -#endif - -#ifdef CONFIG_NX_KBD -static void nxpu_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg); -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/* Pop-up NX callbacks */ - -static const struct nx_callback_s g_pucb = -{ - nxpu_redraw, /* redraw */ - nxpu_position /* position */ -#ifdef CONFIG_NX_MOUSE - , nxpu_mousein /* mousein */ -#endif -#ifdef CONFIG_NX_KBD - , nxpu_kbdin /* my kbdin */ -#endif -}; - -/* Pop-up state information */ - -static struct nxtext_state_s g_pustate; -#ifdef CONFIG_NX_KBD -static struct nxtext_bitmap_s g_pubm[NBM_CACHE]; -static struct nxtext_glyph_s g_puglyph[NGLYPH_CACHE]; -#endif - -/* Some random numbers */ - -static const uint8_t g_rand8[9] = -{ - 0x18, 0x8d, 0x60, 0x42, 0xb7, 0xc2, 0x2d, 0xea, 0x6b -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxpu_randpos - ****************************************************************************/ - -static fb_coord_t nxpu_randpos(fb_coord_t value) -{ - static uint8_t ndx = 0; - uint8_t rand8 = g_rand8[ndx]; - - if (++ndx >= 9) - { - ndx = 0; - } - - return (fb_coord_t)(((uint32_t)value * (uint32_t)rand8) >> 8); -} - -/**************************************************************************** - * Name: nxpu_setsize - ****************************************************************************/ - -static inline int nxpu_setsize(NXWINDOW hwnd, FAR struct nxgl_size_s *size) -{ - int ret = nx_setsize(hwnd, size); - if (ret < 0) - { - message("nxpu_setsize: nx_setsize failed: %d\n", errno); - g_exitcode = NXEXIT_NXSETSIZE; - } - return ret; -} - -/**************************************************************************** - * Name: nxpu_setposition - ****************************************************************************/ - -static inline int nxpu_setposition(NXWINDOW hwnd, FAR struct nxgl_point_s *pos) -{ - int ret = nx_setposition(hwnd, pos); - if (ret < 0) - { - message("nxpu_setposition: nx_setposition failed: %d\n", errno); - g_exitcode = NXEXIT_NXSETPOSITION; - } - return ret; -} - -/**************************************************************************** - * Name: nxpu_fillwindow - ****************************************************************************/ - -static inline void nxpu_fillwindow(NXWINDOW hwnd, - FAR const struct nxgl_rect_s *rect, - FAR struct nxtext_state_s *st) -{ - int ret; - int i; - - ret = nx_fill(hwnd, rect, st->wcolor); - if (ret < 0) - { - message("nxpu_fillwindow: nx_fill failed: %d\n", errno); - } - - /* Fill each character on the display (Only the characters within rect - * will actually be redrawn). - */ - -#ifdef CONFIG_NX_KBD - nxtext_home(st); - for (i = 0; i < st->nchars; i++) - { - nxtext_fillchar(hwnd, rect, st, g_puhfont, &st->bm[i]); - } -#endif -} - -/**************************************************************************** - * Name: nxpu_redraw - ****************************************************************************/ - -static void nxpu_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - bool more, FAR void *arg) -{ - FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg; - gvdbg("hwnd=%p rect={(%d,%d),(%d,%d)} more=%s\n", - hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y, - more ? "true" : "false"); - - nxpu_fillwindow(hwnd, rect, st); -} - -/**************************************************************************** - * Name: nxpu_position - ****************************************************************************/ - -static void nxpu_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size, - FAR const struct nxgl_point_s *pos, - FAR const struct nxgl_rect_s *bounds, - FAR void *arg) -{ - FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg; - - /* Report the position */ - - gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n", - hwnd, size->w, size->h, pos->x, pos->y, - bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y); - - /* Save the window position and size */ - - st->wpos.x = pos->x; - st->wpos.y = pos->y; - - st->wsize.w = size->w; - st->wsize.h = size->h; -} - -/**************************************************************************** - * Name: nxpu_mousein - ****************************************************************************/ - -#ifdef CONFIG_NX_MOUSE -static void nxpu_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos, - uint8_t buttons, FAR void *arg) -{ - message("nxpu_mousein: hwnd=%p pos=(%d,%d) button=%02x\n", - hwnd, pos->x, pos->y, buttons); -} -#endif - -/**************************************************************************** - * Name: nxpu_puts - ****************************************************************************/ - -static inline void nxpu_puts(NXWINDOW hwnd, FAR struct nxtext_state_s *st, - uint8_t nch, FAR const uint8_t *ch) -{ - nxtext_home(st); - while (nch--) - { - nxtext_putc(hwnd, st, g_puhfont, *ch++); - } -} - -/**************************************************************************** - * Name: nxpu_kbdin - ****************************************************************************/ - -#ifdef CONFIG_NX_KBD -static void nxpu_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch, - FAR void *arg) -{ - FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg; - gvdbg("hwnd=%p nch=%d\n", hwnd, nch); - nxpu_puts(hwnd, st, nch, ch); -} -#endif - -/**************************************************************************** - * Name: nxpu_initstate - ****************************************************************************/ - -static inline void nxpu_initstate(void) -{ -#ifdef CONFIG_NX_KBD - FAR const struct nx_font_s *fontset; -#endif - - /* Initialize the color (used for redrawing the window) */ - - memset(&g_pustate, 0, sizeof(struct nxtext_state_s)); - g_pustate.wcolor[0] = CONFIG_EXAMPLES_NXTEXT_PUCOLOR; - g_pustate.fcolor[0] = CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR; - - /* Get information about the font set being used and save this in the - * state structure - */ - -#ifdef CONFIG_NX_KBD - fontset = nxf_getfontset(g_puhfont); - g_pustate.fheight = fontset->mxheight; - g_pustate.fwidth = fontset->mxwidth; - g_pustate.spwidth = fontset->spwidth; - - /* Set up the text caches */ - - g_pustate.maxchars = NBM_CACHE; - g_pustate.maxglyphs = NGLYPH_CACHE; - g_pustate.bm = g_pubm; - g_pustate.glyph = g_puglyph; - - /* Set the first display position */ - - nxtext_home(&g_pustate); -#endif -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxpu_open - ****************************************************************************/ - -NXWINDOW nxpu_open(void) -{ - NXWINDOW hwnd; - struct nxgl_size_s size; - struct nxgl_point_s pt; - int ret; - - /* Create a pop-up window */ - - message("nxpu_open: Create pop-up\n"); - nxpu_initstate(); - - hwnd = nx_openwindow(g_hnx, &g_pucb, (FAR void *)&g_pustate); - gvdbg("hwnd=%p\n", hwnd); - - if (!hwnd) - { - message("nxpu_open: nx_openwindow failed: %d\n", errno); - g_exitcode = NXEXIT_NXOPENWINDOW; - goto errout_with_state; - } - - /* Select the size of the pop-up window */ - - size.w = g_xres / 4; - size.h = g_yres / 4; - - /* Select a random position for pop-up window */ - - pt.x = nxpu_randpos(g_xres - size.w); - pt.y = nxpu_randpos(g_yres - size.h); - - /* Set the position for the pop-up window */ - - message("nxpu_open: Set pop-up postion to (%d,%d)\n", pt.x, pt.y); - ret = nxpu_setposition(hwnd, &pt); - if (ret < 0) - { - goto errout_with_hwnd; - } - - /* Set the size of the pop-up window */ - - gvdbg("Set pop-up size to (%d,%d)\n", size.w, size.h); - ret = nxpu_setsize(hwnd, &size); - if (ret < 0) - { - goto errout_with_hwnd; - } - - return hwnd; - -errout_with_hwnd: - (void)nx_closewindow(hwnd); - -errout_with_state: - return NULL; -} - -/**************************************************************************** - * Name: nxpu_close - ****************************************************************************/ - -int nxpu_close(NXWINDOW hwnd) -{ - int ret; - - ret = nx_closewindow(hwnd); - if (ret < 0) - { - message("nxpu_close: nx_closewindow failed: %d\n", errno); - g_exitcode = NXEXIT_NXCLOSEWINDOW; - return ret; - } - return OK; -} diff --git a/apps/examples/nxtext/nxtext_putc.c b/apps/examples/nxtext/nxtext_putc.c deleted file mode 100644 index 13a441115..000000000 --- a/apps/examples/nxtext/nxtext_putc.c +++ /dev/null @@ -1,598 +0,0 @@ -/**************************************************************************** - * examples/nxtext/nxtext_putc.c - * - * 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 - * 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 <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <ctype.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/nx/nx.h> -#include <nuttx/nx/nxtk.h> -#include <nuttx/nx/nxfonts.h> - -#include "nxtext_internal.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Select renderer -- Some additional logic would be required to support - * pixel depths that are not directly addressable (1,2,4, and 24). - */ - -#if CONFIG_EXAMPLES_NXTEXT_BPP == 1 -# define RENDERER nxf_convert_1bpp -#elif CONFIG_EXAMPLES_NXTEXT_BPP == 2 -# define RENDERER nxf_convert_2bpp -#elif CONFIG_EXAMPLES_NXTEXT_BPP == 4 -# define RENDERER nxf_convert_4bpp -#elif CONFIG_EXAMPLES_NXTEXT_BPP == 8 -# define RENDERER nxf_convert_8bpp -#elif CONFIG_EXAMPLES_NXTEXT_BPP == 16 -# define RENDERER nxf_convert_16bpp -#elif CONFIG_EXAMPLES_NXTEXT_BPP == 24 -# define RENDERER nxf_convert_24bpp -#elif CONFIG_EXAMPLES_NXTEXT_BPP == 32 -# define RENDERER nxf_convert_32bpp -#else -# error "Unsupported CONFIG_EXAMPLES_NXTEXT_BPP" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxtext_freeglyph - ****************************************************************************/ - -static void nxtext_freeglyph(FAR struct nxtext_glyph_s *glyph) -{ - if (glyph->bitmap) - { - free(glyph->bitmap); - } - memset(glyph, 0, sizeof(struct nxtext_glyph_s)); -} - -/**************************************************************************** - * Name: nxtext_allocglyph - ****************************************************************************/ - -static inline FAR struct nxtext_glyph_s * -nxtext_allocglyph(FAR struct nxtext_state_s *st) -{ - FAR struct nxtext_glyph_s *glyph = NULL; - FAR struct nxtext_glyph_s *luglyph = NULL; - uint8_t luusecnt; - int i; - - /* Search through the glyph cache looking for an unused glyph. Also, keep - * track of the least used glyph as well. We need that if we have to replace - * a glyph in the cache. - */ - - for (i = 0; i < st->maxglyphs; i++) - { - /* Is this glyph in use? */ - - glyph = &st->glyph[i]; - if (!glyph->usecnt) - { - /* No.. return this glyph with a use count of one */ - - glyph->usecnt = 1; - return glyph; - } - - /* Yes.. check for the least recently used */ - - if (!luglyph || glyph->usecnt < luglyph->usecnt) - { - luglyph = glyph; - } - } - - /* If we get here, the glyph cache is full. We replace the least used - * glyph with the one we need now. (luglyph can't be NULL). - */ - - luusecnt = luglyph->usecnt; - nxtext_freeglyph(luglyph); - - /* But lets decrement all of the usecnts so that the new one one be so - * far behind in the counts as the older ones. - */ - - if (luusecnt > 1) - { - uint8_t decr = luusecnt - 1; - - for (i = 0; i < st->maxglyphs; i++) - { - /* Is this glyph in use? */ - - glyph = &st->glyph[i]; - if (glyph->usecnt > decr) - { - glyph->usecnt -= decr; - } - } - } - - /* Then return the least used glyph */ - - luglyph->usecnt = 1; - return luglyph; -} - -/**************************************************************************** - * Name: nxtext_findglyph - ****************************************************************************/ - -static FAR struct nxtext_glyph_s * -nxtext_findglyph(FAR struct nxtext_state_s *st, uint8_t ch) -{ - int i; - - /* First, try to find the glyph in the cache of pre-rendered glyphs */ - - for (i = 0; i < st->maxglyphs; i++) - { - FAR struct nxtext_glyph_s *glyph = &st->glyph[i]; - if (glyph->usecnt > 0 && glyph->code == ch) - { - /* Increment the use count (unless it is already at the max) */ - - if (glyph->usecnt < MAX_USECNT) - { - glyph->usecnt++; - } - - /* And return the glyph that we found */ - - return glyph; - } - } - return NULL; -} - -/**************************************************************************** - * Name: nxtext_renderglyph - ****************************************************************************/ - -static inline FAR struct nxtext_glyph_s * -nxtext_renderglyph(FAR struct nxtext_state_s *st, - FAR const struct nx_fontbitmap_s *fbm, uint8_t ch) -{ - FAR struct nxtext_glyph_s *glyph = NULL; - FAR nxgl_mxpixel_t *ptr; -#if CONFIG_EXAMPLES_NXTEXT_BPP < 8 - nxgl_mxpixel_t pixel; -#endif - int bmsize; - int row; - int col; - int ret; - - /* Make sure that there is room for another glyph */ - - gvdbg("ch=%c [%02x]\n", isprint(ch) ? ch : '.', ch); - - /* Allocate the glyph (always succeeds) */ - - glyph = nxtext_allocglyph(st); - glyph->code = ch; - - /* Get the dimensions of the glyph */ - - glyph->width = fbm->metric.width + fbm->metric.xoffset; - glyph->height = fbm->metric.height + fbm->metric.yoffset; - - /* Allocate memory to hold the glyph with its offsets */ - - glyph->stride = (glyph->width * CONFIG_EXAMPLES_NXTEXT_BPP + 7) / 8; - bmsize = glyph->stride * glyph->height; - glyph->bitmap = (FAR uint8_t *)malloc(bmsize); - - if (glyph->bitmap) - { - /* Initialize the glyph memory to the background color */ - -#if CONFIG_EXAMPLES_NXTEXT_BPP < 8 - pixel = st->wcolor[0]; -# if CONFIG_EXAMPLES_NXTEXT_BPP == 1 - /* Pack 1-bit pixels into a 2-bits */ - - pixel &= 0x01; - pixel = (pixel) << 1 |pixel; -# endif -# if CONFIG_EXAMPLES_NXTEXT_BPP < 4 - /* Pack 2-bit pixels into a nibble */ - - pixel &= 0x03; - pixel = (pixel) << 2 |pixel; -# endif - - /* Pack 4-bit nibbles into a byte */ - - pixel &= 0x0f; - pixel = (pixel) << 4 | pixel; - - ptr = (FAR nxgl_mxpixel_t *)glyph->bitmap; - for (row = 0; row < glyph->height; row++) - { - for (col = 0; col < glyph->stride; col++) - { - /* Transfer the packed bytes into the buffer */ - - *ptr++ = pixel; - } - } - -#elif CONFIG_EXAMPLES_NXTEXT_BPP == 24 -# error "Additional logic is needed here for 24bpp support" - -#else /* CONFIG_EXAMPLES_NXTEXT_BPP = {8,16,32} */ - - ptr = (FAR nxgl_mxpixel_t *)glyph->bitmap; - for (row = 0; row < glyph->height; row++) - { - /* Just copy the color value into the glyph memory */ - - for (col = 0; col < glyph->width; col++) - { - *ptr++ = st->wcolor[0]; - } - } -#endif - - /* Then render the glyph into the allocated memory */ - - ret = RENDERER((FAR nxgl_mxpixel_t*)glyph->bitmap, - glyph->height, glyph->width, glyph->stride, - fbm, st->fcolor[0]); - if (ret < 0) - { - /* Actually, the RENDERER never returns a failure */ - - message("nxtext_renderglyph: RENDERER failed\n"); - nxtext_freeglyph(glyph); - glyph = NULL; - } - } - - return glyph; -} - -/**************************************************************************** - * Name: nxtext_fontsize - ****************************************************************************/ - -static int nxtext_fontsize(NXHANDLE hfont, uint8_t ch, FAR struct nxgl_size_s *size) -{ - FAR const struct nx_fontbitmap_s *fbm; - - /* No, it is not cached... Does the code map to a font? */ - - fbm = nxf_getbitmap(hfont, ch); - if (fbm) - { - /* Yes.. return the font size */ - - size->w = fbm->metric.width + fbm->metric.xoffset; - size->h = fbm->metric.height + fbm->metric.yoffset; - return OK; - } - - return ERROR; -} - -/**************************************************************************** - * Name: nxtext_getglyph - ****************************************************************************/ - -static FAR struct nxtext_glyph_s * -nxtext_getglyph(NXHANDLE hfont, FAR struct nxtext_state_s *st, uint8_t ch) -{ - FAR struct nxtext_glyph_s *glyph; - FAR const struct nx_fontbitmap_s *fbm; - - /* First, try to find the glyph in the cache of pre-rendered glyphs */ - - glyph = nxtext_findglyph(st, ch); - if (!glyph) - { - /* No, it is not cached... Does the code map to a font? */ - - fbm = nxf_getbitmap(hfont, ch); - if (fbm) - { - /* Yes.. render the glyph */ - - glyph = nxtext_renderglyph(st, fbm, ch); - } - } - - return glyph; -} - -/**************************************************************************** - * Name: nxtext_addchar - * - * Description: - * This is part of the nxtext_putc logic. It creates and positions a - * the character and renders (or re-uses) a glyph for font. - * - ****************************************************************************/ - -static FAR const struct nxtext_bitmap_s * -nxtext_addchar(NXHANDLE hfont, FAR struct nxtext_state_s *st, uint8_t ch) -{ - FAR struct nxtext_bitmap_s *bm = NULL; - FAR struct nxtext_glyph_s *glyph; - - /* Is there space for another character on the display? */ - - if (st->nchars < st->maxchars) - { - /* Yes, setup the bitmap information */ - - bm = &st->bm[st->nchars]; - bm->code = ch; - bm->flags = 0; - bm->pos.x = st->fpos.x; - bm->pos.y = st->fpos.y; - - /* Find (or create) the matching glyph */ - - glyph = nxtext_getglyph(hfont, st, ch); - if (!glyph) - { - /* No, there is no font for this code. Just mark this as a space. */ - - bm->flags |= BMFLAGS_NOGLYPH; - - /* Set up the next character position */ - - st->fpos.x += st->spwidth; - } - else - { - /* Set up the next character position */ - - st->fpos.x += glyph->width; - } - - /* Success.. increment nchars to retain this character */ - - st->nchars++; - } - - return bm; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxtext_home - * - * Description: - * Set the next character position to the top-left corner of the display. - * - ****************************************************************************/ - -void nxtext_home(FAR struct nxtext_state_s *st) -{ - /* The first character is one space from the left */ - - st->fpos.x = st->spwidth; - - /* And LINE_SEPARATION lines from the top */ - - st->fpos.y = LINE_SEPARATION; -} - -/**************************************************************************** - * Name: nxtext_newline - * - * Description: - * Set the next character position to the beginning of the next line. - * - ****************************************************************************/ - -void nxtext_newline(FAR struct nxtext_state_s *st) -{ - /* Carriage return: The first character is one space from the left */ - - st->fpos.x = st->spwidth; - - /* Linefeed: Down the max font height + LINE_SEPARATION */ - - st->fpos.y += (st->fheight + LINE_SEPARATION); -} - -/**************************************************************************** - * Name: nxtext_putc - * - * Description: - * Render the specified character at the current display position. - * - ****************************************************************************/ - -void nxtext_putc(NXWINDOW hwnd, FAR struct nxtext_state_s *st, NXHANDLE hfont, uint8_t ch) -{ - FAR const struct nxtext_bitmap_s *bm; - - /* If it is a newline character, then just perform the logical newline - * operation. - */ - - if (ch == '\n') - { - nxtext_newline(st); - } - - /* Otherwise, find the glyph associated with the character and render it - * onto the display. - */ - - else - { - bm = nxtext_addchar(hfont, st, ch); - if (bm) - { - nxtext_fillchar(hwnd, NULL, st, hfont, bm); - } - } -} - -/**************************************************************************** - * Name: nxtext_fillchar - * - * Description: - * This implements the character display. It is part of the nxtext_putc - * operation but may also be used when redrawing an existing display. - * - ****************************************************************************/ - -void nxtext_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, - FAR struct nxtext_state_s *st, - NXHANDLE hfont, FAR const struct nxtext_bitmap_s *bm) -{ - FAR struct nxtext_glyph_s *glyph; - struct nxgl_rect_s bounds; - struct nxgl_rect_s intersection; - struct nxgl_size_s fsize; - int ret; - - /* Handle the special case of spaces which have no glyph bitmap */ - - if (BM_ISSPACE(bm)) - { - return; - } - - /* Get the size of the font glyph (which may not have been created yet) */ - - ret = nxtext_fontsize(hfont, bm->code, &fsize); - if (ret < 0) - { - /* This would mean that there is no bitmap for the character code and - * that the font would be rendered as a space. But this case should - * never happen here because the BM_ISSPACE() should have already - * found all such cases. - */ - - return; - } - - /* Construct a bounding box for the glyph */ - - bounds.pt1.x = bm->pos.x; - bounds.pt1.y = bm->pos.y; - bounds.pt2.x = bm->pos.x + fsize.w - 1; - bounds.pt2.y = bm->pos.y + fsize.h - 1; - - /* Should this also be clipped to a region in the window? */ - - if (rect) - { - /* Get the intersection of the redraw region and the character bitmap */ - - nxgl_rectintersect(&intersection, rect, &bounds); - } - else - { - /* The intersection is the whole glyph */ - - nxgl_rectcopy(&intersection, &bounds); - } - - /* Check for empty intersections */ - - if (!nxgl_nullrect(&intersection)) - { - FAR const void *src; - - /* Find (or create) the glyph that goes with this font */ - - glyph = nxtext_getglyph(hfont, st, bm->code); - if (!glyph) - { - /* Shouldn't happen */ - - return; - } - - /* Blit the font bitmap into the window */ - - src = (FAR const void *)glyph->bitmap; - ret = nx_bitmap((NXWINDOW)hwnd, &intersection, &src, - &bm->pos, (unsigned int)glyph->stride); - if (ret < 0) - { - message("nxtext_fillchar: nx_bitmapwindow failed: %d\n", errno); - } - } -} - diff --git a/apps/examples/nxtext/nxtext_server.c b/apps/examples/nxtext/nxtext_server.c deleted file mode 100644 index a464628e1..000000000 --- a/apps/examples/nxtext/nxtext_server.c +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************** - * examples/nxtext/nxtext_server.c - * - * 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 - * 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sched.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/arch.h> -#include <nuttx/nx/nx.h> - -#ifdef CONFIG_NX_LCDDRIVER -# include <nuttx/lcd/lcd.h> -#else -# include <nuttx/fb.h> -#endif - -#include "nxtext_internal.h" - -#ifdef CONFIG_NX_MULTIUSER - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: nxtext_server - ****************************************************************************/ - -int nxtext_server(int argc, char *argv[]) -{ - FAR NX_DRIVERTYPE *dev; - int ret; - -#if defined(CONFIG_EXAMPLES_NXTEXT_EXTERNINIT) - /* Use external graphics driver initialization */ - - message("nxtext_server: Initializing external graphics device\n"); - dev = up_nxdrvinit(CONFIG_EXAMPLES_NXTEXT_DEVNO); - if (!dev) - { - message("nxtext_server: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NXTEXT_DEVNO); - g_exitcode = NXEXIT_EXTINITIALIZE; - return ERROR; - } - -#elif defined(CONFIG_NX_LCDDRIVER) - /* Initialize the LCD device */ - - message("nxtext_server: Initializing LCD\n"); - ret = up_lcdinitialize(); - if (ret < 0) - { - message("nxtext_server: up_lcdinitialize failed: %d\n", -ret); - return 1; - } - - /* Get the device instance */ - - dev = up_lcdgetdev(CONFIG_EXAMPLES_NXTEXT_DEVNO); - if (!dev) - { - message("nxtext_server: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXTEXT_DEVNO); - return 2; - } - - /* Turn the LCD on at 75% power */ - - (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); -#else - /* Initialize the frame buffer device */ - - message("nxtext_server: Initializing framebuffer\n"); - ret = up_fbinitialize(); - if (ret < 0) - { - message("nxtext_server: up_fbinitialize failed: %d\n", -ret); - return 1; - } - - dev = up_fbgetvplane(CONFIG_EXAMPLES_NXTEXT_VPLANE); - if (!dev) - { - message("nxtext_server: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXTEXT_VPLANE); - return 2; - } -#endif - - /* Then start the server */ - - ret = nx_run(dev); - gvdbg("nx_run returned: %d\n", errno); - return 3; -} - -/**************************************************************************** - * Name: nxtext_listener - ****************************************************************************/ - -FAR void *nxtext_listener(FAR void *arg) -{ - int ret; - - /* Process events forever */ - - for (;;) - { - /* Handle the next event. If we were configured blocking, then - * we will stay right here until the next event is received. Since - * we have dedicated a while thread to servicing events, it would - * be most natural to also select CONFIG_NX_BLOCKING -- if not, the - * following would be a tight infinite loop (unless we added addition - * logic with nx_eventnotify and sigwait to pace it). - */ - - ret = nx_eventhandler(g_hnx); - if (ret < 0) - { - /* An error occurred... assume that we have lost connection with - * the server. - */ - - message("nxtext_listener: Lost server connection: %d\n", errno); - exit(NXEXIT_LOSTSERVERCONN); - } - - /* If we received a message, we must be connected */ - - if (!g_connected) - { - g_connected = true; - sem_post(&g_semevent); - message("nxtext_listener: Connected\n"); - } - } -} - -#endif /* CONFIG_NX_MULTIUSER */ diff --git a/apps/examples/ostest/Kconfig b/apps/examples/ostest/Kconfig index c3fe8f21d..0da7e4ce3 100644 --- a/apps/examples/ostest/Kconfig +++ b/apps/examples/ostest/Kconfig @@ -39,31 +39,4 @@ config EXAMPLES_OSTEST_NBARRIER_THREADS is 8 but a smaller number may be needed on systems without sufficient memory to start so many threads. -config EXAMPLES_OSTEST_RR_RANGE - int "Round-robin test - end of search range" - default 10000 - range 1 32767 - ---help--- - During round-robin scheduling test two threads are created. Each of the threads - searches for prime numbers in the configurable range, doing that configurable - number of times. - - This value specifies the end of search range and together with number of runs - allows to configure the length of this test - it should last at least a few - tens of seconds. Allowed values [1; 32767], default 10000 - -config EXAMPLES_OSTEST_RR_RUNS - int "Round-robin test - number of runs" - default 10 - range 1 32767 - ---help--- - During round-robin scheduling test two threads are created. Each of the threads - searches for prime numbers in the configurable range, doing that configurable - number of times. - - This value specifies the number of times the thread searches the range for - prime numbers and together with end of search range allows to configure the - length of this test - it should last at least a few tens of seconds. Allowed - values [1; 32767], default 10 - endif diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile index 3e78c64e8..374964b39 100644 --- a/apps/examples/ostest/Makefile +++ b/apps/examples/ostest/Makefile @@ -98,14 +98,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -124,7 +120,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -136,17 +134,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/ostest/roundrobin.c b/apps/examples/ostest/roundrobin.c index bfd344df3..5167a857e 100644 --- a/apps/examples/ostest/roundrobin.c +++ b/apps/examples/ostest/roundrobin.c @@ -1,7 +1,7 @@ /******************************************************************************** * examples/ostest/roundrobin.c * - * Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 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,6 @@ #include <nuttx/config.h> #include <stdio.h> -#include <stdbool.h> #include "ostest.h" #if CONFIG_RR_INTERVAL > 0 @@ -48,87 +47,115 @@ * Definitions ********************************************************************************/ -/* This numbers should be tuned for different processor speeds via .config file. - * With default values the test takes about 30s on Cortex-M3 @ 24MHz. With 32767 - * range and 10 runs it takes ~320s. */ +/* This number may need to be tuned for different processor speeds. Since these + * arrays must be large to very correct SCHED_RR behavior, this test may require + * too much memory on many targets. + */ -#ifndef CONFIG_EXAMPLES_OSTEST_RR_RANGE -# define CONFIG_EXAMPLES_OSTEST_RR_RANGE 10000 -# warning "CONFIG_EXAMPLES_OSTEST_RR_RANGE undefined, using default value = 10000" -#elif (CONFIG_EXAMPLES_OSTEST_RR_RANGE < 1) || (CONFIG_EXAMPLES_OSTEST_RR_RANGE > 32767) -# define CONFIG_EXAMPLES_OSTEST_RR_RANGE 10000 -# warning "Invalid value of CONFIG_EXAMPLES_OSTEST_RR_RANGE, using default value = 10000" -#endif +/* #define CONFIG_NINTEGERS 32768 Takes forever on 60Mhz ARM7 */ -#ifndef CONFIG_EXAMPLES_OSTEST_RR_RUNS -# define CONFIG_EXAMPLES_OSTEST_RR_RUNS 10 -# warning "CONFIG_EXAMPLES_OSTEST_RR_RUNS undefined, using default value = 10" -#elif (CONFIG_EXAMPLES_OSTEST_RR_RUNS < 1) || (CONFIG_EXAMPLES_OSTEST_RR_RUNS > 32767) -# define CONFIG_EXAMPLES_OSTEST_RR_RUNS 10 -# warning "Invalid value of CONFIG_EXAMPLES_OSTEST_RR_RUNS, using default value = 10" -#endif +#define CONFIG_NINTEGERS 2048 + +/******************************************************************************** + * Private Data + ********************************************************************************/ + +static int prime1[CONFIG_NINTEGERS]; +static int prime2[CONFIG_NINTEGERS]; /******************************************************************************** * Private Functions ********************************************************************************/ /******************************************************************************** - * Name: get_primes + * Name: dosieve * * Description - * This function searches for prime numbers in the most primitive way possible. + * This implements a "sieve of aristophanes" algorithm for finding prime number. + * Credit for this belongs to someone, but I am not sure who anymore. Anyway, + * the only purpose here is that we need some algorithm that takes a long period + * of time to execute. + * ********************************************************************************/ -static void get_primes(int *count, int *last) +static void dosieve(int *prime) { - int number; - int local_count = 0; - *last = 0; // to make compiler happy - - for (number = 1; number < CONFIG_EXAMPLES_OSTEST_RR_RANGE; number++) - { - int div; - bool is_prime = true; - - for (div = 2; div <= number / 2; div++) - if (number % div == 0) - { - is_prime = false; - break; - } - - if (is_prime) + int a,d; + int i; + int j; + + a = 2; + d = a; + + for (i = 0; i < CONFIG_NINTEGERS; i++) + { + prime[i] = i+2; + } + + for (i = 1; i < 10; i++) { - local_count++; - *last = number; + for (j = 0; j < CONFIG_NINTEGERS; j++) + { + d = a + d; + if (d < CONFIG_NINTEGERS) + { + prime[d]=0; + } + } + a++; + d = a; + i++; + } + #if 0 /* We don't really care what the numbers are */ - printf(" Prime %d: %d\n", local_count, number); + for (i = 0, j= 0; i < CONFIG_NINTEGERS; i++) + { + if (prime[i] != 0) + { + printf(" Prime %d: %d\n", j, prime[i]); + j++; + } + } #endif +} + +/******************************************************************************** + * Name: sieve1 + ********************************************************************************/ + +static void *sieve1(void *parameter) +{ + int i; + + printf("sieve1 started\n"); + + for (i = 0; i < 1000; i++) + { + dosieve(prime1); } - } - *count = local_count; + printf("sieve1 finished\n"); + + pthread_exit(NULL); + return NULL; /* To keep some compilers happy */ } /******************************************************************************** - * Name: get_primes_thread + * Name: sieve2 ********************************************************************************/ -static void *get_primes_thread(void *parameter) +static void *sieve2(void *parameter) { - int id = (int)parameter; - int i, count, last; + int i; - printf("get_primes_thread id=%d started, looking for primes < %d, doing %d run(s)\n", - id, CONFIG_EXAMPLES_OSTEST_RR_RANGE, CONFIG_EXAMPLES_OSTEST_RR_RUNS); + printf("sieve2 started\n"); - for (i = 0; i < CONFIG_EXAMPLES_OSTEST_RR_RUNS; i++) + for (i = 0; i < 1000; i++) { - get_primes(&count, &last); + dosieve(prime2); } - printf("get_primes_thread id=%d finished, found %d primes, last one was %d\n", - id, count, last); + printf("sieve2 finished\n"); pthread_exit(NULL); return NULL; /* To keep some compilers happy */ @@ -144,13 +171,14 @@ static void *get_primes_thread(void *parameter) void rr_test(void) { - pthread_t get_primes1_thread; - pthread_t get_primes2_thread; + pthread_t sieve1_thread; + pthread_t sieve2_thread; struct sched_param sparam; pthread_attr_t attr; pthread_addr_t result; int status; + printf("rr_test: Starting sieve1 thread \n"); status = pthread_attr_init(&attr); if (status != OK) { @@ -175,31 +203,29 @@ void rr_test(void) } else { - printf("rr_test: Set thread policy to SCHED_RR\n"); + printf("rr_test: Set thread policty to SCHED_RR\n"); } - printf("rr_test: Starting first get_primes_thread\n"); - - status = pthread_create(&get_primes1_thread, &attr, get_primes_thread, (void*)1); + status = pthread_create(&sieve1_thread, &attr, sieve1, NULL); if (status != 0) { printf("rr_test: Error in thread 1 creation, status=%d\n", status); } - printf("rr_test: Starting second get_primes_thread\n"); + printf("rr_test: Starting sieve1 thread \n"); - status = pthread_create(&get_primes2_thread, &attr, get_primes_thread, (void*)2); + status = pthread_create(&sieve2_thread, &attr, sieve2, NULL); if (status != 0) { printf("rr_test: Error in thread 2 creation, status=%d\n", status); } - printf("rr_test: Waiting for threads to complete -- this should take awhile\n"); + printf("rr_test: Waiting for sieves to complete -- this should take awhile\n"); printf("rr_test: If RR scheduling is working, they should start and complete at\n"); printf("rr_test: about the same time\n"); - pthread_join(get_primes2_thread, &result); - pthread_join(get_primes1_thread, &result); + pthread_join(sieve2_thread, &result); + pthread_join(sieve1_thread, &result); printf("rr_test: Done\n"); } diff --git a/apps/examples/pashello/Kconfig b/apps/examples/pashello/Kconfig deleted file mode 100644 index 5591d6b5b..000000000 --- a/apps/examples/pashello/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_PASHELLO - bool "Pascal \"Hello, World!\" example" - default n - ---help--- - Enable the Pascal \"Hello, World!\" example - -if EXAMPLES_PASHELLO -endif diff --git a/apps/examples/pashello/Makefile b/apps/examples/pashello/Makefile deleted file mode 100644 index bb525c925..000000000 --- a/apps/examples/pashello/Makefile +++ /dev/null @@ -1,104 +0,0 @@ -############################################################################ -# apps/examples/pashello/Makefile -# -# Copyright (C) 2008-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# Pascal Add-On Example - -ifeq ($(WINTOOL),y) -INCDIROPT = -w -endif -CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" \ - "." \ - "$(APPDIR)$(DELIM)interpreters$(DELIM)pcode$(DELIM)include" \ - "$(APPDIR)$(DELIM)interpreters$(DELIM)pcode$(DELIM)insn$(DELIM)include"} - -ASRCS = -CSRCS = pashello.c device.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/pashello/README.txt b/apps/examples/pashello/README.txt deleted file mode 100644 index b19846966..000000000 --- a/apps/examples/pashello/README.txt +++ /dev/null @@ -1,34 +0,0 @@ -README -^^^^^^ - -hello.pas - - This is a sample "Hello, World!" Pascal Program - -hello.pex - - This is the compiled, linked P-Code executable that results - when hello.pas is compiled. - -hello.h - - This file defines an initialized C array holds a copy of - hello.pex. This file as created by: - - xxd -i hello.pex >hello.h - -mkhello.sh - - This is a scripts that can be used to rebuild both hello.pex - and hello.h. - -device.c - - The hello.pex file must be provided to the interpreter as a file - in the file system. Normally this would be done using real storage - medium. In this example, we will use device.c: - - device.c implements a simple device driver. Reads from this device - will access the in-memory copy of hello.pex This device driver is - registered as /dev/pashello in the pseudo filesystem. - diff --git a/apps/examples/pashello/device.c b/apps/examples/pashello/device.c deleted file mode 100644 index a3950e6a3..000000000 --- a/apps/examples/pashello/device.c +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** - * examples/pashello/device.c - * - * Copyright (C) 2008, 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Compilation Switches - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <sys/types.h> -#include <string.h> -#include <errno.h> -#include <nuttx/fs/fs.h> - -#include "hello.h" -#include "pashello.h" - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static ssize_t hello_read(struct file *, char *, size_t); - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const struct file_operations hello_fops = -{ - 0, /* open */ - 0, /* close */ - hello_read, /* read */ - 0, /* write */ - 0, /* seek */ - 0, /* ioctl */ -#ifndef CONFIG_DISABLE_POLL - 0 /* poll */ -#endif -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static ssize_t hello_read(struct file *filep, char *buffer, size_t len) -{ - off_t offset = filep->f_pos; /* Start read position */ - ssize_t nread = 0; /* Bytes read -- assume EOF */ - - /* Make sure that the offset is within the .pex file */ - - if (offset < hello_pex_len) - { - /* Make sure the read does not extend beyond the .pex file */ - - nread = len; - if (nread + offset > hello_pex_len) - { - nread = hello_pex_len - offset; - } - memcpy(buffer, &hello_pex[offset], nread); - filep->f_pos += nread; - } - return nread; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void hello_register(void) -{ - (void)register_driver("/dev/hello", &hello_fops, 0444, NULL); -} diff --git a/apps/examples/pashello/hello.h b/apps/examples/pashello/hello.h deleted file mode 100644 index 818e5e4a5..000000000 --- a/apps/examples/pashello/hello.h +++ /dev/null @@ -1,23 +0,0 @@ -unsigned char hello_pex[] = { - 0x50, 0x4f, 0x46, 0x46, 0x01, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x05, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, - 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x11, 0x01, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, - 0x00, 0x00, 0x00, 0x0f, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x04, - 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, - 0x00, 0x00, 0x00, 0x38, 0xb1, 0x00, 0x00, 0x74, 0x0e, 0xf9, 0x00, 0x00, - 0x25, 0xb5, 0xff, 0xfc, 0xf9, 0x00, 0x00, 0x20, 0x3f, 0x48, 0x65, 0x6c, - 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x21, 0x21, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x48, 0x45, 0x4c, - 0x4c, 0x4f, 0x00, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, 0x70, 0x61, 0x73, - 0x00, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x00, 0x2e, 0x72, 0x6f, 0x64, 0x61, - 0x74, 0x61, 0x00, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x74, 0x61, 0x62, 0x00, - 0x2e, 0x6c, 0x69, 0x6e, 0x65, 0x6e, 0x6f, 0x00, 0x2e, 0x73, 0x74, 0x72, - 0x74, 0x61, 0x62, 0x00 -}; -unsigned int hello_pex_len = 232; diff --git a/apps/examples/pashello/hello.pas b/apps/examples/pashello/hello.pas deleted file mode 100644 index fe137f1b6..000000000 --- a/apps/examples/pashello/hello.pas +++ /dev/null @@ -1,5 +0,0 @@ -program hello(output); -begin - writeln('Hello world!!!'); -end. - diff --git a/apps/examples/pashello/hello.pex b/apps/examples/pashello/hello.pex Binary files differdeleted file mode 100644 index c23610598..000000000 --- a/apps/examples/pashello/hello.pex +++ /dev/null diff --git a/apps/examples/pashello/mkhello.sh b/apps/examples/pashello/mkhello.sh deleted file mode 100755 index e8f196498..000000000 --- a/apps/examples/pashello/mkhello.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -############################################################################ -# examples/pashello/mkhello.sh -# -# Copyright (C) 2008 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. -# -############################################################################ -#set -x - -BINDIR=$1 -WD=`pwd` - -PASCAL=${BINDIR}/pascal -POPT=${BINDIR}/popt -PLINK=${BINDIR}/plink -PRUN=${BINDIR}/prun - -PASFILENAME=hello.pas -OUFILE=hello.h -STRSTKSZ=1024 - -function sanity_check () -{ - if [ ! -f "${WD}/${PASFILENAME}" ]; then - echo "ERROR: Source ${PASFILENAME} does not exist in this directory" - exit 1 - fi - if [ -z "${BINDIR}" ]; then - echo "ERROR: Path to the pascal bin/ directory not provided" - exit 1 - fi - if [ ! -d "${BINDIR}" ]; then - echo "ERROR: Tool ${BINDIR} does not exist" - exit 1 - fi - if [ ! -x "${PASCAL}" ]; then - echo "ERROR: Executable ${PASCAL} does not exist" - exit 1 - fi - if [ ! -x "${POPT}" ]; then - echo "ERROR: Executable ${POPT} does not exist" - exit 1 - fi - if [ ! -x "${PLINK}" ]; then - echo "ERROR: Executable ${PLINK} does not exist" - exit 1 - fi - if [ ! -x "${PRUN}" ]; then - echo "ERROR: Executable ${PRUN} does not exist" - exit 1 - fi -} - -function compile_hello () -{ - PASOPTS= - ${PASCAL} ${PASOPTS} ${PASFILENAME} 2>&1 || rm -f hello.o1 - if [ -f hello.err ] ; then - cat hello.err | grep Line - fi - if [ ! -f hello.o1 ] ; then - echo "Compilation failed" - else - POPTOPTS= - ${POPT} ${POPTOPTS} hello.o1 2>&1 - ${PLINK} hello.o hello.pex 2>&1 - fi -} - -function test_program () -{ - if [ "${CONFIG_REGM}" == "y" ]; then - echo "Don't know how to run REGM programs yet" - else - echo "Using string stack size = ${STRSTKSZ}" - PRUNOPTS="-t ${STRSTKSZ}" - - if [ ! -f hello.pex ]; then - echo "No p-code executable" - else - if [ -f hello.inp ] ; then - ${PRUN} ${PRUNOPTS} hello.pex 2>&1 <hello.inp - else - ${PRUN} ${PRUNOPTS} hello.pex 2>&1 - fi - fi - fi -} - -function test_hello () -{ - echo "Using string stack size = ${STRSTKSZ}" - PRUNOPTS="-t ${STRSTKSZ}" - - if [ ! -f hello.pex ]; then - echo "No p-code executable" - exit 1 - else - ${PRUN} ${PRUNOPTS} hello.pex - fi -} - -function make_include () -{ - xxd -i hello.pex >hello.h -} - -sanity_check -compile_hello -rm *.o *.o1 *.lst *.err -test_hello -make_include - diff --git a/apps/examples/pashello/pashello.c b/apps/examples/pashello/pashello.c deleted file mode 100644 index 8f9fc8b22..000000000 --- a/apps/examples/pashello/pashello.c +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** - * examples/pashello/pashello.c - * - * Copyright (C) 2008-2009, 2011 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 <stdio.h> -#include <stdlib.h> -#include <debug.h> - -#include "pexec.h" -#include "pedefs.h" -#include "pashello.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#ifndef CONFIG_PASHELLO_VARSTACKSIZE -# define CONFIG_PASHELLO_VARSTACKSIZE 1024 -#endif - -#ifndef CONFIG_PASHELLO_STRSTACKSIZE -# define CONFIG_PASHELLO_STRSTACKSIZE 128 -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: prun - * - * Description: - * This function executes the P-Code program until a stopping condition - * is encountered. - * - ****************************************************************************/ - -static void prun(FAR struct pexec_s *st) -{ - int errcode; - - for (;;) - { - /* Execute the instruction; Check for exceptional conditions */ - - errcode = pexec(st); - if (errcode != eNOERROR) break; - } - - if (errcode != eEXIT) - { - printf("Runtime error 0x%02x -- Execution Stopped\n", errcode); - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * pashello_main - ****************************************************************************/ - -int pashello_main(int argc, FAR char *argv[]) -{ - FAR struct pexec_s *st; - - /* Register the /dev/hello driver */ - - hello_register(); - - /* Load the POFF file */ - - st = pload("/dev/hello", CONFIG_PASHELLO_VARSTACKSIZE, CONFIG_PASHELLO_STRSTACKSIZE); - if (!st) - { - fprintf(stderr, "pashello_main: ERROR: Could not load /dev/hello\n"); - exit(1); - } - printf("pashello_main: /dev/hello Loaded\n"); - printf("pashello_main: Interpreter started:\n"); - - /* And start program execution */ - - prun(st); - - /* Clean up resources used by the interpreter */ - - printf("pashello_main: Interpreter terminated"); - pexec_release(st); - return 0; -} diff --git a/apps/examples/pashello/pashello.h b/apps/examples/pashello/pashello.h deleted file mode 100644 index ac5f99fbe..000000000 --- a/apps/examples/pashello/pashello.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** - * examples/pashello/pashello.h - * - * Copyright (C) 2008 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 __EXAMPLES_PASHELLO_H -#define __EXAMPLES_PASHELLO_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -/* Defined in device.c */ - -extern void hello_register(void); - -#endif /* __EXAMPLES_PASHELLO_H */ diff --git a/apps/examples/pipe/Makefile b/apps/examples/pipe/Makefile index bed319085..956c911b3 100644 --- a/apps/examples/pipe/Makefile +++ b/apps/examples/pipe/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/pipe/Makefile # -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,23 +70,24 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/poll/Makefile b/apps/examples/poll/Makefile index 13173f125..aef61d199 100644 --- a/apps/examples/poll/Makefile +++ b/apps/examples/poll/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/poll/Makefile # -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,25 +70,25 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ # Register application depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - $(call DELFILE, host$(HOSTEXEEXT)) + @rm -f Make.dep .depend host -include Make.dep diff --git a/apps/examples/pwm/Makefile b/apps/examples/pwm/Makefile index 3a6f2520a..efbdb048e 100644 --- a/apps/examples/pwm/Makefile +++ b/apps/examples/pwm/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/pwm/Makefile # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -90,17 +88,16 @@ $(COBJS): %$(OBJEXT): %.c context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/pwm/pwm_main.c b/apps/examples/pwm/pwm_main.c index a46c10f55..775bdba6b 100644 --- a/apps/examples/pwm/pwm_main.c +++ b/apps/examples/pwm/pwm_main.c @@ -48,7 +48,6 @@ #include <fcntl.h> #include <errno.h> #include <debug.h> -#include <string.h> #include <nuttx/pwm.h> diff --git a/apps/examples/elf/tests/mutex/Makefile b/apps/examples/px4_deamon_app/Makefile index 04c1e8975..e4c169872 100644 --- a/apps/examples/elf/tests/mutex/Makefile +++ b/apps/examples/px4_deamon_app/Makefile @@ -1,8 +1,6 @@ ############################################################################ -# examples/elf/tests/mutex/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt <gnutt@nuttx.org> +# Copyright (C) 2012 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -14,7 +12,7 @@ # 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 +# 3. Neither the name PX4 nor the names of its contributors may be # used to endorse or promote products derived from this software # without specific prior written permission. # @@ -33,27 +31,12 @@ # ############################################################################ --include $(TOPDIR)/Make.defs - -BIN = mutex - -SRCS = $(BIN).c -OBJS = $(SRCS:.c=.o) - -all: $(BIN) - -$(OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ - -$(BIN): $(OBJS) - @echo "LD: $<" - $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ +# +# Basic example application +# -clean: - $(call DELFILE, $(BIN)) - $(call CLEAN) +APPNAME = px4_deamon_app +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 -install: - $(Q) mkdir -p $(ROMFS_DIR) - $(Q) install $(BIN) $(ROMFS_DIR)/$(BIN) +include $(APPDIR)/mk/app.mk diff --git a/apps/examples/px4_deamon_app/px4_deamon_app.c b/apps/examples/px4_deamon_app/px4_deamon_app.c new file mode 100644 index 000000000..a5d847777 --- /dev/null +++ b/apps/examples/px4_deamon_app/px4_deamon_app.c @@ -0,0 +1,137 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Author: @author Example User <mail@example.com> + * + * 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 PX4 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. + * + ****************************************************************************/ + +/** + * @file px4_deamon_app.c + * Deamon application example for PX4 autopilot + */ + +#include <nuttx/config.h> +#include <unistd.h> +#include <stdio.h> + +static bool thread_should_exit = false; /**< Deamon exit flag */ +static bool thread_running = false; /**< Deamon status flag */ +static int deamon_task; /**< Handle of deamon task / thread */ + +/** + * Deamon management function. + */ +__EXPORT int px4_deamon_app_main(int argc, char *argv[]); + +/** + * Mainloop of deamon. + */ +int px4_deamon_thread_main(int argc, char *argv[]); + +/** + * Print the correct usage. + */ +static void usage(const char *reason); + +static void +usage(const char *reason) +{ + if (reason) + fprintf(stderr, "%s\n", reason); + fprintf(stderr, "usage: deamon {start|stop|status} [-p <additional params>]\n\n"); + exit(1); +} + +/** + * The deamon app only briefly exists to start + * the background job. The stack size assigned in the + * Makefile does only apply to this management task. + * + * The actual stack size should be set in the call + * to task_create(). + */ +int px4_deamon_app_main(int argc, char *argv[]) +{ + if (argc < 1) + usage("missing command"); + + if (!strcmp(argv[1], "start")) { + + if (thread_running) { + printf("deamon already running\n"); + /* this is not an error */ + exit(0); + } + + thread_should_exit = false; + deamon_task = task_spawn("deamon", + SCHED_DEFAULT, + SCHED_PRIORITY_DEFAULT, + 4096, + px4_deamon_thread_main, + (argv) ? (const char **)&argv[2] : (const char **)NULL); + exit(0); + } + + if (!strcmp(argv[1], "stop")) { + thread_should_exit = true; + exit(0); + } + + if (!strcmp(argv[1], "status")) { + if (thread_running) { + printf("\tdeamon app is running\n"); + } else { + printf("\tdeamon app not started\n"); + } + exit(0); + } + + usage("unrecognized command"); + exit(1); +} + +int px4_deamon_thread_main(int argc, char *argv[]) { + + printf("[deamon] starting\n"); + + thread_running = true; + + while (!thread_should_exit) { + printf("Hello Deamon!\n"); + sleep(10); + } + + printf("[deamon] exiting.\n"); + + thread_running = false; + + return 0; +} diff --git a/apps/examples/px4_simple_app/Makefile b/apps/examples/px4_simple_app/Makefile new file mode 100644 index 000000000..102f51fd4 --- /dev/null +++ b/apps/examples/px4_simple_app/Makefile @@ -0,0 +1,42 @@ +############################################################################ +# +# Copyright (C) 2012 PX4 Development Team. All rights reserved. +# +# 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 PX4 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. +# +############################################################################ + +# +# Basic example application +# + +APPNAME = px4_simple_app +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +include $(APPDIR)/mk/app.mk diff --git a/apps/examples/px4_simple_app/px4_simple_app.c b/apps/examples/px4_simple_app/px4_simple_app.c new file mode 100644 index 000000000..7f655964d --- /dev/null +++ b/apps/examples/px4_simple_app/px4_simple_app.c @@ -0,0 +1,115 @@ +/**************************************************************************** + * + * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Author: @author Example User <mail@example.com> + * + * 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 PX4 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. + * + ****************************************************************************/ + +/** + * @file px4_simple_app.c + * Minimal application example for PX4 autopilot + */ + +#include <nuttx/config.h> +#include <unistd.h> +#include <stdio.h> +#include <poll.h> + +#include <uORB/uORB.h> +#include <uORB/topics/sensor_combined.h> +#include <uORB/topics/vehicle_attitude.h> + +__EXPORT int px4_simple_app_main(int argc, char *argv[]); + +int px4_simple_app_main(int argc, char *argv[]) +{ + printf("Hello Sky!\n"); + + /* subscribe to sensor_combined topic */ + int sensor_sub_fd = orb_subscribe(ORB_ID(sensor_combined)); + orb_set_interval(sensor_sub_fd, 1000); + + /* advertise attitude topic */ + struct vehicle_attitude_s att; + memset(&att, 0, sizeof(att)); + orb_advert_t att_pub = orb_advertise(ORB_ID(vehicle_attitude), &att); + + /* one could wait for multiple topics with this technique, just using one here */ + struct pollfd fds[] = { + { .fd = sensor_sub_fd, .events = POLLIN }, + /* there could be more file descriptors here, in the form like: + * { .fd = other_sub_fd, .events = POLLIN }, + */ + }; + + int error_counter = 0; + + while (true) { + /* wait for sensor update of 1 file descriptor for 1000 ms (1 second) */ + int poll_ret = poll(fds, 1, 1000); + + /* handle the poll result */ + if (poll_ret == 0) { + /* this means none of our providers is giving us data */ + printf("[px4_simple_app] Got no data within a second\n"); + } else if (poll_ret < 0) { + /* this is seriously bad - should be an emergency */ + if (error_counter < 10 || error_counter % 50 == 0) { + /* use a counter to prevent flooding (and slowing us down) */ + printf("[px4_simple_app] ERROR return value from poll(): %d\n" + , poll_ret); + } + error_counter++; + } else { + + if (fds[0].revents & POLLIN) { + /* obtained data for the first file descriptor */ + struct sensor_combined_s raw; + /* copy sensors raw data into local buffer */ + orb_copy(ORB_ID(sensor_combined), sensor_sub_fd, &raw); + printf("[px4_simple_app] Accelerometer:\t%8.4f\t%8.4f\t%8.4f\n", + (double)raw.accelerometer_m_s2[0], + (double)raw.accelerometer_m_s2[1], + (double)raw.accelerometer_m_s2[2]); + + /* set att and publish this information for other apps */ + att.roll = raw.accelerometer_m_s2[0]; + att.pitch = raw.accelerometer_m_s2[1]; + att.yaw = raw.accelerometer_m_s2[2]; + orb_publish(ORB_ID(vehicle_attitude), att_pub, &att); + } + /* there could be more file descriptors here, in the form like: + * if (fds[1..n].revents & POLLIN) {} + */ + } + } + + return 0; +} diff --git a/apps/examples/qencoder/Makefile b/apps/examples/qencoder/Makefile index 7d2427c6b..3f3fc9def 100644 --- a/apps/examples/qencoder/Makefile +++ b/apps/examples/qencoder/Makefile @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -92,17 +90,16 @@ endif context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/relays/Kconfig b/apps/examples/relays/Kconfig deleted file mode 100644 index 1e1f9aa5b..000000000 --- a/apps/examples/relays/Kconfig +++ /dev/null @@ -1,20 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_RELAYS - bool "wget JSON Example" - default n - depends on NETUTILS_JSON - ---help--- - Enable the wget JSON example - -if EXAMPLES_RELAYS - -config EXAMPLES_RELAYS_NRELAYS - int "Number of Relays" - default 2 - depends on ARCH_RELAYS - -endif diff --git a/apps/examples/relays/Makefile b/apps/examples/relays/Makefile deleted file mode 100644 index 8e91ab572..000000000 --- a/apps/examples/relays/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################ -# apps/examples/relays/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# relays Example - -ASRCS = -CSRCS = relays_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Buttons built-in application info - -APPNAME = relays -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 512 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/relays/relays_main.c b/apps/examples/relays/relays_main.c deleted file mode 100644 index c7ad6db0f..000000000 --- a/apps/examples/relays/relays_main.c +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************** - * examples/relays/relays_main.c - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Darcy Gong - * - * 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/arch.h> - -#include <stdbool.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/arch.h> - -#ifdef CONFIG_ARCH_RELAYS - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_RELAYS_NRELAYS -# define CONFIG_EXAMPLES_RELAYS_NRELAYS 2 -#endif - - /**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: relays_main - ****************************************************************************/ - -int relays_main(int argc, char *argv[]) -{ - char *stat = NULL; - char *no = NULL; - bool badarg = false; - bool set_stat = false; - uint32_t r_stat; - int option; - int n = -1; - int ret = -1; - int i; - - while ((option = getopt(argc, argv, ":n:")) != ERROR) - { - switch (option) - { - case 'n': - no = optarg; - n = atoi(no); - break; - - case ':': - badarg = true; - break; - - case '?': - default: - badarg = true; - break; - } - } - - if (badarg) - { - printf("usage: relays [ -n <relay id> ] <switch-status>\n"); - return -1; - } - - if (optind == argc - 1) - { - stat = argv[optind]; - set_stat = (!strcmp(stat,"on") || !strcmp(stat,"ON")) ? true : false ; - } - - up_relaysinit(); - - if (n >= 0) - { - printf("set RELAY ID %d to %s\n", n , set_stat ? "ON" : "OFF"); - relays_setstat(n,set_stat); - } - else - { - r_stat = 0; - for (i = 0; i < CONFIG_EXAMPLES_RELAYS_NRELAYS; i++) - { - printf("set RELAY ID %d to %s\n", i , set_stat ? "ON" : "OFF"); - r_stat |= (set_stat ? 1 : 0) << i; - } - - relays_setstats(r_stat); - } - - return 0; -} - -#endif /* CONFIG_ARCH_RELAYS */ diff --git a/apps/examples/rgmp/Kconfig b/apps/examples/rgmp/Kconfig deleted file mode 100644 index f3accba9c..000000000 --- a/apps/examples/rgmp/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_RGMP - bool "RGMP example" - default n - ---help--- - Enable the RGMP example - -if EXAMPLES_RGMP -endif diff --git a/apps/examples/rgmp/Makefile b/apps/examples/rgmp/Makefile deleted file mode 100644 index d94d6ec3c..000000000 --- a/apps/examples/rgmp/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -############################################################################ -# examples/rgmp/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# The smallest thing you can build -- the NULL example. - -ASRCS = -CSRCS = rgmp_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/romfs/Makefile b/apps/examples/romfs/Makefile index 2b02952ed..ba930b77d 100644 --- a/apps/examples/romfs/Makefile +++ b/apps/examples/romfs/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/romfs/Makefile # -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -65,7 +61,7 @@ ROOTDEPPATH = --dep-path . VPATH = all: .built -.PHONY: checkgenromfs clean depend distclean +.PHONY: checkgenromfs clean depend disclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -90,26 +86,26 @@ romfs_testdir.h : testdir.img @xxd -i $< >$@ || { echo "xxd of $< failed" ; exit 1 ; } .built: romfs_testdir.h $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ # Register application depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - $(call DELFILE, testdir.img) + @rm -f Make.dep .depend testdir.img -include Make.dep diff --git a/apps/examples/sendmail/Kconfig b/apps/examples/sendmail/Kconfig deleted file mode 100644 index 875820b16..000000000 --- a/apps/examples/sendmail/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_SENDMAIL - bool "Sendmail example" - default n - ---help--- - Enable the sendmail example - -if EXAMPLES_SENDMAIL -endif diff --git a/apps/examples/sendmail/Makefile b/apps/examples/sendmail/Makefile deleted file mode 100644 index a3b8b7288..000000000 --- a/apps/examples/sendmail/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -############################################################################ -# apps/examples/sendmail/Makefile -# -# Copyright (C) 2009-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# Sendmail SMTP Example - -ASRCS = -CSRCS = target.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -# Register application -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - @$(MAKE) -f Makefile.host clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/sendmail/Makefile.host b/apps/examples/sendmail/Makefile.host deleted file mode 100644 index b62a8755b..000000000 --- a/apps/examples/sendmail/Makefile.host +++ /dev/null @@ -1,79 +0,0 @@ -############################################################################ -# apps/examples/sendmail/Makefile.host -# -# Copyright (C) 2009, 2011 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. -# -############################################################################ - -# TOPDIR must be defined on the make command line - --include $(TOPDIR)/Make.defs - -OBJS = host.o1 smtp.o1 -BIN = sendmail - -HOSTCFLAGS += -DCONFIG_WEBCLIENT_HOST=1 -HOSTCFLAGS += -I. -include hostdefs.h -Iinclude -VPATH = $(TOPDIR)/netutils/smtp:. - -all: $(BIN) -.PHONY: clean context clean_context distclean - -$(OBJS): %.o1: %.c - $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ - -include: - @mkdir include - -include/net: include - @ln -s $(TOPDIR)/include/net include/net - -include/nuttx: - @mkdir -p include/nuttx - -include/queue.h: include - @cp -a $(TOPDIR)/include/queue.h include/. - -include/nuttx/config.h: include/nuttx - @touch include/nuttx/config.h - -headers: include/nuttx/config.h include/queue.h include/net - -$(BIN): headers $(OBJS) - $(HOSTCC) $(HOSTLDFLAGS) $(OBJS) -o $@ - -clean: - $(call DELFILE, $(BIN).*) - $(call DELFILE, *.o1) - $(call CLEAN) - @rm -rf include - - diff --git a/apps/examples/sendmail/host.c b/apps/examples/sendmail/host.c deleted file mode 100644 index a175d2e9a..000000000 --- a/apps/examples/sendmail/host.c +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** - * examples/sendmail/host.c - * - * Copyright (C) 2009, 2011 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 Gregory Nutt 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -#include <apps/netutils/smtp.h> - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const char g_host_name[] = "localhost"; -static const char g_sender[] = "nuttx-testing@example.com"; -static const char g_subject[] = "Testing SMTP from NuttX"; -static const char g_msg_body[] = "Test message sent by NuttX\r\n"; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: show_usage - ****************************************************************************/ - -static void show_usage(const char *progname, int exitcode) -{ - fprintf(stderr, "USAGE: %s <recipient>\n", progname); - exit(exitcode); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ -/**************************************************************************** - * Name: main - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - struct in_addr addr; - void *handle; - - if (argc != 2) - { - show_usage(argv[0], 1); - } - - printf("sendmail: To: %s\n", argv[1]); - printf("sendmail: From: %s\n", g_sender); - printf("sendmail: Subject: %s\n", g_subject); - printf("sendmail: Body: %s\n", g_msg_body); - - uip_ipaddr(addr.s_addr, 127, 0, 0, 1); - handle = smtp_open(); - if (handle) - { - smtp_configure(handle, g_host_name, &addr.s_addr); - smtp_send(handle, argv[1], NULL, g_sender, g_subject, - g_msg_body, strlen(g_msg_body)); - smtp_close(handle); - } - return 0; -} diff --git a/apps/examples/sendmail/hostdefs.h b/apps/examples/sendmail/hostdefs.h deleted file mode 100644 index e9860c22d..000000000 --- a/apps/examples/sendmail/hostdefs.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** - * examples/wget/hostdefs.h - * - * Copyright (C) 2009 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 __HOSTDEFS_H -#define __HOSTDEFS_H - -/**************************************************************************** - * Included Files - *****************************************************************************/ - -#include <stdint.h> -#include <stdbool.h> -#include <stdio.h> - -/**************************************************************************** - * Preprocessor Defintiions - *****************************************************************************/ - -#define HTONS(a) htons(a) -#define HTONL(a) htonl(a) -#define CONFIG_CPP_HAVE_WARNING 1 -#define CONFIG_HAVE_GETHOSTBYNAME 1 -#define FAR - -#define ndbg(...) printf(__VA_ARGS__) -#define nvdbg(...) printf(__VA_ARGS__) - -#define ERROR (-1) -#define OK (0) - -/**************************************************************************** - * Type Definitions - *****************************************************************************/ - -typedef void *(*pthread_startroutine_t)(void *); - -#endif /* __HOSTDEFS_H */ diff --git a/apps/examples/sendmail/target.c b/apps/examples/sendmail/target.c deleted file mode 100644 index 59a51f5d9..000000000 --- a/apps/examples/sendmail/target.c +++ /dev/null @@ -1,157 +0,0 @@ -/**************************************************************************** - * examples/sendmail/target.c - * - * Copyright (C) 2009, 2011 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 Gregory Nutt 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 <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -#include <net/if.h> -#include <apps/netutils/uiplib.h> -#include <apps/netutils/smtp.h> - -/**************************************************************************** - * Pre-processor Defintitions - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_SENDMAIL_RECIPIENT -# error "You must provice CONFIG_EXAMPLES_SENDMAIL_RECIPIENT" -#endif - -#ifndef CONFIG_EXAMPLES_SENDMAIL_IPADDR -# error "You must provice CONFIG_EXAMPLES_SENDMAIL_IPADDR" -#endif - -#ifndef CONFIG_EXAMPLES_SENDMAIL_DRIPADDR -# error "You must provice CONFIG_EXAMPLES_SENDMAIL_DRIPADDR" -#endif - -#ifndef CONFIG_EXAMPLES_SENDMAIL_NETMASK -# error "You must provice CONFIG_EXAMPLES_SENDMAIL_NETMASK" -#endif - -#ifndef CONFIG_EXAMPLES_SENDMAIL_SENDER -# define CONFIG_EXAMPLES_SENDMAIL_SENDER "nuttx-testing@example.com" -#endif - -#ifndef CONFIG_EXAMPLES_SENDMAIL_SUBJECT -# define CONFIG_EXAMPLES_SENDMAIL_SUBJECT "Testing SMTP from NuttX" -#endif - -#ifndef CONFIG_EXAMPLES_SENDMAIL_BODY -# define CONFIG_EXAMPLES_SENDMAIL_BODY "Test message sent by NuttX" -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const char g_host_name[] = "localhost"; -static const char g_recipient[] = CONFIG_EXAMPLES_SENDMAIL_RECIPIENT; -static const char g_sender[] = CONFIG_EXAMPLES_SENDMAIL_SENDER; -static const char g_subject[] = CONFIG_EXAMPLES_SENDMAIL_SUBJECT; -static const char g_msg_body[] = CONFIG_EXAMPLES_SENDMAIL_BODY "\r\n"; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * sendmail_main - ****************************************************************************/ - -int sendmail_main(int argc, char *argv[]) -{ - struct in_addr addr; -#if defined(CONFIG_EXAMPLES_SENDMAIL_NOMAC) - uint8_t mac[IFHWADDRLEN]; -#endif - void *handle; - - printf("sendmail: To: %s\n", g_recipient); - printf("sendmail: From: %s\n", g_sender); - printf("sendmail: Subject: %s\n", g_subject); - printf("sendmail: Body: %s\n", g_msg_body); - -/* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_SENDMAIL_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up our host address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_IPADDR); - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_SENDMAIL_NETMASK); - uip_setnetmask("eth0", &addr); - - /* Then send the mail */ - - uip_ipaddr(addr.s_addr, 127, 0, 0, 1); - handle = smtp_open(); - if (handle) - { - smtp_configure(handle, g_host_name, &addr.s_addr); - smtp_send(handle, g_recipient, NULL, g_sender, g_subject, - g_msg_body, strlen(g_msg_body)); - smtp_close(handle); - } - return 0; -} diff --git a/apps/examples/serloop/Makefile b/apps/examples/serloop/Makefile index 4a262884b..e1c415cdd 100644 --- a/apps/examples/serloop/Makefile +++ b/apps/examples/serloop/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/serloop/Makefile # -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -74,25 +70,26 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built context: .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ # Register application depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/telnetd/Kconfig b/apps/examples/telnetd/Kconfig deleted file mode 100644 index 11f94a86f..000000000 --- a/apps/examples/telnetd/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_TELNETD - bool "Telnet daemon example" - default n - ---help--- - Enable the Telnet daemon example - -if EXAMPLES_TELNETD -endif diff --git a/apps/examples/telnetd/Makefile b/apps/examples/telnetd/Makefile deleted file mode 100644 index 8f5e5b6d2..000000000 --- a/apps/examples/telnetd/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################ -# apps/examples/telnetd/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# Hello, World! Example - -ASRCS = -CSRCS = shell.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Buttons built-in application info - -APPNAME = telnetd -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/telnetd/README.txt b/apps/examples/telnetd/README.txt deleted file mode 100644 index ebc9684ca..000000000 --- a/apps/examples/telnetd/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -README.txt -^^^^^^^^^^ - -This directory contains a functional port of the tiny uIP shell. In the -NuttX environment, the NuttShell (at apps/nshlib) supercedes this tiny -shell and also supports telnetd. - -This example is retained here for reference purposes only. diff --git a/apps/examples/telnetd/shell.c b/apps/examples/telnetd/shell.c deleted file mode 100644 index 3058daa39..000000000 --- a/apps/examples/telnetd/shell.c +++ /dev/null @@ -1,255 +0,0 @@ -/**************************************************************************** - * examples/telnetd/shell.c - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * This is a leverage of similar logic from uIP: - * - * Author: Adam Dunkels <adam@sics.se> - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * 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 of the Institute 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 INSTITUTE 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 INSTITUTE 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 <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <net/if.h> - -#include <apps/netutils/telnetd.h> -#include <apps/netutils/uiplib.h> - -#include "shell.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -struct ptentry_s -{ - FAR const char *commandstr; - void (*pfunc)(int argc, char **argv); -}; - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static void shell_help(int argc, char **argv); -static void shell_quit(int argc, char **argv); -static void shell_unknown(int argc, char **argv); -static void shell_parse(FAR char *line, int len); - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static struct ptentry_s g_parsetab[] = -{ - {"help", shell_help}, - {"exit", shell_quit}, - {"?", shell_help}, - {NULL, shell_unknown} -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: shell_help - ****************************************************************************/ - -static void shell_help(int argc, char **argv) -{ - printf("Available commands:\n"); - printf(" help, ? - show help\n"); - printf(" exit - exit shell\n"); -} - -/**************************************************************************** - * Name: shell_help - ****************************************************************************/ - -static void shell_unknown(int argc, char **argv) -{ - if (argv[0]) - { - printf("Unknown command: %s\n", argv[0]); - } -} - -/**************************************************************************** - * Name: shell_quit - ****************************************************************************/ - -static void shell_quit(int argc, char **argv) -{ - printf("Bye!\n"); - exit(0); -} - -/**************************************************************************** - * Name: shell_parse - ****************************************************************************/ - -static void shell_parse(FAR char *line, int len) -{ - struct ptentry_s *entry; - FAR char *cmd; - FAR char *saveptr; - - /* Get the command from the beginning the line */ - - cmd = strtok_r(line, " \t\n\r\f\v", &saveptr); - if (cmd) - { - /* Now find the matching command in the command table */ - - for (entry = g_parsetab; entry->commandstr != NULL; entry++) - { - if (strncmp(entry->commandstr, cmd, strlen(entry->commandstr)) == 0) - { - break; - } - } - - entry->pfunc(1, &cmd); - } -} - -/**************************************************************************** - * Name: shell_session - ****************************************************************************/ - -int shell_session(int argc, char *argv[]) -{ - char line[128]; - - printf("uIP command shell -- NuttX style\n"); - printf("Type '?' and return for help\n"); - - for(;;) - { - printf(SHELL_PROMPT); - fflush(stdout); - - if (fgets(line, 128, stdin) == NULL) - { - break; - } - - shell_parse(line, 128); - } - - return 0; -} - -/**************************************************************************** - * Name: shell_netinit - ****************************************************************************/ - -static void shell_netinit(void) -{ - struct in_addr addr; -#ifdef CONFIG_EXAMPLES_TELNETD_NOMAC - uint8_t mac[IFHWADDRLEN]; -#endif - -/* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_TELNETD_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up our host address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_TELNETD_IPADDR); - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_TELNETD_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_TELNETD_NETMASK); - uip_setnetmask("eth0", &addr); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int shell_main(int argc, char *argv[]) -{ - struct telnetd_config_s config; - int ret; - - /* Configure the network */ - - printf("shell_main: Initializing the network\n"); - shell_netinit(); - - /* Configure the telnet daemon */ - - config.d_port = HTONS(23); - config.d_priority = CONFIG_EXAMPLES_TELNETD_DAEMONPRIO; - config.d_stacksize = CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE; - config.t_priority = CONFIG_EXAMPLES_TELNETD_CLIENTPRIO; - config.t_stacksize = CONFIG_EXAMPLES_TELNETD_CLIENTSTACKSIZE; - config.t_entry = shell_session; - - /* Start the telnet daemon */ - - printf("shell_main: Starting the Telnet daemon\n"); - ret = telnetd_start(&config); - if (ret < 0) - { - printf("Failed to tart the Telnet daemon\n"); - } - - printf("shell_main: Exiting\n"); - return 0; -} diff --git a/apps/examples/telnetd/shell.h b/apps/examples/telnetd/shell.h deleted file mode 100644 index 59d51a562..000000000 --- a/apps/examples/telnetd/shell.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** - * apps/examples/telnetd/shell.h - * Interface for the Contiki shell. - * - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 __APPS_EXAMPLES_TELNETD_SHELL_H -#define __APPS_EXAMPLES_TELNETD_SHELL_H - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_EXAMPLES_TELNETD_DAEMONPRIO - Priority of the Telnet daemon. - * Default: SCHED_PRIORITY_DEFAULT - * CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE - Stack size allocated for the - * Telnet daemon. Default: 2048 - * CONFIG_EXAMPLES_TELNETD_CLIENTPRIO- Priority of the Telnet client. - * Default: SCHED_PRIORITY_DEFAULT - * CONFIG_EXAMPLES_TELNETD_CLIENTSTACKSIZE - Stack size allocated for the - * Telnet client. Default: 2048 - * CONFIG_EXAMPLES_TELNETD_NOMAC - If the hardware has no MAC address of its - * own, define this =y to provide a bogus address for testing. - * CONFIG_EXAMPLES_TELNETD_IPADDR - The target IP address. Default 10.0.0.2 - * CONFIG_EXAMPLES_TELNETD_DRIPADDR - The default router address. Default - * 10.0.0.1 - * CONFIG_EXAMPLES_TELNETD_NETMASK - The network mask. Default: 255.255.255.0 - */ - -#ifndef CONFIG_EXAMPLES_TELNETD_DAEMONPRIO -# define CONFIG_EXAMPLES_TELNETD_DAEMONPRIO SCHED_PRIORITY_DEFAULT -#endif - -#ifndef CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE -# define CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE 2048 -#endif - -#ifndef CONFIG_EXAMPLES_TELNETD_CLIENTPRIO -# define CONFIG_EXAMPLES_TELNETD_CLIENTPRIO SCHED_PRIORITY_DEFAULT -#endif - -#ifndef CONFIG_EXAMPLES_TELNETD_CLIENTSTACKSIZE -# define CONFIG_EXAMPLES_TELNETD_CLIENTSTACKSIZE 2048 -#endif - -#ifndef CONFIG_EXAMPLES_TELNETD_IPADDR -# define CONFIG_EXAMPLES_TELNETD_IPADDR 0x0a000002 -#endif -#ifndef CONFIG_EXAMPLES_TELNETD_DRIPADDR -# define CONFIG_EXAMPLES_TELNETD_DRIPADDR 0x0a000002 -#endif -#ifndef CONFIG_EXAMPLES_TELNETD_NETMASK -# define CONFIG_EXAMPLES_TELNETD_NETMASK 0xffffff00 -#endif - -/* Other definitions ********************************************************/ - -#define SHELL_PROMPT "uIP 1.0> " - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __APPS_EXAMPLES_TELNETD_SHELL_H */ diff --git a/apps/examples/thttpd/Kconfig b/apps/examples/thttpd/Kconfig deleted file mode 100644 index d5802f531..000000000 --- a/apps/examples/thttpd/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_THTTPD - bool "THTTPD web server example" - default n - ---help--- - Enable the THTTPD web server example - -if EXAMPLES_THTTPD -endif diff --git a/apps/examples/thttpd/Makefile b/apps/examples/thttpd/Makefile deleted file mode 100644 index 85a26d39f..000000000 --- a/apps/examples/thttpd/Makefile +++ /dev/null @@ -1,101 +0,0 @@ -############################################################################ -# apps/examples/thttpd/Makefile -# -# Copyright (C) 2009-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# THTTPD Web Server Example - -ASRCS = -CSRCS = thttpd_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: headers clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -headers: - @$(MAKE) -C content TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) - -.built: headers $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - @$(MAKE) -C content clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/thttpd/content/Makefile b/apps/examples/thttpd/content/Makefile deleted file mode 100644 index b4deddef5..000000000 --- a/apps/examples/thttpd/content/Makefile +++ /dev/null @@ -1,106 +0,0 @@ -############################################################################ -# apps/examples/thttpd/content/Makefile -# -# Copyright (C) 2009, 2011 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. -# -############################################################################ - -SUBDIRS = hello tasks netstat -INSTALL_FILES = index.html style.css - -THTTPD_DIR = $(APPDIR)/examples/thttpd -CONTENT_DIR = $(THTTPD_DIR)/content -ROMFS_DIR = $(CONTENT_DIR)/romfs -ROMFS_IMG = $(CONTENT_DIR)/romfs.img -ROMFS_HDR = $(CONTENT_DIR)/romfs.h -ROMFSCGI_DIR = $(ROMFS_DIR)/cgi-bin -SYMTAB = $(CONTENT_DIR)/symtab.h - -define DIR_template -$(1)_$(2): - @$(MAKE) -C $(1) $(3) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) CGI_DIR="$(ROMFSCGI_DIR)" -endef - -all: $(ROMFS_HDR) $(SYMTAB) -.PHONY: all build clean install populate - -$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),build, all))) -$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),clean,clean))) -$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),install,install))) - -# Build program(s) in each sud-directory - -build: $(foreach DIR, $(SUBDIRS), $(DIR)_build) - -# Install each program in the romfs directory - -install: $(foreach DIR, $(SUBDIRS), $(DIR)_install) - @( for file in $(INSTALL_FILES); do\ - install -m 0644 -D $${file} $(ROMFS_DIR)/$${file}; \ - done; ) - -# Create the romfs directory - -$(ROMFS_DIR): - @mkdir -p $(ROMFS_DIR) - -$(ROMFSCGI_DIR): $(ROMFS_DIR) - @mkdir -p $(ROMFSCGI_DIR) - -# Populate the romfs directory - -populate: $(ROMFSCGI_DIR) build install - -# Create the romfs.img file from the populated romfs directory - -$(ROMFS_IMG): populate - @genromfs -f $@ -d $(ROMFS_DIR) -V "THTTPDTEST" - -# Create the romfs.h header file from the romfs.img file - -$(ROMFS_HDR) : $(ROMFS_IMG) - @(cd $(CONTENT_DIR); xxd -i romfs.img | sed -e "s/^unsigned/static const unsigned/g" >$@) - -# Create the exported symbol table list from the derived *-thunk.S files - -$(SYMTAB): build - @$(CONTENT_DIR)/mksymtab.sh $(CONTENT_DIR) >$@ - -# Clean each subdirectory - -clean: $(foreach DIR, $(SUBDIRS), $(DIR)_clean) - $(call DELFILE$(ROMFS_HDR)) - $(call DELFILE, $(ROMFS_IMG)) - $(call DELFILE, $(SYMTAB)) - @rm -rf $(ROMFS_DIR) - $(call CLEAN) - - diff --git a/apps/examples/thttpd/content/hello/Makefile b/apps/examples/thttpd/content/hello/Makefile deleted file mode 100644 index 2cdead59c..000000000 --- a/apps/examples/thttpd/content/hello/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################ -# examples/thttpd/content/hello/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = hello - -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -m 0755 -D $(BIN) $(CGI_DIR)/$(BIN) - diff --git a/apps/examples/thttpd/content/hello/hello.c b/apps/examples/thttpd/content/hello/hello.c deleted file mode 100644 index 386759fc2..000000000 --- a/apps/examples/thttpd/content/hello/hello.c +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** - * examples/thttpd/content/hello/hello.c - * Manatory "Hello, World!" Example - * - * Copyright (C) 2009 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 Gregory Nutt 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 <stdio.h> -#include <stdlib.h> - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char *argv[]) -{ - fprintf(stderr, "Hello requested from: %s\n", getenv("REMOTE_ADDR")); - - puts( - "Content-type: text/html\r\n" - "Status: 200/html\r\n" - "\r\n" - "<html>\r\n" - "<head>\r\n" - "<title>Hello!</title>\r\n" - "<link rel=\"stylesheet\" type=\"text/css\" href=\"/style.css\">\r\n" - "</head>\r\n" - "<body bgcolor=\"#fffeec\" text=\"black\">\r\n" - "<div class=\"menu\">\r\n" - "<div class=\"menubox\"><a href=\"/index.html\">Front page</a></div>\r\n" - "<div class=\"menubox\"><a href=\"hello\">Say Hello</a></div>\r\n" - "<div class=\"menubox\"><a href=\"tasks\">Tasks</a></div>\r\n" - "<div class=\"menubox\"><a href=\"netstat\">Network status</a></div>\r\n" - "<br>\r\n" - "</div>\r\n" - "<div class=\"contentblock\">\r\n"); - printf( - "<h2>Hello, World!</h2><p>Requested by: %s</p>\r\n", - getenv("REMOTE_ADDR")); - puts( - "</body>\r\n" - "</html>\r\n"); - return 0; -} diff --git a/apps/examples/thttpd/content/index.html b/apps/examples/thttpd/content/index.html deleted file mode 100644 index 1fba1fbf6..000000000 --- a/apps/examples/thttpd/content/index.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> - <head> - <title>NuttX examples/thttpd</title> - <link rel="stylesheet" type="text/css" href="style.css"> - </head> - <body bgcolor="#fffeec" text="black"> - - <div class="menu"> - <div class="menubox"><a href="index.html">Front page</a></div> - <div class="menubox"><a href="cgi-bin/hello">Say Hello</a></div> - <div class="menubox"><a href="cgi-bin/tasks">Tasks</a></div> - <div class="menubox"><a href="cgi-bin/netstat">Network status</a></div> - <br> - </div> - - <div class="contentblock"> - <p> - These web pages are served by a port of <a href="http://acme.com/software/thttpd/">THTTPD</a> - running on top of <a href="http://www.nuttx.org">NuttX</a>. - NuttX includes a port of the <a href="http://www.sics.se/~adam/uip/">uIP</a> embedded TCP/IP stack. - </p> - <p> - Click on the links above to exercise THTTPD's CGI capability under NuttX. - Clicking the links will execute the CGI program from an - <a href="http://nuttx.sourceforge.net/NuttXNxFlat.html">NXFLAT</a> program residing - in a ROMFS file system. - </p> - </body> -</html> diff --git a/apps/examples/thttpd/content/mksymtab.sh b/apps/examples/thttpd/content/mksymtab.sh deleted file mode 100755 index 4b5347f17..000000000 --- a/apps/examples/thttpd/content/mksymtab.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -usage="Usage: %0 <test-dir-path>" - -dir=$1 -if [ -z "$dir" ]; then - echo "ERROR: Missing <test-dir-path>" - echo "" - echo $usage - exit 1 -fi - -if [ ! -d "$dir" ]; then - echo "ERROR: Directory $dir does not exist" - echo "" - echo $usage - exit 1 -fi - -varlist=`find $dir -name "*-thunk.S"| xargs grep -h asciz | cut -f3 | sort | uniq` - -echo "#ifndef __EXAMPLES_NXFLAT_TESTS_SYMTAB_H" -echo "#define __EXAMPLES_NXFLAT_TESTS_SYMTAB_H" -echo "" -echo "#include <nuttx/binfmt/symtab.h>" -echo "" -echo "static const struct symtab_s exports[] = " -echo "{" - -for string in $varlist; do - var=`echo $string | sed -e "s/\"//g"` - echo " {$string, $var}," -done - -echo "};" -echo "#define NEXPORTS (sizeof(exports)/sizeof(struct symtab_s))" -echo "" -echo "#endif /* __EXAMPLES_NXFLAT_TESTS_SYMTAB_H */" - diff --git a/apps/examples/thttpd/content/netstat/Makefile b/apps/examples/thttpd/content/netstat/Makefile deleted file mode 100644 index 98675bd88..000000000 --- a/apps/examples/thttpd/content/netstat/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################ -# examples/thttpd/content/netstat/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = netstat - -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -m 0755 -D $(BIN) $(CGI_DIR)/$(BIN) - diff --git a/apps/examples/thttpd/content/netstat/netstat.c b/apps/examples/thttpd/content/netstat/netstat.c deleted file mode 100644 index 9aec0c81c..000000000 --- a/apps/examples/thttpd/content/netstat/netstat.c +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** - * examples/thttpd/netstat/netstat.c - * - * Copyright (C) 2009, 2011 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include <netinet/ether.h> -#include <nuttx/net/uip/uipopt.h> -#include <nuttx/net/uip/uip-arch.h> - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/* NOTEs: - * - * 1. One limitation in the use of NXFLAT is that functions that are - * referenced as a pointer-to-a-function must have global scope. Otherwise - * ARM GCC will generate some bad logic. - * 2. In general, when called back, there is no guarantee to that PIC registers - * will be valid and, unless you take special precautions, it could be - * dangerous to reference global variables in the callback function. - */ - -/* static */ int netdev_callback(FAR struct uip_driver_s *dev, void *arg) -{ - struct in_addr addr; - - printf(" <dt>%s\r\n", dev->d_ifname); -#ifdef CONFIG_NET_ETHERNET - printf(" <dd>HWaddr: %s<br>\r\n", ether_ntoa(&dev->d_mac)); -#endif - addr.s_addr = dev->d_ipaddr; - printf(" IPaddr: %s<br>\r\n", inet_ntoa(addr)); - addr.s_addr = dev->d_draddr; - printf(" DRaddr: %s<br>\r\n", inet_ntoa(addr)); - addr.s_addr = dev->d_netmask; - printf(" Mask: %s\r\n", inet_ntoa(addr)); - return OK; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char *argv[]) -{ - puts( - "Content-type: text/html\r\n" - "Status: 200/html\r\n" - "\r\n" - "<html>\r\n" - "<head>\r\n" - "<title>Network Status</title>\r\n" - "<link rel=\"stylesheet\" type=\"text/css\" href=\"/style.css\">\r\n" - "</head>\r\n" - "<body bgcolor=\"#fffeec\" text=\"black\">\r\n" - "<div class=\"menu\">\r\n" - "<div class=\"menubox\"><a href=\"/index.html\">Front page</a></div>\r\n" - "<div class=\"menubox\"><a href=\"hello\">Say Hello</a></div>\r\n" - "<div class=\"menubox\"><a href=\"tasks\">Tasks</a></div>\r\n" - "<div class=\"menubox\"><a href=\"netstat\">Network status</a></div>\r\n" - "<br>\r\n" - "</div>\r\n" - "<div class=\"contentblock\">\r\n" - "<dl>\r\n"); - - netdev_foreach(netdev_callback, NULL); - - puts( - "</dl>\r\n" - "</body>\r\n" - "</html>\r\n"); - return 0; -} diff --git a/apps/examples/thttpd/content/style.css b/apps/examples/thttpd/content/style.css deleted file mode 100644 index bfb0997a8..000000000 --- a/apps/examples/thttpd/content/style.css +++ /dev/null @@ -1,80 +0,0 @@ -h1 -{ - text-align: center; - font-size:14pt; - font-family:arial,helvetica; - font-weight:bold; - padding:10px; -} - -body -{ - background-color: #fffeec; - color:black; - font-size:8pt; - font-family:arial,helvetica; -} - -.menu -{ - margin: 4px; - width:60%; - padding:2px; - border: solid 1px; - background-color: #fffcd2; - text-align:left; - font-size:9pt; - font-family:arial,helvetica; -} - -div.menubox -{ - width: 25%; - border: 0; - float: left; - text-align: center; -} - -.contentblock -{ - margin: 4px; - width:60%; - padding:2px; - border: 1px dotted; - background-color: white; - font-size:8pt; - font-family:arial,helvetica; -} - -p.intro -{ - margin-left:20px; - margin-right:20px; - font-size:10pt; - font-family:arial,helvetica; -} - -p.clink -{ - font-size:12pt; - font-family:courier,monospace; - text-align:center; -} - -p.clink9 -{ - font-size:9pt; - font-family:courier,monospace; - text-align:center; -} - -p -{ - padding-left:10px; -} - -p.right -{ - text-align:right; -} - diff --git a/apps/examples/thttpd/content/tasks/Makefile b/apps/examples/thttpd/content/tasks/Makefile deleted file mode 100644 index bf9811524..000000000 --- a/apps/examples/thttpd/content/tasks/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -############################################################################ -# examples/thttpd/content/tasks/Makefile -# -# Copyright (C) 2009 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. -# -############################################################################ - --include $(TOPDIR)/Make.defs - -BIN = tasks - -R1SRCS = $(BIN).c -R1OBJS = $(R1SRCS:.c=.o) - -R2SRC = $(BIN)-thunk.S -R2OBJ = $(R2SRC:.S=.o) - -all: $(BIN) - -$(R1OBJS): %.o: %.c - @echo "CC: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(R2OBJ): %.o: %.S - @echo "AS: $<" - $(Q) $(CC) -c $(CPICFLAGS) $< -o $@ - -$(BIN).r1: $(R1OBJS) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS1) -o $@ $^ - -$(R2SRC): $(BIN).r1 - @echo "MK: $<" - $(Q) $(MKNXFLAT) -o $@ $^ - -$(BIN).r2: $(R2OBJ) - @echo "LD: $<" - $(Q) $(LD) $(NXFLATLDFLAGS2) -o $@ $(R1OBJS) $(R2OBJ) - -$(BIN): $(BIN).r2 - @echo "LD: $<" - $(Q) $(LDNXFLAT) $(LDNXFLATFLAGS) -o $@ $^ - -clean: - $(call DELFILE, $(BIN)) - $(call DELFILE, $(R2SRC)) - $(call DELFILE, *.r1) - $(call DELFILE, *.r2) - $(call CLEAN) - -install: - $(Q) install -m 0755 -D $(BIN) $(CGI_DIR)/$(BIN) - diff --git a/apps/examples/thttpd/content/tasks/tasks.c b/apps/examples/thttpd/content/tasks/tasks.c deleted file mode 100644 index e2eedf781..000000000 --- a/apps/examples/thttpd/content/tasks/tasks.c +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************************** - * examples/thttpd/tasks/tasks.c - * - * Copyright (C) 2009, 2011 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sched.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const char *g_statenames[] = -{ - "INVALID ", - "PENDING ", - "READY ", - "RUNNING ", - "INACTIVE", - "WAITSEM ", -#ifndef CONFIG_DISABLE_MQUEUE - "WAITSIG ", -#endif -#ifndef CONFIG_DISABLE_MQUEUE - "MQNEMPTY", - "MQNFULL " -#endif -}; - -static const char *g_ttypenames[4] = -{ - "TASK ", - "PTHREAD", - "KTHREAD", - "--?-- " -}; - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/* NOTEs: - * - * 1. One limitation in the use of NXFLAT is that functions that are - * referenced as a pointer-to-a-function must have global scope. Otherwise - * ARM GCC will generate some bad logic. - * 2. In general, when called back, there is no guarantee to that PIC registers - * will be valid and, unless you take special precautions, it could be - * dangerous to reference global variables in the callback function. - */ - -/* static */ void show_task(FAR _TCB *tcb, FAR void *arg) -{ - int i; - - /* Show task status */ - - printf("%5d %3d %4s %7s%c%c %8s ", - tcb->pid, tcb->sched_priority, - tcb->flags & TCB_FLAG_ROUND_ROBIN ? "RR " : "FIFO", - g_ttypenames[(tcb->flags & TCB_FLAG_TTYPE_MASK) >> TCB_FLAG_TTYPE_SHIFT], - tcb->flags & TCB_FLAG_NONCANCELABLE ? 'N' : ' ', - tcb->flags & TCB_FLAG_CANCEL_PENDING ? 'P' : ' ', - g_statenames[tcb->task_state]); - - /* Show task name and arguments */ - - printf("%s(", tcb->argv[0]); - - /* Special case 1st argument (no comma) */ - - if (tcb->argv[1]) - { - printf("%p", tcb->argv[1]); - } - - /* Then any additional arguments */ - -#if CONFIG_MAX_TASK_ARGS > 2 - for (i = 2; i <= CONFIG_MAX_TASK_ARGS && tcb->argv[i]; i++) - { - printf(", %p", tcb->argv[i]); - } -#endif - printf(")\n"); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -int main(int argc, char *argv[]) -{ - puts( - "Content-type: text/html\r\n" - "Status: 200/html\r\n" - "\r\n" - "<html>\r\n" - "<head>\r\n" - "<title>NuttX Tasks</title>\r\n" - "<link rel=\"stylesheet\" type=\"text/css\" href=\"/style.css\">\r\n" - "</head>\r\n" - "<body bgcolor=\"#fffeec\" text=\"black\">\r\n" - "<div class=\"menu\">\r\n" - "<div class=\"menubox\"><a href=\"/index.html\">Front page</a></div>\r\n" - "<div class=\"menubox\"><a href=\"hello\">Say Hello</a></div>\r\n" - "<div class=\"menubox\"><a href=\"tasks\">Tasks</a></div>\r\n" - "<div class=\"menubox\"><a href=\"netstat\">Network status</a></div>\r\n" - "<br>\r\n" - "</div>\r\n" - "<div class=\"contentblock\">\r\n" - "<pre>\r\n" - "PID PRI SCHD TYPE NP STATE NAME\r\n"); - - sched_foreach(show_task, NULL); - - puts( - "</pre>\r\n" - "</body>\r\n" - "</html>\r\n"); - return 0; -} diff --git a/apps/examples/thttpd/thttpd_main.c b/apps/examples/thttpd/thttpd_main.c deleted file mode 100644 index 97f922a76..000000000 --- a/apps/examples/thttpd/thttpd_main.c +++ /dev/null @@ -1,267 +0,0 @@ -/**************************************************************************** - * examples/thttpd/thttpd_main.c - * - * Copyright (C) 2009-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 Gregory Nutt 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/ioctl.h> -#include <sys/mount.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <errno.h> -#include <debug.h> - -#include <net/if.h> -#include <netinet/ether.h> - -#include <nuttx/net/uip/uip-arp.h> -#include <apps/netutils/uiplib.h> -#include <apps/netutils/thttpd.h> - -#include <nuttx/ramdisk.h> -#include <nuttx/binfmt/binfmt.h> -#include <nuttx/binfmt/nxflat.h> -#ifdef CONFIG_NET_SLIP -# include <nuttx/net/net.h> -#endif - -#include "content/romfs.h" -#include "content/symtab.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/* Check configuration. This is not all of the configuration settings that - * are required -- only the more obvious. - */ - -#if CONFIG_NFILE_DESCRIPTORS < 1 -# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" -#endif - -#ifndef CONFIG_NXFLAT -# error "You must select CONFIG_NXFLAT in your configuration file" -#endif - -#ifndef CONFIG_FS_ROMFS -# error "You must select CONFIG_FS_ROMFS in your configuration file" -#endif - -#ifdef CONFIG_DISABLE_MOUNTPOINT -# error "You must not disable mountpoints via CONFIG_DISABLE_MOUNTPOINT in your configuration file" -#endif - -#ifdef CONFIG_BINFMT_DISABLE -# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file" -#endif - -/* SLIP-specific configuration */ - -#ifdef CONFIG_NET_SLIP - - /* No MAC address operations */ - -# undef CONFIG_EXAMPLES_THTTPD_NOMAC - - /* TTY device to use */ - -# ifndef CONFIG_NET_SLIPTTY -# define CONFIG_NET_SLIPTTY "/dev/ttyS1" -# endif - -# define SLIP_DEVNO 0 -# define NET_DEVNAME "sl0" -#else - - /* Otherwise, use the standard ethernet device name */ - -# define NET_DEVNAME "eth0" -#endif - -/* Describe the ROMFS file system */ - -#define SECTORSIZE 512 -#define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE) -#define ROMFSDEV "/dev/ram0" -#define MOUNTPT CONFIG_THTTPD_PATH - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# define msgflush() -# else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define msgflush() -# else -# define message printf -# define msgflush() fflush(stdout) -# endif -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* These values must be provided by the user before the THTTPD task daemon - * is started: - * - * g_thttpdsymtab: A symbol table describing all of the symbols exported - * from the base system. These symbols are used to bind address references - * in CGI programs to NuttX. - * g_nsymbols: The number of symbols in g_thttpdsymtab[]. - */ - -FAR const struct symtab_s *g_thttpdsymtab; -int g_thttpdnsymbols; - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * thttp_main - ****************************************************************************/ - -int thttp_main(int argc, char *argv[]) -{ - struct in_addr addr; -#ifdef CONFIG_EXAMPLES_THTTPD_NOMAC - uint8_t mac[IFHWADDRLEN]; -#endif - char *thttpd_argv = "thttpd"; - int ret; - - /* Configure SLIP */ - -#ifdef CONFIG_NET_SLIP - ret = slip_initialize(SLIP_DEVNO, CONFIG_NET_SLIPTTY); - if (ret < 0) - { - message("ERROR: SLIP initialization failed: %d\n", ret); - exit(1); - } -#endif - -/* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_THTTPD_NOMAC - message("Assigning MAC\n"); - - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr(NET_DEVNAME, mac); -#endif - - /* Set up our host address */ - - message("Setup network addresses\n"); - addr.s_addr = HTONL(CONFIG_THTTPD_IPADDR); - uip_sethostaddr(NET_DEVNAME, &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_THTTPD_DRIPADDR); - uip_setdraddr(NET_DEVNAME, &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_THTTPD_NETMASK); - uip_setnetmask(NET_DEVNAME, &addr); - - /* Initialize the NXFLAT binary loader */ - - message("Initializing the NXFLAT binary loader\n"); - ret = nxflat_initialize(); - if (ret < 0) - { - message("ERROR: Initialization of the NXFLAT loader failed: %d\n", ret); - exit(2); - } - - /* Create a ROM disk for the ROMFS filesystem */ - - message("Registering romdisk\n"); - ret = romdisk_register(0, (uint8_t*)romfs_img, NSECTORS(romfs_img_len), SECTORSIZE); - if (ret < 0) - { - message("ERROR: romdisk_register failed: %d\n", ret); - nxflat_uninitialize(); - exit(1); - } - - /* Mount the file system */ - - message("Mounting ROMFS filesystem at target=%s with source=%s\n", - MOUNTPT, ROMFSDEV); - - ret = mount(ROMFSDEV, MOUNTPT, "romfs", MS_RDONLY, NULL); - if (ret < 0) - { - message("ERROR: mount(%s,%s,romfs) failed: %s\n", - ROMFSDEV, MOUNTPT, errno); - nxflat_uninitialize(); - } - - /* Start THTTPD. At present, symbol table info is passed via global variables */ - - g_thttpdsymtab = exports; - g_thttpdnsymbols = NEXPORTS; - - message("Starting THTTPD\n"); - msgflush(); - thttpd_main(1, &thttpd_argv); - message("THTTPD terminated\n"); - msgflush(); - return 0; -} diff --git a/apps/examples/tiff/Kconfig b/apps/examples/tiff/Kconfig deleted file mode 100644 index f3c5c4ebe..000000000 --- a/apps/examples/tiff/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_TIFF - bool "TIFF file generation example" - default n - ---help--- - Enable the TIFF file generation example - -if EXAMPLES_TIFF -endif diff --git a/apps/examples/tiff/Makefile b/apps/examples/tiff/Makefile deleted file mode 100644 index f62209931..000000000 --- a/apps/examples/tiff/Makefile +++ /dev/null @@ -1,111 +0,0 @@ -############################################################################ -# apps/examples/tiff/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# TIFF Unit Test - -ASRCS = -CSRCS = tiff_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# TIFF built-in application info - -APPNAME = tiff -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_EXAMPLES_TIFF_BUILTIN),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call DELFILE, result.tif) - $(call DELFILE, tmpfile1.dat) - $(call DELFILE, tmpfile2.dat) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/tiff/tiff_main.c b/apps/examples/tiff/tiff_main.c deleted file mode 100644 index 1bf931a43..000000000 --- a/apps/examples/tiff/tiff_main.c +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** - * apps/graphics/tiff/tiff_main.c - * - * Copyright (C) 2011 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 <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <errno.h> - -#include <apps/tiff.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* This is a simple unit test for the TIFF creation library at apps/graphic/tiff. - * It is configured to work in the Linux user-mode simulation and has not been - * tested in any other environment. Since the example also depends on some - * other logic to mount a file system, currently it will only work as an NSH - * built-on, i.e., if the following is defined: - * - * CONFIG_NSH_BUILTIN_APPS=y - * CONFIG_EXAMPLES_TIFF_BUILTIN=y - * - * Other configuration options: - * - * CONFIG_EXAMPLES_TIFF_OUTFILE - Name of the resulting TIFF file - * CONFIG_EXAMPLES_TIFF_TMPFILE1/2 - Names of two temporaries files that - * will be used in the file creation. - */ - -#ifndef CONFIG_EXAMPLES_TIFF_OUTFILE -# define CONFIG_EXAMPLES_TIFF_OUTFILE "/tmp/result.tif" -#endif - -#ifndef CONFIG_EXAMPLES_TIFF_TMPFILE1 -# define CONFIG_EXAMPLES_TIFF_TMPFILE1 "/tmp/tmpfile1.dat" -#endif - -#ifndef CONFIG_EXAMPLES_TIFF_TMPFILE2 -# define CONFIG_EXAMPLES_TIFF_TMPFILE2 "/tmp/tmpfile2.dat" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: tiff_main - * - * Description: - * TIFF unit test. - * - ****************************************************************************/ - -int tiff_main(int argc, char *argv[]) -{ - struct tiff_info_s info; - uint8_t strip[3*256]; - uint8_t *ptr; - int green; - int blue; - int ret; - - /* Configure the interface structure */ - - memset(&info, 0, sizeof(struct tiff_info_s)); - info.outfile = CONFIG_EXAMPLES_TIFF_OUTFILE; - info.tmpfile1 = CONFIG_EXAMPLES_TIFF_TMPFILE1; - info.tmpfile2 = CONFIG_EXAMPLES_TIFF_TMPFILE2; - info.colorfmt = FB_FMT_RGB24; - info.rps = 1; - info.imgwidth = 256; - info.imgheight = 256; - info.iobuffer = (uint8_t *)malloc(300); - info.iosize = 300; - - /* Initialize the TIFF library */ - - ret = tiff_initialize(&info); - if (ret < 0) - { - printf("tiff_initialize() failed: %d\n", ret); - exit(1); - } - - /* Add each strip to the TIFF file */ - - for (green = 0, ptr = strip; green < 256; green++) - { - ptr = strip; - for (blue = 0; blue < 256; blue++) - { - *ptr++ = (green + blue) >> 1; - *ptr++ = green; - *ptr++ = blue; - } - - ret = tiff_addstrip(&info, strip); - if (ret < 0) - { - printf("tiff_addstrip() #%d failed: %d\n", green, ret); - exit(1); - } - } - - /* Then finalize the TIFF file */ - - ret = tiff_finalize(&info); - if (ret < 0) - { - printf("tiff_finalize() failed: %d\n", ret); - exit(1); - } - return 0; -} diff --git a/apps/examples/touchscreen/Kconfig b/apps/examples/touchscreen/Kconfig deleted file mode 100644 index e8d8728d8..000000000 --- a/apps/examples/touchscreen/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_TOUCHSCREEN - bool "Touchscreen example" - default n - ---help--- - Enable the touchscreen example - -if EXAMPLES_TOUCHSCREEN -endif diff --git a/apps/examples/touchscreen/Makefile b/apps/examples/touchscreen/Makefile deleted file mode 100644 index b3943951e..000000000 --- a/apps/examples/touchscreen/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################ -# apps/examples/touchscreen/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# NuttX NX Graphics Example. - -ASRCS = -CSRCS = tc_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Touchscreen built-in application info - -APPNAME = tc -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/touchscreen/tc.h b/apps/examples/touchscreen/tc.h deleted file mode 100644 index 654b1d874..000000000 --- a/apps/examples/touchscreen/tc.h +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** - * examples/touchscreen/tc.h - * - * Copyright (C) 2011 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 __APPS_EXAMPLES_TOUCHSCREEN_TC_H -#define __APPS_EXAMPLES_TOUCHSCREEN_TC_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ -/* CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN - Build the touchscreen test as - * an NSH built-in function. Default: Built as a standalone problem - * CONFIG_EXAMPLES_TOUCHSCREEN_MINOR - The minor device number. Minor=N - * correspnds to touchscreen device /dev/input0. Note this value must - * with CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH. Default 0. - * CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH - The path to the touchscreen - * device. This must be consistent with CONFIG_EXAMPLES_TOUCHSCREEN_MINOR. - * Default: "/dev/input0" - * CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES - If CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN - * is defined, then the number of samples is provided on the command line - * and this value is ignored. Otherwise, this number of samples is - * collected and the program terminates. Default: Samples are collected - * indefinitely. - */ - -#ifndef CONFIG_INPUT -# error "Input device support is not enabled (CONFIG_INPUT)" -#endif - -#ifndef CONFIG_EXAMPLES_TOUCHSCREEN_MINOR -# undef CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH -# define CONFIG_EXAMPLES_TOUCHSCREEN_MINOR 0 -# define CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH "/dev/input0" -#endif - -#ifndef CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH -# undef CONFIG_EXAMPLES_TOUCHSCREEN_MINOR -# define CONFIG_EXAMPLES_TOUCHSCREEN_MINOR 0 -# define CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH "/dev/input0" -#endif - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_rawprintf(__VA_ARGS__) -# define msgflush() -# else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_rawprintf -# define msgflush() -# else -# define message printf -# define msgflush() fflush(stdout) -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#endif /* __APPS_EXAMPLES_TOUCHSCREEN_TC_H */ diff --git a/apps/examples/touchscreen/tc_main.c b/apps/examples/touchscreen/tc_main.c deleted file mode 100644 index 79b6b65a3..000000000 --- a/apps/examples/touchscreen/tc_main.c +++ /dev/null @@ -1,208 +0,0 @@ -/**************************************************************************** - * examples/touchscreen/tc_main.c - * - * Copyright (C) 2011 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/input/touchscreen.h> - -#include "tc.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: tc_main - ****************************************************************************/ - -int tc_main(int argc, char *argv[]) -{ - struct touch_sample_s sample; - ssize_t nbytes; -#if defined(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN) || defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES) - long nsamples; -#endif - int fd; - int errval = 0; - int ret; - - /* If this example is configured as an NX add-on, then limit the number of - * samples that we collect before returning. Otherwise, we never return - */ - -#if defined(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN) - nsamples = 1; - if (argc > 1) - { - nsamples = strtol(argv[1], NULL, 10); - } - message("tc_main: nsamples: %d\n", nsamples); -#elif defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES) - message("tc_main: nsamples: %d\n", CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES); -#endif - - /* Initialization of the touchscreen hardware is performed by logic - * external to this test. - */ - - message("tc_main: Initializing external touchscreen device\n"); - ret = arch_tcinitialize(CONFIG_EXAMPLES_TOUCHSCREEN_MINOR); - if (ret != OK) - { - message("tc_main: arch_tcinitialize failed: %d\n", ret); - errval = 1; - goto errout; - } - - /* Open the touchscreen device for reading */ - - message("tc_main: Opening %s\n", CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH); - fd = open(CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, O_RDONLY); - if (fd < 0) - { - message("tc_main: open %s failed: %d\n", - CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errno); - errval = 2; - goto errout_with_tc; - } - - /* Now loop the appropriate number of times, displaying the collected - * touchscreen samples. - */ - -#if defined(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN) - for (; nsamples > 0; nsamples--) -#elif defined(CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES) - for (nsamples = 0; nsamples < CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES; nsamples++) -#else - for (;;) -#endif - { - /* Flush any output before the loop entered or from the previous pass - * through the loop. - */ - - msgflush(); - - /* Read one sample */ - - ivdbg("Reading...\n"); - nbytes = read(fd, &sample, sizeof(struct touch_sample_s)); - ivdbg("Bytes read: %d\n", nbytes); - - /* Handle unexpected return values */ - - if (nbytes < 0) - { - errval = errno; - if (errval != EINTR) - { - message("tc_main: read %s failed: %d\n", - CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH, errval); - errval = 3; - goto errout_with_dev; - } - - message("tc_main: Interrupted read...\n"); - } - else if (nbytes != sizeof(struct touch_sample_s)) - { - message("tc_main: Unexpected read size=%d, expected=%d, Ignoring\n", - nbytes, sizeof(struct touch_sample_s)); - } - - /* Print the sample data on successful return */ - - else - { - message("Sample :\n"); - message(" npoints : %d\n", sample.npoints); - message("Point 1 :\n"); - message(" id : %d\n", sample.point[0].id); - message(" flags : %02x\n", sample.point[0].flags); - message(" x : %d\n", sample.point[0].x); - message(" y : %d\n", sample.point[0].y); - message(" h : %d\n", sample.point[0].h); - message(" w : %d\n", sample.point[0].w); - message(" pressure : %d\n", sample.point[0].pressure); - } - } - -errout_with_dev: - close(fd); -errout_with_tc: - arch_tcuninitialize(); -errout: - message("Terminating!\n"); - msgflush(); - return errval; -} diff --git a/apps/examples/udp/Kconfig b/apps/examples/udp/Kconfig deleted file mode 100644 index 24df27375..000000000 --- a/apps/examples/udp/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_UDP - bool "UDP example" - default n - ---help--- - Enable the UDP example - -if EXAMPLES_UDP -endif diff --git a/apps/examples/udp/Makefile b/apps/examples/udp/Makefile deleted file mode 100644 index 9c35cc94f..000000000 --- a/apps/examples/udp/Makefile +++ /dev/null @@ -1,129 +0,0 @@ -############################################################################ -# apps/examples/udp/Makefile -# -# Copyright (C) 2007-2008, 2011-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# UDP Test - -TARG_ASRCS = - -TARG_CSRCS = target.c -ifeq ($(CONFIG_EXAMPLES_UDP_SERVER),y) -TARG_CSRCS += udp-server.c -else -TARG_CSRCS += udp-client.c -endif - -TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT)) -TARG_COBJS = $(TARG_CSRCS:.c=$(OBJEXT)) - -TARG_SRCS = $(TARG_ASRCS) $(TARG_CSRCS) -TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - TARG_BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - TARG_BIN = ..\\..\\libapps$(LIBEXT) -else - TARG_BIN = ../../libapps$(LIBEXT) -endif -endif - -HOSTCFLAGS += -DCONFIG_EXAMPLES_UDP_HOST=1 -ifeq ($(CONFIG_EXAMPLES_UDP_SERVER),y) -HOSTCFLAGS += -DCONFIG_EXAMPLES_UDP_SERVER=1 \ - -DCONFIG_EXAMPLES_UDP_SERVERIP="$(CONFIG_EXAMPLES_UDP_SERVERIP)" -endif - -HOST_SRCS = host.c -ifeq ($(CONFIG_EXAMPLES_UDP_SERVER),y) -HOST_SRCS += udp-client.c -else -HOST_SRCS += udp-server.c -endif - -HOST_OBJS = $(HOST_SRCS:.c=.o) -HOST_BIN = host - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(TARG_AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(TARG_COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -"$(TARG_BIN)": $(TARG_OBJS) $(HOST_BIN) - $(call ARCHIVE, $@, $(TARG_OBJS)) - -$(HOST_OBJS): %.o: %.c - $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ - -$(HOST_BIN): $(HOST_OBJS) - $(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@ - -.built: $(TARG_BIN) $(HOST_BIN) - @touch .built - -context: - -.depend: Makefile $(TARG_SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(TARG_SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call DELFILE, $(TARG_BIN)) - $(call DELFILE, $(HOST_BIN)) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/udp/host.c b/apps/examples/udp/host.c deleted file mode 100644 index e103acd8c..000000000 --- a/apps/examples/udp/host.c +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** - * examples/udp/host.c - * - * Copyright (C) 2007 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 Gregory Nutt 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 "udp-internal.h" - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * main - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ -#ifdef CONFIG_EXAMPLES_UDP_SERVER - send_client(); -#else - recv_server(); -#endif - - return 0; -} diff --git a/apps/examples/udp/target.c b/apps/examples/udp/target.c deleted file mode 100644 index d7b64638d..000000000 --- a/apps/examples/udp/target.c +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** - * examples/udp/nettest.c - * - * Copyright (C) 2007, 2011 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 <stdio.h> -#include <debug.h> - -#include <nuttx/net/uip/uip.h> -#include <apps/netutils/uiplib.h> - -#include "udp-internal.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * udp_main - ****************************************************************************/ - -int udp_main(int argc, char *argv[]) -{ - struct in_addr addr; - - /* Set up our host address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_IPADDR); - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_NETMASK); - uip_setnetmask("eth0", &addr); - -#ifdef CONFIG_EXAMPLES_UDP_SERVER - recv_server(); -#else - send_client(); -#endif - - return 0; -} diff --git a/apps/examples/udp/udp-client.c b/apps/examples/udp/udp-client.c deleted file mode 100644 index 6b8473582..000000000 --- a/apps/examples/udp/udp-client.c +++ /dev/null @@ -1,133 +0,0 @@ -/**************************************************************************** - * examples/udp/udp-client.c - * - * Copyright (C) 2007 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 Gregory Nutt 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 <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -#include "udp-internal.h" - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static inline void fill_buffer(unsigned char *buf, int offset) -{ - int ch; - int j; - - buf[0] = offset; - for (ch = 0x20, j = offset + 1; ch < 0x7f; ch++, j++) - { - if (j >= SENDSIZE) - { - j = 1; - } - buf[j] = ch; - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void send_client(void) -{ - struct sockaddr_in server; - unsigned char outbuf[SENDSIZE]; - int sockfd; - int nbytes; - int offset; - - /* Create a new TCP socket */ - - sockfd = socket(PF_INET, SOCK_DGRAM, 0); - if (sockfd < 0) - { - message("client socket failure %d\n", errno); - exit(1); - } - - /* Then send and receive 256 messages */ - - for (offset = 0; offset < 256; offset++) - { - /* Set up the output buffer */ - - fill_buffer(outbuf, offset); - - /* Send the message */ - - server.sin_family = AF_INET; - server.sin_port = HTONS(PORTNO); - server.sin_addr.s_addr = HTONL(CONFIG_EXAMPLES_UDP_SERVERIP); - - message("client: %d. Sending %d bytes\n", offset, SENDSIZE); - nbytes = sendto(sockfd, outbuf, SENDSIZE, 0, - (struct sockaddr*)&server, sizeof(struct sockaddr_in)); - message("client: %d. Sent %d bytes\n", offset, nbytes); - - if (nbytes < 0) - { - message("client: %d. sendto failed: %d\n", offset, errno); - close(sockfd); - exit(-1); - } - else if (nbytes != SENDSIZE) - { - message("client: %d. Bad send length: %d Expected: %d\n", - offset, nbytes, SENDSIZE); - close(sockfd); - exit(-1); - } - - /* Now, sleep a bit. No packets should be dropped due to overrunning - * the server. - */ - - sleep(2); - } - close(sockfd); -} diff --git a/apps/examples/udp/udp-internal.h b/apps/examples/udp/udp-internal.h deleted file mode 100644 index 2a966c746..000000000 --- a/apps/examples/udp/udp-internal.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** - * examples/udp/udp-internal.h - * - * Copyright (C) 2007, 2008 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 __EXAMPLES_UIP_INTERNAL_H -#define __EXAMPLES_UIP_INTERNAL_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_UDP_HOST -#else -# include <debug.h> -#endif - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_UDP_HOST - /* HTONS/L macros are unique to uIP */ - -# define HTONS(a) htons(a) -# define HTONL(a) htonl(a) - - /* Used printf for debug output */ - -# define message(...) printf(__VA_ARGS__) - - /* Have SO_LINGER */ - -#else - - /* If debug is enabled, use the synchronous lib_lowprintf so that the - * program output does not get disassociated in the debug output. - */ - -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif - -#endif - -#define PORTNO 5471 - -#define ASCIISIZE (0x7f - 0x20) -#define SENDSIZE (ASCIISIZE+1) - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -extern void send_client(void); -extern void recv_server(void); - -#endif /* __EXAMPLES_UIP_INTERNAL_H */ diff --git a/apps/examples/udp/udp-server.c b/apps/examples/udp/udp-server.c deleted file mode 100644 index 1f4774deb..000000000 --- a/apps/examples/udp/udp-server.c +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************** - * examples/udp/udp-server.c - * - * Copyright (C) 2007, 2009, 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 Gregory Nutt 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 <sys/socket.h> -#include <netinet/in.h> - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <errno.h> - -#include "udp-internal.h" - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static inline int check_buffer(unsigned char *buf) -{ - int ret = 1; - int offset; - int ch; - int j; - - offset = buf[0]; - for (ch = 0x20, j = offset + 1; ch < 0x7f; ch++, j++) - { - if (j >= SENDSIZE) - { - j = 1; - } - if (buf[j] != ch) - { - message("server: Buffer content error for offset=%d, index=%d\n", offset, j); - ret = 0; - } - } - return ret; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void recv_server(void) -{ - struct sockaddr_in server; - struct sockaddr_in client; - in_addr_t tmpaddr; - unsigned char inbuf[1024]; - int sockfd; - int nbytes; - int optval; - int offset; - socklen_t addrlen; - - /* Create a new UDP socket */ - - sockfd = socket(PF_INET, SOCK_DGRAM, 0); - if (sockfd < 0) - { - message("server: socket failure: %d\n", errno); - exit(1); - } - - /* Set socket to reuse address */ - - optval = 1; - if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0) - { - message("server: setsockopt SO_REUSEADDR failure: %d\n", errno); - exit(1); - } - - /* Bind the socket to a local address */ - - server.sin_family = AF_INET; - server.sin_port = HTONS(PORTNO); - server.sin_addr.s_addr = HTONL(INADDR_ANY); - - if (bind(sockfd, (struct sockaddr*)&server, sizeof(struct sockaddr_in)) < 0) - { - message("server: bind failure: %d\n", errno); - exit(1); - } - - /* Then receive up to 256 packets of data */ - - for (offset = 0; offset < 256; offset++) - { - message("server: %d. Receiving up 1024 bytes\n", offset); - addrlen = sizeof(struct sockaddr_in); - nbytes = recvfrom(sockfd, inbuf, 1024, 0, - (struct sockaddr*)&client, &addrlen); - - tmpaddr = ntohl(client.sin_addr.s_addr); - message("server: %d. Received %d bytes from %d.%d.%d.%d:%d\n", - offset, nbytes, - tmpaddr >> 24, (tmpaddr >> 16) & 0xff, - (tmpaddr >> 8) & 0xff, tmpaddr & 0xff, - ntohs(client.sin_port)); - - if (nbytes < 0) - { - message("server: %d. recv failed: %d\n", offset, errno); - close(sockfd); - exit(-1); - } - - if (nbytes != SENDSIZE) - { - message("server: %d. recv size incorrect: %d vs %d\n", offset, nbytes, SENDSIZE); - close(sockfd); - exit(-1); - } - - if (offset < inbuf[0]) - { - message("server: %d. %d packets lost, resetting offset\n", offset, inbuf[0] - offset); - offset = inbuf[0]; - } - else if (offset > inbuf[0]) - { - message("server: %d. Bad offset in buffer: %d\n", offset, inbuf[0]); - close(sockfd); - exit(-1); - } - - if (!check_buffer(inbuf)) - { - message("server: %d. Bad buffer contents\n", offset); - close(sockfd); - exit(-1); - } - } - close(sockfd); -} diff --git a/apps/examples/uip/Kconfig b/apps/examples/uip/Kconfig deleted file mode 100644 index db65995c8..000000000 --- a/apps/examples/uip/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_UIP - bool "uIP web server example" - default n - ---help--- - Enable the uIP web server example - -if EXAMPLES_UIP -endif diff --git a/apps/examples/uip/Makefile b/apps/examples/uip/Makefile deleted file mode 100644 index b154532b7..000000000 --- a/apps/examples/uip/Makefile +++ /dev/null @@ -1,101 +0,0 @@ -############################################################################ -# apps/examples/uip/Makefile -# -# Copyright (C) 2007-2008, 2010-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# uIP very tiny web server example - -ASRCS = -CSRCS = uip_main.c cgi.c httpd_fsdata.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -httpd_fsdata.c: httpd-fs/* - $(TOPDIR)/tools/mkfsdata.pl - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -epend: .depend - -clean: - $(call DELFILE, .built) - $(call DELFILE, httpd_fsdata.c) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/uip/cgi.c b/apps/examples/uip/cgi.c deleted file mode 100644 index 8d081db92..000000000 --- a/apps/examples/uip/cgi.c +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** - * apps/examples/uip/cgi.c - * Web server script interface - * Author: Adam Dunkels <adam@sics.se> - * - * Copyright (c) 2001-2006, Adam Dunkels. - * All rights reserved. - * - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 <stdio.h> -#include <string.h> -#include <sys/socket.h> - -#include <apps/netutils/httpd.h> - -#include "cgi.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -#ifdef CONFIG_NETUTILS_HTTPDFILESTATS -HTTPD_CGI_CALL(file, "file-stats", file_stats); -#endif - -#ifdef CONFIG_NETUTILS_HTTPDNETSTATS -HTTPD_CGI_CALL(net, "net-stats", net_stats); -#endif - -/**************************************************************************** - * Name: net_stats - ****************************************************************************/ - -#ifdef CONFIG_NETUTILS_HTTPDNETSTATS -static void net_stats(struct httpd_state *pstate, char *ptr) -{ - char buffer[16]; - int i; - - for (i = 0; i < sizeof(uip_stat) / sizeof(uip_stats_t); i++) - { - snprintf(buffer, 16, "%5u\n", ((uip_stats_t *)&uip_stat)[i]); - send(pstate->ht_sockfd, buffer, strlen(buffer), 0); - } -} -#endif - -/**************************************************************************** - * Name: file_stats - ****************************************************************************/ - -#ifdef CONFIG_NETUTILS_HTTPDFILESTATS -static void file_stats(struct httpd_state *pstate, char *ptr) -{ - char buffer[16]; - char *pcount = strchr(ptr, ' ') + 1; - snprintf(buffer, 16, "%5u", httpd_fs_count(pcount)); - send(pstate->ht_sockfd, buffer, strlen(buffer), 0); -} -#endif - -/**************************************************************************** - * Name: cgi_register - ****************************************************************************/ - -void cgi_register() -{ -#ifdef CONFIG_NETUTILS_HTTPDFILESTATS - httpd_cgi_register(&file); -#endif - -#ifdef CONFIG_NETUTILS_HTTPDNETSTATS - httpd_cgi_register(&net); -#endif -} diff --git a/apps/examples/uip/cgi.h b/apps/examples/uip/cgi.h deleted file mode 100644 index 8ad0f93ce..000000000 --- a/apps/examples/uip/cgi.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** - * apps/examples/uip/cgi.c - * Web server script interface header file - * Author: Adam Dunkels <adam@sics.se> - * - * Copyright (c) 2001, Adam Dunkels. - * All rights reserved. - * - * 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. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 __HTTPD_CGI_H__ -#define __HTTPD_CGI_H__ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -void cgi_register(void); - -#endif /* __HTTPD_CGI_H__ */ diff --git a/apps/examples/uip/httpd-fs/404.html b/apps/examples/uip/httpd-fs/404.html deleted file mode 100644 index a17711d02..000000000 --- a/apps/examples/uip/httpd-fs/404.html +++ /dev/null @@ -1,8 +0,0 @@ -<html> - <body bgcolor="white"> - <center> - <h1>404 - file not found</h1> - <h3>Go <a href="/">here</a> instead.</h3> - </center> - </body> -</html>
\ No newline at end of file diff --git a/apps/examples/uip/httpd-fs/fade.png b/apps/examples/uip/httpd-fs/fade.png Binary files differdeleted file mode 100644 index a9e69f75d..000000000 --- a/apps/examples/uip/httpd-fs/fade.png +++ /dev/null diff --git a/apps/examples/uip/httpd-fs/files.shtml b/apps/examples/uip/httpd-fs/files.shtml deleted file mode 100644 index 8a90dbd6d..000000000 --- a/apps/examples/uip/httpd-fs/files.shtml +++ /dev/null @@ -1,31 +0,0 @@ -%!: /header.html -<h1>File statistics</h1> -<center> -<table width="300"> -<tr><td><a href="/index.shtml">/index.shtml</a></td> -<td>%! file-stats /index.shtml -</td><td><img src="/fade.png" height=10 width=%! file-stats /index.shtml -> </td></tr> -<tr><td><a href="/files.shtml">/files.shtml</a></td> -<td>%! file-stats /files.shtml -</td><td><img src="/fade.png" height=10 width=%! file-stats /files.shtml -> </td></tr> -<tr><td><a href="/stats.shtml">/stats.shtml</a></td> -<td>%! file-stats /stats.shtml -</td><td><img src="/fade.png" height=10 width=%! file-stats /stats.shtml -> </td></tr> -<tr><td><a href="/style.css">/style.css</a></td> -<td>%! file-stats /style.css -</td><td><img src="/fade.png" height=10 width=%! file-stats /style.css -> </td></tr> -<tr><td><a href="/404.html">/404.html</a></td> -<td>%! file-stats /404.html -</td><td><img src="/fade.png" height=10 width=%! file-stats /404.html -> </td></tr> -<tr><td><a href="/fade.png">/fade.png</a></td> -<td>%! file-stats /fade.png -</td><td><img src="/fade.png" height=10 width=%! file-stats /fade.png -> </td></tr> -</table> -</center> -%!: /footer.html diff --git a/apps/examples/uip/httpd-fs/footer.html b/apps/examples/uip/httpd-fs/footer.html deleted file mode 100644 index 5b6e2d653..000000000 --- a/apps/examples/uip/httpd-fs/footer.html +++ /dev/null @@ -1,3 +0,0 @@ - </div> - </body> -</html> diff --git a/apps/examples/uip/httpd-fs/header.html b/apps/examples/uip/httpd-fs/header.html deleted file mode 100644 index 70df07fa6..000000000 --- a/apps/examples/uip/httpd-fs/header.html +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> - <head> - <title>Welcome to the uIP web server!</title> - <link rel="stylesheet" type="text/css" href="style.css"> - </head> - <body bgcolor="#fffeec" text="black"> - - <div class="menu"> - <div class="menubox"><a href="/">Front page</a></div> - <div class="menubox"><a href="files.shtml">File statistics</a></div> - <div class="menubox"><a href="stats.shtml">Network statistics</a></div> - <br> - </div> - - <div class="contentblock"> diff --git a/apps/examples/uip/httpd-fs/index.shtml b/apps/examples/uip/httpd-fs/index.shtml deleted file mode 100644 index 7f19358ce..000000000 --- a/apps/examples/uip/httpd-fs/index.shtml +++ /dev/null @@ -1,10 +0,0 @@ -%!: /header.html - <p> - These web pages are served by a small web server running on top of - the <a href="http://www.sics.se/~adam/uip/">uIP embedded TCP/IP - stack</a>. - </p> - <p> - Click on the links above for web server statistics. - </p> -%!: /footer.html diff --git a/apps/examples/uip/httpd-fs/stats.shtml b/apps/examples/uip/httpd-fs/stats.shtml deleted file mode 100644 index c63ed4afd..000000000 --- a/apps/examples/uip/httpd-fs/stats.shtml +++ /dev/null @@ -1,31 +0,0 @@ -%!: /header.html -<h1>Network statistics</h1> -<center> -<table width="300" border="0"> -<tr><td><pre> -IP Packets received - Packets sent - Packets dropped -IP errors IP version/header length - IP length, high byte - IP length, low byte - IP fragments - Header checksum - Wrong protocol -ICMP Packets received - Packets sent - Packets dropped - Type errors -TCP Packets received - Packets sent - Packets dropped - Checksum errors - Data packets without ACKs - Resets - Retransmissions - No connection avaliable - Connection attempts to closed ports -</pre></td><td><pre>%! net-stats -</pre></table> -</center> -%!: /footer.html diff --git a/apps/examples/uip/httpd-fs/style.css b/apps/examples/uip/httpd-fs/style.css deleted file mode 100644 index ba6df7f15..000000000 --- a/apps/examples/uip/httpd-fs/style.css +++ /dev/null @@ -1,92 +0,0 @@ -h1 -{ - text-align: center; - font-size:14pt; - font-family:arial,helvetica; - font-weight:bold; - padding:10px; -} - -body -{ - - background-color: #fffeec; - color:black; - - font-size:8pt; - font-family:arial,helvetica; -} - -.menu -{ - margin: 4px; - width:60%; - - padding:2px; - - border: solid 1px; - background-color: #fffcd2; - text-align:left; - - font-size:9pt; - font-family:arial,helvetica; -} - -div.menubox -{ - width: 25%; - border: 0; - float: left; -text-align: center; -} - -.contentblock -{ - margin: 4px; - width:60%; - - padding:2px; - - border: 1px dotted; - background-color: white; - - font-size:8pt; - font-family:arial,helvetica; - -} - -p.intro -{ - margin-left:20px; - margin-right:20px; - - font-size:10pt; -/* font-weight:bold; */ - font-family:arial,helvetica; -} - -p.clink -{ - font-size:12pt; - font-family:courier,monospace; - text-align:center; -} - -p.clink9 -{ - font-size:9pt; - font-family:courier,monospace; - text-align:center; -} - - -p -{ - padding-left:10px; -} - -p.right -{ - text-align:right; -} - diff --git a/apps/examples/uip/httpd-fs/tcp.shtml b/apps/examples/uip/httpd-fs/tcp.shtml deleted file mode 100644 index 4c4bffe97..000000000 --- a/apps/examples/uip/httpd-fs/tcp.shtml +++ /dev/null @@ -1,5 +0,0 @@ -%!: /header.html -<h1>Current connections</h1><br><table width="100%"> -<tr><th>Local</th><th>Remote</th><th>State</th><th>Retransmissions</th><th>Timer</th><th>Flags</th></tr> -%! tcp-connections -%!: /footer.html
\ No newline at end of file diff --git a/apps/examples/uip/uip_main.c b/apps/examples/uip/uip_main.c deleted file mode 100644 index 6c2f96f39..000000000 --- a/apps/examples/uip/uip_main.c +++ /dev/null @@ -1,210 +0,0 @@ -/**************************************************************************** - * examples/uip/uip_main.c - * - * Copyright (C) 2007, 2009-2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <gnutt@nuttx.org> - * - * Based on uIP which also has a BSD style license: - * - * Copyright (c) 2001, Adam Dunkels. - * All rights reserved. - * - * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Adam Dunkels. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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/ioctl.h> -#include <stdint.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <time.h> -#include <debug.h> - -#include <net/if.h> -#include <nuttx/net/uip/uip.h> -#include <nuttx/net/uip/uip-arp.h> - -#include <apps/netutils/uiplib.h> - -#ifdef CONFIG_EXAMPLES_UIP_DHCPC -#include <arpa/inet.h> -#endif - -/* Here we include the header file for the application(s) we use in - * our project as defined in the config/<board-name>/defconfig file - */ - -/* DHCPC may be used in conjunction with any other feature (or not) */ - -#ifdef CONFIG_EXAMPLES_UIP_DHCPC -# include <apps/netutils/resolv.h> -# include <apps/netutils/dhcpc.h> -#endif - -/* Include uIP webserver definitions */ - -#include <apps/netutils/httpd.h> - -#include "cgi.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# else -# define message(...) printf(__VA_ARGS__) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# else -# define message (void) -# endif -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * uip_main - ****************************************************************************/ - -int uip_main(int argc, char *argv[]) -{ - struct in_addr addr; -#if defined(CONFIG_EXAMPLES_UIP_DHCPC) || defined(CONFIG_EXAMPLES_UIP_NOMAC) - uint8_t mac[IFHWADDRLEN]; -#endif -#ifdef CONFIG_EXAMPLES_UIP_DHCPC - void *handle; -#endif - -/* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_UIP_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up our host address */ - -#ifdef CONFIG_EXAMPLES_UIP_DHCPC - addr.s_addr = 0; -#else - addr.s_addr = HTONL(CONFIG_EXAMPLES_UIP_IPADDR); -#endif - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_UIP_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_UIP_NETMASK); - uip_setnetmask("eth0", &addr); - -#ifdef CONFIG_EXAMPLES_UIP_DHCPC - /* Set up the resolver */ - - resolv_init(); - - /* Get the MAC address of the NIC */ - - uip_getmacaddr("eth0", mac); - - /* Set up the DHCPC modules */ - - handle = dhcpc_open(&mac, IFHWADDRLEN); - - /* Get an IP address. Note: there is no logic here for renewing the address in this - * example. The address should be renewed in ds.lease_time/2 seconds. - */ - - printf("Getting IP address\n"); - if (handle) - { - struct dhcpc_state ds; - (void)dhcpc_request(handle, &ds); - uip_sethostaddr("eth1", &ds.ipaddr); - if (ds.netmask.s_addr != 0) - { - uip_setnetmask("eth0", &ds.netmask); - } - if (ds.default_router.s_addr != 0) - { - uip_setdraddr("eth0", &ds.default_router); - } - if (ds.dnsaddr.s_addr != 0) - { - resolv_conf(&ds.dnsaddr); - } - dhcpc_close(handle); - printf("IP: %s\n", inet_ntoa(ds.ipaddr)); - } -#endif - -#ifdef CONFIG_NET_TCP - printf("Starting webserver\n"); - httpd_init(); - cgi_register(); - httpd_listen(); -#endif - - while(1) - { - sleep(3); - printf("uip_main: Still running\n"); -#if CONFIG_NFILE_DESCRIPTORS > 0 - fflush(stdout); -#endif - } - return 0; -} diff --git a/apps/examples/usbserial/Kconfig b/apps/examples/usbserial/Kconfig deleted file mode 100644 index 33a0243eb..000000000 --- a/apps/examples/usbserial/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_USBSERIAL - bool "USB serial test example" - default n - ---help--- - Enable the USB serial test example - -if EXAMPLES_USBSERIAL -endif diff --git a/apps/examples/usbserial/Makefile b/apps/examples/usbserial/Makefile deleted file mode 100644 index ec7219505..000000000 --- a/apps/examples/usbserial/Makefile +++ /dev/null @@ -1,97 +0,0 @@ -############################################################################ -# apps/examples/usbserial/Makefile -# -# Copyright (C) 2008, 2010-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. -# -############################################################################ - --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# USB serial device example - -ASRCS = -CSRCS = usbserial_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - @$(MAKE) -f Makefile.host clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/usbserial/Makefile.host b/apps/examples/usbserial/Makefile.host deleted file mode 100644 index a98ed8d5f..000000000 --- a/apps/examples/usbserial/Makefile.host +++ /dev/null @@ -1,64 +0,0 @@ -############################################################################ -# apps/examples/usbserial/Makefile.host -# -# Copyright (C) 2008, 2011 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. -# -############################################################################ - -# TOPDIR must be defined on the make command line - --include $(TOPDIR)/Make.defs - -SRC = host.c -BIN = host$(EXEEXT) - -DEFINES = -ifeq ($(CONFIG_EXAMPLES_USBSERIAL_INONLY),y) -DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_INONLY=1 -endif -ifeq ($(CONFIG_EXAMPLES_USBSERIAL_OUTONLY),y) -DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_OUTONLY=1 -endif -ifeq ($(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL),y) -DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=1 -endif -ifeq ($(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG),y) -DEFINES += -DCONFIG_EXAMPLES_USBSERIAL_ONLYBIG=1 -endif - -all: $(BIN) - -$(BIN): $(SRC) - @$(HOSTCC) $(HOSTCFLAGS) $(DEFINES) $^ -o $@ - -clean: - $(call DELFILE, $(BIN)) - $(call CLEAN) diff --git a/apps/examples/usbserial/host.c b/apps/examples/usbserial/host.c deleted file mode 100644 index 366b62223..000000000 --- a/apps/examples/usbserial/host.c +++ /dev/null @@ -1,297 +0,0 @@ -/**************************************************************************** - * examples/usbserial/host.c - * - * Copyright (C) 2008 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 <stdio.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <termios.h> -#include <fcntl.h> -#include <errno.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#if defined(CONFIG_EXAMPLES_USBSERIAL_INONLY) && defined(CONFIG_EXAMPLES_USBSERIAL_OUTONLY) -# error "Cannot define both CONFIG_EXAMPLES_USBSERIAL_INONLY and _OUTONLY" -#endif -#if defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) && defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) -# error "Cannot define both CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL and _ONLYBIG" -#endif - -#if !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) && !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) -# ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY -# define COUNTER_NEEDED 1 -# endif -#endif - -#ifdef CONFIG_CDCACM -# define DEFAULT_TTYDEV "/dev/ttyACM0" -#else -# define DEFAULT_TTYDEV "/dev/ttyUSB0" -#endif -#define BUFFER_SIZE 1024 - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const char *g_ttydev = DEFAULT_TTYDEV; - -#ifndef CONFIG_EXAMPLES_USBSERIAL_ONLYBIG -static const char g_shortmsg[] = "Sure... You betcha!!\n"; -#endif - -#ifndef CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL -static const char g_longmsg[] = - "I am proud to come to this city as the guest of your distinguished Mayor, " - "who has symbolized throughout the world the fighting spirit of West Berlin. " - "And I am proud to visit the Federal Republic with your distinguished Chancellor " - "who for so many years has committed Germany to democracy and freedom and " - "progress, and to come here in the company of my fellow American, General Clay, " - "who has been in this city during its great moments of crisis and will come " - "again if ever needed.\n" - "Two thousand years ago the proudest boast was \"civis Romanus sum.\" Today, " - "in the world of freedom, the proudest boast is \"Ich bin ein Berliner.\"\r\"" - "I appreciate my interpreter translating my German!\n" - "There are many people in the world who really don't understand, or say they " - "don't, what is the great issue between the free world and the Communist world. " - "Let them come to Berlin. There are some who say that communism is the wave of " - "the future. Let them come to Berlin. And there are some who say in Europe and " - "elsewhere we can work with the Communists. Let them come to Berlin. And there " - "are even a few who say that it is true that communism is an evil system, but it " - "permits us to make economic progress. Lass' sie nach Berlin kommen. Let them " - "come to Berlin.\n" - "Freedom has many difficulties and democracy is not perfect, but we have never " - "had to put a wall up to keep our people in, to prevent them from leaving us. I " - "want to say, on behalf of my countrymen, who live many miles away on the other " - "side of the Atlantic, who are far distant from you, that they take the greatest " - "pride that they have been able to share with you, even from a distance, the " - "story of the last 18 years. I know of no town, no city, that has been besieged " - "for 18 years that still lives with the vitality and the force, and the hope and " - "the determination of the city of West Berlin. While the wall is the most obvious " - "and vivid demonstration of the failures of the Communist system, for all the " - "world to see, we take no satisfaction in it, for it is, as your Mayor has said, " - "an offense not only against history but an offense against humanity, separating " - "families, dividing husbands and wives and brothers and sisters, and dividing a " - "people who wish to be joined together.\n" - "What is true of this city is true of Germany--real, lasting peace in Europe can " - "never be assured as long as one German out of four is denied the elementary " - "right of free men, and that is to make a free choice. In 18 years of peace and " - "good faith, this generation of Germans has earned the right to be free, " - "including the right to unite their families and their nation in lasting peace, " - "with good will to all people. You live in a defended island of freedom, but " - "your life is part of the main. So let me ask you as I close, to lift your eyes " - "beyond the dangers of today, to the hopes of tomorrow, beyond the freedom merely " - "of this city of Berlin, or your country of Germany, to the advance of freedom " - "everywhere, beyond the wall to the day of peace with justice, beyond yourselves " - "and ourselves to all mankind.\n" - "Freedom is indivisible, and when one man is enslaved, all are not free. When all " - "are free, then we can look forward to that day when this city will be joined as " - "one and this country and this great Continent of Europe in a peaceful and hopeful " - "globe. When that day finally comes, as it will, the people of West Berlin can take " - "sober satisfaction in the fact that they were in the front lines for almost two " - "decades.\n" - "All free men, wherever they may live, are citizens of Berlin, and, therefore, " - "as a free man, I take pride in the words \"Ich bin ein Berliner.\"\n" - "President John F. Kennedy - June 26, 1963\n"; -#endif - -#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY -static char g_iobuffer[BUFFER_SIZE]; -#endif - -/**************************************************************************** - * show_usage - ****************************************************************************/ - -static void show_usage(const char *progname, int exitcode) -{ - fprintf(stderr, "USAGE: %s [<ttydev>]\n", progname); - exit(exitcode); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * main - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - struct termios tty; -#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY - ssize_t nbytes; -#endif -#ifdef COUNTER_NEEDED - int count = 0; -#endif - int fd; - int ret; - - /* Handle input parameters */ - - if (argc > 1) - { - if (argc > 2) - { - fprintf(stderr, "Too many arguments on command line\n"); - show_usage(argv[0], 1); - } - g_ttydev = argv[1]; - } - - /* Open the USB serial device for blocking read/write */ - - do - { - printf("main: Opening USB serial driver\n"); - fd = open(g_ttydev, O_RDWR); - if (fd < 0) - { - printf("main: ERROR: Failed to open %s: %s\n", g_ttydev, strerror(errno)); - printf("main: Assume not connected. Wait and try again.\n"); - printf("main: (Control-C to terminate).\n"); - sleep(5); - } - } - while (fd < 0); - printf("main: Successfully opened the serial driver\n"); - - /* Configure the serial port in raw mode (at least turn off echo) */ - - ret = tcgetattr(fd, &tty); - if (ret < 0) - { - printf("main: ERROR: Failed to get termios for %s: %s\n", g_ttydev, strerror(errno)); - close(fd); - return 1; - } - - tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - tty.c_oflag &= ~OPOST; - tty.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - tty.c_cflag &= ~(CSIZE|PARENB); - tty.c_cflag |= CS8; - - ret = tcsetattr(fd, TCSANOW, &tty); - if (ret < 0) - { - printf("main: ERROR: Failed to set termios for %s: %s\n", g_ttydev, strerror(errno)); - close(fd); - return 1; - } - - /* Wait for and/or send messages -- forever */ - - for (;;) - { - /* Test IN messages (device-to-host) */ - -#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY - printf("main: Reading from the serial driver\n"); - printf("main: ... (Control-C to terminate) ...\n"); - nbytes = read(fd, g_iobuffer, BUFFER_SIZE-1); - if (nbytes < 0) - { - printf("main: ERROR: Failed to read from %s: %s\n", g_ttydev, strerror(errno)); - close(fd); - return 2; - } - else if (nbytes == 0) - { - printf("main: End-of-file encountered\n"); - break; - } - - g_iobuffer[nbytes] = '\0'; - printf("main: Received %d bytes:\n", nbytes); - printf(" \"%s\"\n", g_iobuffer); -#else - printf("main: Waiting...\n"); - sleep(5); -#endif /* CONFIG_EXAMPLES_USBSERIAL_OUTONLY */ - - /* Test OUT messages (host-to-device) */ - -#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY -#if !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) && !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) - count++; - if (count < 5) - { - printf("main: Sending %d bytes..\n", sizeof(g_shortmsg)); - nbytes = write(fd, g_shortmsg, sizeof(g_shortmsg)); - } - else - { - printf("main: Sending %d bytes..\n", sizeof(g_longmsg)); - nbytes = write(fd, g_longmsg, sizeof(g_longmsg)); - count = 0; - } -#elif !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) - printf("main: Sending %d bytes..\n", sizeof(g_longmsg)); - nbytes = write(fd, g_longmsg, sizeof(g_longmsg)); -#else /* !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) */ - printf("main: Sending %d bytes..\n", sizeof(g_shortmsg)); - nbytes = write(fd, g_shortmsg, sizeof(g_shortmsg)); -#endif - - /* Test if write was successful */ - - if (nbytes < 0) - { - printf("main: ERROR: Failed to write to %s: %s\n", g_ttydev, strerror(errno)); - close(fd); - return 2; - } - printf("main: %d bytes sent\n", nbytes); -#endif /* CONFIG_EXAMPLES_USBSERIAL_INONLY */ - } - - close(fd); - return 0; -} - diff --git a/apps/examples/usbserial/usbserial_main.c b/apps/examples/usbserial/usbserial_main.c deleted file mode 100644 index 016c8b292..000000000 --- a/apps/examples/usbserial/usbserial_main.c +++ /dev/null @@ -1,467 +0,0 @@ -/**************************************************************************** - * examples/usbserial/usbserial_main.c - * - * Copyright (C) 2008, 2010-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/stat.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <fcntl.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/usb/usbdev.h> -#include <nuttx/usb/usbdev_trace.h> - -#ifdef CONFIG_CDCACM -# include <nuttx/usb/cdcacm.h> -#endif - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#if defined(CONFIG_EXAMPLES_USBSERIAL_INONLY) && defined(CONFIG_EXAMPLES_USBSERIAL_OUTONLY) -# error "Cannot define both CONFIG_EXAMPLES_USBSERIAL_INONLY and _OUTONLY" -#endif -#if defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) && defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) -# error "Cannot define both CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL and _ONLYBIG" -#endif - -#if !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) && !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) -# ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY -# define COUNTER_NEEDED 1 -# endif -#endif - -#ifdef CONFIG_EXAMPLES_USBSERIAL_TRACEINIT -# define TRACE_INIT_BITS (TRACE_INIT_BIT) -#else -# define TRACE_INIT_BITS (0) -#endif - -#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT) - -#ifdef CONFIG_EXAMPLES_USBSERIAL_TRACECLASS -# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT) -#else -# define TRACE_CLASS_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS -# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|TRACE_READ_BIT|\ - TRACE_WRITE_BIT|TRACE_COMPLETE_BIT) -#else -# define TRACE_TRANSFER_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER -# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT) -#else -# define TRACE_CONTROLLER_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS -# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT) -#else -# define TRACE_INTERRUPT_BITS (0) -#endif - -#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\ - TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS) -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# define trmessage lib_lowprintf -# else -# define message(...) printf(__VA_ARGS__) -# define trmessage printf -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define trmessage lib_lowprintf -# else -# define message printf -# define trmessage printf -# endif -#endif - -#ifdef CONFIG_CDCACM -# define USBSER_DEVNAME "/dev/ttyACM0" -#else -# define USBSER_DEVNAME "/dev/ttyUSB0" -#endif - -#define IOBUFFER_SIZE 256 - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_USBSERIAL_ONLYBIG -static const char g_shortmsg[] = "Hello, World!!\n"; -#endif - -#ifndef CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL -static const char g_longmsg[] = - "The Spanish Armada a Speech by Queen Elizabeth I of England\n" - "Addressed to the English army at Tilbury Fort - 1588\n" - "My loving people, we have been persuaded by some, that are careful of our " - "safety, to take heed how we commit ourselves to armed multitudes, for fear " - "of treachery; but I assure you, I do not desire to live to distrust my " - "faithful and loving people.\n" - "Let tyrants fear; I have always so behaved myself that, under God, I have " - "placed my chiefest strength and safeguard in the loyal hearts and good will " - "of my subjects. And therefore I am come amongst you at this time, not as for " - "my recreation or sport, but being resolved, in the midst and heat of the " - "battle, to live or die amongst you all; to lay down, for my God, and for " - "my kingdom, and for my people, my honour and my blood, even the dust.\n" - "I know I have but the body of a weak and feeble woman; but I have the heart " - "of a king, and of a king of England, too; and think foul scorn that Parma " - "or Spain, or any prince of Europe, should dare to invade the borders of my " - "realms: to which, rather than any dishonour should grow by me, I myself will " - "take up arms; I myself will be your general, judge, and rewarder of every " - "one of your virtues in the field.\n" - "I know already, by your forwardness, that you have deserved rewards and " - "crowns; and we do assure you, on the word of a prince, they shall be duly " - "paid you. In the mean my lieutenant general shall be in my stead, than whom " - "never prince commanded a more noble and worthy subject; not doubting by " - "your obedience to my general, by your concord in the camp, and by your " - "valour in the field, we shall shortly have a famous victory over the enemies " - "of my God, of my kingdom, and of my people.\n"; -#endif - -#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY -static char g_iobuffer[IOBUFFER_SIZE]; -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -#ifdef CONFIG_USBDEV_TRACE -static int trace_callback(struct usbtrace_s *trace, void *arg) -{ - usbtrace_trprintf((trprintf_t)trmessage, trace->event, trace->value); - return 0; -} - -static void dumptrace(void) -{ - (void)usbtrace_enumerate(trace_callback, NULL); -} -#else -# define dumptrace() -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * usbserial_main - ****************************************************************************/ - -int usbserial_main(int argc, char *argv[]) -{ -#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY - int infd; -#endif -#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY - int outfd; -#endif -#ifdef COUNTER_NEEDED - int count = 0; -#endif - ssize_t nbytes; -#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY - int i, j, k; -#endif - int ret; - - /* Initialize the USB serial driver */ - - message("usbserial_main: Registering USB serial driver\n"); -#ifdef CONFIG_CDCACM - ret = cdcacm_initialize(0, NULL); -#else - ret = usbdev_serialinitialize(0); -#endif - if (ret < 0) - { - message("usbserial_main: ERROR: Failed to create the USB serial device: %d\n", -ret); - return 1; - } - message("usbserial_main: Successfully registered the serial driver\n"); - -#if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0 - /* If USB tracing is enabled and tracing of initial USB events is specified, - * then dump all collected trace data to stdout - */ - - sleep(5); - dumptrace(); -#endif - - /* Then, in any event, configure trace data collection as configured */ - - usbtrace_enable(TRACE_BITSET); - - /* Open the USB serial device for writing (blocking) */ - -#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY - do - { - message("usbserial_main: Opening USB serial driver\n"); - outfd = open(USBSER_DEVNAME, O_WRONLY); - if (outfd < 0) - { - int errcode = errno; - message("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME " for writing: %d\n", errcode); - - /* ENOTCONN means that the USB device is not yet connected */ - - if (errcode == ENOTCONN) - { - message("usbserial_main: Not connected. Wait and try again.\n"); - sleep(5); - } - else - { - /* Give up on other errors */ - - message("usbserial_main: Aborting\n"); - return 2; - } - } - - /* If USB tracing is enabled, then dump all collected trace data to stdout */ - - dumptrace(); - } - while (outfd < 0); -#endif - - /* Open the USB serial device for reading (non-blocking) */ - -#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY -#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY - infd = open(USBSER_DEVNAME, O_RDONLY|O_NONBLOCK); - if (infd < 0) - { - message("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME " for reading: %d\n", errno); - close(outfd); - return 3; - } -#else - do - { - infd = open(USBSER_DEVNAME, O_RDONLY|O_NONBLOCK); - if (infd < 0) - { - int errcode = errno; - message("usbserial_main: ERROR: Failed to open " USBSER_DEVNAME " for reading: %d\n", errno); - - /* ENOTCONN means that the USB device is not yet connected */ - - if (errcode == ENOTCONN) - { - message("usbserial_main: Not connected. Wait and try again.\n"); - sleep(5); - } - else - { - /* Give up on other errors */ - - message("usbserial_main: Aborting\n"); - return 3; - } - } - - /* If USB tracing is enabled, then dump all collected trace data to stdout */ - - dumptrace(); - } - while (infd < 0); -#endif -#endif - - message("usbserial_main: Successfully opened the serial driver\n"); - - /* Send messages and get responses -- forever */ - - for (;;) - { - /* Test IN (device-to-host) messages */ - -#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY -#if !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) && !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) - if (count < 8) - { - message("usbserial_main: Saying hello\n"); - nbytes = write(outfd, g_shortmsg, sizeof(g_shortmsg)); - count++; - } - else - { - message("usbserial_main: Reciting QEI's speech of 1588\n"); - nbytes = write(outfd, g_longmsg, sizeof(g_longmsg)); - count = 0; - } -#elif !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL) - message("usbserial_main: Reciting QEI's speech of 1588\n"); - nbytes = write(outfd, g_longmsg, sizeof(g_longmsg)); -#else /* !defined(CONFIG_EXAMPLES_USBSERIAL_ONLYBIG) */ - message("usbserial_main: Saying hello\n"); - nbytes = write(outfd, g_shortmsg, sizeof(g_shortmsg)); -#endif - - /* Test if the write was successful */ - - if (nbytes < 0) - { - message("usbserial_main: ERROR: write failed: %d\n", errno); -#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY - close(infd); -#endif - close(outfd); - return 4; - } - message("usbserial_main: %d bytes sent\n", nbytes); -#endif /* CONFIG_EXAMPLES_USBSERIAL_OUTONLY */ - - /* Test OUT (host-to-device) messages */ - -#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY - /* Poll for incoming messages */ - - message("usbserial_main: Polling for OUT messages\n"); - for (i = 0; i < 5; i++) - { - memset(g_iobuffer, 'X', IOBUFFER_SIZE); - nbytes = read(infd, g_iobuffer, IOBUFFER_SIZE); - if (nbytes < 0) - { - int errorcode = errno; - if (errorcode != EAGAIN) - { - message("usbserial_main: ERROR: read failed: %d\n", errno); - close(infd); -#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY - close(outfd); -#endif - return 6; - } - } - else - { - message("usbserial_main: Received %d bytes:\n", nbytes); - if (nbytes > 0) - { - for (j = 0; j < nbytes; j += 16) - { - message("usbserial_main: %03x: ", j); - for (k = 0; k < 16; k++) - { - if (k == 8) - { - message(" "); - } - if (j+k < nbytes) - { - message("%02x", g_iobuffer[j+k]); - } - else - { - message(" "); - } - } - message(" "); - for (k = 0; k < 16; k++) - { - if (k == 8) - { - message(" "); - } - if (j+k < nbytes) - { - if (g_iobuffer[j+k] >= 0x20 && g_iobuffer[j+k] < 0x7f) - { - message("%c", g_iobuffer[j+k]); - } - else - { - message("."); - } - } - else - { - message(" "); - } - } - message("\n"); - } - } - } - sleep(1); - } -#else /* CONFIG_EXAMPLES_USBSERIAL_INONLY */ - message("usbserial_main: Waiting\n"); - sleep(5); -#endif /* CONFIG_EXAMPLES_USBSERIAL_INONLY */ - - /* If USB tracing is enabled, then dump all collected trace data to stdout */ - - dumptrace(); - } - - /* Won't get here, but if we did this what we would have to do */ - -#ifndef CONFIG_EXAMPLES_USBSERIAL_INONLY - close(infd); -#endif -#ifndef CONFIG_EXAMPLES_USBSERIAL_OUTONLY - close(outfd); -#endif - return 0; -} - diff --git a/apps/examples/usbstorage/Kconfig b/apps/examples/usbstorage/Kconfig deleted file mode 100644 index 96af82b21..000000000 --- a/apps/examples/usbstorage/Kconfig +++ /dev/null @@ -1,136 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_USBMSC - bool "USB mass storage class example" - default n - ---help--- - Enable the USB mass storage class example - -config EXAMPLES_USBMSC_BUILTIN - bool "NSH built-in command" - default y - depends on EXAMPLES_USBMSC && NSH_BUILTIN_APPS - ---help--- - This example can be built as two NSH "built-in" commands if this - option is selected: 'msconn' will connect the USB mass storage - device; 'msdis' will disconnect the USB storage device. - -config EXAMPLES_USBMSC_NLUNS - int "Number of LUNs" - default 1 - depends on EXAMPLES_USBMSC - ---help--- - Defines the number of logical units (LUNs) exported by the USB - storage driver. Each LUN corresponds to one exported block driver - (or partition of a block driver). May be 1, 2, or 3. Default is 1. - -config EXAMPLES_USBMSC_DEVMINOR1 - int "LUN1 Minor Device Number" - default 0 - depends on EXAMPLES_USBMSC - ---help--- - The minor device number of the block driver for the first LUN. For - example, N in /dev/mmcsdN. Used for registering the block driver. - Default is zero. - -config EXAMPLES_USBMSC_DEVPATH1 - string "LUN1 Device Path" - default "/dev/mmcsd0" - depends on EXAMPLES_USBMSC - ---help--- - The full path to the registered block driver. Default is - "/dev/mmcsd0" - -config EXAMPLES_USBMSC_DEVMINOR2 - int "LUN2 Minor Device Number" - default 1 - depends on EXAMPLES_USBMSC - ---help--- - The minor device number of the block driver for the second LUN. For - example, N in /dev/mmcsdN. Used for registering the block driver. - Ignored if EXAMPLES_USBMSC_NLUNS < 2. Default is one. - -config EXAMPLES_USBMSC_DEVPATH2 - string "LUN2 Device Path" - default "/dev/mmcsd1" - depends on EXAMPLES_USBMSC - ---help--- - The full path to the registered block driver. Ignored if - EXAMPLES_USBMSC_NLUNS < 2. Default is "/dev/mmcsd1" - -config EXAMPLES_USBMSC_DEVMINOR3 - int "LUN3 Minor Device Number" - default 2 - depends on EXAMPLES_USBMSC - ---help--- - The minor device number of the block driver for the third LUN. For - example, N in /dev/mmcsdN. Used for registering the block driver. - Ignored if EXAMPLES_USBMSC_NLUNS < 2. Default is two. - -config EXAMPLES_USBMSC_DEVPATH3 - string "LUN3 Device Path" - default "/dev/mmcsd2" - depends on EXAMPLES_USBMSC - ---help--- - The full path to the registered block driver. Ignored if - EXAMPLES_USBMSC_NLUNS < 2. Default is "/dev/mmcsd2" - -config EXAMPLES_USBMSC_DEBUGMM - bool "USB MSC MM Debug" - default n - depends on EXAMPLES_USBMSC - ---help--- - Enables some debug tests to check for memory usage and memory leaks. - -config EXAMPLES_USBMSC_TRACEINIT - bool "USB Trace Initialization" - default n - depends on EXAMPLES_USBMSC - ---help--- - If USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB), - then the example code will also manage the USB trace output. The - amount of trace output can be controlled this configuration value: - This setting will show USB initialization events - -config EXAMPLES_USBMSC_TRACECLASS - bool "USB Trace Class" - default n - depends on EXAMPLES_USBMSC - ---help--- - If USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB), - then the example code will also manage the USB trace output. The - amount of trace output can be controlled this configuration value: - This setting will show USB class driver events - -config EXAMPLES_USBMSC_TRACETRANSFERS - bool "USB Trace Transfers" - default n - depends on EXAMPLES_USBMSC - ---help--- - If USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB), - then the example code will also manage the USB trace output. The - amount of trace output can be controlled this configuration value: - This setting will show USB data transfer events - -config EXAMPLES_USBMSC_TRACECONTROLLER - bool "USB Trace Device Controller Events" - default n - depends on EXAMPLES_USBMSC - ---help--- - If USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB), - then the example code will also manage the USB trace output. The - amount of trace output can be controlled this configuration value: - This setting will show USB device controller events - -config EXAMPLES_USBMSC_TRACEINTERRUPTS - bool "USB Trace Device Controller Interrupt Events" - default n - depends on EXAMPLES_USBMSC - ---help--- - If USBDEV_TRACE is enabled (or CONFIG_DEBUG and CONFIG_DEBUG_USB), - then the example code will also manage the USB trace output. The - amount of trace output can be controlled this configuration value: - This setting will show USB device controller interrupt-related events. diff --git a/apps/examples/usbstorage/Makefile b/apps/examples/usbstorage/Makefile deleted file mode 100644 index 5492e47dc..000000000 --- a/apps/examples/usbstorage/Makefile +++ /dev/null @@ -1,114 +0,0 @@ -############################################################################ -# apps/examples/usbstorage/Makefile -# -# Copyright (C) 2008, 2010-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# USB device mass storage example - -ASRCS = -CSRCS = usbmsc_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# USB storage built-in application info - -APPNAME1 = msconn -PRIORITY1 = SCHED_PRIORITY_DEFAULT -STACKSIZE1 = 2048 - -APPNAME2 = msdis -PRIORITY2 = SCHED_PRIORITY_DEFAULT -STACKSIZE2 = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_EXAMPLES_USBMSC_BUILTIN),y) - $(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main) - $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/usbstorage/usbmsc.h b/apps/examples/usbstorage/usbmsc.h deleted file mode 100644 index 9d48c4521..000000000 --- a/apps/examples/usbstorage/usbmsc.h +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************** - * examples/usbstorage/usbmsc.h - * - * Copyright (C) 2008-2009, 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 __EXAMPLES_USBSTORAGE_USBMSC_H -#define __EXAMPLES_USBSTORAGE_USBMSC_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> -#include <stdlib.h> - -/**************************************************************************** - * Pre-Processor Definitions - ****************************************************************************/ - -/* Configuration ************************************************************/ - -#ifndef CONFIG_EXAMPLES_USBMSC_NLUNS -# define CONFIG_EXAMPLES_USBMSC_NLUNS 1 -#endif - -#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1 -# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0 -#endif - -#ifndef CONFIG_EXAMPLES_USBMSC_DEVPATH1 -# define CONFIG_EXAMPLES_USBMSC_DEVPATH1 "/dev/mmcsd0" -#endif - -#if CONFIG_EXAMPLES_USBMSC_NLUNS > 1 -# ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR2 -# error "CONFIG_EXAMPLES_USBMSC_DEVMINOR2 for LUN=2" -# endif -# ifndef CONFIG_EXAMPLES_USBMSC_DEVPATH2 -# error "CONFIG_EXAMPLES_USBMSC_DEVPATH2 for LUN=2" -# endif -# if CONFIG_EXAMPLES_USBMSC_NLUNS > 2 -# ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR3 -# error "CONFIG_EXAMPLES_USBMSC_DEVMINOR2 for LUN=3" -# endif -# ifndef CONFIG_EXAMPLES_USBMSC_DEVPATH2 -# error "CONFIG_EXAMPLES_USBMSC_DEVPATH2 for LUN=3" -# endif -# if CONFIG_EXAMPLES_USBMSC_NLUNS > 3 -# error "CONFIG_EXAMPLES_USBMSC_NLUNS must be {1,2,3}" -# endif -# endif -#endif - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_lowprintf(__VA_ARGS__) -# define msgflush() -# else -# define message(...) printf(__VA_ARGS__) -# define msgflush() fflush(stdout) -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define msgflush() -# else -# define message printf -# define msgflush() fflush(stdout) -# endif -#endif - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* All global variables used by this example are packed into a structure in - * order to avoid name collisions. - */ - -#if defined(CONFIG_EXAMPLES_USBMSC_BUILTIN) || defined(CONFIG_EXAMPLES_USBMSC_DEBUGMM) -struct usbmsc_state_s -{ - /* This is the handle that references to this particular USB storage driver - * instance. It is only needed if the USB mass storage device example is - * built using CONFIG_EXAMPLES_USBMSC_BUILTIN. In this case, the value - * of the driver handle must be remembered between the 'msconn' and 'msdis' - * commands. - */ - -#ifdef CONFIG_EXAMPLES_USBMSC_BUILTIN - FAR void *mshandle; -#endif - - /* Heap usage samples. These are useful for checking USB storage memory - * usage and for tracking down memoryh leaks. - */ - -#ifdef CONFIG_EXAMPLES_USBMSC_DEBUGMM - struct mallinfo mmstart; /* Memory usage before the connection */ - struct mallinfo mmprevious; /* The last memory usage sample */ - struct mallinfo mmcurrent; /* The current memory usage sample */ -#endif -}; -#endif - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* All global variables used by this example are packed into a structure in - * order to avoid name collisions. - */ - -#if defined(CONFIG_EXAMPLES_USBMSC_BUILTIN) || defined(CONFIG_EXAMPLES_USBMSC_DEBUGMM) -extern struct usbmsc_state_s g_usbmsc; -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: usbmsc_archinitialize - * - * Description: - * Perform architecture specific initialization. This function must - * configure the block device to export via USB. This function must be - * provided by architecture-specific logic in order to use this example. - * - ****************************************************************************/ - -extern int usbmsc_archinitialize(void); - -#endif /* __EXAMPLES_USBSTORAGE_USBMSC_H */ diff --git a/apps/examples/usbstorage/usbmsc_main.c b/apps/examples/usbstorage/usbmsc_main.c deleted file mode 100644 index ac7b82d01..000000000 --- a/apps/examples/usbstorage/usbmsc_main.c +++ /dev/null @@ -1,588 +0,0 @@ -/**************************************************************************** - * examples/usbstorage/usbmsc_main.c - * - * Copyright (C) 2008-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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <debug.h> - -#include <nuttx/usb/usbdev.h> -#include <nuttx/usb/usbdev_trace.h> - -#include "usbmsc.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_USBMSC_TRACEINIT -# define TRACE_INIT_BITS (TRACE_INIT_BIT) -#else -# define TRACE_INIT_BITS (0) -#endif - -#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT) - -#ifdef CONFIG_EXAMPLES_USBMSC_TRACECLASS -# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT) -#else -# define TRACE_CLASS_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS -# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|TRACE_READ_BIT|\ - TRACE_WRITE_BIT|TRACE_COMPLETE_BIT) -#else -# define TRACE_TRANSFER_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER -# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT) -#else -# define TRACE_CONTROLLER_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS -# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT) -#else -# define TRACE_INTERRUPT_BITS (0) -#endif - -#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\ - TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS) - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/* All global variables used by this example are packed into a structure in - * order to avoid name collisions. - */ - -#if defined(CONFIG_EXAMPLES_USBMSC_BUILTIN) || defined(CONFIG_EXAMPLES_USBMSC_DEBUGMM) -struct usbmsc_state_s g_usbmsc; -#endif - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: show_memory_usage - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_USBMSC_DEBUGMM -static void show_memory_usage(struct mallinfo *mmbefore, - struct mallinfo *mmafter) -{ - int diff; - - message(" total used free largest\n"); - message("Before:%11d%11d%11d%11d\n", - mmbefore->arena, mmbefore->uordblks, mmbefore->fordblks, mmbefore->mxordblk); - message("After: %11d%11d%11d%11d\n", - mmafter->arena, mmafter->uordblks, mmafter->fordblks, mmafter->mxordblk); - - diff = mmbefore->uordblks - mmafter->uordblks; - if (diff < 0) - { - message("Change:%11d allocated\n", -diff); - } - else if (diff > 0) - { - message("Change:%11d freed\n", diff); - } -} -#else -# define show_memory_usage(mm1, mm2) -#endif - -/**************************************************************************** - * Name: check_test_memory_usage - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_USBMSC_DEBUGMM -static void check_test_memory_usage(FAR const char *msg) -{ - /* Get the current memory usage */ - -#ifdef CONFIG_CAN_PASS_STRUCTS - g_usbmsc.mmcurrent = mallinfo(); -#else - (void)mallinfo(&g_usbmsc.mmcurrent); -#endif - - /* Show the change from the previous time */ - - message("\%s:\n", msg); - show_memory_usage(&g_usbmsc.mmprevious, &g_usbmsc.mmcurrent); - - /* Set up for the next test */ - -#ifdef CONFIG_CAN_PASS_STRUCTS - g_usbmsc.mmprevious = g_usbmsc.mmcurrent; -#else - memcpy(&g_usbmsc.mmprevious, &g_usbmsc.mmcurrent, sizeof(struct mallinfo)); -#endif -} -#else -# define check_test_memory_usage(msg) -#endif - -/**************************************************************************** - * Name: check_test_memory_usage - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_USBMSC_DEBUGMM -static void final_memory_usage(FAR const char *msg) -{ - /* Get the current memory usage */ - -#ifdef CONFIG_CAN_PASS_STRUCTS - g_usbmsc.mmcurrent = mallinfo(); -#else - (void)mallinfo(&g_usbmsc.mmcurrent); -#endif - - /* Show the change from the previous time */ - - message("\n%s:\n", msg); - show_memory_usage(&g_usbmsc.mmstart, &g_usbmsc.mmcurrent); -} -#else -# define final_memory_usage(msg) -#endif - -/**************************************************************************** - * Name: usbmsc_enumerate - ****************************************************************************/ - -#ifdef CONFIG_USBDEV_TRACE -static int usbmsc_enumerate(struct usbtrace_s *trace, void *arg) -{ - switch (trace->event) - { - case TRACE_DEVINIT: - message("USB controller initialization: %04x\n", trace->value); - break; - - case TRACE_DEVUNINIT: - message("USB controller un-initialization: %04x\n", trace->value); - break; - - case TRACE_DEVREGISTER: - message("usbdev_register(): %04x\n", trace->value); - break; - - case TRACE_DEVUNREGISTER: - message("usbdev_unregister(): %04x\n", trace->value); - break; - - case TRACE_EPCONFIGURE: - message("Endpoint configure(): %04x\n", trace->value); - break; - - case TRACE_EPDISABLE: - message("Endpoint disable(): %04x\n", trace->value); - break; - - case TRACE_EPALLOCREQ: - message("Endpoint allocreq(): %04x\n", trace->value); - break; - - case TRACE_EPFREEREQ: - message("Endpoint freereq(): %04x\n", trace->value); - break; - - case TRACE_EPALLOCBUFFER: - message("Endpoint allocbuffer(): %04x\n", trace->value); - break; - - case TRACE_EPFREEBUFFER: - message("Endpoint freebuffer(): %04x\n", trace->value); - break; - - case TRACE_EPSUBMIT: - message("Endpoint submit(): %04x\n", trace->value); - break; - - case TRACE_EPCANCEL: - message("Endpoint cancel(): %04x\n", trace->value); - break; - - case TRACE_EPSTALL: - message("Endpoint stall(true): %04x\n", trace->value); - break; - - case TRACE_EPRESUME: - message("Endpoint stall(false): %04x\n", trace->value); - break; - - case TRACE_DEVALLOCEP: - message("Device allocep(): %04x\n", trace->value); - break; - - case TRACE_DEVFREEEP: - message("Device freeep(): %04x\n", trace->value); - break; - - case TRACE_DEVGETFRAME: - message("Device getframe(): %04x\n", trace->value); - break; - - case TRACE_DEVWAKEUP: - message("Device wakeup(): %04x\n", trace->value); - break; - - case TRACE_DEVSELFPOWERED: - message("Device selfpowered(): %04x\n", trace->value); - break; - - case TRACE_DEVPULLUP: - message("Device pullup(): %04x\n", trace->value); - break; - - case TRACE_CLASSBIND: - message("Class bind(): %04x\n", trace->value); - break; - - case TRACE_CLASSUNBIND: - message("Class unbind(): %04x\n", trace->value); - break; - - case TRACE_CLASSDISCONNECT: - message("Class disconnect(): %04x\n", trace->value); - break; - - case TRACE_CLASSSETUP: - message("Class setup(): %04x\n", trace->value); - break; - - case TRACE_CLASSSUSPEND: - message("Class suspend(): %04x\n", trace->value); - break; - - case TRACE_CLASSRESUME: - message("Class resume(): %04x\n", trace->value); - break; - - case TRACE_CLASSRDCOMPLETE: - message("Class RD request complete: %04x\n", trace->value); - break; - - case TRACE_CLASSWRCOMPLETE: - message("Class WR request complete: %04x\n", trace->value); - break; - - default: - switch (TRACE_ID(trace->event)) - { - case TRACE_CLASSAPI_ID: /* Other class driver system API calls */ - message("Class API call %d: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_CLASSSTATE_ID: /* Track class driver state changes */ - message("Class state %d: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_INTENTRY_ID: /* Interrupt handler entry */ - message("Interrrupt %d entry: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_INTDECODE_ID: /* Decoded interrupt trace->event */ - message("Interrrupt decode %d: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_INTEXIT_ID: /* Interrupt handler exit */ - message("Interrrupt %d exit: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_OUTREQQUEUED_ID: /* Request queued for OUT endpoint */ - message("EP%d OUT request queued: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_INREQQUEUED_ID: /* Request queued for IN endpoint */ - message("EP%d IN request queued: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_READ_ID: /* Read (OUT) action */ - message("EP%d OUT read: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_WRITE_ID: /* Write (IN) action */ - message("EP%d IN write: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_COMPLETE_ID: /* Request completed */ - message("EP%d request complete: %04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_DEVERROR_ID: /* USB controller driver error event */ - message("Controller error: %02x:%04x\n", TRACE_DATA(trace->event), trace->value); - break; - - case TRACE_CLSERROR_ID: /* USB class driver error event */ - message("Class error: %02x:%04x\n", TRACE_DATA(trace->event), trace->value); - break; - - default: - message("Unrecognized event: %02x:%02x:%04x\n", - TRACE_ID(trace->event) >> 8, TRACE_DATA(trace->event), trace->value); - break; - } - } - return OK; -} -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * msconn_main - * - * Description: - * This is the main program that configures the USB mass storage device - * and exports the LUN(s). If CONFIG_EXAMPLES_USBMSC_BUILTIN is defined - * in the NuttX configuration, then this program can be executed by - * entering the "msconn" command at the NSH console. - * - ****************************************************************************/ - -int msconn_main(int argc, char *argv[]) -{ - FAR void *handle; - int ret; - - /* If this program is implemented as the NSH 'msconn' command, then we need to - * do a little error checking to assure that we are not being called re-entrantly. - */ - -#ifdef CONFIG_EXAMPLES_USBMSC_BUILTIN - - /* Check if there is a non-NULL USB mass storage device handle (meaning that the - * USB mass storage device is already configured). - */ - - if (g_usbmsc.mshandle) - { - message("msconn_main: ERROR: Already connected\n"); - return 1; - } -#endif - -#ifdef CONFIG_EXAMPLES_USBMSC_DEBUGMM -# ifdef CONFIG_CAN_PASS_STRUCTS - g_usbmsc.mmstart = mallinfo(); - g_usbmsc.mmprevious = g_usbmsc.mmstart; -# else - (void)mallinfo(&g_usbmsc.mmstart); - memcpy(&g_usbmsc.mmprevious, &g_usbmsc.mmstart, sizeof(struct mallinfo)); -# endif -#endif - - /* Initialize USB trace output IDs */ - - usbtrace_enable(TRACE_BITSET); - check_test_memory_usage("After usbtrace_enable()"); - - /* Register block drivers (architecture-specific) */ - - message("msconn_main: Creating block drivers\n"); - ret = usbmsc_archinitialize(); - if (ret < 0) - { - message("msconn_main: usbmsc_archinitialize failed: %d\n", -ret); - return 2; - } - check_test_memory_usage("After usbmsc_archinitialize()"); - - /* Then exports the LUN(s) */ - - message("msconn_main: Configuring with NLUNS=%d\n", CONFIG_EXAMPLES_USBMSC_NLUNS); - ret = usbmsc_configure(CONFIG_EXAMPLES_USBMSC_NLUNS, &handle); - if (ret < 0) - { - message("msconn_main: usbmsc_configure failed: %d\n", -ret); - usbmsc_uninitialize(handle); - return 3; - } - message("msconn_main: handle=%p\n", handle); - check_test_memory_usage("After usbmsc_configure()"); - - message("msconn_main: Bind LUN=0 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH1); - ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH1, 0, 0, 0, false); - if (ret < 0) - { - message("msconn_main: usbmsc_bindlun failed for LUN 1 using %s: %d\n", - CONFIG_EXAMPLES_USBMSC_DEVPATH1, -ret); - usbmsc_uninitialize(handle); - return 4; - } - check_test_memory_usage("After usbmsc_bindlun()"); - -#if CONFIG_EXAMPLES_USBMSC_NLUNS > 1 - - message("msconn_main: Bind LUN=1 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH2); - ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH2, 1, 0, 0, false); - if (ret < 0) - { - message("msconn_main: usbmsc_bindlun failed for LUN 2 using %s: %d\n", - CONFIG_EXAMPLES_USBMSC_DEVPATH2, -ret); - usbmsc_uninitialize(handle); - return 5; - } - check_test_memory_usage("After usbmsc_bindlun() #2"); - -#if CONFIG_EXAMPLES_USBMSC_NLUNS > 2 - - message("msconn_main: Bind LUN=2 to %s\n", CONFIG_EXAMPLES_USBMSC_DEVPATH3); - ret = usbmsc_bindlun(handle, CONFIG_EXAMPLES_USBMSC_DEVPATH3, 2, 0, 0, false); - if (ret < 0) - { - message("msconn_main: usbmsc_bindlun failed for LUN 3 using %s: %d\n", - CONFIG_EXAMPLES_USBMSC_DEVPATH3, -ret); - usbmsc_uninitialize(handle); - return 6; - } - check_test_memory_usage("After usbmsc_bindlun() #3"); - -#endif -#endif - - ret = usbmsc_exportluns(handle); - if (ret < 0) - { - message("msconn_main: usbmsc_exportluns failed: %d\n", -ret); - usbmsc_uninitialize(handle); - return 7; - } - check_test_memory_usage("After usbmsc_exportluns()"); - - /* It this program was configued as an NSH command, then just exit now. - * Also, if signals are not enabled (and, hence, sleep() is not supported. - * then we have not real option but to exit now. - */ - -#if !defined(CONFIG_EXAMPLES_USBMSC_BUILTIN) && !defined(CONFIG_DISABLE_SIGNALS) - - /* Otherwise, this thread will hang around and monitor the USB storage activity */ - - for (;;) - { - msgflush(); - sleep(5); - -# ifdef CONFIG_USBDEV_TRACE - message("\nmsconn_main: USB TRACE DATA:\n"); - ret = usbtrace_enumerate(usbmsc_enumerate, NULL); - if (ret < 0) - { - message("msconn_main: usbtrace_enumerate failed: %d\n", -ret); - usbmsc_uninitialize(handle); - return 8; - } - check_test_memory_usage("After usbtrace_enumerate()"); -# else - message("msconn_main: Still alive\n"); -# endif - } -#elif defined(CONFIG_EXAMPLES_USBMSC_BUILTIN) - - /* Return the USB mass storage device handle so it can be used by the 'misconn' - * command. - */ - - message("msconn_main: Connected\n"); - g_usbmsc.mshandle = handle; - check_test_memory_usage("After MS connection"); - -#else /* defined(CONFIG_DISABLE_SIGNALS) */ - - /* Just exit */ - - message("msconn_main: Exiting\n"); - - /* Dump debug memory usage */ - - final_memory_usage("Final memory usage"); -#endif - return 0; -} - -/**************************************************************************** - * msdis_main - * - * Description: - * This is a program entry point that will disconnet the USB mass storage - * device. This program is only available if CONFIG_EXAMPLES_USBMSC_BUILTIN - * is defined in the NuttX configuration. In that case, this program can - * be executed by entering the "msdis" command at the NSH console. - * - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_USBMSC_BUILTIN -int msdis_main(int argc, char *argv[]) -{ - /* First check if the USB mass storage device is already connected */ - - if (!g_usbmsc.mshandle) - { - message("msdis: ERROR: Not connected\n"); - return 1; - } - check_test_memory_usage("Since MS connection"); - - /* Then disconnect the device and uninitialize the USB mass storage driver */ - - usbmsc_uninitialize(g_usbmsc.mshandle); - g_usbmsc.mshandle = NULL; - message("msdis: Disconnected\n"); - check_test_memory_usage("After usbmsc_uninitialize()"); - - /* Dump debug memory usage */ - - final_memory_usage("Final memory usage"); - return 0; -} -#endif diff --git a/apps/examples/usbterm/Kconfig b/apps/examples/usbterm/Kconfig deleted file mode 100644 index 622b7ad88..000000000 --- a/apps/examples/usbterm/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_USBTERM - bool "USB serial terminal example" - default n - ---help--- - Enable the USB serial terminal example - -if EXAMPLES_USBTERM -endif diff --git a/apps/examples/usbterm/Makefile b/apps/examples/usbterm/Makefile deleted file mode 100644 index c5fb95331..000000000 --- a/apps/examples/usbterm/Makefile +++ /dev/null @@ -1,109 +0,0 @@ -############################################################################ -# apps/examples/usbterm/Makefile -# -# 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 -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# USB terminal example - -ASRCS = -CSRCS = usbterm_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Built-in application info - -APPNAME = usbterm -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_EXAMPLES_USBTERM_BUILTIN),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/usbterm/usbterm.h b/apps/examples/usbterm/usbterm.h deleted file mode 100644 index 2534c2f3c..000000000 --- a/apps/examples/usbterm/usbterm.h +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************** - * examples/usbterm/usbterm.h - * - * 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 - * 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 __APPS_EXAMPLES_USBTERM_USBTERM_H -#define __APPS_EXAMPLES_USBTERM_USBTERM_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> - -#include <stdint.h> -#include <stdbool.h> -#include <semaphore.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -#ifndef CONFIG_EXAMPLES_USBTERM_BUFLEN -# define CONFIG_EXAMPLES_USBTERM_BUFLEN 256 -#endif - -#ifdef CONFIG_EXAMPLES_USBTERM_TRACEINIT -# define TRACE_INIT_BITS (TRACE_INIT_BIT) -#else -# define TRACE_INIT_BITS (0) -#endif - -#define TRACE_ERROR_BITS (TRACE_DEVERROR_BIT|TRACE_CLSERROR_BIT) - -#ifdef CONFIG_EXAMPLES_USBTERM_TRACECLASS -# define TRACE_CLASS_BITS (TRACE_CLASS_BIT|TRACE_CLASSAPI_BIT|TRACE_CLASSSTATE_BIT) -#else -# define TRACE_CLASS_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_USBTERM_TRACETRANSFERS -# define TRACE_TRANSFER_BITS (TRACE_OUTREQQUEUED_BIT|TRACE_INREQQUEUED_BIT|TRACE_READ_BIT|\ - TRACE_WRITE_BIT|TRACE_COMPLETE_BIT) -#else -# define TRACE_TRANSFER_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_USBTERM_TRACECONTROLLER -# define TRACE_CONTROLLER_BITS (TRACE_EP_BIT|TRACE_DEV_BIT) -#else -# define TRACE_CONTROLLER_BITS (0) -#endif - -#ifdef CONFIG_EXAMPLES_USBTERM_TRACEINTERRUPTS -# define TRACE_INTERRUPT_BITS (TRACE_INTENTRY_BIT|TRACE_INTDECODE_BIT|TRACE_INTEXIT_BIT) -#else -# define TRACE_INTERRUPT_BITS (0) -#endif - -#define TRACE_BITSET (TRACE_INIT_BITS|TRACE_ERROR_BITS|TRACE_CLASS_BITS|\ - TRACE_TRANSFER_BITS|TRACE_CONTROLLER_BITS|TRACE_INTERRUPT_BITS) - -#ifdef CONFIG_CDCACM -# define USBTERM_DEVNAME "/dev/ttyACM0" -#else -# define USBTERM_DEVNAME "/dev/ttyUSB0" -#endif - -/* Debug ********************************************************************/ - -#ifdef CONFIG_CPP_HAVE_VARARGS -# ifdef CONFIG_DEBUG -# define message(...) lib_rawprintf(__VA_ARGS__) -# define trmessage lib_rawprintf -# else -# define message(...) printf(__VA_ARGS__) -# define trmessage printf -# endif -#else -# ifdef CONFIG_DEBUG -# define message lib_lowprintf -# define trmessage lib_lowprintf -# else -# define message printf -# define trmessage printf -# endif -#endif - -#define IOBUFFER_SIZE 256 - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* All USB terminal state data is packaged in a single structure to minimize - * name conflicts with other global symbols -- a poor man's name space. - */ - -struct usbterm_globals_s -{ - FILE *instream; /* Stream for incoming USB data */ - FILE *outstream; /* Stream for outgoing USB data */ - pthread_t listener; /* USB terminal listener thread */ - bool peer; /* True: A peer is connected to the serial port on - * the remote host */ - - /* Buffers for incoming and outgoing data */ - - char inbuffer[CONFIG_EXAMPLES_USBTERM_BUFLEN]; - char outbuffer[CONFIG_EXAMPLES_USBTERM_BUFLEN]; -}; - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -/* USB terminal state data */ - -extern struct usbterm_globals_s g_usbterm; - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ -/**************************************************************************** - * Name: - * - * Description: - * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will - * call this user provided function as part of its initialization. - * - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_USBTERM_DEVINIT -int usbterm_devinit(void); -#endif - -/**************************************************************************** - * Name: - * - * Description: - * If CONFIG_EXAMPLES_USBTERM_DEVINIT is defined, then the example will - * call this user provided function as part of its termination sequeunce. - * - ****************************************************************************/ - -#ifdef CONFIG_EXAMPLES_USBTERM_DEVINIT -void usbterm_devuninit(void); -#endif - -#endif /* __APPS_EXAMPLES_USBTERM_USBTERM_H */ diff --git a/apps/examples/usbterm/usbterm_main.c b/apps/examples/usbterm/usbterm_main.c deleted file mode 100644 index 69301dfcd..000000000 --- a/apps/examples/usbterm/usbterm_main.c +++ /dev/null @@ -1,376 +0,0 @@ -/**************************************************************************** - * examples/usbterm/usbterm_main.c - * - * 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 - * 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/stat.h> - -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <pthread.h> -#include <fcntl.h> -#include <errno.h> -#include <debug.h> - -#include <apps/readline.h> - -#include <nuttx/usb/usbdev.h> -#include <nuttx/usb/usbdev_trace.h> - -#ifdef CONFIG_CDCACM -# include <nuttx/usb/cdcacm.h> -#endif - -#ifdef CONFIG_CDCACM -# include <nuttx/usb/pl2303.h> -#endif - -#include "usbterm.h" - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* USB terminal state data */ - -struct usbterm_globals_s g_usbterm; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: trace_callback - * - * Description: - * Callback from USB trace instrumentation. - * - ****************************************************************************/ - -#ifdef CONFIG_USBDEV_TRACE -static int trace_callback(struct usbtrace_s *trace, void *arg) -{ - usbtrace_trprintf((trprintf_t)trmessage, trace->event, trace->value); - return 0; -} -#endif - -/**************************************************************************** - * Name: dumptrace - * - * Description: - * Dump collected trace data. - * - ****************************************************************************/ - -#ifdef CONFIG_USBDEV_TRACE -static void dumptrace(void) -{ - (void)usbtrace_enumerate(trace_callback, NULL); -} -#else -# define dumptrace() -#endif - -/**************************************************************************** - * Name: dumptrace - * - * Description: - * Entry point for the listener thread. - * - ****************************************************************************/ - -FAR void *usbterm_listener(FAR void *parameter) -{ - message("usbterm_listener: Waiting for remote input\n"); - for (;;) - { - /* Display the prompt string on the remote USB serial connection -- only - * if we know that there is someone listening at the other end. The - * remote side must initiate the the conversation. - */ - - if (g_usbterm.peer) - { - fputs("\rusbterm> ", g_usbterm.outstream); - fflush(g_usbterm.outstream); - } - - /* Get the next line of input from the remote USB serial connection */ - - if (fgets(g_usbterm.inbuffer, CONFIG_EXAMPLES_USBTERM_BUFLEN, g_usbterm.instream)) - { - /* If we receive anything, then we can be assured that there is someone - * with the serial driver open on the remote host. - */ - - g_usbterm.peer = true; - - /* Echo the line on the local stdout */ - - fputs(g_usbterm.inbuffer, stdout); - - /* Display the prompt string on stdout */ - - fputs("usbterm> ", stdout); - fflush(stdout); - } - - /* If USB tracing is enabled, then dump all collected trace data to stdout */ - - dumptrace(); - } - - /* Won't get here */ - - return NULL; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: usbterm_main - * - * Description: - * Main entry point for the USB serial terminal example. - * - ****************************************************************************/ - -int usbterm_main(int argc, char *argv[]) -{ - pthread_attr_t attr; - int ret; - - /* Initialize global data */ - - memset(&g_usbterm, 0, sizeof(struct usbterm_globals_s)); - - /* Initialization of the USB hardware may be performed by logic external to - * this test. - */ - -#ifdef CONFIG_EXAMPLES_USBTERM_DEVINIT - message("usbterm_main: Performing external device initialization\n"); - ret = usbterm_devinit(); - if (ret != OK) - { - message("usbterm_main: usbterm_devinit failed: %d\n", ret); - goto errout; - } -#endif - - /* Initialize the USB serial driver */ - - message("usbterm_main: Registering USB serial driver\n"); -#ifdef CONFIG_CDCACM - ret = cdcacm_initialize(0, NULL); -#else - ret = usbdev_serialinitialize(0); -#endif - if (ret < 0) - { - message("usbterm_main: ERROR: Failed to create the USB serial device: %d\n", -ret); - goto errout_with_devinit; - } - message("usbterm_main: Successfully registered the serial driver\n"); - -#if CONFIG_USBDEV_TRACE && CONFIG_USBDEV_TRACE_INITIALIDSET != 0 - /* If USB tracing is enabled and tracing of initial USB events is specified, - * then dump all collected trace data to stdout - */ - - sleep(5); - dumptrace(); -#endif - - /* Then, in any event, configure trace data collection as configured */ - - usbtrace_enable(TRACE_BITSET); - - /* Open the USB serial device for writing */ - - do - { - message("usbterm_main: Opening USB serial driver\n"); - - g_usbterm.outstream = fopen(USBTERM_DEVNAME, "w"); - if (g_usbterm.outstream == NULL) - { - int errcode = errno; - message("usbterm_main: ERROR: Failed to open " USBTERM_DEVNAME " for writing: %d\n", - errcode); - - /* ENOTCONN means that the USB device is not yet connected */ - - if (errcode == ENOTCONN) - { - message("usbterm_main: Not connected. Wait and try again.\n"); - sleep(5); - } - else - { - /* Give up on other errors */ - - goto errout_with_devinit; - } - } - - /* If USB tracing is enabled, then dump all collected trace data to stdout */ - - dumptrace(); - } - while (g_usbterm.outstream == NULL); - - /* Open the USB serial device for reading. Since we are already connected, this - * should not fail. - */ - - g_usbterm.instream = fopen(USBTERM_DEVNAME, "r"); - if (g_usbterm.instream == NULL) - { - message("usbterm_main: ERROR: Failed to open " USBTERM_DEVNAME " for reading: %d\n", errno); - goto errout_with_outstream; - } - - message("usbterm_main: Successfully opened the serial driver\n"); - - /* Start the USB term listener thread */ - - message("usbterm_main: Starting the listener thread\n"); - - ret = pthread_attr_init(&attr); - if (ret != OK) - { - message("usbterm_main: pthread_attr_init failed: %d\n", ret); - goto errout_with_streams; - } - - ret = pthread_create(&g_usbterm.listener, &attr, - usbterm_listener, (pthread_addr_t)0); - if (ret != 0) - { - message("usbterm_main: Error in thread creation: %d\n", ret); - goto errout_with_streams; - } - - /* Send messages and get responses -- forever */ - - message("usbterm_main: Waiting for local input\n"); - for (;;) - { - /* Display the prompt string on stdout */ - - fputs("usbterm> ", stdout); - fflush(stdout); - - /* Get the next line of input */ - -#ifdef CONFIG_EXAMPLES_USBTERM_FGETS - /* fgets returns NULL on end-of-file or any I/O error */ - - if (fgets(g_usbterm.outbuffer, CONFIG_EXAMPLES_USBTERM_BUFLEN, stdin) == NULL) - { - printf("ERROR: fgets failed: %d\n", errno); - return 1; - } -#else - ret = readline(g_usbterm.outbuffer, CONFIG_EXAMPLES_USBTERM_BUFLEN, stdin, stdout); - - /* Readline normally returns the number of characters read, - * but will return 0 on end of file or a negative value - * if an error occurs. Either will cause the session to - * terminate. - */ - - if (ret <= 0) - { - printf("ERROR: readline failed: %d\n", ret); - return 1; - } -#endif - /* Is there anyone listening on the other end? */ - - else if (g_usbterm.peer) - { - /* Yes.. Send the line of input via USB */ - - fputs(g_usbterm.outbuffer, g_usbterm.outstream); - - /* Display the prompt string on the remote USB serial connection */ - - fputs("\rusbterm> ", g_usbterm.outstream); - fflush(g_usbterm.outstream); - } - else - { - printf("Still waiting for remote peer. Please try again later.\n", ret); - } - - /* If USB tracing is enabled, then dump all collected trace data to stdout */ - - dumptrace(); - } - - /* Error exits */ - -errout_with_streams: - fclose(g_usbterm.instream); -errout_with_outstream: - fclose(g_usbterm.outstream); -errout_with_devinit: -#ifdef CONFIG_EXAMPLES_USBTERM_DEVINIT - usbterm_devuninit(); -errout: -#endif - message("usbterm_main: Aborting\n"); - return 1; -} - diff --git a/apps/examples/watchdog/Makefile b/apps/examples/watchdog/Makefile index 9890959fb..d2739dbb0 100644 --- a/apps/examples/watchdog/Makefile +++ b/apps/examples/watchdog/Makefile @@ -48,14 +48,10 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) + BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}" else - BIN = ../../libapps$(LIBEXT) -endif + BIN = "$(APPDIR)/libapps$(LIBEXT)" endif ROOTDEPPATH = --dep-path . @@ -80,7 +76,9 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) .built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) + @( for obj in $(OBJS) ; do \ + $(call ARCHIVE, $(BIN), $${obj}); \ + done ; ) @touch .built .context: @@ -90,17 +88,16 @@ $(COBJS): %$(OBJEXT): %.c context: .context .depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ depend: .depend clean: - $(call DELFILE, .built) + @rm -f *.o *~ .*.swp .built $(call CLEAN) distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) + @rm -f Make.dep .depend -include Make.dep diff --git a/apps/examples/wget/Kconfig b/apps/examples/wget/Kconfig deleted file mode 100644 index f7d5a2a89..000000000 --- a/apps/examples/wget/Kconfig +++ /dev/null @@ -1,37 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_WGET - bool "wget example" - default n - depends on NET_TCP && !NSH_BUILTIN_APPS - ---help--- - Enable the wget example - -if EXAMPLES_WGET - -config EXAMPLES_WGET_URL - string "File URL" - default "" - ---help--- - The URL of the file to get - -config EXAMPLES_WGET_NOMAC - bool "Use Canned MAC Address" - default n - -config EXAMPLES_WGET_IPADDR - hex "Target IP address" - default 0x0a000002 - -config EXAMPLES_WGET_DRIPADDR - hex "Default Router IP address (Gateway)" - default 0x0a000001 - -config EXAMPLES_WGET_NETMASK - hex "Network Mask" - default 0xffffff00 - -endif diff --git a/apps/examples/wget/Makefile b/apps/examples/wget/Makefile deleted file mode 100644 index 3e5f5d63d..000000000 --- a/apps/examples/wget/Makefile +++ /dev/null @@ -1,98 +0,0 @@ -############################################################################ -# apps/examples/wget/Makefile -# -# Copyright (C) 2009-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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# wget webclient example - -ASRCS = -CSRCS = target.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - @$(MAKE) -f Makefile.host clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/wget/Makefile.host b/apps/examples/wget/Makefile.host deleted file mode 100644 index 3895835d8..000000000 --- a/apps/examples/wget/Makefile.host +++ /dev/null @@ -1,79 +0,0 @@ -############################################################################ -# apps/examples/wget/Makefile.host -# -# Copyright (C) 2009, 2011 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. -# -############################################################################ - -WD = ${shell pwd} -TOPDIR = $(WD)/../.. --include $(TOPDIR)/Make.defs - -OBJS = host.o1 webclient.o1 uip_parsehttpurl.o1 -BIN = wget - -HOSTCFLAGS += -DCONFIG_WEBCLIENT_HOST=1 -HOSTCFLAGS += -I. -include hostdefs.h -VPATH = $(TOPDIR)/netutils/webclient:$(TOPDIR)/netutils/uiplib:. - -all: $(BIN) -.PHONY: clean context clean_context distclean - -$(OBJS): %.o1: %.c - $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ - -apps/netutils: - @mkdir -p apps/netutils - -apps/netutils/webclient.h: apps/netutils $(TOPDIR)/include/apps/netutils/webclient.h - @cp -a $(TOPDIR)/include/apps/netutils/webclient.h apps/netutils/. - -apps/netutils/uiplib.h: apps/netutils $(TOPDIR)/include/apps/netutils/uiplib.h - @cp -a $(TOPDIR)/include/apps/netutils/uiplib.h apps/netutils/. - -nuttx: - @mkdir nuttx - -nuttx/config.h: nuttx - @touch nuttx/config.h - -headers: apps/netutils/webclient.h apps/netutils/uiplib.h nuttx/config.h - -$(BIN): headers $(OBJS) - $(HOSTCC) $(HOSTLDFLAGS) $(OBJS) -o $@ - -clean: - $(call DELFILE, $(BIN).*) - $(call DELFILE, *.o1) - $(call CLEAN) - @rm -rf net nuttx - - diff --git a/apps/examples/wget/host.c b/apps/examples/wget/host.c deleted file mode 100644 index b0e65b505..000000000 --- a/apps/examples/wget/host.c +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** - * examples/wget/host.c - * - * Copyright (C) 2009 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 Gregory Nutt 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 <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -#include <apps/netutils/webclient.h> - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: callback - ****************************************************************************/ - -static void callback(FAR char **buffer, int offset, int datend, - FAR int *buflen, FAR void *arg) -{ - (void)write(1, &((*buffer)[offset]), datend - offset); -} - -/**************************************************************************** - * Name: show_usage - ****************************************************************************/ - -static void show_usage(const char *progname, int exitcode) -{ - fprintf(stderr, "USAGE: %s <url>\n", progname); - exit(exitcode); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ -/**************************************************************************** - * Name: main - ****************************************************************************/ - -int main(int argc, char **argv, char **envp) -{ - char buffer[1024]; - int ret; - - if (argc != 2) - { - show_usage(argv[0], 1); - } - - printf("WGET: Getting %s\n", argv[1]); - ret = wget(argv[1], buffer, 1024, callback, NULL); - if (ret < 0) - { - fprintf(stderr, "WGET: wget failed: %s\n", strerror(errno)); - } - return 0; -} diff --git a/apps/examples/wget/hostdefs.h b/apps/examples/wget/hostdefs.h deleted file mode 100644 index e9860c22d..000000000 --- a/apps/examples/wget/hostdefs.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** - * examples/wget/hostdefs.h - * - * Copyright (C) 2009 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 __HOSTDEFS_H -#define __HOSTDEFS_H - -/**************************************************************************** - * Included Files - *****************************************************************************/ - -#include <stdint.h> -#include <stdbool.h> -#include <stdio.h> - -/**************************************************************************** - * Preprocessor Defintiions - *****************************************************************************/ - -#define HTONS(a) htons(a) -#define HTONL(a) htonl(a) -#define CONFIG_CPP_HAVE_WARNING 1 -#define CONFIG_HAVE_GETHOSTBYNAME 1 -#define FAR - -#define ndbg(...) printf(__VA_ARGS__) -#define nvdbg(...) printf(__VA_ARGS__) - -#define ERROR (-1) -#define OK (0) - -/**************************************************************************** - * Type Definitions - *****************************************************************************/ - -typedef void *(*pthread_startroutine_t)(void *); - -#endif /* __HOSTDEFS_H */ diff --git a/apps/examples/wget/target.c b/apps/examples/wget/target.c deleted file mode 100644 index d205a81ae..000000000 --- a/apps/examples/wget/target.c +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** - * examples/wget/target.c - * - * Copyright (C) 2009, 2011 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 Gregory Nutt 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 <unistd.h> - -#include <netinet/in.h> -#include <arpa/inet.h> -#include <net/if.h> - -#include <nuttx/net/uip/uip.h> - -#include <apps/netutils/uiplib.h> -#include <apps/netutils/resolv.h> -#include <apps/netutils/webclient.h> - -/**************************************************************************** - * Preprocessor Definitions - ****************************************************************************/ - -/* Configuation Checks ******************************************************/ -/* BEWARE: - * There are other configuration settings needed in netutitls/wget/wgetc.s, - * but there are default values for those so we cannot check them here. - */ - -#ifndef CONFIG_EXAMPLES_WGET_IPADDR -# error "You must define CONFIG_EXAMPLES_WGET_IPADDR" -#endif - -#ifndef CONFIG_EXAMPLES_WGET_DRIPADDR -# error "You must define CONFIG_EXAMPLES_WGET_DRIPADDR" -#endif - -#ifndef CONFIG_EXAMPLES_WGET_NETMASK -# error "You must define CONFIG_EXAMPLES_WGET_NETMASK" -#endif - -#ifndef CONFIG_NET -# error "You must define CONFIG_NET" -#endif - -#ifndef CONFIG_NET_TCP -# error "You must define CONFIG_NET_TCP" -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static char g_iobuffer[512]; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ -/**************************************************************************** - * Name: callback - ****************************************************************************/ - -static void callback(FAR char **buffer, int offset, int datend, - FAR int *buflen, FAR void *arg) -{ - (void)write(1, &((*buffer)[offset]), datend - offset); -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * wget_main - ****************************************************************************/ - -int wget_main(int argc, char *argv[]) -{ - struct in_addr addr; -#if defined(CONFIG_EXAMPLES_WGET_NOMAC) - uint8_t mac[IFHWADDRLEN]; -#endif - -/* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_WGET_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up our host address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_WGET_IPADDR); - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_WGET_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_WGET_NETMASK); - uip_setnetmask("eth0", &addr); - - /* Then start the server */ - - wget(CONFIG_EXAMPLES_WGET_URL, g_iobuffer, 512, callback, NULL); - return 0; -} diff --git a/apps/examples/wgetjson/Kconfig b/apps/examples/wgetjson/Kconfig deleted file mode 100644 index f7f909690..000000000 --- a/apps/examples/wgetjson/Kconfig +++ /dev/null @@ -1,27 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_WGETJSON - bool "wget JSON Example" - default n - depends on NETUTILS_JSON - ---help--- - Enable the wget JSON example - -if EXAMPLES_WGETJSON - -config EXAMPLES_WGETJSON_MAXSIZE - int "Max. JSON Buffer Size" - default 1024 - -config EXAMPLES_WGETJSON_URL - string "wget URL" - default "http://10.0.0.1/wgetjson/json_cmd.php" - -config EXAMPLES_WGETPOST_URL - string "wget_post URL" - default "http://10.0.0.1/wgetjson/post_cmd.php" - -endif diff --git a/apps/examples/wgetjson/Makefile b/apps/examples/wgetjson/Makefile deleted file mode 100644 index fa8f302c6..000000000 --- a/apps/examples/wgetjson/Makefile +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################ -# apps/examples/wgetjson/Makefile -# -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# Hello, World! Example - -ASRCS = -CSRCS = wgetjson_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Buttons built-in application info - -APPNAME = wgetjson -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -# Common build - -VPATH = - -all: .built -.PHONY: context clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/wgetjson/webserver/wgetjson/json_cmd.php b/apps/examples/wgetjson/webserver/wgetjson/json_cmd.php deleted file mode 100644 index 2b66ff18f..000000000 --- a/apps/examples/wgetjson/webserver/wgetjson/json_cmd.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php
-/*
-$json = "{\n\"name\": \"Jack (\\\"Bee\\\") Nimble\", \n\"format\": {\"type\": \"rect\", \n\"width\": 1920, \n\"height\": 1080, \n\"interlace\": false,\"frame rate\": 24\n}\n}";
-*/
-$ja["name"] = "Jack (\"Bee\") Nimble";
-$ja["format"]["type"] = "rect";
-$ja["format"]["width"] = 1920;
-$ja["format"]["height"] = 1080;
-$ja["format"]["interlace"] = false;
-$ja["format"]["frame rate"] = 24;
-
-echo json_encode($ja);
-?>
\ No newline at end of file diff --git a/apps/examples/wgetjson/webserver/wgetjson/post_cmd.php b/apps/examples/wgetjson/webserver/wgetjson/post_cmd.php deleted file mode 100644 index a35230075..000000000 --- a/apps/examples/wgetjson/webserver/wgetjson/post_cmd.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php
-echo json_encode($_POST);
-?>
\ No newline at end of file diff --git a/apps/examples/wgetjson/wgetjson_main.c b/apps/examples/wgetjson/wgetjson_main.c deleted file mode 100644 index 8f82d1fca..000000000 --- a/apps/examples/wgetjson/wgetjson_main.c +++ /dev/null @@ -1,413 +0,0 @@ -/**************************************************************************** - * examples/wgetjson/wgetjson_main.c - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Darcy Gong - * - * 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 <stdbool.h> - -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> -#include <debug.h> - -#include <apps/netutils/uiplib.h> -#include <apps/netutils/webclient.h> -#include <apps/netutils/cJSON.h> - -/**************************************************************************** - * Definitions - ****************************************************************************/ - -#ifndef CONFIG_EXAMPLES_WGETJSON_MAXSIZE -# define CONFIG_EXAMPLES_WGETJSON_MAXSIZE 1024 -#endif - -#ifndef CONFIG_EXAMPLES_WGETJSON_URL -# define CONFIG_EXAMPLES_WGETJSON_URL "http://10.0.0.1/wgetjson/json_cmd.php" -#endif - -#ifndef CONFIG_EXAMPLES_WGETPOST_URL -# define CONFIG_EXAMPLES_WGETPOST_URL "http://10.0.0.1/wgetjson/post_cmd.php" -#endif - -#define MULTI_POST_NDATA 3 - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static char *g_json_buff = NULL; -static int g_json_bufflen = 0; -static bool g_has_json = false; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static void wgetjson_postdebug_callback(FAR char **buffer, int offset, - int datend, FAR int *buflen, - FAR void *arg) -{ - int len = datend - offset; - if (len <= 0) - { - printf("Callback No Data!\n"); - return; - } - - ((*buffer)[datend]) = '\0'; - printf("Callback Data(Length:%d):\n%s\n", len, &((*buffer)[offset])); -} - -/**************************************************************************** - * Name: wgetjson_callback - ****************************************************************************/ - -static void wgetjson_callback(FAR char **buffer, int offset, int datend, - FAR int *buflen, FAR void *arg) -{ - int len = datend - offset,org=len; - - if (len <= 0) - { - return; - } - - if (!g_json_buff) - { - g_json_buff = malloc(len + 1); - memcpy(g_json_buff, &((*buffer)[offset]), len); - g_json_buff[len] = 0; - g_json_bufflen = len; - } - else - { - if (g_json_bufflen >= CONFIG_EXAMPLES_WGETJSON_MAXSIZE) - { - g_json_bufflen += org; - return; - } - - if (g_json_bufflen+len > CONFIG_EXAMPLES_WGETJSON_MAXSIZE) - { - len = CONFIG_EXAMPLES_WGETJSON_MAXSIZE - g_json_bufflen; - } - - g_json_buff = realloc(g_json_buff, g_json_bufflen + len + 1); - memcpy(&g_json_buff[g_json_bufflen-1], &((*buffer)[offset]), len); - g_json_buff[g_json_bufflen + len] = 0; - g_json_bufflen += org; - } -} - -/**************************************************************************** - * Name: wgetjson_json_release - ****************************************************************************/ - -static void wgetjson_json_release(void) -{ - if (g_json_buff) - { - free(g_json_buff); - g_json_buff = NULL; - } - - g_json_bufflen = 0; -} - -/**************************************************************************** - * Name: wgetjson_doit - ****************************************************************************/ - -#if 0 /* Not used */ -static void wgetjson_doit(char *text) -{ - char *out; - cJSON *json; - - json = cJSON_Parse(text); - if (!json) - { - printf("Error before: [%s]\n",cJSON_GetErrorPtr()); - } - else - { - out = cJSON_Print(json); - cJSON_Delete(json); - printf("%s\n", out); - free(out); - } -} -#endif - -/**************************************************************************** - * Name: wgetjson_json_item_callback - ****************************************************************************/ - -static int wgetjson_json_item_callback(const char *name,int type,cJSON *item) -{ - if (strlen(name) > 8 && !memcmp(name, "/(null)", 7)) - { - name += 8; - g_has_json = true; - } - - if (!strcmp(name, "name")) - { - printf("name:\t\t\t%s \n", item->valuestring); - // todo something.... - } - else if (strcmp(name, "format/type")==0) - { - printf("format/type:\t\t%s \n", item->valuestring); - // todo something.... - } - else if (!strcmp(name, "format/width")) - { - printf("format/width:\t\t%d \n", item->valueint); - // todo something.... - } - else if (!strcmp(name, "format/height")) - { - printf("format/height:\t\t%d \n", item->valueint); - // todo something.... - } - else if (!strcmp(name, "format/interlace")) - { - printf("format/interlace:\t%s \n", (item->valueint) ? "true" : "false"); - // todo something.... - } - else if (!strcmp(name, "format/frame rate")) - { - printf("format/frame rate:\t%d \n", item->valueint); - // todo something.... - } - - return 1; -} - -/**************************************************************************** - * Name: wgetjson_json_item_scan - ****************************************************************************/ - -static void wgetjson_json_item_scan(cJSON *item, const char *prefix) -{ - char *newprefix; - int dorecurse; - - while (item) - { - newprefix = malloc(strlen(prefix) + strlen(item->string) + 2); - sprintf(newprefix, "%s/%s", prefix, item->string); - - dorecurse = wgetjson_json_item_callback(newprefix, item->type, item); - if (item->child && dorecurse) - { - wgetjson_json_item_scan(item->child, newprefix); - } - - item = item->next; - free(newprefix); - } -} - -/**************************************************************************** - * Name: wgetjson_json_parse - ****************************************************************************/ - -static int wgetjson_json_parse(char *text) -{ - cJSON *json; - char *path = ""; - - json=cJSON_Parse(text); - if (!json) - { - printf("Error before: [%s]\n", cJSON_GetErrorPtr()); - return ERROR; - } - else - { - wgetjson_json_item_scan(json, path); - cJSON_Delete(json); - return OK; - } -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: wgetjson_main - ****************************************************************************/ - -int wgetjson_main(int argc, char *argv[]) -{ - char *buffer = NULL; - int buffer_len = 512; - char *url = CONFIG_EXAMPLES_WGETJSON_URL; - int ret = -1; - int option; - bool is_post = false; - bool is_post_multi = false; - bool badarg=false; - bool is_debug=false; - char *post_buff = NULL; - int post_buff_len = 0; - char *post_single_name = "type"; - char *post_single_value = "string"; - char *post_multi_names[MULTI_POST_NDATA] = {"name", "gender", "country"}; - char *post_multi_values[MULTI_POST_NDATA] = {"darcy", "man", "china"}; - wget_callback_t wget_cb = wgetjson_callback; - - while ((option = getopt(argc, argv, ":pPD")) != ERROR) - { - switch (option) - { - case 'p': - is_post = true; - break; - - case 'P': - is_post = true; - is_post_multi = true; - break; - - case 'D': - is_debug = true; - break; - - case ':': - badarg = true; - break; - - case '?': - default: - badarg = true; - break; - } - } - - if (badarg) - { - printf("usage: wgetjson -p(single post) -P(multi post) -D(debug wget callback)\n"); - return -1; - } - - if (is_debug) - { - wget_cb = wgetjson_postdebug_callback; - } - - if (is_post) - { - buffer_len = 512*2; - } - - buffer = malloc(buffer_len); - wgetjson_json_release(); - - printf("URL: %s\n", url); - - if (is_post) - { - url = CONFIG_EXAMPLES_WGETPOST_URL; - if (is_post_multi) - { - post_buff_len = web_posts_strlen(post_multi_names, post_multi_values, MULTI_POST_NDATA); - post_buff = malloc(post_buff_len); - web_posts_str(post_buff, &post_buff_len, post_multi_names, post_multi_values, MULTI_POST_NDATA); - } - else - { - post_buff_len = web_post_strlen(post_single_name, post_single_value); - post_buff = malloc(post_buff_len); - web_post_str(post_buff, &post_buff_len, post_single_name, post_single_value); - } - - if (post_buff) - { - ret = wget_post(url, post_buff, buffer, buffer_len, wget_cb, NULL); - } - } - else - { - ret = wget(url, buffer, buffer_len, wget_cb , NULL); - } - - if (ret < 0) - { - printf("get json size: %d\n",g_json_bufflen); - } - else if (!is_debug) - { - g_has_json = false; - if (wgetjson_json_parse(g_json_buff) == OK && g_has_json) - { - printf("Parse OK\n"); - } - else - { - printf("Parse error\n"); - } - - g_has_json = false; - } - - wgetjson_json_release(); - free(buffer); - if (post_buff) - { - free(post_buff); - } - - return 0; -} diff --git a/apps/examples/wlan/Kconfig b/apps/examples/wlan/Kconfig deleted file mode 100644 index 7f8fb526a..000000000 --- a/apps/examples/wlan/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_WLAN - bool "WLAN example" - default n - ---help--- - Enable the WLAN example - -if EXAMPLES_WLAN -endif diff --git a/apps/examples/wlan/Makefile b/apps/examples/wlan/Makefile deleted file mode 100644 index 1da79736f..000000000 --- a/apps/examples/wlan/Makefile +++ /dev/null @@ -1,98 +0,0 @@ -############################################################################ -# apps/examples/wlan/Makefile -# -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. -# Authors: Gregory Nutt <gnutt@nuttx.org> -# Rafael Noronha <rafael@pdsolucoes.com.br> -# -# 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 $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# WLAN Test - -ASRCS = -CSRCS = wlan_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/wlan/wlan_main.c b/apps/examples/wlan/wlan_main.c deleted file mode 100644 index aa48a0238..000000000 --- a/apps/examples/wlan/wlan_main.c +++ /dev/null @@ -1,306 +0,0 @@ -/**************************************************************************** - * examples/wlan/wlan_main.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Authors: Gregory Nutt <gnutt@nuttx.org> - * Rafael Noronha <rafael@pdsolucoes.com.br> - * - * 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 Gregory Nutt 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/stat.h> -#include <sys/ioctl.h> - -#include <stdint.h> -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <time.h> -#include <sched.h> -#include <errno.h> -#include <debug.h> - -#include <nuttx/usb/usbhost.h> - -#include <net/if.h> -#include <nuttx/net/uip/uip.h> -#include <nuttx/net/uip/uip-arp.h> - -#include <apps/netutils/uiplib.h> - -/* DHCPC may be used in conjunction with any other feature (or not) */ - -#ifdef CONFIG_EXAMPLES_WLAN_DHCPC -# include <arpa/inet.h> -# include <apps/netutils/resolv.h> -# include <apps/netutils/dhcpc.h> -#endif - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Sanity checking */ - -#ifndef CONFIG_USBHOST -# error "CONFIG_USBHOST is not defined" -#endif - -#ifdef CONFIG_USBHOST_BULK_DISABLE -# error "Bulk endpoints are disabled (CONFIG_USBHOST_BULK_DISABLE)" -#endif - -#ifndef CONFIG_NFILE_DESCRIPTORS -# error "CONFIG_NFILE_DESCRIPTORS > 0 needed" -#endif - -/* Provide some default values for other configuration settings */ - -#ifndef CONFIG_EXAMPLES_WLAN_DEFPRIO -# define CONFIG_EXAMPLES_WLAN_DEFPRIO 50 -#endif - -#ifndef CONFIG_EXAMPLES_WLAN_STACKSIZE -# define CONFIG_EXAMPLES_WLAN_STACKSIZE 1024 -#endif - -#ifndef CONFIG_EXAMPLES_WLAN_DEVNAME -# define CONFIG_EXAMPLES_WLAN_DEVNAME "wlan0" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static struct usbhost_driver_s *g_drvr; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: wlan_bringup - * - * Description: - * Wait for USB devices to be connected. - * - ****************************************************************************/ - -static inline void wlan_bringup(void) -{ -#if defined(CONFIG_EXAMPLES_WLAN_DHCPC) || defined(CONFIG_EXAMPLES_WLAN_NOMAC) - uint8_t mac[IFHWADDRLEN]; -#endif - struct in_addr addr; -#ifdef CONFIG_EXAMPLES_WLAN_DHCPC - void *handle; -#endif - - /* Many embedded network interfaces must have a software assigned - * MAC - */ - -#ifdef CONFIG_EXAMPLES_WLAN_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_WLAN_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_WLAN_NETMASK); - uip_setnetmask("eth0", &addr); - - /* Set up our host address */ - -#ifdef CONFIG_EXAMPLES_WLAN_DHCPC - addr.s_addr = 0; -#else - addr.s_addr = HTONL(CONFIG_EXAMPLES_WLAN_IPADDR); -#endif - uip_sethostaddr("eth0", &addr); - -#ifdef CONFIG_EXAMPLES_WLAN_DHCPC - /* Set up the resolver */ - - resolv_init(); - - /* Get the MAC address of the NIC */ - - uip_getmacaddr("eth0", mac); - - /* Set up the DHCPC modules */ - - handle = dhcpc_open(&mac, IFHWADDRLEN); - - /* Get an IP address. Note: there is no logic here for renewing - * the address in this example. The address should be renewed in - * ds.lease_time/2 seconds. - */ - - printf("Getting IP address\n"); - if (handle) - { - struct dhcpc_state ds; - (void)dhcpc_request(handle, &ds); - uip_sethostaddr("eth1", &ds.ipaddr); - if (ds.netmask.s_addr != 0) - { - uip_setnetmask("eth0", &ds.netmask); - } - if (ds.default_router.s_addr != 0) - { - uip_setdraddr("eth0", &ds.default_router); - } - if (ds.dnsaddr.s_addr != 0) - { - resolv_conf(&ds.dnsaddr); - } - dhcpc_close(handle); - printf("IP: %s\n", inet_ntoa(ds.ipaddr)); - } -#endif -} - -/**************************************************************************** - * Name: wlan_waiter - * - * Description: - * Wait for USB devices to be connected. - * - ****************************************************************************/ - -static int wlan_waiter(int argc, char *argv[]) -{ - bool connected = false; - int ret; - - printf("wlan_waiter: Running\n"); - for (;;) - { - /* Wait for the device to change state */ - - ret = DRVR_WAIT(g_drvr, connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - printf("wlan_waiter: %s\n", connected ? "connected" : "disconnected"); - - /* Did we just become connected? */ - - if (connected) - { - /* Yes.. enumerate the newly connected device */ - - ret = DRVR_ENUMERATE(g_drvr); - - /* If the enumeration was successful, then bring up the interface */ - - wlan_bringup(); - } - } - - /* Keep the compiler from complaining */ - - return 0; -} - -/**************************************************************************** - * Name: wlan_main - ****************************************************************************/ - -int wlan_main(int argc, char *argv[]) -{ - pid_t pid; - int ret; - - /* First, register all of the USB host Wireless LAN drivers */ - - printf("wlan_main: Register drivers\n"); - ret = usbhost_wlaninit(); - if (ret != OK) - { - printf("wlan_main: Failed to register the WLAN driver\n"); - } - - /* Then get an instance of the USB host interface */ - - printf("wlan_main: Initialize USB host WLAN driver\n"); - g_drvr = usbhost_initialize(0); - if (g_drvr) - { - /* Start a thread to handle device connection. */ - - printf("wlan_main: Start wlan_waiter\n"); - -#ifndef CONFIG_CUSTOM_STACK - pid = task_create("usbhost", CONFIG_EXAMPLES_WLAN_DEFPRIO, - CONFIG_EXAMPLES_WLAN_STACKSIZE, - (main_t)wlan_waiter, (const char **)NULL); -#else - pid = task_create("usbhost", CONFIG_EXAMPLES_WLAN_DEFPRIO, - (main_t)wlan_waiter, (const char **)NULL); -#endif - - /* Now just sleep. Eventually logic here will perform the device test. */ - - for (;;) - { - sleep(5); - printf("usert_start: Still alive\n"); - } - } - return 0; -} diff --git a/apps/examples/xmlrpc/Kconfig b/apps/examples/xmlrpc/Kconfig deleted file mode 100644 index 80ee5a225..000000000 --- a/apps/examples/xmlrpc/Kconfig +++ /dev/null @@ -1,46 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_XMLRPC - bool "XML RPC example" - default n - depends on NET_TCP && !DISABLE_POLL - select NETUTILS_XMLRPC - ---help--- - An example for the netutils/xmlrpc library. - This example implements a lightweight HTTP server and uses the xmlrpc lib - for parsing xml remote procedure calls. - -config EXAMPLES_XMLRPC_BUFFERSIZE - int "HTTP buffer size" - default 1024 - depends on EXAMPLES_XMLRPC - -config EXAMPLES_XMLRPC_DHCPC - bool "DHCP Client" - default n - depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS - select NETUTILS_DHCPC - select NETUTILS_RESOLV - -config EXAMPLES_XMLRPC_NOMAC - bool "Use Canned MAC Address" - default n - depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS - -config EXAMPLES_XMLRPC_IPADDR - hex "Target IP address" - default 0x0a000002 - depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS && !EXAMPLES_XMLRPC_DHCPC - -config EXAMPLES_XMLRPC_DRIPADDR - hex "Default Router IP address (Gateway)" - default 0x0a000001 - depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS - -config EXAMPLES_XMLRPC_NETMASK - hex "Network Mask" - default 0xffffff00 - depends on EXAMPLES_XMLRPC && !NSH_BUILTIN_APPS diff --git a/apps/examples/xmlrpc/Makefile b/apps/examples/xmlrpc/Makefile deleted file mode 100644 index 7053f54d3..000000000 --- a/apps/examples/xmlrpc/Makefile +++ /dev/null @@ -1,109 +0,0 @@ -############################################################################ -# apps/examples/xmlrpc/Makefile -# -# Copyright (C) 2012 Max Holtzberg. All rights reserved. -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. -# -# Authors: Max Holtzberg <mh@uvc.de> -# 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. -# -############################################################################ - --include $(TOPDIR)/.config --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# XML RPC built-in application info - -APPNAME = xmlrpc -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 - -ASRCS = -CSRCS = xmlrpc_main.c calls.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -.context: -ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) - $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif - -context: .context - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep diff --git a/apps/examples/xmlrpc/calls.c b/apps/examples/xmlrpc/calls.c deleted file mode 100644 index bda164f4d..000000000 --- a/apps/examples/xmlrpc/calls.c +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** - * apps/examples/xmlrpc/calls.c - * - * Copyright (C) 2012 Max Holtzberg. All rights reserved. - * Author: Max Holtzberg <mh@uvc.de> - * - * Based on the embeddable lightweight XML-RPC server code discussed - * in the article at: http://www.drdobbs.com/web-development/\ - * an-embeddable-lightweight-xml-rpc-server/184405364 - * - * Copyright (c) 2002 Cogito LLC. All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, is hereby granted without fee 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 of Cogito LLC 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 COGITO LLC AND CONTRIBUTERS 'AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COGITO LLC - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARAY, 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 <string.h> -#include <apps/netutils/xmlrpc.h> - -/**************************************************************************** - * Private Function Prototypes - ****************************************************************************/ - -static int calls_get_device_stats(struct xmlrpc_s *xmlcall); - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -struct xmlrpc_entry_s get_device_stats = -{ - .name = "get_device_stats", - .func = calls_get_device_stats -}; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -static int calls_get_device_stats(struct xmlrpc_s *xmlcall) -{ - char username[80], password[80]; - char lastCommand[80], curState[80]; - int request = 0, status, ret; - - do - { - ret = xmlrpc_getstring(xmlcall, username); - if (ret != XMLRPC_NO_ERROR) - { - break; - } - - ret = xmlrpc_getstring(xmlcall, password); - if (ret != XMLRPC_NO_ERROR) - { - break; - } - - ret = xmlrpc_getinteger(xmlcall, &request); - if (ret != XMLRPC_NO_ERROR) - { - break; - } - } - while (0); - - if (ret == XMLRPC_NO_ERROR) - { - /* Dummy up some data... */ - - status = 1; - strcpy(lastCommand, "reboot"); - strcpy(curState, "Normal Operation"); - - ret = xmlrpc_buildresponse(xmlcall, "{iss}", - "status", status, - "lastCommand", lastCommand, - "currentState", curState); - } - - return ret; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -void calls_register(void) -{ - xmlrpc_register(&get_device_stats); -} diff --git a/apps/examples/xmlrpc/xmlrpc_main.c b/apps/examples/xmlrpc/xmlrpc_main.c deleted file mode 100644 index 5f5ce5f06..000000000 --- a/apps/examples/xmlrpc/xmlrpc_main.c +++ /dev/null @@ -1,419 +0,0 @@ -/**************************************************************************** - * apps/examples/xmlrpc/xmlrpc_main.c - * - * Copyright (C) 2012 Max Holtzberg. All rights reserved. - * Author: Max Holtzberg <mh@uvc.de> - * - * Based on the embeddable lightweight XML-RPC server code discussed - * in the article at: http://www.drdobbs.com/web-development/\ - * an-embeddable-lightweight-xml-rpc-server/184405364 - * - * Copyright (c) 2002 Cogito LLC. All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, is hereby granted without fee 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 of Cogito LLC 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 COGITO LLC AND CONTRIBUTERS 'AS IS' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COGITO LLC - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARAY, 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. - ****************************************************************************/ - -/* - * Lightweight Embedded XML-RPC Server main - * - * mtj@cogitollc.com - * - */ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <debug.h> -#include <sys/select.h> -#include <sys/socket.h> -#include <sys/time.h> -#include <arpa/inet.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include <net/if.h> -#include <nuttx/net/uip/uip.h> -#include <nuttx/net/uip/uip-arp.h> - -#include <apps/netutils/uiplib.h> -#include <apps/netutils/xmlrpc.h> - -#ifdef CONFIG_EXAMPLES_XMLRPC_DHCPC -# include <arpa/inet.h> -#endif - -/* Here we include the header file for the application(s) we use in - * our project as defined in the config/<board-name>/defconfig file - */ - -/* DHCPC may be used in conjunction with any other feature (or not) */ - -#ifdef CONFIG_EXAMPLES_XMLRPC_DHCPC -# include <apps/netutils/resolv.h> -# include <apps/netutils/dhcpc.h> -#endif - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static const char *notimplemented = { "HTTP/1.1 501 Not Implemented\n\n" }; -static const char *separator = { "\015\012\015\012" }; - -/**************************************************************************** - * External Function Prototypes - ****************************************************************************/ - -extern void calls_register(void); - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: xmlrpc_findbody - * - * Description: - * Find the message body of an HTTP Request Message - * - ****************************************************************************/ - -static char *xmlrpc_findbody(char *buf) -{ - char *temp; - - temp = strstr(buf, separator); - - if (temp == NULL) - { - return NULL; - } - else - { - return temp + 4; - } -} - -/**************************************************************************** - * Name: xmlrpc_getheader - * - * Description: - * Find the HTTP header and return it's value. - * - ****************************************************************************/ - -static int xmlrpc_getheader(char *buffer, char *header, char *value, int size) -{ - char *temp; - int i = 0; - - temp = strstr(buffer, header); - if (temp) - { - /* Skip the header element */ - - temp += strlen(header); - - /* Skip any white-space */ - - while (*temp == ' ') - { - temp++; - } - - /* Copy the rest to the value parameter */ - - while ((*temp != ' ') && (*temp != '\n') && (i < size)) - { - value[i++] = *temp++; - } - - value[i] = 0; - return i; - } - - return -1; -} - -/**************************************************************************** - * Name: xmlrpc_handler - * - * Description: - * Parse and handle the current HTTP request message. - * - ****************************************************************************/ - -static void xmlrpc_handler(int fd) -{ - fd_set rfds; - struct timeval tv; - int ret, len, max = 0, loadlen = -1; - char buffer[CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE] = { 0 }; - char value[CONFIG_XMLRPC_STRINGSIZE + 1]; - char *temp; - - /* Read in the Request Header */ - - do - { - FD_ZERO(&rfds); - FD_SET(fd, &rfds); - - tv.tv_sec = 1; - tv.tv_usec = 0; - - ndbg("[%d] select...\n", fd); - ret = select(fd + 1, &rfds, NULL, NULL, &tv); - ndbg("[%d] data ready\n", fd); - - if (ret > 0) - { - if (FD_ISSET(fd, &rfds)) - { - len = recv(fd, &buffer[max], 1024, 0); - ndbg("[%d] %d bytes received\n", fd, len); - - if (len > 0) - { - max += len; - buffer[max] = 0; - - ret = xmlrpc_getheader(buffer, "Content-Length:", value, - CONFIG_EXAMPLES_XMLRPC_BUFFERSIZE); - if (ret > 0) - loadlen = atoi(value); - } - else - { - ret = -1; - break; - } - } - } - else - { - /* Timeout... */ - - ndbg("[%d] timeout\n", fd); - ret = -1; - break; - } - - temp = strstr(buffer, separator); - - if (temp) - { - if (strlen(temp) - 4 == loadlen) - break; - } - - } - while (1); - - /* Determine request */ - - if (!strncmp(buffer, "POST", 4)) - { - temp = xmlrpc_findbody(buffer); - xmlrpc_parse(fd, temp); - } - else - { - write(fd, notimplemented, strlen(notimplemented)); - } -} - -/**************************************************************************** - * Name: xmlrpc_netinit - * - * Description: - * Setup network configuration. - * - ****************************************************************************/ - -static int xmlrpc_netinit(void) -{ - /* If this task is excecutated as an NSH built-in function, then the network - * has already been configured by NSH's start-up logic. - */ - -#ifndef CONFIG_NSH_BUILTIN_APPS - struct in_addr addr; -#if defined(CONFIG_EXAMPLES_XMLRPC_DHCPC) || defined(CONFIG_EXAMPLES_XMLRPC_NOMAC) - uint8_t mac[IFHWADDRLEN]; -#endif -#ifdef CONFIG_EXAMPLES_XMLRPC_DHCPC - void *handle; -#endif - -/* Many embedded network interfaces must have a software assigned MAC */ - -#ifdef CONFIG_EXAMPLES_XMLRPC_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up our host address */ - -#ifdef CONFIG_EXAMPLES_XMLRPC_DHCPC - addr.s_addr = 0; -#else - addr.s_addr = HTONL(CONFIG_EXAMPLES_XMLRPC_IPADDR); -#endif - uip_sethostaddr("eth0", &addr); - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_XMLRPC_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_XMLRPC_NETMASK); - uip_setnetmask("eth0", &addr); - -#ifdef CONFIG_EXAMPLES_XMLRPC_DHCPC - /* Set up the resolver */ - - resolv_init(); - - /* Get the MAC address of the NIC */ - - uip_getmacaddr("eth0", mac); - - /* Set up the DHCPC modules */ - - handle = dhcpc_open(&mac, IFHWADDRLEN); - - /* Get an IP address. Note: there is no logic here for renewing the address - * in this example. The address should be renewed in ds.lease_time/2 - * seconds. - */ - - printf("Getting IP address\n"); - if (handle) - { - struct dhcpc_state ds; - (void)dhcpc_request(handle, &ds); - uip_sethostaddr("eth1", &ds.ipaddr); - - if (ds.netmask.s_addr != 0) - { - uip_setnetmask("eth0", &ds.netmask); - } - - if (ds.default_router.s_addr != 0) - { - uip_setdraddr("eth0", &ds.default_router); - } - - if (ds.dnsaddr.s_addr != 0) - { - resolv_conf(&ds.dnsaddr); - } - - dhcpc_close(handle); - printf("IP: %s\n", inet_ntoa(ds.ipaddr)); - } - -#endif /* CONFIG_EXAMPLES_XMLRPC_DHCPC */ -#endif /* CONFIG_NSH_BUILTIN_APPS */ - - return OK; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: xmlrpc_main - * - * Description: - * The embedded HTTP server main - * - ****************************************************************************/ - -int xmlrpc_main(int argc, char *argv[]) -{ - int listenfd, connfd, on = 1; - socklen_t clilen; - struct sockaddr_in cliaddr, servaddr; - - if (xmlrpc_netinit() < 0) - { - ndbg("Could not initialize the network interface\n"); - return ERROR; - } - - /* Register RPC functions. */ - - calls_register(); - - listenfd = socket(AF_INET, SOCK_STREAM, 0); - - setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); - - bzero((void *)&servaddr, sizeof(servaddr)); - servaddr.sin_family = AF_INET; - servaddr.sin_addr.s_addr = htonl(INADDR_ANY); - servaddr.sin_port = htons(80); - - bind(listenfd, (struct sockaddr *)&servaddr, sizeof(servaddr)); - - listen(listenfd, 5); - - for (;;) - { - clilen = sizeof(cliaddr); - connfd = accept(listenfd, (struct sockaddr *)&cliaddr, &clilen); - if (connfd <= 0) - { - break; - } - ndbg("Connection accepted: %d\n", connfd); - - xmlrpc_handler(connfd); - close(connfd); - ndbg("[%d] connection closed\n", connfd); - } - - close(listenfd); - return (0); -} |