summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-09-01 12:27:17 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-09-01 12:27:17 -0600
commit9ee5cfaffa313949563fb37f7cd39a2b7620a4dd (patch)
treec4ac8ef00bbc20cd9d265d6fdc1e917f3a96eb37 /misc
parente21b9a799cafb19d617995579d5b16739a34f2bb (diff)
downloadnuttx-9ee5cfaffa313949563fb37f7cd39a2b7620a4dd.tar.gz
nuttx-9ee5cfaffa313949563fb37f7cd39a2b7620a4dd.tar.bz2
nuttx-9ee5cfaffa313949563fb37f7cd39a2b7620a4dd.zip
Obsolete support for the 8051 family. Trying to maintain compatibility with this family is too much effort and there has never really been a successful NuttX impplementation on these parts
Diffstat (limited to 'misc')
-rw-r--r--misc/Obsoleted/arch/8051/Kconfig48
-rw-r--r--misc/Obsoleted/arch/8051/include/arch.h86
-rw-r--r--misc/Obsoleted/arch/8051/include/irq.h206
-rw-r--r--misc/Obsoleted/arch/8051/include/limits.h84
-rw-r--r--misc/Obsoleted/arch/8051/include/syscall.h82
-rw-r--r--misc/Obsoleted/arch/8051/include/types.h98
-rw-r--r--misc/Obsoleted/arch/8051/src/.gitignore16
-rw-r--r--misc/Obsoleted/arch/8051/src/Makefile54
-rw-r--r--misc/Obsoleted/arch/8051/src/Makefile.sdccl278
-rw-r--r--misc/Obsoleted/arch/8051/src/up_allocateheap.c89
-rw-r--r--misc/Obsoleted/arch/8051/src/up_assert.c145
-rw-r--r--misc/Obsoleted/arch/8051/src/up_blocktask.c167
-rw-r--r--misc/Obsoleted/arch/8051/src/up_debug.c255
-rw-r--r--misc/Obsoleted/arch/8051/src/up_delay.c93
-rw-r--r--misc/Obsoleted/arch/8051/src/up_exit.c106
-rw-r--r--misc/Obsoleted/arch/8051/src/up_head.S471
-rw-r--r--misc/Obsoleted/arch/8051/src/up_idle.c95
-rw-r--r--misc/Obsoleted/arch/8051/src/up_initialize.c144
-rw-r--r--misc/Obsoleted/arch/8051/src/up_initialstate.c119
-rw-r--r--misc/Obsoleted/arch/8051/src/up_internal.h153
-rw-r--r--misc/Obsoleted/arch/8051/src/up_interruptcontext.c70
-rw-r--r--misc/Obsoleted/arch/8051/src/up_irq.c152
-rw-r--r--misc/Obsoleted/arch/8051/src/up_irqtest.c272
-rw-r--r--misc/Obsoleted/arch/8051/src/up_putc.c81
-rw-r--r--misc/Obsoleted/arch/8051/src/up_releasepending.c135
-rw-r--r--misc/Obsoleted/arch/8051/src/up_reprioritizertr.c190
-rw-r--r--misc/Obsoleted/arch/8051/src/up_restorecontext.c296
-rw-r--r--misc/Obsoleted/arch/8051/src/up_savecontext.c362
-rw-r--r--misc/Obsoleted/arch/8051/src/up_timerisr.c147
-rw-r--r--misc/Obsoleted/arch/8051/src/up_unblocktask.c161
-rw-r--r--misc/Obsoleted/configs/pjrc-8051/Kconfig7
-rw-r--r--misc/Obsoleted/configs/pjrc-8051/Make.defs170
-rw-r--r--misc/Obsoleted/configs/pjrc-8051/README.txt54
-rw-r--r--misc/Obsoleted/configs/pjrc-8051/defconfig577
-rw-r--r--misc/Obsoleted/configs/pjrc-8051/include/board.h51
-rw-r--r--misc/Obsoleted/configs/pjrc-8051/include/pjrc.h215
-rw-r--r--misc/Obsoleted/configs/pjrc-8051/sdcc-2.6.0.patch28
-rwxr-xr-xmisc/Obsoleted/configs/pjrc-8051/setenv.sh65
-rw-r--r--misc/Obsoleted/configs/pjrc-8051/src/.gitignore15
-rw-r--r--misc/Obsoleted/configs/pjrc-8051/src/Makefile75
-rw-r--r--misc/Obsoleted/configs/pjrc-8051/src/up_leds.c207
41 files changed, 6119 insertions, 0 deletions
diff --git a/misc/Obsoleted/arch/8051/Kconfig b/misc/Obsoleted/arch/8051/Kconfig
new file mode 100644
index 000000000..9c389b959
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/Kconfig
@@ -0,0 +1,48 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_8051
+comment "ARM Options"
+
+choice
+ prompt "8051 Chip Selection"
+ default ARCH_CHIP_8052
+
+config ARCH_CHIP_8051
+ bool "8051"
+
+config ARCH_CHIP_8052
+ bool "8052"
+
+endchoice # 8051 Chip Selection
+
+comment "Bring-up Debug Options"
+
+config ARCH_8051_BRINGUP
+ bool "Bring-up debug"
+ default n
+ ---help---
+ Enable bring-up debug instrumentation
+
+config ARCH_8051_NOSYSTIMER
+ bool "No system timer"
+ ---help---
+ By default, Timer0 will be used as the system timer. Use of the
+ system timer can be suppressed with the setting. This is useful
+ during bring-up.
+
+config ARCH_8051_BRINGUP
+ bool "Bring-up debug"
+ default n
+ ---help---
+ Enable bring-up debug instrumentation
+
+config ARCH_8051_SUPRESS_INTERRUPTS
+ bool "Suppress interrupts"
+ default n
+ ---help---
+ It is useful during low-level bring-up to suppress all interrupts.
+
+endif # ARCH_8051
diff --git a/misc/Obsoleted/arch/8051/include/arch.h b/misc/Obsoleted/arch/8051/include/arch.h
new file mode 100644
index 000000000..48ab2b331
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/include/arch.h
@@ -0,0 +1,86 @@
+/************************************************************************
+ * arch.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.
+ *
+ ************************************************************************/
+
+/* This file should never be included directed but, rather,
+ * only indirectly through nuttx/arch.h
+ */
+
+#ifndef __ARCH_ARCH_H
+#define __ARCH_ARCH_H
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include <stdint.h>
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Types
+ ************************************************************************/
+
+/************************************************************************
+ * Public Variables
+ ************************************************************************/
+
+/************************************************************************
+ * Public Function Prototypes
+ ************************************************************************/
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+/* The 805x family has a tiny, 256 stack and can be easily
+ * overflowed. The following macro can be used to instrument
+ * code to dump the stack pointer at critical locations.
+ */
+
+void up_showsp(uint8_t ch) __naked;
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ARCH_ARCH_H */
+
diff --git a/misc/Obsoleted/arch/8051/include/irq.h b/misc/Obsoleted/arch/8051/include/irq.h
new file mode 100644
index 000000000..da7513530
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/include/irq.h
@@ -0,0 +1,206 @@
+/************************************************************************
+ * irq.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.
+ *
+ ************************************************************************/
+
+/* This file should never be included directed but, rather,
+ * only indirectly through nuttx/irq.h
+ */
+
+#ifndef __ARCH_IRQ_H
+#define __ARCH_IRQ_H
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include <nuttx/config.h>
+#ifndef __ASSEMBLY__
+# include <stdint.h>
+#endif
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+#define EXT_INT0_IRQ 0
+#define TIMER0_IRQ 1
+#define EXT_INT1_IRQ 2
+#define TIMER1_IRQ 3
+#define UART_IRQ 4
+#define TIMER2_IRQ 5
+
+#define NR_IRQS 6
+
+/* The stack for all tasks/threads lie at the same position
+ * in IRAM. On context switches, the STACK contents will be
+ * copied into the TCB.
+ */
+
+#define IRAM_BASE 0x0000
+#ifdef CONFIG_ARCH_CHIP_8052
+# define IRAM_SIZE 0x0100
+#else
+# define IRAM_SIZE 0x0080
+#endif
+
+#define STACK_BASE 0x0024
+#define STACK_SIZE (IRAM_SIZE - STACK_BASE)
+
+/* This is the form of initial stack frame
+ *
+ * This initial stack frame will be configured to hold.
+ * (1) The 16-bit return address of either:
+ *
+ * void task_start(void);
+ * void pthread_start(void)
+ *
+ * The return address is stored at the top of stack.
+ * so that the RETI instruction will work:
+ *
+ * PC15-8 <- ((SP))
+ * (SP) <- (SP) -1
+ * PC7-0 <- ((SP))
+ * (SP) <- (SP) -1
+ */
+
+#define FRAME_RETLS 0
+#define FRAME_RETMS 1
+
+/* Then a partial context context save area that can be
+ * indexed with the following definitions (relative to the
+ * beginning of the initial frame.
+ */
+
+#define FRAME_ACC 2
+#define FRAME_IE 3
+#define FRAME_DPL 4
+#define FRAME_DPH 5
+
+#define FRAME_SIZE 6
+
+/* The remaining registers are not saved on the stack (due
+ * to the limited stack size of the 8051/2) but in an array
+ * in the TCB:
+ */
+
+#define REGS_B 0
+#define REGS_R2 1
+#define REGS_R3 2
+#define REGS_R4 3
+#define REGS_R5 4
+#define REGS_R6 5
+#define REGS_R7 6
+#define REGS_R0 7
+#define REGS_R1 8
+#define REGS_PSW 9
+#define REGS_BP 10
+
+#define REGS_SIZE 11
+
+/* Note that the stack pointer is not saved. Rather, the
+ * size of the saved stack frame is saved in the 'nbytes'
+ * field. Since that stack begins at a fixed location, the
+ * top-of-stack pointer can be derived from the saved size.
+ */
+
+/* These are offsets into struct xcptcontext that can be
+ * used from assembly language to access the structure.
+ */
+
+#define XCPT_NBYTES 0
+#define XCPT_STACK 1
+#define XCPT_REGS (STACK_SIZE+1)
+
+#define XCPT_SIZE (STACK_SIZE+REGS_SIZE+1)
+
+/************************************************************************
+ * Public Types
+ ************************************************************************/
+
+/* This struct defines the way the registers are stored */
+
+#ifndef __ASSEMBLY__
+struct xcptcontext
+{
+ /* This is the number of valid bytes currently saved in
+ * stack[]. Since that stack begins at a fixed location,
+ * the top-of-stack pointer can be derived from this size.
+ */
+
+ uint8_t nbytes;
+
+ /* This is the saved stack. Space is allocated for the
+ * entire 256 byte IRAM (minus register and bit usage at
+ * the beginning).
+ */
+
+ uint8_t stack[STACK_SIZE];
+
+ /* These are save 8051/2 registers. These are saved
+ * separately from the stack to increase the effective
+ * stack size.
+ */
+
+ uint8_t regs[REGS_SIZE];
+};
+#endif /* __ASSEMBLY */
+
+/************************************************************************
+ * Public Variables
+ ************************************************************************/
+
+/************************************************************************
+ * Public Function Prototypes
+ ************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+EXTERN irqstate_t irqsave(void);
+EXTERN void irqrestore(irqstate_t flags);
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ASSEMBLY */
+#endif /* __ARCH_IRQ_H */
+
diff --git a/misc/Obsoleted/arch/8051/include/limits.h b/misc/Obsoleted/arch/8051/include/limits.h
new file mode 100644
index 000000000..5c8116e07
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/include/limits.h
@@ -0,0 +1,84 @@
+/************************************************************
+ * arch/8051/include/limits.h
+ *
+ * Copyright (C) 2007, 2009, 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.
+ *
+ ************************************************************/
+
+#ifndef __ARCH_8051_INCLUDE_LIMITS_H
+#define __ARCH_8051_INCLUDE_LIMITS_H
+
+/************************************************************
+ * Included Files
+ ************************************************************/
+
+/************************************************************
+ * Definitions
+ ************************************************************/
+
+#define CHAR_BIT 8
+#define SCHAR_MIN (-SCHAR_MAX - 1)
+#define SCHAR_MAX 127
+#define UCHAR_MAX 255
+
+/* These could be different on machines where char is unsigned */
+
+#ifdef __CHAR_UNSIGNED__
+#define CHAR_MIN 0
+#define CHAR_MAX UCHAR_MAX
+#else
+#define CHAR_MIN SCHAR_MIN
+#define CHAR_MAX SCHAR_MAX
+#endif
+
+#define SHRT_MIN (-SHRT_MAX - 1)
+#define SHRT_MAX 32767
+#define USHRT_MAX 65535U
+
+#define INT_MIN (-INT_MAX - 1)
+#define INT_MAX 32767
+#define UINT_MAX 65535U
+
+/* These change on 32-bit and 64-bit platforms */
+
+#define LONG_MIN (-LONG_MAX - 1)
+#define LONG_MAX 2147483647L
+#define ULONG_MAX 4294967295UL
+
+/* For SDCC, a Generic pointer is 3 bytes in length with the
+ * first byte holding data space information.
+ */
+
+#define PTR_MIN (-PTR_MAX - 1)
+#define PTR_MAX 8388607
+#define UPTR_MAX 16777215U
+
+#endif /* __ARCH_8051_INCLUDE_LIMITS_H */
diff --git a/misc/Obsoleted/arch/8051/include/syscall.h b/misc/Obsoleted/arch/8051/include/syscall.h
new file mode 100644
index 000000000..2c85fb420
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/include/syscall.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+ * arch/8051/include/syscall.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.
+ *
+ ****************************************************************************/
+
+/* This file should never be included directed but, rather, only indirectly
+ * through include/syscall.h or include/sys/sycall.h
+ */
+
+#ifndef __ARCH_8051_INCLUDE_SYSCALL_H
+#define __ARCH_8051_INCLUDE_SYSCALL_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+/****************************************************************************
+ * Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Inline functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Variables
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#ifndef __ASSEMBLY__
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif /* __ARCH_8051_INCLUDE_SYSCALL_H */
+
diff --git a/misc/Obsoleted/arch/8051/include/types.h b/misc/Obsoleted/arch/8051/include/types.h
new file mode 100644
index 000000000..a3865e978
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/include/types.h
@@ -0,0 +1,98 @@
+/************************************************************************
+ * arch/8051/include/types.h
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/* This file should never be included directed but, rather,
+ * only indirectly through sys/types.h
+ */
+
+#ifndef __ARCH_8051_INCLUDE_TYPES_H
+#define __ARCH_8051_INCLUDE_TYPES_H
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Type Declarations
+ ************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/* These are the sizes of the standard integer types. NOTE that these type
+ * names have a leading underscore character. This file will be included
+ * (indirectly) by include/stdint.h and typedef'ed to the final name without
+ * the underscore character. This roundabout way of doings things allows
+ * the stdint.h to be removed from the include/ directory in the event that
+ * the user prefers to use the definitions provided by their toolchain header
+ * files
+ *
+ *
+ * For SDCC, sizeof(int) is 16 and sizeof(long) is 32.
+ * long long and double are not supported.
+ */
+
+typedef signed char _int8_t;
+typedef unsigned char _uint8_t;
+
+typedef signed int _int16_t;
+typedef unsigned int _uint16_t;
+
+typedef signed long _int32_t;
+typedef unsigned long _uint32_t;
+
+/* For SDCC, a Generic pointer is 3 bytes in length with the
+ * first byte holding data space information.
+ */
+
+typedef signed long _intptr_t;
+typedef unsigned long _uintptr_t;
+
+/* This is the size of the interrupt state save returned by
+ * irqsave()
+ */
+
+typedef unsigned char irqstate_t;
+
+#endif /* __ASSEMBLY__ */
+
+/************************************************************************
+ * Global Function Prototypes
+ ************************************************************************/
+
+#endif /* __ARCH_8051_INCLUDE_TYPES_H */
diff --git a/misc/Obsoleted/arch/8051/src/.gitignore b/misc/Obsoleted/arch/8051/src/.gitignore
new file mode 100644
index 000000000..63526d43f
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/.gitignore
@@ -0,0 +1,16 @@
+Make.dep
+.depend
+up_mem.h
+*.sym
+*.asm
+*.rel
+*.lst
+*.adb
+*.rst
+*.lib
+*.lnk
+*.map
+*.mem
+*.ihx
+*.hex
+
diff --git a/misc/Obsoleted/arch/8051/src/Makefile b/misc/Obsoleted/arch/8051/src/Makefile
new file mode 100644
index 000000000..867024b62
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/Makefile
@@ -0,0 +1,54 @@
+############################################################################
+# arch/8051/src/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.
+#
+############################################################################
+
+# Makefile fragments
+
+-include $(TOPDIR)/Make.defs
+-include chip/Make.defs
+-include board/Make.defs
+
+# Check for SDCC native windows build
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+
+ # SDCC Windows native build
+
+ include Makefile.sdccw
+else
+
+ # SDCC in a POSIX environment (Linux, OSX, or Cygwin/MSYS)
+
+ include Makefile.sdccl
+endif
diff --git a/misc/Obsoleted/arch/8051/src/Makefile.sdccl b/misc/Obsoleted/arch/8051/src/Makefile.sdccl
new file mode 100644
index 000000000..0e424924b
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/Makefile.sdccl
@@ -0,0 +1,278 @@
+############################################################################
+# arch/8051/src/Makefile.sdccl
+#
+# Copyright (C) 2007, 2008, 2011-2012, 2014 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
+
+# Tools
+# CFLAGS, CPPFLAGS, ASFLAGS, LDFLAGS are set in $(TOPDIR)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -D__ASSEMBLY__
+
+LDFLAGS += --model-large --nostdlib --data-loc $(DEF_STACK_BASE) \
+ --iram-size $(IRAM_SIZE) --code-loc 0x2100 --code-size 0x5f40 \
+ --xram-loc $(IRAM_SIZE) --xram-size 0x1f00
+
+# Files and directories
+# There should be one head source (.asm file)
+
+HEAD_SSRC = up_head.S
+HEAD_ASRC = $(HEAD_SSRC:.S=$(ASMEXT))
+HEAD_OBJ = $(HEAD_ASRC:$(ASMEXT)=$(OBJEXT))
+
+# Assembly sources and objects
+
+SSRCS =
+ASRCS = $(SSRCS:.S=$(ASMEXT))
+AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT))
+
+# C sources and objects
+
+CSRCS = up_initialize.c up_idle.c up_interruptcontext.c up_initialstate.c \
+ up_unblocktask.c up_blocktask.c up_releasepending.c \
+ up_reprioritizertr.c up_exit.c up_assert.c up_allocateheap.c \
+ up_irq.c up_savecontext.c up_restorecontext.c up_putc.c \
+ up_debug.c up_delay.c
+
+ifneq ($(CONFIG_SCHED_TICKLESS),y)
+CSRCS += up_timerisr.c
+endif
+
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+# All sources and objcts
+
+SRCS = $(SSRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+DEPSRCS = $(SRCS) $(HEAD_SSRC)
+
+# Board path
+
+BOARDDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src/board
+
+# Source path
+
+VPATH = chip:common:board
+
+# Libraries
+
+SDCCLIBS = -llibfloat.lib -llibint.lib -lliblong.lib -llibmysdcc.lib -lmcs51.lib
+
+LINKLIBS ?=
+LIBPATHS = -L"$(TOPDIR)/lib"
+LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
+
+# Test sources
+
+TESTSRCS = up_irqtest.c
+TESTOBJS = $(TESTSRCS:.c=$(OBJEXT))
+TESTLINKOBJS = up_head$(OBJEXT)
+TESTEXTRAOBJS = up_savecontext$(OBJEXT) up_restorecontext$(OBJEXT)
+
+# Memory
+
+HEAP1_BASE = ${shell \
+ if [ -e pass1.mem ]; then \
+ cat pass1.mem | grep "EXTERNAL RAM" | \
+ sed -e "s/[ ][ ]*/ /g" | cut -d' ' -f5 ; \
+ else \
+ echo $(IRAM_SIZE) ; \
+ fi \
+ }
+DEF_HEAP2_BASE = 0x6000
+HEAP2_BASE = ${shell \
+ if [ -e pass1.mem ]; then \
+ cat pass1.mem | grep "ROM/EPROM/FLASH" | \
+ sed -e "s/[ ][ ]*/ /g" | cut -d' ' -f4 ; \
+ else \
+ echo $(DEF_HEAP2_BASE) ; \
+ fi \
+ }
+STACK_BASE = ${shell \
+ if [ -e pass1.mem ]; then \
+ cat pass1.mem | grep "Stack starts" | \
+ cut -d' ' -f4 ; \
+ else \
+ echo $(DEF_STACK_BASE) ; \
+ fi \
+ }
+
+# Targets
+
+all: up_head$(OBJEXT) libarch$(LIBEXT)
+
+.PHONY: board/libboard$(LIBEXT)
+
+$(ASRCS) $(HEAD_ASRC): %$(ASMEXT): %.S
+ $(CPP) -P $(CPPFLAGS) $< -o $@
+
+$(AOBJS) $(HEAD_OBJ): $(ASRCS) $(HEAD_ASRC)
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(TESTOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+# This is a kludge to work around some conflicting symbols in the SDCC libraries
+
+$(TOPDIR)/lib/$(SDCCLIB): $(SDCC_LIBDIR)/$(SDCCLIB)
+ $(Q) cp $(SDCC_LIBDIR)/$(SDCCLIB) $(TOPDIR)/lib/$(SDCCLIB)
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _calloc.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _malloc.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _realloc.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _free.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) printf_large.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) sprintf.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) vprintf.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) strcpy.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) strlen.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strcat.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strchr.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strcmp.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strcspn.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strncat.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strncmp.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strncpy.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strpbrk.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strrchr.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strspn.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strstr.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _strtok.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _memchr.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _memcmp.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _memcpy.rel
+ $(Q) sdar d $(TOPDIR)/lib/$(SDCCLIB) _memset.rel
+
+# Create a header file that contains addressing information needed by the code
+
+up_mem.h: pass1.mem
+ @echo "#ifndef __ARCH_MEM_H" >up_mem.h
+ @echo "#define __ARCH_MEM_H" >>up_mem.h
+ @echo "" >>up_mem.h
+ @echo "#define UP_DEFAULT_STACK_BASE $(DEF_STACK_BASE)" >>up_mem.h
+ @echo "#define UP_DEFAULT_HEAP1_BASE $(IRAM_SIZE)" >> up_mem.h
+ @echo "#define UP_DEFAULT_HEAP2_BASE $(DEF_HEAP2_BASE)" >> up_mem.h
+ @echo "" >>up_mem.h
+ @echo "#define UP_STACK_BASE $(STACK_BASE)" >>up_mem.h
+ @echo "#if UP_STACK_BASE > UP_DEFAULT_STACK_BASE" >>up_mem.h
+ @echo "# error \"Stack overlap: $(DEF_STACK_BASE) < $(STACK_BASE)\"" >>up_mem.h
+ @echo "#elif UP_STACK_BASE < UP_DEFAULT_STACK_BASE" >>up_mem.h
+ @echo "# warning \"Wasted stack: $(DEF_STACK_BASE) > $(STACK_BASE)\"" >>up_mem.h
+ @echo "#endif" >>up_mem.h
+ @echo "" >>up_mem.h
+ @echo "#define UP_HEAP1_BASE $(HEAP1_BASE)" >> up_mem.h
+ @echo "#define UP_HEAP1_END 0x2000" >> up_mem.h
+ @echo "" >>up_mem.h
+ @echo "#define UP_HEAP2_BASE $(HEAP2_BASE)" >> up_mem.h
+ @echo "#define UP_HEAP2_END 0x8000" >> up_mem.h
+ @echo "" >>up_mem.h
+ @echo "#endif /* __ARCH_MEM_H */" >>up_mem.h
+
+# Combine all objects in this directory into a library
+
+libarch$(LIBEXT): up_mem.h $(OBJS)
+ $(call ARCHIVE, $@, $(OBJS))
+
+# This builds the libboard library in the board/ subdirectory
+
+board/libboard$(LIBEXT):
+ $(Q) $(MAKE) -C board TOPDIR="$(TOPDIR)" libboard$(LIBEXT) EXTRADEFINES=$(EXTRADEFINES)
+
+# This target builds the final executable
+
+pass1.hex: up_mem.h $(TOPDIR)/lib/$(SDCCLIB) $(HEAD_OBJ) board/libboard$(LIBEXT)
+ @echo "LD: $@"
+ $(Q) "$(CC)" $(LDFLAGS) $(LIBPATHS) -L$(BOARDDIR) $(SDCCPATH) $(HEAD_OBJ) \
+ $(LDLIBS) -llibboard$(LIBEXT) $(SDCCLIBS) -o $@
+ $(Q) rm -f up_mem.h
+ $(Q) rm -f up_allocateheap$(OBJEXT) libarch$(LIBEXT)
+ $(Q) $(MAKE) TOPDIR=$(TOPDIR) libarch$(LIBEXT)
+
+nuttx.hex: up_mem.h $(TOPDIR)/lib/$(SDCCLIB) $(HEAD_OBJ)
+ @echo "LD: $@"
+ $(Q) "$(CC)" $(LDFLAGS) $(LIBPATHS) -L$(BOARDDIR) $(SDCCPATH) $(HEAD_OBJ) \
+ $(LDLIBS) -llibboard$(LIBEXT) $(SDCCLIBS) -o $@
+
+nuttx$(EXEEXT): pass1.hex nuttx.hex
+ $(Q) rm -f pass1.*
+ $(Q) packihx nuttx.hex > $(TOPDIR)/nuttx$(EXEEXT)
+ $(Q) cp -f nuttx.map $(TOPDIR)/.
+
+# This is part of the top-level export target
+
+export_head: board/libboard$(LIBEXT) p_head$(OBJEXT)
+ $(Q) if [ -d "$(EXPORT_DIR)/startup" ]; then \
+ cp -f up_head$(OBJEXT) "$(EXPORT_DIR)/startup"; \
+ else \
+ echo "$(EXPORT_DIR)/startup does not exist"; \
+ exit 1; \
+ fi
+
+# This target builds a test program to verify interrupt context switching. irqtest is
+# a PHONY target that just sets upt the up_irqtest build correctly
+
+up_irqtest.hex: $(TESTOBJS)
+ $(Q) "$(CC)" $(LDFLAGS) -L. $(SDCCPATH) $(TESTLINKOBJS) $(TESTOBJS) $(TESTEXTRAOBJS) $(SDCCLIBS) -o $@
+
+irqtest:
+ $(Q) $(MAKE) TOPDIR=../../.. up_irqtest.hex
+
+# Build dependencies
+
+.depend: Makefile up_mem.h $(DEPSRCS)
+ $(Q) if [ -e board/Makefile ]; then \
+ $(MAKE) -C board TOPDIR=$(TOPDIR) depend ; \
+ fi
+ $(Q) $(MKDEP) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
+
+depend: .depend
+
+clean:
+ $(Q) if [ -e board/Makefile ]; then \
+ $(MAKE) -C board TOPDIR=$(TOPDIR) clean ; \
+ fi
+ $(call DELFILE, libarch$(LIBEXT))
+ $(call DELFILE, up_mem.h)
+ $(call CLEAN)
+
+distclean: clean
+ $(Q) if [ -e board/Makefile ]; then \
+ $(MAKE) -C board TOPDIR=$(TOPDIR) distclean ; \
+ fi
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
+
+-include Make.dep
diff --git a/misc/Obsoleted/arch/8051/src/up_allocateheap.c b/misc/Obsoleted/arch/8051/src/up_allocateheap.c
new file mode 100644
index 000000000..0b00f88ec
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_allocateheap.c
@@ -0,0 +1,89 @@
+/************************************************************
+ * up_allocateheap.c
+ *
+ * Copyright (C) 2007, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * 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 <sched.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+#include <nuttx/kmalloc.h>
+
+#include "up_internal.h"
+#include "up_mem.h"
+
+/************************************************************
+ * Private Definitions
+ ************************************************************/
+
+/************************************************************
+ * Private Data
+ ************************************************************/
+
+/************************************************************
+ * Private Functions
+ ************************************************************/
+
+/************************************************************
+ * Public Functions
+ ************************************************************/
+
+/************************************************************
+ * Name: up_allocate_heap
+ *
+ * Description:
+ * This function will be called to dynamically set aside
+ * the heap region.
+ *
+ ************************************************************/
+
+void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
+{
+ *heap_start = (FAR void*)UP_HEAP1_BASE;
+ *heap_size = UP_HEAP1_END - UP_HEAP1_BASE;
+ board_led_on(LED_HEAPALLOCATE);
+}
+
+#if CONFIG_MM_REGIONS > 1
+void up_addregion(void)
+{
+ kmm_addregion((FAR void*)UP_HEAP2_BASE, UP_HEAP2_END - UP_HEAP2_BASE);
+}
+#endif
diff --git a/misc/Obsoleted/arch/8051/src/up_assert.c b/misc/Obsoleted/arch/8051/src/up_assert.c
new file mode 100644
index 000000000..ca0be70bb
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_assert.c
@@ -0,0 +1,145 @@
+/************************************************************************
+ * up_assert.c
+ *
+ * Copyright (C) 2007, 2009, 2012-2014 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 <stdlib.h>
+#include <assert.h>
+#include <sched.h>
+#include <debug.h>
+
+#include <nuttx/usb/usbdev_trace.h>
+
+#include <8052.h>
+
+#include "sched/sched.h"
+#include "up_internal.h"
+#include "up_mem.h"
+
+/************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************/
+/* USB trace dumping */
+
+#ifndef CONFIG_USBDEV_TRACE
+# undef CONFIG_ARCH_USBDUMP
+#endif
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: _up_assert
+ ************************************************************************/
+
+static void _up_assert(int errorcode) noreturn_function;
+static void _up_assert(int errorcode)
+{
+ /* Are we in an interrupt handler or the idle task? */
+
+ if (g_irqtos || ((FAR struct tcb_s*)g_readytorun.head)->pid == 0)
+ {
+ (void)irqsave();
+ for (;;)
+ {
+#ifdef CONFIG_ARCH_LEDS
+ board_led_on(LED_PANIC);
+ up_delay(250);
+ board_led_off(LED_PANIC);
+ up_delay(250);
+#endif
+ }
+ }
+ else
+ {
+ exit(errorcode);
+ }
+}
+
+/****************************************************************************
+ * Name: assert_tracecallback
+ ****************************************************************************/
+
+#ifdef CONFIG_ARCH_USBDUMP
+static int assert_tracecallback(struct usbtrace_s *trace, void *arg)
+{
+ usbtrace_trprintf((trprintf_t)lowsyslog, trace->event, trace->value);
+ return 0;
+}
+#endif
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_assert
+ ************************************************************************/
+
+void up_assert(const uint8_t *filename, int lineno)
+{
+#if CONFIG_TASK_NAME_SIZE > 0
+ struct tcb_s *rtcb = (struct tcb_s*)g_readytorun.head;
+#endif
+
+ board_led_on(LED_ASSERTION);
+
+#if CONFIG_TASK_NAME_SIZE > 0
+ lldbg("Assertion failed at file:%s line: %d task: %s\n",
+ filename, lineno, rtcb->name);
+#else
+ lldbg("Assertion failed at file:%s line: %d\n",
+ filename, lineno);
+#endif
+
+ up_dumpstack();
+
+#ifdef CONFIG_ARCH_USBDUMP
+ /* Dump USB trace data */
+
+ (void)usbtrace_enumerate(assert_tracecallback, NULL);
+#endif
+
+ _up_assert(EXIT_FAILURE);
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_blocktask.c b/misc/Obsoleted/arch/8051/src/up_blocktask.c
new file mode 100644
index 000000000..72a519b2b
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_blocktask.c
@@ -0,0 +1,167 @@
+/************************************************************************
+ * up_blocktask.c
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <sched.h>
+#include <debug.h>
+#include <nuttx/arch.h>
+
+#include "sched/sched.h"
+#include "up_internal.h"
+
+/************************************************************************
+ * Private Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+/************************************************************************
+ * Private Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_block_task
+ *
+ * Description:
+ * The currently executing task at the head of
+ * the ready to run list must be stopped. Save its context
+ * and move it to the inactive list specified by task_state.
+ *
+ * Inputs:
+ * tcb: Refers to a task in the ready-to-run list (normally
+ * the task at the head of the list). It most be
+ * stopped, its context saved and moved into one of the
+ * waiting task lists. It it was the task at the head
+ * of the ready-to-run list, then a context to the new
+ * ready to run task must be performed.
+ * task_state: Specifies which waiting task list should be
+ * hold the blocked task TCB.
+ *
+ ************************************************************************/
+
+void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state)
+{
+ FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
+ bool switch_needed;
+
+ /* Verify that the context switch can be performed */
+
+ ASSERT((tcb->task_state >= FIRST_READY_TO_RUN_STATE) &&
+ (tcb->task_state <= LAST_READY_TO_RUN_STATE));
+
+ dbg("Blocking TCB=%p\n", tcb);
+
+ /* Remove the tcb task from the ready-to-run list. If we
+ * are blocking the task at the head of the task list (the
+ * most likely case), then a context switch to the next
+ * ready-to-run task is needed. In this case, it should
+ * also be true that rtcb == tcb.
+ */
+
+ switch_needed = sched_removereadytorun(tcb);
+
+ /* Add the task to the specified blocked task list */
+
+ sched_addblocked(tcb, (tstate_t)task_state);
+
+ /* If there are any pending tasks, then add them to the g_readytorun
+ * task list now
+ */
+
+ if (g_pendingtasks.head)
+ {
+ switch_needed |= sched_mergepending();
+ }
+
+ /* Now, perform the context switch if one is needed */
+
+ if (switch_needed)
+ {
+ /* Are we in an interrupt handler? */
+
+ if (g_irqtos)
+ {
+ /* Yes, then we have to do things differently.
+ * Just copy the current registers into the OLD rtcb.
+ */
+
+ up_saveirqcontext(&tcb->xcp);
+
+ /* Restore the exception context of the rtcb at the (new) head
+ * of the g_readytorun task list.
+ */
+
+ rtcb = (FAR struct tcb_s*)g_readytorun.head;
+ dbg("New Active Task TCB=%p\n", rtcb);
+
+ /* Then setup so that the context will be performed on exit
+ * from the interrupt.
+ */
+
+ g_irqcontext = &rtcb->xcp;
+ }
+
+ /* Copy the user C context into the TCB at the (old) head of the
+ * g_readytorun Task list. if up_savecontext returns a non-zero
+ * value, then this is really the previously running task restarting!
+ */
+
+ else if (!up_savecontext(&rtcb->xcp))
+ {
+ /* Restore the exception context of the rtcb at the (new) head
+ * of the g_readytorun task list.
+ */
+
+ rtcb = (FAR struct tcb_s*)g_readytorun.head;
+ dbg("New Active Task TCB=%p\n", rtcb);
+
+ /* Then switch contexts */
+
+ up_restorecontext(&rtcb->xcp);
+ }
+ }
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_debug.c b/misc/Obsoleted/arch/8051/src/up_debug.c
new file mode 100644
index 000000000..35a5d1d50
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_debug.c
@@ -0,0 +1,255 @@
+/************************************************************************
+ * arch/8051/src/up_debug.c
+ *
+ * Copyright (C) 2007, 2009, 2014 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 <debug.h>
+
+#include <8052.h>
+#include <nuttx/arch.h>
+#include <arch/irq.h>
+
+#include "up_internal.h"
+#include "up_mem.h"
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+#if defined(CONFIG_FRAME_DUMP) && defined(CONFIG_ARCH_8051_BRINGUP)
+static void up_putspace(void) __naked
+{
+ _asm
+ mov a, #0x20
+ ljmp PM2_ENTRY_COUT
+ _endasm;
+}
+
+static void _up_putcolon(void) __naked
+{
+ _asm
+ mov a, #0x3a
+ ljmp PM2_ENTRY_COUT
+ _endasm;
+}
+
+static void _up_dump16(__code char *ptr, uint8_t msb, uint8_t lsb)
+{
+ up_puts(ptr);
+ up_puthex(msb);
+ up_puthex(lsb);
+ up_putnl();
+}
+
+static void _up_dump8(__code char *ptr, uint8_t b)
+{
+ up_puts(ptr);
+ up_puthex(b);
+ up_putnl();
+}
+#endif
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_puthex, up_puthex16, up_putnl, up_puts
+ ************************************************************************/
+
+#if defined(CONFIG_ARCH_8051_BRINGUP)
+void up_puthex(uint8_t hex) __naked
+{
+ hex; /* To avoid unreferenced argument warning */
+ _asm
+ mov a, dpl
+ ljmp PM2_ENTRY_PHEX
+ _endasm;
+}
+
+void up_puthex16(int hex) __naked
+{
+ hex; /* To avoid unreferenced argument warning */
+ _asm
+ ljmp PM2_ENTRY_PHEX16
+ _endasm;
+}
+
+void up_putnl(void) __naked
+{
+ _asm
+ ljmp PM2_ENTRY_NEWLINE
+ _endasm;
+}
+
+void up_puts(__code char *ptr)
+{
+ for (; *ptr; ptr++)
+ {
+ up_putc(*ptr);
+ }
+}
+#endif
+
+/************************************************************************
+ * Name: up_dumpstack
+ ************************************************************************/
+
+#if defined(CONFIG_FRAME_DUMP) && defined(CONFIG_ARCH_8051_BRINGUP)
+void up_dumpstack(void)
+{
+ NEAR uint8_t *start = (NEAR uint8_t *)(STACK_BASE & 0xf0);
+ NEAR uint8_t *end = (NEAR uint8_t *)SP;
+ uint8_t i;
+
+ while (start < end)
+ {
+ up_puthex((uint8_t)start);
+ _up_putcolon();
+
+ for (i = 0; i < 8; i++)
+ {
+ up_putspace();
+ if (start < (NEAR uint8_t *)(STACK_BASE) ||
+ start > end)
+ {
+ up_putspace();
+ up_putspace();
+ }
+ else
+ {
+ up_puthex(*start);
+ }
+ start++;
+ }
+ up_putnl();
+ }
+}
+#endif
+
+/************************************************************************
+ * Name: up_dumpframe
+ ************************************************************************/
+
+#if defined(CONFIG_FRAME_DUMP) && defined(CONFIG_ARCH_8051_BRINGUP)
+void up_dumpframe(FAR struct xcptcontext *context)
+{
+#ifdef CONFIG_FRAME_DUMP_SHORT
+ FAR uint8_t *stack = &context->stack[context->nbytes - FRAME_SIZE];
+ FAR uint8_t *regs = context->regs;
+
+ _up_dump16(" RET ", stack[FRAME_RETMS], stack[FRAME_RETLS]);
+ _up_dump8 (" IE ", stack[FRAME_IE]);
+ _up_dump16(" DPTR ", stack[FRAME_DPH], stack[FRAME_DPL]);
+ _up_dump8 (" PSW ", regs[REGS_PSW]);
+ _up_dump8 (" SP ", context->nbytes + (STACK_BASE-1));
+#else
+ FAR uint8_t *stack = &context->stack[context->nbytes - FRAME_SIZE];
+ FAR uint8_t *regs = context->regs;
+ uint8_t i, j, k;
+
+ _up_dump8 (" NBYTES ", context->nbytes);
+
+ for (i = 0; i < context->nbytes; i += 8)
+ {
+ up_puthex(i);
+ _up_putcolon();
+
+ for (j = 0; j < 8; j++)
+ {
+ k = i + j;
+ up_putspace();
+ if (k >= context->nbytes)
+ {
+ up_putspace();
+ up_putspace();
+ }
+ else
+ {
+ up_puthex(context->stack[k]);
+ }
+ }
+ up_putnl();
+ }
+
+ up_puts(" REGS:");
+ for (i = 0; i < REGS_SIZE; i++)
+ {
+ up_putspace();
+ up_puthex(context->regs[i]);
+ }
+ up_putnl();
+#endif
+}
+#endif
+
+/************************************************************************
+ * Name: up_dumpframe
+ ************************************************************************/
+
+/* The 805x family has a tiny, 256 stack and can be easily
+ * overflowed. The following macro can be used to instrument
+ * code to dump the stack pointer at critical locations.
+ */
+
+#ifdef CONFIG_ARCH_8051_BRINGUP
+void up_showsp(uint8_t ch) __naked
+{
+ ch;
+ _asm
+ mov a, dpl
+ lcall PM2_ENTRY_COUT
+ mov a, sp
+ lcall PM2_ENTRY_PHEX
+ lcall PM2_ENTRY_NEWLINE
+ _endasm;
+}
+#endif
+
+
diff --git a/misc/Obsoleted/arch/8051/src/up_delay.c b/misc/Obsoleted/arch/8051/src/up_delay.c
new file mode 100644
index 000000000..ad8950e86
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_delay.c
@@ -0,0 +1,93 @@
+/************************************************************************
+ * up_delay.c
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+#include "up_internal.h"
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Private Types
+ ************************************************************************/
+
+/************************************************************************
+ * Private Function Prototypes
+ ************************************************************************/
+
+/************************************************************************
+ * Private Variables
+ ************************************************************************/
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+
+/************************************************************************
+ * Public Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_delay
+ *
+ * Description:
+ * Delay inline for the requested number of milliseconds.
+ * NOT multi-tasking friendly.
+ *
+ ************************************************************************/
+
+void up_delay(uint8_t milliseconds) __naked
+{
+ _asm
+ mov r0, dpl
+00001$: mov r1, #230
+00002$: nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ djnz r1, 00002$
+ djnz r0, 00001$
+ ret
+ _endasm;
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_exit.c b/misc/Obsoleted/arch/8051/src/up_exit.c
new file mode 100644
index 000000000..29fe790fb
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_exit.c
@@ -0,0 +1,106 @@
+/****************************************************************************************
+ * up_exit.c
+ *
+ * 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.
+ *
+ ****************************************************************************************/
+
+/****************************************************************************************
+ * Included Files
+ ****************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sched.h>
+#include <debug.h>
+
+#include <8052.h>
+#include <nuttx/arch.h>
+
+#include "task/task.h"
+#include "sched/sched.h"
+#include "up_internal.h"
+
+/****************************************************************************************
+ * Private Definitions
+ ****************************************************************************************/
+
+/****************************************************************************************
+ * Private Data
+ ****************************************************************************************/
+
+/****************************************************************************************
+ * Private Functions
+ ****************************************************************************************/
+
+/****************************************************************************************
+ * Public Functions
+ ****************************************************************************************/
+
+/****************************************************************************************
+ * Name: _exit
+ *
+ * Description:
+ * This function causes the currently executing task to cease
+ * to exist. This is a special case of task_delete() where the task to
+ * be deleted is the currently executing task. It is more complex because
+ * a context switch must be perform to the next ready to run task.
+ *
+ ****************************************************************************************/
+
+void _exit(int status)
+{
+ FAR struct tcb_s* tcb;
+
+ dbg("TCB=%p exiting\n", tcb);
+
+ /* Disable interrupts. Interrupts will remain disabled until
+ * the new task is resumed below when the save IE is restored.
+ */
+
+ EA = 0;
+
+ /* Destroy the task at the head of the ready to run list. */
+
+ (void)task_exit();
+
+ /* Now, perform the context switch to the new ready-to-run task at the
+ * head of the list.
+ */
+
+ tcb = (FAR struct tcb_s*)g_readytorun.head;
+ dbg("New Active Task TCB=%p\n", tcb);
+
+ /* Then switch contexts */
+
+ up_restorecontext(&tcb->xcp);
+}
+
diff --git a/misc/Obsoleted/arch/8051/src/up_head.S b/misc/Obsoleted/arch/8051/src/up_head.S
new file mode 100644
index 000000000..d4e2ba6e7
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_head.S
@@ -0,0 +1,471 @@
+/************************************************************
+ * arch/8051/src/up_head.S
+ *
+ * Copyright (C) 2007, 2014 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 <nuttx/irq.h>
+#include "up_internal.h"
+
+ .module up_head
+ .optsdcc -mmcs51 --model-large
+
+/************************************************************
+ * Private Data
+ ************************************************************/
+
+ .area REG_BANK_0 (REL,OVR,DATA)
+ .ds 8
+
+#ifndef CONFIG_ARCH_8051_NOSYSTIMER
+ .area XSEG
+_g_timer0tick:
+ .ds 1
+#endif
+
+/************************************************************
+ * Public Data
+ ************************************************************/
+
+ .globl _g_irqtos
+ .globl _g_irqcontext
+ .globl _g_irqregs
+
+/************************************************************
+ * Public Functions
+ ************************************************************/
+
+ .globl _irq_dispatch
+ .globl _up_restoreregisters
+
+/************************************************************
+ * Program entry points
+ ************************************************************/
+
+/* Program entry is through PROGRAM_BASE. This is just a
+ * branch to our start up logic.
+ */
+
+ .area CODE1 (ABS)
+ .org PROGRAM_BASE
+ ljmp start
+
+/* These are indirect interrupt vectors. Logic in PAULMON2,
+ * captures the interrupt vectors (near address 0x0000) and
+ * re-routes them through the following entry points.
+ *
+ * Each of these saves acc and ie then passes the IRQ number
+ * to higher level logic in a
+ */
+
+ .org PM2_VECTOR_EXTINT0
+ push acc
+ mov a, #EXT_INT0_IRQ
+ ljmp _up_interrupt
+
+ .org PM2_VECTOR_TIMER0
+ push acc
+#ifdef CONFIG_ARCH_8051_NOSYSTIMER
+ mov a, #TIMER0_IRQ
+ ljmp _up_interrupt
+#else
+ ljmp _up_timer0
+#endif
+ .org PM2_VECTOR_EXTINT1
+ push acc
+ mov a, #EXT_INT1_IRQ
+ ljmp _up_interrupt
+
+ .org PM2_VECTOR_TIMER1
+ push acc
+ mov a, #TIMER1_IRQ
+ ljmp _up_interrupt
+
+ .org PM2_VECTOR_UART
+ push acc
+ mov a, #UART_IRQ
+ ljmp _up_interrupt
+
+ .org PM2_VECTOR_TIMER2
+ push acc
+ mov a, #TIMER2_IRQ
+ ljmp _up_interrupt
+
+/************************************************************
+ * Name: start
+ *
+ * Description:
+ * This is the initial entry point into NuttX
+ *
+ ************************************************************/
+
+start:
+ mov sp, #(STACK_BASE-1)
+
+#ifdef CONFIG_ARCH_LEDS
+ lcall _board_led_initialize
+#endif
+
+ ljmp _os_start
+
+/************************************************************
+ * Name: up_timer0
+ *
+ * Description:
+ * Timer 0, mode 0 can be used as a system timer. In that
+ * mode, the 1.8432 MHz clock is divided by 32. A single
+ * 8-bit value is incremented at 57600 Hz, which results
+ * in 225 Timer 0 overflow interrupts per second.
+ *
+ * The Timer0 interrupt vectors to this point which then
+ * does a software divide by 2 to get a system timer of
+ * 112.5Hz.
+ *
+ * On Entry:
+ *
+ * (1) acc on the stack and
+ * (2) the IRQ number(TIMER0_IRQ) in the accumulator
+ *
+ ************************************************************/
+
+#ifndef CONFIG_ARCH_8051_NOSYSTIMER
+_up_timer0:
+ ar2 = 0x02
+ ar3 = 0x03
+ ar4 = 0x04
+ ar5 = 0x05
+ ar6 = 0x06
+ ar7 = 0x07
+ ar0 = 0x00
+ ar1 = 0x01
+
+ /* ACC already on the stack; push IE. Then disable interrupts */
+
+ push ie
+ clr ea
+
+ /* Save the remaining registers with interrupts disabled
+ *
+ * a, ie, and dptr go on the stack.
+ */
+
+ push dpl
+ push dph
+
+ /* Increment the tick counter */
+
+ mov dptr, #_g_timer0tick
+ movx a, @dptr
+ inc a
+ movx @dptr, a
+
+ /* If bit 0 is '0', then just return from the interrupt */
+
+ anl a, #0x01
+ jnz 00101$
+ ljmp _up_timer0exit
+
+ /* If bit 0 is '1', then process the interrupt */
+
+00101$:
+ mov a, #TIMER0_IRQ
+ sjmp _up_timer0join
+#endif
+
+/************************************************************
+ * Name: up_interrupt
+ *
+ * Description:
+ * All interrupts vector to this point with:
+ *
+ * (1) acc on the stack and
+ * (2) the IRQ number in the accumulator
+ *
+ ************************************************************/
+
+_up_interrupt:
+ ar2 = 0x02
+ ar3 = 0x03
+ ar4 = 0x04
+ ar5 = 0x05
+ ar6 = 0x06
+ ar7 = 0x07
+ ar0 = 0x00
+ ar1 = 0x01
+
+ /* ACC already on the stack; push IE. Then disable interrupts */
+
+ push ie
+ clr ea
+
+ /* Save the remaining registers with interrupts disabled
+ *
+ * a, ie, and dptr go on the stack.
+ */
+
+ push dpl
+ push dph
+
+_up_timer0join:
+ /* Other registers go into the IRQ register save area */
+
+ push acc
+ mov dptr, #_g_irqregs
+ lcall _up_saveregisters
+
+ /* Show interrupt status on the LEDs */
+
+#ifdef CONFIG_ARCH_LEDS
+ mov dpl, #LED_INIRQ
+ lcall _board_led_on
+#endif
+
+ /* Save the IRQ number in r2 */
+
+ pop ar2
+
+ /* Mark that we are in an interrupt and provide the top
+ * of stack pointer to the context switching logic.
+ */
+
+ mov dptr, #_g_irqtos
+ mov a, sp
+ movx @dptr, a
+
+ /* Nullify the context pointer. If a context switch is
+ * needed, this will be set to the address of the context
+ * structure.
+ */
+
+ mov dptr, #_g_irqcontext
+ clr a
+ movx @dptr,a
+ inc dptr
+ movx @dptr,a
+
+ /* Now call void irq_dispatch(int irq, FAR void *context)
+ *
+ * First, create the first argument as (int)irqno
+ */
+
+ mov dpl, r2
+ mov dph, #0
+
+ /* Create the second argument (void *context) on the stack */
+
+ push sp
+ clr a
+ push acc
+
+ /* Then dispatch the IRQ. */
+
+ lcall _irq_dispatch
+ pop acc
+ pop acc
+
+ /* Indicate that we are no longer in an interrupt */
+
+ mov dptr, #_g_irqtos
+ clr a
+ movx @dptr, a
+
+ /* Check if a context switch is pending */
+
+ mov dptr,#_g_irqcontext
+ movx a, @dptr
+ mov r2, a
+ inc dptr
+ movx a, @dptr
+ mov r3, a
+
+ orl a, r2
+ jnz 00001$
+
+ /* No context switch is pending. Restore registers
+ * from the interrupt register save area.
+ */
+
+ mov dptr, #_g_irqregs
+ sjmp 00004$
+
+00001$: /****************************************************/
+
+ /* A context switch is pending, clear g_irqcontext */
+
+ mov dpl, r2
+ mov dph, r3
+ clr a
+ movx @dptr, a
+ inc dptr
+ movx @dptr, a
+
+#ifdef CONFIG_INTERRUPT_FRAME_DUMP
+ mov dpl, r2
+ mov dph, r3
+ push ar2
+ push ar3
+ lcall _up_dumpframe
+ pop ar3
+ pop ar2
+#endif
+
+ /* Register usage in the following:
+ *
+ * R0 - Holds working the 8-bit IRAM pointer
+ * R1 - Not used
+ * R2-3 - Holds the working 16-bit XRAM pointer
+ * R4 - Holds the working byte count
+ * R5 - Holds the new stack pointer
+ * R6-7 - Not used
+ */
+
+ /* Fetch r4 = context->nbytes */
+
+ mov dpl, r2
+ mov dph, r3
+ movx a, @dptr
+ mov r4, a
+
+ /* Save the new stack pointer in r5 */
+
+ add a, #(STACK_BASE-1)
+ mov r5, a
+
+ /* Save r2-3 = &context->stack */
+
+ inc dptr
+ push dpl
+ push dph
+ mov r2, dpl
+ mov r3, dph
+
+ /* Set r0 = stack base address */
+
+ mov r0, #STACK_BASE
+
+ /* Top of the copy loop */
+00002$:
+ mov a, r4 /* a = bytes left to transfer */
+ dec r4 /* (for next time through the loop) */
+ jz 00003$ /* Jump if a = 0 (done) */
+
+ /* Fetch the next byte from context->stack */
+
+ mov dpl, r2
+ mov dph, r3
+ movx a,@dptr
+
+ /* Increment the XRAM pointer */
+
+ inc dptr
+ mov r2, dpl
+ mov r3, dph
+
+ /* Save the next byte into IRAM */
+
+ mov @r0, a
+
+ /* Increment the IRAM pointer */
+
+ inc r0
+ sjmp 00002$
+
+ /* The entire stack has been copied from XRAM into
+ * IRAM. Set the new stack pointer
+ */
+
+00003$:
+ pop dph
+ pop dpl
+ mov sp, r5
+
+#ifdef CONFIG_INTERRUPT_FRAME_DUMP
+ push dpl
+ push dph
+ lcall _up_dumpstack
+ pop dph
+ pop dpl
+#endif
+ /* Get the pointer to the register save area */
+
+ mov a, #STACK_SIZE
+ add a, dpl
+ mov dpl, a
+ clr a
+ addc a, dph
+ mov dph, a
+
+00004$: /****************************************************/
+
+ /* Restore the context from the register save area
+ * and return from the interrupt. At this point, dptr
+ * holds the pointer to the memory region that holds
+ * the register save area. This could be either
+ * g_irqregs (no context switch) or &g_irqcontext->regs
+ * (context switch).
+ */
+
+#ifdef CONFIG_ARCH_LEDS
+ push dpl
+ push dph
+ mov dpl, #LED_INIRQ
+ lcall _board_led_off
+ pop dph
+ pop dpl
+#endif
+ /* Restore registers from the register save area */
+
+ lcall _up_restoreregisters
+
+_up_timer0exit:
+ /* Restore registers from the stack and return */
+
+ pop dph
+ pop dpl
+
+ /* Restore the interrupt state per the stored IE value */
+
+ pop acc
+ jb acc.7,00005$
+ clr ie.7
+ sjmp 00006$
+00005$:
+ setb ie.7
+
+00006$:
+ pop acc
+ reti
diff --git a/misc/Obsoleted/arch/8051/src/up_idle.c b/misc/Obsoleted/arch/8051/src/up_idle.c
new file mode 100644
index 000000000..a5d39bcfb
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_idle.c
@@ -0,0 +1,95 @@
+/************************************************************************
+ * arch/8051/src/up_idle.c
+ *
+ * Copyright (C) 2007, 2009, 2014 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 <nuttx/arch.h>
+
+#include "up_internal.h"
+
+/************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+#if defined(CONFIG_ARCH_LEDS) && defined(CONFIG_ARCH_8051_BRINGUP)
+static uint8_t g_ledtoggle = 0;
+#endif
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_idle
+ *
+ * Description:
+ * up_idle() is the logic that will be executed when their
+ * is no other ready-to-run task. This is processor idle
+ * time and will continue until some interrupt occurs to
+ * cause a context switch from the idle task.
+ *
+ * Processing in this state may be processor-specific. e.g.,
+ * this is where power management operations might be
+ * performed.
+ *
+ ************************************************************************/
+
+void up_idle(void)
+{
+#if defined(CONFIG_ARCH_LEDS) && defined(CONFIG_ARCH_8051_BRINGUP)
+ g_ledtoggle++;
+ if (g_ledtoggle == 0x80)
+ {
+ board_led_on(LED_IDLE);
+ }
+ else if (g_ledtoggle == 0x00)
+ {
+ board_led_off(LED_IDLE);
+ }
+#endif
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_initialize.c b/misc/Obsoleted/arch/8051/src/up_initialize.c
new file mode 100644
index 000000000..bf461a09c
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_initialize.c
@@ -0,0 +1,144 @@
+/************************************************************************
+ * arch/8051/src/up_initialize.c
+ *
+ * Copyright (C) 2007, 2009, 2011, 2014 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 <nuttx/arch.h>
+#include <nuttx/fs/fs.h>
+
+#include "up_internal.h"
+
+/************************************************************************
+ * Private Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+/* This is the top of the stack containing the interrupt
+ * stack frame. It is set when processing an interrupt. It
+ * is also cleared when the interrupt returns so this can
+ * also be used like a boolean indication that we are in an
+ * interrupt.
+ */
+
+volatile uint8_t g_irqtos;
+
+/* Registers are saved in the following global array during
+ * interrupt processing. If a context switch is performed
+ * during the interrupt handling, these registers will be
+ * copied into the TCB again (NOTE: We could save a copy
+ * if the interrupt handling logic saved the registers
+ * directly into (struct tcb_s*)g_readytorun.head->xcp.regs).
+ */
+
+uint8_t g_irqregs[REGS_SIZE];
+
+/* If during execution of an interrup handler, a context
+ * switch must be performed, the follwing will be set to
+ * to that address of the relevant context structure. The
+ * actual switch will be deferred until the time that the
+ * the interrupt exits.
+ */
+
+FAR struct xcptcontext *g_irqcontext;
+
+/* It is faster to look up 8-bit shifts in this table than
+ * to comput them.
+ */
+
+const uint8_t g_ntobit[8] =
+ { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_initialize
+ *
+ * Description:
+ * up_initialize will be called once during OS
+ * initialization after the basic OS services have been
+ * initialized. The architecture specific details of
+ * initializing the OS will be handled here. Such things as
+ * setting up interrupt service routines, starting the
+ * clock, and registering device drivers are some of the
+ * things that are different for each processor and hardware
+ * platform.
+ *
+ * up_initialize is called after the OS initialized but
+ * before the init process has been started and before the
+ * libraries have been initialized. OS services and driver
+ * services are available.
+ *
+ ************************************************************************/
+
+void up_initialize(void)
+{
+ /* Initialize global variables */
+
+ g_irqtos = 0;
+
+ /* Add extra memory fragments to the memory manager */
+
+#if CONFIG_MM_REGIONS > 1
+ up_addregion();
+#endif
+
+ /* Initialize the interrupt subsystem */
+
+ up_irqinitialize();
+
+ /* Initialize the system timer interrupt */
+
+#ifndef CONFIG_ARCH_8051_SUPRESS_INTERRUPTS
+ up_timer_initialize();
+#endif
+
+ board_led_on(LED_IRQSENABLED);
+}
+
diff --git a/misc/Obsoleted/arch/8051/src/up_initialstate.c b/misc/Obsoleted/arch/8051/src/up_initialstate.c
new file mode 100644
index 000000000..d0d568981
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_initialstate.c
@@ -0,0 +1,119 @@
+/************************************************************************
+ * up_initialstate.c
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdint.h>
+#include <sched.h>
+
+#include "up_internal.h"
+
+/************************************************************************
+ * Private Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_initial_state
+ *
+ * Description:
+ * A new thread is being started and a new TCB
+ * has been created. This function is called to initialize
+ * the processor specific portions of the new TCB.
+ *
+ * This function must setup the intial architecture registers
+ * and/or stack so that execution will begin at tcb->start
+ * on the next context switch.
+ *
+ ************************************************************************/
+
+void up_initial_state(FAR struct tcb_s *tcb)
+{
+ FAR uint8_t *frame = tcb->xcp.stack;
+ FAR uint8_t *regs = tcb->xcp.regs;
+
+ /* This is the form of initial stack frame
+ *
+ * This initial stack frame will be configured to hold.
+ * (1) The 16-bit return address of either:
+ *
+ * void task_start(void);
+ * void pthread_start(void)
+ *
+ * The return address is stored at the top of stack.
+ * so that the RETI instruction will work:
+ *
+ * PC15-8 <- ((SP))
+ * (SP) <- (SP) -1
+ * PC7-0 <- ((SP))
+ * (SP) <- (SP) -1
+ */
+
+ frame[FRAME_RETLS] = (((uint16_t)tcb->start) & 0xff);
+ frame[FRAME_RETMS] = (((uint16_t)tcb->start) >> 8);
+
+ /* The context save area for registers a, ie, and dpstr
+ * follows the return address in the stack frame.
+ */
+
+ frame[FRAME_IE] = 0x80;
+
+ /* Save the number of bytes in the frame (which will be used
+ * to initialize the stack pointer when the task is started).
+ */
+
+ tcb->xcp.nbytes = FRAME_SIZE;
+
+ /* Initialize the remaining register save area which is
+ * outside of the stack save area.
+ */
+
+ tcb->xcp.regs[REGS_PSW] = 0;
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_internal.h b/misc/Obsoleted/arch/8051/src/up_internal.h
new file mode 100644
index 000000000..d4bde5923
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_internal.h
@@ -0,0 +1,153 @@
+/**************************************************************************
+ * arch/8051/src/up_internal.h
+ *
+ * Copyright (C) 2007, 2009, 2011, 2014 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ **************************************************************************/
+
+#ifndef __ARCH_8051_SRC_UP_INTERNAL_H
+#define __ARCH_8051_SRC_UP_INTERNAL_H
+
+/**************************************************************************
+ * Included Files
+ **************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <arch/irq.h>
+
+#if defined(CONFIG_ARCH_BOARD_PJRC_87C52)
+# include <arch/board/pjrc.h>
+#else
+# warning "805x board not recognized"
+#endif
+
+/**************************************************************************
+ * Public Definitions
+ **************************************************************************/
+
+/**************************************************************************
+ * Public Types
+ **************************************************************************/
+
+/**************************************************************************
+ * Public Variables
+ **************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/* This is the top of the stack containing the interrupt
+ * stack frame. It is set when processing an interrupt. It
+ * is also cleared when the interrupt returns so this can
+ * also be used like a boolean indication that we are in an
+ * interrupt.
+ */
+
+extern volatile uint8_t g_irqtos;
+
+/* Registers are saved in the following global array during
+ * interrupt processing. If a context switch is performed
+ * during the interrupt handling, these registers will be
+ * copied into the TCB again (NOTE: We could save a copy
+ * if the interrupt handling logic saved the registers
+ * directly into (struct tcb_s*)g_readytorun.head->xcp.regs).
+ */
+
+extern uint8_t g_irqregs[REGS_SIZE];
+
+/* If during execution of an interrup handler, a context
+ * switch must be performed, the follwing will be set to
+ * to that address of the relevant context structure. The
+ * actual switch will be deferred until the time that the
+ * the interrupt exits.
+ */
+
+extern FAR struct xcptcontext *g_irqcontext;
+
+/* It is faster to look up 8-bit shifts in this table than
+ * to comput them.
+ */
+
+extern const uint8_t g_ntobit[8];
+
+#endif /* __ASSEMBLY */
+
+/**************************************************************************
+ * Public Function Prototypes
+ **************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+#if CONFIG_MM_REGIONS > 1
+void up_addregion(void);
+#endif
+void up_delay(uint8_t milliseconds) __naked;
+void up_irqinitialize(void);
+void up_restorecontext(FAR struct xcptcontext *context) _naked;
+void up_restoreregisters(FAR uint8_t *regs) _naked;
+uint8_t up_savecontext(FAR struct xcptcontext *context) __naked;
+void up_saveregisters(FAR uint8_t *regs) _naked;
+void up_saveirqcontext(FAR struct xcptcontext *context);
+void up_timer_initialize(void);
+
+/* Defined in up_debug.c */
+
+#if defined(CONFIG_ARCH_8051_BRINGUP)
+void up_puthex(uint8_t hex) __naked;
+void up_puthex16(int hex) __naked;
+void up_putnl(void) __naked;
+void up_puts(__code char *ptr);
+void up_showsp(uint8_t ch) __naked;
+#endif
+
+#if defined(CONFIG_FRAME_DUMP) && defined(CONFIG_ARCH_8051_BRINGUP)
+void up_dumpstack(void);
+void up_dumpframe(FAR struct xcptcontext *context);
+#else
+# define up_dumpstack()
+# define up_dumpframe(x)
+#endif
+
+/* Defined in board/up_leds.c */
+
+#ifdef CONFIG_ARCH_LEDS
+void board_led_initialize(void);
+void board_led_on(uint8_t led);
+void board_led_off(uint8_t led);
+#else
+# define board_led_initialize()
+# define board_led_on(led)
+# define board_led_off(led)
+#endif
+
+#endif /* __ASSEMBLY */
+#endif /* __ARCH_8051_SRC_UP_INTERNAL_H */
diff --git a/misc/Obsoleted/arch/8051/src/up_interruptcontext.c b/misc/Obsoleted/arch/8051/src/up_interruptcontext.c
new file mode 100644
index 000000000..bcc9e4cd9
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_interruptcontext.c
@@ -0,0 +1,70 @@
+/************************************************************************
+ * up_interruptcontext.c
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdbool.h>
+#include <nuttx/arch.h>
+#include <nuttx/irq.h>
+
+#include "up_internal.h"
+
+/************************************************************************
+ * Private Types
+ ************************************************************************/
+
+/************************************************************************
+ * Private Function Prototypes
+ ************************************************************************/
+
+/************************************************************************
+ * Global Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_interrupt_context
+ *
+ * Description: Return true is we are currently executing in
+ * the interrupt handler context.
+ ************************************************************************/
+
+bool up_interrupt_context(void)
+{
+ return g_irqtos != 0;
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_irq.c b/misc/Obsoleted/arch/8051/src/up_irq.c
new file mode 100644
index 000000000..85b30aeaf
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_irq.c
@@ -0,0 +1,152 @@
+/************************************************************************
+ * arch/8051/src/up_irq.c
+ *
+ * Copyright (C) 2007, 2009, 2014 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/irq.h>
+#include <debug.h>
+
+#include <8052.h>
+
+#include "up_internal.h"
+
+extern int g_nints;
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Data
+ ************************************************************************/
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: irq_initialize
+ ************************************************************************/
+
+void up_irqinitialize(void)
+{
+ /* Set interrupt priorities (all low) */
+
+ IP = 0;
+
+#ifdef CONFIG_ARCH_8051_SUPRESS_INTERRUPTS
+ /* Disable all interrupts */
+
+ IE = 0;
+#else
+ /* Enable interrupts globally, but disable all interrupt
+ * sources.
+ */
+
+ IE = 0x80;
+#endif
+}
+
+/************************************************************************
+ * Name: irqsave
+ *
+ * Description:
+ * Disable all IRQs
+ *
+ ************************************************************************/
+
+irqstate_t irqsave(void)
+{
+ irqstate_t ret = IE;
+ EA = 0;
+ return ret;
+}
+
+/************************************************************************
+ * Name: irqrestore
+ *
+ * Description:
+ * Restore a previous interrupt state
+ *
+ ************************************************************************/
+
+void irqrestore(irqstate_t flags)
+{
+ IE = flags;
+}
+
+/************************************************************************
+ * Name: up_disable_irq
+ *
+ * Description:
+ * Disable the IRQ specified by 'irq'
+ *
+ ************************************************************************/
+
+void up_disable_irq(int irq)
+{
+ if ((unsigned)irq < NR_IRQS)
+ {
+ IE &= ~(g_ntobit[irq]);
+ }
+}
+
+/************************************************************************
+ * Name: up_enable_irq
+ *
+ * Description:
+ * Enable the IRQ specified by 'irq'
+ *
+ ************************************************************************/
+
+void up_enable_irq(int irq)
+{
+ if ((unsigned)irq < NR_IRQS)
+ {
+ IE |= g_ntobit[irq];
+ }
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_irqtest.c b/misc/Obsoleted/arch/8051/src/up_irqtest.c
new file mode 100644
index 000000000..be8f6d00b
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_irqtest.c
@@ -0,0 +1,272 @@
+/************************************************************************
+ * arch/8051/src/up_irqtest.c
+ *
+ * Copyright (C) 2007, 2011, 2014 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 <nuttx/arch.h>
+#include <8052.h>
+
+#include "up_internal.h"
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+#define up_extint0 ((vector_t)PM2_VECTOR_EXTINT0)
+#define up_timer0 ((vector_t)PM2_VECTOR_TIMER0)
+#define up_extint1 ((vector_t)PM2_VECTOR_EXTINT1)
+#define up_timer1 ((vector_t)PM2_VECTOR_TIMER1)
+#define up_uart ((vector_t)PM2_VECTOR_UART)
+#define up_timer2 ((vector_t)PM2_VECTOR_TIMER2)
+
+/************************************************************************
+ * Private Types
+ ************************************************************************/
+
+typedef void (*vector_t)(void);
+
+/************************************************************************
+ * Public Variables
+ ************************************************************************/
+
+bool g_irqtest;
+volatile uint8_t g_irqtos;
+uint8_t g_irqregs[REGS_SIZE];
+int g_nirqs;
+FAR struct xcptcontext *g_irqcontext;
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: utility functions
+ ************************************************************************/
+
+static void _up_putc(uint8_t ch) __naked
+{
+ ch; /* To avoid unreferenced argument warning */
+ _asm
+ mov a, dpl
+ ljmp PM2_ENTRY_COUT
+ _endasm;
+}
+
+void _up_puthex(uint8_t hex) __naked
+{
+ hex; /* To avoid unreferenced argument warning */
+ _asm
+ mov a, dpl
+ ljmp PM2_ENTRY_PHEX
+ _endasm;
+}
+
+void _up_puthex16(int hex) __naked
+{
+ hex; /* To avoid unreferenced argument warning */
+ _asm
+ ljmp PM2_ENTRY_PHEX16
+ _endasm;
+}
+
+void _up_putnl(void) __naked
+{
+ _asm
+ ljmp PM2_ENTRY_NEWLINE
+ _endasm;
+}
+
+void _up_puts(__code char *ptr)
+{
+ for (; *ptr; ptr++)
+ {
+ _up_putc(*ptr);
+ }
+}
+
+void _up_delay(uint8_t milliseconds) __naked
+{
+ _asm
+ mov r0, dpl
+00001$: mov r1, #230
+00002$: nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ djnz r1, 00002$
+ djnz r0, 00001$
+ ret
+ _endasm;
+}
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: os_start
+ *
+ * Description:
+ * "Fake" OS entry point.
+ *
+ ************************************************************************/
+
+void os_start(void)
+{
+ int i;
+
+ /* Disable all interrupts */
+
+ IE = 0;
+
+ /* Then verify all of the interrupts */
+
+ g_irqtest = false;
+
+ up_extint0();
+#ifdef CONFIG_ARCH_8051_NOSYSTIMER
+ up_timer0();
+#endif
+ up_extint1();
+ up_timer1();
+ up_uart();
+ up_timer2();
+
+ /* Now a real interrupt ... */
+
+ /* Configure timer 0 */
+
+ TR0 = 0; /* Make sure timer 0 is stopped */
+ TF0 = 0; /* Clear the overflow flag */
+ TMOD &= 0xF0; /* Set to mode 0 (without changing timer1) */
+ TL0 = 0; /* Clear timer 0 value */
+ TH0 = 0;
+ TR0 = 1; /* Start the timer */
+
+ /* Start timer interrupts */
+
+ g_irqtest = true;
+ g_nirqs = 0;
+ IE = 0x82; /* Enable interrupts */
+
+ /* Wait a about 500 MS */
+
+ _up_delay(500);
+
+ /* Disable the timer */
+
+ TR0 = 0; /* Stop timer 0 */
+ IE = 0; /* Disable interrupts */
+
+ _up_puts("IRQs in 500 MS=");
+ _up_puthex16(g_nirqs);
+ _up_putnl();
+
+ /* end of test */
+
+ _up_puts("Test complete");
+ _up_putnl();
+ for (;;);
+}
+
+/************************************************************************
+ * Name: irq_dispatch
+ *
+ * Description:
+ * "Fake" IRQ dispatcher
+ *
+ ***********************************************************************/
+
+void irq_dispatch(int irq, FAR void *context)
+{
+ context;
+ if (g_irqtest)
+ {
+ g_nirqs++;
+ }
+ else
+ {
+ _up_puts("Dispatch IRQ=");
+ _up_puthex(irq);
+ _up_putnl();
+ }
+}
+
+/************************************************************************
+ * Name: up_dumpstack / up_dumpframe
+ *
+ * Description:
+ * "Fake" debug routines if needed.
+ *
+ ************************************************************************/
+
+void up_dumpstack(void)
+{
+}
+
+void up_dumpframe(FAR struct xcptcontext *context)
+{
+}
+
+/************************************************************************
+ * Name: board_led_initialize, board_led_on, board_led_off
+ *
+ * Description:
+ * "Fake" LED routines if needed
+ *
+ ************************************************************************/
+
+void board_led_initialize(void)
+{
+}
+
+void board_led_on(uint8_t led)
+{
+ led;
+}
+
+void board_led_off(uint8_t led)
+{
+ led;
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_putc.c b/misc/Obsoleted/arch/8051/src/up_putc.c
new file mode 100644
index 000000000..bf2edb5e1
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_putc.c
@@ -0,0 +1,81 @@
+/************************************************************************
+ * up_putc.c
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/arch.h>
+#include "up_internal.h"
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+static void _up_putc(int ch) __naked
+{
+#if 1
+ ch; /* To avoid unreferenced argument warning */
+ _asm
+ mov a, dpl
+ ljmp PM2_ENTRY_COUT
+ _endasm;
+#else
+ ch; /* To avoid unreferenced argument warning */
+ _asm
+ mov a, dpl
+cout: jnb ti, cout
+ clr ti
+ mov sbuf, a
+ ret
+ _endasm;
+#endif
+}
+
+/************************************************************************
+ * Public Functions
+ ************************************************************************/
+
+int up_putc(int ch)
+{
+ _up_putc(ch);
+ if (ch == '\n')
+ {
+ _up_putc('\r');
+ }
+ return ch;
+}
+
diff --git a/misc/Obsoleted/arch/8051/src/up_releasepending.c b/misc/Obsoleted/arch/8051/src/up_releasepending.c
new file mode 100644
index 000000000..ebb5271a6
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_releasepending.c
@@ -0,0 +1,135 @@
+/************************************************************************
+ * up_releasepending.c
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+/************************************************************************
+ * Included Files
+ ************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sched.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include "sched/sched.h"
+#include "up_internal.h"
+
+/************************************************************************
+ * Private Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+/************************************************************************
+ * Private Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_release_pending
+ *
+ * Description:
+ * Release and ready-to-run tasks that have
+ * collected in the pending task list. This can call a
+ * context switch if a new task is placed at the head of
+ * the ready to run list.
+ *
+ ************************************************************************/
+
+void up_release_pending(void)
+{
+ FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
+
+ dbg("From TCB=%p\n", rtcb);
+
+ /* Merge the g_pendingtasks list into the g_readytorun task list */
+
+ /* sched_lock(); */
+ if (sched_mergepending())
+ {
+ /* The currently active task has changed! We will need to
+ * switch contexts. First check if we are operating in
+ * interrupt context:
+ */
+
+ if (g_irqtos)
+ {
+ /* Yes, then we have to do things differently.
+ * Just copy the current registers into the OLD rtcb.
+ */
+
+ up_saveirqcontext(&rtcb->xcp);
+
+ /* Restore the exception context of the rtcb at the (new) head
+ * of the g_readytorun task list.
+ */
+
+ rtcb = (FAR struct tcb_s*)g_readytorun.head;
+ dbg("New Active Task TCB=%p\n", rtcb);
+
+ /* Then setup so that the context will be performed on exit
+ * from the interrupt.
+ */
+
+ g_irqcontext = &rtcb->xcp;
+ }
+
+ /* Copy the exception context into the TCB of the task that
+ * was currently active. if up_savecontext returns a non-zero
+ * value, then this is really the previously running task
+ * restarting!
+ */
+
+ else if (!up_savecontext(&rtcb->xcp))
+ {
+ /* Restore the exception context of the rtcb at the (new) head
+ * of the g_readytorun task list.
+ */
+
+ rtcb = (FAR struct tcb_s*)g_readytorun.head;
+ dbg("New Active Task TCB=%p\n", rtcb);
+
+ /* Then switch contexts */
+
+ up_restorecontext(&rtcb->xcp);
+ }
+ }
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_reprioritizertr.c b/misc/Obsoleted/arch/8051/src/up_reprioritizertr.c
new file mode 100644
index 000000000..7f28c711b
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_reprioritizertr.c
@@ -0,0 +1,190 @@
+/****************************************************************************
+ * up_reprioritizertr.c
+ *
+ * Copyright (C) 2007, 2009, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * 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 <sched.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include "sched/sched.h"
+#include "up_internal.h"
+
+/****************************************************************************
+ * Private Definitions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Funtions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Funtions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_reprioritize_rtr
+ *
+ * Description:
+ * Called when the priority of a running or
+ * ready-to-run task changes and the reprioritization will
+ * cause a context switch. Two cases:
+ *
+ * 1) The priority of the currently running task drops and the next
+ * task in the ready to run list has priority.
+ * 2) An idle, ready to run task's priority has been raised above the
+ * the priority of the current, running task and it now has the
+ * priority.
+ *
+ * Inputs:
+ * tcb: The TCB of the task that has been reprioritized
+ * priority: The new task priority
+ *
+ ****************************************************************************/
+
+void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority)
+{
+ /* Verify that the caller is sane */
+
+ if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
+ tcb->task_state > LAST_READY_TO_RUN_STATE
+#if SCHED_PRIORITY_MIN > 0
+ || priority < SCHED_PRIORITY_MIN
+#endif
+#if SCHED_PRIORITY_MAX < UINT8_MAX
+ || priority > SCHED_PRIORITY_MAX
+#endif
+ )
+ {
+ PANIC();
+ }
+ else
+ {
+ FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
+ bool switch_needed;
+
+ dbg("TCB=%p PRI=%d\n", tcb, priority);
+
+ /* Remove the tcb task from the ready-to-run list.
+ * sched_removereadytorun will return true if we just
+ * remove the head of the ready to run list.
+ */
+
+ switch_needed = sched_removereadytorun(tcb);
+
+ /* Setup up the new task priority */
+
+ tcb->sched_priority = (uint8_t)priority;
+
+ /* Return the task to the specified blocked task list.
+ * sched_addreadytorun will return true if the task was
+ * added to the new list. We will need to perform a context
+ * switch only if the EXCLUSIVE or of the two calls is non-zero
+ * (i.e., one and only one the calls changes the head of the
+ * ready-to-run list).
+ */
+
+ switch_needed ^= sched_addreadytorun(tcb);
+
+ /* Now, perform the context switch if one is needed */
+
+ if (switch_needed)
+ {
+ /* If we are going to do a context switch, then now is the right
+ * time to add any pending tasks back into the ready-to-run list.
+ * task list now
+ */
+
+ if (g_pendingtasks.head)
+ {
+ sched_mergepending();
+ }
+
+ /* Are we in an interrupt handler? */
+
+ if (g_irqtos)
+ {
+ /* Yes, then we have to do things differently.
+ * Just copy the current registers into the OLD rtcb.
+ */
+
+ up_saveirqcontext(&tcb->xcp);
+
+ /* Restore the exception context of the rtcb at the (new) head
+ * of the g_readytorun task list.
+ */
+
+ rtcb = (FAR struct tcb_s*)g_readytorun.head;
+ dbg("New Active Task TCB=%p\n", rtcb);
+
+ /* Then setup so that the context will be performed on exit
+ * from the interrupt.
+ */
+
+ g_irqcontext = &tcb->xcp;
+ }
+
+ /* Copy the exception context into the TCB at the (old) head of the
+ * g_readytorun Task list. if up_savecontext returns a non-zero
+ * value, then this is really the previously running task restarting!
+ */
+
+ else if (!up_savecontext(&rtcb->xcp))
+ {
+ /* Restore the exception context of the rtcb at the (new) head
+ * of the g_readytorun task list.
+ */
+
+ rtcb = (FAR struct tcb_s*)g_readytorun.head;
+ dbg("New Active Task TCB=%p\n", rtcb);
+
+ /* Then switch contexts */
+
+ up_restorecontext(&rtcb->xcp);
+ }
+ }
+ }
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_restorecontext.c b/misc/Obsoleted/arch/8051/src/up_restorecontext.c
new file mode 100644
index 000000000..6966866ee
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_restorecontext.c
@@ -0,0 +1,296 @@
+/**************************************************************************
+ * up_restorecontext.c
+ *
+ * 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.
+ *
+ **************************************************************************/
+
+/**************************************************************************
+ * Included Files
+ **************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+#include <nuttx/irq.h>
+#include "up_internal.h"
+
+/**************************************************************************
+ * Private Definitions
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Types
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Function Prototypes
+ **************************************************************************/
+
+/**************************************************************************
+ * Global Variables
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Variables
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Functions
+ **************************************************************************/
+
+/**************************************************************************
+ * Public Functions
+ **************************************************************************/
+
+/**************************************************************************
+ * Name: up_restoreregisters
+ *
+ * Description:
+ * Restore the saved registers from the context save area. This function
+ * is called from up_restorecontext (below) and also from interrupt
+ * handling logic.
+ *
+ * Note that this function does not restore:
+ * a, dptr, ie - these are saved in the stack area
+ * sp - this can be inferred from g_irqtos or struct xcptontext.nbytes.
+ *
+ * Inputs:
+ * context - the context register array from which to restore the
+ * register values
+ *
+ * Return:
+ * None
+ *
+ **************************************************************************/
+
+void up_restoreregisters(FAR uint8_t *regs) _naked
+{
+ _asm
+ movx a, @dptr
+ mov b, a
+ inc dptr
+ movx a, @dptr
+ mov r2, a
+ inc dptr
+ movx a, @dptr
+ mov r3, a
+ inc dptr
+ movx a, @dptr
+ mov r4, a
+ inc dptr
+ movx a, @dptr
+ mov r5, a
+ inc dptr
+ movx a, @dptr
+ mov r6, a
+ inc dptr
+ movx a, @dptr
+ mov r7, a
+ inc dptr
+ movx a, @dptr
+ mov r0, a
+ inc dptr
+ movx a, @dptr
+ mov r1, a
+ inc dptr
+ movx a, @dptr
+ mov psw, a
+ inc dptr
+ movx a, @dptr
+ mov _bp, a
+ ret
+ _endasm;
+}
+
+/**************************************************************************
+ * Name: up_restorecontext
+ *
+ * Description:
+ * Restore the stack specified in the context structure and return to
+ * that context
+ *
+ * Inputs:
+ * context - Holds the stack content of the context to return to
+ *
+ * Return:
+ * This function does not return.
+ *
+ **************************************************************************/
+
+void up_restorecontext(FAR struct xcptcontext *context) __naked
+{
+ _asm
+ ar2 = 0x02
+ ar3 = 0x03
+ ar4 = 0x04
+ ar5 = 0x05
+ ar6 = 0x06
+ ar7 = 0x07
+ ar0 = 0x00
+ ar1 = 0x01
+
+ /* Dump the contents of the saved frame before it is copied back
+ * to memory/registers.
+ */
+
+#ifdef CONFIG_SWITCH_FRAME_DUMP
+ push dpl
+ push dph
+ lcall _up_dumpframe
+ pop dph
+ pop dpl
+#endif
+
+ /* Interrupts should be disabled for the following. up_popcontext() will
+ * set the new interrupt state correctly.
+ */
+
+ clr ea
+
+ /* The following logic will copy the stack from the
+ * context save structure into IRAM. We cannot use
+ * the stack in anyway during this copy. Instead,
+ * we will use registers as follows:
+ *
+ * R0 - Holds the working 8-bit IRAM pointer
+ * R1 - Not used
+ * R2-3 - Holds the working 16-bit XRAM pointer
+ * R4 - Holds the working byte count
+ * R5 - Holds the new stack pointer
+ * R6-7 - Saved context pointer
+ */
+
+ /* Fetch r4 = context->nbytes */
+
+ movx a, @dptr
+ mov r4, a
+
+ /* Save the new stack pointer in r5 */
+
+ add a, #(STACK_BASE-1)
+ mov r5, a
+
+ /* Save r2-3 and r6-r7 = &context->stack */
+
+ inc dptr
+ mov r2, dpl
+ mov r3, dph
+ mov r6, dpl
+ mov r7, dph
+
+ /* Set r0 = stack base address */
+
+ mov r0, #STACK_BASE
+
+ /* Top of the copy loop -- we cannot use the stack
+ * again until we finish the copy and set the new
+ * stack pointer (saved in r5)
+ */
+00001$:
+ mov a, r4 /* a = bytes left to transfer */
+ dec r4 /* (for next time through the loop) */
+ jz 00002$ /* Jump if a = 0 (done) */
+
+ /* Fetch the next byte from context->stack */
+
+ mov dpl, r2
+ mov dph, r3
+ movx a, @dptr
+
+ /* Increment the XRAM pointer */
+
+ inc dptr
+ mov r2, dpl
+ mov r3, dph
+
+ /* Save the next byte into IRAM */
+
+ mov @r0, a
+
+ /* Increment the IRAM pointer */
+
+ inc r0
+ sjmp 00001$
+00002$:
+
+ /* Set the new stack pointer and recover the
+ * context->stack pointer.
+ */
+
+ mov sp, r5
+ mov dpl, r6
+ mov dph, r7
+
+ /* Dump the stack contents after they have
+ * been restored to IRAM
+ */
+
+#ifdef CONFIG_SWITCH_FRAME_DUMP
+ push dpl
+ push dph
+ lcall _up_dumpstack
+ pop dph
+ pop dpl
+#endif
+ /* Get the pointer to the register save area */
+
+ mov a, #STACK_SIZE
+ add a, dpl
+ mov dpl, a
+ clr a
+ addc a, dph
+ mov dph, a
+
+ /* Restore registers from the register save area */
+
+ lcall _up_restoreregisters
+
+ /* Restore registers from the new stack */
+
+ pop dph
+ pop dpl
+
+ /* Restore the interrupt state per the stored IE value */
+
+ pop acc
+ jb acc.7,00003$
+ clr ie.7
+ sjmp 00004$
+ 00003$:
+ setb ie.7
+
+ 00004$:
+ pop acc
+ ret
+ _endasm;
+}
+
+
diff --git a/misc/Obsoleted/arch/8051/src/up_savecontext.c b/misc/Obsoleted/arch/8051/src/up_savecontext.c
new file mode 100644
index 000000000..c5d0ae1c7
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_savecontext.c
@@ -0,0 +1,362 @@
+/**************************************************************************
+ * up_savecontext.c
+ *
+ * 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.
+ *
+ **************************************************************************/
+
+/**************************************************************************
+ * Included Files
+ **************************************************************************/
+
+#include <nuttx/config.h>
+#include <stdint.h>
+#include <nuttx/irq.h>
+#include "up_internal.h"
+
+/**************************************************************************
+ * Private Definitions
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Types
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Function Prototypes
+ **************************************************************************/
+
+/**************************************************************************
+ * Global Variables
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Variables
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Functions
+ **************************************************************************/
+
+/**************************************************************************
+ * Name: up_savestack
+ *
+ * Description:
+ * Save the entire interrupt stack contents in the provided context
+ * structure.
+ *
+ * Inputs:
+ * context - the context structure in which to save the stack info
+ *
+ * Return:
+ * None
+ *
+ * Assumptions:
+ * - Interrupts are disabled
+ *
+ **************************************************************************/
+
+static void up_savestack(FAR struct xcptcontext *context, uint8_t tos)
+{
+ /* Copy the current stack frame from internal RAM to XRAM. */
+
+ uint8_t nbytes = tos - (STACK_BASE-1);
+ NEAR uint8_t *src = (NEAR uint8_t*)STACK_BASE;
+ FAR uint8_t *dest = context->stack;
+
+ context->nbytes = nbytes;
+ while (nbytes--)
+ {
+ *dest++ = *src++;
+ }
+}
+
+/**************************************************************************
+ * Name: up_saveregs
+ *
+ * Description:
+ * Save the interrupt registers into the TCB.
+ *
+ * Inputs:
+ * context - the context structure in which to save the register info
+ *
+ * Return:
+ * None
+ *
+ * Assumptions:
+ * - Interrupts are disabled
+ *
+ **************************************************************************/
+
+static void up_saveregs(FAR struct xcptcontext *context, uint8_t tos)
+{
+ /* Copy the irq register save area into the TCB */
+
+ FAR uint8_t *src = g_irqregs;
+ FAR uint8_t *dest = context->regs;
+ uint8_t nbytes = REGS_SIZE;
+
+ while (nbytes--)
+ {
+ *dest++ = *src++;
+ }
+}
+
+/**************************************************************************
+ * Public Functions
+ **************************************************************************/
+
+/**************************************************************************
+ * Name: up_saveregisters
+ *
+ * Description:
+ * Save the current registers in the context save area. This function
+ * is called from up_savecontext (below) and also from interrupt
+ * handling logic.
+ *
+ * Note that this function does not save:
+ * a, dptr, ie - these are saved in the stack area
+ * sp - this can be inferred from g_irqtos or struct xcptontext.nbytes.
+ *
+ * Inputs:
+ * regs - the context register array in which to save the register info
+ *
+ * Return:
+ * None
+ *
+ **************************************************************************/
+
+void up_saveregisters(FAR uint8_t *regs) _naked
+{
+ _asm
+ mov a, b
+ movx @dptr, a
+ inc dptr
+ mov a, r2
+ movx @dptr, a
+ inc dptr
+ mov a, r3
+ movx @dptr, a
+ inc dptr
+ mov a, r4
+ movx @dptr, a
+ inc dptr
+ mov a, r5
+ movx @dptr, a
+ inc dptr
+ mov a, r6
+ movx @dptr, a
+ inc dptr
+ mov a, r7
+ movx @dptr, a
+ inc dptr
+ mov a, r0
+ movx @dptr, a
+ inc dptr
+ mov a, r1
+ movx @dptr, a
+ inc dptr
+ mov a, psw
+ movx @dptr, a
+ clr psw
+ inc dptr
+ mov a, _bp
+ movx @dptr, a
+ ret
+ _endasm;
+}
+
+/**************************************************************************
+ * Name: up_savecontext
+ *
+ * Description:
+ * Push the current execution context onto the stack, then save the
+ * entire stack contents in the provided context structure.
+ *
+ * Inputs:
+ * context - the context structure in which to save the stack info
+ *
+ * Return:
+ * 0 = Normal state save return
+ * 1 = This is the matching return from up_restorecontext()
+ *
+ **************************************************************************/
+
+uint8_t up_savecontext(FAR struct xcptcontext *context) _naked
+{
+ _asm
+ /* Create the stack frame that we want when it is time to restore
+ * this context. The return address will be the return address
+ * of this function, the return value will be zero.
+ *
+ * ...
+ * return address (2 bytes, already on the stack)
+ * register a=0 (1 byte)
+ * register ie (1 byte)
+ * register dptr (2 bytes)
+ */
+
+ clr a
+ push acc /* ACC = 0 */
+ push ie
+ mov a, #1
+ push acc /* DPL = 1 */
+ clr a
+ push acc /* DPH = 0 */
+
+ /* Dump the stack contents before they are occupied into XRAM */
+
+#ifdef CONFIG_SWITCH_FRAME_DUMP
+ push dpl
+ push dph
+ lcall _up_dumpstack
+ pop dph
+ pop dpl
+#endif
+ /* Disable interrupts while we create a snapshot of the stack
+ * and registers. At this point, we have 5 bytes on the stack
+ * to account for.
+ */
+
+ push ie
+ mov ea, 0
+
+ /* Save the registers in the context save area */
+
+ push dpl
+ push dph
+ mov a, #XCPT_REGS
+ add a, dpl
+ mov dpl, a
+ clr a
+ addc a, dph
+ mov dph, a
+ lcall _up_saveregisters
+ pop dph
+ pop dpl
+
+#ifdef CONFIG_SWITCH_FRAME_DUMP
+ /* Save the address of the context structure. We will
+ * need this later to dump the saved frame. Now we have
+ * 7 bytes on the stack to account for.
+ */
+
+ push dpl
+ push dph
+
+ /* Push the top of frame stack pointer. We need to
+ * decrement the current SP value by three to account
+ * for dptr+IE on the stack above the end of the frame.
+ */
+
+ mov a, sp
+ subb a, #3
+#else
+ /* Push the top of frame stack pointer. We need to
+ * decrement the current stack pointer by one to account
+ * for IE that we saved on the stack.
+ */
+
+ mov a, sp
+ dec a
+#endif
+ push acc
+
+ /* Copy the current stack frame from internal RAM to XRAM. */
+
+ lcall _up_savestack
+ pop acc
+
+ /* Dump the contents of the saved frame after it has been
+ * copied from memory/registers.
+ */
+
+#ifdef CONFIG_SWITCH_FRAME_DUMP
+ pop dph
+ pop dpl
+ push dpl
+ push dph
+ lcall _up_dumpframe
+ pop dph
+ pop dpl
+ lcall _up_dumpstack
+#endif
+
+ /* Restore the interrupt state */
+
+ pop ie
+
+ /* Now that we have a snapshot of the desired stack frame saved,
+ * we can release the stack frame (all but the return address)
+ */
+
+ mov a, sp
+ subb a, #4
+ mov sp, a
+ mov dpl,#0
+ ret
+ _endasm;
+}
+
+/**************************************************************************
+ * Name: up_saveirqcontext
+ *
+ * Description:
+ * The interrupt context was saved in g_irqtos and g_irqregs when the
+ * interrupt was taken. If a context switch from the interrupted task
+ * will be made at the interrupt level, then these saved values must be
+ * copied into the TCB.
+ *
+ * Inputs:
+ * context - the structure in which to save the context info
+ *
+ * Return:
+ * None
+ *
+ * Assumptions:
+ * - Interrupts are disabled
+ *
+ **************************************************************************/
+
+void up_saveirqcontext(FAR struct xcptcontext *context)
+{
+ /* Save the number of bytes in the stack */
+
+ context->nbytes = g_irqtos - (STACK_BASE-1);
+
+ /* Copy the current stack frame from internal RAM to XRAM. */
+
+ up_savestack(context, g_irqtos);
+
+ /* Copy the saved registers into the TCB */
+
+ up_saveregisters(context->regs);
+}
diff --git a/misc/Obsoleted/arch/8051/src/up_timerisr.c b/misc/Obsoleted/arch/8051/src/up_timerisr.c
new file mode 100644
index 000000000..7abe5d2fe
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_timerisr.c
@@ -0,0 +1,147 @@
+/************************************************************************
+ * arch/8051/src/up_timerisr.c
+ *
+ * Copyright (C) 2007, 2009, 2014 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 <debug.h>
+
+#include <nuttx/arch.h>
+#include <8052.h>
+
+#include "clock/clock.h"
+#include "up_internal.h"
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Private Types
+ ************************************************************************/
+
+/************************************************************************
+ * Private Function Prototypes
+ ************************************************************************/
+
+/************************************************************************
+ * Global Functions
+ ************************************************************************/
+
+/************************************************************************
+ * Function: up_timerisr
+ *
+ * Description:
+ * The timer ISR will perform a variety of services for
+ * various portions of the systems.
+ *
+ ************************************************************************/
+
+int up_timerisr(int irq, FAR uint8_t *frame)
+{
+ /* Process timer interrupt */
+
+ sched_process_timer();
+ return 0;
+}
+
+/************************************************************************
+ * Function: up_timer_initialize
+ *
+ * Description:
+ * This function is called during start-up to initialize
+ * the timer interrupt.
+ *
+ ************************************************************************/
+
+void up_timer_initialize(void)
+{
+#ifdef CONFIG_ARCH_8051_NOSYSTIMER
+ up_disable_irq(TIMER2_IRQ);
+
+ /* Set up timer 2 -- See pjrc.h for details */
+
+ T2MOD = 0;
+
+ /* Set up the capture count to generate 100Hz system
+ * interrupts.
+ */
+
+ RCAP2L = TIMER2_CAPTURE_LOW;
+ RCAP2H = TIMER2_CAPTURE_HIGH;
+
+ TL2 = TIMER2_CAPTURE_LOW;
+ TH2 = TIMER2_CAPTURE_HIGH;
+
+ /* Configure for interrupts */
+
+ T2CON = 0x04;
+
+ /* Attach and enable the timer interrupt */
+
+ irq_attach(TIMER2_IRQ, (xcpt_t)up_timerisr);
+ up_enable_irq(TIMER2_IRQ);
+
+#else
+ /* Timer 0, mode 0 can be used as a system timer. In that mode, the
+ * 1.8432 MHz clock is divided by 32. A single 8-bit value is incremented
+ * at 57600 Hz, which results in 225 Timer 0 overflow interrupts per
+ * second.
+ */
+
+ up_disable_irq(TIMER0_IRQ);
+
+ /* Initialize timer 0 */
+
+ TR0 = 0; /* Make sure timer 0 is stopped */
+ TF0 = 0; /* Clear the overflow flag */
+ TMOD &= 0xF0; /* Set to mode 0 (without changing timer1) */
+ TL0 = 0; /* Clear timer 0 value */
+ TH0 = 0;
+
+ /* Attach and enable the timer interrupt */
+
+ irq_attach(TIMER0_IRQ, (xcpt_t)up_timerisr);
+
+ TR0 = 1; /* Start the timer */
+ up_enable_irq(TIMER0_IRQ);
+
+#endif
+}
+
diff --git a/misc/Obsoleted/arch/8051/src/up_unblocktask.c b/misc/Obsoleted/arch/8051/src/up_unblocktask.c
new file mode 100644
index 000000000..36d6ed1ef
--- /dev/null
+++ b/misc/Obsoleted/arch/8051/src/up_unblocktask.c
@@ -0,0 +1,161 @@
+/************************************************************************
+ * up_unblocktask.c
+ *
+ * Copyright (C) 2007, 2009, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * 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 <sched.h>
+#include <debug.h>
+
+#include <nuttx/arch.h>
+
+#include "clock/clock.h"
+#include "sched/sched.h"
+#include "up_internal.h"
+
+/************************************************************************
+ * Private Definitions
+ ************************************************************************/
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+/************************************************************************
+ * Private Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Public Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: up_unblock_task
+ *
+ * Description:
+ * A task is currently in an inactive task list
+ * but has been prepped to execute. Move the TCB to the
+ * ready-to-run list, restore its context, and start execution.
+ *
+ * Inputs:
+ * tcb: Refers to the tcb to be unblocked. This tcb is
+ * in one of the waiting tasks lists. It must be moved to
+ * the ready-to-run list and, if it is the highest priority
+ * ready to run taks, executed.
+ *
+ ************************************************************************/
+
+void up_unblock_task(FAR struct tcb_s *tcb)
+{
+ FAR struct tcb_s *rtcb = (FAR struct tcb_s*)g_readytorun.head;
+
+ /* Verify that the context switch can be performed */
+
+ ASSERT((tcb->task_state >= FIRST_BLOCKED_STATE) &&
+ (tcb->task_state <= LAST_BLOCKED_STATE));
+
+ dbg("Unblocking TCB=%p\n", tcb);
+
+ /* Remove the task from the blocked task list */
+
+ sched_removeblocked(tcb);
+
+ /* Reset its timeslice. This is only meaningful for round
+ * robin tasks but it doesn't here to do it for everything
+ */
+
+#if CONFIG_RR_INTERVAL > 0
+ tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
+#endif
+
+ /* Add the task in the correct location in the prioritized
+ * g_readytorun task list
+ */
+
+ if (sched_addreadytorun(tcb))
+ {
+ /* The currently active task has changed! We need to do
+ * a context switch to the new task.
+ *
+ * Are we in an interrupt handler?
+ */
+
+ if (g_irqtos)
+ {
+ /* Yes, then we have to do things differently.
+ * Just copy the current stack into the OLD rtcb.
+ */
+
+ up_saveirqcontext(&rtcb->xcp);
+
+ /* Restore the exception context of the rtcb at the (new) head
+ * of the g_readytorun task list.
+ */
+
+ rtcb = (FAR struct tcb_s*)g_readytorun.head;
+ dbg("New Active Task TCB=%p\n", rtcb);
+
+ /* Then setup so that the context will be performed on exit
+ * from the interrupt.
+ */
+
+ g_irqcontext = &rtcb->xcp;
+ }
+
+ /* We are not in an interrupt andler. Copy the user C context
+ * into the TCB of the task that was previously active. if
+ * up_savecontext returns a non-zero value, then this is really the
+ * previously running task restarting!
+ */
+
+ else if (!up_savecontext(&rtcb->xcp))
+ {
+ /* Restore the exception context of the new task that is ready to
+ * run (probably tcb). This is the new rtcb at the head of the
+ * g_readytorun task list.
+ */
+
+ rtcb = (FAR struct tcb_s*)g_readytorun.head;
+ dbg("New Active Task TCB=%p\n", rtcb);
+
+ /* Then switch contexts */
+
+ up_restorecontext(&rtcb->xcp);
+ }
+ }
+}
diff --git a/misc/Obsoleted/configs/pjrc-8051/Kconfig b/misc/Obsoleted/configs/pjrc-8051/Kconfig
new file mode 100644
index 000000000..921bc732c
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/Kconfig
@@ -0,0 +1,7 @@
+#
+# For a description of the syntax of this configuration file,
+# see misc/tools/kconfig-language.txt.
+#
+
+if ARCH_BOARD_PJRC_87C52
+endif
diff --git a/misc/Obsoleted/configs/pjrc-8051/Make.defs b/misc/Obsoleted/configs/pjrc-8051/Make.defs
new file mode 100644
index 000000000..d4716dedc
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/Make.defs
@@ -0,0 +1,170 @@
+############################################################################
+# configs/pjrc-8051/Make.defs
+#
+# Copyright (C) 2007, 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}/tools/Config.mk
+
+# These are the directories where the SDCC toolchain is installed. NOTE
+# that short 8.3 path names are used in order to avoid spaces. On my machine
+# I have:
+#
+# C:\PROGRA~1\ = C:\Profram Files\
+# C:\PROGRA~2\ = C:\Program Files (x86)\
+#
+# Your PC may be configured differently.
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ SDCC_INSTALLDIR = C:\PROGRA~2\SDCC
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)\bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)\lib\large-stack-auto
+else
+ SDCC_INSTALLDIR = /usr/local
+ SDCC_BINDIR = $(SDCC_INSTALLDIR)/bin
+ SDCC_LIBDIR = $(SDCC_INSTALLDIR)/share/sdcc/lib/large-stack-auto
+endif
+
+CROSSDEV =
+CC = sdcc
+CPP = sdcpp
+LD = sdld
+AS = sdas8051
+AR = sdar -r
+
+IRAM_SIZE = 0x100
+DEF_STACK_BASE = 0x24
+
+ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
+ ARCHOPTIMIZATION = --debug
+else
+ ARCHOPTIMIZATION =
+endif
+
+ARCHCPUFLAGS = -mmcs51 --stack-auto --model-large --int-long-reent --float-reent
+ARCHPICFLAGS =
+ARCHWARNINGS =
+ARCHDEFINES =
+ARCHINCLUDES = -I. -I$(TOPDIR)/include
+
+CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
+AFLAGS = -x -j -g -l -s -p
+
+SDCCLIB = libsdcc.lib
+
+ASMEXT = .asm
+OBJEXT = .rel
+LIBEXT = .lib
+EXEEXT = .hex
+
+# Custom ASSEMBLE definition. The most common toolchain, GCC, uses the
+# compiler to assemble files because this has the advantage of running the C
+# Pre-Processor against. This is not possible with other SDCC; we need to
+# define AS and over-ride the common definition in order to use the assembler
+# directly.
+
+define ASSEMBLE
+ @echo "AS: $1"
+ @$(AS) $(AFLAGS) $1
+endef
+
+# Custom CLEAN definition
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+define CLEAN
+ $(Q) if exist *.o (del /f /q *.o)
+ $(Q) if exist *.asm (del /f /q *.asm)
+ $(Q) if exist *.rel (del /f /q *.rel)
+ $(Q) if exist *.lst (del /f /q *.lst)
+ $(Q) if exist *.rst (del /f /q *.rst)
+ $(Q) if exist *.sym (del /f /q *.sym)
+ $(Q) if exist *.adb (del /f /q *.adb)
+ $(Q) if exist *.lnk (del /f /q *.lnk)
+ $(Q) if exist *.map (del /f /q *.map)
+ $(Q) if exist *.mem (del /f /q *.mem)
+ $(Q) if exist *.hex (del /f /q *.hex)
+ $(Q) if exist *.cmd (del /f /q *.cmd)
+endef
+else
+define CLEAN
+ $(Q) rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex *.cmd
+endef
+endif
+
+# Windows native host tool definitions
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+ HOSTCC = mingw32-gcc.exe
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+ HOSTEXEEXT = .exe
+
+ # Windows-native host tools
+
+ MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative
+
+ # Use NTFS links or directory copies
+
+ifeq ($(CONFIG_WINDOWS_MKLINK),y)
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.bat
+else
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.bat
+endif
+DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.bat
+
+else
+
+# Linux/Cygwin host tool definitions
+
+ HOSTCC = gcc
+ HOSTINCLUDES = -I.
+ HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
+ HOSTLDFLAGS =
+
+ # This is the tool to use for dependencies (i.e., none)
+
+ MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
+
+ # SDCC for Linux, OSX, or Cygwin understands symbolic links. Windows SDCC
+ # running under Cygwin does not
+
+ifeq ($(WINTOOL),y)
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.sh
+else
+ DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh
+endif
+DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
+
+endif
diff --git a/misc/Obsoleted/configs/pjrc-8051/README.txt b/misc/Obsoleted/configs/pjrc-8051/README.txt
new file mode 100644
index 000000000..1343ec9db
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/README.txt
@@ -0,0 +1,54 @@
+pjrc-8051 README
+^^^^^^^^^^^^^^^^
+
+This port uses the PJRC 87C52 development system and the SDCC toolchain.
+
+The PJRC 87C52 development system can be obtained from http://www.pjrc.com/.
+
+The SDCC toolchain is available from http://sdcc.sourceforge.net/. All
+testing has been performed using verison 2.6.0 of the SDDC toolchain.
+
+Building the SDCC toolchain
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The SDCC toolchain is built with the standard configure/make/make install
+sequence. However, some special actions are required to generate libraries
+compatible with this build. First start with the usual steps
+
+ download
+ unpack
+ cd sdcc
+ ./configure
+ make
+
+But before installing, we need to apply a patch to the SDCC 2.6.0 source.
+WARNING: This patch is specific to the particular combination of CFLAGS
+that are used in the compilation. If you change Make.defs, then you will
+likely have to change the patch as well.
+
+ Apply sdcc-2.6.0.patch
+ cd sdcc/device/lib
+ make model-mcs51-stack-auto
+
+Then
+
+ cd sdcc
+ make install
+
+Status
+^^^^^^
+
+On December 9, 2012, I made updates so that the 8051 port could use the
+newest SDCC toolchain (a pre-3.2.1 at that time). However, when I attempted
+to build the PJRC-8051 configuration, I got type incompatibility errors
+from sched/os_bringup.c. From what I gather by googling, this is a compiler
+bug related to the --stack-auto option.
+
+I have not been successful working around those bugs and I believe that
+these are 8051-related bugs in the SDCC toolchain. This needs to be
+revisited with a later version of SDCC.
+
+This configuration was last successfully built and tested with a ca.
+2.6.0 SDCC release. Support for that older toolchain was removed in
+NuttX revision -r5423. If you wanted to used those older toolchains,
+you would need to revert to a pre-r5423 revision.
diff --git a/misc/Obsoleted/configs/pjrc-8051/defconfig b/misc/Obsoleted/configs/pjrc-8051/defconfig
new file mode 100644
index 000000000..68a3a68ea
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/defconfig
@@ -0,0 +1,577 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Nuttx/ Configuration
+#
+
+#
+# Build Setup
+#
+# CONFIG_EXPERIMENTAL is not set
+CONFIG_DEFAULT_SMALL=y
+CONFIG_HOST_LINUX=y
+# CONFIG_HOST_OSX is not set
+# CONFIG_HOST_WINDOWS is not set
+# CONFIG_HOST_OTHER is not set
+
+#
+# Build Configuration
+#
+# CONFIG_APPS_DIR="../apps"
+# CONFIG_BUILD_2PASS is not set
+
+#
+# Binary Output Formats
+#
+# CONFIG_RRLOAD_BINARY is not set
+# CONFIG_INTELHEX_BINARY is not set
+# CONFIG_MOTOROLA_SREC is not set
+# CONFIG_RAW_BINARY is not set
+
+#
+# Customize Header Files
+#
+# CONFIG_ARCH_STDBOOL_H is not set
+# CONFIG_ARCH_MATH_H is not set
+# CONFIG_ARCH_FLOAT_H is not set
+# CONFIG_ARCH_STDARG_H is not set
+
+#
+# Debug Options
+#
+# CONFIG_DEBUG is not set
+# CONFIG_ARCH_HAVE_STACKCHECK is not set
+# CONFIG_ARCH_HAVE_HEAPCHECK is not set
+# CONFIG_DEBUG_SYMBOLS is not set
+# CONFIG_ARCH_HAVE_CUSTOMOPT is not set
+# CONFIG_DEBUG_NOOPT is not set
+CONFIG_DEBUG_FULLOPT=y
+
+#
+# System Type
+#
+CONFIG_ARCH_8051=y
+# CONFIG_ARCH_ARM is not set
+# CONFIG_ARCH_AVR is not set
+# CONFIG_ARCH_HC is not set
+# CONFIG_ARCH_MIPS is not set
+# CONFIG_ARCH_RGMP is not set
+# CONFIG_ARCH_SH is not set
+# CONFIG_ARCH_SIM is not set
+# CONFIG_ARCH_X86 is not set
+# CONFIG_ARCH_Z16 is not set
+# CONFIG_ARCH_Z80 is not set
+CONFIG_ARCH="8051"
+
+#
+# ARM Options
+#
+# CONFIG_ARCH_CHIP_8051 is not set
+CONFIG_ARCH_CHIP_8052=y
+
+#
+# Bring-up Debug Options
+#
+CONFIG_ARCH_8051_BRINGUP=y
+CONFIG_ARCH_8051_NOSYSTIMER=y
+CONFIG_ARCH_8051_SUPRESS_INTERRUPTS=y
+
+#
+# Architecture Options
+#
+# CONFIG_ARCH_NOINTC is not set
+# CONFIG_ARCH_VECNOTIRQ is not set
+# CONFIG_ARCH_DMA is not set
+# CONFIG_ARCH_HAVE_IRQPRIO is not set
+CONFIG_CUSTOM_STACK=y
+# CONFIG_ARCH_ADDRENV is not set
+# CONFIG_ARCH_HAVE_VFORK is not set
+# CONFIG_ARCH_HAVE_MMU is not set
+# CONFIG_ARCH_NAND_HWECC is not set
+# CONFIG_ARCH_STACKDUMP is not set
+# CONFIG_ENDIAN_BIG is not set
+# CONFIG_ARCH_IDLE_CUSTOM is not set
+# CONFIG_ARCH_HAVE_RAMFUNCS is not set
+# CONFIG_ARCH_HAVE_RAMVECTORS is not set
+
+#
+# Board Settings
+#
+CONFIG_BOARD_LOOPSPERMSEC=5000
+# CONFIG_ARCH_CALIBRATION is not set
+
+#
+# Interrupt options
+#
+# CONFIG_ARCH_HAVE_INTERRUPTSTACK is not set
+# CONFIG_ARCH_HAVE_HIPRI_INTERRUPT is not set
+
+#
+# Boot options
+#
+# CONFIG_BOOT_RUNFROMEXTSRAM is not set
+CONFIG_BOOT_RUNFROMFLASH=y
+# CONFIG_BOOT_RUNFROMISRAM is not set
+# CONFIG_BOOT_RUNFROMSDRAM is not set
+# CONFIG_BOOT_COPYTORAM is not set
+
+#
+# Boot Memory Configuration
+#
+CONFIG_RAM_START=0x0
+CONFIG_RAM_SIZE=0
+# CONFIG_ARCH_HAVE_SDRAM is not set
+
+#
+# Board Selection
+#
+CONFIG_ARCH_BOARD_PJRC_87C52=y
+# CONFIG_ARCH_BOARD_CUSTOM is not set
+CONFIG_ARCH_BOARD="pjrc-8051"
+
+#
+# Common Board Options
+#
+CONFIG_ARCH_HAVE_LEDS=y
+CONFIG_ARCH_LEDS=y
+
+#
+# Board-Specific Options
+#
+
+#
+# RTOS Features
+#
+# CONFIG_BOARD_INITIALIZE is not set
+CONFIG_USEC_PER_TICK=10000
+# CONFIG_SYSTEM_TIME64 is not set
+CONFIG_RR_INTERVAL=0
+# CONFIG_SCHED_CPULOAD is not set
+# CONFIG_SCHED_INSTRUMENTATION is not set
+CONFIG_TASK_NAME_SIZE=0
+# CONFIG_SCHED_HAVE_PARENT is not set
+# CONFIG_JULIAN_TIME is not set
+CONFIG_START_YEAR=2007
+CONFIG_START_MONTH=2
+CONFIG_START_DAY=21
+# CONFIG_DEV_CONSOLE is not set
+# CONFIG_MUTEX_TYPES is not set
+# CONFIG_PRIORITY_INHERITANCE is not set
+# CONFIG_FDCLONE_DISABLE is not set
+# CONFIG_FDCLONE_STDIO is not set
+CONFIG_SDCLONE_DISABLE=y
+# CONFIG_SCHED_WAITPID is not set
+# CONFIG_SCHED_STARTHOOK is not set
+# CONFIG_SCHED_ATEXIT is not set
+# CONFIG_SCHED_ONEXIT is not set
+CONFIG_USER_ENTRYPOINT="ostest_main"
+CONFIG_DISABLE_OS_API=y
+CONFIG_DISABLE_POSIX_TIMERS=y
+CONFIG_DISABLE_PTHREAD=y
+CONFIG_DISABLE_SIGNALS=y
+CONFIG_DISABLE_MQUEUE=y
+CONFIG_DISABLE_ENVIRON=y
+
+#
+# Sizes of configurable things (0 disables)
+#
+CONFIG_MAX_TASKS=8
+CONFIG_MAX_TASK_ARGS=4
+CONFIG_NPTHREAD_KEYS=0
+CONFIG_NFILE_DESCRIPTORS=0
+CONFIG_NFILE_STREAMS=0
+CONFIG_NAME_MAX=32
+CONFIG_PREALLOC_MQ_MSGS=0
+CONFIG_MQ_MAXMSGSIZE=0
+CONFIG_MAX_WDOGPARMS=2
+CONFIG_PREALLOC_WDOGS=4
+CONFIG_PREALLOC_TIMERS=0
+
+#
+# Stack and heap information
+#
+CONFIG_IDLETHREAD_STACKSIZE=256
+CONFIG_USERMAIN_STACKSIZE=256
+CONFIG_PTHREAD_STACK_MIN=256
+CONFIG_PTHREAD_STACK_DEFAULT=256
+
+#
+# Device Drivers
+#
+CONFIG_DISABLE_POLL=y
+CONFIG_DEV_NULL=y
+# CONFIG_DEV_ZERO is not set
+# CONFIG_LOOP is not set
+# CONFIG_RAMDISK is not set
+# CONFIG_CAN is not set
+# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set
+# CONFIG_PWM is not set
+# CONFIG_ARCH_HAVE_I2CRESET is not set
+# CONFIG_I2C is not set
+# CONFIG_SPI is not set
+# CONFIG_I2S is not set
+# CONFIG_RTC is not set
+# CONFIG_WATCHDOG is not set
+# CONFIG_ANALOG is not set
+# CONFIG_AUDIO_DEVICES is not set
+# CONFIG_VIDEO_DEVICES is not set
+# CONFIG_BCH is not set
+# CONFIG_INPUT is not set
+# CONFIG_LCD is not set
+# CONFIG_MMCSD is not set
+# CONFIG_MTD is not set
+# CONFIG_PIPES is not set
+# CONFIG_PM is not set
+# CONFIG_POWER is not set
+# CONFIG_SENSORS is not set
+# CONFIG_SERCOMM_CONSOLE is not set
+CONFIG_SERIAL=y
+# CONFIG_DEV_LOWCONSOLE is not set
+# CONFIG_16550_UART is not set
+# CONFIG_ARCH_HAVE_UART is not set
+# CONFIG_ARCH_HAVE_UART0 is not set
+# CONFIG_ARCH_HAVE_UART1 is not set
+# CONFIG_ARCH_HAVE_UART2 is not set
+# CONFIG_ARCH_HAVE_UART3 is not set
+# CONFIG_ARCH_HAVE_UART4 is not set
+# CONFIG_ARCH_HAVE_UART5 is not set
+# CONFIG_ARCH_HAVE_UART6 is not set
+# CONFIG_ARCH_HAVE_UART7 is not set
+# CONFIG_ARCH_HAVE_UART8 is not set
+# CONFIG_ARCH_HAVE_SCI0 is not set
+# CONFIG_ARCH_HAVE_SCI1 is not set
+# CONFIG_ARCH_HAVE_USART0 is not set
+# CONFIG_ARCH_HAVE_USART1 is not set
+# CONFIG_ARCH_HAVE_USART2 is not set
+# CONFIG_ARCH_HAVE_USART3 is not set
+# CONFIG_ARCH_HAVE_USART4 is not set
+# CONFIG_ARCH_HAVE_USART5 is not set
+# CONFIG_ARCH_HAVE_USART6 is not set
+# CONFIG_ARCH_HAVE_USART7 is not set
+# CONFIG_ARCH_HAVE_USART8 is not set
+
+#
+# USART Configuration
+#
+# CONFIG_MCU_SERIAL is not set
+# CONFIG_STANDARD_SERIAL is not set
+# CONFIG_SERIAL_IFLOWCONTROL is not set
+# CONFIG_SERIAL_OFLOWCONTROL is not set
+# CONFIG_USBDEV is not set
+# CONFIG_USBHOST is not set
+# CONFIG_WIRELESS is not set
+
+#
+# System Logging Device Options
+#
+
+#
+# System Logging
+#
+# CONFIG_RAMLOG is not set
+
+#
+# Networking Support
+#
+# CONFIG_ARCH_HAVE_NET is not set
+# CONFIG_ARCH_HAVE_PHY is not set
+# CONFIG_NET is not set
+
+#
+# File Systems
+#
+
+#
+# File system configuration
+#
+CONFIG_DISABLE_MOUNTPOINT=y
+CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
+# CONFIG_FS_READABLE is not set
+# CONFIG_FS_WRITABLE is not set
+# CONFIG_FS_RAMMAP is not set
+# CONFIG_FS_PROCFS is not set
+
+#
+# System Logging
+#
+# CONFIG_SYSLOG_ENABLE is not set
+# CONFIG_SYSLOG is not set
+
+#
+# Graphics Support
+#
+# CONFIG_NX is not set
+
+#
+# Memory Management
+#
+# CONFIG_MM_SMALL is not set
+CONFIG_MM_REGIONS=2
+# CONFIG_ARCH_HAVE_HEAP2 is not set
+# CONFIG_GRAN is not set
+
+#
+# Audio Support
+#
+# CONFIG_AUDIO is not set
+
+#
+# Binary Formats
+#
+# CONFIG_BINFMT_DISABLE is not set
+# CONFIG_NXFLAT is not set
+# CONFIG_ELF is not set
+# CONFIG_BUILTIN is not set
+# CONFIG_PIC is not set
+# CONFIG_SYMTAB_ORDEREDBYNAME is not set
+
+#
+# Library Routines
+#
+
+#
+# Standard C Library Options
+#
+CONFIG_STDIO_BUFFER_SIZE=0
+CONFIG_STDIO_LINEBUFFER=y
+CONFIG_NUNGET_CHARS=0
+# CONFIG_LIBM is not set
+CONFIG_NOPRINTF_FIELDWIDTH=y
+# CONFIG_LIBC_FLOATINGPOINT is not set
+CONFIG_LIB_RAND_ORDER=1
+# CONFIG_EOL_IS_CR is not set
+# CONFIG_EOL_IS_LF is not set
+# CONFIG_EOL_IS_BOTH_CRLF is not set
+CONFIG_EOL_IS_EITHER_CRLF=y
+# CONFIG_LIBC_EXECFUNCS is not set
+CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=256
+CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=256
+# CONFIG_LIBC_STRERROR is not set
+# CONFIG_LIBC_PERROR_STDOUT is not set
+CONFIG_ARCH_LOWPUTC=y
+CONFIG_LIB_SENDFILE_BUFSIZE=512
+# CONFIG_ARCH_ROMGETC is not set
+# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set
+
+#
+# Non-standard Library Support
+#
+# CONFIG_LIB_KBDCODEC is not set
+# CONFIG_LIB_SLCDCODEC is not set
+
+#
+# Basic CXX Support
+#
+# CONFIG_C99_BOOL8 is not set
+# CONFIG_HAVE_CXX is not set
+
+#
+# Application Configuration
+#
+
+#
+# Built-In Applications
+#
+
+#
+# Examples
+#
+# CONFIG_EXAMPLES_BUTTONS is not set
+# CONFIG_EXAMPLES_CAN is not set
+# CONFIG_EXAMPLES_CONFIGDATA is not set
+# CONFIG_EXAMPLES_DHCPD is not set
+# CONFIG_EXAMPLES_ELF is not set
+# CONFIG_EXAMPLES_FTPC is not set
+# CONFIG_EXAMPLES_FTPD is not set
+# CONFIG_EXAMPLES_HELLO is not set
+# CONFIG_EXAMPLES_HELLOXX is not set
+# CONFIG_EXAMPLES_JSON is not set
+# CONFIG_EXAMPLES_HIDKBD is not set
+# CONFIG_EXAMPLES_KEYPADTEST is not set
+# CONFIG_EXAMPLES_IGMP is not set
+# CONFIG_EXAMPLES_LCDRW is not set
+# CONFIG_EXAMPLES_MM is not set
+# CONFIG_EXAMPLES_MODBUS is not set
+# CONFIG_EXAMPLES_MOUNT is not set
+# CONFIG_EXAMPLES_NRF24L01TERM is not set
+# CONFIG_EXAMPLES_NSH is not set
+# CONFIG_EXAMPLES_NULL is not set
+# CONFIG_EXAMPLES_NX is not set
+# CONFIG_EXAMPLES_NXCONSOLE is not set
+# CONFIG_EXAMPLES_NXFFS is not set
+# CONFIG_EXAMPLES_NXFLAT is not set
+# CONFIG_EXAMPLES_NXHELLO is not set
+# CONFIG_EXAMPLES_NXIMAGE is not set
+# CONFIG_EXAMPLES_NXLINES is not set
+# CONFIG_EXAMPLES_NXTEXT is not set
+CONFIG_EXAMPLES_OSTEST=y
+CONFIG_EXAMPLES_OSTEST_LOOPS=1
+CONFIG_EXAMPLES_OSTEST_STACKSIZE=256
+CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=8
+CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000
+CONFIG_EXAMPLES_OSTEST_RR_RUNS=10
+# CONFIG_EXAMPLES_PASHELLO is not set
+# CONFIG_EXAMPLES_PIPE is not set
+# CONFIG_EXAMPLES_POLL is not set
+# CONFIG_EXAMPLES_POSIXSPAWN is not set
+# CONFIG_EXAMPLES_QENCODER is not set
+# CONFIG_EXAMPLES_RGMP is not set
+# CONFIG_EXAMPLES_ROMFS is not set
+# CONFIG_EXAMPLES_SENDMAIL is not set
+# CONFIG_EXAMPLES_SERLOOP is not set
+# CONFIG_EXAMPLES_SLCD is not set
+# CONFIG_EXAMPLES_SMART is not set
+# CONFIG_EXAMPLES_TCPECHO is not set
+# CONFIG_EXAMPLES_TELNETD is not set
+# CONFIG_EXAMPLES_THTTPD is not set
+# CONFIG_EXAMPLES_TIFF is not set
+# CONFIG_EXAMPLES_TOUCHSCREEN is not set
+# CONFIG_EXAMPLES_UDP is not set
+# CONFIG_EXAMPLES_WEBSERVER is not set
+# CONFIG_EXAMPLES_USBSERIAL is not set
+# CONFIG_EXAMPLES_USBTERM is not set
+# CONFIG_EXAMPLES_WATCHDOG is not set
+
+#
+# Graphics Support
+#
+# CONFIG_TIFF is not set
+
+#
+# Interpreters
+#
+# CONFIG_INTERPRETERS_FICL is not set
+# CONFIG_INTERPRETERS_PCODE is not set
+
+#
+# Network Utilities
+#
+
+#
+# Networking Utilities
+#
+# CONFIG_NETUTILS_CODECS is not set
+# CONFIG_NETUTILS_DHCPD is not set
+# CONFIG_NETUTILS_FTPC is not set
+# CONFIG_NETUTILS_FTPD is not set
+# CONFIG_NETUTILS_JSON is not set
+# CONFIG_NETUTILS_SMTP is not set
+# CONFIG_NETUTILS_TFTPC is not set
+# CONFIG_NETUTILS_THTTPD is not set
+# CONFIG_NETUTILS_NETLIB is not set
+# CONFIG_NETUTILS_WEBCLIENT is not set
+
+#
+# FreeModBus
+#
+# CONFIG_MODBUS is not set
+
+#
+# NSH Library
+#
+# CONFIG_NSH_LIBRARY is not set
+
+#
+# NxWidgets/NxWM
+#
+
+#
+# Platform-specific Support
+#
+# CONFIG_PLATFORM_CONFIGDATA is not set
+
+#
+# System Libraries and NSH Add-Ons
+#
+
+#
+# USB CDC/ACM Device Commands
+#
+
+#
+# USB Composite Device Commands
+#
+
+#
+# Custom Free Memory Command
+#
+# CONFIG_SYSTEM_FREE is not set
+
+#
+# I2C tool
+#
+
+#
+# INI File Parser
+#
+# CONFIG_SYSTEM_INIFILE is not set
+
+#
+# FLASH Program Installation
+#
+# CONFIG_SYSTEM_INSTALL is not set
+
+#
+# FLASH Erase-all Command
+#
+
+#
+# NxPlayer media player library / command Line
+#
+# CONFIG_SYSTEM_NXPLAYER is not set
+
+#
+# RAM test
+#
+# CONFIG_SYSTEM_RAMTEST is not set
+
+#
+# readline()
+#
+# CONFIG_SYSTEM_READLINE is not set
+
+#
+# Power Off
+#
+# CONFIG_SYSTEM_POWEROFF is not set
+
+#
+# RAMTRON
+#
+# CONFIG_SYSTEM_RAMTRON is not set
+
+#
+# SD Card
+#
+# CONFIG_SYSTEM_SDCARD is not set
+
+#
+# Sysinfo
+#
+# CONFIG_SYSTEM_SYSINFO is not set
+
+#
+# USB Monitor
+#
+
+#
+# EMACS-like Command Line Editor
+#
+# CONFIG_SYSTEM_CLE is not set
+
+#
+# VI Work-Alike Editor
+#
+# CONFIG_SYSTEM_VI is not set
+
+#
+# Stack Monitor
+#
+
+#
+# USB Mass Storage Device Commands
+#
+
+#
+# Zmodem Commands
+#
+# CONFIG_SYSTEM_ZMODEM is not set
diff --git a/misc/Obsoleted/configs/pjrc-8051/include/board.h b/misc/Obsoleted/configs/pjrc-8051/include/board.h
new file mode 100644
index 000000000..9f518f81e
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/include/board.h
@@ -0,0 +1,51 @@
+/************************************************************
+ * board/board.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 __ARCH_BOARD_BOARD_H
+#define __ARCH_BOARD_BOARD_H
+
+/************************************************************
+ * Included Files
+ ************************************************************/
+
+/************************************************************
+ * Definitions
+ ************************************************************/
+
+/************************************************************
+ * Inline Functions
+ ************************************************************/
+
+#endif /* __ARCH_BOARD_BOARD_H */
diff --git a/misc/Obsoleted/configs/pjrc-8051/include/pjrc.h b/misc/Obsoleted/configs/pjrc-8051/include/pjrc.h
new file mode 100644
index 000000000..9d0d9482a
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/include/pjrc.h
@@ -0,0 +1,215 @@
+/**************************************************************************
+ * pjrc.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 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.
+ *
+ **************************************************************************/
+
+#ifndef __PJRC_H
+#define __PJRC_H
+
+/**************************************************************************
+ * Included Files
+ **************************************************************************/
+
+#include <stdint.h>
+
+/**************************************************************************
+ * Public Definitions
+ **************************************************************************/
+
+/**************************************************************************
+ * Public Types
+ **************************************************************************/
+
+/**************************************************************************
+ * Public Variables
+ **************************************************************************/
+
+/* Memory Map
+ *
+ * BEGIN END DESCRIPTION
+ * 0x0000 0x1fff CODE: ROM containg PAULMON2
+ * DATA: RAM for program variables
+ * 0x2000 0x7fff COMMON: RAM for program code or
+ * variables
+ * 0x8000 0xf7ff COMMON: FLASH for program code
+ * 0xf800 0xfeff COMMON: Peripherals
+ * 0xff00 0xffff COMMON: unused
+ *
+ * Program code may be loaded at the RAM location 0x2000-0x7fff
+ * for testing. If loaded into the FLASH location at
+ * 0x8000-0xf7ff, PAULMON2 will automatically write the program
+ * into flash. The program is configured in the RAM-based test
+ * configuration:
+ */
+
+#define RAM_BLOCK_START IRAM_SIZE
+#define RAM_BLOCK_END 0x1fff
+
+#define PROGRAM_BASE 0x2000
+#define PROGRAM_END 0x7fff
+
+#define FLASH_BASE 0x8000
+#define FLASH_END 0xf7ff
+
+/* Well-known entry points to access PAULMON2's built-in functions */
+
+#define PM2_ENTRY_PHEX1 0x002e
+#define PM2_ENTRY_COUT 0x0030
+#define PM2_ENTRY_CIN 0x0032
+#define PM2_ENTRY_PHEX 0x0034
+#define PM2_ENTRY_PHEX16 0x0036
+#define PM2_ENTRY_PSTR 0x0038
+#define PM2_ENTRY_ESC 0x003e
+#define PM2_ENTRY_UPPER 0x0040
+#define PM2_ENTRY_PINT8U 0x004D
+#define PM2_ENTRY_PINT8 0x0050
+#define PM2_ENTRY_PINT16U 0x0053
+#define PM2_ENTRY_NEWLINE 0x0048
+#define PM2_ENTRY_PRGM 0x0059
+#define PM2_ENTRY_ERBLOCK 0x0067
+
+/* PAULMON2 captures all interrupt vectors in ROM but relays them
+ * through the following RAM addresses:
+ */
+
+#define PM2_VECTOR_BASE PROGRAM_BASE
+#define PM2_VECTOR_EXTINT0 (PM2_VECTOR_BASE + 3)
+#define PM2_VECTOR_TIMER0 (PM2_VECTOR_BASE + 11)
+#define PM2_VECTOR_EXTINT1 (PM2_VECTOR_BASE + 19)
+#define PM2_VECTOR_TIMER1 (PM2_VECTOR_BASE + 27)
+#define PM2_VECTOR_UART (PM2_VECTOR_BASE + 35)
+#define PM2_VECTOR_TIMER2 (PM2_VECTOR_BASE + 43)
+
+/* Peripheral Mapping
+ *
+ * Begin End Peripheral Addr Acc Function
+ * F800 F8FF 82C55 (A, B, C) F800 R/W Port A
+ * F801 R/W Port B
+ * F802 R/W Port C
+ * F803 W Config A,B,C
+ * F900 F9FF 82C55 (D, E, F) F900 R/W Port D
+ * F901 R/W Port E (LEDs)
+ * F902 R/W Port F
+ * F903 W Config D,E,F
+ * FA00 FAFF User Expansion
+ * FB00 FBFF User Expansion
+ * FC00 FCFF User Expansion
+ * FD00 FDFF User Expansion
+ * FE00 FEFF LCD Port FE00 W Command Register
+ * FE01 R Status Register
+ * FE02 W Display or CGRAM Buffer
+ * FE03 R " " "" " " " "
+ *
+ * These are the memory-mapped locations used to access the two 82C55
+ * chips
+ */
+
+#ifndef __ASSEMBLY__
+xdata at 0xF800 uint8_t p82c55_port_a;
+xdata at 0xF801 uint8_t p82c55_port_b;
+xdata at 0xF802 uint8_t p82c55_port_c;
+xdata at 0xF803 uint8_t p82c55_abc_config;
+xdata at 0xF900 uint8_t p82c55_port_d;
+xdata at 0xF901 uint8_t p82c55_port_e;
+xdata at 0xF902 uint8_t p82c55_port_f;
+xdata at 0xF903 uint8_t p82c55_def_config;
+#endif
+
+/* LED (Port E) bit definitions */
+
+#define LED_STARTED 0
+#define LED_HEAPALLOCATE 1
+#define LED_IRQSENABLED 2
+#define LED_IDLE 3
+#define LED_UNUSED2 4
+#define LED_INIRQ 5
+#define LED_ASSERTION 6
+#define LED_PANIC 7
+
+/* Registers. 8052 regiser definitions are provided in the SDCC header
+ * file 8052.h. However, a few SFR registers are missing from that
+ * file (they can be found in mcs51reg.h, but that file is too much
+ * when the following simple addtions do the job).
+ */
+
+#ifndef __ASSEMBLY__
+sfr at 0xc9 T2MOD ;
+#endif
+
+/* Timing information.
+ *
+ * The PJRC board is based on a standard 87C52 CPU clocked at 22.1184 MHz.
+ * The CPU clock is divided by 12 to yield a clock frequency of 1.8432 MHz.
+ */
+
+#define CPU_CLOCK_HZ 22118400L
+#define TIMER_CLOCK_HZ 1843200L
+
+/* The 87C52 has three timers, timer 0, timer 1, and timer 2. On the PJRC
+ * board, timer 1 and 2 have dedicated functions. They provide baud support
+ * support for the boards two serial ports. Unfortunately, only timer 2
+ * can generate the accurate 100Hz timer desired by the OS.
+ *
+ * Timer 0 provides only a 8-bit auto-reload mode.
+ */
+
+#ifdef CONFIG_8052_TIMER2
+
+/* To use timer 2 as the 100Hz system timer, we need to calculate a 16-bit
+ * reload value that results in 100Hz overflow interrupts. That value
+ * is given by:
+ *
+ * Timer ticks = TIMER_CLOCK_HZ / (desired ticks-per-second)
+ * = 18432
+ * Capture value = 0xffff - (Timer ticks)
+ * = 47103 = 0x67ff
+ */
+
+# define TIMER2_CAPTURE_LOW 0xff
+# define TIMER2_CAPTURE_HIGH 0x67
+
+#else
+
+/* Timer 0, mode 0 can be used as a system timer. In that mode, the
+ * 1.8432 is further divided by 32. A single 8-bit value is incremented
+ * at 57600 Hz, which results in 225 Timer 0 overflow interrupts per
+ * second.
+ */
+
+#endif
+
+/**************************************************************************
+ * Public Function Prototypes
+ **************************************************************************/
+
+#endif /* __PJRC_H */
diff --git a/misc/Obsoleted/configs/pjrc-8051/sdcc-2.6.0.patch b/misc/Obsoleted/configs/pjrc-8051/sdcc-2.6.0.patch
new file mode 100644
index 000000000..beb8bf2ea
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/sdcc-2.6.0.patch
@@ -0,0 +1,28 @@
+diff -u sdcc/device/lib/Makefile.orig sdcc/device/lib/Makefile
+--- sdcc/device/lib/Makefile.orig 2007-03-06 09:55:01.000000000 -0600
++++ sdcc/device/lib/Makefile 2007-03-06 09:58:32.000000000 -0600
+@@ -242,7 +242,7 @@
+ model-mcs51-stack-auto:
+ if [ "`grep mcs51 $(top_builddir)ports.build`" = mcs51 ]; then \
+ for model in $(MODELS); do \
+- $(MAKE) MODELFLAGS="--model-$$model --stack-auto" PORT=$$model PORTDIR=$(BUILDDIR)/$$model-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
++ $(MAKE) MODELFLAGS="--model-$$model --stack-auto --int-long-reent --float-reent" PORT=$$model PORTDIR=$(BUILDDIR)/$$model-stack-auto PORTINCDIR=$(INCDIR)/mcs51 objects; \
+ done \
+ fi
+
+diff -u sdcc/device/include/stdarg.h.orig sdcc/device/include/stdarg.h
+--- sdcc/device/include/stdarg.h.orig 2007-03-11 13:21:15.000000000 -0600
++++ sdcc/device/include/stdarg.h 2007-03-11 13:26:59.000000000 -0600
+@@ -25,9 +25,9 @@
+
+ #else
+
+-typedef unsigned char __data * va_list ;
+-#define va_arg(marker,type) *((type __data * )(marker -= sizeof(type)))
+-#define va_start(marker,first) { marker = (va_list) ((char __data * )&first); }
++typedef unsigned char * va_list ;
++#define va_arg(marker,type) *((type * )(marker -= sizeof(type)))
++#define va_start(marker,first) { marker = (va_list) ((char * )&first); }
+
+ #endif
+
diff --git a/misc/Obsoleted/configs/pjrc-8051/setenv.sh b/misc/Obsoleted/configs/pjrc-8051/setenv.sh
new file mode 100755
index 000000000..621bb27b1
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/setenv.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# configs/pjrc-8051/setenv.sh
+#
+# Copyright (C) 2007-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.
+#
+
+if [ "$_" = "$0" ] ; then
+ echo "You must source this script, not run it!" 1>&2
+ exit 1
+fi
+
+WD=`pwd`
+if [ ! -x "setenv.sh" ]; then
+ echo "This script must be executed from the top-level NuttX build directory"
+ exit 1
+fi
+
+if [ -z "${PATH_ORIG}" ]; then
+ export PATH_ORIG="${PATH}"
+fi
+
+#
+# This is the normal installation directory for SDCC under Linux, OSX
+# or Linux:
+#
+export TOOLCHAIN_BIN=/usr/local/bin
+
+#
+# This is the normal installation directory for SDCC under Windows
+#
+#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/SDCC/bin"
+
+#
+# Add the path to the toolchain to the PATH varialble
+#
+export PATH="${TOOLCHAIN_BIN}":/sbin:/usr/sbin:${PATH_ORIG}
+echo "PATH : ${PATH}"
diff --git a/misc/Obsoleted/configs/pjrc-8051/src/.gitignore b/misc/Obsoleted/configs/pjrc-8051/src/.gitignore
new file mode 100644
index 000000000..04b280c8b
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/src/.gitignore
@@ -0,0 +1,15 @@
+/Make.dep
+/.depend
+/up_mem.h
+/*.sym
+/*.asm
+/*.rel
+/*.lst
+/*.adb
+/*.rst
+/*.lib
+/*.lnk
+/*.map
+/*.mem
+/*.ihx
+/*.hex
diff --git a/misc/Obsoleted/configs/pjrc-8051/src/Makefile b/misc/Obsoleted/configs/pjrc-8051/src/Makefile
new file mode 100644
index 000000000..0983153b0
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/src/Makefile
@@ -0,0 +1,75 @@
+############################################################################
+# configs/pjrc-8051/src/Makefile
+#
+# Copyright (C) 2007, 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)/Make.defs
+
+CFLAGS += -I$(TOPDIR)/sched
+
+ASRCS =
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+CSRCS = up_leds.c
+COBJS = $(CSRCS:.c=$(OBJEXT))
+
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
+
+CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src
+
+all: libboard$(LIBEXT)
+
+$(AOBJS): %$(OBJEXT): %.S
+ $(call ASSEMBLE, $<, $@)
+
+$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
+ $(call COMPILE, $<, $@)
+
+libboard$(LIBEXT): $(OBJS)
+ $(call ARCHIVE, $@, $(OBJS))
+
+.depend: Makefile $(SRCS)
+ $(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
+ $(Q) touch $@
+
+depend: .depend
+
+clean:
+ $(call DELFILE, libboard$(LIBEXT))
+ $(call CLEAN)
+
+distclean: clean
+ $(call DELFILE, Make.dep)
+ $(call DELFILE, .depend)
+
+-include Make.dep
diff --git a/misc/Obsoleted/configs/pjrc-8051/src/up_leds.c b/misc/Obsoleted/configs/pjrc-8051/src/up_leds.c
new file mode 100644
index 000000000..f2020b540
--- /dev/null
+++ b/misc/Obsoleted/configs/pjrc-8051/src/up_leds.c
@@ -0,0 +1,207 @@
+/************************************************************************
+ * up_leds.c
+ *
+ * Copyright (C) 2007, 2009, 2013 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * 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 "up_internal.h"
+
+/************************************************************************
+ * Definitions
+ ************************************************************************/
+
+#define RESET_KLUDGE_NEEDED 1
+
+/************************************************************************
+ * Private Data
+ ************************************************************************/
+
+static uint8_t g_ledstate;
+
+/************************************************************************
+ * Private Functions
+ ************************************************************************/
+
+#if defined(CONFIG_DEBUG_LEDS) && defined(CONFIG_ARCH_LEDS)
+static void _up_puthex(uint8_t hex) __naked
+{
+ hex; /* To avoid unreferenced argument warning */
+ _asm
+ mov a, dpl
+ ljmp PM2_ENTRY_PHEX
+ _endasm;
+}
+
+static void _up_putch(uint8_t ch) __naked
+{
+ _asm
+ mov a, dpl
+ ljmp PM2_ENTRY_COUT
+ _endasm;
+}
+
+static void _up_putnl(void) __naked
+{
+ _asm
+ ljmp PM2_ENTRY_NEWLINE
+ _endasm;
+}
+
+# define _up_showledinit() \
+ _up_putch('I'); \
+ _up_puthex(g_ledstate); _up_putch(':'); \
+ _up_puthex(p82c55_port_e); _up_putnl();
+
+# define _up_showledreset() \
+ _up_putch('R'); \
+ _up_puthex(led); _up_putch(':'); \
+ _up_puthex(g_ledstate); _up_putch(':'); \
+ _up_puthex(p82c55_port_e); _up_putnl();
+
+# define _up_showledon() \
+ _up_putch('+'); \
+ _up_puthex(led); _up_putch(':'); \
+ _up_puthex(g_ledstate); _up_putch(':'); \
+ _up_puthex(p82c55_port_e); _up_putnl();
+
+# define _up_showledoff() \
+ _up_putch('-'); \
+ _up_puthex(led); _up_putch(':'); \
+ _up_puthex(g_ledstate); _up_putch(':'); \
+ _up_puthex(p82c55_port_e); _up_putnl();
+
+#else
+
+# define _up_showledinit()
+# define _up_showledreset()
+# define _up_showledon()
+# define _up_showledoff()
+
+#endif
+
+/************************************************************************
+ * Public Funtions
+ ************************************************************************/
+
+/************************************************************************
+ * Name: board_led_initialize
+ ************************************************************************/
+
+#ifdef CONFIG_ARCH_LEDS
+void board_led_initialize(void)
+{
+ /* Set all ports as outputs */
+
+ p82c55_def_config = 128;
+
+ /* Turn LED 1-7 off; turn LED 0 on */
+
+ g_ledstate = 0xfe;
+ p82c55_port_e = g_ledstate;
+
+ _up_showledinit();
+}
+
+/************************************************************************
+ * Name: board_led_on
+ ************************************************************************/
+
+void board_led_on(uint8_t led)
+{
+ /* This may be called from an interrupt handler */
+
+ irqstate_t flags = irqsave();
+
+#ifdef RESET_KLUDGE_NEEDED
+ /* I don't understand why this happens yet, but sometimes
+ * it is necessary to reconfigure port E.
+ */
+
+ if (g_ledstate != p82c55_port_e)
+ {
+ _up_showledreset();
+ p82c55_def_config = 128;
+ }
+#endif
+
+ /* Clear the bit in port E corresponding to LED to turn it on */
+
+ if (led < 8)
+ {
+ g_ledstate &= ~(g_ntobit[led]);
+ p82c55_port_e = g_ledstate;
+ }
+
+ _up_showledon();
+ irqrestore(flags);
+}
+
+/************************************************************************
+ * Name: board_led_off
+ ************************************************************************/
+
+void board_led_off(uint8_t led)
+{
+ /* This may be called from an interrupt handler */
+
+ irqstate_t flags = irqsave();
+
+#ifdef RESET_KLUDGE_NEEDED
+ /* I don't understand why this happens yet, but sometimes
+ * it is necessary to reconfigure port E.
+ */
+
+ if (g_ledstate != p82c55_port_e)
+ {
+ _up_showledreset();
+ p82c55_def_config = 128;
+ }
+#endif
+
+ /* Set the bit in port E corresponding to LED to turn it off */
+
+ if (led < 8)
+ {
+ g_ledstate |= g_ntobit[led];
+ p82c55_port_e = g_ledstate;
+ }
+
+ _up_showledoff();
+ irqrestore(flags);
+}
+#endif /* CONFIG_ARCH_LEDS */